NexusFi: Find Your Edge


Home Menu

 





PriceLine indicator from Current Bar


Discussion in NinjaTrader

Updated
    1. trending_up 1,412 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: 28 since Mar 2023
Thanks Given: 24
Thanks Received: 18

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?
My Rant with AMP Futures
Trading Reviews and Vendors
No book, only a stair: journaling fills where price move …
Cryptocurrency
What we know about Binances $6.3bn hack - BBC News
Cryptocurrency
Building a free browser DOM/SMC simulator - need some ad …
Platforms and Indicators
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
 
  #2 (permalink)
 Miesto 
Monte Carlo, Monaco
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: Futures
Posts: 739 since May 2012
Thanks Given: 900
Thanks Received: 1,307


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: 28 since Mar 2023
Thanks Given: 24
Thanks Received: 18



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: 687 since Jun 2009
Thanks Given: 765
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


© 2026 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