Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MTF Question

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

    MTF Question

    I have put two MTF strategies together. They are basically the same strategy. One is way more profitable than the other in backtesting and I cannot determine why. Can you tell me the difference between the two strategies below? Shouldn't the results be identical? Thanks.

    On both strategies, the primary series = 60 min and secondary = 60 min. Primary and secondary series are the same instrument.

    Strategy 1
    Code:
            protected override void OnBarUpdate()
            {
                if (BarsInProgress != 1)
                    return;
                
                SetProfitTarget("", CalculationMode.Ticks, 10);
                
                if (Falling(HMA(BarsArray[1],Length)))
                    {
                        ExitLong("XL", "EL60");
                    }
    
                if (Rising(HMA(BarsArray[1],Length)))
                    {
                        ExitShort("XS", "ES60");
                    }    
        
                if (Rising(HMA(BarsArray[1],Length)))
                    {
                        EnterLong(1, 1, "EL60");
                    }
    
                if (Falling(HMA(BarsArray[1],Length)))
                    {
                        EnterShort(1, 1, "ES60");
                    }
            }
    Strategy 2
    Code:
            protected override void OnBarUpdate()
            {
                if (BarsInProgress != 0)
                    return;
                
                SetProfitTarget("", CalculationMode.Ticks, 10);
                
                if (Falling(HMA(BarsArray[0],Length)))
                    {
                        ExitLong("XL", "EL60");
                    }
    
                if (Rising(HMA(BarsArray[0],Length)))
                    {
                        ExitShort("XS", "ES60");
                    }    
        
                if (Rising(HMA(BarsArray[0],Length)))
                    {
                        EnterLong(0, 1, "EL60");
                    }
    
                if (Falling(HMA(BarsArray[0],Length)))
                    {
                        EnterShort(0, 1, "ES60");
                    }
            }
    Last edited by eleven; 08-26-2010, 07:38 PM.

    #2
    eleven, I ran your codes here and the strategy executing to the added series seems to have about 20% more trades - I would suggest you add TraceOrders and prints to the strategies to see why this might be the case.

    Comment


      #3
      HI Bertrand,

      I've narrowed this down to the root of the issue. It looks like "SetProfitTarget" is not working as expected on BIP == 1 (Strategy 1 listed above). It is give more trades that are falsely profitable, making the overall strategy unrealistically profitable in backtesting. When I remove "SetProfitTarget" from both strategies they produce identical results.

      On BIP == 1 (Strategy 1), with TraceOrders = true, those extra trades are canceled as indicated in the output window, but they end up in the profit calculations.

      Do you have an explanation for what could be going on with this?

      Thanks,
      eleven

      Comment


        #4
        eleven, the SetProfitTarget() would check the new price for each OnBarUpdate() (for both BIP), and if the target is inside the bar, then it will be executed more or less automatically. Perhaps you are looking to backtest with an intrabar granularity?
        AustinNinjaTrader Customer Service

        Comment


          #5
          Both BIP are set at 60 min. SetProfitTarget should work exactly the same on BIP == 0 and BIP == 1 if they are both set at 60 min for OnBarUpdate(). How could the results be different?

          I've reduced my once complex MTF strategy to the code above to troubleshoot. I have started out with intrabar granularity but I get the same unrealistic profits when backtesting (using SetProfitTarget).

          Comment


            #6
            eleven, thank you for the update. We will look into this starting on Monday.
            AustinNinjaTrader Customer Service

            Comment


              #7
              Austin,

              Thanks for looking into this.

              Eleven

              Comment


                #8
                eleven, I could reproduce the issues here - we'll look into it.

                Comment


                  #9
                  eleven, we looked into it: it's working as expected as your Set() method would fill on the first series (BIP0) still, so the result is the intrabar trade you see.

                  We would generally advise not to use idential bars objects.

                  Comment


                    #10
                    Thanks Bertrand.

                    1. Would you recommend then that BIP0 is always the shortest time frame when using SetProfitTarget() in a MTF strategy as to not get an intrabar fill on the unintended series (BIP0)?

                    2. I still don't understand why the backtesting results are different if BIP0 and BIP1 are both at 60min. The intrabar fills should be identical. Should they not?

                    I only set the bar objects to identical timeframes to illustrate this point. I see the same thing on non-identical timeframes as well with SetProfitTarget in MFT strategies.
                    Last edited by eleven; 09-01-2010, 09:29 PM.

                    Comment


                      #11
                      No, they would not be identical as in one case the Set fills are in BIP0 and that's the only context you're working in, while for the other it would still fill in BIP0 while you work and submit other orders from BIP1 context.

                      In general you would have then more control using the Exit() methods, as they offer a specific BIP parameter to work in.

                      Comment


                        #12
                        Bertrand, Thanks for the explanation.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        652 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        370 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        109 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        574 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        577 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X