Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit order - what's wrong

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

    Limit order - what's wrong

    Hello,

    Here is my code, the backtest seems not react well. What's wrong ?

    I got one buy entry order (first line)
    One target limit (second line)
    One stop loss limit (third line)

    Thanks a lot !
    Attached Files

    #2
    After,

    Thank you for your note.

    What is the issue you are having with the backtest?

    Is it the Exit orders not getting placed?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Exactly, exit orders don't works ! Entry order seems to be okay (not sure but it looks like)

      Comment


        #4
        After,

        More than likely these orders are getting ignored as the position will not be updated on the same bar update that the entry order is being submitted on.

        You would want to remove them from the same condition that the entry is being placed and have a separate condition to check when you are either long or short and then place working Exit orders.

        Additionally, you can use OnOrderUpdate() or OnExecution() to get when the entry has indeed filled and then submit working protective orders -
        http://www.ninjatrader.com/support/f...ead.php?t=7499
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Thanks ! It works

          But If at the beginning of the day I would like to have one entry order which could be trigerred only once during the day, how should I do ?

          Because if I left this line (entry order) with Exit order line, the entry order can be triggered again then...

          Comment


            #6
            After,

            Your EntriesPerDirection setting will handle this portion. If this is set to 1, then only one entry order per direction will be available for this.

            Additionally, you can do a MarketPosition check for the order and ensure you are flat before submitting the order.

            if(Position.MarketPosition == MarketPosition.Flat)
            EnterLong()
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Hi Cal, thanks for answering ! But it doesn't work

              At the openning of the day I would like to set-up :

              -An entry limit order (only trigerred once in the day)
              -A target exit limit order
              -A stop exit limit order

              Do you have any sample to show me how I can do this ?

              Comment


                #8
                After,

                Apologies, I misunderstood the question.

                You would want to use a bool that you would check for the entry order. When the condition is true to submit the limit order you would then set the bool to false.

                You can then use Bars.FirstBarOfSession to get the new day and use this to reset your bool back to true.

                http://www.ninjatrader.com/support/h...rofsession.htm
                Cal H.NinjaTrader Customer Service

                Comment


                  #9
                  Do you mean entry limit order need to be read just once at the beginning of the day (and then order is waiting till trigerred) while Exit limit order need to be read at each candle ?

                  Comment


                    #10
                    After,

                    If you are using the overload to have it LiveUntilCancelled set to true than yes, otherwise it will cancel at the end of the bar when the condition is no longer true.
                    EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName)

                    http://www.ninjatrader.com/support/h...rlonglimit.htm
                    Cal H.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    648 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    369 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    108 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    572 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    573 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X