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 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