Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer and Stop Limit Orders

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

    Strategy Analyzer and Stop Limit Orders

    I am trying to use stop limit trade entry orders on 5 minute bars with the strategy analyzer, however very few trades are initiated and many errors stating that a stoplimit order has been ignored are shown in the log.

    How does the strategy analyzer handle stop limit orders if it has no visibility into the bar?

    Are the errors due to the close of the bar being beyond the stop limit trade entry price which would have been triggered during the bar?

    Can stop limit orders be used successfully with the strategy analyzer?

    Thanks

    #2
    Hello Operandi,

    Buy stop orders submitted below the close of the signal bar are rejected, reverse for sell orders.

    Yes, you can use stop stop limit orders in backtesting but will have to ensure that they are submitted at valid values. For greater granularity when backtesting, can follow this reference sample:
    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Buy stop orders submitted below the close of the signal bar are rejected, reverse for sell orders.
      I am not sure what you mean by "signal bar" - is it the bar that places the EnterLongStopLimit order, for example, or the bar in which the LongStopLimitOrder is filled?

      I want to place the LongStopLimitOrder like this (triggered by the previous bar):

      LongStopLimitOrder( High[1] + 2 * TickSize, High[1] + 1 * TickSize, "SMA Cross Entry" )

      Then have the order filled in the current bar, or if not, cancelled. This does not seem to work in the strategy analyzer as I get almost no trades and loads of rejected orders.

      It seems that FirstTickOfBar does not work in the strategy analyzer (presumably because it is not visible to the analyzer). Is this correct?

      If I use a MTF strategy, as you suggested, then it must have to use a one tick time frame, which is not possible when you are back testing years of data. is this what you mean by your suggestion?

      Thanks

      Comment


        #4
        Continuing on this theme, the strategy analyzer is entering trades at entirely the wrong price!

        The strategy places a EnterShortStopLimitOrder one tick below the low of the previous bar if the previous bar is a down bar (Close[1] < Open[1])

        That short order should have been filled by the Current bar, but it wasn't.

        The valid order was cancelled and then placed a bar later so the trade result is wrong because the strategy analyzer entered the trade in completely the wrong place.

        If traded live, the correct entry would have been triggered.

        This completely invalidates the results obtainable from the strategy analyzer.

        Please advise when you intend to rectify this major bug in NT 7.1000.1

        Thanks
        Attached Files
        Last edited by Operandi; 12-14-2010, 07:22 AM.

        Comment


          #5
          A one tick series is one way to get increased granularity, but any time frame smaller than your primary series gives you a greater perspective on what happened. You're seeing differences between backtest and real time trading which is expected. Details are outlined here:


          You may find it useful to test with market replay or live feed.

          Backtesting will places orders on the next bar following the condition (the signal bar). Is this consistent with what you're seeing?

          We are not aware of issues in the backtesting fill engine. Please review the description of fills here > historical fill processing.


          If you identify a discrepancy between the description there and your results, please:
          • Isolate to a reproducible scenario
          • Share a simple strategy and all settings needed to see the issue.
          • The steps needed to see the issue.


          Thanks
          Last edited by NinjaTrader_RyanM1; 12-14-2010, 10:08 AM.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Backtesting will places orders on the next bar following the condition (the signal bar). Is this consistent with what you're seeing?
            No, I expect that and don't have a problem with it.

            As I said, and showed in that image, the first stop limit order was completely ignored and then the strategy analyzer decided to take the second one, which is wrong. It should have taken the first!

            If the strategy analyzer ignores valid trades and then enters trades in the wrong place, the results will have no bearing on live trading expectancies at all, as I have demonstrated in this thread.

            This makes the strategy analyzer worse than useless.

            This scenario is entirely reproducible with a simple strategy along these lines:

            PHP Code:
            if ( Close[1] < Open[1] ) {
            EnterShortStopLimit(1Low[1] - 2TickSizeLow[1] - TickSize"Short"  );
            SetProfitTarget"Short"CalculationMode.Ticks);
            SetStopLoss"Short"CalculationMode.Ticks5false); 
            }

            Comment


              #7
              the first stop limit order was completely ignored and then the strategy analyzer decided to take the second one, which is wrong. It should have taken the first!
              I'm not sure what this means. I only see one order statement in your code snippet. How are you defining first and second order here?
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                The first time in my chart image that the condition Close[1] < Open[1] is met is the first red bar in the image.

                So the code I posted just now then places a EnterShortStopLimit order 1 tick below that first red bar.

                That order should have been filled by the second red bar at the point the top arrow points to.

                It wasn't. It was ignored.

                The lower arrow point to the place another order was placed and then filled, but that trade should not have taken place as the strategy should have been in a short position by then (from what should have been the filled order that the top arrow points to).

                So the strategy analyzer arbitarily missed filling the first and correct order and then arbitarily decided it was going to fill the second order which is incorrect. As it keeps doing this, imagine how that skews the results.

                This means that the strategy analyzer cannot be trusted at all.

                ThIs is just a simple example that I am using to illustrate to you that there is a major fault with the strategy analyzer. When I look through the analysis results, I see many discrepancies like this. It is simply not filling stop limit orders correctly.

                Comment


                  #9
                  The first time the condition is met is actually the second red bar. You're evaluating whether the prior close is lower than the prior open. This condition is not true on the first red bar.

                  I suggest you use Print() statements and DrawingTools for additional signal confirmation. You can then use these additional visual clues to track what your strategy is doing. Help for these items is included here:

                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    The first time the condition is met is actually the second red bar. You're evaluating whether the prior close is lower than the prior open. This condition is not true on the first red bar.
                    That is just semantics!

                    The trade entry is the low of the first bar minus one tick because the first red bar is the first time that a red bar was encountered, but yes it is from the point of view of the second bar (I know that!).

                    The second bar places the stop limit order which then should have been filled when price triggered it.

                    In a live market situation that order would have been triggered. It was ignored by the Strategy Analyzer. This is why the strategy analyzer is worse than useless. It creates results that bear no resemblence at all to what happens in the market.

                    You have to expect some discrepancies when back testing, but not to this extent.

                    This is why so many stop limit orders get cancelled by the strategy analyzer - because they get ignored and then when the bar closes, low and behold they are above the market (in this case) and are therefore "invalid", when they should have been filled.

                    That is my point.

                    Comment


                      #11
                      So the second red bar is the bar you're evaluating? Then the green bar following this is the bar you're submitting orders to?

                      The bar you're submitting on does not meet the sell limit price. Why should there be a fill on this bar?
                      Ryan M.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by usazencort, Today, 01:16 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post usazencort  
                      Started by kaywai, 09-01-2023, 08:44 PM
                      5 responses
                      603 views
                      0 likes
                      Last Post NinjaTrader_Jason  
                      Started by xiinteractive, 04-09-2024, 08:08 AM
                      6 responses
                      23 views
                      0 likes
                      Last Post xiinteractive  
                      Started by Pattontje, Yesterday, 02:10 PM
                      2 responses
                      22 views
                      0 likes
                      Last Post Pattontje  
                      Started by flybuzz, 04-21-2024, 04:07 PM
                      17 responses
                      230 views
                      0 likes
                      Last Post TradingLoss  
                      Working...
                      X