multiple time frames strategy on 15 minutes TF with daily conditions

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #199461 quote
    Markscragg
    Participant
    New

    I am trying to back test a strategy on a 15 min time frame

    which is dependent on the previous day daily chart

    eg if yesterdays bar crossed over a SMA (Daily Chart),  buy if 15 min bar crosses over SMA (15 Min Chart)

    Can anyone help me to reference the different time frames in the code?

     

    Mark Scragg

    #199465 quote
    robertogozzi
    Moderator
    Master

    Searching this forum for MTF will return many links to a blog, articles, info and tons of  code snippets.

    #199467 quote
    GraHal
    Participant
    Master
    #199470 quote
    JS
    Participant
    Senior

    Hi @Markscragg

    You can try this…

    DefParam CumulateOrders = False
    
    TimeFrame (Daily, UpdateOnClose)
    
    DaySMA = Average[20](Close)
    
    If Close[1] > DaySMA[1] then
    LongYesterday = 1
    Else
    LongYesterday = 0
    EndIf
    
    TimeFrame(15 minutes, Default)
    
    SMA15 = Average[20](Close)
    
    If LongYesterday and Close Crosses Over SMA15 then
    Buy 1 contract at Market
    EndIf
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

multiple time frames strategy on 15 minutes TF with daily conditions


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Markscragg @markscragg Participant
Summary

This topic contains 3 replies,
has 4 voices, and was last updated by JS
3 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/23/2022
Status: Active
Attachments: No files
Logo Logo
Loading...