TradingView
veryevilone
Mar 9, 2018 10:19 AM

Always show daily EMA 

Bitcoin / DollarBitfinex

描述

This script will always plot the daily EMA regardless of which timeframe you are on.

版本注释

Added SMA so people can compare the two and analyse which one carries more weight.

版本注释

Updated chart image

版本注释

Dropdown has been replaced with a manual entry. So now you can do custom time frames. Its important to use minutes for timeframes lower than daily.

ie. put 240 for the 4H timeframe. For daily you can simply put D, and for monthly or weekly you can put M or W respectively.

版本注释

Updated chart image
评论
Short-and-Long
Can we change the "Daily" for something else? Like putting a 1H 20-EMA on a 5M chart?
RickAdlam
Brilliant concept. If you had "Always showing the 5/20/50/200 Day EMA's" on any time frame in the same script that would be very useful. I have these "Day EMA's" set on my 1 hour chart and it has helped out of sight.
jerobibobi
the values change from when i go from 1d to lower time frames still...
alxgreen
Why are you plotting the MA only for historical bars?
veryevilone
@alxgreen, iirc mtf only worked on historical bars at the time. the real time bar would just return the close price. TV has built in MTF on the moving average indicator now so you should probably just use that anyway. Have a nice day
alxgreen
@veryevilone, thanks!
Turns out these scripts produce different results depending on which version of Pine script you set. V2 didn't have this problem, but it has an offset issue.
I tried TV's MTF (in pine V4) and it actually has exactly the problem you mention: the realtime bar just shows the closing price.
But TV's MTF doesn't allow you to select and style the historical bars independently from the realtime bars so now I'm back to your method in V3 -- seems like the best solution afaik
spaceoddity
Thank you!
更多