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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        49 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        15 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        21 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X