Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DMIndex issue backtest

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

    DMIndex issue backtest

    Dear support,

    I am testing the DMindex and found some issue with it.

    The custom strategy is very basic:
    Code:
    if CrossAbove(DMIndex(3), 10, 1)
    EnterLong
    
    if CrossBelow(DMIndex(3), 65, 1) 
    && Close[0] >= Position.AvgPrice)
    ExitLong
    My test stock is ZLC (NYSE)

    If I backtest from 1 Jan. 2010 to 1 Nov. 2011 it generates 4 trades
    1. 03/02/2010 to 26/02/2010
    2. 08/03/2010 to 12/03/2010
    3. 19/04/2010 to 31/12/2010
    4. 17/03/2011 to 07/06/2011


    If I backtest from 1 Jan. 2009 to 1 Nov. 2011 it generates only 2 trades
    1. 09/02/2009 to 31/03/2009
    2. 17/03/2011 to 07/06/2011

    I do not understand at all why the 3 trades that happened in 2010 are not executed!!!


    I know re DMIndex


    The main difference between the two is that the RSI uses a fixed number of time periods (usually 14), while the dynamic momentum index uses different time periods as volatility changes.

    I've also plotted the DMIndex on another charting platform and the results are quite different. With NT the DMIndex of 15/04/2010 is 3.32 while for the other it is 54.9. The definition is the same and I was expecting the same levels.


    All in all I was wondering if there was an issue with the definition of the DMIndex or something else because of these inconsistencies.


    Any brilliant ideas/explanations?


    Kind regards,


    Chris

    #2
    Chris, you likely see those differences as the strategy trade placement and indicator calculations are of course affected by the data span at the beginning of the chart / series to normalize the values, this is turn will also influence signals received and also their sequence seen.

    To which platform were you exactly comparing?

    We use the formula below with an SMA, which is the correct according to the definition from Chande:

    Values[0].Set(RSI((int)(14 / (StdDev(5)[0] / SMA(StdDev(5), 10)[0])), Smooth)[0]);
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hello Bertrand, I think you're right but I find it weird and counter intuitive. Which means the DMIndex is probably not the right index for my strategy. A pity I liked the underlying concept though.

      The other platform I use is the one of my data provider TDA. In theory they use the same definition but I guess the data span is the right explanation.

      May I ask another question you've probably answered a thousand times already?
      My entry and exits are the opening price at Day+1 (when my condition is met at Day). Is it possible to trigger the entry at the same bar (Day) with a price like e.g. (O+C)/2 or the Open price (default)?

      FYI my strategy uses CalculateOnBarClose = true; I've tried to set it at false but it is the same.

      Thank you, chris

      Comment


        #4
        You can use the DMIndex still, but you would need to check via the charts when the value has stabilized enough for your lengths so you start entering trades then with it.

        Since the open is not known in advance, you could not place an order on it - but you could work with an intraday series in your strategy and then backtest for example submitting the order on DAY a few minutes before the close (as you would then have access to a finer series than the daily).

        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


        CalculateOnBarClose is set to 'true' per default in backtesting as here only the bar series resolution is known.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thank you Bertrand, I agree that the open is not known but can you buy at the close of the bar then (just for backtest) or do I need to work with an intraday "secondary" series?

          Comment


            #6
            You will need to work with an added intraday series then, at the close of the day bar you are already on the Day + 1 bar - in NT everything is event based, not time based this goes for the bars closing as well. The opening tick of a new bar is the closing tick of the 'old' bar.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Got it. Thank you. C

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by andrewtrades, Today, 04:57 PM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by chbruno, Today, 04:10 PM
              0 responses
              5 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by josh18955, 03-25-2023, 11:16 AM
              6 responses
              436 views
              0 likes
              Last Post Delerium  
              Started by FAQtrader, Today, 03:35 PM
              0 responses
              7 views
              0 likes
              Last Post FAQtrader  
              Started by rocketman7, Today, 09:41 AM
              5 responses
              19 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X