Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

built-in order safeguards

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

    built-in order safeguards

    Hi,
    I just got the following message:

    **NT** A BuyToCover stop order placed at '12/07/2011 22:01:00' has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.
    I understand the violation, and its a very good thing NT catches this.
    My question is where I can find the set of rules by which NT determines that an order is invalid?
    I would like to problematically check for those before sending any orders.

    Many thanks,
    Boaz

    #2
    Boaz, you would need to check your stop orders against the current inside market (bid / ask) to ensure the order price fits as needed and would not be rejected. If you like to deal with rejections liks those in your code, then the realtime error handling could be turned off (http://www.ninjatrader.com/support/h...orhandling.htm)
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand,
      I'd be happy if you could elaborate:
      1. What do you mean by 'fits as needed'? What are the legal/illegal boundaries for stop loss orders in live and in simulation?
      2. Is it possible to access the current bid/ask prices in live, while the strategy has CalculateOnBarClose is true?
      3. Are there any corresponding rules for Limit orders? Is it valid to place 'marketable' limit orders, namely orders which can be filled immediately?


      Thanks,
      Boaz

      Comment


        #4
        Boaz, limit orders can be marketable yes.

        Stop orders need to be valid, meaning for a buy stop order it has to be placed above the current market or else it would be rejected.

        For your scripts, work with CalculateOnBarClose = false and use GetCurrentBid / Ask for example, for logic to be executing on the close of the bar only, place it in FirstTickOfBar.

        BertrandNinjaTrader Customer Service

        Comment


          #5
          Bertrand,

          I'm assuming that by 'above the current market', you mean that for Sell stop orders, the stop price must be below the current bid, whereas for Buy stop orders, the price has to be above the current ask. Is that correct?

          As for working with 'CalculateOnBarClose = false' - are there any implications besides having to shift indices of indicators by one? Can I still use multi-time frames?

          Thanks,
          Boaz

          Comment


            #6
            I'm assuming that by 'above the current market', you mean that for Sell stop orders, the stop price must be below the current bid, whereas for Buy stop orders, the price has to be above the current ask. Is that correct?
            Correct, the inside market is the reference.

            As for working with 'CalculateOnBarClose = false' - are there any implications besides having to shift indices of indicators by one? Can I still use multi-time frames?
            Yes MultiTimeFrames can still be used, however of course indices used must be adapted as you already noted.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Bertrand,

              Using 'CalculateOnBarClose = false' is currently too big a shift for me.
              I'm sending the stop order not in OnBarUpdate(), but in OnExecution(), as demonstrated here.
              • Can I still access the GetCurrentBid() and GetCurrentAsk() methods in OnExecution, even though 'CalculateOnBarClose = true'?
              • How would the simulator behave in this case?

              Comment


                #8
                boaza, I'm not sure what exactly you mean with your simulator question - for the Bid / Ask values to compare it would be best if you stored them in OnMarketData() to variables which you would refer to in your OnExecution() then, those would hold then the last known bid / ask events.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Thanks Bertrand,
                  • By 'Simulation' I mean that currently I only simulate bar data. Is there a way I can avoid going to tick-by-tick simulation?
                  • As for storing the last bid/ask in OnMarketData() - any idea how would this effect execution performance in real time?

                  Comment


                    #10
                    boaza, if you want to use CalculateOnBarClose = false, this would be tick by tick simulation. It's your script design that dictates whether you would set this true / false.

                    Storing a value from OnMarketData() should not contribute to a significant performance hit.
                    Ryan M.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by benmarkal, Yesterday, 12:52 PM
                    3 responses
                    22 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by helpwanted, Today, 03:06 AM
                    1 response
                    18 views
                    0 likes
                    Last Post sarafuenonly123  
                    Started by Brevo, Today, 01:45 AM
                    0 responses
                    11 views
                    0 likes
                    Last Post Brevo
                    by Brevo
                     
                    Started by aussugardefender, Today, 01:07 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post aussugardefender  
                    Started by pvincent, 06-23-2022, 12:53 PM
                    14 responses
                    244 views
                    0 likes
                    Last Post Nyman
                    by Nyman
                     
                    Working...
                    X