TSI-Donchian

RafaelZioni · study · 33 行 · 点赞 671 · TradingView 原页

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

Pine Script

//@version=3
study("TSI-Donchian")
 
long = input(9, minval=1, title="TSI Long")
short = input(3, minval=1, title="TSI Short")
average = input(20, minval=2, title="SMA Length")
 
TSI = tsi(close, short, long)
 
SMA = sma(TSI, average)
resCustom = input("240", title="Time frame", options=[ "03", "15", "30", "45", "60","120","180","240","360","720","1440"]) 
value = security(tickerid, resCustom, TSI[1], barmerge.gaps_off, barmerge.lookahead_on)  
resCustom1 = input("120", title="Time frame", options=[ "03", "15", "30", "45", "60","120","180","240","360","720","1440"])
value1 = security(tickerid, resCustom, SMA[1], barmerge.gaps_off, barmerge.lookahead_on)  
plot(value*2, color=blue, style=line, linewidth=2)
 
plot(value1*2, color=red, style=line, linewidth=2)
 
tf=input(720)
 
lookBack = isintraday and interval >= 1 ? tf/interval * 7 : isintraday and interval < 60 ? 60/interval * 24 * 7 : 7
 
High = highest(high, lookBack) 
Low = lowest(low, lookBack) 
 
highRatio = ((close-Low) / (High-Low)) 
lowRatio = -((High-close) / (High-Low)) 
 
highColor = High > High[1] ? #006400 : #90EE90 
lowRatio1 = Low < Low[1] ? #8B0000 : #EDAFAF
 
plot(lowRatio, title="low", color=lowRatio1, linewidth=3, style=line)
plot(highRatio, title="high", color=highColor, linewidth=3, style=line)

← 返回列表