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.JesseNinjaTrader Customer Service
-
Originally 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
-
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
-
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 JoMoon2024, Today, 06:56 AM
|
0 responses
6 views
0 likes
|
Last Post
by JoMoon2024
Today, 06:56 AM
|
||
Started by Haiasi, 04-25-2024, 06:53 PM
|
2 responses
17 views
0 likes
|
Last Post
by Massinisa
Today, 05:32 AM
|
||
Started by Creamers, Today, 05:32 AM
|
0 responses
6 views
0 likes
|
Last Post
by Creamers
Today, 05:32 AM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
12 responses
1,786 views
0 likes
|
Last Post
by Leafcutter
Today, 05:30 AM
|
||
Started by poplagelu, Today, 05:00 AM
|
0 responses
3 views
0 likes
|
Last Post
by poplagelu
Today, 05:00 AM
|
Comment