multiple time frames strategy on 15 minutes TF with daily conditions

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #199461 quote
    MarkscraggMarkscragg
    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
    robertogozzirobertogozzi
    Moderator
    Legend

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

    #199467 quote
    GraHalGraHal
    Participant
    Master
    #199470 quote
    JSJS
    Participant
    Master

    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 JSJS
4 years, 1 month ago.

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