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
Searching this forum for MTF will return many links to a blog, articles, info and tons of code snippets.
JSParticipant
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