Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to have a running stop order
Collapse
X
-
How to have a running stop order
I am trying to create a strategy where once the price crosses a certain level I am entered into the position. Thus I do not want to enter at market or something on the next bar but I instead would be looking for something like a rolling stop order. Just for example, let's assume that I want to take a long position as soon as price crosses above a 50 period EMA. Is there a way that I can have a stop order resting on the EMA so that as soon as the price crosses above it (not closes above it) then I'll be entered, even if it is intra-bar?Tags: None
-
Hello JVP3122
Thanks for your post and questions.
To assure intrabar response you will need to set CalculateOnBarClose to false so that your code is evaluated on each tick and so that when the order condition is true that your order is immediately placed.
Next concerning the code would be to place a stop order at the EMA(50) level, continually adjusting on each tick.
In the case of price coming up to the EMA 50 and you want to go long when it touches the EMA(50) you would code:
if (High[0] < EMA(50)[0])
{
EnterLongstop(1, EMA(50)[0], "EMACrossUpEntry"); // Set at price of EMA(50)
}
Here is the help guide on EnterLongStop: http://www.ninjatrader.com/support/h...erlongstop.htm
Alternatively you can use EnterLongStopLimit which gives you tighter control, here is the help guide reference: http://www.ninjatrader.com/support/h...gstoplimit.htm
Please let me know if I can be of further assistance.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
627 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
359 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 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
562 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
568 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment