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 argusthome, Yesterday, 10:06 AM
|
0 responses
17 views
0 likes
|
Last Post
by argusthome
Yesterday, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
16 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
14 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
9 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
38 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment