Keltner Fibzones

eykpunter · study · 29 行 · 点赞 358 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=4    
study(title ="Keltner Fibzones", overlay=true) 
per=input(20, "calculate for last ## bars") //The channel is used for short period movements, so 10 periods is default
amd=input(4, "minimum hight in ATR") //Keltner channels have usually 4 atr distance, this is sort of a natuaral range for short period price movements
 
hl=highest(high,per) //High Line of Donchian channel, used for calculation of fibonacci lines
ll=lowest(low,per)   //Low Line of Donchian channel, used for calculation of fibonacci lines
dist=hl-ll           //range of the donchian channel, used for calculation of fibonacci lines
midl=hl-dist/2       //middle line, used for calculation of keltner lines
 
hf=hl-dist*0.236     //Highest Fibonacci line
cfh=hl-dist*0.382    //Center High Fibonacci line
cfl=hl-dist*0.618    //Center Low Fibonacci line
lf=hl-dist*0.764     //Lowest Fibonacci line
 
md=highest(atr(10),10)*amd/2 //amount of Average True Range used for calculation of keltner lines
kll=midl-md          //Low Keltner Line
khl=midl+md          //high Keltner Line
 
pkhl=plot(khl, title="high keltner", color=color.purple)
pkll=plot(kll, title="low keltner", color=color.purple)
phf=plot(hf, "high fib", color.green)
pcfh=plot(cfh, "center high", color.gray)
pcfl=plot(cfl, "center low", color.gray)
plf=plot(lf, "low fib", color.red)
 
fill(pkhl,phf, color.blue, transp=70)     //zone higher than high fib, up trend when candles outside over channel
fill(pcfh,pcfl, color.gray, transp=70)    //ranging zone between center fibs, fibonacci lines are support/resistance levels
fill(plf,pkll, color.red, transp=70)      //zone lower than low fib, down trend when candles outside under channel

← 返回列表