TradingView
cheatcountry
2023年5月29日午後3時23分

Daily Factor Indicator [CC] 

Apple Inc.NASDAQ

詳細

The Daily Factor Indicator was created by Andrea Unger (Stocks and Commodities Jun 2023 pgs 26-31), and this is a new volatility indicator that compares the body, which is the absolute difference between the previous open and previous close, and the range which is the difference between the previous high and previous low. The indicator is calculated by dividing the body and range to determine the volatility for the previous bar. This indicator will range between 0 and 1. Values closer to 1 mean very high volatility, and values closer to 0 mean very low volatility. I have introduced a simple moving average strategy to decide buy or sell signals and colors. Darker colors mean the indicator is above the threshold level, and lighter colors mean the indicator is below the threshold level. Colors are shades of green when the price is above the moving average and shades of red when the price is below the moving average. Feel free to try out your own threshold level and general buy and sell signals.

Let me know if there are any other indicators you would like me to publish!
コメント
DeFi_initiate
Thanks for implementing this indicator!

I have tried it on BTC and for some reason it calculates DF for two bars back (and not for the previous bar). When I modify the script to pull '0' indexes (rather than '1' in the line "float df = nz(h[1]) - nz(l[1]) != 0 ? math.abs(nz(o[1]) - nz(c[1])) / (nz(h[1]) - nz(l[1])) : 0"), it works correctly.

Keep up the good work!
cheatcountry
@DeFi_initiate, Thank you and what you are describing is the built in protections I have against repainting so my indicators ignore the latest bar by default. It is recommended to turn on repainting when viewing closed bars and to keep it off when viewing open bars
DeFi_initiate
@cheatcountry, Thanks for explaining!
cheatcountry
詳細