Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- study("Twin Hull Crossover (TH)",overlay=true)
- LowestPeriod = input(title="Lowest Period",type=integer,defval=8)
- MediumPeriod = input(title="Medium Period",type=integer,defval=10)
- // Hull MA function
- hma(src,len) => wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))
- //LowestEMA = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))
- LowestEMA = hma(close,LowestPeriod)
- MediumEMA = ema(close,MediumPeriod)
- //LowestEMA = ema(close,LowestPeriod)
- //MediumEMA = ema(close,MediumPeriod)
- LEColor = LowestEMA > LowestEMA[1] ? green : red
- MEColor = MediumEMA > MediumEMA[1] ? lime : maroon
- plot( LowestEMA, color= LEColor , title="Lowest EMA", trackprice=false, style=line)
- plot( MediumEMA ,color= MEColor , title="Medium EMA", trackprice=false, style=line)
- Trend = LowestEMA > MediumEMA ? 1 : LowestEMA < MediumEMA ? -1 : 0
- plotarrow(Trend == 1 and Trend[1] != 1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=30, minheight=20, transp=0)
- plotarrow(Trend == -1 and Trend[1] != -1 ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=30, minheight=20, transp=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement