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

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 geddyisodin, Yesterday, 05:20 AM
                    8 responses
                    49 views
                    0 likes
                    Last Post geddyisodin  
                    Started by DayTradingDEMON, Today, 09:28 AM
                    3 responses
                    19 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by Stanfillirenfro, Today, 07:23 AM
                    9 responses
                    23 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by George21, Today, 10:07 AM
                    0 responses
                    8 views
                    0 likes
                    Last Post George21  
                    Started by navyguy06, Today, 09:28 AM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Working...
                    X