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 NullPointStrategies, Today, 05:17 AM
|
0 responses
38 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
64 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
41 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment