TradingView
victoryong
2018년 10월 23일 오후 3시 3분

Multi Time Frame Volume 

Nike, Inc.NYSE

설명

This is a standard Volume indicator with options to allow different configurable daily and weekly MA length. All other chart time frame (besides daily and weekly) will be using the default MA length value.

On top of the configurable daily and weekly MA length, a dot is displayed for volume x% > current MA length. This is to indicate institutional buying when volume is above certain %.

Default, daily and weekly MA length are configurable. % of increase above the MA length is also configurable. Here are the default value, Default = 20, Daily MA length = 50, Weekly MA length = 10, Institutional Purchase (blue dot) = 40%.
코멘트
riotcontrol
Hi, could you explain what if any steps to be able to calculate volume MA for higher timeframe if at a lower timeframe? Pines method of storing history data is confounding and doesn't work exactly like arrays. Any help is appreciated. Thank you!
victoryong
@nndhawan, No Array required, just use pine script available function sma(volume, LengthOfMovingAverage) for both daily or weekly, meaning if I switch to daily chart, then use the daily length input, if I switch to weekly then use the weekly length input.

After that use function security(tickerid,['D' for Daily, 'W' for Weekly, smaValueFromPreviousFunction) to get the security to request data for the ticker, then plot it.

The key is to understand that the entire pine script are call on each candle. E.g.

mymovingaverage = isdaily ? sma(volume, dLength) : isweekly ? sma(volume, wLength) : sma(volume, default)

requestData = isdaily ? security(tickerid,'D', mymovingaverage) : isweekly ? security(tickerid,'W', mymovingaverage) : security(tickerid, period, mymovingaverage)

...
plot(requestData, style=line, color=orange, title="Volume MA", transp=20)
victoryong
@nndhawan, my message was cut off. I didn't know there was a limit to the comments
victoryong
@nndhawan, After that use function security(tickerid, ['D','W'], smaValueFromPreviousFunction), then use the data to plot.
victoryong
@nndhawan, The key is to understand that the entire indicator script is call for each candle you see
riotcontrol
@victoryong, Thank you for replying. It sounds like you are doing something different then what I was originally intending. I'm trying to figure out how to measure Vol and MA for higher tf, for example, calculate 15m Vol and 15m MA on the 1m TF and compare MA. Only I was thinking of yours as weekly Vol/Weekly MA on the daily TF. Anyways, very interesting stuff. Thank you!
더보기