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 Waxavi, 04-19-2024, 02:10 AM
        4 responses
        53 views
        0 likes
        Last Post sonia0101  
        Started by cmtjoancolmenero, Today, 03:58 PM
        0 responses
        3 views
        0 likes
        Last Post cmtjoancolmenero  
        Started by Segwin, 05-07-2018, 02:15 PM
        11 responses
        1,777 views
        0 likes
        Last Post aligator  
        Started by trilliantrader, Today, 03:01 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by geddyisodin, Today, 05:20 AM
        6 responses
        36 views
        0 likes
        Last Post geddyisodin  
        Working...
        X