Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Looking for indicator to show profit target at given # ticks beyond the previous bar
Collapse
X
-
Looking for indicator to show profit target at given # ticks beyond the previous bar
Pretty much what the title says. I'm looking for an indicator where I can set my profit target at, say, 4 ticks, and the indicator will put a little line on the chart showing where that is (above & below) the previous bar like in the attached pic. I searched the NT indicator page but didn't find anything. Anyone know of an indicator that would do this?Tags: None
-
Hello EnveousColnago,
I am not aware of an item like that myself but that would be fairly simple to create using the Ray drawing object.
You can generate a new empty indicator and place the following inside it to draw with an offset:
Code:protected override void OnBarUpdate() { if(CurrentBar < 1) return; double highPrice = High[1] + (4 * TickSize); double lowPrice= Low[1] - (4 * TickSize); Draw.Ray(this, "HighRay", 1, highPrice, 0, highPrice, Brushes.LimeGreen); Draw.Ray(this, "LowRay", 1, lowPrice, 0, lowPrice, Brushes.Red); }Last edited by NinjaTrader_Jesse; 08-01-2022, 07:49 AM.
-
Thank you! How do I go about converting this code to an indicator? I'm on NT8 btw. I tried New > Ninjascript Editor > right click indicators > New Indicator, then pasting the above code, but it's giving me a bunch of errors. Also tried pasting code into notepad file, changing extension to .cs, zipping in a folder, and importing, but in that case it said it was incompatible with my version of NTOriginally posted by NinjaTrader_Jesse View PostHello EnveousColnago,
I am not aware of an item like that myself but that would be fairly simple to create using the Ray drawing object.
You can generate a new empty indicator and place the following inside it to draw with an offset:
Code:if(CurrentBar < 1) return; double highPrice = High[1] + (4 * TickSize); double lowPrice= Low[1] - (4 * TickSize); Draw.Ray(this, "HighRay", 1, highPrice, 0, highPrice, Brushes.LimeGreen); Draw.Ray(this, "LowRay", 1, lowPrice, 0, lowPrice, Brushes.Red);
Comment
-
Those targets and stops are reserved for strategies in NT8.Originally posted by EnveousColnago View Post
Thank you! How do I go about converting this code to an indicator? I'm on NT8 btw. I tried New > Ninjascript Editor > right click indicators > New Indicator, then pasting the above code, but it's giving me a bunch of errors. Also tried pasting code into notepad file, changing extension to .cs, zipping in a folder, and importing, but in that case it said it was incompatible with my version of NT
Comment
-
Thank you!Originally posted by NinjaTrader_Jesse View PostHello EnveousColnago,
Those are the correct steps to create an indicator, it sounds like you pasted it in the wrong location. This code would go inside the curly braces below OnBarUpdate: I updated the previous post to show OnBarUpdate
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
556 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 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
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment