TradingView
Mehradzie
29 июля 2020 г., 11:59

EMA with time-interval dependant visiblity setting 

MARLEY SPOON SEASX

Описание

This scrip exposes 4 Exponential Moving Average (EMA) indicators which their visibility can be set to a daily or weekly time-frame (aka intervals). Based on your current chart time-frame, the matching EMA indicators come on and off.
This helps to have meaningful EMAs relevant to your time internal.

In a traditional 10[unit] EMA indicates a plotted indicator would bear a meaning of a 10 day EMA when in daily and 10 week EMA when in weekly chart which may or may not be useful as some who for example only require a 10 week EMA for thier analysis and wouldn't want to cloud a daily chart with an EMA which won't resemble a valuable output for this particular user.

With EMA+, you can choose to see the 10 week EMA only when your chart is in the weekly time interval, so when switched to a daily interval a 10x EMA is not shown anymore.
If you prefer to see a 10 week EMA and a 21 day EMA on the other hand, you will only have 1 EMA shown when in weekly mode which is a 10 week EMA and one EMA when in daily mode with is 21 day EMA.
Комментарии
mrjxtr
How to set all emas to only show on weekly daily and 4h timeframe and not on other timeframes?
mrjxtr
@Mehradzie, UPDATE. I already figured out how to only show them only on weekly and daily but I don't know how to include the 4-hour timeframe... I think it's "else if timeframe.isminutes" and then put 240 minutes since 4 hours is 240 mins.. but I don't know how 😅 please help 🙏
Mehradzie
@mrjxtr, haha... Hi mrjxtr. thanks for taking interest in my script. I am quite baffled by this question at the moment. I played around a fair bit this afternoon to see if I can put a solution forward, however, to my surprise Pine doesn't have a ".ishourly" !!! time frame haha...
I'll keep on that for the next couple of weeks to see if I can come up with something. :)
mrjxtr
@Mehradzie, I actually figured it out already hahaha it's timeframe.period == "240"
northguleria
Hello ,
I hope you can answer my simple query about Moving averages in general :
when toggling between daily charts & weekly charts ---do we have have to change the input tab which has indicator timeframe ---default value is --'same as chart' ...is that enough ? or do we change the input to 'daily' when viewing daily charts and to 'weekly' when viewing weekly charts ?
Mehradzie
@northguleria, hi

If I am understanding your question the following example should help. In my case, I use a 20 day moving average and a 10,30,50 week moving average.
So I have set one of the inputs to be EMA = 20 and Timeframe = Daily so this way when I change the chart to weekly it goes away and when I come back to weekly it apears.
Then I have 3 other entries of EMA = 10, 30, and 50 and Timeframe = Weekly, so I only see these 3 when I am on the weekly chart view and they go away when I switch to daily. :)

Let me know if this helps
northguleria
@Mehradzie, Hello, Thanks for your response , i was able to sort out the issue in feb'21 by getting a code which is dynamic in nature i.e it changes to Daily values for MA when time-frame selected is daily and it changes to weekly values for MA when timeframe is weekly , so this solves my purpose since i dont have to keep changing the inputs in the code everytime i select daily or weekly . I think what you described above can also work perfectly fine.

Thanks for your reply.
Ещё