TradingView
SeaSide420
15 Th02 2019 22:29

HULL MA + Lag 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Mô tả

Hull MA crossover, Lag the Hull or the price individually by user settings
this is study version for alert users
this chart is the strategy version for backtesting
tradingview.com/script/f2IueitY-HULL-MA-Lag-Strategy/
Bình luận
SeaSide420
//@version=3
// HULL MA
study("HULL MA + Lag", shorttitle="HullL", overlay=true)
keh=input(title="Hull MA Period",type=integer,defval=500)
Hull_Lag=input(type=integer,minval=0,defval=2)
Price_Lag=input(type=integer,minval=0,defval=2)
p=ohlc4
a2ma=2*wma(p,round(keh/2))
ama=wma(p,keh)
adiff=a2ma-ama
sqn=round(sqrt(keh))
a2ma1=2*wma(p[1],round(keh/2))
ama1=wma(p[1],keh)
adiff1=a2ma1-ama1
sqn1=round(sqrt(keh))
a1=wma(adiff,sqn)
a2=wma(adiff1,sqn)
c=a1<p?green:red
d=plot(a1, style = line, color=c, linewidth = 1, title='HMA1')
e=plot(a2, style = line, color=c, linewidth = 1, title='HMA2')
fill(d,e,color=c, transp=0, title='cloud')
bgcolor(color = c)
plot(a1[Hull_Lag], style = line, color=orange, linewidth = 1, title='Hull Lag')
plot(p[Price_Lag], style = line, color=black, linewidth = 1, title='Price Lag')
//if (a1[Hull_Lag]<p[Price_Lag] and a1[Hull_Lag+1]<p[Price_Lag+1] and a1<p)
// strategy.entry("buy", strategy.long, comment="BUY", when=window())
//if (a1[Hull_Lag]>p[Price_Lag] and a1[Hull_Lag+1]>p[Price_Lag+1] and a1>p)
//strategy.entry("sell", strategy.short, comment="SELL", when=window())
Thêm nữa