Advertisement
JustUncleL

Twin Hull Crossover (TH)

Dec 15th, 2017
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. //@version=3
  2. study("Twin Hull Crossover (TH)",overlay=true)
  3.  
  4. LowestPeriod = input(title="Lowest Period",type=integer,defval=8)
  5. MediumPeriod = input(title="Medium Period",type=integer,defval=10)
  6.  
  7. // Hull MA function
  8. hma(src,len) => wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))
  9.  
  10. //LowestEMA = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))
  11. LowestEMA = hma(close,LowestPeriod)
  12. MediumEMA = ema(close,MediumPeriod)
  13.  
  14. //LowestEMA = ema(close,LowestPeriod)
  15. //MediumEMA = ema(close,MediumPeriod)
  16.  
  17. LEColor = LowestEMA > LowestEMA[1] ? green : red
  18. MEColor = MediumEMA > MediumEMA[1] ? lime : maroon
  19.  
  20. plot( LowestEMA, color= LEColor , title="Lowest EMA", trackprice=false, style=line)
  21. plot( MediumEMA ,color= MEColor , title="Medium EMA", trackprice=false, style=line)
  22.  
  23. Trend = LowestEMA > MediumEMA ? 1 : LowestEMA < MediumEMA ? -1 : 0
  24. plotarrow(Trend == 1 and Trend[1] != 1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=30, minheight=20, transp=0)
  25. 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