Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slippage

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

    Slippage

    In order to reduce slippage for my strategy I am going to stop using market orders and start using limit orders. I was wanting to know if there is a way to use Ninja Trade to assess slippage so I can determine where to set my limit orders. Is slippage factored into real-time simulation trading?

    I realize that a limit order will reduce the possibility of my order being filled, but is there any possibility of being filled exceeding the limit after the limit order is placed?

    I am working on my strategy with the Strategy Wizard initially before unlocking the code, I am looking for a way to set my limit price as a set number of pips, plus or minus (if I am going long or short) from the current value of the future. Say I want to enter a long position by a limit order, how would I set the limit order to 2 pips greater than the value of the future the moment my strategy places the order?

    I was also wanting to examine my chart data in excel, is there a way to export chart data? If so does it matter if it is a Renko chart?

    Thanks

    #2
    Hi Chris, the slippage would be directly factored in as the fills you get using market orders (either on the simulator or in live trading). In backtesting you could set slippage as input as # of ticks, so it would be considered into the executions generated off historical data there.

    The limit order would mean you want to get filled at your price specified or better (though never worse). Chances of fills are reduced but you have more control over the fills / executions in return. You would want to keep in mind as well that per default the limit orders will expire after the bar they were placed on, unless they are placed with the liveUntilCancelled parameters set to true, then they could persist for more bars and potentially fill you. To work that part in you would need to unlock your wizard script though.

    For the limit price you could start by specifying to use the Close price of the bar +- your offset in ticks. That's the price point where you would evaluate your logic and place orders.

    The Renko data could not be directly exported using our Historical Data Manager, but a workaround could be generated a data file from the chart via SystemIO / StreamWriter in C# :



    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks,

      How do I enable liveuntilcancelled? Is that onlyfor manual cancel or can I set it to cancel after so many bars? I see how to set the offset for the limit order now, thanks. I am concerned that if a limit order is cancelled that a new limit order will immediately be placed as the entry conditions will still be met. I faced a similar problem with my trailing stop where it would sometimes immediately enter a new position after closing a position. This was corrected by adding a statement of waiting several bars since closing a position to my condition. I was wondering if the same would work if I add a statement to wait several bars since the last limit order before placing a new limit order, since if a limit order is cancelled will it be recognized by that statement or will a new limit order be placed immediately after cancelling the order? Sorry if there are any confusing parts, this was sent in a rush on my iPhone. Thank you.

      Comment


        #4
        Hi Chris001,

        The liveUntilCancelled property is a bool that is used as the second parameter when calling an order that is not a market order.

        This only affects orders made in the Managed approach, for example using EnterLongLimit().

        When liveUntilCancelled is false, any order that is not a market order will be cancelled if it is not filled within the bar it is placed on. When this is true, the order will remain until filled.

        For example:
        EnterLongLimit(0, true, 1, Low[0]-3*TickSize, "myLongOrder");
        EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName)

        Below is a link to the help guide on EnterLongLimit().
        http://www.ninjatrader.com/support/h...rlonglimit.htm

        You can also cancel an order that has not been filled at anytime using CancelOrder().
        Below is a link to the help guide on CancelOrder().
        http://www.ninjatrader.com/support/h...ancelorder.htm

        If you want your new entry to wait a few bars from the last exit even if the conditions are for entry are still true, you will have to code this into your strategy. It sounds like you were able to accomplish this in another script and something similar would need to be done for this script. Basically a integer that starts counting after the position becomes flat. Once the count is high enough you enter a new order.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks Bertrand,

          What if I want a plus side and negative side to the limit order, so that the price can only drop or fall so much, is that a possibility?

          On the strategy backtest it seems that the limit order is always filled at the limit, is this a normal assumption or am I using the order wrong?

          Will a canceled entry order be treated the same as a filled entry for the Bars Since Entry command?

          Comment


            #6
            And Thanks Chelsea

            Comment


              #7
              To correct myself, I meant to say rise or fall so much... So tired.

              Comment


                #8
                Hi Chris001,

                A limit order fills at the specified price or better. If a limit is placed behind the market and the price moves up to it, it will fill at the limit price. If a limit order is placed ahead of the market, it will fill at market as the market price will be a better price.

                Below is a link to Investopedia on Buy Limit Orders
                http://www.investopedia.com/terms/b/buy-limit-order.asp

                A Stop Limit Order can be used to place an order ahead of the market and when touched submit a limit order.

                Below is a link to Investopedia on Stop Limit Orders.
                http://www.investopedia.com/terms/s/stop-limitorder.asp

                I'm not quite sure what you are asking for. Are you asking if a limit order can have a range? I'm not quite sure how that would work. Could you clarify further on this?


                Also, no, a cancelled order that has not filled will not be marked as the last entry.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  I must not have explained my problem well enough. I believe I have found the solution anyway. This problem was occurring on my backtest results. Referring to the order below, lets say the order is placed at a low of 100 pips, but the backtest was always filling the order at 104 pips, never before. Turns out it is the difference between "Default" and "Liberal" for the Fill type. Default seems to assume the max allowable slippage, where as Liberal is the least. Is there no middle ground to these fill types?

                  EnterLongLimit(0, true, 1, Low[0] + 4*TickSize, "");

                  My other question was in reference to a range, but I suppose there is no such type of order that allows for two limits in the order.

                  Thanks

                  Comment


                    #10
                    Hi Chris001,

                    Thanks for clarifying.

                    Your assessment is correct. The Default fill type is basically the worst case senario slippage within the bar, while the Liberal fills at the stop/limit price.

                    There is not a middle ground because there is not intra-bar data within the historical data that is being backtested. There are 4 price points for each bar in historical that is used for backtests, Open, High, Low, and Close.

                    It would be possible to custom code a fill type, however, this is not supported by NinjaTrader.

                    Also, you are correct. There is not an order that allows for two orders to be placed.

                    You would simply need to place two orders and cancel one if the other is filled.
                    Last edited by NinjaTrader_ChelseaB; 03-28-2014, 02:46 PM.
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cre8able, Today, 01:16 PM
                    2 responses
                    9 views
                    0 likes
                    Last Post cre8able  
                    Started by chbruno, 04-24-2024, 04:10 PM
                    3 responses
                    48 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by samish18, Today, 01:01 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_LuisH  
                    Started by WHICKED, Today, 12:56 PM
                    1 response
                    9 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by WHICKED, Today, 12:45 PM
                    1 response
                    11 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Working...
                    X