Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A Short Order without having that instruction in the Strategy Builder

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

    A Short Order without having that instruction in the Strategy Builder

    First the Calculate on the Strategy Builder is Calculate on each tick.

    I have a strategy that has a TAB with conditions:
    Market = Flat
    Other Conditions
    Do EnterLong()

    In other TABS I have as conditions:
    Market = Long
    Other Conditions
    Do ExitLong()

    Today with one contract, I had an order to buy, next an order to sell and then another order to sell. It means a ShortOrder has been created that does not exist in my strategy. I ask if I'm failing at something in the logic of my strategy.

    #2
    Hello Mastercom,

    I would suggest adding a print into your exit condition to see if the exit is being submitted twice. If you are using OnEachTick and your condition keeps calling the exit method while the position is still open and before the exit fills you may duplicate that order. To avoid that you can add logic to the exit condition so it only gets called once or use a different calculate mode like OnPriceChange.

    Comment


      #3
      Thank you for the quick response. What kind of logic can I use to make sure that the exit condition is only called once using the Calculate on each tick, because it is observed that the condition that Market=Long is not enough in real time.

      Comment


        #4
        Hello Mastercom,

        You could use a bool variable for that purpose. Have the default value of false. In the exit condition check if the value of that bool is false as part of the condition. In the action for that condition set it to true. In another set you can check the position for flat and if its flat reset the bool to false so it can take future exits.

        Comment


          #5
          Thanks a lot. I think that solution is the simplest and most efficient.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          86 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          151 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          79 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          53 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          61 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X