i am trying to setup in the initialize method but dunno how to set ATR(14) value as the stop. how do i do do it.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
setup stop on multitimeframe strategy
Collapse
X
-
Hello,
Thank you for your forum post.
You will not want to set SetStopLoss in initialize if you are using a stop that will change. This needs to be down in OnBarUpdate();
You must set your stop before you submit your entry so that it is in the correct BarsInProgress check and gets the correct value.
So before you use EnterLong() for example to get into your trade set you stop.
SetStopLoss(YourStopPriceHere);
EnterLong();
Set YourStopPriceHere variable with whatever price you want to use. If you want to use an ATR specify ATR[0] here.
Let me know if I can be of further assistance.BrettNinjaTrader Product Management
-
Hello,
Sure you will use CalculationMode.Ticks. You will want to insure that ATR()[0] is in fact a value integer. So you would want to typecast/convert to an int for this to make sure there are no issues.
int stopLoss = (int)ATR(14)[0];
then SetStopLoss(CalculationMode.Ticks, stoploss);
Let me know if I can be of further assistance.
BrettNinjaTrader Product Management
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
419 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
278 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
238 views
1 like
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
324 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
287 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment