Backtest Data Timeframe Weekly But Market Filter Daily.

Optuma Forums Optuma Scripting Backtest Data Timeframe Weekly But Market Filter Daily.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #60133
    AvatarEvan
    • Topics: 4
    • Replies: 6
    • Posts: 10

    Gday, I am backtesting a strategy with the Data Timeframe set to weekly and have 4 entry criteria ANDed. All works well except one of the entry conditions is a market filter on the XJO which is an EMA crossover using daily data.  The strategy clearly enters positions when the market filter should be false. Verified by looking at the purchase dates on a chart with the 2 EMAs in place.  Any ideas appreciated?

    Regards

    Evan

    Market Filter below.
    MA1 = MA(Day(PERIODAMOUNT=1), GetData(CODE=XJO:ASX, TIMEFRAME=1 Day),BARS=8,STYLE=Exponential,CALC=CLOSE);
    MA2 = MA(Day(PERIODAMOUNT=1), GetData(CODE=XJO:ASX, TIMEFRAME=1 Day),BARS=34,STYLE=Exponential,CALC=CLOSE);
    MA1 > MA2

    #60135
    AvatarEvan
    • Topics: 4
    • Replies: 6
    • Posts: 10

    So, more information. Most buy signals are correct with the market filter, some are close to the filter being crossed, but there are a few, say 10% totally out.

    #60137
    AvatarMichael
    • Topics: 16
    • Replies: 28
    • Posts: 44

    Your code for the MAs seems ok, but I note that they are in a daily time frame whereas you mentioned that your backtest is in a weekly time frame.

    It may be that the period mismatch is causing triggers midweek that do not fit with the weekly aspect of the strategy.

    #60138
    MatthewMatthew
    • Topics: 5
    • Replies: 310
    • Posts: 315

    Hi,

    When you are mixing time frames like this you should set the back testing time frame to the lowest level (1 Day in your example), and use script overrides for anything higher (1 Week, 1 Month, etc).

    If you make this adjustment on the back test settings (so its time frame is 1 day) and adjust the scripts accordingly for that setup the results should match what you see on the chart(s).

    #60153
    AvatarEvan
    • Topics: 4
    • Replies: 6
    • Posts: 10

    OK thanks guys I’ll give that a shot.

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

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close