ajiim

🎁

Oct 20th, 2026
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.64 KB | None | 0 0
  1. //@version=6
  2. indicator("Prime Oscillators Pro + [ChartPrime]", shorttitle = "Prime Oscillators Pro + [ChartPrime]", overlay = false, max_lines_count = 500, max_labels_count = 500, max_bars_back = 500)
  3.  
  4. const string GRP_MODE = "Mode"
  5. const string GRP_OSC = "Main Oscillator"
  6. const string GRP_MF = "Money Flow Tracker"
  7. const string GRP_MTF = "Multi Time Frame Money Flow"
  8. const string GRP_VM = "Volume Matrix"
  9. const string GRP_PB = "Top and Bottom Power Bars"
  10. const string GRP_T7 = "The True 7"
  11. const string GRP_SIG = "Signals"
  12. const string GRP_PS = "Peak Seekers"
  13. const string GRP_DIV = "Money Flow Divergences"
  14. const string GRP_DS = "Diamond Shift"
  15. const string GRP_MVP = "MVP Oscillator"
  16. const string GRP_COL = "Colors"
  17.  
  18. string modeInput = input.string("Prime Oscillator", "Oscillator Mode", options = ["Prime Oscillator", "MVP Oscillator"], group = GRP_MODE, tooltip = "Prime Oscillator: full toolkit (Main Oscillator, Money Flow Tracker, Volume Matrix, Power Bars, The True 7, Signals).\nMVP Oscillator: deep volume analysis ribbon with overextended bars and signals.")
  19.  
  20. bool showOsc = input.bool(true, "Main Oscillator", group = GRP_OSC, inline = "osc1")
  21. bool showGlow = input.bool(true, "Glow", group = GRP_OSC, inline = "osc1")
  22. int oscLen = input.int(14, "Length", minval = 2, group = GRP_OSC, tooltip = "Base length used for the RSI, Stochastic and CCI components of the main oscillator.")
  23. int oscSmooth = input.int(9, "Low Lag Smoothing", minval = 1, group = GRP_OSC, tooltip = "Zero lag smoothing length applied to the oscillator.")
  24. float oscGain = input.float(1.25, "Gain", minval = 0.1, step = 0.05, group = GRP_OSC)
  25.  
  26. bool showMF = input.bool(true, "Money Flow Tracker", group = GRP_MF)
  27. string moneyMode = input.string("Volume Weighted", "Money Mode", options = ["Volume Weighted", "Price Action"], group = GRP_MF, tooltip = "Volume Weighted: price location within the bar weighted by volume.\nPrice Action: body to range pressure without volume.")
  28. int mfLen = input.int(20, "Length", minval = 2, group = GRP_MF)
  29. int mfSmooth = input.int(5, "Low Lag Smoothing", minval = 1, group = GRP_MF)
  30. float mfMult = input.float(1.5, "Multiplier", minval = 0.1, step = 0.1, group = GRP_MF)
  31.  
  32. bool mtfOn = input.bool(false, "Use Higher Timeframe", group = GRP_MTF, inline = "mtf", tooltip = "Calculates the Money Flow Tracker on a higher timeframe without repainting (confirmed higher timeframe values only).")
  33. string mtfTf = input.timeframe("240", "", group = GRP_MTF, inline = "mtf")
  34.  
  35. bool showVM = input.bool(true, "Volume Matrix", group = GRP_VM)
  36. int vmLen = input.int(21, "Smoothing Length", minval = 2, group = GRP_VM)
  37. float vmHeight = input.float(40.0, "Height", minval = 5, group = GRP_VM)
  38.  
  39. bool showPB = input.bool(true, "Top and Bottom Power Bars", group = GRP_PB)
  40. int pbMin = input.int(4, "Minimum Confirmations", minval = 1, maxval = 7, group = GRP_PB, tooltip = "Minimum number of the 7 conditions that must agree before a power bar is drawn. Brightness grows with the number of confirmations.")
  41.  
  42. bool showT7 = input.bool(true, "The True 7", group = GRP_T7)
  43. float t7Scale = input.float(10.0, "Scale", minval = 1, step = 0.5, group = GRP_T7, tooltip = "Each rank step (from -7 to +7) is multiplied by this value on the oscillator scale.")
  44. int t7Fast = input.int(21, "Fast EMA", minval = 2, group = GRP_T7, inline = "t7")
  45. int t7Slow = input.int(50, "Slow EMA", minval = 3, group = GRP_T7, inline = "t7")
  46.  
  47. bool showObOs = input.bool(true, "OB/OS Markers", group = GRP_SIG, inline = "ob")
  48. float obLevel = input.float(100.0, "OB", group = GRP_SIG, inline = "ob")
  49. float osLevel = input.float(-100.0, "OS", group = GRP_SIG, inline = "ob")
  50. bool showVS = input.bool(true, "Volume Inspired Signals", group = GRP_SIG, inline = "vs")
  51. string vwapAnchor = input.timeframe("D", "Anchor", group = GRP_SIG, inline = "vs")
  52. float vwapMult = input.float(2.0, "Band Multiplier", minval = 0.1, step = 0.1, group = GRP_SIG, tooltip = "Price fairness bands around the anchored VWAP.")
  53. bool showRev = input.bool(true, "Reversal Signals", group = GRP_SIG, inline = "rv")
  54. float revLevel = input.float(70.0, "Level", minval = 0, group = GRP_SIG, inline = "rv")
  55.  
  56. bool showPS = input.bool(true, "Peak Seekers", group = GRP_PS)
  57. bool psAuto = input.bool(true, "Auto Optimize", group = GRP_PS, inline = "ps", tooltip = "Automatically optimizes the pivot lookback for the selected chart timeframe.")
  58. int psManual = input.int(5, "Lookback", minval = 1, group = GRP_PS, inline = "ps")
  59. int psMin = input.int(3, "Minimum Confluence", minval = 1, maxval = 4, group = GRP_PS, tooltip = "Number of oscillators (RSI, MFI, CCI, Main Oscillator) that must show the same divergence.")
  60.  
  61. bool showDiv = input.bool(true, "Money Flow Divergences", group = GRP_DIV)
  62. bool showRegDiv = input.bool(true, "Regular", group = GRP_DIV, inline = "dv")
  63. bool showHidDiv = input.bool(true, "Hidden", group = GRP_DIV, inline = "dv")
  64. int divLeft = input.int(5, "Pivot Left", minval = 1, group = GRP_DIV, inline = "dp")
  65. int divRight = input.int(3, "Pivot Right", minval = 1, group = GRP_DIV, inline = "dp")
  66. int divMinRange = input.int(5, "Min Range", minval = 1, group = GRP_DIV, inline = "dr")
  67. int divMaxRange = input.int(60, "Max Range", minval = 2, group = GRP_DIV, inline = "dr")
  68. int divMaxLines = input.int(30, "Max Lines", minval = 1, maxval = 500, group = GRP_DIV)
  69.  
  70. bool showDS = input.bool(true, "Diamond Shift", group = GRP_DS)
  71. int dsThresh = input.int(5, "Rank Threshold", minval = 1, maxval = 7, group = GRP_DS, tooltip = "The True 7 rank required (with Money Flow agreement) to confirm a change in market direction.")
  72.  
  73. int mvpVwLen = input.int(10, "Volume Weight Length", minval = 1, group = GRP_MVP)
  74. int mvpLen = input.int(14, "Oscillator Length", minval = 2, group = GRP_MVP)
  75. int mvpSmooth = input.int(5, "Ribbon Fast", minval = 1, group = GRP_MVP, inline = "rb")
  76. int mvpSignal = input.int(9, "Ribbon Slow", minval = 1, group = GRP_MVP, inline = "rb")
  77. bool showMvpBars = input.bool(true, "Overextended Bars", group = GRP_MVP, inline = "mb")
  78. float mvpExt = input.float(70.0, "Level", minval = 1, maxval = 100, group = GRP_MVP, inline = "mb")
  79. bool showMvpSig = input.bool(true, "Signals", group = GRP_MVP, inline = "ms")
  80. float mvpSigLevel = input.float(60.0, "Level", minval = 1, maxval = 100, group = GRP_MVP, inline = "ms")
  81.  
  82. color bullCol = input.color(#26E8B5, "Bullish", group = GRP_COL, inline = "c1")
  83. color bearCol = input.color(#F7375F, "Bearish", group = GRP_COL, inline = "c1")
  84. color pbHiCol = input.color(#E6FFF8, "Power Bar Peak", group = GRP_COL, inline = "c2")
  85. color obosCol = input.color(#FF9800, "OB/OS", group = GRP_COL, inline = "c2")
  86. color vsCol = input.color(#FF9800, "Volume Signals", group = GRP_COL, inline = "c3")
  87. color revBullCol = input.color(#00E676, "Reversal Up", group = GRP_COL, inline = "c3")
  88. color revBearCol = input.color(#FF5252, "Reversal Down", group = GRP_COL, inline = "c4")
  89. color psCol = input.color(#2196F3, "Peak Seekers", group = GRP_COL, inline = "c4")
  90. color divBullCol = input.color(#00BCD4, "Divergence Bull", group = GRP_COL, inline = "c5")
  91. color divBearCol = input.color(#FF4D6D, "Divergence Bear", group = GRP_COL, inline = "c5")
  92. color divHidCol = input.color(#FF9800, "Hidden Divergence", group = GRP_COL, inline = "c6")
  93. color dsCol = input.color(#FFEB3B, "Diamond Shift", group = GRP_COL, inline = "c6")
  94. color mvpUpCol = input.color(#2196F3, "MVP Up", group = GRP_COL, inline = "c7")
  95. color mvpDnCol = input.color(#9C27B0, "MVP Down", group = GRP_COL, inline = "c7")
  96. color mvpBarCol = input.color(#00E676, "MVP Bars", group = GRP_COL, inline = "c8")
  97. color zeroCol = input.color(color.new(#787B86, 60), "Zero Line", group = GRP_COL, inline = "c8")
  98. color levelCol = input.color(color.new(#787B86, 75), "Levels", group = GRP_COL, inline = "c9")
  99.  
  100. const float VM_BASE = -130.0
  101. const float TOP_STRIP = 150.0
  102. const float BOT_STRIP = -150.0
  103. const float OB_Y = 165.0
  104. const float OS_Y = -165.0
  105. const float OB_TXT_Y = 176.0
  106. const float OS_TXT_Y = -176.0
  107. const float REV_Y = 125.0
  108. const float VS_Y = 113.0
  109. const float PS_Y = 140.0
  110. const float DS_OFFSET = 14.0
  111. const float MVP_SIG_Y = 115.0
  112. const float EPS = 1e-10
  113.  
  114. bool isPrime = modeInput == "Prime Oscillator"
  115. bool isMvp = modeInput == "MVP Oscillator"
  116.  
  117. f_zlema(float src, simple int len) =>
  118. int lag = math.max(int(math.floor((len - 1) / 2)), 0)
  119. ta.ema(src + (src - nz(src[lag], src)), len)
  120.  
  121. f_clamp(float v, float lo, float hi) =>
  122. math.max(lo, math.min(hi, v))
  123.  
  124. f_stripColor(int cnt, int minC, color base, color peak) =>
  125. color result = color(na)
  126. if cnt >= minC
  127. float strength = float(cnt - minC) / math.max(float(7 - minC), 1.0)
  128. color mixed = cnt >= 7 ? color.from_gradient(0.5, 0.0, 1.0, base, peak) : base
  129. float transp = 88.0 - strength * 88.0
  130. result := color.new(mixed, math.min(100.0, transp))
  131. result
  132.  
  133. f_div(float src, bool found, simple int lb, bool isBear) =>
  134. var float prevPrice = na
  135. var float prevSrc = na
  136. float curPrice = isBear ? high[lb] : low[lb]
  137. float curSrc = src[lb]
  138. bool isDiv = false
  139. if found
  140. isDiv := not na(prevPrice) and not na(prevSrc) and not na(curSrc) and (isBear ? (curPrice > prevPrice and curSrc < prevSrc) : (curPrice < prevPrice and curSrc > prevSrc))
  141. prevPrice := curPrice
  142. prevSrc := curSrc
  143. isDiv
  144.  
  145. f_addLine(array<line> arr, line ln, int maxN) =>
  146. arr.push(ln)
  147. while arr.size() > maxN
  148. line.delete(arr.shift())
  149. arr.size()
  150.  
  151. f_autoLookback() =>
  152. int tfSec = timeframe.in_seconds(timeframe.period)
  153. tfSec <= 60 ? 8 : tfSec <= 300 ? 6 : tfSec <= 1800 ? 5 : tfSec <= 14400 ? 4 : tfSec <= 86400 ? 3 : 2
  154.  
  155. bool hasVol = ta.cum(nz(volume)) > 0
  156. float vol = hasVol ? nz(volume) : 1.0
  157. float rng = math.max(high - low, syminfo.mintick)
  158.  
  159. float rsiVal = ta.rsi(close, oscLen)
  160. float stochVal = ta.stoch(close, high, low, oscLen)
  161. float cciVal = ta.cci(hlc3, oscLen)
  162. float mfiRaw = ta.mfi(hlc3, oscLen)
  163. float rsiHlc = ta.rsi(hlc3, oscLen)
  164. float mfiVal = hasVol and not na(mfiRaw) ? mfiRaw : rsiHlc
  165.  
  166. float rsiN = (nz(rsiVal, 50) - 50) * 2
  167. float stochN = (nz(stochVal, 50) - 50) * 2
  168. float cciN = f_clamp(nz(cciVal) / 2, -150, 150)
  169. float oscRaw = (rsiN + stochN + cciN) / 3
  170. float oscZl = f_zlema(oscRaw, oscSmooth)
  171. float osc = ta.ema(oscZl, 2) * oscGain
  172. bool oscUp = osc >= nz(osc[1], osc)
  173. color oscCol = oscUp ? bullCol : bearCol
  174.  
  175. float clv = ((close - low) - (high - close)) / rng
  176. float mfVolRaw = math.sum(clv * vol, mfLen) / math.max(math.sum(vol, mfLen), EPS) * 100
  177. float mfPriceRaw = ta.ema((close - open) / rng, mfLen) * 100
  178. float mfRaw = moneyMode == "Volume Weighted" and hasVol ? mfVolRaw : mfPriceRaw
  179. float mfLocal = f_clamp(f_zlema(nz(mfRaw), mfSmooth) * mfMult, -100, 100)
  180.  
  181. bool useHtf = mtfOn and timeframe.in_seconds(mtfTf) > timeframe.in_seconds(timeframe.period)
  182. float mfHtf = useHtf ? request.security(syminfo.tickerid, mtfTf, mfLocal[1], lookahead = barmerge.lookahead_on) : na
  183. float mf = useHtf and not na(mfHtf) ? mfHtf : mfLocal
  184.  
  185. float bullVolSrc = close > open ? vol : close < open ? 0.0 : vol * 0.5
  186. float bearVolSrc = close < open ? vol : close > open ? 0.0 : vol * 0.5
  187. float bullV = ta.ema(bullVolSrc, vmLen)
  188. float bearV = ta.ema(bearVolSrc, vmLen)
  189. float vmDelta = (bullV - bearV) / math.max(bullV + bearV, EPS)
  190. float volEma = ta.ema(vol, vmLen)
  191. float volHi = ta.highest(volEma, 200)
  192. float vmNorm = nz(volEma / math.max(nz(volHi, volEma), EPS), 0.5)
  193. float vmTop = VM_BASE + 8.0 + (0.5 * vmNorm + 0.5 * math.abs(nz(vmDelta))) * vmHeight
  194. color vmBaseCol = color.from_gradient(nz(vmDelta), -0.6, 0.6, bearCol, bullCol)
  195.  
  196. float emaFast = ta.ema(close, t7Fast)
  197. float emaSlow = ta.ema(close, t7Slow)
  198. [macdLine, macdSig, _] = ta.macd(close, 12, 26, 9)
  199. bool c1 = close > emaFast
  200. bool c2 = emaFast > emaSlow
  201. bool c3 = nz(rsiVal, 50) > 50
  202. bool c4 = nz(macdLine) > nz(macdSig)
  203. bool c5 = nz(mfiVal, 50) > 50
  204. bool c6 = oscUp
  205. bool c7 = mf > 0
  206. int bullCount = (c1 ? 1 : 0) + (c2 ? 1 : 0) + (c3 ? 1 : 0) + (c4 ? 1 : 0) + (c5 ? 1 : 0) + (c6 ? 1 : 0) + (c7 ? 1 : 0)
  207. int bearCount = 7 - bullCount
  208. int rank = bullCount - bearCount
  209. bool rankWeak = math.abs(rank) < math.abs(nz(rank[1], rank))
  210.  
  211. bool vwapReset = timeframe.change(vwapAnchor)
  212. [_, vwapUp, vwapDn] = ta.vwap(hlc3, vwapReset, vwapMult)
  213. bool vsBearRaw = hasVol and not na(vwapUp) and nz(close[1]) > nz(vwapUp[1]) and close <= vwapUp
  214. bool vsBullRaw = hasVol and not na(vwapDn) and nz(close[1]) < nz(vwapDn[1]) and close >= vwapDn
  215.  
  216. int psLb = psAuto ? f_autoLookback() : psManual
  217. float pricePH = ta.pivothigh(high, psLb, psLb)
  218. float pricePL = ta.pivotlow(low, psLb, psLb)
  219. bool phFound = not na(pricePH)
  220. bool plFound = not na(pricePL)
  221. bool bearRsi = f_div(rsiVal, phFound, psLb, true)
  222. bool bearMfi = f_div(mfiVal, phFound, psLb, true)
  223. bool bearCci = f_div(cciVal, phFound, psLb, true)
  224. bool bearOsc = f_div(osc, phFound, psLb, true)
  225. bool bullRsi = f_div(rsiVal, plFound, psLb, false)
  226. bool bullMfi = f_div(mfiVal, plFound, psLb, false)
  227. bool bullCci = f_div(cciVal, plFound, psLb, false)
  228. bool bullOsc = f_div(osc, plFound, psLb, false)
  229. int psBearCnt = (bearRsi ? 1 : 0) + (bearMfi ? 1 : 0) + (bearCci ? 1 : 0) + (bearOsc ? 1 : 0)
  230. int psBullCnt = (bullRsi ? 1 : 0) + (bullMfi ? 1 : 0) + (bullCci ? 1 : 0) + (bullOsc ? 1 : 0)
  231.  
  232. float oscPH = ta.pivothigh(osc, divLeft, divRight)
  233. float oscPL = ta.pivotlow(osc, divLeft, divRight)
  234. float hiAtPivot = high[divRight]
  235. float loAtPivot = low[divRight]
  236.  
  237. float vwPrice = math.sum(hlc3 * vol, mvpVwLen) / math.max(math.sum(vol, mvpVwLen), EPS)
  238. float mvpRaw = (nz(ta.rsi(vwPrice, mvpLen), 50) - 50) * 2
  239. float mvpFast = f_clamp(ta.ema(mvpRaw, mvpSmooth), -100, 100)
  240. float mvpSlow = ta.ema(mvpFast, mvpSignal)
  241. bool mvpUp = mvpFast >= mvpSlow
  242. bool mvpCrossUp = ta.crossover(mvpFast, mvpSlow)
  243. bool mvpCrossDn = ta.crossunder(mvpFast, mvpSlow)
  244. bool mvpOverExt = math.abs(mvpFast) >= mvpExt
  245. bool mfCrossUp = ta.crossover(mf, 0.0)
  246. bool mfCrossDn = ta.crossunder(mf, 0.0)
  247.  
  248. bool revBear = osc[1] >= revLevel and osc < osc[1] and osc[1] >= nz(osc[2], osc[1])
  249. bool revBull = osc[1] <= -revLevel and osc > osc[1] and osc[1] <= nz(osc[2], osc[1])
  250.  
  251. bool obCond = osc >= obLevel
  252. bool osCond = osc <= osLevel
  253.  
  254. bool psBear = psBearCnt >= psMin
  255. bool psBull = psBullCnt >= psMin
  256.  
  257. bool mvpBuy = mvpCrossUp and nz(mvpFast[1]) <= -mvpSigLevel
  258. bool mvpSell = mvpCrossDn and nz(mvpFast[1]) >= mvpSigLevel
  259.  
  260. var int mktDir = 0
  261. int prevDir = mktDir
  262. if rank >= dsThresh and mf > 0
  263. mktDir := 1
  264. else if rank <= -dsThresh and mf < 0
  265. mktDir := -1
  266. bool dsBull = mktDir == 1 and prevDir == -1
  267. bool dsBear = mktDir == -1 and prevDir == 1
  268.  
  269. var int obStart = na
  270. var int osStart = na
  271. var label obLbl = na
  272. var label osLbl = na
  273. if isPrime and showObOs
  274. if obCond and not obCond[1]
  275. obStart := bar_index
  276. obLbl := label.new(bar_index, OB_TXT_Y, "OB", xloc = xloc.bar_index, yloc = yloc.price, color = color(na), style = label.style_none, textcolor = obosCol, size = size.tiny)
  277. else if obCond and not na(obLbl)
  278. label.set_x(obLbl, int(math.round((obStart + bar_index) / 2.0)))
  279. if osCond and not osCond[1]
  280. osStart := bar_index
  281. osLbl := label.new(bar_index, OS_TXT_Y, "OS", xloc = xloc.bar_index, yloc = yloc.price, color = color(na), style = label.style_none, textcolor = obosCol, size = size.tiny)
  282. else if osCond and not na(osLbl)
  283. label.set_x(osLbl, int(math.round((osStart + bar_index) / 2.0)))
  284.  
  285. var array<line> divLines = array.new<line>()
  286. var float lastHOsc = na
  287. var float lastHPrice = na
  288. var int lastHBar = na
  289. var float lastLOsc = na
  290. var float lastLPrice = na
  291. var int lastLBar = na
  292. bool regBear = false
  293. bool hidBear = false
  294. bool regBull = false
  295. bool hidBull = false
  296. bool drawDiv = isPrime and showDiv
  297.  
  298. if not na(oscPH)
  299. int curBar = bar_index - divRight
  300. if not na(lastHOsc) and not na(lastHBar)
  301. int dist = curBar - lastHBar
  302. if dist >= divMinRange and dist <= divMaxRange
  303. regBear := showRegDiv and hiAtPivot > lastHPrice and oscPH < lastHOsc
  304. hidBear := showHidDiv and hiAtPivot < lastHPrice and oscPH > lastHOsc
  305. if drawDiv and regBear
  306. f_addLine(divLines, line.new(lastHBar, lastHOsc, curBar, oscPH, xloc = xloc.bar_index, color = divBearCol, width = 2), divMaxLines)
  307. if drawDiv and hidBear
  308. f_addLine(divLines, line.new(lastHBar, lastHOsc, curBar, oscPH, xloc = xloc.bar_index, color = divHidCol, width = 2), divMaxLines)
  309. lastHOsc := oscPH
  310. lastHPrice := hiAtPivot
  311. lastHBar := curBar
  312.  
  313. if not na(oscPL)
  314. int curBar = bar_index - divRight
  315. if not na(lastLOsc) and not na(lastLBar)
  316. int dist = curBar - lastLBar
  317. if dist >= divMinRange and dist <= divMaxRange
  318. regBull := showRegDiv and loAtPivot < lastLPrice and oscPL > lastLOsc
  319. hidBull := showHidDiv and loAtPivot > lastLPrice and oscPL < lastLOsc
  320. if drawDiv and regBull
  321. f_addLine(divLines, line.new(lastLBar, lastLOsc, curBar, oscPL, xloc = xloc.bar_index, color = divBullCol, width = 2), divMaxLines)
  322. if drawDiv and hidBull
  323. f_addLine(divLines, line.new(lastLBar, lastLOsc, curBar, oscPL, xloc = xloc.bar_index, color = divHidCol, width = 2), divMaxLines)
  324. lastLOsc := oscPL
  325. lastLPrice := loAtPivot
  326. lastLBar := curBar
  327.  
  328. hline(0, "Zero Line", color = zeroCol, linestyle = hline.style_solid)
  329. hline(75, "Upper Level", color = levelCol, linestyle = hline.style_solid)
  330. hline(-75, "Lower Level", color = levelCol, linestyle = hline.style_solid)
  331. hline(100, "Upper Extreme", color = levelCol, linestyle = hline.style_dotted)
  332. hline(-100, "Lower Extreme", color = levelCol, linestyle = hline.style_dotted)
  333.  
  334. bool vmOn = isPrime and showVM
  335. plot(vmOn ? vmTop : na, "Volume Matrix", color = color.new(vmBaseCol, 78), style = plot.style_columns, histbase = VM_BASE)
  336. plot(vmOn ? vmTop : na, "Volume Matrix Line", color = color.new(vmBaseCol, 45), linewidth = 1)
  337.  
  338. bool mfOn = isPrime and showMF
  339. pZero = plot(mfOn ? 0.0 : na, "Money Flow Base", display = display.none, editable = false)
  340. pMfPos = plot(mfOn ? math.max(mf, 0.0) : na, "Money Flow Positive", display = display.none, editable = false)
  341. pMfNeg = plot(mfOn ? math.min(mf, 0.0) : na, "Money Flow Negative", display = display.none, editable = false)
  342. fill(pMfPos, pZero, mfOn ? math.max(mf, 0.01) : na, 0.0, color.new(bullCol, 45), color.new(bullCol, 96), "Money Flow In")
  343. fill(pZero, pMfNeg, 0.0, mfOn ? math.min(mf, -0.01) : na, color.new(bearCol, 96), color.new(bearCol, 45), "Money Flow Out")
  344. plot(mfOn ? mf : na, "Money Flow Tracker", color = color.new(mf >= 0 ? bullCol : bearCol, 35), linewidth = 2)
  345.  
  346. bool t7On = isPrime and showT7
  347. color t7Col = color.new(rank > 0 ? bullCol : bearCol, rankWeak ? 72 : 45)
  348. plot(t7On ? rank * t7Scale : na, "The True 7", color = t7Col, linewidth = 1, style = plot.style_stepline)
  349.  
  350. bool pbOn = isPrime and showPB
  351. plot(pbOn ? TOP_STRIP : na, "Top Power Bar", color = f_stripColor(bullCount, pbMin, bullCol, pbHiCol), linewidth = 4, style = plot.style_linebr)
  352. plot(pbOn ? BOT_STRIP : na, "Bottom Power Bar", color = f_stripColor(bearCount, pbMin, bearCol, pbHiCol), linewidth = 4, style = plot.style_linebr)
  353.  
  354. bool oscOn = isPrime and showOsc
  355. bool glowOn = oscOn and showGlow
  356. plot(glowOn ? osc : na, "Oscillator Glow", color = color.new(oscCol, 82), linewidth = 6)
  357. plot(oscOn ? osc : na, "Main Oscillator", color = oscCol, linewidth = 2)
  358.  
  359. plotshape(isPrime and showObOs and obCond ? OB_Y : na, "OB Marker", style = shape.square, location = location.absolute, color = obosCol, size = size.tiny)
  360. plotshape(isPrime and showObOs and osCond ? OS_Y : na, "OS Marker", style = shape.square, location = location.absolute, color = obosCol, size = size.tiny)
  361.  
  362. plotchar(isPrime and showVS and vsBearRaw ? VS_Y : na, "Volume Signal Down", char = "⇣", location = location.absolute, color = vsCol, size = size.tiny)
  363. plotchar(isPrime and showVS and vsBullRaw ? -VS_Y : na, "Volume Signal Up", char = "⇡", location = location.absolute, color = vsCol, size = size.tiny)
  364.  
  365. plotshape(isPrime and showRev and revBear ? REV_Y : na, "Reversal Down", style = shape.triangledown, location = location.absolute, color = revBearCol, size = size.tiny, offset = -1)
  366. plotshape(isPrime and showRev and revBull ? -REV_Y : na, "Reversal Up", style = shape.triangleup, location = location.absolute, color = revBullCol, size = size.tiny, offset = -1)
  367.  
  368. plotshape(isPrime and showPS and psBear ? PS_Y : na, "Peak Seeker Bearish", style = shape.circle, location = location.absolute, color = psCol, size = size.tiny, offset = -psLb)
  369. plotshape(isPrime and showPS and psBull ? -PS_Y : na, "Peak Seeker Bullish", style = shape.circle, location = location.absolute, color = psCol, size = size.tiny, offset = -psLb)
  370.  
  371. plotshape(isPrime and showDS and dsBear ? osc + DS_OFFSET : na, "Diamond Shift Bearish", style = shape.diamond, location = location.absolute, color = dsCol, size = size.tiny)
  372. plotshape(isPrime and showDS and dsBull ? osc - DS_OFFSET : na, "Diamond Shift Bullish", style = shape.diamond, location = location.absolute, color = dsCol, size = size.tiny)
  373.  
  374. color mvpCol = mvpUp ? mvpUpCol : mvpDnCol
  375. plot(isMvp and showMvpBars and mvpOverExt ? mvpFast : na, "MVP Overextended Bars", color = color.new(mvpBarCol, 35), style = plot.style_columns, histbase = 0.0)
  376. pMvpFast = plot(isMvp ? mvpFast : na, "MVP Ribbon Fast", color = mvpCol, linewidth = 2)
  377. pMvpSlow = plot(isMvp ? mvpSlow : na, "MVP Ribbon Slow", color = color.new(mvpCol, 40), linewidth = 1)
  378. fill(pMvpFast, pMvpSlow, color.new(mvpCol, 55), "MVP Ribbon Fill")
  379. plotshape(isMvp and showMvpSig and mvpBuy ? -MVP_SIG_Y : na, "MVP Buy Signal", style = shape.arrowup, location = location.absolute, color = mvpUpCol, size = size.small)
  380. plotshape(isMvp and showMvpSig and mvpSell ? MVP_SIG_Y : na, "MVP Sell Signal", style = shape.arrowdown, location = location.absolute, color = mvpDnCol, size = size.small)
  381.  
  382. string tk = syminfo.ticker + " (" + timeframe.period + ")"
  383. string pre = "Prime Oscillators: "
  384. if isPrime and revBull
  385. alert(pre + "Bullish reversal on " + tk, alert.freq_once_per_bar_close)
  386. if isPrime and revBear
  387. alert(pre + "Bearish reversal on " + tk, alert.freq_once_per_bar_close)
  388. if isPrime and obCond and not obCond[1]
  389. alert(pre + "Overbought on " + tk, alert.freq_once_per_bar_close)
  390. if isPrime and osCond and not osCond[1]
  391. alert(pre + "Oversold on " + tk, alert.freq_once_per_bar_close)
  392. if isPrime and vsBullRaw
  393. alert(pre + "Volume signal up on " + tk, alert.freq_once_per_bar_close)
  394. if isPrime and vsBearRaw
  395. alert(pre + "Volume signal down on " + tk, alert.freq_once_per_bar_close)
  396. if isPrime and psBull
  397. alert(pre + "Bullish Peak Seeker on " + tk, alert.freq_once_per_bar_close)
  398. if isPrime and psBear
  399. alert(pre + "Bearish Peak Seeker on " + tk, alert.freq_once_per_bar_close)
  400. if isPrime and regBull
  401. alert(pre + "Bullish divergence on " + tk, alert.freq_once_per_bar_close)
  402. if isPrime and regBear
  403. alert(pre + "Bearish divergence on " + tk, alert.freq_once_per_bar_close)
  404. if isPrime and hidBull
  405. alert(pre + "Hidden bullish divergence on " + tk, alert.freq_once_per_bar_close)
  406. if isPrime and hidBear
  407. alert(pre + "Hidden bearish divergence on " + tk, alert.freq_once_per_bar_close)
  408. if isPrime and dsBull
  409. alert(pre + "Diamond Shift bullish on " + tk, alert.freq_once_per_bar_close)
  410. if isPrime and dsBear
  411. alert(pre + "Diamond Shift bearish on " + tk, alert.freq_once_per_bar_close)
  412. if isPrime and mfCrossUp
  413. alert(pre + "Money Flow above zero on " + tk, alert.freq_once_per_bar_close)
  414. if isPrime and mfCrossDn
  415. alert(pre + "Money Flow below zero on " + tk, alert.freq_once_per_bar_close)
  416. if isMvp and mvpBuy
  417. alert(pre + "MVP buy on " + tk, alert.freq_once_per_bar_close)
  418. if isMvp and mvpSell
  419. alert(pre + "MVP sell on " + tk, alert.freq_once_per_bar_close)
  420. if isMvp and mvpOverExt and not mvpOverExt[1]
  421. alert(pre + "MVP overextended on " + tk, alert.freq_once_per_bar_close)
Add Comment
Please, Sign In to add comment