xmd79

TMO Scalper

Nov 7th, 2022
594
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.37 KB | None | 1 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. //
  3. // @version=5
  4. //
  5. // TMO (T)rue (M)omentum (O)scillator) MTF Special Scapler Version
  6. //
  7. // TMO Scalper is a special custom version that was designed exclusively for lower time frame scalps (1-5min charts)
  8. //
  9. // This version of the TMO Oscillator print the signals ONLY when the higher aggregation is aligned with the current (lower aggregation)
  10. //
  11. // Created by L&L Capital
  12. //
  13.  
  14. indicator("TMO Scalper", shorttitle="TMO Scalper", overlay=false)
  15.  
  16. // Inputs
  17.  
  18. tmolength = input.int(14,title="Length")
  19. calcLength = input(5, title="Calc Length")
  20. smoothLength = input(3, title="Smooth Length")
  21. dotsize = input(3, title="Signal Size")
  22. offset = input(0,title="Signal Offset")
  23.  
  24. // TMO 1 Calculations
  25.  
  26. TimeFrame1 = input.timeframe('1', "TMO 1", options=['1','2','3','5','10','15','20','30','45',"60","120","180","240",'D','2D','3D','4D','W','2W','3W','M','2M','3M'])
  27.  
  28. inp = input(close)
  29.  
  30. srcc1 = request.security(syminfo.tickerid, TimeFrame1, inp)
  31. srco1 = request.security(syminfo.tickerid, TimeFrame1, open)
  32. o1 = srco1
  33. c1 = srcc1
  34.  
  35. data1 = 0
  36. for i1 = 1 to tmolength -1
  37. if c1 > o1[i1]
  38. data1 := data1 + 1
  39. if c1 < o1[i1]
  40. data1 := data1 - 1
  41.  
  42.  
  43. EMA1 = ta.ema(data1,calcLength)
  44. Main1 = request.security(syminfo.tickerid, TimeFrame1, ta.ema(EMA1, smoothLength))
  45. Signal1 = request.security(syminfo.tickerid, TimeFrame1, ta.ema(Main1, smoothLength))
  46.  
  47. // TMO 2 Calculations
  48.  
  49. TimeFrame2 = input.timeframe('5', "TMO 2", options=['1','2','3','5','10','15','20','30','45',"60","120","180","240",'D','2D','3D','4D','W','2W','3W','M','2M','3M'])
  50.  
  51. srcc2 = request.security(syminfo.tickerid, TimeFrame2, inp)
  52. srco2 = request.security(syminfo.tickerid, TimeFrame2, open)
  53.  
  54. o2 = srco2
  55. c2 = srcc2
  56.  
  57. data2 = 0
  58. for i2 = 1 to tmolength -1
  59. if c2 > o2[i2]
  60. data2 := data2 + 1
  61. if c2 < o2[i2]
  62. data2 := data2 - 1
  63.  
  64.  
  65. EMA2 = ta.ema(data2,calcLength)
  66. Main2 = request.security(syminfo.tickerid, TimeFrame2, ta.ema(EMA2, smoothLength))
  67. Signal2 = request.security(syminfo.tickerid, TimeFrame2, ta.ema(Main2, smoothLength))
  68.  
  69. // TMO 3 Calculations
  70.  
  71. TimeFrame3 = input.timeframe('30', "TMO 3", options=['1','2','3','5','10','15','20','30','45',"60","120","180","240",'D','2D','3D','4D','W','2W','3W','M','2M','3M'])
  72.  
  73. srcc3 = request.security(syminfo.tickerid, TimeFrame3, inp)
  74. srco3 = request.security(syminfo.tickerid, TimeFrame3, open)
  75.  
  76. o3 = srco3
  77. c3 = srcc3
  78.  
  79. data3 = 0
  80. for i3 = 1 to tmolength -1
  81. if c3 > o3[i3]
  82. data3 := data3 + 1
  83. if c3 < o3[i3]
  84. data3 := data3 - 1
  85.  
  86.  
  87. EMA3 = ta.ema(data3,calcLength)
  88. Main3 = request.security(syminfo.tickerid, TimeFrame3, ta.ema(EMA3, smoothLength))
  89. Signal3 = request.security(syminfo.tickerid, TimeFrame3, ta.ema(Main3, smoothLength))
  90.  
  91. // TMO Scalper Signals
  92.  
  93. mainln = (15*Main1/tmolength)
  94. signaln = (15*Signal1/tmolength)
  95. mainln2 = (15*Main2/tmolength)
  96. signaln2 = (15*Signal2/tmolength)
  97. mainln3 = (15*Main3/tmolength)
  98. signaln3 = (15*Signal3/tmolength)
  99.  
  100. // TMO 1 Bullish Signal
  101. plot(ta.crossover(mainln, signaln) and (mainln2 > signaln2) ? (mainln-offset) : na, color = #0de50d ,title="TMO 1 Bullish Signal",style=plot.style_circles,linewidth = dotsize)
  102.  
  103. // TMO 1 Bearish Signal
  104. plot(ta.crossover(signaln, mainln) and (mainln2 < signaln2) ? (mainln+offset) : na, color = #ff0000 ,title="TMO 1 Bearish Signal",style=plot.style_circles,linewidth = dotsize)
  105.  
  106. //TMO 2 Bullish Signal
  107. plot(ta.crossover(mainln2, signaln2) and (mainln3 > signaln3) ? (mainln2-offset) : na, color = #006400 ,title="TMO 2 Bullish Signal",style=plot.style_circles,linewidth = dotsize+2,display=display.none)
  108.  
  109. //TMO 2 Bearish Signal
  110. plot(ta.crossover(signaln2, mainln2) and (mainln3 < signaln3) ? (mainln2+offset) : na, color = #800000 ,title="TMO 2 Bearish Signal",style=plot.style_circles,linewidth = dotsize+2, display=display.none)
  111.  
  112. // TMO 1 Plots
  113.  
  114. color1 = Main1 > Signal1 ? #27c22e : #ff0000
  115. mainLine1 = plot(15*Main1/tmolength, title="TMO 1 Main", color=color1)
  116. signalLine1 = plot(15*Signal1/tmolength, title="TMO 1 Signal", color=color1)
  117. fill(mainLine1, signalLine1, title="TMO 1 Fill", color=color1, transp=75)
  118.  
  119. // TMO 2 Plots
  120.  
  121. color2 = Main2 > Signal2 ? #27c22e : #ff0000
  122. mainLine2 = plot(15*Main2/tmolength, title="TMO 2 Main", color=color2)
  123. signalLine2 = plot(15*Signal2/tmolength, title="TMO 2 Signal", color=color2)
  124. fill(mainLine2, signalLine2, title="TMO 2 Fill", color=color2, transp=75)
  125.  
  126. // TMO 3 Plots
  127.  
  128. color3 = Main3 > Signal3 ? #006400 : #800000
  129. mainLine3 = plot(15*Main3/tmolength, title="TMO 3 Main", color=color3)
  130. signalLine3 = plot(15*Signal3/tmolength, title="TMO 3 Signal", color=color3)
  131. fill(mainLine3, signalLine3, title="TMO 3 Fill", color=color3, transp=75)
  132.  
  133. // Background & Colors
  134.  
  135. upper = hline(10, title="OB Line", color=#ff0000, linestyle=hline.style_solid,display=display.none)
  136. lower = hline(-10, title="OS Line", color=#27c22e, linestyle=hline.style_solid,display=display.none)
  137. ob = hline(math.round(15), title="OB Cutoff Line", color=#ff0000, linestyle=hline.style_solid)
  138. os = hline(-math.round(15), title="OS Cutoff Line", color=#27c22e, linestyle=hline.style_solid)
  139. zero = hline(0, title="Zero Line", color=#2a2e39, linestyle=hline.style_solid)
  140. fill(ob, upper, title="OB Fill", color= #ff0000, transp = 75)
  141. fill(os, lower, title="OS Fill", color= #27c22e, transp = 75)
  142.  
Advertisement
Comments
  • hemal9022
    2 years
    # text 0.12 KB | 0 0
    1. i founded all types of premium tradingview indicators codes available on telegram - https://t.me/tradingview_premium_indicator
Add Comment
Please, Sign In to add comment