NexusFi: Find Your Edge


Home Menu

 





PriceLine indicator from Current Bar


Discussion in NinjaTrader

Updated
    1. trending_up 365 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 2 attachments




 
Search this Thread
  #1 (permalink)
 rx13 
Delhi, India
 
Experience: Intermediate
Platform: NinjaTrader, others
Trading: Future and Options
Frequency: Every few days
Duration: Days
Posts: 24 since Mar 2023
Thanks Given: 21
Thanks Received: 16

I was wondering if anyone can help me with a PriceLine indicator for NT8 that starts from the last bar (current forming bar) to the right edge of the chart ? I had one of those indicators but unfortunately can't find it anymore after my system crashed.

The PriceLine indicator in Ninjatrader has to be manually set as % of chart screen which changes if I re-arrange my charts. Other indicators that I found, draws a full horizontal line across the entire chart.

I just need the line to start from current forming bar to right edge of price scale.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Alternative for Volume Spread Scalper Indicator
Traders Hideout
Tradestation Chart Setup
TradeStation
How to look up market depth?
MultiCharts
Reliable Prop Firms for FGBL/Eurex?
Traders Hideout
Experience with this Trading Indicator/System from www.p …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tariffs and what comes next...
13 thanks
$TRUMP Crypto coin: Facts, Legality, and Controversies
7 thanks
For DOM based traders. (ES/NQ)
6 thanks
My hunt for the Automated Holy Grail
4 thanks
For DOM based traders. (ES/NQ)
3 thanks
  #2 (permalink)
 Miesto 
Monte Carlo, Monaco
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: Futures
Posts: 690 since May 2012
Thanks Given: 846
Thanks Received: 1,227


rx13 View Post
I was wondering if anyone can help me with a PriceLine indicator for NT8 that starts from the last bar (current forming bar) to the right edge of the chart ? I had one of those indicators but unfortunately can't find it anymore after my system crashed.

The PriceLine indicator in Ninjatrader has to be manually set as % of chart screen which changes if I re-arrange my charts. Other indicators that I found, draws a full horizontal line across the entire chart.

I just need the line to start from current forming bar to right edge of price scale.

You can use the attached file or change the code yourself.

Copy the NT PriceLine indicator (open the file in the NinjaScript Editor > right mouse click in de code > Save as) and name it PriceLineActiveBar.

Then change line 121 from:

"float startX = Convert.ToSingle(panel.X + panel.W * (1 - LastLineLength / 100.0));"

to

"float startX = ChartControl.GetXByBarIndex(ChartBars, BarsArray[0].Count-1);"

Save and Compile and you're ready.

To use the attached "PriceLineActiveBar.cs" file:

Copy the file to: "...\Documents\NinjaTrader 8\bin\Custom\Indicators"

Open the NinjaScript Editor (from the Control Panel Select New > NinjaScript Editor) > Open PriceLineActiveBar (under indicators) > Compile. Close the editor and you're ready to go.


Attached Files
Elite Membership required to download: PriceLineActiveBar.cs
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
 rx13 
Delhi, India
 
Experience: Intermediate
Platform: NinjaTrader, others
Trading: Future and Options
Frequency: Every few days
Duration: Days
Posts: 24 since Mar 2023
Thanks Given: 21
Thanks Received: 16



Miesto View Post
You can use the attached file or change the code yourself.

Copy the NT PriceLine indicator (open the file in the NinjaScript Editor > right mouse click in de code > Save as) and name it PriceLineActiveBar.

Then change line 121 from:

"float startX = Convert.ToSingle(panel.X + panel.W * (1 - LastLineLength / 100.0));"

to

"float startX = ChartControl.GetXByBarIndex(ChartBars, BarsArray[0].Count-1);"

Save and Compile and you're ready.

To use the attached "PriceLineActiveBar.cs" file:

Copy the file to: "...\Documents\NinjaTrader 8\bin\Custom\Indicators"

Open the NinjaScript Editor (from the Control Panel Select New > NinjaScript Editor) > Open PriceLineActiveBar (under indicators) > Compile. Close the editor and you're ready to go.

THANK YOU !!!! This is exactly what I needed.
For anyone who is interested, I have attached the add-on zip file for NT8. All credit goes to Miesto for the code change.


Attached Files
Elite Membership required to download: PriceLineActiveBar.zip
Started this thread Reply With Quote
Thanked by:
  #4 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 Vendor: www.innovative-trading-solutions-online.com 
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: ES
Posts: 686 since Jun 2009
Thanks Given: 763
Thanks Received: 789

rx13,

This is a lot of code for drawing just this line. All you need is a Draw.Ray pointing forward. prior bar price Close[0] towards CurrentBar price Close[0].

Done.

RJay


Reply With Quote




Last Updated on February 25, 2025


© 2025 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts