Multi timeframe – MTF indicators for ProRealTime
12/22/2020 at 2:44 AM #154809
Hello everybody. I am trying to use the MTF in a momentum strategy that is in its early stages.
I am using the close of multiple moving averages, that are < or > the previous close. In the hour TF.
Wanting to open a trade at the start of the hour candle, and close at the end of the candle. So that I can open another trade at the start of the next candle.
The only work around I have found is using the 1 minute time frame, and closing the trade at 235900. I minute before the end of the day.
But my strategy will not trade both longs and shorts. Some currency pairs trade longs only, and others trade shorts only.
Being a code learner at the early stages, I have no idea of how to fix this!
12/22/2020 at 8:34 PM #15491812/22/2020 at 8:37 PM #15492012/24/2020 at 6:24 AM #155077
Nicolas sorry I think I have posted a message in English on the French Forum. You can delete it if needed.
The here below code draw n/d1234567timeframe(15 minutes)SSpanA = SenkouSpanA[9,26,52]//(tenkan[KijPeriod]+kijun[KijPeriod])/2timeframe(1 minutes)DRAWTEXT(SSpanA, barindex, high+1, Dialog, Bold, 12) COLOURED(255,140,0,255)return
if I replace the timeframe 15 by
- timeframe 5: Everything is OK
- 1 hour, 4 hours fail as well…
Attachments:12/27/2020 at 7:42 AM #15529412/27/2020 at 10:43 AM #15530612/27/2020 at 2:10 PM #155334
@robdav, the solution appears in this direction, the contrary in fact ! If I do not load enough historical data, the n/d appears
I am now looking for a coding solution where I could load more data than the ones displayed.01/01/2021 at 7:55 PM #15588401/09/2021 at 1:40 PM #15708801/09/2021 at 2:23 PM #15709302/23/2021 at 2:58 PM #162444
I am also trying to use MTF on indicators in a strategie. The idea is to use the historiv volatility on de daily timeframe in a 5 minute timeframe strategie.
First I created the indicator (see below)1234timeframe(daily, updateonclose)myvolatility = HistoricVolatility(close)return myvolatility
But when I look at the indicator on the five minute chart it gives a completely different value the the historicvolatility on the daily chart.
How is this possible and what am i doing wrong? Also the indicator does not go further back then 25th of januari. Why is that?
Hope somebody can help me.
Attachments:02/23/2021 at 3:55 PM #162455
This might be of help https://www.prorealcode.com/topic/indicator-for-system/page/2/#post-162300.02/23/2021 at 3:55 PM #16245604/09/2021 at 3:10 PM #166630
I saw an issue with multiple TimeFrames for long EMAs (600 periods) when computing them through the strategy tester and indicators.
Results are différent. Numlber of displayed units is the same.
Codes are the same except that one is inside a strategy tester, the other inside an indicator.
It seems related to the number of units displayed in the 1 minute graph.
It seems also the issue appears on the multiple timeframe indicator with 15 k units of 1 minute (that should be OK to compute a EMA(600) in 15 minutes because 15 * 600 = 9000 < 15 000),
Same issue with 20 k units.
When I display 30 k units, then it works better (not fully accurate though). I show this différence_StratégieEtIndicateurMTF3.JPG in which the middle graph is showing the issue. Left graph is the accurate number (15 minute timeframe), Middle (15 k units in 1 minute) is wrong and right is better (30k units of 1 minute), but not fully accurate though…
Is this a known problem ?
Thanks for your help
04/09/2021 at 4:28 PM #166643
EMA uses the previous EMA value with a weighting factor to continuously calculate the new value, so a decay might happen if you start the calculation earlier or later, and that’s what you are observing here. If I use 30k units, I get the same results on the current bar.
1 user thanked author for this post.