safwan092

Untitled

Aug 15th, 2025
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.48 KB | None | 0 0
  1.  
  2.  
  3. //@version=5
  4. indicator("Lux Algo - Oscillator Matrix [6.0]", shorttitle = "Lux Algo - Oscillator Matrix [6.0]", max_lines_count = 500)
  5.  
  6.  
  7. dwTL = "Length of the hyper wave"
  8. smTL = "[SMA] Smooth signal with a simple moving average\n[EMA] Smooth signal with an exponential moving average\n[Input] Length of the smooth"
  9. dvTL = "Sensibility of the real time divergence : less sensibility = more short term divs; more sensibility = more long term divs"
  10.  
  11. cmTL = "Show confluence meter at the side of the oscillator"
  12. caTL = "Show confluence area at the bottom/top of the oscillator"
  13.  
  14. rfTL = "More factor will return in less signals but in a stronger way, less factor will return more signal with less strength"
  15.  
  16.  
  17. simple bool dW = input.bool (true , "Main Length?????? ", inline = "1 ", group = "HYPER WAVE" , tooltip = dwTL)
  18. simple int mL = input.int (7 , " ", inline = "1 ", group = "HYPER WAVE", minval = 5, maxval = 21)
  19. simple string sT = input.string("SMA" , "Signal ", inline = "s ", group = "HYPER WAVE", options = ["SMA", "EMA"], tooltip = smTL)
  20. simple int sL = input.int (3 , " ", inline = "s ", group = "HYPER WAVE", minval = 2, maxval = 10)
  21. simple color fCSS = input.color (#51B155 , "Colors?? ", inline = "css ", group = "HYPER WAVE")
  22. simple color sCSS = input.color (#80828D , " ", inline = "css ", group = "HYPER WAVE")
  23. simple int tCSS = input.int (80 , " ", inline = "css ", group = "HYPER WAVE", minval = 0, maxval = 100)
  24. simple int dvT = input.int (20 , "Divergence Sensibility?? ", inline = "x ", group = "HYPER WAVE", minval = 20, maxval = 40 , tooltip = dvTL)
  25. simple bool sDiv = input.bool (true , "Show Divergences?? ", inline = "div ", group = "HYPER WAVE")
  26. simple color blDv = input.color (color.new(#2962ff, 20), " ", inline = "div ", group = "HYPER WAVE")
  27. simple color brDv = input.color (color.new(#f23645, 20), " ", inline = "div ", group = "HYPER WAVE")
  28.  
  29. simple bool Smf = input.bool (true , "Money Flow Length ", inline = "mfi ", group = "SMART MONEY FLOW")
  30. simple int mfL = input.int (35 , " ", inline = "mfi ", group = "SMART MONEY FLOW", minval = 10, maxval = 55)
  31. simple int mfS = input.int (6 , "Smooth?????????????? ", inline = "mfx ", group = "SMART MONEY FLOW", minval = 2 , maxval = 10)
  32. simple color mfBL = input.color (#089981 , "Money Flow Colors?????? ", inline = "mfiC", group = "SMART MONEY FLOW")
  33. simple color mfBR = input.color (#f23645 , " ", inline = "mfiC", group = "SMART MONEY FLOW")
  34.  
  35. simple color cnBL = input.color (#089981 , "Confluence Colors??????? ", inline = "cf ", group = "CONFLUENCE")
  36. simple color cnBR = input.color (#f23645 , " ", inline = "cf ", group = "CONFLUENCE")
  37. simple bool sCNF = input.bool (true , "Show Confluence Meter ", inline = "zf ", group = "CONFLUENCE", tooltip = cmTL)
  38. simple bool sCNB = input.bool (true , "Show Confluence Areas ", inline = "zx ", group = "CONFLUENCE", tooltip = caTL)
  39.  
  40. simple bool rsS = input.bool (true , "Reversal Factor???? ", inline = "rv ", group = "REVERSAL")
  41. simple int rsF = input.int (4 , " ", inline = "rv ", group = "REVERSAL", options = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], tooltip = rfTL)
  42. simple color rsBL = input.color (#089981 , "Reversal Colors??????????", inline = "rc ", group = "REVERSAL")
  43. simple color rsBR = input.color (#f23645 , " ", inline = "rc ", group = "REVERSAL")
  44.  
  45. type oL
  46. float sig
  47. float sgD
  48. color cO
  49.  
  50. type dP
  51. int n
  52. float src
  53. float p
  54.  
  55. type smf
  56. float mfi
  57. color mfc
  58. float blMFI
  59. float brMFI
  60.  
  61. type cnf
  62. color up
  63. color dn
  64. float[] blT
  65. float[] brT
  66.  
  67. var oL osc = oL.new (na, na, na )
  68. var dP div = dP.new (na, na, na )
  69. var smf mf = smf.new(na, na, na, na)
  70.  
  71. var cnf cf = cnf.new(
  72. color.rgb(54, 58, 69, 60)
  73. , color.rgb(54, 58, 69, 60)
  74. , array.new<float>(1, na)
  75. , array.new<float>(1, na)
  76. )
  77.  
  78.  
  79. mfT() =>
  80. switch
  81. mf.mfi > 0 =>
  82. if cf.brT.size() > 1
  83. cf.brT.pop()
  84. if cf.blT.size() > mfL
  85. cf.blT.pop()
  86. if mf.mfi > cf.blT.avg()
  87. cf.blT.unshift(mf.mfi)
  88. else
  89. cf.blT.unshift(mf.mfi[mfL] > 0
  90. ? mf.mfi[mfL]
  91. : mf.mfi
  92. )
  93.  
  94. mf.mfi < 0 =>
  95. if cf.blT.size() > 1
  96. cf.blT.pop()
  97. if cf.brT.size() > mfL
  98. cf.brT.pop()
  99. if mf.mfi < cf.blT.avg()
  100. cf.brT.unshift(mf.mfi)
  101. else
  102. cf.brT.unshift(mf.mfi[mfL] < 0
  103. ? mf.mfi[mfL]
  104. : mf.mfi
  105. )
  106.  
  107.  
  108. method st(simple string src, float osc, simple int len) =>
  109. float o = switch src
  110. "SMA" => ta.sma(osc, len)
  111. "EMA" => ta.ema(osc, len)
  112.  
  113. method css(color x, int inv) =>
  114. color out = inv == 1
  115. ? color.new(x, tCSS)
  116. : color.new(x, 0 )
  117.  
  118. method transp(color x, int t) =>
  119. color.new(x, t)
  120.  
  121.  
  122.  
  123. rv() =>
  124. vMA = ta.sma(volume, 7)
  125. rsi = ta.rsi(vMA, 7) - 50
  126.  
  127. tMj = volume > vMA * ( rsF != 10 ? 1 + (rsF / 10) : 2) ? true : false
  128. tMn = volume > vMA * ( rsF != 10 ? 0 + (rsF / 10) : 2) and not tMj ? true : false
  129.  
  130. mjBR = tMj and osc.sig > rsF and mf.mfi > cf.blT.avg() ? true : false
  131. mjBL = tMj and osc.sig < -rsF and mf.mfi < cf.brT.avg() ? true : false
  132.  
  133. mnBR = tMn and osc.sig > 20 and osc.sig > osc.sgD and rsi > 20 ? true : false
  134. mnBL = tMn and osc.sig < -20 and osc.sig < osc.sgD and rsi < -20 ? true : false
  135.  
  136. [mjBL, mjBR, mnBR, mnBL]
  137.  
  138.  
  139.  
  140. osc(simple int len, simple int smt) =>
  141. float hi = ta.highest( len)
  142. float lo = ta.lowest ( len)
  143. float av = ta.sma (hl2, len)
  144.  
  145. osc.sig := ta.ema(ta.linreg((close - math.avg(hi, lo, av)) / (hi - lo) * 100, len, 0), sL)
  146. osc.sgD := sT.st(osc.sig, 2)
  147. osc.cO := osc.sig > osc.sgD ? fCSS.css(1) : sCSS.css(1)
  148.  
  149. mfi() =>
  150. mf.mfi := ta.sma(ta.mfi(hl2, mfL) - 50, mfS)
  151.  
  152. mf.mfc := mf.mfi > 0
  153. ? mfBL
  154. : mfBR
  155.  
  156. bL = mf.mfi - 10
  157. bR = mf.mfi + 10
  158.  
  159. mf.blMFI := mf.mfi > 0 and mf.mfi > cf.blT.avg()
  160. ? bL
  161. : 0
  162. mf.brMFI := mf.mfi < 0 and mf.mfi < cf.brT.avg()
  163. ? bR
  164. : 0
  165.  
  166. cDiv() =>
  167. mx = math.max(osc.sig, osc.sgD, osc.sig[1], osc.sgD[1])
  168. mn = math.min(osc.sig, osc.sgD, osc.sig[1], osc.sgD[1])
  169.  
  170. mxid = mx == osc.sig[1] or mx == osc.sgD[1] ? 1 : 0
  171. mnid = mn == osc.sig[1] or mn == osc.sgD[1] ? 1 : 0
  172.  
  173. switch
  174. osc.sig > dvT =>
  175. if ta.crossunder(osc.sig, osc.sgD)
  176. switch
  177. na(div.src) =>
  178. div.n := bar_index - mxid
  179. div.src := math.max(open[mxid], close[mxid])
  180. div.p := mx
  181.  
  182. not na(div.src) =>
  183. if math.max(open[mxid], close[mxid]) > div.src and not(osc.sig[mxid] > div.p)
  184. line.new(x1 = div.n, x2 = bar_index - mxid, y1 = div.p, y2 = mx, color = brDv)
  185. div.n := na
  186. div.src := na
  187. div.p := na
  188. else
  189. div.n := bar_index - mxid
  190. div.src := math.max(open[mxid], close[mxid])
  191. div.p := mx
  192. osc.sig < -dvT =>
  193. if ta.crossover (osc.sig, osc.sgD)
  194. switch
  195. na(div.src) =>
  196. div.n := bar_index - mnid
  197. div.src := math.min(open[mnid], close[mnid])
  198. div.p := mn
  199.  
  200. not na(div.src) =>
  201. if math.min(open[mnid], close[mnid]) < div.src and not(osc.sig[mnid] < div.p)
  202. line.new(x1 = div.n, x2 = bar_index - mnid, y1 = div.p, y2 = mn, color = blDv)
  203. div.n := na
  204. div.src := na
  205. div.p := na
  206. else
  207. div.n := bar_index - mnid
  208. div.src := math.min(open[mnid], close[mnid])
  209. div.p := mn
  210.  
  211. osc(mL, sL)
  212. mfi()
  213. mfT()
  214.  
  215. if sDiv
  216. cDiv()
  217.  
  218. [mjBL, mjBR, mnBR, mnBL] = rv()
  219.  
  220.  
  221.  
  222. // REVERSAL SIGNAL
  223. plotshape(mjBL and rsS ? -65 : na, location = location.absolute, color = rsBL, size = size.tiny, style = shape.triangleup)
  224. plotshape(mjBR and rsS ? 65 : na, location = location.absolute, color = rsBR, size = size.tiny, style = shape.triangledown)
  225.  
  226. plot(mnBL and rsS ? -65 : na, color = rsBL, linewidth = 1, style = plot.style_circles)
  227. plot(mnBR and rsS ? 65 : na, color = rsBR, linewidth = 1, style = plot.style_circles)
  228.  
  229.  
  230.  
  231. // HYPER WAVE
  232. plot(ta.crossover (osc.sig, osc.sgD) and dW ? math.min(osc.sig, osc.sgD) : na, style = plot.style_circles, linewidth = 2, color = osc.cO.css(0), offset = 0)
  233. plot(ta.crossunder(osc.sig, osc.sgD) and dW ? math.max(osc.sig, osc.sgD) : na, style = plot.style_circles, linewidth = 2, color = osc.cO.css(0), offset = 0)
  234.  
  235. pO = plot(dW ? osc.sig : na, color = osc.cO.css(0) )
  236. iO = plot(dW ? osc.sgD : na, color = osc.cO.css(1), display = display.none)
  237. bL = plot(0 , color = color.black )
  238.  
  239. fill(pO, iO, color = dW ? osc.cO : na)
  240.  
  241.  
  242.  
  243. //SMART MONEY FLOW
  244. pmf = plot(Smf ? mf.mfi : na, color = mf.mfc )
  245. blT = plot(mf.blMFI > 0 and mf.mfi > 0 ? mf.blMFI : 0 , color = na, display = display.none)
  246. brT = plot(mf.brMFI < 0 and mf.mfi < 0 ? mf.brMFI : 0 , color = na, display = display.none)
  247.  
  248. fill(bL, pmf, mf.mfc.transp(Smf ? 50 : 100))
  249. fill(bL, blT, mf.mfc.transp(Smf ? 0 : 100))
  250. fill(bL, brT, mf.mfc.transp(Smf ? 0 : 100))
  251.  
  252.  
  253. cf.up := color.rgb(54, 58, 69, 60)
  254. cf.dn := color.rgb(54, 58, 69, 60)
  255.  
  256. switch
  257. osc.sig > 0 and mf.mfi > 0 => cf.up := cnBL
  258. osc.sig < 0 and mf.mfi < 0 => cf.dn := cnBR
  259. =>
  260. cf.dn := cnBR.transp(60)
  261. cf.up := cnBL.transp(60)
  262.  
  263.  
  264. tLv = plot( 55, color = sCNB ? cf.up : na)
  265. bLv = plot(-55, color = sCNB ? cf.dn : na)
  266.  
  267. tfL = plot( 50, display = display.none)
  268. dfL = plot(-50, display = display.none)
  269.  
  270. fill(tLv, tfL, color = sCNB ? cf.up : na)
  271. fill(bLv, dfL, color = sCNB ? cf.dn : na)
  272.  
  273. plot(mf.mfi > 0 and Smf ? cf.blT.avg() : na, color = mfBL, style = plot.style_linebr)
  274. plot(mf.mfi < 0 and Smf ? cf.brT.avg() : na, color = mfBR, style = plot.style_linebr)
  275.  
  276.  
  277.  
  278. //CONFLUENCE METER
  279. if barstate.islast
  280. line.new(x1 = last_bar_index, x2 = bar_index - 1, y1 = 20, y2 = 20, color = chart.fg_color.transp(50), style = line.style_dashed, extend = extend.right)
  281. line.new(x1 = last_bar_index, x2 = bar_index - 1, y1 = -20, y2 = -20, color = chart.fg_color.transp(50), style = line.style_dashed, extend = extend.right)
  282.  
  283. if sCNF
  284.  
  285. var line[] ln = array.new<line>()
  286. for j in ln
  287. j.delete()
  288. ln.clear()
  289.  
  290. var label lb = na
  291. lb.delete()
  292. lb := na
  293.  
  294. for i = 0 to 21
  295. int id = switch i
  296. 0 => 55
  297. 1 => 50
  298. 2 => 45
  299. 3 => 40
  300. 4 => 35
  301. 5 => 30
  302. 6 => 25
  303. 7 => 20
  304. 8 => 15
  305. 9 => 10
  306. 10 => 5
  307. 11 => 0
  308. 12 => -5
  309. 13 => -10
  310. 14 => -15
  311. 15 => -20
  312. 16 => -25
  313. 17 => -30
  314. 18 => -35
  315. 19 => -40
  316. 20 => -45
  317. 21 => -50
  318.  
  319. ln.unshift(
  320. line.new(
  321. x1 = bar_index + 2
  322. , x2 = bar_index + 2
  323. , y1 = id
  324. , y2 = id - 5
  325. , color = color.from_gradient(id, -50, 55, cnBR, cnBL)
  326. , width = 4
  327. )
  328. )
  329.  
  330. cnfP = switch
  331. osc.sig > 0 and mf.mfi > 0 and mf.mfi > cf.blT.avg() => 40
  332. osc.sig < 0 and mf.mfi < 0 and mf.mfi < cf.brT.avg() => -40
  333.  
  334. osc.sig > 0 and mf.mfi > 0 => 20
  335. osc.sig < 0 and mf.mfi < 0 => -20
  336.  
  337. osc.sig > 0 and mf.mfi < 0 => 0
  338. osc.sig < 0 and mf.mfi > 0 => 0
  339.  
  340.  
  341. lb := label.new(
  342. x = bar_index + 3
  343. , y = cnfP
  344. , text = "?"
  345. , color = na
  346. , textcolor = chart.fg_color
  347. , size = size.small
  348. , style = label.style_label_left
  349. )
Advertisement
Add Comment
Please, Sign In to add comment