Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
strategy limit order - stop chasing the candles
Collapse
X
-
strategy limit order - stop chasing the candles
Hi, I know I've seen the answer in here somewhere, but can't find it. How do i tell the strategy to stop moving the limit order up as candles close higher above it?Tags: None
-
if ((Close[0] > Open[0])
&& (Close[1] > Open[1]))
{
EnterLongLimit(Convert.ToInt32(DefaultQuantity), Median[0], "");
}
i'm sure it just keeps checking for 2 consecutive green candles if I'm flat, and then placing a new limit each time if the limit doesn't get hit, so i guess I'm wondering how to tell it to stop checking once the initial limit order is placed
Comment
-
Hello,
Thank you for your reply.
You could certainly use a bool. For example, if you make a bool called OrderPlaced, and set that to false, check that it's false before entering the order, then flipping the bool to true, you could then monitor in OnOrderUpdate for the order to be filled or cancelled and flip the bool back to false when that occurs to keep the order from firing again. Keep in mind that with limit orders the default behavior is to cancel the order once the conditions for entry are no longer true, so it'll get cancelled once the current and prior bar are no longer rising bars. If you want the order to stay live until cancelled, you can do that. Here's an example from our help guide on how to keep an order alive:
Please let us know if we may be of further assistance to you.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
92 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
138 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
121 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
72 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment