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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
68 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
37 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
62 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
62 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
53 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment