• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.

        http://www.ninjatrader.com/support/f...ad.php?t=19387
        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 MNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by bomanpbm, Yesterday, 09:27 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post bomanpbm  
                    Started by tgn55, Yesterday, 08:47 AM
                    0 responses
                    8 views
                    0 likes
                    Last Post tgn55
                    by tgn55
                     
                    Started by ballboy11, 05-04-2019, 10:26 AM
                    6 responses
                    58 views
                    0 likes
                    Last Post Kermit
                    by Kermit
                     
                    Started by mrlucky1x, 06-14-2019, 10:01 PM
                    0 responses
                    15 views
                    0 likes
                    Last Post mrlucky1x  
                    Started by roger556, 06-14-2019, 09:22 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post roger556  
                    Working...
                    X