Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

new order overlaps settrailstop close ?

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

    new order overlaps settrailstop close ?

    Hello, i am testing a simple strategy based in SampleMACrossOver and i had some problems when settrailstop long close position and inmediatly a short position was created.

    The platform sent 2 short positions but the strategy programming only want to send 1. Whats happend?

    The CalculateOnBarClose is initialize to false but, when i send an order i test if the if(Position.MarketPosition.ToString() != "Long" or "Short" ...

    I think musnt entry 2 times...


    I attached 2 images and the .cs file.






    Attached Files

    #2
    marynja, it would definitely send 2 in the managed approach to reverse you with the EnterMethods. You're closing out the prior long (1 qty) and entering the new short (1qty). This means you're net short 1 contract, as the other one is needed to offset the prior long.

    Comment


      #3
      Hello Bertrand, thank you.

      This error is strange, dont happends all the times, then i think there are something more.

      Could you help me whats the best and more safe method for launch orders in strategies?

      Thank you again.

      Comment


        #4
        marynja, the behavior you describe would be expected for the Enter() methods in the managed approach. If you don't want them to reverse for you, then for example working in the more advanced unmanaged approach would be ideal, here you directly just execute the qty you specify in your SubmitOrder call via the script.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        61 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        148 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        98 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X