SeaSide420

Indicator420 strategy

strategy for Indicator420
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
//@version=2 
//                                                Indicator420 by SeaSide420
strategy("Indicator420 strategy", overlay=true)
q=input(title="HullMA",type=integer,defval=420)
z=input(title="HullMA cross",type=integer,defval=3)
a=input(title="VWMA",type=integer,defval=14)
rvwma=vwma(close,round(a))
rvwma2=vwma(close,round(a*2))
rvwma3=vwma(close,round(a*3))
n2ma=2*wma(close,round(z/2))
nma=wma(close,z)
diff=n2ma-nma
sqn=round(sqrt(z))
n2ma1=2*wma(close[1],round(z/2))
nma1=wma(close[1],z)
diff1=n2ma1-nma1
sqn1=round(sqrt(z))
n2ma2=2*wma(close[2],round(q/2))
nma2=wma(close[2],q)
diff2=n2ma2-nma2
sqn2=round(sqrt(q))
n1=wma(diff,sqn)
n2=wma(diff1,sqn)
n3=wma(diff2,sqn)
b=n1>n2?red:lime
c=n1>n2?green:red
d=n3>rvwma3?red:green
e=rvwma2>rvwma3?green:red
f=n1>n2?red:green
//plot(rvwma3, color=e, linewidth=1)
plot(cross(rvwma, rvwma2) ? rvwma : na, style = line,color=e, linewidth = 1)
plot(cross(n1, n2) ? n1 : na, style = line,color=b, linewidth = 3)
plot(cross(n1, n2) ? n1 : na, style = circles,color=c, linewidth = 4)
closelong = n1<n2
if (closelong)
    strategy.close("Long")
closeshort = n1>n2
if (closeshort)
    strategy.close("Short") 
longCondition = n1>n2 and strategy.opentrades<1 and n1<rvwma3
if (longCondition)
    strategy.entry("Long",strategy.long)
shortCondition = n1<n2 and strategy.opentrades<1 and n1>rvwma3
if (shortCondition)
    strategy.entry("Short",strategy.short)