Advertisement
magarto

Tradingview Magarto Indicator (Bear & Bull Power)

Aug 19th, 2014
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. study("magarto indicator",overlay=false)
  2. ma=sma(close,30)
  3. maslope=ma-ma[2]
  4. maslopeB=iff(maslope<0,-1,iff(maslope>0,1,0))
  5.  
  6. candleOver=iff(ohlc4>ma,1,-1)
  7.  
  8. xMA = ema(close,13)
  9. DayLow = iff(dayofmonth != dayofmonth[1], low, min(low, nz(DayLow[1])))
  10. bearpower = DayLow - xMA
  11.  
  12. DayHigh = iff(dayofmonth != dayofmonth[1], high, max(high, nz(DayHigh[1])))
  13. bullpower = DayHigh - xMA
  14.  
  15. bothElder=iff((bearpower>0 and bullpower>0),1,iff((bearpower<0 and bullpower<0),-1,0))
  16.  
  17. all4=maslopeB+candleOver+bothElder
  18. plot(all4)
  19. hline(3)
  20. hline(-3)
  21. sell = all4 == -3 ? all4 : na
  22. buy = all4 == 3 ? all4 : na
  23. plot(sell, style=circles, linewidth=4, color=red)
  24. plot(buy, style=circles, linewidth=4, color=green)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement