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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        67 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        36 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        60 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X