MTF backtesting having different results using same timeframes

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #137103 quote
    Philstrading
    Participant
    Senior

    Hi

    When backtesting I’m ggetting vastly different results when it should be the same so wondeiring if someone has an explanation. Below is the format and results of the code.

    So essentially If I run a 4hr code with a 1hr section of code, when running the code on a lower timeframe say 15 minutes I get a different result to that when running the code timeframe written as 15 minutes within the code.

    Essentially whether I run it on a 15 minutes, 30 minutes or whatever, shouldnt the results be the same as that when run in the timeframe of the code?  I understand why the results would be different when running on the Lower timeframes specified if I change the code to that timeframe, but not when it is different to the result when running it on the 1hour in this instance, when ran on the LTF and the code timeframe hasnt changed.

    Why?

    Thanks in advance…

     

    Timeframe (4 hours, updateonclose)
    "Mycode"
    Timeframe (1 hour, updateonclose) // ran on 1hr
    result= £6881.20
    //----------------------------------------------//
    //---------------------------------------------//
    Timeframe (4 hours, updateonclose)
    "Mycode"
    Timeframe (1 hour, updateonclose) // ran on 30 minutes
    "Mycode"
    result= £9,246.80
    //----------------------------------------------//
    //---------------------------------------------//
    Timeframe (4 hours, updateonclose)
    "Mycode"
    Timeframe (1 hour, updateonclose) // ran on 15 minutes
    "MyCode"
    result= £9,761.60 
    
    //----------------------------------------------//
    //---------------------------------------------//
    // If any of these are changed to the lower timeframe ran on for th eMTF they are different results again.
    Timeframe (4 hours, updateonclose)
    "Mycode"
    Timeframe (1 hour, updateonclose) // ran on 1hr
    result= £6881.20
    //----------------------------------------------//
    //---------------------------------------------//
    Timeframe (4 hours, updateonclose)
    "Mycode"
    Timeframe (30 minutes, updateonclose) // ran on 30 minutes
    "Mycode"
    result= £5,226.00
    //----------------------------------------------//
    //---------------------------------------------//
    Timeframe (4 hours, updateonclose)
    "Mycode"
    Timeframe (15 minutes, updateonclose) // ran on 15 minutes
    "MyCode"
    result= £4,302.40
    #137110 quote
    robertogozzi
    Moderator
    Master

    The lower the TF the most likely your trade exits BEFORE the larger TF’s bar is closed, so conditions (if you use UpdateOnClose) are still effective and will make another trade to be entered but… since there’s always some pullback on higher TF’s it’s most likely subsequent trades are losers!

    On a 4h bar setup, your strategy may enter several 15-minute trades (if TP and SL are tight), on a 30-minute TF there will be less chances to enter multiple trades, on a 1-hour TF that will be very difficult.

    Think at what may happens to a MTF strategy like this one:

    Timeframe (1 Day, updateonclose)
    "Mycode"
    Timeframe (4 hour, updateonclose) // ran on 1min
    result= ???

    tens of trades will show at the end of the day, but will many of them have reliable setups (therefore be profitable) after some hours have elapsed since new day inception?

    #137112 quote
    robertogozzi
    Moderator
    Master

    I use this snippet to prevent trades from entering multiple times within the same 4h bar (same conditions):

    timeframe(4h,UpdateOnClose)
    BarCount = BarIndex
    (my code)
    timeframe(1h,UpdateOnClose)
    (my code)
    timeframe(default) //1 minute (or whatever small TF you like)
    IF IntraDayBarIndex = 0 THEN
       TradeON = 1
    ENDIF
    TradeBar = BarCount             //must use a different name for the lower TF
    IF TradeBar <> TradeBar[1] THEN //if one bar elapsed, then re-enable trading
       TradeON = 1
    ENDIF
    IF MyConditions AND Not OnMarket AND TradeON THEN
       BUY 1 contract AT Market
       TradeON = 0                  //disable further trades till next higher bar
    ENDIF
    
    #137116 quote
    Philstrading
    Participant
    Senior

    Ok thanks Robert

    I will have to traul through that and figure the process once the fuzz has cleared.. 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

MTF backtesting having different results using same timeframes


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Philstrading
5 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/25/2020
Status: Active
Attachments: No files
Logo Logo
Loading...