Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

When does order submit?

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

    When does order submit?

    Hey guys, in efforts to avoid slippage I was curious to know how soon an order would submit within a script. For example, if you have a long script with an "Enterlong" statement in the middle of the code, would the order submit at the point the script hits that line, or does it submit at the end of the BarUpdate code? Assuming that CalculateonBarClose=true.

    Thanks,
    EliteTraderNYC

    #2
    Hello EliteTraderNYC,

    NinjaTrader is an event driven so your EnterLong call would happen after the end of the OnBarUpdate() method. Using CalculateOnBarClose set to true OnBarUpdate() will be called at the end of the bar so the order will be submitted after OnBarUpdate() finishes processing.

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thanks for the information. Do you have any tips for avoiding slippage for my scripts for ES executions? I want to make them as efficient as possible.

      Comment


        #4
        Originally posted by elitetradernyc View Post
        Thanks for the information. Do you have any tips for avoiding slippage for my scripts for ES executions? I want to make them as efficient as possible.
        Limit orders by definition and execution have only no slippage or favorable slippage. If you want efficient entry, use Limit orders at the price that you want to enter. The downside, is that in a sudden surge, your entry may never be filled.

        Comment


          #5
          Hello elitetradernyc,

          Yes, you may want to do as koganam suggested and use Limit orders.

          When backtesting keep in mind that the fill prices are going to be determined based on the OHLC of a bar and the Fill type selected. If you want a more expected fill price using a limit order with a specific price, you may use a Fill type to get the result.

          The two Fill types are Default, and Liberal:

          Default- An algorithm that takes a conservative and more realistic approach to filling limit and stop limit orders.

          * Limit orders only fill if the limit price was penetrated

          * Limit orders are always filled at the limit price specified never better (for example, if a limit order is submitted on bar n, NinjaTrader will check if the order is filled on bar n+1, if this bar gaps down and the limit order was a buy, the order would be filled at the limit price and NOT the high of bar n+1)

          Liberal - An algorithm that takes a liberal approach to filling limit and stop limit orders.

          * Limit orders fill if the limit price was touched

          * On gap down bars, buy limit orders will fill at the high of the gap down bar

          * On gap up bars, sell limit orders will fill at the low of the gap up bar

          For more information about historical Fill types you may read the following link.

          http://www.ninjatrader.com/support/h...a_strategy.htm
          JCNinjaTrader Customer Service

          Comment


            #6
            What about adding a secondary period (1 tick/1 range) and submitting orders on that period?

            Comment


              #7
              Hello nailz420,

              Yes, you may add intrabar granularity to help with your fills Historically as well.
              JCNinjaTrader Customer Service

              Comment


                #8
                Koganam, thanks for your response, but this is my concern about limit orders. I heard that with Limits, if you miss the price, then it may move away from you, and this would make backtesting with limit orders useless because it does not mimic what would happen if you missed the limit. Am I correct or no?

                Thanks,
                EliteTraderNYC

                Originally posted by koganam View Post
                Limit orders by definition and execution have only no slippage or favorable slippage. If you want efficient entry, use Limit orders at the price that you want to enter. The downside, is that in a sudden surge, your entry may never be filled.

                Comment


                  #9
                  Hello EliteTraderNYC,

                  By miss the price, do you mean that the price did not touch our order or are you referring to as a broker did not fill your order?
                  JCNinjaTrader Customer Service

                  Comment


                    #10
                    Lets say hypothetically the broker doesn't fill your order, is that simulatable? whats the solution?

                    Comment


                      #11
                      Originally posted by elitetradernyc View Post
                      Koganam, thanks for your response, but this is my concern about limit orders. I heard that with Limits, if you miss the price, then it may move away from you, and this would make backtesting with limit orders useless because it does not mimic what would happen if you missed the limit. Am I correct or no?

                      Thanks,
                      EliteTraderNYC
                      That is the point that I made. In a fast moving market Limit Orders might not get filled, because the market will simply not retreat to put one in. That is the price of efficient entry. To me, it does not matter: trades are like buses; if you miss one, there will be another along soon enough. I would rather be out of a trade wishing that I were in, than in a trade wishing that I were out, which is often the case if you get very large slippage with a market order. I have seen /TF jump 1 full point between updates, meaning potentially at least $100/contract slippage on a market order in such a case.

                      The second thing is that you probably should not put so much store in backtest. They do not need to be as accurate as you seem to want for a very simple reason.

                      The only real/valid use of a backtest is to answer the question: "Given perfect knowledge of the future, would my system have made money?". In other words, you use a backtest to decide if you need to do further investigation towards using the system, because if the system cannot make money in backtest, there is a probability, bordering on certainty, that the system cannot make money in real time.

                      Given that aegis, what does it really matter if a few trades are not taken because the market does not retreat. If that is the case, that is what would have happened in reality anyway, so that is all to the good. Of course, you can switch to Market Orders, but in fact, in backtest, Market Orders will probably underestimate slippage, relative to reality, and will actually give you results which are likely more deceptive.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by t.kelly4149, Today, 05:36 PM
                      1 response
                      5 views
                      0 likes
                      Last Post bltdavid  
                      Started by SilverSurfer1, Today, 06:29 PM
                      0 responses
                      15 views
                      0 likes
                      Last Post SilverSurfer1  
                      Started by trader3000a, Today, 01:06 PM
                      1 response
                      9 views
                      0 likes
                      Last Post NinjaTrader_ShawnB  
                      Started by marcus2300, Today, 11:45 AM
                      3 responses
                      31 views
                      0 likes
                      Last Post marcus2300  
                      Started by pel11, Today, 11:06 AM
                      0 responses
                      12 views
                      0 likes
                      Last Post pel11
                      by pel11
                       
                      Working...
                      X