Advertisement
xmd79

IFT Combo and EMA with zones

Jan 15th, 2023
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.34 KB | None | 0 0
  1. //@version=5
  2. // Concept creator of IFT John EHLERS
  3. // Updated and extended with Zones and EMA {Str3SS} aka Techn0Joe
  4. // Next update to include the Buy Sell signals
  5. // Watch for all lines to cross the EMA(yellow by default)
  6. // Indicates price movement best for longs above 50 or 100 or 200 based on market conditions and your agressiveness
  7. // Indicates price movement best for shorts below 50 or 100 or 200 based on market conditions and your agressiveness
  8.  
  9. indicator('IFT Combo and EMA with zones', shorttitle='IFTCOMBOEMA')
  10. EMA = input(true, title='Show EMA line?')
  11. AVERAGE = input(true, title='Show AVERAGE Line?')
  12. STO = input(false, title='Show STOCHASTIC Line?')
  13. RSI = input(false, title='Show RSI Line?')
  14. CCI = input(false, title='Show CCI Line?')
  15. MFI = input(false, title='Show MFI Line?')
  16. //Average means: average value of all 4 inverse fisher trasformed indicators
  17.  
  18.  
  19. EmaMC = input(false, title='Show EMA Multicolor?')
  20. AvgMC = input(false, title='Show AVERAGE Multicolor?')
  21.  
  22.  
  23. ccilength = input(15, 'CCI Length')
  24. wmalength = input(15, title='Smoothing Length')
  25.  
  26.  
  27.  
  28.  
  29. v11 = 0.1 * (ta.cci(close, ccilength) / 4)
  30. v21 = ta.wma(v11, wmalength)
  31. INV1 = (math.exp(2 * v21) - 1) / (math.exp(2 * v21) + 1)
  32. rsilength = input(5, 'RSI Length')
  33. v12 = 0.1 * (ta.rsi(close, rsilength) - 50)
  34. v22 = ta.wma(v12, wmalength)
  35. INV2 = (math.exp(2 * v22) - 1) / (math.exp(2 * v22) + 1)
  36. stochlength = input(5, 'STOCH Length')
  37. v1 = 0.1 * (ta.stoch(close, high, low, stochlength) - 50)
  38. v2 = ta.wma(v1, wmalength)
  39. INVLine = (math.exp(2 * v2) - 1) / (math.exp(2 * v2) + 1)
  40. //MFI
  41. mfilength = input(5, 'MFI Length')
  42. source = hlc3
  43. up = math.sum(volume * (ta.change(source) <= 0 ? 0 : source), mfilength)
  44. lo = math.sum(volume * (ta.change(source) >= 0 ? 0 : source), mfilength)
  45. mfi = 100.0 - 100.0 / (1.0 + up / lo)
  46. v13 = 0.1 * (mfi - 50)
  47. v23 = ta.wma(v13, wmalength)
  48. INV3 = (math.exp(2 * v23) - 1) / (math.exp(2 * v23) + 1)
  49. AVINV = (INV1 + INV2 + INVLine + INV3) / 4
  50.  
  51. ema_length = input.int(6, minval=1, title='EMA length')
  52. vema = ta.ema(INV1, ema_length)
  53.  
  54. color rema = color.new(color.red, 30)
  55.  
  56.  
  57. plot(STO and INVLine ? INVLine : na, color=color.new(color.blue, 0), linewidth=1, title='STOCH')
  58. plot(CCI and INV1 ? INV1 : na, color=color.new(color.white, 0), linewidth=1, title='CCIv2')
  59. plot(RSI and INV2 ? INV2 : na, color=color.new(color.green, 0), linewidth=1, title='RSI')
  60. plot(MFI and INV3 ? INV3 : na, color=color.new(color.purple, 0), linewidth=1, title='MFI')
  61.  
  62.  
  63. plot(not AvgMC and AVERAGE and AVINV ? AVINV : na, color=color.new(color.green, 0), linewidth=3, title='AVERAGE')
  64. plot(AvgMC and AVERAGE and AVINV ? AVINV : na, color=AVINV > AVINV[1] ? color.green :color.red, linewidth=3, title='Average MC')
  65.  
  66.  
  67.  
  68. plot(not EmaMC and EMA and vema ? vema : na, color=rema, linewidth=2, title='EMA')
  69. plot(EmaMC and EMA and vema ? vema : na, color=vema > vema[1] ? color.green :color.red, linewidth=2, title='Ema MC')
  70.  
  71.  
  72.  
  73. color w1 = color.new(color.white, 60)
  74. color r1 = color.new(color.red, 50)
  75. color r2 = color.new(color.red, 20)
  76. color g1 = color.new(color.green, 50)
  77. color g2 = color.new(color.green, 20)
  78.  
  79.  
  80. //hline(0.5, color=r1)
  81. hline(0.75, color=r2)
  82. //hline(-0.5, color=g1)
  83. hline(-0.75, color=g2)
  84. hline(0, color=w1)
  85.  
  86.  
  87. // Used for fill area at top and bottom
  88. color p0 = color.new(color.gray, 100)
  89. h1 = hline(0.75, color=p0)
  90. h2 = hline(1, color=p0)
  91. h3 = hline(-.75, color=p0)
  92. h4 = hline(-1, color=p0)
  93.  
  94. color z1 = color.new(color.gray, 85)
  95.  
  96. fill(h1, h2, color=z1)
  97. fill(h3, h4, color=z1)
  98.  
  99.  
  100. //var table atrDisplay = table.new(position.top_center, 1, 1)
  101. // We call `ta.atr()` outside the `if` block so it executes on each bar.
  102. //myAtr = tostring(INV1)
  103. //table.cell(atrDisplay, 0, 0, "CCI:" + myAtr , text_color = color.white)
  104.  
  105.  
  106. threeone = input(true, title='Highlight 3-1 Strat bar combo?')
  107. onethree = input(true, title='Highlight 1-3 Strat bar combo?')
  108.  
  109. inBar = low > low[1] and high < high[1]
  110. outBar = low < low[1] and high > high[1]
  111. combo31 = low[1] < low[2] and high[1] > high[2] and low > low[1] and high < high[1]
  112. combo13 = low[2] < low[1] and high[2] > high[1] and low[1] > low and high[1] < high
  113.  
  114.  
  115. color y1 = color.new(color.yellow, 90)
  116. color b1 = color.new(color.blue, 90)
  117.  
  118. bgcolor(threeone and combo31 == 1 ? y1 : na, offset=-1, title='3-1 Bar Combo')
  119. bgcolor(threeone and combo31 == 1 ? y1 : na, title='3-1 - Bar Combo')
  120. plotshape(threeone and combo31 == 1, style=shape.labelup, text='3-1', location=location.top, color=color.new(color.yellow, 0), textcolor=color.new(color.black, 0))
  121.  
  122.  
  123. bgcolor(threeone and combo13 == 1 ? b1 : na, offset=-1, title='1-3 - Bar Combo')
  124. bgcolor(combo13 == 1 ? b1 : na, title='1-3 - Bar Combo')
  125. plotshape(combo13 == 1, style=shape.labelup, text='1-3', location=location.top, color=color.new(color.blue, 0), textcolor=color.new(color.white, 0))
  126.  
  127.  
  128.  
  129.  
  130. //fast = input(3, title="LBR Fast Length")
  131. //slow = input(10, title="LBR Slow Length")
  132. //smoothing = input(16, title="LBR Signal Smoothing")
  133.  
  134. //[fastline, slowline, histline] = macd(close,fast,slow,smoothing)
  135.  
  136. //plot(0, color=gray)
  137. //plot(fastline, color=fastline > 0 ? green : red, style=histogram)
  138. //plot(fastline, color=fastline > fastline[1] ? color.green :color.red)
  139. //plot(slowline, color=slowline > slowline[1] ? color.green : color.red)
  140.  
  141.  
  142. //plot(fastline, color=color.green, linewidth=3, title="Fast")
  143. //plot(slowline, color=color.red, linewidth=2, title="Slow")
  144.  
  145.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement