Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Price crossover my line
Collapse
X
-
Price crossover my line
Hi , I will draw Lines and Channels from my Indicator. I want to take action when prices cross-over the line. I also want to calculate the price difference between current bar Low/High and my Line. What are the support available in Ninja Script? Kindly guide me.Tags: None
-
Hello nandhumca,
Thank you for your post.
You will need to calculate what value the line has at that particular bar and then compare the current price and bar low/high to that. The YAxisProjectionOfLine script my colleague Paul created at the link I also provided on your other post will demonstrate how you can calculate the price of a line at a specific bar:
https://ninjatrader.com/support/forum/forum/ninjatrader-8/add-on-development/107312-price-crossing-a-line#post828663
Please let us know if we may be of further assistance to you.
-
Hi Kate, I have used the sample code you shared to draw line from indicator. When I draw line from Y1 to Y2, the line is going into center of the Bar (marked in blue line in circle of attached image). But I want to draw the line on the Edge of the bar (marked in yellow line in circle attached. Kindly guide me how set the Y2 as edge of the bar.
Comment
-
Hello nandhumca,
Thank you for your reply.
That's a bit tricky, you'd need to calculate exactly at what price the yellow line crosses the center of the bar and use that as your Y2 value instead of what you're using for the blue line, there wouldn't be a way to just snap the blue line to the corner of the bar.
Please let us know if we may be of further assistance to you.
Comment
-
Hello nandhumca,
Thank you for your reply.
The problem is that you can't tell it to just snap to that corner of the bar since that corner's between time slots for the bar.
You would have to modify the calculations to move the line to a different slope to do that, and I don't really have any exact guidance for that as I don't know what calculations you're using to place the line in the first place.
Please let us know if we may be of further assistance to you.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
563 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
329 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
547 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
548 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment