xmd79

Trend and Momentum Digi Indicator

Sep 15th, 2022
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. //digiindicator.ir
  2. //@version=5
  3. indicator(title="Trend and Momentum Digi Indicator", shorttitle="TMDI", timeframe="", timeframe_gaps=true)
  4. h1 = hline(2)
  5. h5 = hline(-5)
  6. [_, mac, _] = ta.macd(close, 12, 26, 9)
  7. nrsi= ta.rsi(close,14)
  8. hrsi=ta.highest(nrsi, 10)
  9. lrsi=ta.lowest(nrsi, 10)
  10. mo_g = input.int(title="Buyers", minval=1, maxval=500, defval=21)
  11. mo_r = input.int(title="Sellers", minval=1, maxval=500, defval=34)
  12. h_k = input.int(title="General process", minval=1, maxval=500, defval=144)
  13. ma21 = ta.sma(close,mo_g)
  14. ma34 = ta.sma(close,mo_r)
  15. ma144 = ta.sma(close,h_k)
  16. src = input(title="Source", defval=close)
  17. b3 = ma21>ma34 and src>ma144 and ma144[1]<ma144
  18. b2 = (ma21>ma34 and src>ma144 and ma144[1]>ma144) or (ma21>ma34 and ma144[1]<ma144 and src<ma144) or (src>ma144 and ma144[1]<ma144 and ma21<ma34)
  19. bsh = (ma21>ma34 and src>ma144) or (ma21>ma34 and ma144[1]<ma144) or (src>ma144 and ma144[1]<ma144)
  20. s3 = ma21<ma34 and src<ma144 and ma144[1]>ma144
  21. s2 = (ma21<ma34 and src<ma144 and ma144[1]<ma144) or (ma21<ma34 and src>ma144 and ma144[1]>ma144) or (ma21>ma34 and src<ma144 and ma144[1]>ma144)
  22. ssh = (ma21<ma34 and src<ma144) or (ma21<ma34 and ma144[1]>ma144) or ( src<ma144 and ma144[1]>ma144)
  23. tf = if (lrsi<nrsi and nrsi>50) or (hrsi>nrsi and nrsi<50)
  24. false
  25. else
  26. true
  27. ft = if (mac>0 and ma21>ma34) or (mac<0 and ma34>ma21)
  28. false
  29. else
  30. true
  31. plot(b3?2:na, style=plot.style_columns, color=#2bff00)
  32. plot(b2?1:na, style=plot.style_columns, color=#77dc7f)
  33. plot(s3?-2:na, style=plot.style_columns, color=#ff0000)
  34. plot(s2?-1:na, style=plot.style_columns, color=#eb9c9c)
  35. plot(lrsi<nrsi and nrsi>50?-3:na, style=plot.style_linebr, color=#2bff00)
  36. plot(hrsi>nrsi and nrsi<50?-3:na, style=plot.style_linebr, color=#ff0707)
  37. plot(mac>0 and ma21>ma34?-4:na, style=plot.style_linebr, color=#2bff00)
  38. plot(mac<0 and ma34>ma21?-4:na, style=plot.style_linebr, color=#ff0707)
  39. plot(ft==true?-4:na, style=plot.style_linebr, color=#ffffff)
  40. plot(tf==true?-3:na, style=plot.style_linebr, color=#ffffff)
  41. fill(h1, h5, color= color.new(#8B0000, 90))
Advertisement
Add Comment
Please, Sign In to add comment