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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
47 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
33 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
51 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment