Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to avoid sending a repeated EnterLong()?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?


    #2
    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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    89 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X