Hourly Average plotted in Higher timeframe
05/14/2019 at 10:27 AM #98446
I am trying to plot the 200 moving average of the hourly chart in higher timeframes; 4 hours chart for instance.
I have tried grapfhonprice as suggested in the example 2, but it is nt working; it claims:Example 212345678910111213141516171819202122232425262728293031323334timeframe(4 hours)mm7h4=averagemm20h4=averagemm50h4=averageboluph4=BollingerUp(close)boldnh4=BollingerDown(close)timeframe(1 hour)mm7h1=averagemm20h1=averagemm50h1=averageboluph1=BollingerUp(close)boldnh1=BollingerDown(close)timeframe(default)a = 0if a>0 thenbuy at marketendif// --- PLOT MTF INDICATORS ON PRICE CHART//4 hours indisgraphonprice mm7h4 coloured(200,200,0)graphonprice mm20h4 coloured(200,200,0)graphonprice mm50h4 coloured(200,200,0)graphonprice boluph4 coloured(200,200,0)graphonprice boldnh4 coloured(200,200,0)//1 hour indisgraphonprice mm7h1 coloured(0,200,0)graphonprice mm20h1 coloured(0,200,0)graphonprice mm50h1 coloured(0,200,0)graphonprice boluph1 coloured(0,200,0)graphonprice boldnh1 coloured(0,200,0)//etc.
Thanks in advance for your help05/14/2019 at 10:39 AM #9844705/14/2019 at 11:12 AM #9845005/14/2019 at 12:03 PM #9845905/14/2019 at 12:33 PM #9846405/14/2019 at 1:11 PM #9847405/14/2019 at 1:14 PM #98477
It’s because you use timeframes that are not multiple of the lowest one, that on the chart.
If you use, say, a 20-minute TF on the chart, then you cannot refer TF’s like 30 minutes in your code.
What TF’s did you use?05/14/2019 at 2:56 PM #98486
I have just copied the example 2 that it claims:
4 hours and 1 hour indicators plotted on the current chart.
I is wotking in 30 minutes and 1 hour chart but it is not working in 4 hours and daily chart.
I would like to plot the 200 hourly average in four hours chart and daily charts. What I should change?
Many thanks05/14/2019 at 3:27 PM #98488
As it has already been said, MTF requires the lowest TF on the chart!
So, in this case you can use it on any TF <= 1 hour provided 1 hours and 4 houra are multiples. You cannot launch it from a 17-minute TF, because 1 hour (60 minutes) and 4 hours (240 minutes) are NOT multiple of 17.
You CANNOT use it on any TF higher than 1 hour, since this is the lowest TF you use in your strategy.
By the way, what use it a 1-hour and 4-hour MA on a Daily TF? It’s fine the other way round.
1 user thanked author for this post.05/15/2019 at 4:54 AM #9851805/15/2019 at 6:53 AM #98519
I am not sure you understood the issue, you CANNOT use a higher TF as default.
You can plot a 4h TF’s indicators on a 1h TF, not the other way round!
Moreover, what use would be doing the other way round?05/15/2019 at 9:41 AM #9853405/15/2019 at 10:12 AM #98540
It is impossible to do, but in case you could do that, every 4 hours you would like to plot a 1-hor MA, which hour would you like to be plotted, out of for? That of the first hour, the second hour, the third or the last hour?
If you are in front of your 4-hour chart and you plot on it the 1-h MA from 2 hours before, does that make sense.
The other way round is true, if you are taking a glance at your 1-hour chart you may want to also plot the 4-hour MA to see what the price and indicators on higher TF are doing.05/17/2019 at 4:05 AM #98667
I woud like to plot the 1 hour average as it is in the 1 hour graph.
I found in another post another solution for the RSI that I do not know if it can be changed to apply to the simple average, thanks for your help.RSI short timeframe to higher timeframe12345678910111213141516171819202122//higher timeframe minutes count//HigherTFminutes = 60//current timeframe minutes count//CurrentTFminutes = 5//RSI period to display//RSIperiod = 14if hour<>hour thenc = closeendifcurrentRSI = RSI[RSIperiod](close)factor = ROUND(HigherTFminutes/CurrentTFminutes)MTFRSI = RSI[RSIperiod*factor](c)RETURN currentRSI as "current TF RSI", MTFRSI as "higher TF RSI"05/17/2019 at 7:20 AM #98672