Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
ATR Profit Target
Collapse
X
-
Stupid question. Can i get it to print just the first bar that the target is hit on? It colors all bars after as well, as it is performing the colorbar calc for each new bar close.Originally posted by NinjaTrader_Bertrand View PostYou could then simply change the barcolor if the target / stop loss activation triggers via your code. You would then have a visual market once this process starts to kick in.
Code:// If a long position is open, allow for stop loss modification else if (Position.MarketPosition == MarketPosition.Long) { // Once the price is greater than entry price+3*ATR, set stop loss to recent bar close - 1.5ATR if (Close[0] > Position.AvgPrice + (ATR(14)[0]) * atrtargetx) { BarColorSeries[0] = Color.Blue;} {SetStopLoss(CalculationMode.Price, Close[0] - (ATR(14)[0] * atrstopx)); }
Comment
-
Finally figured out how to code the bool flag in. Perfect! thanksOriginally posted by NinjaTrader_Bertrand View PostRight...then you could combine that with a bool flag you reset once the position flat, that means it will 'guard' you against a recoloring for the time you're in the trade as desired.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
656 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
371 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
579 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment