Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    BertrandNinjaTrader Customer Service

    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.

        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by LiamTwine, Today, 08:10 AM
        0 responses
        2 views
        0 likes
        Last Post LiamTwine  
        Started by Balage0922, Today, 07:38 AM
        0 responses
        5 views
        0 likes
        Last Post Balage0922  
        Started by JoMoon2024, Today, 06:56 AM
        0 responses
        6 views
        0 likes
        Last Post JoMoon2024  
        Started by Haiasi, 04-25-2024, 06:53 PM
        2 responses
        19 views
        0 likes
        Last Post Massinisa  
        Started by Creamers, Today, 05:32 AM
        0 responses
        6 views
        0 likes
        Last Post Creamers  
        Working...
        X