Can I check if (myOrder == null) to do this? After a pending order is executed, I assume myOrder will be "null", correct?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to avoid sending a repeated EnterLong()?
Collapse
X
-
How to avoid sending a repeated EnterLong()?
When all conditions are met, I will submit myOrder = EnterLongLimit(0, true, 100, 24.86, "BUY", ). But I don't want to submit any new order before the first one is executed. What's the best way to prevent this?
Can I check if (myOrder == null) to do this? After a pending order is executed, I assume myOrder will be "null", correct?
Tags: None
-
Hello localappleseed,
That is the generally suggested approach however that also relies on setting the order to the variable as early as possible. Depending on the provider you are using that is often going to be the first time you see the order from OnOrderUpdate.
If you are doing something where this would be true again faster than an order update event, for example on the next tick or in a loop, you might want to instead look at using a variable like a bool to control the logic flow. You could set a bool to true in the entry condition and prevent the condition if the bool is true. You could later reset that with the order states and when you set the order to null.
More that likely using the order object is going to be sufficient so you can monitor the order through its life and also base your logic around that orders life.
I look forward to being of further assistance.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
44 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
65 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 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