Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with "double" entries

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

    Problem with "double" entries

    Hi

    I have a strategy code which in most situations performs exactly as expected except for one.

    Generally, for isolated trades, it works according to expectation but when one trade is immediately followed by another trade, problems - two entries instead of one - arise.

    For example, if I had a long position, a signal occured for me to reverse the position, the code for that would be EnterShort();. Another portion of the code, which helps manage a position triggers a ExitLong() at the same time. The same situation also occurs for short positions.

    Is there any way I can avoid a doubling of my position? If so, how do I go about doing that?

    Regards

    Kay Wai

    #2
    Hi Kay, so the strategy is not always reversing then? You would need to ensure the ExitLong() is then not called if a signal to reverse is being prepared for the next bar by the conditions.

    Comment


      #3
      That's correct Bertrand! Any suggestions how I can do that?

      Comment


        #4
        Unfortunately no generic ones, it would really be custom code dependent - so I suggest you simplify your code and understand why and when it occurs so you could then work in ways to prevent it.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        637 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        572 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X