name
stringlengths
1
64
url
stringlengths
44
135
author
stringlengths
3
30
author_url
stringlengths
34
61
likes_count
int64
0
33.2k
kind
stringclasses
3 values
pine_version
int64
1
5
license
stringclasses
3 values
source
stringlengths
177
279k
z_score
https://www.tradingview.com/script/tfWBpl8m-z-score/
crashout75
https://www.tradingview.com/u/crashout75/
19
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © crashout75 //@version=5 indicator("z_score") window = input(40, title="window") vSMA = ta.sma(close,window) vSTDDEV = ta.stdev(close,window,true) plot((close-vSMA)/vSTDDEV,title="Z-SCORE", style=plot.style_columns, color=color.new(color.blue,50)) h0=plot(10, color=color.new(color.green,50), title ="z=10") h1=plot(2, color=color.new(color.green,50), title ="z=2") h2=plot(1, color=color.new(color.green,50), title ="z=1") h3=plot(0, color=color.new(color.blue,50), title ="z=0") h4=plot(-1, color=color.new(color.green,50), title ="z=-1") h5=plot(-2, color=color.new(color.green,50), title ="z=-2") h6=plot(-10, color=color.new(color.green,50), title ="z=-10") fill(h0, h1, color=color.new(color.green, 70), title="STRONG BUY") fill(h1, h2, color=color.new(color.green, 85), title="BUY") fill(h2, h4, color=color.new(color.gray, 90), title="NO TRADE") fill(h4, h5, color=color.new(color.green, 85), title="SELL") fill(h5, h6, color=color.new(color.green, 70), title="STRONG SELL") //tweak
PA-Adaptive MACD w/ Variety Levels [Loxx]
https://www.tradingview.com/script/EMgpsmRE-PA-Adaptive-MACD-w-Variety-Levels-Loxx/
loxx
https://www.tradingview.com/u/loxx/
79
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("PA-Adaptive MACD w/ Variety Levels [Loxx]", shorttitle='PAMACDDZ [Loxx]', overlay = false, timeframe="", timeframe_gaps = true) import loxx/loxxexpandedsourcetypes/3 import loxx/loxxmas/1 import loxx/loxxpaaspecial/1 SM02 = 'Zero-Line Cross' SM03 = 'Signal Crossover' SM04 = 'Levels Crossover' RMA(x, t) => EMA1 = x EMA1 := na(EMA1[1]) ? x : (x - nz(EMA1[1])) * (1/t) + nz(EMA1[1]) EMA1 EMA(x, t) => EMA1 = x EMA1 := na(EMA1[1]) ? x : (x - nz(EMA1[1])) * (2 / (t + 1)) + nz(EMA1[1]) EMA1 variant(type, src, len) => sig = 0.0 if type == "SMA" sig := ta.sma(src, len) else if type == "EMA" sig := EMA(src, len) else if type == "WMA" sig := ta.wma(src, len) else if type == "RMA" sig := RMA(src, len) sig greencolor = #2DD204 redcolor = #D2042D lightgreencolor = #96E881 lightredcolor = #DF4F6C smthtype = input.string("Kaufman", "Heikin-Ashi Better Caculation Type", options = ["AMA", "T3", "Kaufman"], group = "Basic Settings") srcin = input.string("Close", "Source", group= "Basic Settings", options = ["Close", "Open", "High", "Low", "Median", "Typical", "Weighted", "Average", "Average Median Body", "Trend Biased", "Trend Biased (Extreme)", "HA Close", "HA Open", "HA High", "HA Low", "HA Median", "HA Typical", "HA Weighted", "HA Average", "HA Average Median Body", "HA Trend Biased", "HA Trend Biased (Extreme)", "HAB Close", "HAB Open", "HAB High", "HAB Low", "HAB Median", "HAB Typical", "HAB Weighted", "HAB Average", "HAB Average Median Body", "HAB Trend Biased", "HAB Trend Biased (Extreme)"]) matype = input.string("EMA", "Signal Type", options = ["EMA", "WMA", "RMA", "SMA"], group = "Basic Settings") sigtype = input.string("EMA", "Signal Type", options = ["EMA", "WMA", "RMA", "SMA"], group = "Signal Settings") signalMode = input.string(SM03, 'Signal Type', options=[SM02, SM03, SM04], group = "Signal Settings") sigper = input.int(9, "Signal Period", group = "Signal Settings") fregcycles = input.float(1.5, title = "Fast PA Cycles", group= "Phase Accumulation Cycle Settings") fregfilter = input.float(1.0, title = "Fast PA Filter", group= "Phase Accumulation Cycle Settings") sregcycles = input.float(3.0, title = "Slow PA Cycles", group= "Phase Accumulation Cycle Settings") sregfilter = input.float(1.0, title = "Slow PA Filter", group= "Phase Accumulation Cycle Settings") sigregcycles = input.float(1., title = "Signal PA Cycles", group= "Phase Accumulation Cycle Settings") sigregfilter = input.float(1.0, title = "Signal PA Filter", group= "Phase Accumulation Cycle Settings") levelstype = input.string("Floating", "Levels type", options = ["Floating", "Quantile"], group = "Levels Settings") FlPeriod = input.int(35, "Levels Period", group = "Levels Settings") FlUp = input.float(90 , "Up Level", group = "Levels Settings") FlDn = input.float(10 , "Down Level", group = "Levels Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") kfl=input.float(0.666, title="* Kaufman's Adaptive MA (KAMA) Only - Fast End", group = "Moving Average Inputs") ksl=input.float(0.0645, title="* Kaufman's Adaptive MA (KAMA) Only - Slow End", group = "Moving Average Inputs") amafl = input.int(2, title="* Adaptive Moving Average (AMA) Only - Fast", group = "Moving Average Inputs") amasl = input.int(30, title="* Adaptive Moving Average (AMA) Only - Slow", group = "Moving Average Inputs") haclose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) haopen = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open) hahigh = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high) halow = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low) hamedian = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hl2) hatypical = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlc3) haweighted = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlcc4) haaverage = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, ohlc4) src = switch srcin "Close" => loxxexpandedsourcetypes.rclose() "Open" => loxxexpandedsourcetypes.ropen() "High" => loxxexpandedsourcetypes.rhigh() "Low" => loxxexpandedsourcetypes.rlow() "Median" => loxxexpandedsourcetypes.rmedian() "Typical" => loxxexpandedsourcetypes.rtypical() "Weighted" => loxxexpandedsourcetypes.rweighted() "Average" => loxxexpandedsourcetypes.raverage() "Average Median Body" => loxxexpandedsourcetypes.ravemedbody() "Trend Biased" => loxxexpandedsourcetypes.rtrendb() "Trend Biased (Extreme)" => loxxexpandedsourcetypes.rtrendbext() "HA Close" => loxxexpandedsourcetypes.haclose(haclose) "HA Open" => loxxexpandedsourcetypes.haopen(haopen) "HA High" => loxxexpandedsourcetypes.hahigh(hahigh) "HA Low" => loxxexpandedsourcetypes.halow(halow) "HA Median" => loxxexpandedsourcetypes.hamedian(hamedian) "HA Typical" => loxxexpandedsourcetypes.hatypical(hatypical) "HA Weighted" => loxxexpandedsourcetypes.haweighted(haweighted) "HA Average" => loxxexpandedsourcetypes.haaverage(haaverage) "HA Average Median Body" => loxxexpandedsourcetypes.haavemedbody(haclose, haopen) "HA Trend Biased" => loxxexpandedsourcetypes.hatrendb(haclose, haopen, hahigh, halow) "HA Trend Biased (Extreme)" => loxxexpandedsourcetypes.hatrendbext(haclose, haopen, hahigh, halow) "HAB Close" => loxxexpandedsourcetypes.habclose(smthtype, amafl, amasl, kfl, ksl) "HAB Open" => loxxexpandedsourcetypes.habopen(smthtype, amafl, amasl, kfl, ksl) "HAB High" => loxxexpandedsourcetypes.habhigh(smthtype, amafl, amasl, kfl, ksl) "HAB Low" => loxxexpandedsourcetypes.hablow(smthtype, amafl, amasl, kfl, ksl) "HAB Median" => loxxexpandedsourcetypes.habmedian(smthtype, amafl, amasl, kfl, ksl) "HAB Typical" => loxxexpandedsourcetypes.habtypical(smthtype, amafl, amasl, kfl, ksl) "HAB Weighted" => loxxexpandedsourcetypes.habweighted(smthtype, amafl, amasl, kfl, ksl) "HAB Average" => loxxexpandedsourcetypes.habaverage(smthtype, amafl, amasl, kfl, ksl) "HAB Average Median Body" => loxxexpandedsourcetypes.habavemedbody(smthtype, amafl, amasl, kfl, ksl) "HAB Trend Biased" => loxxexpandedsourcetypes.habtrendb(smthtype, amafl, amasl, kfl, ksl) "HAB Trend Biased (Extreme)" => loxxexpandedsourcetypes.habtrendbext(smthtype, amafl, amasl, kfl, ksl) => haclose int flen = math.floor(loxxpaaspecial.paa(close, fregcycles, fregfilter)) flen := flen < 1 ? 1 : flen int slen = math.floor(loxxpaaspecial.paa(close, sregcycles, sregfilter)) slen := slen < 1 ? 1 : slen int siglen = math.floor(loxxpaaspecial.paa(close, sigregcycles, sigregfilter)) siglen := siglen < 1 ? 1 : siglen fma = variant(matype, src, flen) sloma = variant(matype, src, slen) macd = fma - sloma signal = variant(sigtype, macd, siglen) flhi = 0., mid = 0., fllo = 0., if levelstype == "Floating" min = ta.lowest(macd, FlPeriod) max = ta.highest(macd, FlPeriod) rng = max-min flhi := min + FlUp * rng / 100.0 mid := min + 0.5 * rng fllo := min + FlDn * rng / 100.0 else flhi := ta.percentile_linear_interpolation(macd, FlPeriod, FlUp) mid := ta.percentile_linear_interpolation(macd, FlPeriod, (FlUp+FlDn)/2.0) fllo := ta.percentile_linear_interpolation(macd, FlPeriod, FlDn) colorout = signalMode == SM03 ? (macd > signal ? greencolor : redcolor) : signalMode == SM02 ? (macd > 0 ? greencolor : redcolor) : (macd > flhi ? greencolor : macd < fllo ? redcolor : color.gray) plot(flhi, color = bar_index % 2 ? greencolor : na) plot(mid, color = bar_index % 2 ? color.gray : na) plot(fllo, color = bar_index % 2 ? redcolor : na) plot(macd, color = colorout, linewidth = 2) plot(signal, color = color.white, linewidth = 1) plot(0, color = bar_index % 2 ? color.gray : na) barcolor(colorbars ? colorout : na) goLong = signalMode == SM03 ? ta.crossover(macd, signal) : signalMode == SM02 ? ta.crossover(macd, 0) : ta.crossover(macd, flhi) goShort = signalMode == SM03 ? ta.crossunder(macd, signal) : signalMode == SM02 ? ta.crossunder(macd, 0) : ta.crossunder(macd, fllo) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="PA-Adaptive MACD w/ Variety Levels [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="PA-Adaptive MACD w/ Variety Levels [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
Williams %R on Chart w/ Dynamic Zones [Loxx]
https://www.tradingview.com/script/tIqpzA2b-Williams-R-on-Chart-w-Dynamic-Zones-Loxx/
loxx
https://www.tradingview.com/u/loxx/
108
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Williams %R on Chart w/ Dynamic Zones [Loxx]", shorttitle='WPRDZ [Loxx]', overlay = true, timeframe="", timeframe_gaps = true) import loxx/loxxdynamiczone/3 import loxx/loxxexpandedsourcetypes/4 import loxx/loxxmas/1 greencolor = #2DD204 redcolor = #D2042D lightgreencolor = #96E881 lightredcolor = #DF4F6C _iT3(src, per, hot, org)=> a = hot _c1 = -a * a * a _c2 = 3 * a * a + 3 * a * a * a _c3 = -6 * a * a - 3 * a - 3 * a * a * a _c4 = 1 + 3 * a + a * a * a + 3 * a * a alpha = 0. if (org) alpha := 2.0 / (1.0 + per) else alpha := 2.0 / (2.0 + (per - 1.0) / 2.0) _t30 = src, _t31 = src _t32 = src, _t33 = src _t34 = src, _t35 = src _t30 := nz(_t30[1]) + alpha * (src - nz(_t30[1])) _t31 := nz(_t31[1]) + alpha * (_t30 - nz(_t31[1])) _t32 := nz(_t32[1]) + alpha * (_t31 - nz(_t32[1])) _t33 := nz(_t33[1]) + alpha * (_t32 - nz(_t33[1])) _t34 := nz(_t34[1]) + alpha * (_t33 - nz(_t34[1])) _t35 := nz(_t35[1]) + alpha * (_t34 - nz(_t35[1])) out = _c1 * _t35 + _c2 * _t34 + _c3 * _t33 + _c4 * _t32 out smthtype = input.string("Kaufman", "Heikin-Ashi Better Caculation Type", options = ["AMA", "T3", "Kaufman"], group = "Basic Settings") srcin = input.string("Close", "Source", group= "Basic Settings", options = ["Close", "Open", "High", "Low", "Median", "Typical", "Weighted", "Average", "Average Median Body", "Trend Biased", "Trend Biased (Extreme)", "HA Close", "HA Open", "HA High", "HA Low", "HA Median", "HA Typical", "HA Weighted", "HA Average", "HA Average Median Body", "HA Trend Biased", "HA Trend Biased (Extreme)", "HAB Close", "HAB Open", "HAB High", "HAB Low", "HAB Median", "HAB Typical", "HAB Weighted", "HAB Average", "HAB Average Median Body", "HAB Trend Biased", "HAB Trend Biased (Extreme)"]) wprper = input.int(21, "WPR Period", group = "Basic Settings") T3Period= input.int(21, "T3 Period", group = "Basic Settings") T3Hot = input.float(1, "T3 Hot", group = "Basic Settings") T3Original = input.bool(false, "T3 original?", group = "Basic Settings") MaPeriod = input.int(21, "MA Period", group = "Basic Settings") type = input.string("Simple Moving Average - SMA", "MA Type", options = ["ADXvma - Average Directional Volatility Moving Average", "Ahrens Moving Average" , "Alexander Moving Average - ALXMA", "Double Exponential Moving Average - DEMA", "Double Smoothed Exponential Moving Average - DSEMA" , "Exponential Moving Average - EMA", "Fast Exponential Moving Average - FEMA", "Fractal Adaptive Moving Average - FRAMA" , "Hull Moving Average - HMA", "IE/2 - Early T3 by Tim Tilson", "Integral of Linear Regression Slope - ILRS" , "Instantaneous Trendline", "Laguerre Filter", "Leader Exponential Moving Average", "Linear Regression Value - LSMA (Least Squares Moving Average)" , "Linear Weighted Moving Average - LWMA", "McGinley Dynamic", "McNicholl EMA", "Non-Lag Moving Average", "Parabolic Weighted Moving Average" , "Recursive Moving Trendline", "Simple Moving Average - SMA", "Sine Weighted Moving Average", "Smoothed Moving Average - SMMA" , "Smoother", "Super Smoother", "Three-pole Ehlers Butterworth", "Three-pole Ehlers Smoother" , "Triangular Moving Average - TMA", "Triple Exponential Moving Average - TEMA", "Two-pole Ehlers Butterworth", "Two-pole Ehlers smoother" , "Volume Weighted EMA - VEMA", "Zero-Lag DEMA - Zero Lag Double Exponential Moving Average", "Zero-Lag Moving Average" , "Zero Lag TEMA - Zero Lag Triple Exponential Moving Average"], group = "Basic Settings") atrper = input.int(120, "ATR Period", group = "Basic Settings") dzper = input.int(49, "Dynamic Zone Period", group = "Basic Settings") buy1 = input.float(0.1 , "Dynamic Zone Buy Probability Level 1", group = "Levels Settings", maxval = 0.5) buy2 = input.float(0.25 , "Dynamic Zone Buy Probability Level 2", group = "Levels Settings", maxval = 0.5) sell1 = input.float(0.1 , "Dynamic Zone Sell Probability Level 1", group = "Levels Settings", maxval = 0.5) sell2 = input.float(0.25 , "Dynamic Zone Sell Probability Level 2", group = "Levels Settings", maxval = 0.5) colorbars = input.bool(false, "Color bars?", group= "UI Options") ShowMiddleLine = input.bool(true, "Show middle line?", group = "UI Options") filllevels = input.bool(false, "Show fill colors?", group = "UI Options") frama_FC = input.int(defval=1, title="* Fractal Adjusted (FRAMA) Only - FC", group = "Moving Average Inputs") frama_SC = input.int(defval=200, title="* Fractal Adjusted (FRAMA) Only - SC", group = "Moving Average Inputs") instantaneous_alpha = input.float(defval=0.07, minval = 0, title="* Instantaneous Trendline (INSTANT) Only - Alpha", group = "Moving Average Inputs") _laguerre_alpha = input.float(title="* Laguerre Filter (LF) Only - Alpha", minval=0, maxval=1, step=0.1, defval=0.7, group = "Moving Average Inputs") lsma_offset = input.int(defval=0, title="* Least Squares Moving Average (LSMA) Only - Offset", group = "Moving Average Inputs") _pwma_pwr = input.int(2, "* Parabolic Weighted Moving Average (PWMA) Only - Power", minval=0, group = "Moving Average Inputs") kfl=input.float(0.666, title="* Kaufman's Adaptive MA (KAMA) Only - Fast End", group = "Moving Average Inputs") ksl=input.float(0.0645, title="* Kaufman's Adaptive MA (KAMA) Only - Slow End", group = "Moving Average Inputs") amafl = input.int(2, title="* Adaptive Moving Average (AMA) Only - Fast", group = "Moving Average Inputs") amasl = input.int(30, title="* Adaptive Moving Average (AMA) Only - Slow", group = "Moving Average Inputs") haclose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) haopen = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open) hahigh = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high) halow = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low) hamedian = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hl2) hatypical = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlc3) haweighted = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlcc4) haaverage = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, ohlc4) src = switch srcin "Close" => loxxexpandedsourcetypes.rclose() "Open" => loxxexpandedsourcetypes.ropen() "High" => loxxexpandedsourcetypes.rhigh() "Low" => loxxexpandedsourcetypes.rlow() "Median" => loxxexpandedsourcetypes.rmedian() "Typical" => loxxexpandedsourcetypes.rtypical() "Weighted" => loxxexpandedsourcetypes.rweighted() "Average" => loxxexpandedsourcetypes.raverage() "Average Median Body" => loxxexpandedsourcetypes.ravemedbody() "Trend Biased" => loxxexpandedsourcetypes.rtrendb() "Trend Biased (Extreme)" => loxxexpandedsourcetypes.rtrendbext() "HA Close" => loxxexpandedsourcetypes.haclose(haclose) "HA Open" => loxxexpandedsourcetypes.haopen(haopen) "HA High" => loxxexpandedsourcetypes.hahigh(hahigh) "HA Low" => loxxexpandedsourcetypes.halow(halow) "HA Median" => loxxexpandedsourcetypes.hamedian(hamedian) "HA Typical" => loxxexpandedsourcetypes.hatypical(hatypical) "HA Weighted" => loxxexpandedsourcetypes.haweighted(haweighted) "HA Average" => loxxexpandedsourcetypes.haaverage(haaverage) "HA Average Median Body" => loxxexpandedsourcetypes.haavemedbody(haclose, haopen) "HA Trend Biased" => loxxexpandedsourcetypes.hatrendb(haclose, haopen, hahigh, halow) "HA Trend Biased (Extreme)" => loxxexpandedsourcetypes.hatrendbext(haclose, haopen, hahigh, halow) "HAB Close" => loxxexpandedsourcetypes.habclose(smthtype, amafl, amasl, kfl, ksl) "HAB Open" => loxxexpandedsourcetypes.habopen(smthtype, amafl, amasl, kfl, ksl) "HAB High" => loxxexpandedsourcetypes.habhigh(smthtype, amafl, amasl, kfl, ksl) "HAB Low" => loxxexpandedsourcetypes.hablow(smthtype, amafl, amasl, kfl, ksl) "HAB Median" => loxxexpandedsourcetypes.habmedian(smthtype, amafl, amasl, kfl, ksl) "HAB Typical" => loxxexpandedsourcetypes.habtypical(smthtype, amafl, amasl, kfl, ksl) "HAB Weighted" => loxxexpandedsourcetypes.habweighted(smthtype, amafl, amasl, kfl, ksl) "HAB Average" => loxxexpandedsourcetypes.habaverage(smthtype, amafl, amasl, kfl, ksl) "HAB Average Median Body" => loxxexpandedsourcetypes.habavemedbody(smthtype, amafl, amasl, kfl, ksl) "HAB Trend Biased" => loxxexpandedsourcetypes.habtrendb(smthtype, amafl, amasl, kfl, ksl) "HAB Trend Biased (Extreme)" => loxxexpandedsourcetypes.habtrendbext(smthtype, amafl, amasl, kfl, ksl) => haclose variant(type, src, len) => sig = 0.0 trig = 0.0 special = false if type == "ADXvma - Average Directional Volatility Moving Average" [t, s, b] = loxxmas.adxvma(src, len) sig := s trig := t special := b else if type == "Ahrens Moving Average" [t, s, b] = loxxmas.ahrma(src, len) sig := s trig := t special := b else if type == "Alexander Moving Average - ALXMA" [t, s, b] = loxxmas.alxma(src, len) sig := s trig := t special := b else if type == "Double Exponential Moving Average - DEMA" [t, s, b] = loxxmas.dema(src, len) sig := s trig := t special := b else if type == "Double Smoothed Exponential Moving Average - DSEMA" [t, s, b] = loxxmas.dsema(src, len) sig := s trig := t special := b else if type == "Exponential Moving Average - EMA" [t, s, b] = loxxmas.ema(src, len) sig := s trig := t special := b else if type == "Fast Exponential Moving Average - FEMA" [t, s, b] = loxxmas.fema(src, len) sig := s trig := t special := b else if type == "Fractal Adaptive Moving Average - FRAMA" [t, s, b] = loxxmas.frama(src, len, frama_FC, frama_SC) sig := s trig := t special := b else if type == "Hull Moving Average - HMA" [t, s, b] = loxxmas.hma(src, len) sig := s trig := t special := b else if type == "IE/2 - Early T3 by Tim Tilson" [t, s, b] = loxxmas.ie2(src, len) sig := s trig := t special := b else if type == "Integral of Linear Regression Slope - ILRS" [t, s, b] = loxxmas.ilrs(src, len) sig := s trig := t special := b else if type == "Instantaneous Trendline" [t, s, b] = loxxmas.instant(src, instantaneous_alpha) sig := s trig := t special := b else if type == "Laguerre Filter" [t, s, b] = loxxmas.laguerre(src, _laguerre_alpha) sig := s trig := t special := b else if type == "Leader Exponential Moving Average" [t, s, b] = loxxmas.leader(src, len) sig := s trig := t special := b else if type == "Linear Regression Value - LSMA (Least Squares Moving Average)" [t, s, b] = loxxmas.lsma(src, len, lsma_offset) sig := s trig := t special := b else if type == "Linear Weighted Moving Average - LWMA" [t, s, b] = loxxmas.lwma(src, len) sig := s trig := t special := b else if type == "McGinley Dynamic" [t, s, b] = loxxmas.mcginley(src, len) sig := s trig := t special := b else if type == "McNicholl EMA" [t, s, b] = loxxmas.mcNicholl(src, len) sig := s trig := t special := b else if type == "Non-Lag Moving Average" [t, s, b] = loxxmas.nonlagma(src, len) sig := s trig := t special := b else if type == "Parabolic Weighted Moving Average" [t, s, b] = loxxmas.pwma(src, len, _pwma_pwr) sig := s trig := t special := b else if type == "Recursive Moving Trendline" [t, s, b] = loxxmas.rmta(src, len) sig := s trig := t special := b else if type == "Simple Moving Average - SMA" [t, s, b] = loxxmas.sma(src, len) sig := s trig := t special := b else if type == "Sine Weighted Moving Average" [t, s, b] = loxxmas.swma(src, len) sig := s trig := t special := b else if type == "Smoothed Moving Average - SMMA" [t, s, b] = loxxmas.smma(src, len) sig := s trig := t special := b else if type == "Smoother" [t, s, b] = loxxmas.smoother(src, len) sig := s trig := t special := b else if type == "Super Smoother" [t, s, b] = loxxmas.super(src, len) sig := s trig := t special := b else if type == "Three-pole Ehlers Butterworth" [t, s, b] = loxxmas.threepolebuttfilt(src, len) sig := s trig := t special := b else if type == "Three-pole Ehlers Smoother" [t, s, b] = loxxmas.threepolesss(src, len) sig := s trig := t special := b else if type == "Triangular Moving Average - TMA" [t, s, b] = loxxmas.tma(src, len) sig := s trig := t special := b else if type == "Triple Exponential Moving Average - TEMA" [t, s, b] = loxxmas.tema(src, len) sig := s trig := t special := b else if type == "Two-pole Ehlers Butterworth" [t, s, b] = loxxmas.twopolebutter(src, len) sig := s trig := t special := b else if type == "Two-pole Ehlers smoother" [t, s, b] = loxxmas.twopoless(src, len) sig := s trig := t special := b else if type == "Volume Weighted EMA - VEMA" [t, s, b] = loxxmas.vwema(src, len) sig := s trig := t special := b else if type == "Zero-Lag DEMA - Zero Lag Double Exponential Moving Average" [t, s, b] = loxxmas.zlagdema(src, len) sig := s trig := t special := b else if type == "Zero-Lag Moving Average" [t, s, b] = loxxmas.zlagma(src, len) sig := s trig := t special := b else if type == "Zero Lag TEMA - Zero Lag Triple Exponential Moving Average" [t, s, b] = loxxmas.zlagtema(src, len) sig := s trig := t special := b trig maValue = 0. wpr = 0. maValue := variant(type, src, MaPeriod) hi = ta.highest(high, wprper) lo = ta.lowest(low, wprper) t31 = _iT3(-100*(hi-src)/(hi-lo), T3Period, T3Hot, T3Original) t32 = _iT3(0., T3Period, T3Hot, T3Original) wpr := hi!=lo ? t31 : t32 rng = ta.atr(atrper) buffer1 = maValue + (wpr + 50) / 100 * rng bl1 = loxxdynamiczone.dZone("buy", buffer1, buy1, dzper) bl2 = loxxdynamiczone.dZone("buy", buffer1, buy2, dzper) sl1 = loxxdynamiczone.dZone("sell", buffer1, sell1, dzper) sl2 = loxxdynamiczone.dZone("sell", buffer1, sell2, dzper) zli = loxxdynamiczone.dZone("sell", buffer1, 0.5 , dzper) colorout = buffer1 > buffer1[1] ? greencolor : buffer1 < buffer1[1] ? redcolor : color.white plot(buffer1, color = colorout, linewidth = 3) bl1pl = plot(bl1, "buy lvl 1", color = greencolor) bl2pl = plot(bl2, "buy lvl 2", color = lightgreencolor) sl1pl = plot(sl1, "sell lvl 1", color = redcolor) sl2pl = plot(sl2, "sell lvl 1", color = lightredcolor) midpl = plot(ShowMiddleLine ? zli : na, "mid lvl", color = color.white) fill(bl1pl, bl2pl, color = filllevels ? color.new(greencolor, 85) : na) fill(bl2pl, midpl, color = filllevels ? color.new(greencolor, 95): na) fill(sl1pl, sl2pl, color = filllevels ? color.new(redcolor, 85): na) fill(sl2pl, midpl, color = filllevels ? color.new(redcolor, 95): na) barcolor(colorbars ? colorout : na)
Pips-Stepped PDFMA [Loxx]
https://www.tradingview.com/script/GWYhw25p-Pips-Stepped-PDFMA-Loxx/
loxx
https://www.tradingview.com/u/loxx/
177
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Pips-Stepped PDFMA [Loxx]", shorttitle='PSPDFMA [Loxx]', overlay = true, timeframe="", timeframe_gaps = true) greencolor = #2DD204 redcolor = #D2042D _calcBaseUnit() => bool isForexSymbol = syminfo.type == "forex" bool isYenPair = syminfo.currency == "JPY" float out = isForexSymbol ? isYenPair ? 0.01 : 0.0001 : syminfo.mintick out _stepSizeCalc(type, per, sense, size)=> float stma = 0. float ATR0 = 0. float ATRmax = -1e10 float ATRmin = 1e10 float out = 0 float alfa = 0 if (size == 0) float avgrng = 0 float Weight = 0 for i = per-1 to 0 if (type == "SMA") alfa := 1.0 else alfa := 1.0 * (per - i) / per avgrng += alfa * (nz(high[i]) - nz(low[i])) Weight += alfa ATR0 := avgrng / Weight if (ATR0 > ATRmax) ATRmax := ATR0 if (ATR0 < ATRmin) ATRmin := ATR0 out := math.round(0.5 * sense * (ATRmax + ATRmin) / _calcBaseUnit()) else out := sense * size out _pdf(x, vari, mean)=> out = (1.0/math.sqrt(2 * math.pi * math.pow(vari,2)) * math.exp(-math.pow(x-mean, 2)/(2 * math.pow(vari, 2)))) out _pdfma(src, per, vari, mean)=> maxx = 3.5 step = math.pi/(per-1) coeff = array.new_float(per, 0) for k = 0 to per - 1 array.set(coeff, k, _pdf(k * step, vari, mean * math.pi)) sumw = array.get(coeff, 0) sum = array.get(coeff, 0) * src for k = 1 to per -1 weight = nz(array.get(coeff, k)) * src sumw += weight sum += weight * nz(src) out = sum/sumw out per = input.int(10, "Period", group = "Basic Settings") MA_Mode = input.string("SMA", "MA Type", options = ["SMA", "LWMA"], group = "Basic Settings") Percentage = input.float(0, "Percentage", step = 0.1, group = "Basic Settings", tooltip = "Percentage of Up/Down Moving") stepsize = input.int(20, "Step size", group = "Basic Settings") sense = input.float(5, "Sensivity", step = 0.1, minval = 0.1, group = "Basic Settings") vari = input.float(1, "Variance", step = 0.1, minval = 0.1, group = "Basic Settings") mean = input.float(0, "Mean", step = 0.1, minval = -1, maxval = 1, group = "Basic Settings") HighLow = input.bool(false, "High/Low mode?", group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group= "UI Options") flat = input.bool(false, "Flat-level colroing?", group= "UI Options") showSigs = input.bool(false, "Show signals?", group= "UI Options") size = _stepSizeCalc(MA_Mode, per, sense, stepsize) smax = 0., smin = 0. if HighLow smax := _pdfma(low, per, vari, mean) + 2.0 * size * _calcBaseUnit() smin := _pdfma(high, per, vari, mean) - 2.0 * size * _calcBaseUnit() else smax := _pdfma(close, per, vari, mean) + 2.0 * size * _calcBaseUnit() smin := _pdfma(close, per, vari, mean) - 2.0 * size * _calcBaseUnit() trend = 0., out = 0. trend := trend[1] if (close > smax[1]) trend := 1 if (close < smin[1]) trend := -1 if (trend > 0) if (smin < smin[1]) smin := smin[1] out := smin + size * _calcBaseUnit() else if (smax > smax[1]) smax := smax[1] out := smax - size * _calcBaseUnit() val = out + Percentage / 100.0 * stepsize * _calcBaseUnit() colorout = val > val[1] ? greencolor : val < val[1] ? redcolor : color.gray goLong_pre = ta.crossover(val, val[1]) goShort_pre = ta.crossunder(val, val[1]) contSwitch = 0 contSwitch := nz(contSwitch[1]) contSwitch := goLong_pre ? 1 : goShort_pre ? -1 : contSwitch goLong = goLong_pre and ta.change(contSwitch) goShort = goShort_pre and ta.change(contSwitch) plot(val,"Pips-Stepped PDFMA", color = flat ? colorout : (contSwitch == 1 ? greencolor : redcolor), linewidth = 3) barcolor(colorbars ? flat ? colorout : (contSwitch == 1 ? greencolor : redcolor) : na) plotshape(showSigs and goLong, title = "Long", color = color.yellow, textcolor = color.yellow, text = "L", style = shape.triangleup, location = location.belowbar, size = size.tiny) plotshape(showSigs and goShort, title = "Short", color = color.fuchsia, textcolor = color.fuchsia, text = "S", style = shape.triangledown, location = location.abovebar, size = size.tiny) alertcondition(goLong, title="Long", message="Pips-Stepped PDFMA [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="Pips-Stepped PDFMA [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
Session High Low
https://www.tradingview.com/script/xuVwuxaB-Session-High-Low/
Munkhtur
https://www.tradingview.com/u/Munkhtur/
650
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Munkhtur // @version=5 // indicator("Session High Low", shorttitle="Session" ,overlay=true) // timezone = input.string (defval = "Europe/London", title = "Timezone", options = ["GMT", "Etc/UTC", "Asia/Tokyo", "Europe/London", "America/New_York"], inline = "settings 1", group = "Indicator settings") timeframe = input.int (15, title = "Timeframe", inline = "settings", group = "Indicator settings") hide_history = input.bool (defval = false, title = "Hide History", inline = "settings 1", group = "Indicator settings") show_price = input.bool (defval = true, title = "Show price", inline = "settings", group = "Indicator settings") show_timeframe = (timeframe.multiplier <= timeframe) and (timeframe.isintraday) // Session_time = input.session (title = "Session time", defval = "0800-1330", inline = "Session time", group = "Session settings") Session_start = time (timeframe.period, Session_time, timezone) Session_start_hour = input.int (title = "Hour", defval = 08, minval = 0, maxval = 23, inline = "Session start", group = "Session settings") Session_start_minute = input.int (title = "Minute", defval = 00, minval = 0, maxval = 59, inline = "Session start", group = "Session settings") Session_end_hour = input.int (title = "Hour", defval = 16, minval = 0, maxval = 23, inline = "Session end", group = "Session settings") Session_end_minute = input.int (title = "Minute", defval = 59, minval = 0, maxval = 59, inline = "Session end", group = "Session settings") Extend_line_hour = input.int (title = "Line extend hour",defval = 23, minval = 0, maxval = 23, inline = "line extend", group = "High Low settings") Extend_line_minute = input.int (title = "Minute", defval = 59, minval = 0, maxval = 59, inline = "line extend", group = "High Low settings") Session_start_timestamp = timestamp (timezone, year, month, dayofmonth, Session_start_hour, Session_start_minute, 00) Session_end_timestamp = timestamp (timezone, year, month, dayofmonth, Session_end_hour, Session_end_minute, 00) Extend_line_timestamp = timestamp (timezone, year, month, dayofmonth, Extend_line_hour, Extend_line_minute, 00) Session_start_vertical = input.bool (defval=true, title="Start", inline = "Session start", group = "Session settings") Session_end_vertical = input.bool (defval=true, title="End", inline = "Session end", group = "Session settings") // var float Session_high = na var float Session_low = na Session_high_color = input.color (title = "Session high", defval = color.blue, inline = "line extend 1", group = "High Low settings") Session_low_color = input.color (title = "Session low", defval = color.red, inline = "line extend 1", group = "High Low settings") Vertical_start_color = input.color (title = "Line color", defval = color.blue, inline = "Session start", group = "Session settings") Vertical_end_color = input.color (title = "Line color", defval = color.red, inline = "Session end", group = "Session settings") var Session_high_line = line.new (x1 = na, y1 = na, x2 = na, xloc = xloc.bar_time, y2 = close, color = Session_high_color) var Session_low_line = line.new (x1 = na, y1 = na, x2 = na, xloc = xloc.bar_time, y2 = close, color = Session_low_color ) var Session_high_price = label.new (x = na, y = na, xloc = xloc.bar_time, textcolor = Session_high_color, style = label.style_label_left, size = size.small) var Session_low_price = label.new (x = na, y = na, xloc = xloc.bar_time, textcolor = Session_low_color, style = label.style_label_left, size = size.small) var Vertical_start = line.new (x1 = na, y1 = na, x2 = na, xloc = xloc.bar_time, y2 = close, color = Vertical_start_color) // Asian Killzone Start Vertical Line var Vertical_end = line.new (x1 = na, y1 = na, x2 = na, xloc = xloc.bar_time, y2 = close, color = Vertical_end_color ) var Session_start_time = time new_day = ta.change(dayofweek) // Vertical_line_start (start, color, style, width) => line.new(x1 = start, y1 = low - ta.tr, x2 = start, y2 = high + ta.tr, xloc = xloc.bar_time, extend = extend.both, color = Vertical_start_color, style = line.style_dotted, width = 1) Vertical_line_end (start, color, style, width) => line.new(x1 = start, y1 = low - ta.tr, x2 = start, y2 = high + ta.tr, xloc = xloc.bar_time, extend = extend.both, color = Vertical_end_color, style = line.style_dotted, width = 1) Session_start(sess) => t = time("", sess , timezone) show_timeframe and (not barstate.isfirst) and na(t[1]) and not na(t) // if Session_start(Session_time) and show_timeframe Session_start_timestamp := time Session_high := high Session_low := low if Extend_line_timestamp < Session_start_timestamp Extend_line_timestamp := Extend_line_timestamp + 86400000 if hide_history line.delete (Session_high_line [1]) line.delete (Session_low_line [1]) label.delete (Session_high_price [1]) label.delete (Session_low_price [1]) Session_high_line := line.new (x1=Session_start_timestamp, y1=Session_high, x2=Extend_line_timestamp, xloc=xloc.bar_time, y2=Session_high, color=Session_high_color, width=1, style=line.style_solid) Session_low_line := line.new (x1=Session_start_timestamp, y1=Session_low, x2=Extend_line_timestamp, xloc=xloc.bar_time, y2=Session_low, color=Session_low_color, width=1, style=line.style_solid) Session_high_price := label.new (x= Session_start_timestamp, y =Session_high, xloc=xloc.bar_time, color=color.new(color.gray, 100), textcolor=Session_high_color, style=label.style_label_left, size=size.small) Session_low_price := label.new (x= Session_start_timestamp, y =Session_low, xloc=xloc.bar_time, color=color.new(color.gray, 100), textcolor=Session_low_color, style=label.style_label_left, size=size.small) label.set_text (Session_high_price, str.tostring(Session_high)) label.set_text (Session_low_price, str.tostring(Session_low )) // else if (time > Session_start_timestamp and time < Session_end_timestamp) if Extend_line_timestamp < Session_start_timestamp Extend_line_timestamp := Extend_line_timestamp + 86400000 Session_high := math.max(high, Session_high) Session_low := math.min(low, Session_low ) if (Session_high > Session_high[1]) line.set_xy1 (id = Session_high_line, x = time, y = Session_high) line.set_xy2 (id = Session_high_line, x = Extend_line_timestamp, y = Session_high) if show_price label.set_xy (id = Session_high_price, x = Extend_line_timestamp, y = Session_high) label.set_xy (id = Session_low_price, x = Extend_line_timestamp, y = Session_low ) label.set_text (Session_high_price, str.tostring (Session_high)) label.set_text (Session_low_price, str.tostring (Session_low )) if not show_price label.delete (Session_low_price) label.delete (Session_high_price) if (Session_low < Session_low [1]) line.set_xy1 (id = Session_low_line, x = time, y = Session_low ) line.set_xy2 (id = Session_low_line, x = Extend_line_timestamp, y = Session_low ) if show_price label.set_xy (id = Session_high_price, x = Extend_line_timestamp, y = Session_high) label.set_xy (id = Session_low_price, x = Extend_line_timestamp, y = Session_low ) label.set_text (Session_high_price, str.tostring (Session_high)) label.set_text (Session_low_price, str.tostring (Session_low )) if not show_price label.delete (Session_low_price ) label.delete (Session_high_price) // if new_day and show_timeframe if Session_start_vertical and hide_history line.delete(Vertical_start [1]) Vertical_start := Vertical_line_start(Session_start_timestamp, Vertical_start_color, line.style_dotted, 1) if not Session_start_vertical line.delete(Vertical_start) if Session_end_vertical and hide_history line.delete(Vertical_end [1]) Vertical_end := Vertical_line_end(Session_end_timestamp, Vertical_end_color, line.style_dotted, 1) if not Session_end_vertical line.delete(Vertical_end) //End
Current price & Daily open
https://www.tradingview.com/script/v2YB2vm6-Current-price-Daily-open/
Munkhtur
https://www.tradingview.com/u/Munkhtur/
182
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Munkhtur //@version=5 indicator('Current price & Daily open', shorttitle='Price & DO', overlay=true) daily_time = request.security(syminfo.tickerid, 'D', time, lookahead=barmerge.lookahead_on) daily_open = request.security(syminfo.tickerid, 'D', open, lookahead=barmerge.lookahead_on) daily_close = request.security(syminfo.tickerid, 'D', close, lookahead=barmerge.lookahead_on) var lastprice = input(defval=true, title='Last Price') var dailyopen = input(defval=true, title='Daily Open') var extend_right = 20 var show_price = lastprice var show_open = dailyopen and timeframe.isintraday and timeframe.multiplier <= 60 candlecolor = close >= open line_color = candlecolor ? color.blue : color.red DOcolor = close >= daily_open daily_color = DOcolor ? color.blue : color.red rightbar(bars) => time_close + (time - time[1]) * bars if barstate.islast if show_open and DOcolor and not barstate.isconfirmed and barstate.isrealtime var open_line = line.new(x1=daily_time, x2=rightbar(extend_right), y1=daily_open, y2=daily_open, color = daily_color, width=1, xloc = xloc.bar_time) var open_label = label.new(x=rightbar(extend_right), y=daily_open, text='Open ' + str.tostring(daily_open), style = label.style_none, textcolor = daily_color, size = size.small, xloc = xloc.bar_time) line.set_x1(open_line, daily_time) line.set_x2(open_line, rightbar(extend_right)) line.set_y1(open_line, daily_open) line.set_y2(open_line, daily_open) label.set_x(open_label, rightbar(extend_right)) label.set_y(open_label, daily_open) if show_open and not DOcolor and not barstate.isconfirmed and barstate.isrealtime var open_line = line.new(x1=daily_time, x2=rightbar(extend_right), y1=daily_open, y2=daily_open, color = daily_color, width=1, xloc = xloc.bar_time) var open_label = label.new(x=rightbar(extend_right), y=daily_open, text='Open ' + str.tostring(daily_open), style = label.style_none, textcolor = daily_color, size = size.small, xloc = xloc.bar_time) line.set_x1(open_line, daily_time) line.set_x2(open_line, rightbar(extend_right)) line.set_y1(open_line, daily_open) line.set_y2(open_line, daily_open) label.set_x(open_label, rightbar(extend_right)) label.set_y(open_label, daily_open) if show_price and candlecolor and not barstate.isconfirmed and barstate.isrealtime var open_line = line.new(x1=rightbar(extend_right - 20), x2=rightbar(extend_right - 15), y1=close, y2=close, color = line_color, width=1, xloc = xloc.bar_time) var open_label = label.new(x=rightbar(extend_right - 15), y=close, text=str.tostring(close), style = label.style_none, textcolor = line_color, size = size.small, xloc = xloc.bar_time) line.set_x1(open_line, rightbar(extend_right - 20)) line.set_x2(open_line, rightbar(extend_right - 15)) line.set_y1(open_line, close) line.set_y2(open_line, close) label.set_x(open_label, rightbar(extend_right - 15)) label.set_y(open_label, close) if show_price and not candlecolor and not barstate.isconfirmed and barstate.isrealtime var open_line = line.new(x1=rightbar(extend_right - 20), x2=rightbar(extend_right - 15), y1=close, y2=close, color = line_color, width=1, xloc = xloc.bar_time) var open_label = label.new(x=rightbar(extend_right - 15), y=close, text=str.tostring(close), style = label.style_none, textcolor = line_color, size = size.small, xloc = xloc.bar_time) line.set_x1(open_line, rightbar(extend_right - 20)) line.set_x2(open_line, rightbar(extend_right - 15)) line.set_y1(open_line, close) line.set_y2(open_line, close) label.set_x(open_label, rightbar(extend_right - 15)) label.set_y(open_label, close)
Dynamic Zone Range on PDFMA [Loxx]
https://www.tradingview.com/script/s9ygLQ36-Dynamic-Zone-Range-on-PDFMA-Loxx/
loxx
https://www.tradingview.com/u/loxx/
53
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Dynamic Zone Range on PDFMA [Loxx]", shorttitle='DDZRPDFMA [Loxx]', overlay = false, timeframe="", timeframe_gaps = true) import loxx/loxxdynamiczone/3 greencolor = #2DD204 redcolor = #D2042D lightgreencolor = #96E881 lightredcolor = #DF4F6C SM02 = 'Slope' SM03 = 'Middle Crossover' SM04 = 'Inner Crossover' SM05 = 'Outer Crossover' _calcBaseUnit() => bool isForexSymbol = syminfo.type == "forex" bool isYenPair = syminfo.currency == "JPY" float out = isForexSymbol ? isYenPair ? 0.01 : 0.0001 : syminfo.mintick out _stepSizeCalc(type, per, sense, size)=> float stma = 0. float ATR0 = 0. float ATRmax = -1e10 float ATRmin = 1e10 float out = 0 float alfa = 0 if (size == 0) float avgrng = 0 float Weight = 0 for i = per-1 to 0 if (type == "SMA") alfa := 1.0 else alfa := 1.0 * (per - i) / per avgrng += alfa * (nz(high[i]) - nz(low[i])) Weight += alfa ATR0 := avgrng / Weight if (ATR0 > ATRmax) ATRmax := ATR0 if (ATR0 < ATRmin) ATRmin := ATR0 out := math.round(0.5 * sense * (ATRmax + ATRmin) / _calcBaseUnit()) else out := sense * size out _pdf(x, vari, mean)=> out = (1.0/math.sqrt(2 * math.pi * math.pow(vari,2)) * math.exp(-math.pow(x-mean, 2)/(2 * math.pow(vari, 2)))) out _pdfma(src, per, vari, mean)=> maxx = 3.5 step = math.pi/(per-1) coeff = array.new_float(per, 0) for k = 0 to per - 1 array.set(coeff, k, _pdf(k * step, vari, mean * math.pi)) sumw = array.get(coeff, 0) sum = array.get(coeff, 0) * src for k = 1 to per -1 weight = nz(array.get(coeff, k)) * src sumw += weight sum += weight * nz(src) out = sum/sumw out HLR_Range = input.int(25, "HLR Range", group = "Basic Settings") per = input.int(10, "Period", group = "Basic Settings") MA_Mode = input.string("SMA", "MA Type", options = ["SMA", "LWMA"], group = "Basic Settings") Percentage = input.float(0, "Percentage", step = 0.1, group = "Basic Settings", tooltip = "Percentage of Up/Down Moving") stepsize = input.int(20, "Step Size", group = "Basic Settings") sense = input.float(5, "Sensivity", step = 0.1, minval = 0.1, group = "Basic Settings") vari = input.float(1, "variance", step = 0.1, minval = 0.1, group = "Basic Settings") mean = input.float(0, "Mean", step = 0.1, minval = -1, maxval = 1, group = "Basic Settings") HighLow = input.bool(false, "High/Low mode?", group = "Basic Settings") dzper = input.int(70, "Dynamic Zone Period", group = "Levels Settings") buy1 = input.float(0.2, "Dynamic Zone Buy Probability Level 1", group = "Levels Settings", maxval = 0.49) buy2 = input.float(0.06, "Dynamic Zone Buy Probability Level 2", group = "Levels Settings", maxval = 0.49) sell1 = input.float(0.2, "Dynamic Zone Sell Probability Level 1", group = "Levels Settings", maxval = 0.49) sell2 = input.float(0.06, "Dynamic Zone Sell Probability Level 2", group = "Levels Settings", maxval = 0.49) sigtype = input.string(SM03, "Signal type", options = [SM02, SM03, SM04, SM05], group = "Signal Settings") colorbars = input.bool(false, "Color bars?", group= "UI Options") ShowMiddleLine = input.bool(true, "Show middle line?", group = "UI Options") filllevels = input.bool(false, "Show fill colors?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") size = _stepSizeCalc(MA_Mode, per, sense, stepsize) smax = 0., smin = 0. hhv = 0., llv = 0., m_pr = 0. if HighLow hhv := _pdfma(ta.highest(high, HLR_Range), per, vari, mean) + 2.0 * size * _calcBaseUnit() llv := _pdfma(ta.lowest(low, HLR_Range), per, vari, mean) - 2.0 * size * _calcBaseUnit() m_pr := _pdfma(hl2, per, vari, mean) else hhv := _pdfma(ta.highest(close, HLR_Range), per, vari, mean) + 2.0 * size * _calcBaseUnit() llv := _pdfma(ta.lowest(close, HLR_Range), per, vari, mean) - 2.0 * size * _calcBaseUnit() m_pr := _pdfma(hl2, per, vari, mean) HLR_Buffer = 100.0 * (m_pr - llv) / (hhv - llv) bl1 = loxxdynamiczone.dZone("buy", HLR_Buffer, buy1, dzper) bl2 = loxxdynamiczone.dZone("buy", HLR_Buffer, buy2, dzper) sl1 = loxxdynamiczone.dZone("sell", HLR_Buffer, sell1, dzper) sl2 = loxxdynamiczone.dZone("sell", HLR_Buffer, sell2, dzper) zli = loxxdynamiczone.dZone("sell", HLR_Buffer, 0.5 , dzper) state = 0. if sigtype == SM02 if (HLR_Buffer<nz(HLR_Buffer[1])) state :=-1 if (HLR_Buffer>nz(HLR_Buffer[1])) state := 1 else if sigtype == SM03 if (HLR_Buffer<zli) state :=-1 if (HLR_Buffer>zli) state := 1 else if sigtype == SM04 if (HLR_Buffer<bl1) state :=-1 if (HLR_Buffer>sl1) state := 1 else if sigtype == SM05 if (HLR_Buffer<bl2) state :=-1 if (HLR_Buffer>sl2) state := 1 colorout = state == -1 ? redcolor : state == 1 ? greencolor : color.gray plot(HLR_Buffer, "PDFMA", color = colorout, linewidth = 3) bl1pl = plot(bl1, "buy lvl 1", color = bar_index % 3 ? lightgreencolor: na) bl2pl = plot(bl2, "buy lvl 2", color = bar_index % 2 ? greencolor: na) sl1pl = plot(sl1, "sell lvl 1", color = bar_index % 3 ? lightredcolor: na) sl2pl = plot(sl2, "sell lvl 1", color = bar_index % 2 ? redcolor: na) midpl = plot(ShowMiddleLine ? zli : na, "mid lvl", color = bar_index % 4 ? color.white : na) fill(bl1pl, bl2pl, color = filllevels ? color.new(greencolor, 85) : na) fill(bl2pl, midpl, color = filllevels ? color.new(greencolor, 95): na) fill(sl1pl, sl2pl, color = filllevels ? color.new(redcolor, 85): na) fill(sl2pl, midpl, color = filllevels ? color.new(redcolor, 95): na) barcolor(colorbars ? colorout : na) goLong = colorout == greencolor and colorout[1] == redcolor goShort = colorout == redcolor and colorout[1] == greencolor plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="Dynamic Zone Range on PDFMA [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="Dynamic Zone Range on PDFMA [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
Larry Williams Large Trade Index (LWTI) [Loxx]
https://www.tradingview.com/script/ECuloL0o-Larry-Williams-Large-Trade-Index-LWTI-Loxx/
loxx
https://www.tradingview.com/u/loxx/
240
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Larry Williams Large Trade Index (LWTI) [Loxx]", shorttitle="LWTI [Loxx]", overlay = false, timeframe="", timeframe_gaps = true) greencolor = #2DD204 redcolor = #D2042D variant(type, src, len) => sig = 0.0 if type == "SMA" sig := ta.sma(src, len) else if type == "EMA" sig := ta.ema(src, len) else if type == "WMA" sig := ta.wma(src, len) else if type == "RMA" sig := ta.rma(src, len) sig per = input.int(8, "Period", group = "Basic Settings") smthit = input.bool(false, "Smooth LWPI?", group = "Basic Settings") type = input.string("SMA", "Smoothing Type", options = ["EMA", "WMA", "RMA", "SMA"], group = "BasicR Settings") smthper = input.int(5, "Smoothing Period", group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") ma = ta.sma(close - nz(close[per]), per) atr = ta.atr(per) out = ma/atr * 50 + 50 out := smthit ? variant(type, out, smthper) : out colorout = out > 50 ? greencolor : redcolor plot(out, color = colorout, linewidth = 2) barcolor(colorbars ? colorout : na) middle = 50 plot(middle, color = bar_index % 2 ? color.gray : na) goLong = ta.crossover(out, middle) goShort = ta.crossunder(out, middle) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="Larry Williams Large Trade Index (LWTI) [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="Larry Williams Large Trade Index (LWTI) [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
Flag Detector
https://www.tradingview.com/script/HFaypTav-Flag-Detector/
millerrh
https://www.tradingview.com/u/millerrh/
208
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © millerrh //@version=5 indicator("Flag Detector", overlay=true) // USER INPUTS flagLookback = input.int(title="Top of Flag Pole Lookback", defval=15, tooltip = "Lookback period for detecting the top of the flag pole.") poleLookback = input.int(title="Bottom of Flag Pole Lookback", defval=20, tooltip = "Lookback period for detecting the bottom of the flag pole from the top of the pole. These two points are used to determine the flag pole length.") poleLengthInput = input.int(title="Min Flag Pole Length (%)", defval=15, tooltip = "Only look for consolildations that are preceded by a move of this magnatude.") flagDepthInput = input.int(title="Max Flag Depth (%)", defval=25, tooltip = "Flag bottom must be within this distance from the top.") flagRatioInput = input.int(title="Max Flag Retracement (%)", defval=50, tooltip = "Max percentage the flag can retrace the pole. Similar to Fibonacci Retracement levels.") phBarInput = input.int(title="Min Flag Length (%)", defval=1, tooltip = "Minimum number of bars after the top of the flagpole necessary for consolidation to count.") PoleHigh = ta.highest(high, flagLookback) PHBar = 1 for i = 1 to flagLookback if high[i] >= PoleHigh PHBar := i FlagLow = ta.lowest(low, PHBar) PoleLow = ta.lowest(low, poleLookback + PHBar) // Flag characteristics PoleLength = (PoleHigh - PoleLow)/PoleLow // Percentage move that forms the flag pole FlagDepth = (PoleHigh - FlagLow)/PoleHigh // Percentage retracement off the highs FlagRatio = FlagDepth/PoleLength // Flag-to-Pole ratio // Flag Requirements Flag = PoleLength > poleLengthInput/100 and // Minimum 15% initial move before consolication FlagDepth < flagDepthInput/100 and // Bottom of consolidation less than 25% from the top of the consolidtion FlagRatio < flagRatioInput/100 and // Flag can't have retraced more than 50% the initial move PHBar > phBarInput // Minimum one bar after that local top acts as a pullback // Highlight the flag bars plotshape(Flag, title = 'Flag', style = shape.circle, location = location.belowbar, color = color.new(color.blue, 60)) // Plot channels/lines showing the current flag boundaries for troubleshooting // plot(PoleHigh, color = color.new(color.white, 60), style = plot.style_line, linewidth = 1) // plot(FlagLow, color = color.new(color.red, 60), style = plot.style_line, linewidth = 1) // plot(PoleLow, color = color.new(color.purple, 60), style = plot.style_line, linewidth = 1)
ATR Multiplier Overlay
https://www.tradingview.com/script/q0OawrwT-ATR-Multiplier-Overlay/
rahulhegde1234
https://www.tradingview.com/u/rahulhegde1234/
21
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Credits to bjr117 for original code, Modified by Hedgineering //@version=5 indicator(title = "ATR Multiplier", shorttitle = "ATRX", overlay = true) //============================================================================== // Input Parameters //============================================================================== atr_length = input.int(14, title = "ATR Length", minval = 0, group = "ATR Indicator Settings") atr1_multiplier = input.float(1.5, title = "ATR Multiplier #1", minval = 0, group = "ATR Multiplier Settings") show_atr2 = input.bool(false, title = "Show 2nd ATR line?", group = "ATR Multiplier Settings") atr2_multiplier = input.float(3, title = "ATR Multiplier #2", minval = 0, group = "ATR Multiplier Settings") offset = input.int(0, title = "ATR Length", minval = 0, group = "ATR Indicator Backward Offset") //============================================================================== //============================================================================== // ATR #1 and ATR #2 Calculation //============================================================================== // Calculate basic ATR value with given smoothing parameters atr = ta.rma(ta.tr, atr_length) // Multiply atr by the given atr1 multiplier to get atr1 atr1_top = atr * atr1_multiplier + close[offset] atr1_bottom = atr * atr1_multiplier * -1 + close[offset] // Multiply atr by the given atr2 multiplier to get atr2 atr2_top = atr * atr2_multiplier + close[offset] atr2_bottom = atr * atr2_multiplier * -1 + close[offset] //============================================================================== //============================================================================== // Plot ATR #1 and ATR #2 //============================================================================== atr1_color = show_atr2 ? color.red : color.new(#0000ff, 0) atr1_top_plot = plot(atr1_top, title = "ATR #1 Top", color = atr1_color) atr1_bottom_plot = plot(atr1_bottom, title = "ATR #1 Bottom", color = atr1_color) atr2_top_plot = plot(show_atr2 ? atr2_top : na, title = "ATR #2 Top", color = color.green) atr2_bottom_plot = plot(show_atr2 ? atr2_bottom : na, title = "ATR #2 Bottom", color = color.green) //==============================================================================
Volume with EMA 20 and 2 BB SALEM_ALSALEM1
https://www.tradingview.com/script/8T9Lkbya/
salemsaud90
https://www.tradingview.com/u/salemsaud90/
116
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © salem_alsalem1 //@version=5 indicator("Volume with EMA 20 and 2 BB") emainput = input(defval = 20 , title = "EMA lenght:") bb1 = input(defval = 15 , title = "first BB lenght:") bb1_mult = input(defval = 2.0 , title = "first BB mult:") bb2 = input(defval = 15 , title = "second BB lenght:") bb2_mult = input(defval = 1.0 , title = "second BB mult:") vol = volume [middle1, upper1, lower1] = ta.bb(vol, bb1, bb1_mult) [middle2, upper2, lower2] = ta.bb(vol, bb2, bb2_mult) ema = ta.ema(vol , emainput) cond = vol >= upper1 and upper2 and ema plot(vol, title = "volume", style = plot.style_columns , color = cond ? color.blue:color.aqua, linewidth = 3) plot(upper1, title = "first BB ", color = color.green , linewidth = 2) plot(upper2, title = "second BB", color = color.orange, linewidth = 2) plot(ema, title = "EMA", color = color.red, linewidth = 2) alertcondition(cond , "ultar High" , "volume ultra high ")
MTO2 EMaS
https://www.tradingview.com/script/tQyTZ8gl/
msbac93
https://www.tradingview.com/u/msbac93/
0
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © msbac93 //@version=4 study("Daily EMA + Daily EMA2", "MTO2", overlay = true) //Inputs length_d_ema = input(title = "Comprimento EMA Diaria", type = input.integer, defval = 20) length_d_ema2 = input(title = "Comprimento EMA2 Diaria", type = input.integer, defval = 9) //Calculo MAs ema_d = security(syminfo.tickerid,"D", ema(close, length_d_ema)) ema2_d = security(syminfo.tickerid,"D", ema(close, length_d_ema2)) //Plot MAs plot(ema_d, title = "EMA Diaria", color = color.yellow, linewidth = 3) plot(ema2_d, title = "EMA Diaria2", color = color.blue, linewidth = 1)
CPR with High of the day
https://www.tradingview.com/script/RhYzJQoJ-CPR-with-High-of-the-day/
opweekly2020
https://www.tradingview.com/u/opweekly2020/
23
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © VBV // © Modifed by VBV 07/22/2022 //@version=4 study("CPR with Hih of the day", shorttitle="CPR_HighDay", overlay=true) // User inputs showTomorrowCPR = input(title="Show tomorrow's CPR", type=input.bool, defval=false) showHistoricalCPR = input(title="Show historical CPR Daily", type=input.bool, defval=true) showInterval= input("D", options = ["3", "5", "15", "30", "45", "D"], title = "CPR Interval") showTomorrowCPRDynamic = input(title="Show tomorrow's CPR Dynamically", type=input.bool, defval=false) shotLineTransp = input(50, options=[5,50,75,95], title="lineTransp") showR1S1 = input(title="Show HR1 & HS1", type=input.bool, defval=true) showR2S2 = input(title="Show HR2 & HS2", type=input.bool, defval=true) showR3S3 = input(title="Show HR3 & HS3", type=input.bool, defval=true) showR4S4 = input(title="Show HR4 & HS4", type=input.bool, defval=true) showPDHL = input(title="Show previous day's High & Low", type=input.bool, defval=true) showPDC = input(title="Show previous day's Close", type=input.bool, defval=true) showLines = input(title="Show Lines", type=input.bool, defval=false) showWeekly = input(title="Show Weekly", type=input.bool, defval=false) //0 for next week and 1 for current week showCWNWInterval= input(1, options = [0, 1], title = "CPR based on Week 1-current,0-next") showPWHL = input(title="Show previous weeks's High & Low", type=input.bool, defval=false) showNextWeekCPR = input(title="Show next week's CPR", type=input.bool, defval=false) showMonthly = input(title="Show Monthly", type=input.bool, defval=false) //0 for next Month and 1 for current Month showCMNMInterval= input(1, options = [0, 1], title = "CPR based on Month 1-current,0-next") showPMHL = input(title="Show previous monthly's High & Low", type=input.bool, defval=false) showNextMonthCPR = input(title="Show next month's CPR", type=input.bool, defval=false) showQuaterly = input(title="Show Quaterly", type=input.bool, defval=false) //0 for next Month and 1 for current Quater showCQNQInterval= input(1, options = [0, 1], title = "CPR based on Quater 1-current,0-next") showYearly = input(title="Show Yearly", type=input.bool, defval=false) //0 for next Month and 1 for current Year showCYNYInterval= input(1, options = [0, 1], title = "CPR based on Year 1-current,0-next") // Defaults // CPR Colors cprColor = color.purple rColor = color.red sColor = color.green cColor = color.black hlColor = color.fuchsia tcprColor = color.yellow twcprColor = color.maroon tmcprColor = color.navy tqcprColor = color.silver tycprColor = color.teal // Line style & Transparency lStyle = plot.style_line lTransp = shotLineTransp //Flip this value to 5 to see the lines on the chart lTranspCPR = 0 //Fill Transparency fTransp = 95 // Global Variables & Flags // TODO : Update the No of Holidays noOfHolidays = 12 // Global Functions // TODO : Update the list of Holiday here in format YYYY, MM, DD, 09, 15 // **09, 15 are session start hour & minutes IsHoliday(_date) => iff(_date == timestamp(2020, 02, 21, 09, 15), true, iff(_date == timestamp(2020, 03, 10, 09, 15), true, iff(_date == timestamp(2020, 04, 02, 09, 15), true, iff(_date == timestamp(2020, 04, 06, 09, 15), true, iff(_date == timestamp(2020, 04, 10, 09, 15), true, iff(_date == timestamp(2020, 04, 14, 09, 15), true, iff(_date == timestamp(2020, 05, 01, 09, 15), true, iff(_date == timestamp(2020, 05, 25, 09, 15), true, iff(_date == timestamp(2020, 10, 02, 09, 15), true, iff(_date == timestamp(2020, 11, 16, 09, 15), true, iff(_date == timestamp(2020, 11, 30, 09, 15), true, iff(_date == timestamp(2020, 12, 25, 09, 15), true, false)))))))))))) // Note: Week of Sunday=1...Saturday=7 IsWeekend(_date) => dayofweek(_date) == 7 or dayofweek(_date) == 1 // Skip Weekend SkipWeekend(_date) => _d = dayofweek(_date) _mul = _d == 6 ? 3 : _d == 7 ? 2 : 1 _date + (_mul * 86400000) // Get Next Working Day GetNextWorkingDay(_date) => _dt = SkipWeekend(_date) for i = 1 to noOfHolidays if IsHoliday(_dt) _dt := SkipWeekend(_dt) continue else break _dt // Today's Session Start timestamp y = year(timenow) m = month(timenow) d = dayofmonth(timenow) // Start & End time for Today's CPR start = timestamp(y, m, d, 09, 15) end = start + 86400000 // Plot Today's CPR shouldPlotToday = timenow > start //----tomorrows plot------ tom_start = start tom_end = end // Start & End time for Tomorrow's CPR if shouldPlotToday tom_start := GetNextWorkingDay(start) tom_end := tom_start + 86400000 //-----------weekly plot------------- nw_start = start nw_end = end // Start & End time for Tomorrow's CPR if shouldPlotToday nw_start := GetNextWorkingDay(start) nw_end := nw_start + 432000000 //draw line for next 5 days --86400000*5 //----------monthly plot--------------- nm_start = start nm_end = end // Start & End time for Tomorrow's CPR if shouldPlotToday nm_start := GetNextWorkingDay(start) nm_end := nm_start + 2937600000 //draw line for next 34 days --86400000*34 // this is still not accurate but it is ok //------------------------ // Get series getSeries(e, timeFrame) => security(syminfo.tickerid, showInterval, e, lookahead=barmerge.lookahead_on) // Calculate Today's CPR //Get High, Low and Close from Previous day H = getSeries(high[1], showInterval) L = getSeries(low[1], showInterval) C = getSeries(high[1], showInterval) // Pivot Range P = (H + L + C) / 3 BC = (H + L)/2 TC = (P - BC) + P // Resistance Levels R1 = (P * 2) - L R2 = P + (H - L) R3 = R1 + (H - L) R4 = R3+(R2-R1) // Support Levels S1 = (P * 2) - H S2 = P - (H - L) S3 = S1 - (H - L) S4 = S3 -(S1-S2) // Values to consider for trade directions and depth DHL=(H-L) PD=(TC-BC) Dir=(PD/C)*100 SR4=S4-R4 bool alert= (Dir>=0.01 and DHL>=1) //alert:=true // Plot Today's CPR if not(IsHoliday(start)) and not(IsWeekend(start)) and shouldPlotToday if showR4S4 _r4 = line.new(start, R4, end, R4, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_r4[1]) if showR3S3 _r3 = line.new(start, R3, end, R3, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_r3[1]) if showR2S2 _r2 = line.new(start, R2, end, R2, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_r2[1]) if showR1S1 _r1 = line.new(start, R1, end, R1, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_r1[1]) _tc = line.new(start, TC, end, TC, xloc.bar_time, color=color.new(cprColor, lTransp)) line.delete(_tc[1]) _p = line.new(start, P, end, P, xloc.bar_time, color=color.new(cprColor, lTransp)) line.delete(_p[1]) _bc = line.new(start, BC, end, BC, xloc.bar_time, color=color.new(cprColor, lTransp)) line.delete(_bc[1]) if showR1S1 _s1 = line.new(start, S1, end, S1, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_s1[1]) if showR2S2 _s2 = line.new(start, S2, end, S2, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_s2[1]) if showR3S3 _s3 = line.new(start, S3, end, S3, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_s3[1]) if showR4S4 _s4 = line.new(start, S4, end, S4, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_s4[1]) if showPDHL _pdh = line.new(start, H, end, H, xloc.bar_time, color=color.new(rColor, lTransp), style=line.style_dotted, width=2) line.delete(_pdh[1]) _pdl = line.new(start, L, end, L, xloc.bar_time, color=color.new(sColor, lTransp), style=line.style_dotted, width=2) line.delete(_pdl[1]) if showPDC _pdc = line.new(start, C, end, C, xloc.bar_time, color=color.new(cColor, lTransp), style=line.style_dotted, width=2) line.delete(_pdc[1]) // Plot Today's Labels if not(IsHoliday(start)) and not(IsWeekend(start)) and shouldPlotToday if showR4S4 l_r4 = label.new(start, R4, text="HR4", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_r4[1]) if showR3S3 l_r3 = label.new(start, R3, text="HR3", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_r3[1]) if showR2S2 l_r2 = label.new(start, R2, text="HR2", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_r2[1]) if showR1S1 l_r1 = label.new(start, R1, text="HR1", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_r1[1]) l_tc = label.new(start, TC, text="HTC", xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_tc[1]) l_p = label.new(start, P, text="HP", xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_p[1]) l_bc = label.new(start, BC, text="HBC", xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_bc[1]) if showR1S1 l_s1 = label.new(start, S1, text="HS1", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_s1[1]) if showR2S2 l_s2 = label.new(start, S2, text="HS2", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_s2[1]) if showR3S3 l_s3 = label.new(start, S3, text="HS3", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_s3[1]) if showR4S4 l_s4 = label.new(start, S4, text="HS4", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_s4[1]) if showPDHL l_pdh = label.new(start, H, text="PD High", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_pdh[1]) l_pdl = label.new(start, L, text="PD Low", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_pdl[1]) if showPDC l_pdc = label.new(start, C, text="PD Close", xloc=xloc.bar_time, textcolor=cColor, style=label.style_none) label.delete(l_pdc[1]) // Get series Dynamically for day getSeriesD(e, timeFrame) => security(syminfo.tickerid, 'D', e, lookahead=barmerge.lookahead_on) // Calculate Tomorrow's CPR // Get High, Low and Close tH = getSeriesD(high, 'D') tL = getSeriesD(low, 'D') tC = getSeriesD(high, 'D') // Pivot Range tP = (tH + tL + tC) / 3 tBC = (tH + tL)/2 tTC = (tP - tBC) + tP // Resistance Levels tR1 = (tP * 2) - tL tR2 = tP + (tH - tL) tR3 = tR1 + (tH - tL) tR4 = tR3 + (tR2 - tR1) // Support Levels tS1 = (tP * 2) - tH tS2 = tP - (tH - tL) tS3 = tS1 - (tH - tL) tS4 = tS3 - (tS1 - tS2) // Values to consider for trade directions and depth tDHL=(tH-tL) tPD=(tTC-tBC) tDir=(tPD/tC)*100 tSR4=tS4-tR4 // Plot Tomorrow's CPR if showTomorrowCPR if showR4S4 _t_r4 = line.new(tom_start, tR4, tom_end, tR4, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_t_r4[1]) if showR3S3 _t_r3 = line.new(tom_start, tR3, tom_end, tR3, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_t_r3[1]) if showR2S2 _t_r2 = line.new(tom_start, tR2, tom_end, tR2, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_t_r2[1]) if showR1S1 _t_r1 = line.new(tom_start, tR1, tom_end, tR1, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_t_r1[1]) _t_tc = line.new(tom_start, tTC, tom_end, tTC, xloc.bar_time, color=color.new(cprColor, lTranspCPR)) line.delete(_t_tc[1]) _t_p = line.new(tom_start, tP, tom_end, tP, xloc.bar_time, color=color.new(cprColor, lTranspCPR)) line.delete(_t_p[1]) _t_bc = line.new(tom_start, tBC, tom_end, tBC, xloc.bar_time, color=color.new(cprColor, lTranspCPR)) line.delete(_t_bc[1]) if showR1S1 _t_s1 = line.new(tom_start, tS1, tom_end, tS1, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_t_s1[1]) if showR2S2 _t_s2 = line.new(tom_start, tS2, tom_end, tS2, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_t_s2[1]) if showR3S3 _t_s3 = line.new(tom_start, tS3, tom_end, tS3, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_t_s3[1]) if showR4S4 _t_s4 = line.new(tom_start, tS4, tom_end, tS4, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_t_s4[1]) if showPDHL _pdth = line.new(tom_start, tH, tom_end, tH, xloc.bar_time, color=color.new(rColor, lTranspCPR), style=line.style_dotted, width=2) line.delete(_pdth[1]) _pdtl = line.new(tom_start, tL, tom_end, tL, xloc.bar_time, color=color.new(sColor, lTranspCPR), style=line.style_dotted, width=2) line.delete(_pdtl[1]) if showPDC _pdtc = line.new(tom_start, tC, tom_end, tC, xloc.bar_time, color=color.new(cColor, lTranspCPR), style=line.style_dotted, width=2) line.delete(_pdtc[1]) // Plot Tomorrow's Labels if showTomorrowCPR if showR4S4 l_t_r4 = label.new(tom_start, tR4, text="R4: "+tostring(tR4), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_t_r4[1]) if showR3S3 l_t_r3 = label.new(tom_start, tR3, text="R3: "+tostring(tR3), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_t_r3[1]) if showR2S2 l_t_r2 = label.new(tom_start, tR2, text="R2: "+tostring(tR2), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_t_r2[1]) if showR1S1 l_t_r1 = label.new(tom_start, tR1, text="R1: "+tostring(tR1), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_t_r1[1]) l_t_tc = label.new(tom_start, tTC, text="TC: "+tostring(tTC), xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_t_tc[1]) l_t_p = label.new(tom_start, tP, text="P: " +tostring(tP), xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_t_p[1]) l_t_bc = label.new(tom_start, tBC, text="BC: "+tostring(tBC), xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_t_bc[1]) if showR1S1 l_t_s1 = label.new(tom_start, tS1, text="S1: "+tostring(tS1), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_t_s1[1]) if showR2S2 l_t_s2 = label.new(tom_start, tS2, text="S2: "+tostring(tS2), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_t_s2[1]) if showR3S3 l_t_s3 = label.new(tom_start, tS3, text="S3: "+tostring(tS3), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_t_s3[1]) if showR4S4 l_t_s4 = label.new(tom_start, tS4, text="S4: "+tostring(tS4), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_t_s4[1]) if showPDHL l_pdth = label.new(tom_start, tH, text="PD High: "+tostring(tH), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_pdth[1]) l_pdtl = label.new(tom_start, tL, text="PD Low: "+tostring(tL), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_pdtl[1]) if showPDC l_pdtc = label.new(tom_start, tC, text="PD Close: "+tostring(tC), xloc=xloc.bar_time, textcolor=cColor, style=label.style_none) label.delete(l_pdtc[1]) // --------- Get series Daily -----------End------ // --------- Get series weekly -----------start------ // Get series getSeriesW(e, timeFrame) => security(syminfo.tickerid, 'W', e, lookahead=barmerge.lookahead_on) // -------Calculate Weekly's CPR current week and next week--------------- // Get High, Low and Close for the week twH = getSeriesW(high[showCWNWInterval], 'W') twL = getSeriesW(low[showCWNWInterval], 'W') twC = getSeriesW(high[showCWNWInterval], 'W') // Pivot Range twP = (twH + twL + twC) / 3 twBC = (twH + twL)/2 twTC = (twP - twBC) + twP // Resistance Levels twR1 = (twP * 2) - twL twR2 = twP + (twH - twL) twR3 = twR1 + (twH - twL) twR4 = twR3 + (twR2 - twR1) // Support Levels twS1 = (twP * 2) - twH twS2 = twP - (twH - twL) twS3 = twS1 - (twH - twL) twS4 = twS3 - (twS1 - twS2) // for current week values are plotted historically at the end of the scripts plotting section // the below coding is needed only to draw the lines and show the values manually on tomorrows date // ----------calculate next weekly values based on the current week as of now available OHLC values and this would be accurate by end of week end closing------------ // Get High, Low and Close for the week nwH = getSeriesW(high[0], 'W') nwL = getSeriesW(low[0], 'W') nwC = getSeriesW(high[0], 'W') // Pivot Range nwP = (nwH + nwL + nwC) / 3 nwBC = (nwH + nwL)/2 nwTC = (nwP - nwBC) + nwP // Resistance Levels nwR1 = (nwP * 2) - nwL nwR2 = nwP + (nwH - nwL) nwR3 = nwR1 + (nwH - nwL) nwR4 = nwR3 + (nwR2 - nwR1) // Support Levels nwS1 = (nwP * 2) - nwH nwS2 = nwP - (nwH - nwL) nwS3 = nwS1 - (nwH - nwL) nwS4 = nwS3 - (nwS1 - nwS2) //-------- Plot next weekly values & CPR Range on tomorrow date-- need to work on this date logic to show fully for next week. --------- //for now we can see it if this flag is set to true on tomorrows date if (showNextWeekCPR) if showR4S4 _nw_r4 = line.new(nw_start, nwR4, nw_end, nwR4, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_nw_r4[1]) if showR3S3 _nw_r3 = line.new(nw_start, nwR3, nw_end, nwR3, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_nw_r3[1]) if showR2S2 _nw_r2 = line.new(nw_start, nwR2, nw_end, nwR2, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_nw_r2[1]) if showR1S1 _nw_r1 = line.new(nw_start, nwR1, nw_end, nwR1, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_nw_r1[1]) _nw_tc = line.new(nw_start, nwTC, nw_end, nwTC, xloc.bar_time, color=color.new(twcprColor, lTranspCPR), width=2) line.delete(_nw_tc[1]) _nw_p = line.new(nw_start, nwP, nw_end, nwP, xloc.bar_time, color=color.new(twcprColor, lTranspCPR), width=2) line.delete(_nw_p[1]) _nw_bc = line.new(nw_start, nwBC, nw_end, nwBC, xloc.bar_time, color=color.new(twcprColor, lTranspCPR), width=2) line.delete(_nw_bc[1]) if showR1S1 _nw_s1 = line.new(nw_start, nwS1, nw_end, nwS1, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_nw_s1[1]) if showR2S2 _nw_s2 = line.new(nw_start, nwS2, nw_end, nwS2, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_nw_s2[1]) if showR3S3 _nw_s3 = line.new(nw_start, nwS3, nw_end, nwS3, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_nw_s3[1]) if showR4S4 _nw_s4 = line.new(nw_start, nwS4, nw_end, nwS4, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_nw_s4[1]) if showPWHL _pdnwh = line.new(nw_start, nwH, nw_end, nwH, xloc.bar_time, color=color.new(rColor, lTranspCPR), style=line.style_dotted, width=2) line.delete(_pdnwh[1]) _pdnwl = line.new(nw_start, nwL, nw_end, nwL, xloc.bar_time, color=color.new(sColor, lTranspCPR), style=line.style_dotted, width=2) line.delete(_pdnwl[1]) //if showPDC // _pdnwc = line.new(nw_start, nwC, nw_end, nwC, xloc.bar_time, color=color.new(cColor, lTranspCPR), style=line.style_dotted, width=2) // line.delete(_pdnwc[1]) // Plot next weekly Labels if (showNextWeekCPR) if showR4S4 l_nw_r4 = label.new(nw_start, nwR4, text="nwR4: "+tostring(nwR4), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_nw_r4[1]) if showR3S3 l_nw_r3 = label.new(nw_start, nwR3, text="nwR3: "+tostring(nwR3), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_nw_r3[1]) if showR2S2 l_nw_r2 = label.new(nw_start, nwR2, text="nwR2: "+tostring(nwR2), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_nw_r2[1]) if showR1S1 l_nw_r1 = label.new(nw_start, nwR1, text="nwR1: "+tostring(nwR1), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_nw_r1[1]) l_nw_tc = label.new(nw_start, nwTC, text="nwTC: "+tostring(nwTC), xloc=xloc.bar_time, textcolor=twcprColor, style=label.style_none) label.delete(l_nw_tc[1]) l_nw_p = label.new(nw_start, nwP, text="nwP: "+tostring(nwP), xloc=xloc.bar_time, textcolor=twcprColor, style=label.style_none) label.delete(l_nw_p[1]) l_nw_bc = label.new(nw_start, nwBC, text="nwBC: "+tostring(nwBC), xloc=xloc.bar_time, textcolor=twcprColor, style=label.style_none) label.delete(l_nw_bc[1]) if showR1S1 l_nw_s1 = label.new(nw_start, nwS1, text="nwS1: "+tostring(nwS1), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_nw_s1[1]) if showR2S2 l_nw_s2 = label.new(nw_start, nwS2, text="nwS2: "+tostring(nwS2), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_nw_s2[1]) if showR3S3 l_nw_s3 = label.new(nw_start, nwS3, text="nwS3: "+tostring(nwS3), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_nw_s3[1]) if showR4S4 l_nw_s4 = label.new(nw_start, nwS4, text="nwS4: "+tostring(nwS4), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_nw_s4[1]) if showPWHL l_pdnwh = label.new(nw_start, nwH, text="nwH: "+tostring(nwH), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_pdnwh[1]) l_pdnwl = label.new(nw_start, nwL, text="nwL: "+tostring(nwL), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_pdnwl[1]) //if showPDC // l_pdnwc = label.new(nw_start, nwC, text="nwC: "+tostring(nwC), xloc=xloc.bar_time, textcolor=cColor, style=label.style_none) // label.delete(l_pdnwc[1]) // --------- Get series Weekly -----------End------ // --------- Get series Monthly -----------start------ getSeriesM(e, timeFrame) => security(syminfo.tickerid, 'M', e, lookahead=barmerge.lookahead_on) // Calculate Weekly's CPR for current month and next month // Get High, Low and Close // if showCMNMInterval =0 for next Month and 1 for current month based on last week HLC canldle close values tmH = getSeriesM(high[showCMNMInterval], 'M') tmL = getSeriesM(low[showCMNMInterval], 'M') tmC = getSeriesM(high[showCMNMInterval], 'M') // Pivot Range tmP = (tmH + tmL + tmC) / 3 tmBC = (tmH + tmL)/2 tmTC = (tmP - tmBC) + tmP // Resistance Levels tmR1 = (tmP * 2) - tmL tmR2 = tmP + (tmH - tmL) tmR3 = tmR1 + (tmH - tmL) tmR4 = tmR3 + (tmR2 - tmR1) // Support Levels tmS1 = (tmP * 2) - tmH tmS2 = tmP - (tmH - tmL) tmS3 = tmS1 - (tmH - tmL) tmS4 = tmS3 - (tmS1 - tmS2) // for current month values are plotted historically at the end of the scripts plotting section // the below coding is needed only to draw the lines and show the values manually on tomorrows date // ----------calculate next month values based on the current month as of now available OHLC values and this would be accurate by end of month end closing------------ // Get High, Low and Close for the month nmH = getSeriesM(high[0], 'M') nmL = getSeriesM(low[0], 'M') nmC = getSeriesM(high[0], 'M') // Pivot Range nmP = (nmH + nmL + nmC) / 3 nmBC = (nmH + nmL)/2 nmTC = (nmP - nmBC) + nmP // Resistance Levels nmR1 = (nmP * 2) - nmL nmR2 = nmP + (nmH - nmL) nmR3 = nmR1 + (nmH - nmL) nmR4 = nmR3 + (nmR2 - nmR1) // Support Levels nmS1 = (nmP * 2) - nmH nmS2 = nmP - (nmH - nmL) nmS3 = nmS1 - (nmH - nmL) nmS4 = nmS3 - (nmS1 - nmS2) //-------- Plot next month values & CPR Range on tomorrow date-- need to work on this date logic to show fully for next month. --------- //for now we can see it if this flag is set to true on tomorrows date if (showNextMonthCPR) if showR4S4 _nm_r4 = line.new(nm_start, nmR4, nm_end, nmR4, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_nm_r4[1]) if showR3S3 _nm_r3 = line.new(nm_start, nmR3, nm_end, nmR3, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_nm_r3[1]) if showR2S2 _nm_r2 = line.new(nm_start, nmR2, nm_end, nmR2, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_nm_r2[1]) if showR1S1 _nm_r1 = line.new(nm_start, nmR1, nm_end, nmR1, xloc.bar_time, color=color.new(rColor, lTranspCPR)) line.delete(_nm_r1[1]) _nm_tc = line.new(nm_start, nmTC, nm_end, nmTC, xloc.bar_time, color=color.new(tmcprColor, lTranspCPR), width=2) line.delete(_nm_tc[1]) _nm_p = line.new(nm_start, nmP, nm_end, nmP, xloc.bar_time, color=color.new(tmcprColor, lTranspCPR), width=2) line.delete(_nm_p[1]) _nm_bc = line.new(nm_start, nmBC, nm_end, nmBC, xloc.bar_time, color=color.new(tmcprColor, lTranspCPR), width=2) line.delete(_nm_bc[1]) if showR1S1 _nm_s1 = line.new(nm_start, nmS1, nm_end, nmS1, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_nm_s1[1]) if showR2S2 _nm_s2 = line.new(nm_start, nmS2, nm_end, nmS2, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_nm_s2[1]) if showR3S3 _nm_s3 = line.new(nm_start, nmS3, nm_end, nmS3, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_nm_s3[1]) if showR4S4 _nm_s4 = line.new(nm_start, nmS4, nm_end, nmS4, xloc.bar_time, color=color.new(sColor, lTranspCPR)) line.delete(_nm_s4[1]) if showPMHL _pdnmh = line.new(nm_start, nmH, nm_end, nmH, xloc.bar_time, color=color.new(rColor, lTranspCPR), style=line.style_dotted, width=2) line.delete(_pdnmh[1]) _pdnml = line.new(nm_start, nmL, nm_end, nmL, xloc.bar_time, color=color.new(sColor, lTranspCPR), style=line.style_dotted, width=2) line.delete(_pdnml[1]) //if shonmPDC // _pdnmc = line.new(nm_start, nmC, nm_end, nmC, xloc.bar_time, color=color.new(cColor, lTranspCPR), style=line.style_dotted, width=2) // line.delete(_pdnmc[1]) // Plot next month Labels if (showNextMonthCPR) if showR4S4 l_nm_r4 = label.new(nm_start, nmR4, text="nmR4: "+tostring(nmR4), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_nm_r4[1]) if showR3S3 l_nm_r3 = label.new(nm_start, nmR3, text="nmR3: "+tostring(nmR3), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_nm_r3[1]) if showR2S2 l_nm_r2 = label.new(nm_start, nmR2, text="nmR2: "+tostring(nmR2), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_nm_r2[1]) if showR1S1 l_nm_r1 = label.new(nm_start, nmR1, text="nmR1: "+tostring(nmR1), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_nm_r1[1]) l_nm_tc = label.new(nm_start, nmTC, text="nmTC: "+tostring(nmTC), xloc=xloc.bar_time, textcolor=tmcprColor, style=label.style_none) label.delete(l_nm_tc[1]) l_nm_p = label.new(nm_start, nmP, text="nmP: "+tostring(nmP), xloc=xloc.bar_time, textcolor=tmcprColor, style=label.style_none) label.delete(l_nm_p[1]) l_nm_bc = label.new(nm_start, nmBC, text="nmBC: "+tostring(nmBC), xloc=xloc.bar_time, textcolor=tmcprColor, style=label.style_none) label.delete(l_nm_bc[1]) if showR1S1 l_nm_s1 = label.new(nm_start, nmS1, text="nmS1: "+tostring(nmS1), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_nm_s1[1]) if showR2S2 l_nm_s2 = label.new(nm_start, nmS2, text="nmS2: "+tostring(nmS2), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_nm_s2[1]) if showR3S3 l_nm_s3 = label.new(nm_start, nmS3, text="nmS3: "+tostring(nmS3), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_nm_s3[1]) if showR4S4 l_nm_s4 = label.new(nm_start, nmS4, text="nmS4: "+tostring(nmS4), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_nm_s4[1]) if showPMHL l_pdnmh = label.new(nm_start, nmH, text="nmH: "+tostring(nmH), xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_pdnmh[1]) l_pdnml = label.new(nm_start, nmL, text="nmL: "+tostring(nmL), xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_pdnml[1]) //if shownmPDC // l_pdnmc = label.new(nm_start, nmC, text="nmC: "+tostring(nmC), xloc=xloc.bar_time, textcolor=cColor, style=label.style_none) // label.delete(l_pdnmc[1]) // --------- Get series Monthly -----------End------ // --------- Get series Quaterly -----------Start------ getSeriesQ(e, timeFrame) => security(syminfo.tickerid, '3M', e, lookahead=barmerge.lookahead_on) // Calculate Quaterly's CPR for current Quaterly and next Quaterly // Get High, Low and Close // if showCMNMInterval =0 for next Quaterly and 1 for current Quaterly based on last week HLC canldle close values tqH = getSeriesQ(high[showCQNQInterval], '3M') tqL = getSeriesQ(low[showCQNQInterval], '3M') tqC = getSeriesQ(high[showCQNQInterval], '3M') // Pivot Range tqP = (tqH + tqL + tqC) / 3 tqBC = (tqH + tqL)/2 tqTC = (tqP - tqBC) + tqP // Resistance Levels tqR1 = (tqP * 2) - tqL tqR2 = tqP + (tqH - tqL) tqR3 = tqR1 + (tqH - tqL) tqR4 = tqR3 + (tqR2 - tqR1) // Support Levels tqS1 = (tqP * 2) - tqH tqS2 = tqP - (tqH - tqL) tqS3 = tqS1 - (tqH - tqL) tqS4 = tqS3 - (tqS1 - tqS2) // --------- Get series Quaterly -----------End------ // --------- Get series Yearly -----------Start------ getSeriesY(e, timeFrame) => security(syminfo.tickerid, '12M', e, lookahead=barmerge.lookahead_on) // Calculate Yearly's CPR for current Year and next year // Get High, Low and Close // if showCMNMInterval =0 for next year and 1 for current year based on last week HLC canldle close values tyH = getSeriesY(high[showCYNYInterval], '12M') tyL = getSeriesY(low[showCYNYInterval], '12M') tyC = getSeriesY(high[showCYNYInterval], '12M') // Pivot Range tyP = (tyH + tyL + tyC) / 3 tyBC = (tyH + tyL)/2 tyTC = (tyP - tyBC) + tyP // Resistance Levels tyR1 = (tyP * 2) - tyL tyR2 = tyP + (tyH - tyL) tyR3 = tyR1 + (tyH - tyL) tyR4 = tyR3 + (tyR2 - tyR1) // Support Levels tyS1 = (tyP * 2) - tyH tyS2 = tyP - (tyH - tyL) tyS3 = tyS1 - (tyH - tyL) tyS4 = tyS3 - (tyS1 - tyS2) // --------- Get series Yearly -----------End------ // dispaly the dayofweek -- remember these numbers displyed righ most in CPR line DOW=dayofweek(time) //mon=2,tue=3,wed=4,thu=5,friday6 //spy is 2 day expiry and expires on mon=2,wed=4,friday6 //Plot Historical CPR for daily p_r4 = plot(showHistoricalCPR ? showR4S4 ? showLines ? R4: R4 : na : na, title=' HR4', color=rColor, transp=lTransp, style=lStyle) p_r3 = plot(showHistoricalCPR ? showR3S3 ? showLines ? R3: R3 : na : na, title=' HR3', color=rColor, transp=lTransp, style=lStyle) p_r2 = plot(showHistoricalCPR ? showR2S2 ? showLines ? R2: R2 : na : na, title=' HR2', color=rColor, transp=lTransp, style=lStyle) p_r1 = plot(showHistoricalCPR ? showR1S1 ? showLines ? R1: R1 : na : na, title=' HR1', color=rColor, transp=lTransp, style=lStyle) p_cprTC = plot(showHistoricalCPR ? TC : na, title=' HTC', color=color.red, transp=lTranspCPR, style=lStyle) p_cprP = plot(showHistoricalCPR ? P : na, title=' HP', color=color.orange, transp=lTranspCPR, style=lStyle) p_cprBC = plot(showHistoricalCPR ? BC : na, title=' HBC', color=color.green, transp=lTranspCPR, style=lStyle) s1 = plot(showHistoricalCPR ? showR1S1 ? S1 : na : na, title=' HS1', color=sColor, transp=lTransp, style=lStyle) s2 = plot(showHistoricalCPR ? showR2S2 ? S2 : na : na, title=' HS2', color=sColor, transp=lTransp, style=lStyle) s3 = plot(showHistoricalCPR ? showR3S3 ? S3 : na : na, title=' HS3', color=sColor, transp=lTransp, style=lStyle) s4 = plot(showHistoricalCPR ? showR4S4 ? S4 : na : na, title=' HS4', color=sColor, transp=lTransp, style=lStyle) // showPDHL- High/Low --show previous day High and low values p_dH = plot(showHistoricalCPR ? showPDHL ? H : na : na, title=' Pre-Day High', color=hlColor, transp=lTransp, style=lStyle) p_dL = plot(showHistoricalCPR ? showPDHL ? L : na : na, title=' Pre-Day Low', color=hlColor, transp=lTransp, style=lStyle) // cutom strategy calculations display start.... p_DHL= plot(showHistoricalCPR ? true ? DHL : na : na, title=' DHL', color=hlColor, transp=lTransp, style=lStyle) p_PD= plot(showHistoricalCPR ? true ? PD : na : na, title=' PD', color=hlColor, transp=lTransp, style=lStyle) //this is the main value we need to consider the direction of the trade to enter p_Dir= plot(showHistoricalCPR ? true ? Dir : na : na, title=' Dir', color=color.orange, transp=lTransp, style=lStyle) p_SR4= plot(showHistoricalCPR ? true ? SR4 : na : na, title=' SR4', color=hlColor, transp=lTransp, style=lStyle) //Day of Week --this is used in Back testing to know 0 DTE's p_DOW= plot(showHistoricalCPR ? true ? DOW : na : na, title=' DOW', color=color.black, transp=lTransp, style=lStyle) // cutom strategy calculations display end.... //if showTomorrowCPRDynamically with current day HLC values present at the moment p_cprtTC = plot(showTomorrowCPRDynamic ? tTC : na, title=' HtTC', color=tcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtP = plot(showTomorrowCPRDynamic ? tP : na, title=' HtP', color=tcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtBC = plot(showTomorrowCPRDynamic ? tBC : na, title=' HtBC', color=tcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) //if showTomorrowCPRDynamic flip tc and bc //p_cprtBC = plot(showTomorrowCPRDynamic ? tBC : na, title=' tBC', color=tcprColor, transp=lTranspCPR, style=lStyle) //p_cprtP = plot(showTomorrowCPRDynamic ? tP : na, title=' tP', color=tcprColor, transp=lTranspCPR, style=lStyle) //p_cprtTC = plot(showTomorrowCPRDynamic ? tTC : na, title=' tTC', color=tcprColor, transp=lTranspCPR, style=lStyle) // cutom strategy calculations display start.... not working/using on these yet -- commented for now // this is to display values of tomorrow calculations by EOD it will be occurate as OHLC are keep changing // for now there is no strategy on these so commenting it for now //p_tDHL= plot(showHistoricalCPR ? true ? tDHL : na : na, title=' tDHL', color=hlColor, transp=lTransp, style=lStyle) //p_tPD= plot(showHistoricalCPR ? true ? tPD : na : na, title=' tPD', color=hlColor, transp=lTransp, style=lStyle) //this is the main value we need to consider the direction of the trade to enter //p_tDir= plot(showHistoricalCPR ? true ? tDir : na : na, title=' tDir', color=color.orange, transp=lTransp, style=lStyle) //p_tSR4= plot(showHistoricalCPR ? true ? tSR4 : na : na, title=' tSR4', color=hlColor, transp=lTransp, style=lStyle) // cutom strategy calculations display end.... ///end daily //start weekly for this week ---- plots weekly historically p_rw4 = plot(showWeekly ? showR4S4 ? showLines ? twR4: twR4 : na : na, title=' HWR4', color=rColor, transp=lTransp, style=lStyle) p_rw3 = plot(showWeekly ? showR3S3 ? showLines ? twR3: twR3 : na : na, title=' HWR3', color=rColor, transp=lTransp, style=lStyle) p_rw2 = plot(showWeekly ? showR2S2 ? showLines ? twR2: twR2 : na : na, title=' HWR2', color=rColor, transp=lTransp, style=lStyle) p_rw1 = plot(showWeekly ? showR1S1 ? showLines ? twR1: twR1 : na : na, title=' HWR1', color=rColor, transp=lTransp, style=lStyle) //if showWeekly CPR Range p_cprtwTC = plot(showWeekly ? twTC : na, title=' HWTC', color=twcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtwP = plot(showWeekly ? twP : na, title=' HWP', color=twcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtwBC = plot(showWeekly ? twBC : na, title=' HWBC', color=twcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) //if showWeekly flip tc, bc //p_cprtwBC = plot(showWeekly ? twBC : na, title=' WBC', color=twcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) //p_cprtwP = plot(showWeekly ? twP : na, title=' WP', color=twcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) //p_cprtwTC = plot(showWeekly ? twTC : na, title=' WTC', color=twcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_ws1 = plot(showWeekly ? showR1S1 ? twS1 : na : na, title=' HWS1', color=sColor, transp=lTransp, style=lStyle) p_ws2 = plot(showWeekly ? showR2S2 ? twS2 : na : na, title=' HWS2', color=sColor, transp=lTransp, style=lStyle) p_ws3 = plot(showWeekly ? showR3S3 ? twS3 : na : na, title=' HWS3', color=sColor, transp=lTransp, style=lStyle) p_ws4 = plot(showWeekly ? showR4S4 ? twS4 : na : na, title=' HWS4', color=sColor, transp=lTransp, style=lStyle) // showPWHL- High/Low p_twH = plot(showWeekly ? showPWHL ? twH : na : na, title=' W High', color=hlColor, transp=lTransp, style=lStyle) p_twL = plot(showWeekly ? showPWHL ? twL : na : na, title=' W Low', color=hlColor, transp=lTransp, style=lStyle) //end weekly //start monthly -- plots monthly historically p_rm4 = plot(showMonthly ? showR4S4 ? showLines ? tmR4: tmR4 : na : na, title=' HMR4', color=rColor, transp=lTransp, style=lStyle) p_rm3 = plot(showMonthly ? showR3S3 ? showLines ? tmR3: tmR3 : na : na, title=' HMR3', color=rColor, transp=lTransp, style=lStyle) p_rm2 = plot(showMonthly ? showR2S2 ? showLines ? tmR2: tmR2 : na : na, title=' HMR2', color=rColor, transp=lTransp, style=lStyle) p_rm1 = plot(showMonthly ? showR1S1 ? showLines ? tmR1: tmR1 : na : na, title=' HMR1', color=rColor, transp=lTransp, style=lStyle) //if showMonthly CPR range p_cprtmTC = plot(showMonthly ? tmTC : na, title=' HMTC', color=tmcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtmP = plot(showMonthly ? tmP : na, title=' HMP', color=tmcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtmBC = plot(showMonthly ? tmBC : na, title=' HMBC', color=tmcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_ms1 = plot(showMonthly ? showR1S1 ? tmS1 : na : na, title=' HMS1', color=sColor, transp=lTransp, style=lStyle) p_ms2 = plot(showMonthly ? showR2S2 ? tmS2 : na : na, title=' HMS2', color=sColor, transp=lTransp, style=lStyle) p_ms3 = plot(showMonthly ? showR3S3 ? tmS3 : na : na, title=' HMS3', color=sColor, transp=lTransp, style=lStyle) p_ms4 = plot(showMonthly ? showR4S4 ? tmS4 : na : na, title=' HMS4', color=sColor, transp=lTransp, style=lStyle) // showPMHL- High/Low p_tmH = plot(showMonthly ? showPMHL ? tmH : na : na, title=' M High', color=hlColor, transp=lTransp, style=lStyle) p_tmL = plot(showMonthly ? showPMHL ? tmL : na : na, title=' M Low', color=hlColor, transp=lTransp, style=lStyle) //end Monthly //start quaterly --- plots quaterly historically //_rq4 = plot(showQuaterly ? showR4S4 ? showLines ? tqR4: tqR4 : na : na, title=' QR4', color=rColor, transp=lTransp, style=lStyle) //_rq3 = plot(showQuaterly ? showR3S3 ? showLines ? tqR3: tqR3 : na : na, title=' QR3', color=rColor, transp=lTransp, style=lStyle) _rq2 = plot(showQuaterly ? showR2S2 ? showLines ? tqR2: tqR2 : na : na, title=' HQR2', color=rColor, transp=lTransp, style=lStyle) _rq1 = plot(showQuaterly ? showR1S1 ? showLines ? tqR1: tqR1 : na : na, title=' HQR1', color=rColor, transp=lTransp, style=lStyle) //if Quaterly CPR p_cprtqTC = plot(showQuaterly ? tqTC : na, title=' HQTC', color=tqcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtqP = plot(showQuaterly ? tqP : na, title=' HQP', color=tqcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtqBC = plot(showQuaterly ? tqBC : na, title=' HQBC', color=tqcprColor, transp=lTranspCPR, style=lStyle, linewidth=2) //_sq4 = plot(showQuaterly ? showR4S4 ? showLines ? tqS4: tqS4 : na : na, title=' QS4', color=sColor, transp=lTransp, style=lStyle) //_sq3 = plot(showQuaterly ? showR3S3 ? showLines ? tqS3: tqS3 : na : na, title=' QS3', color=sColor, transp=lTransp, style=lStyle) _sq2 = plot(showQuaterly ? showR2S2 ? showLines ? tqS2: tqS2 : na : na, title=' HQS2', color=sColor, transp=lTransp, style=lStyle) _sq1 = plot(showQuaterly ? showR1S1 ? showLines ? tqS1: tqS1 : na : na, title=' HQS1', color=sColor, transp=lTransp, style=lStyle) //end quaterly //start yearly --- plots yealy historically _ry4 = plot(showYearly ? showR4S4 ? showLines ? tyR4: tyR4 : na : na, title=' HYR4', color=rColor, transp=lTransp, style=lStyle) _ry3 = plot(showYearly ? showR3S3 ? showLines ? tyR3: tyR3 : na : na, title=' HYR3', color=rColor, transp=lTransp, style=lStyle) _ry2 = plot(showYearly ? showR2S2 ? showLines ? tyR2: tyR2 : na : na, title=' HYR2', color=rColor, transp=lTransp, style=lStyle) _ry1 = plot(showYearly ? showR1S1 ? showLines ? tyR1: tyR1 : na : na, title=' HYR1', color=rColor, transp=lTransp, style=lStyle) //if Yearly CPR p_cprtyTC = plot(showYearly ? tyTC : na, title=' HYTC', color=tycprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtyP = plot(showYearly ? tyP : na, title=' HYP', color=tycprColor, transp=lTranspCPR, style=lStyle, linewidth=2) p_cprtyBC = plot(showYearly ? tyBC : na, title=' HYBC', color=tycprColor, transp=lTranspCPR, style=lStyle, linewidth=2) //_sy4 = plot(showYearly ? showR4S4 ? showLines ? tyS4: tyS4 : na : na, title=' YS4', color=sColor, transp=lTransp, style=lStyle) //_sy3 = plot(showYearly ? showR3S3 ? showLines ? tyS3: tyS3 : na : na, title=' YS3', color=sColor, transp=lTransp, style=lStyle) //_sy2 = plot(showYearly ? showR2S2 ? showLines ? tyS2: tyS2 : na : na, title=' YS2', color=sColor, transp=lTransp, style=lStyle) sy1 = plot(showYearly ? showR1S1 ? showLines ? tyS1: tyS1 : na : na, title=' HYS1', color=sColor, transp=lTransp, style=lStyle) //end yearly //line_on = input(title="show vertical line", type=input.bool, defval=true) //label_on = input(title="show label", type=input.bool, defval=true) //color_chosen = input(title="color", type=input.color, defval=color.new(color.silver, 70)) // this plots label on each bar so commented it for now // barTime = time_close - time // if (shouldPlotToday) and (dayofweek == dayofweek.monday or dayofweek == dayofweek.wednesday or dayofweek == dayofweek.friday) // if line_on // line.new(x1=bar_index[0], x2=bar_index[0], y1=1, y2=2, extend=extend.both, color=color_chosen, style=line.style_dashed, width=3) // if label_on // label.new(x=bar_index[0], y=0, yloc=yloc.abovebar, text="Opt\nExp", color=color_chosen) // this alert section is not working at this moment--TBD alertcondition(alert,title="1 - Direction", message=' Dir = {{p_Dir}}') fill(p_cprTC, p_cprBC, color=color.purple, transp=fTransp)
Debug tool - table
https://www.tradingview.com/script/hbmeVFTJ-Debug-tool-table/
fikira
https://www.tradingview.com/u/fikira/
63
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © fikira //@version=5 indicator("Debug tool - table", max_bars_back=1000, overlay=true) i_choice = input.string('middle', title='options', options=['middle', 'time']) i_time = input.time(timestamp("20 Jul 2022 00:00 +0200"), "Date") i_pos = input.string(position.top_right, title='position table', options=[position.top_left , position.top_center , position.top_right , position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right]) var int bixL = na, var int bixM = na, var int dist = na, var float hi = na, var float lo = na, var table tab = na, var int[] num = array.from(-1) // box var box bxM = box.new(na, na, na, na, xloc= xloc.bar_index, bgcolor= color.new(color.orange, 90), border_color= color.orange) var box bxT = box.new(na, na, na, na, xloc= xloc.bar_time , bgcolor= color.new(color.orange, 90), border_color= color.orange) //–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– // example | v_rsi1 = ta.rsi(close, 5) // value from script | var rsi1 = v_rsi1 // value which will be placed in table | // | //–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– // further values // macd - signal - histogram [v_macd1, v_sign1, v_hist1] = ta.macd(close, 9, 14, 5) [v_macd2, v_sign2, v_hist2] = ta.macd(close, 12, 26, 9) [v_macd3, v_sign3, v_hist3] = ta.macd(close, 15, 30, 11) [v_macd4, v_sign4, v_hist4] = ta.macd(close, 18, 34, 13) [v_macd5, v_sign5, v_hist5] = ta.macd(close, 21, 38, 15) [v_macd6, v_sign6, v_hist6] = ta.macd(close, 24, 42, 17) // dir macd - signal - histogram v_dir_macd1 = math.sign(v_macd1), v_dir_sign1 = math.sign(v_sign2), v_dir_hist1 = math.sign(v_hist3) v_dir_macd2 = math.sign(v_macd2), v_dir_sign2 = math.sign(v_sign2), v_dir_hist2 = math.sign(v_hist2) v_dir_macd3 = math.sign(v_macd3), v_dir_sign3 = math.sign(v_sign3), v_dir_hist3 = math.sign(v_hist3) v_dir_macd4 = math.sign(v_macd4), v_dir_sign4 = math.sign(v_sign4), v_dir_hist4 = math.sign(v_hist4) v_dir_macd5 = math.sign(v_macd5), v_dir_sign5 = math.sign(v_sign5), v_dir_hist5 = math.sign(v_hist5) v_dir_macd6 = math.sign(v_macd6), v_dir_sign6 = math.sign(v_sign6), v_dir_hist6 = math.sign(v_hist6) // rsi v_rsi2 = ta.rsi(close, 7) v_rsi3 = ta.rsi(close, 10) v_rsi4 = ta.rsi(close, 14) v_rsi5 = ta.rsi(close, 21) v_rsi6 = ta.rsi(close, 30) // dir rsi v_dir_rsi1 = v_rsi1 > 50 ? 1 : v_rsi1 < 50 ? -1 : 0 v_dir_rsi2 = v_rsi2 > 50 ? 1 : v_rsi2 < 50 ? -1 : 0 v_dir_rsi3 = v_rsi3 > 50 ? 1 : v_rsi3 < 50 ? -1 : 0 v_dir_rsi4 = v_rsi4 > 50 ? 1 : v_rsi4 < 50 ? -1 : 0 v_dir_rsi5 = v_rsi5 > 50 ? 1 : v_rsi5 < 50 ? -1 : 0 v_dir_rsi6 = v_rsi6 > 50 ? 1 : v_rsi6 < 50 ? -1 : 0 // supertrend [v_st1, v_dir_st1] = ta.supertrend(2, 7), v_dir_st1 *= -1 [v_st2, v_dir_st2] = ta.supertrend(3, 14), v_dir_st2 *= -1 [v_st3, v_dir_st3] = ta.supertrend(4, 20), v_dir_st3 *= -1 [v_st4, v_dir_st4] = ta.supertrend(5, 30), v_dir_st4 *= -1 [v_st5, v_dir_st5] = ta.supertrend(6, 50), v_dir_st5 *= -1 [v_st6, v_dir_st6] = ta.supertrend(7, 70), v_dir_st6 *= -1 // values for table var macd1 = v_macd1, var dir_macd1 = v_dir_macd1, var sign1 = v_sign1, var dir_sign1 = v_dir_sign2, var hist1 = v_hist1, var dir_hist1 = v_dir_hist3 var macd2 = v_macd2, var dir_macd2 = v_dir_macd2, var sign2 = v_sign2, var dir_sign2 = v_dir_sign2, var hist2 = v_hist2, var dir_hist2 = v_dir_hist2 var macd3 = v_macd3, var dir_macd3 = v_dir_macd3, var sign3 = v_sign3, var dir_sign3 = v_dir_sign3, var hist3 = v_hist3, var dir_hist3 = v_dir_hist3 var macd4 = v_macd4, var dir_macd4 = v_dir_macd4, var sign4 = v_sign4, var dir_sign4 = v_dir_sign4, var hist4 = v_hist4, var dir_hist4 = v_dir_hist4 var macd5 = v_macd5, var dir_macd5 = v_dir_macd5, var sign5 = v_sign5, var dir_sign5 = v_dir_sign5, var hist5 = v_hist5, var dir_hist5 = v_dir_hist5 var macd6 = v_macd6, var dir_macd6 = v_dir_macd6, var sign6 = v_sign6, var dir_sign6 = v_dir_sign6, var hist6 = v_hist6, var dir_hist6 = v_dir_hist6 var dir_rsi1 = v_dir_rsi1 var rsi2 = v_rsi2 , var dir_rsi2 = v_dir_rsi2 var rsi3 = v_rsi3 , var dir_rsi3 = v_dir_rsi3 var rsi4 = v_rsi3 , var dir_rsi4 = v_dir_rsi4 var rsi5 = v_rsi3 , var dir_rsi5 = v_dir_rsi5 var rsi6 = v_rsi3 , var dir_rsi6 = v_dir_rsi6 var dir_st1 = v_dir_st1 var dir_st2 = v_dir_st2 var dir_st3 = v_dir_st3 var dir_st4 = v_dir_st4 var dir_st5 = v_dir_st5 var dir_st6 = v_dir_st6 tf_s = timeframe.in_seconds(timeframe.period) * 1000 switch time == chart.left_visible_bar_time => bixL := bar_index hi := high lo := low time > chart.left_visible_bar_time and time < chart.right_visible_bar_time => if high > hi hi := high if low < lo lo := low time == chart.right_visible_bar_time => // bixM := math.round(math.avg(bar_index, bixL)) dist := bar_index - bixM // if i_choice == 'middle' box.set_lefttop (bxM, bixM - 1, hi) box.set_rightbottom(bxM, bixM + 1, lo) // // option chart.left_visible_bar_time - chart.right_visible_bar_time bixM := math.round(math.avg(bar_index, bixL)) dist := bar_index - bixM // macd1 := v_macd1 [dist], dir_macd1 := v_dir_macd1[dist], sign1 := v_sign1[dist], dir_sign1 := v_dir_sign2[dist], hist1 := v_hist1[dist], dir_hist1 := v_dir_hist3[dist] macd2 := v_macd2 [dist], dir_macd2 := v_dir_macd2[dist], sign2 := v_sign2[dist], dir_sign2 := v_dir_sign2[dist], hist2 := v_hist2[dist], dir_hist2 := v_dir_hist2[dist] macd3 := v_macd3 [dist], dir_macd3 := v_dir_macd3[dist], sign3 := v_sign3[dist], dir_sign3 := v_dir_sign3[dist], hist3 := v_hist3[dist], dir_hist3 := v_dir_hist3[dist] macd4 := v_macd4 [dist], dir_macd4 := v_dir_macd4[dist], sign4 := v_sign4[dist], dir_sign4 := v_dir_sign4[dist], hist4 := v_hist4[dist], dir_hist4 := v_dir_hist4[dist] macd5 := v_macd5 [dist], dir_macd5 := v_dir_macd5[dist], sign5 := v_sign5[dist], dir_sign5 := v_dir_sign5[dist], hist5 := v_hist5[dist], dir_hist5 := v_dir_hist5[dist] macd6 := v_macd6 [dist], dir_macd6 := v_dir_macd6[dist], sign6 := v_sign6[dist], dir_sign6 := v_dir_sign6[dist], hist6 := v_hist6[dist], dir_hist6 := v_dir_hist6[dist] // //–––––––––––––––––––––––––––––––––––––––––––––––– rsi1 := v_rsi1 [dist] // value from example | //–––––––––––––––––––––––––––––––––––––––––––––––– // dir_rsi1:= v_dir_rsi1 [dist] rsi2 := v_rsi2 [dist], dir_rsi2 := v_dir_rsi2 [dist] rsi3 := v_rsi3 [dist], dir_rsi3 := v_dir_rsi3 [dist] rsi4 := v_rsi4 [dist], dir_rsi4 := v_dir_rsi4 [dist] rsi5 := v_rsi5 [dist], dir_rsi5 := v_dir_rsi5 [dist] rsi6 := v_rsi6 [dist], dir_rsi6 := v_dir_rsi6 [dist] // dir_st1 := v_dir_st1[dist] dir_st2 := v_dir_st2[dist] dir_st3 := v_dir_st3[dist] dir_st4 := v_dir_st4[dist] dir_st5 := v_dir_st5[dist] dir_st6 := v_dir_st6[dist] else //if i_choice == 'time' box.set_lefttop (bxT, i_time - tf_s, hi) box.set_rightbottom(bxT, i_time + tf_s, lo) // // option input.time if i_choice == 'time' and time == i_time // macd1 := v_macd1, dir_macd1 := v_dir_macd1, sign1 := v_sign1, dir_sign1 := v_dir_sign2, hist1 := v_hist1, dir_hist1 := v_dir_hist3 macd2 := v_macd2, dir_macd2 := v_dir_macd2, sign2 := v_sign2, dir_sign2 := v_dir_sign2, hist2 := v_hist2, dir_hist2 := v_dir_hist2 macd3 := v_macd3, dir_macd3 := v_dir_macd3, sign3 := v_sign3, dir_sign3 := v_dir_sign3, hist3 := v_hist3, dir_hist3 := v_dir_hist3 macd4 := v_macd4, dir_macd4 := v_dir_macd4, sign4 := v_sign4, dir_sign4 := v_dir_sign4, hist4 := v_hist4, dir_hist4 := v_dir_hist4 macd5 := v_macd5, dir_macd5 := v_dir_macd5, sign5 := v_sign5, dir_sign5 := v_dir_sign5, hist5 := v_hist5, dir_hist5 := v_dir_hist5 macd6 := v_macd6, dir_macd6 := v_dir_macd6, sign6 := v_sign6, dir_sign6 := v_dir_sign6, hist6 := v_hist6, dir_hist6 := v_dir_hist6 // //–––––––––––––––––––––––––––––––––––––––––––––––– rsi1 := v_rsi1 // value from example | //–––––––––––––––––––––––––––––––––––––––––––––––– // dir_rsi1:= v_dir_rsi1 rsi2 := v_rsi2 , dir_rsi2 := v_dir_rsi2 rsi3 := v_rsi3 , dir_rsi3 := v_dir_rsi3 rsi4 := v_rsi4 , dir_rsi4 := v_dir_rsi4 rsi5 := v_rsi5 , dir_rsi5 := v_dir_rsi5 rsi6 := v_rsi6 , dir_rsi6 := v_dir_rsi6 // dir_st1 := v_dir_st1 dir_st2 := v_dir_st2 dir_st3 := v_dir_st3 dir_st4 := v_dir_st4 dir_st5 := v_dir_st5 dir_st6 := v_dir_st6 // plusMin(value) => value > 0 ? '+' : ' ' value_dir(value, dir) => plusMin(value) + str.format("{0, number, 0.00}", value) + ' ' + plusMin(dir) + str.format("{0, number, #}", dir) addToTable(leftValue, rightValue, col) => set = array.get(num, 0) + 1 table.cell(table_id= tab, column= 0, row= set, text= leftValue , text_size= size.small, text_color= col) table.cell(table_id= tab, column= 1, row= set, text= rightValue, text_size= size.small, text_color= col) array.set (num, 0, set) // table if barstate.islast tab := table.new(position= i_pos, columns= 2, rows= 300, bgcolor= color.black, border_width= 1) // addToTable('macd 1:' , value_dir(macd1, dir_macd1), color.aqua ), addToTable('signal 1:', value_dir(sign1, dir_sign1), color.aqua), addToTable('hist 1:', value_dir(hist1, dir_hist1), color.aqua) addToTable('macd 2:' , value_dir(macd2, dir_macd2), color.aqua ), addToTable('signal 2:', value_dir(sign2, dir_sign2), color.aqua), addToTable('hist 2:', value_dir(hist2, dir_hist2), color.aqua) addToTable('macd 3:' , value_dir(macd3, dir_macd3), color.aqua ), addToTable('signal 3:', value_dir(sign3, dir_sign3), color.aqua), addToTable('hist 3:', value_dir(hist3, dir_hist3), color.aqua) addToTable('macd 4:' , value_dir(macd4, dir_macd4), color.aqua ), addToTable('signal 4:', value_dir(sign4, dir_sign4), color.aqua), addToTable('hist 4:', value_dir(hist4, dir_hist4), color.aqua) addToTable('macd 5:' , value_dir(macd5, dir_macd5), color.aqua ), addToTable('signal 5:', value_dir(sign5, dir_sign5), color.aqua), addToTable('hist 5:', value_dir(hist5, dir_hist5), color.aqua) addToTable('macd 6:' , value_dir(macd6, dir_macd6), color.aqua ), addToTable('signal 6:', value_dir(sign6, dir_sign6), color.aqua), addToTable('hist 6:', value_dir(hist6, dir_hist6), color.aqua) // //–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– addToTable('rsi 1 :' , value_dir(rsi1 , dir_rsi1) , color.yellow) // value from example -> table | //–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– // addToTable('rsi 2 :' , value_dir(rsi2 , dir_rsi2) , color.yellow) addToTable('rsi 3 :' , value_dir(rsi3 , dir_rsi3) , color.yellow) addToTable('rsi 4 :' , value_dir(rsi4 , dir_rsi4) , color.yellow) addToTable('rsi 5 :' , value_dir(rsi5 , dir_rsi5) , color.yellow) addToTable('rsi 6 :' , value_dir(rsi6 , dir_rsi6) , color.yellow) // addToTable('supertrend 1:' , plusMin(dir_st1) + str.format("{0, number, ##}", dir_st1), dir_st1 > 0 ? color.lime : color.red) addToTable('supertrend 2:' , plusMin(dir_st2) + str.format("{0, number, ##}", dir_st2), dir_st2 > 0 ? color.lime : color.red) addToTable('supertrend 3:' , plusMin(dir_st3) + str.format("{0, number, ##}", dir_st3), dir_st3 > 0 ? color.lime : color.red) addToTable('supertrend 4:' , plusMin(dir_st4) + str.format("{0, number, ##}", dir_st4), dir_st4 > 0 ? color.lime : color.red) addToTable('supertrend 5:' , plusMin(dir_st5) + str.format("{0, number, ##}", dir_st5), dir_st5 > 0 ? color.lime : color.red) addToTable('supertrend 6:' , plusMin(dir_st6) + str.format("{0, number, ##}", dir_st6), dir_st6 > 0 ? color.lime : color.red) plot(v_macd1 , color= color.aqua ), plot(v_dir_macd1, color= color.aqua), plot(v_sign1, color= color.aqua), plot(v_dir_sign1, color= color.aqua), plot(v_hist1, color= color.aqua), plot(v_dir_hist1, color= color.aqua) plot(v_macd2 , color= color.aqua ), plot(v_dir_macd2, color= color.aqua), plot(v_sign2, color= color.aqua), plot(v_dir_sign2, color= color.aqua), plot(v_hist2, color= color.aqua), plot(v_dir_hist2, color= color.aqua) plot(v_macd3 , color= color.aqua ), plot(v_dir_macd3, color= color.aqua), plot(v_sign3, color= color.aqua), plot(v_dir_sign3, color= color.aqua), plot(v_hist3, color= color.aqua), plot(v_dir_hist3, color= color.aqua) plot(v_macd4 , color= color.aqua ), plot(v_dir_macd4, color= color.aqua), plot(v_sign4, color= color.aqua), plot(v_dir_sign4, color= color.aqua), plot(v_hist4, color= color.aqua), plot(v_dir_hist4, color= color.aqua) plot(v_macd5 , color= color.aqua ), plot(v_dir_macd5, color= color.aqua), plot(v_sign5, color= color.aqua), plot(v_dir_sign5, color= color.aqua), plot(v_hist5, color= color.aqua), plot(v_dir_hist5, color= color.aqua) plot(v_macd6 , color= color.aqua ), plot(v_dir_macd6, color= color.aqua), plot(v_sign6, color= color.aqua), plot(v_dir_sign6, color= color.aqua), plot(v_hist6, color= color.aqua), plot(v_dir_hist6, color= color.aqua) // //––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– plot(v_rsi1 , color= color.yellow), plot(v_dir_rsi1 , color= color.yellow) // value from example -> series (chart) | //––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– // plot(v_rsi2 , color= color.yellow), plot(v_dir_rsi2 , color= color.yellow) plot(v_rsi3 , color= color.yellow), plot(v_dir_rsi3 , color= color.yellow) plot(v_rsi4 , color= color.yellow), plot(v_dir_rsi4 , color= color.yellow) plot(v_rsi5 , color= color.yellow), plot(v_dir_rsi5 , color= color.yellow) plot(v_rsi6 , color= color.yellow), plot(v_dir_rsi6 , color= color.yellow) plot(v_dir_st1, color= v_dir_st1 > 0 ? color.lime : color.red) plot(v_dir_st2, color= v_dir_st2 > 0 ? color.lime : color.red) plot(v_dir_st3, color= v_dir_st3 > 0 ? color.lime : color.red) plot(v_dir_st4, color= v_dir_st4 > 0 ? color.lime : color.red) plot(v_dir_st5, color= v_dir_st5 > 0 ? color.lime : color.red) plot(v_dir_st6, color= v_dir_st6 > 0 ? color.lime : color.red)
HARKAT momentom
https://www.tradingview.com/script/ABVSMKxc-HARKAT-momentom/
kkaa562
https://www.tradingview.com/u/kkaa562/
64
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © kkaa562 //@version=5 indicator("HARKAT",timeframe="",timeframe_gaps=true) len=input.int(10,minval=1,title="LENGTH") src=input(hl2) harkat=ta.ema(high-low,len)*100/(src[1]*.5+src[len]*.5)+(high[1]-low[1])*100/(src[1]*.5+src[1]*.5) plot(.5*harkat,color=#0a0ec2,title="h")
MACD-V Volatility Normalisation
https://www.tradingview.com/script/cnjeRI36-MACD-V-Volatility-Normalisation/
Riliza
https://www.tradingview.com/u/Riliza/
1,033
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © jamiedubauskas //@version=5 indicator(title = "MACD-V Volatility Normalisation", shorttitle = "MACD-V Volatility Normalisation", overlay = false) // asking for inputs for the parameters of the MACD-V indicator fast_len = input.int(title = "MACD Fast Length", defval = 12, minval = 1, group = "Indicator Settings") slow_len = input.int(title = "MACD Slow Length", defval = 26, minval = 1, group = "Indicator Settings") source = input.source(title = "Source", defval = close, group = "Indicator Settings") signal_len = input.int(title = "Signal Line Smoothing Length", defval = 9, minval = 1, group = "Indicator Settings") atr_len = input.int(title = "ATR Length", defval = 26, minval = 1, tooltip = "Used to gauge volatility to standardize MACD. Keep at the same value as the MACD Slow Length parameter for best results", group = "Indicator Settings") // indicator calculation macd = ((ta.ema(source, fast_len) - ta.ema(source, slow_len)) / ta.atr(atr_len)) * 100 signal = ta.ema(macd, signal_len) hist = macd - signal // asking for input for the color of the macd and signal lines macd_color = input.color(title = "MACD Line", defval = #2962FF, group = "Color Settings") signal_color = input.color(title = "Signal Line", defval = #FF6D00, group = "Color Settings") // getting colors for the histogram col_grow_above = input(#26A69A, "Above Grow", group="Histogram", inline="Above") col_fall_above = input(#B2DFDB, "Fall", group="Histogram", inline="Above") col_grow_below = input(#FFCDD2, "Below Grow", group="Histogram", inline="Below") col_fall_below = input(#FF5252, "Fall", group="Histogram", inline="Below") macd_plot = plot(title = "MACD Line", series = macd, color = macd_color) plot(title = "Signal Line", series = signal, color = signal_color)
CPR PRICE ACTION TODAY AND TOMMOROW
https://www.tradingview.com/script/MG1sxAIT-CPR-PRICE-ACTION-TODAY-AND-TOMMOROW/
bulllegacy
https://www.tradingview.com/u/bulllegacy/
241
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © bull //@version=4 study("CPR PRICE ACTION TODAY AND TOMMOROW", shorttitle="CPR", overlay=true) // User inputs showTomorrowCPR = input(title="Show tomorrow's CPR", type=input.bool, defval=true) showHistoricalCPR = input(title="Show historical CPR", type=input.bool, defval=false) showR3S3 = input(title="Show R3 & S3", type=input.bool, defval=false) showPDHL = input(title="Show previous day's High & Low", type=input.bool, defval=false) showPDC = input(title="Show previous day's Close", type=input.bool, defval=false) // Defaults // CPR Colors cprColor = color.purple rColor = color.red sColor = color.green cColor = color.black // Line style & Transparency lStyle = plot.style_line lTransp = 35 //Fill Transparency fTransp = 95 // Global Variables & Flags // TODO : Update the No of Holidays noOfHolidays = 12 // Global Functions // TODO : Update the list of Holiday here in format YYYY, MM, DD, 09, 15 // **09, 15 are session start hour & minutes IsHoliday(_date) => iff(_date == timestamp(2020, 02, 21, 09, 15), true, iff(_date == timestamp(2020, 03, 10, 09, 15), true, iff(_date == timestamp(2020, 04, 02, 09, 15), true, iff(_date == timestamp(2020, 04, 06, 09, 15), true, iff(_date == timestamp(2020, 04, 10, 09, 15), true, iff(_date == timestamp(2020, 04, 14, 09, 15), true, iff(_date == timestamp(2020, 05, 01, 09, 15), true, iff(_date == timestamp(2020, 05, 25, 09, 15), true, iff(_date == timestamp(2020, 10, 02, 09, 15), true, iff(_date == timestamp(2020, 11, 16, 09, 15), true, iff(_date == timestamp(2020, 11, 30, 09, 15), true, iff(_date == timestamp(2020, 12, 25, 09, 15), true, false)))))))))))) // Note: Week of Sunday=1...Saturday=7 IsWeekend(_date) => dayofweek(_date) == 7 or dayofweek(_date) == 1 // Skip Weekend SkipWeekend(_date) => _d = dayofweek(_date) _mul = _d == 6 ? 3 : _d == 7 ? 2 : 1 _date + (_mul * 86400000) // Get Next Working Day GetNextWorkingDay(_date) => _dt = SkipWeekend(_date) for i = 1 to noOfHolidays if IsHoliday(_dt) _dt := SkipWeekend(_dt) continue else break _dt // Today's Session Start timestamp y = year(timenow) m = month(timenow) d = dayofmonth(timenow) // Start & End time for Today's CPR start = timestamp(y, m, d, 09, 15) end = start + 86400000 // Plot Today's CPR shouldPlotToday = timenow > start tom_start = start tom_end = end // Start & End time for Tomorrow's CPR if shouldPlotToday tom_start := GetNextWorkingDay(start) tom_end := tom_start + 86400000 // Get series getSeries(e, timeFrame) => security(syminfo.tickerid, "D", e, lookahead=barmerge.lookahead_on) // Calculate Today's CPR //Get High, Low and Close H = getSeries(high[1], 'D') L = getSeries(low[1], 'D') C = getSeries(close[1], 'D') // Pivot Range P = (H + L + C) / 3 TC = (H + L)/2 BC = (P - TC) + P // Resistance Levels R3 = H + 2*(P - L) R2 = P + (H - L) R1 = (P * 2) - L // Support Levels S1 = (P * 2) - H S2 = P - (H - L) S3 = L - 2*(H - P) // Plot Today's CPR if not(IsHoliday(start)) and not(IsWeekend(start)) and shouldPlotToday if showR3S3 _r3 = line.new(start, R3, end, R3, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_r3[1]) _r2 = line.new(start, R2, end, R2, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_r2[1]) _r1 = line.new(start, R1, end, R1, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_r1[1]) _tc = line.new(start, TC, end, TC, xloc.bar_time, color=color.new(cprColor, lTransp)) line.delete(_tc[1]) _p = line.new(start, P, end, P, xloc.bar_time, color=color.new(cprColor, lTransp)) line.delete(_p[1]) _bc = line.new(start, BC, end, BC, xloc.bar_time, color=color.new(cprColor, lTransp)) line.delete(_bc[1]) _s1 = line.new(start, S1, end, S1, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_s1[1]) _s2 = line.new(start, S2, end, S2, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_s2[1]) if showR3S3 _s3 = line.new(start, S3, end, S3, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_s3[1]) if showPDHL _pdh = line.new(start, H, end, H, xloc.bar_time, color=color.new(rColor, lTransp), style=line.style_dotted, width=2) line.delete(_pdh[1]) _pdl = line.new(start, L, end, L, xloc.bar_time, color=color.new(sColor, lTransp), style=line.style_dotted, width=2) line.delete(_pdl[1]) if showPDC _pdc = line.new(start, C, end, C, xloc.bar_time, color=color.new(cColor, lTransp), style=line.style_dotted, width=2) line.delete(_pdc[1]) // Plot Today's Labels if not(IsHoliday(start)) and not(IsWeekend(start)) and shouldPlotToday if showR3S3 l_r3 = label.new(start, R3, text="R3", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_r3[1]) l_r2 = label.new(start, R2, text="R2", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_r2[1]) l_r1 = label.new(start, R1, text="R1", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_r1[1]) l_tc = label.new(start, TC, text="TC", xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_tc[1]) l_p = label.new(start, P, text="P", xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_p[1]) l_bc = label.new(start, BC, text="BC", xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_bc[1]) l_s1 = label.new(start, S1, text="S1", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_s1[1]) l_s2 = label.new(start, S2, text="S2", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_s2[1]) if showR3S3 l_s3 = label.new(start, S3, text="S3", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_s3[1]) if showPDHL l_pdh = label.new(start, H, text="PD High", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_pdh[1]) l_pdl = label.new(start, L, text="PD Low", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_pdl[1]) if showPDC l_pdc = label.new(start, C, text="PD Close", xloc=xloc.bar_time, textcolor=cColor, style=label.style_none) label.delete(l_pdc[1]) // Calculate Tomorrow's CPR // Get High, Low and Close tH = getSeries(high, 'D') tL = getSeries(low, 'D') tC = getSeries(close, 'D') // Pivot Range tP = (tH + tL + tC) / 3 tTC = (tH + tL)/2 tBC = (tP - tTC) + tP // Resistance Levels tR3 = tH + 2*(tP - tL) tR2 = tP + (tH - tL) tR1 = (tP * 2) - tL // Support Levels tS1 = (tP * 2) - tH tS2 = tP - (tH - tL) tS3 = tL - 2*(tH - tP) // Plot Tomorrow's CPR if showTomorrowCPR if showR3S3 _t_r3 = line.new(tom_start, tR3, tom_end, tR3, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_t_r3[1]) _t_r2 = line.new(tom_start, tR2, tom_end, tR2, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_t_r2[1]) _t_r1 = line.new(tom_start, tR1, tom_end, tR1, xloc.bar_time, color=color.new(rColor, lTransp)) line.delete(_t_r1[1]) _t_tc = line.new(tom_start, tTC, tom_end, tTC, xloc.bar_time, color=color.new(cprColor, lTransp)) line.delete(_t_tc[1]) _t_p = line.new(tom_start, tP, tom_end, tP, xloc.bar_time, color=color.new(cprColor, lTransp)) line.delete(_t_p[1]) _t_bc = line.new(tom_start, tBC, tom_end, tBC, xloc.bar_time, color=color.new(cprColor, lTransp)) line.delete(_t_bc[1]) _t_s1 = line.new(tom_start, tS1, tom_end, tS1, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_t_s1[1]) _t_s2 = line.new(tom_start, tS2, tom_end, tS2, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_t_s2[1]) if showR3S3 _t_s3 = line.new(tom_start, tS3, tom_end, tS3, xloc.bar_time, color=color.new(sColor, lTransp)) line.delete(_t_s3[1]) if showPDHL _pdth = line.new(tom_start, tH, tom_end, tH, xloc.bar_time, color=color.new(rColor, lTransp), style=line.style_dotted, width=2) line.delete(_pdth[1]) _pdtl = line.new(tom_start, tL, tom_end, tL, xloc.bar_time, color=color.new(sColor, lTransp), style=line.style_dotted, width=2) line.delete(_pdtl[1]) if showPDC _pdtc = line.new(tom_start, tC, tom_end, tC, xloc.bar_time, color=color.new(cColor, lTransp), style=line.style_dotted, width=2) line.delete(_pdtc[1]) // Plot Tomorrow's Labels if showTomorrowCPR if showR3S3 l_t_r3 = label.new(tom_start, tR3, text="R3", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_t_r3[1]) l_t_r2 = label.new(tom_start, tR2, text="R2", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_t_r2[1]) l_t_r1 = label.new(tom_start, tR1, text="R1", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_t_r1[1]) l_t_tc = label.new(tom_start, tTC, text="TC", xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_t_tc[1]) l_t_p = label.new(tom_start, tP, text="P", xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_t_p[1]) l_t_bc = label.new(tom_start, tBC, text="BC", xloc=xloc.bar_time, textcolor=cprColor, style=label.style_none) label.delete(l_t_bc[1]) l_t_s1 = label.new(tom_start, tS1, text="S1", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_t_s1[1]) l_t_s2 = label.new(tom_start, tS2, text="S2", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_t_s2[1]) if showR3S3 l_t_s3 = label.new(tom_start, tS3, text="S3", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_t_s3[1]) if showPDHL l_pdth = label.new(tom_start, tH, text="PD High", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none) label.delete(l_pdth[1]) l_pdtl = label.new(tom_start, tL, text="PD Low", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none) label.delete(l_pdtl[1]) if showPDC l_pdtc = label.new(tom_start, tC, text="PD Close", xloc=xloc.bar_time, textcolor=cColor, style=label.style_none) label.delete(l_pdtc[1]) //Plot Historical CPR p_r3 = plot(showHistoricalCPR ? showR3S3 ? R3 : na : na, title=' R3', color=rColor, transp=lTransp, style=lStyle) p_r2 = plot(showHistoricalCPR ? R2 : na, title=' R2', color=rColor, transp=lTransp, style=lStyle) p_r1 = plot(showHistoricalCPR ? R1 : na, title=' R1', color=rColor, transp=lTransp, style=lStyle) p_cprTC = plot(showHistoricalCPR ? TC : na, title=' TC', color=cprColor, transp=lTransp, style=lStyle) p_cprP = plot(showHistoricalCPR ? P : na, title=' P', color=cprColor, transp=lTransp, style=lStyle) p_cprBC = plot(showHistoricalCPR ? BC : na, title=' BC', color=cprColor, transp=lTransp, style=lStyle) s1 = plot(showHistoricalCPR ? S1 : na, title=' S1', color=sColor, transp=lTransp, style=lStyle) s2 = plot(showHistoricalCPR ? S2 : na, title=' S2', color=sColor, transp=lTransp, style=lStyle) s3 = plot(showHistoricalCPR ? showR3S3 ? S3 : na : na, title=' S3', color=sColor, transp=lTransp, style=lStyle) fill(p_cprTC, p_cprBC, color=color.purple, transp=fTransp)
FLEX KDJ IND
https://www.tradingview.com/script/FeKCdC3U-FLEX-KDJ-IND/
shakibsharifian
https://www.tradingview.com/u/shakibsharifian/
33
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © shakibsharifian //@version=5 indicator("FLEX KDJ IND",max_bars_back=400,overlay=true) bcwsma(s,l,m) => _bcwsma=0.00, _bcwsma:= (m*s+(l-m)*nz(_bcwsma[1]))/l, _bcwsma myKDJ(param,fast,ma1,ma2) => h = ta.highest(high, fast) l = ta.lowest(low,fast) RSV = 100*((param-l)/(h-l)) pK = bcwsma(RSV, ma1, 1) pD = bcwsma(pK, ma2, 1) pJ = 3 * pK-2 * pD [pD,pJ] LONG = input.int(9, minval=1, title='PERIOD Length: ', group='TRADE SETTINGS', inline='k') ma1 = input.int(3, minval=1, title='MA1 length: ', group='TRADE SETTINGS', inline='k') ma2 = input.int(3, minval=1, title='MA2 length: ', group='TRADE SETTINGS', inline='k') src =input.source(defval=ohlc4,title='SOURCE: ', group='TRADE SETTINGS', inline='l') string optTopo1="AVG" string optTopo2="MEDIAN" string optTopo3="MAX" string optTopo4="MIN" string optTopo5="WIDE" string optTopo6="NARROW" string optTopo7="FIX" string optTopo8="GAUSS" string optTopo9="UPPER BOND" string optTopo10="LOWER BOND" string i_TopoType = input.string(defval="NARROW", title="Topology", options = [optTopo1, optTopo2,optTopo3,optTopo4,optTopo5,optTopo6,optTopo7,optTopo8,optTopo9,optTopo10],group='BOND Def.',inline='a') leftBars=input.int(3,title='LEFT RANGE: ', group='BOND Def.', inline='b') rightBars=input.int(3,title='RIGHT RANGE: ', group='BOND Def.', inline='b') fix_H = input.int(80, minval=0, title='MAX BOND: ', group='BOND Def.', inline='c') fix_L = input.int(20, minval=0, title='MIN BOND: ', group='BOND Def.', inline='c') MEMORY = input.int(10, minval=1, title='MEMORY: ', group='BOND Def.', inline='d') _multH = input.float(1.96, title='Mult. Max BOND', group='BOND Def.', inline='e') _multL = input.float(-1.96, title='Mult. Min BOND', group='BOND Def.', inline='e') [_pD,_pJ]=myKDJ(src,LONG,ma1,ma2) pL = ta.pivotlow(_pJ, leftBars, rightBars) pH = ta.pivothigh(_pJ, leftBars, rightBars) // var allBoundsL=array.new_float() var allBoundsH=array.new_float() // if na(pH)==false array.push(allBoundsH,pH) if na(pL)==false array.push(allBoundsL,pL) if bar_index>LONG and array.size(allBoundsH)>MEMORY clnH=array.shift(allBoundsH) if bar_index>LONG and array.size(allBoundsL)>MEMORY clnL=array.shift(allBoundsL) float HvL = switch i_TopoType optTopo1 => array.avg(allBoundsH) optTopo2 => array.median(allBoundsH) optTopo3 => array.max(allBoundsH) optTopo4 => array.min(allBoundsH) optTopo5 => array.max(allBoundsH) optTopo6 => array.min(allBoundsH) optTopo7 => fix_H optTopo8 => array.avg(allBoundsH)+(_multH*array.stdev(allBoundsH)) optTopo9 => array.max(allBoundsH) optTopo10 => array.max(allBoundsL) float LvL = switch i_TopoType optTopo1 => array.avg(allBoundsL) optTopo2 => array.median(allBoundsL) optTopo3 => array.max(allBoundsL) optTopo4 => array.min(allBoundsL) optTopo5 => array.min(allBoundsL) optTopo6 => array.max(allBoundsL) optTopo7 => fix_L optTopo8 => array.avg(allBoundsL)+(_multL*array.stdev(allBoundsL)) optTopo9 => array.min(allBoundsH) optTopo10 => array.min(allBoundsL) h2 = plot(HvL,color=color.new(color.silver,0),title='High BOND',style=plot.style_cross,linewidth=1) h3 = plot(LvL,color=color.new(color.silver,0),title='Low BOND',style=plot.style_cross,linewidth=1) plot(_pD, color=color.orange,title='D') plot(_pJ, color=color.new(color.white,0),title='J') bgcolor(0.97*_pJ>_pD? color.new(#306318,0) : color.new(#6e1010,0)) _preUnder=ta.barssince(ta.crossunder(0.97*_pJ,_pD)) _preOver=ta.barssince(ta.crossover(0.97*_pJ,_pD)) var barUnderC=array.new_int() _delUnder=ta.crossunder(0.97*_pJ,_pD)?(_preOver-_preUnder):na if bar_index>LONG and ta.crossunder(0.97*_pJ,_pD) array.push(barUnderC,_delUnder) if bar_index>LONG and array.size(barUnderC)>MEMORY clnUC=array.shift(barUnderC) _CU=int(array.avg(barUnderC)) CUstd=int(array.stdev(barUnderC)) _multSTD975=1.96 var t = table.new(position.bottom_right, 1, 2, color.olive) table.cell(t, 0, 0, str.tostring(_CU)+'|+-'+str.tostring(CUstd)+'| '+str.tostring(int(_CU-(_multSTD975*CUstd))<0?na:int(_CU-(_multSTD975*CUstd)))+'~'+str.tostring(int(_CU+(_multSTD975*CUstd))),bgcolor=color.new(color.black,0),text_color=color.new(color.yellow,0)) table.cell(t, 0, 1, 'C: '+str.tostring(_preUnder),bgcolor=color.new(color.black,0),text_color=color.new(color.white,0))
Ultra Magic 2.0 [Jay Jani]
https://www.tradingview.com/script/wMr7DsuI-Ultra-Magic-2-0-Jay-Jani/
jayjani0007
https://www.tradingview.com/u/jayjani0007/
32
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © jayjani0007 //@version=4 study(title="Warrior Thunderbolt Indicator 2.0", shorttitle="WTI 2.0", overlay=true) showpivot = input(defval = false, title="Show CPR") showVWAP = input(title="Show VWAP", type=input.bool, defval=false) showVWMA = input(title="Show VWMA", type=input.bool, defval=false) showPSAR = input(title="Show PSAR", type=input.bool, defval=false) showBB = input(title="Show BB", type=input.bool, defval=false) showEMA9 = input(title="Show EMA-9", type=input.bool, defval=false) showEMA20 = input(title="Show EMA-20", type=input.bool, defval=false) showEMA50 = input(title="Show EMA-50", type=input.bool, defval=false) showEMA100 = input(title="Show EMA-100", type=input.bool, defval=false) showSMA9 = input(title="Show SMA-9", type=input.bool, defval=false) showSMA20 = input(title="Show SMA -20", type=input.bool, defval=false) showSMA50 = input(title="Show SMA-50", type=input.bool, defval=false) showSMA100 = input(title="Show SMA-100", type=input.bool, defval=false) showwMA9 = input(title="Show WMA-9", type=input.bool, defval=false) showwMA20 = input(title="Show WMA-20", type=input.bool, defval=false) showwMA50 = input(title="Show WMA-50", type=input.bool, defval=false) showwMA100 = input(title="Show WMA-100", type=input.bool, defval=false) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////// EMA - 9/20/50/100 /////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// EMA9_Len = input(9, minval=1, title="EMA9_Length") //EMA9_src = input(close, title="EMA9_Source") //EMA9_offset = input(title="EMA9_Offset", type=input.integer, defval=0, minval=-500, maxval=500) EMA9_out = ema(close, EMA9_Len) plot(showEMA9 ? EMA9_out:na, title="EMA9", color=color.yellow, offset=0) EMA20_Len = input(20, minval=1, title="EMA20_Length") //EMA20_src = input(close, title="EMA20_Source") //EMA20_offset = input(title="EMA20_Offset", type=input.integer, defval=0, minval=-500, maxval=500) EMA20_out = ema(close, EMA20_Len) plot(showEMA20 ? EMA20_out:na, title="EMA20", color=color.blue, offset=0) EMA50_Len = input(50, minval=1, title="EMA50_Length") //EMA50_src = input(close, title="EMA50_Source") //EMA50_offset = input(title="EMA50_Offset", type=input.integer, defval=0, minval=-500, maxval=500) EMA50_out = ema(close, EMA50_Len) plot(showEMA50 ? EMA50_out:na, title="EMA50", color=color.fuchsia, offset=0) EMA100_Len = input(100, minval=1, title="EMA100_Length") //EMA100_src = input(close, title="EMA100_Source") //EMA100_offset = input(title="EMA100_Offset", type=input.integer, defval=0, minval=-500, maxval=500) EMA100_out = ema(close, EMA100_Len) plot(showEMA100 ? EMA100_out:na, title="EMA100", color=color.aqua, offset=0) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////// SMA - 9/20/50/100 /////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// SMA9_Len = input(9, minval=1, title="SMA9_Length") //SMA9_src = input(close, title="SMA9_Source") //SMA9_offset = input(title="SMA9_Offset", type=input.integer, defval=0, minval=-500, maxval=500) SMA9_out = sma(close, SMA9_Len) plot(showSMA9 ? SMA9_out:na, title="SMA9", color=color.green, offset=0) SMA20_Len = input(20, minval=1, title="SMA20_Length") //SMA20_src = input(close, title="SMA20_Source") //SMA20_offset = input(title="SMA20_Offset", type=input.integer, defval=0, minval=-500, maxval=500) SMA20_out = sma(close, SMA20_Len) plot(showSMA20 ? SMA20_out:na, title="SMA20", color=color.red, offset=0) SMA50_Len = input(50, minval=1, title="SMA50_Length") //SMA50_src = input(close, title="SMA50_Source") //SMA50_offset = input(title="SMA50_Offset", type=input.integer, defval=0, minval=-500, maxval=500) SMA50_out = sma(close, SMA50_Len) plot(showSMA50 ? SMA50_out:na, title="SMA50", color=color.olive, offset=0) SMA100_Len = input(100, minval=1, title="SMA100_Length") //SMA100_src = input(close, title="SMA100_Source") //SMA100_offset = input(title="SMA100_Offset", type=input.integer, defval=0, minval=-500, maxval=500) SMA100_out = sma(close, SMA100_Len) plot(showSMA100 ? SMA100_out:na, title="SMA100", color=color.maroon, offset=0) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////// WMA - 9/20/50/100 /////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// wMA9_Len = input(9, minval=1, title="wMA9_Length") //wMA9_src = input(close, title="wMA9_Source") //wMA9_offset = input(title="wMA9_Offset", type=input.integer, defval=0, minval=-500, maxval=500) wMA9_out = wma(close, wMA9_Len) plot(showwMA9 ? wMA9_out:na, title="wMA9", color=color.navy, offset=0) wMA20_Len = input(20, minval=1, title="wMA20_Length") //wMA20_src = input(close, title="wMA20_Source") //wMA20_offset = input(title="wMA20_Offset", type=input.integer, defval=0, minval=-500, maxval=500) wMA20_out = wma(close, wMA20_Len) plot(showwMA20 ? wMA20_out:na, title="wMA20", color=color.olive, offset=0) wMA50_Len = input(50, minval=1, title="wMA50_Length") //wMA50_src = input(close, title="wMA50_Source") //wMA50_offset = input(title="wMA50_Offset", type=input.integer, defval=0, minval=-500, maxval=500) wMA50_out = wma(close, wMA50_Len) plot(showwMA50 ? wMA50_out:na, title="wMA50", color=color.purple, offset=0) wMA100_Len = input(100, minval=1, title="wMA100_Length") //wMA100_src = input(close, title="wMA100_Source") //wMA100_offset = input(title="wMA100_Offset", type=input.integer, defval=0, minval=-500, maxval=500) wMA100_out = wma(close, wMA100_Len) plot(showwMA100 ? wMA100_out:na, title="wMA100", color=color.gray, offset=0) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////// VWAP ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //vwaplength = input(title="VWAP Length", type=input.integer, defval=1) //cvwap = ema(vwap,vwaplength) cvwap1 = vwap(hlc3) plotvwap = plot(showVWAP ? cvwap1 : na,title="VWAP",color=color.black, transp=0, linewidth=2) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////// VWMA ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// vwma_length = 20 //input(title="VWMA Length", type=input.integer, defval=1) vwma_1 = vwma(close,vwma_length) plotvwma = plot(showVWMA ? vwma_1 : na, title="VWMA", color=color.blue, transp=0, linewidth=2) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////// PARABOLIC SAR ////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// start = 0.02 //input(0.02) increment = 0.02 //input(0.02) maximum = 0.2 //input(0.2, "Max Value") psar_out = sar(start, increment, maximum) plot(showPSAR ? psar_out : na, "ParabolicSAR", style=plot.style_cross, color=#2196f3) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////// BOLLINGER BAND//////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// length = 20 //input(20, minval=1) src = close //input(close, title="BB_Source") mult = 2 //input(2.0, minval=0.001, maxval=50, title="BB_StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev p1 = plot(showBB ? upper : na, "Upper", color=color.teal, editable=false) p2 = plot(showBB ? lower: na, "Lower", color=color.teal, editable=false) plot(showBB ? basis : na, "Basis", color=#872323, editable=false) fill(p1, p2, title = "Background", color=#198787, transp=95) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////// CENTRAL PIVOT RANGE (CPR) ////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// res = input(title="Resolution", type=input.resolution, defval="D") res1 = input(title="Resolution", type=input.resolution, defval="W") res2 = input(title="Resolution", type=input.resolution, defval="M") H = security(syminfo.tickerid, res, high[1], barmerge.gaps_off, barmerge.lookahead_on) L = security(syminfo.tickerid, res, low[1], barmerge.gaps_off, barmerge.lookahead_on) C = security(syminfo.tickerid, res, close[1], barmerge.gaps_off, barmerge.lookahead_on) WH = security(syminfo.tickerid, res1, high[1], barmerge.gaps_off, barmerge.lookahead_on) WL = security(syminfo.tickerid, res1, low[1], barmerge.gaps_off, barmerge.lookahead_on) WC = security(syminfo.tickerid, res1, close[1], barmerge.gaps_off, barmerge.lookahead_on) MH = security(syminfo.tickerid, res2, high[1], barmerge.gaps_off, barmerge.lookahead_on) ML = security(syminfo.tickerid, res2, low[1], barmerge.gaps_off, barmerge.lookahead_on) MC = security(syminfo.tickerid, res2, close[1], barmerge.gaps_off, barmerge.lookahead_on) TTH = security(syminfo.tickerid, res, high, barmerge.gaps_off, barmerge.lookahead_on) TTL = security(syminfo.tickerid, res, low, barmerge.gaps_off, barmerge.lookahead_on) TTC = security(syminfo.tickerid, res, close, barmerge.gaps_off, barmerge.lookahead_on) PP = (H + L + C) / 3 TC = (H + L)/2 BC = (PP - TC) + PP R1 = (PP * 2) - L R2 = PP + (H - L) R3 = H + 2*(PP - L) R4 = PP * 3 + (H - 3 * L) S1 = (PP * 2) - H S2 = PP - (H - L) S3 = L - 2*(H - PP) S4 = PP*3 - (3*H - L) WPP = (WH + WL + WC)/3 WTC = (WH + WL)/2 WBC = (WPP - WTC) + WPP MPP = (MH + ML + MC)/3 MTC = (MH + ML)/2 MBC = (MPP - MTC) + MPP TOPP = (TTH + TTL + TTC)/3 TOTC = (TTH + TTL)/2 TOBC = (TOPP - TOTC) + TOPP TR1 = (TOPP * 2) - TTL TR2 = TOPP + (TTH - TTL) TS1 = (TOPP * 2) - TTH TS2 = TOPP - (TTH - TTL) plot(showpivot ? PP : na, title="PP", style=plot.style_circles, color=color.orange, linewidth=2) plot(showpivot ? TC : na, title="TC", style=plot.style_circles, color=color.blue, linewidth=2) plot(showpivot ? BC : na, title="BC", style=plot.style_circles, color=color.blue, linewidth=2) plot(showpivot ? WPP : na, title="WPP", style=plot.style_stepline, color=color.black, linewidth=2) plot(showpivot ? WTC : na, title="WTC", style=plot.style_stepline, color=color.black, linewidth=2) plot(showpivot ? WBC : na, title="WBC", style=plot.style_stepline, color=color.black, linewidth=2) plot(showpivot ? MPP : na, title="MPP", style=plot.style_stepline, color=color.black, linewidth=3) plot(showpivot ? MTC : na, title="MTC", style=plot.style_stepline, color=color.black, linewidth=3) plot(showpivot ? MBC : na, title="MBC", style=plot.style_stepline, color=color.black, linewidth=3) plot(showpivot ? S1 : na, title="S1", style=plot.style_stepline, color=color.black, linewidth=1) plot(showpivot ? S2 : na, title="S2", style=plot.style_stepline, color=color.black, linewidth=1) plot(showpivot ? S3 : na, title="S3", style=plot.style_stepline, color=color.black, linewidth=1) plot(showpivot ? S4 : na, title="S4", style=plot.style_stepline, color=color.black, linewidth=1) plot(showpivot ? R1 : na, title="R1", style=plot.style_stepline, color=color.black, linewidth=1) plot(showpivot ? R2 : na, title="R2", style=plot.style_stepline, color=color.black, linewidth=1) plot(showpivot ? R3 : na, title="R3", style=plot.style_stepline, color=color.black, linewidth=1) plot(showpivot ? R4 : na, title="R4", style=plot.style_stepline, color=color.black, linewidth=1) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////// PREVIOUS DAY ///////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// prevDayHigh = security(syminfo.tickerid, 'D', high[1], lookahead=true) prevDayLow = security(syminfo.tickerid, 'D', low[1], lookahead=true) plot( showpivot and prevDayHigh ? prevDayHigh : na, title="Prev Day High", style=plot.style_stepline, linewidth=1, color=color.red, transp=0) plot( showpivot and prevDayLow ? prevDayLow : na, title="Prev Day Low", style=plot.style_stepline, linewidth=1, color=color.green, transp=0) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////// PREVIOUS WEEKLY /////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// prevWeekHigh = security(syminfo.tickerid, 'W', high[1], lookahead=true) prevWeekLow = security(syminfo.tickerid, 'W', low[1], lookahead=true) plot( showpivot and prevWeekHigh ? prevWeekHigh : na, title="Prev Week High", style=plot.style_stepline, linewidth=2, color=color.red, transp=0) plot( showpivot and prevWeekLow ? prevWeekLow : na, title="Prev Week Low", style=plot.style_stepline, linewidth=2, color=color.green, transp=0) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////// PREVIOUS MONTH ///////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// prevMonthHigh = security(syminfo.tickerid, 'M', high[1], lookahead=true) prevMonthLow = security(syminfo.tickerid, 'M', low[1], lookahead=true) plot( showpivot and prevMonthHigh ? prevMonthHigh : na, title="Prev Month High", style=plot.style_stepline, linewidth=3, color=color.red, transp=0) plot( showpivot and prevMonthLow ? prevMonthLow : na, title="Prev Month Low", style=plot.style_stepline, linewidth=3, color=color.green, transp=0) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////// NOT NECESSARY ////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // colours for the chart //col0 = #6666ff //col1 = #ebdc87 //col2 = #ffa36c //col3 = #d54062 //colD = #799351 //plotF = input(defval=false, title="Plot 0.236", type=input.bool) //supp0 = (PP - (0.236 * (H - L))) //supp1 = (PP - (0.382 * (H - L))) //supp2 = (PP - (0.618 * (H - L))) //supp3 = (PP - (1 * (H - L))) //res0 = (PP + (0.236 * (H - L))) //res01 = (PP + (0.382 * (H - L))) //res02 = (PP + (0.618 * (H - L))) //res03 = (PP + (1 * (H - L))) //plot(plotF ? supp0 : na, title="0.236", style=plot.style_stepline, color=color.orange , linewidth=1) //plot(plotF ? res0 : na, title="0.236", style=plot.style_stepline, color=color.orange, linewidth=1)
CaraDePoni
https://www.tradingview.com/script/lH6j2NtF/
crynver
https://www.tradingview.com/u/crynver/
0
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © crynver //@version=5 indicator("CaraDePoni", overlay=true) Media6 = ta.ema(close,6) Media21 = ta.ema(close,21) Media200 = ta.ema(close,200) plot(Media6, color=color.white) plot(Media21, color=color.yellow) plot(Media200, color=color.red)
Stochastic Slow and OBV Percent Oscillator
https://www.tradingview.com/script/qLsa6LW3-Stochastic-Slow-and-OBV-Percent-Oscillator/
Bhangerang
https://www.tradingview.com/u/Bhangerang/
117
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Bhangerang //@version=5 indicator("Stochastic Slow & OBV") // Setting Inputs crypto_mode = input.bool(false) sto1 = input.int(12, "%K Length", minval=1) sto2 = input.int(5, "%K Smoothing", minval=1) sto3 = input.int(5, "%D Smoothing", minval=1) sto4 = input.int(12, "OBV Stochastic Slow %K Length", minval=1) sto5 = input.int(5, "OBV Stochastic Slow %K Smoothing", minval=1) obv_period = input.int(380, "OBV Period", minval=1) obv_signal = input.int(5, "OBV Signal Line Period", minval=1) obv = ta.obv // Functions to Use StochSlow(period1, period2) => // Declare variables float numerator = 0 float denominator = 0 // Loop for i = 0 to (period2 - 1) numerator += close[i] - ta.lowest(low, period1)[i] denominator += ta.highest(high, period1)[i] - ta.lowest(low, period1)[i] // Return numerator/denominator OBV_Stochastic_Slow(period1, period2) => // Declare variables float numerator = 0 float denominator = 0 // Loop for i = 0 to (period2 - 1) numerator += obv[i] - ta.lowest(obv, period1)[i] denominator += ta.highest(obv, period1)[i] - ta.lowest(obv, period1)[i] // Return numerator/denominator // Values OBV = ((obv - ta.lowest(obv, obv_period))/(ta.highest(obv, obv_period) - ta.lowest(obv, obv_period))) * 100 OBV_slow = OBV_Stochastic_Slow(sto4, sto5)*100 toggled_obv = crypto_mode ? OBV_slow : OBV signal = ta.sma(toggled_obv, obv_signal) k = StochSlow(sto1, sto2)*100 d = ta.ema(k, sto3) // Plot plot(k, "%K", color=color.orange) plot(d, "%D", color=color.blue) h0 = hline(80, "Upper Band") h1 = hline(50, "Middle Band", color=color.gray) h2 = hline(20, "Lower Band") plot(toggled_obv, "OBV", color=color.purple) plot(signal, "Signal", color=color.red) // Plot dots plot(d, "Momentum Dot", (k-d) > 0 ? color.lime : ((k-d) < 0 ? color.red : color.gray), style=plot.style_circles, linewidth=2) plot(signal, "OBV Dot", (toggled_obv-signal) > 0 ? color.white : ((toggled_obv-signal) < 0 ? color.gray : color.black), style=plot.style_circles, linewidth=2)
Badlo
https://www.tradingview.com/script/CJjcRORk-Badlo/
ktgnaidu
https://www.tradingview.com/u/ktgnaidu/
8
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © bensonsuntw // updation inspired by Morty //@version=4 study("Badlo") s1 = input(title="pair1",type=input.symbol,defval="NSE:NIFTY1!") s2 = input(title="pair2",type=input.symbol,defval="NSE:BANKNIFTY1!") f() => [open,high,low,close] [o1,h1,l1,c1]=security(s1,timeframe.period,f()) [o2,h2,l2,c2]=security(s2,timeframe.period,f()) plotcandle((o2/2-o1)*2, (h2/2-h1)*2, (l2/2-l1)*2, (c2/2-c1)*2,color = (o2/2-o1)*2< (c2/2-c1)*2? color.green : color.red, wickcolor=color.black)
Triple Weekly Moving Average
https://www.tradingview.com/script/axGwxvDS-Triple-Weekly-Moving-Average/
emkjee
https://www.tradingview.com/u/emkjee/
21
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © emkjee // references: // 1. TradingView std ma script //@version=5 indicator(title="Triple Weekly Moving Average", shorttitle="3WMA", overlay=true, timeframe="", timeframe_gaps=true) ma_len1 = input.int(13, minval=1, title="First MA Length ", group="MA Settings") ma_len2 = input.int(26, minval=1, title="Second MA Length", group="MA Settings") ma_len3 = input.int(52, minval=1, title="Third MA Length ", group="MA Settings") ma_source = input(close, title="Source", group="MA Settings") ma_type1 = input.string(defval = "SMA", title="Method", group="MA Settings", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"]) ma_type2 = input.string(defval = "SMA", title="Method", group="MA Settings", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"]) ma_type3 = input.string(defval = "SMA", title="Method", group="MA Settings", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"]) ma_lookahead = input.bool(false, title="Lookahead on or off", group="MA Settings") ma_calc(source, length, type) => switch type "SMA" => ta.sma (source, length) "EMA" => ta.ema (source, length) "SMMA (RMA)" => ta.rma (source, length) "WMA" => ta.wma (source, length) "VWMA" => ta.vwma(source, length) ma_1 = request.security(syminfo.tickerid, "W", ma_calc(ma_source, ma_len1, ma_type1), lookahead=ma_lookahead ? barmerge.lookahead_on : barmerge.lookahead_off) ma_2 = request.security(syminfo.tickerid, "W", ma_calc(ma_source, ma_len2, ma_type2), lookahead=ma_lookahead ? barmerge.lookahead_on : barmerge.lookahead_off) ma_3 = request.security(syminfo.tickerid, "W", ma_calc(ma_source, ma_len3, ma_type3), lookahead=ma_lookahead ? barmerge.lookahead_on : barmerge.lookahead_off) firstma = plot(ma_1, color=color.red, title="1MA", linewidth=1) secondma = plot(ma_2, color=color.green, title="2MA", linewidth=1) thirdma = plot(ma_3, color=color.blue, title="3MA", linewidth=2) fill(firstma, secondma, color = (timeframe.isweekly) ? ma_1 >= ma_2 ? color.new(#AAF0D1, 60) : color.new(#FFE4E1,60) : na, title="MA12 Background Fill", fillgaps=true) fill(secondma, thirdma, color = (timeframe.isweekly) ? ma_2 >= ma_3 ? color.new(#A1CAF1, 60) : color.new(#FAF0BE,60) : na, title="MA23 Background Fill", fillgaps=true)
Smoothed RSI Heikin Ashi Oscillator w/ Expanded Types [Loxx]
https://www.tradingview.com/script/x5T1cMeA-Smoothed-RSI-Heikin-Ashi-Oscillator-w-Expanded-Types-Loxx/
loxx
https://www.tradingview.com/u/loxx/
364
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 //@description=This is the spin off of @author=JayRogers's "Heikin-Ashi RSI Oscillator" found here: https://www.tradingview.com/script/1o4oWbEx-Heikin-Ashi-RSI-Oscillator/ indicator("Smoothed RSI Heikin-Ashi Oscillator w/ Expanded Types [Loxx]", shorttitle="SRSIHAOET [Loxx]", overlay = false, timeframe="", timeframe_gaps = true) import loxx/loxxexpandedsourcetypes/3 import loxx/loxxmas/1 greencolor = #2DD204 redcolor = #D2042D smthtype = input.string("Kaufman", "RSI Source, HA Better Smoothing", options = ["AMA", "T3", "Kaufman"], group = "RSI Settings") srcoption = input.string("HAB Weighted", "RSI Source", group= "RSI Settings", options = ["Close", "Open", "High", "Low", "Median", "Typical", "Weighted", "Average", "Average Median Body", "Trend Biased", "Trend Biased (Extreme)", "HA Close", "HA Open", "HA High", "HA Low", "HA Median", "HA Typical", "HA Weighted", "HA Average", "HA Average Median Body", "HA Trend Biased", "HA Trend Biased (Extreme)", "HAB Close", "HAB Open", "HAB High", "HAB Low", "HAB Median", "HAB Typical", "HAB Weighted", "HAB Average", "HAB Average Median Body", "HAB Trend Biased", "HAB Trend Biased (Extreme)"]) rsiper = input.int(7, "RSI Period", group = "RSI Settings") typersi = input.string("Exponential Moving Average - EMA", "RSI Smoothing Type", options = ["ADXvma - Average Directional Volatility Moving Average", "Ahrens Moving Average" , "Alexander Moving Average - ALXMA", "Double Exponential Moving Average - DEMA", "Double Smoothed Exponential Moving Average - DSEMA" , "Exponential Moving Average - EMA", "Fast Exponential Moving Average - FEMA", "Fractal Adaptive Moving Average - FRAMA" , "Hull Moving Average - HMA", "IE/2 - Early T3 by Tim Tilson", "Integral of Linear Regression Slope - ILRS" , "Instantaneous Trendline", "Laguerre Filter", "Leader Exponential Moving Average", "Linear Regression Value - LSMA (Least Squares Moving Average)" , "Linear Weighted Moving Average - LWMA", "McGinley Dynamic", "McNicholl EMA", "Non-Lag Moving Average", "Parabolic Weighted Moving Average" , "Recursive Moving Trendline", "Simple Moving Average - SMA", "Sine Weighted Moving Average", "Smoothed Moving Average - SMMA" , "Smoother", "Super Smoother", "Three-pole Ehlers Butterworth", "Three-pole Ehlers Smoother" , "Triangular Moving Average - TMA", "Triple Exponential Moving Average - TEMA", "Two-pole Ehlers Butterworth", "Two-pole Ehlers smoother" , "Volume Weighted EMA - VEMA", "Zero-Lag DEMA - Zero Lag Double Exponential Moving Average", "Zero-Lag Moving Average" , "Zero Lag TEMA - Zero Lag Triple Exponential Moving Average"], group = "RSI Settings") smthlen = input.int(1, "RSI Smoothing Period", group = "RSI Settings") type = input.string("Linear Weighted Moving Average - LWMA", "MACD MA Type", options = ["ADXvma - Average Directional Volatility Moving Average", "Ahrens Moving Average" , "Alexander Moving Average - ALXMA", "Double Exponential Moving Average - DEMA", "Double Smoothed Exponential Moving Average - DSEMA" , "Exponential Moving Average - EMA", "Fast Exponential Moving Average - FEMA", "Fractal Adaptive Moving Average - FRAMA" , "Hull Moving Average - HMA", "IE/2 - Early T3 by Tim Tilson", "Integral of Linear Regression Slope - ILRS" , "Instantaneous Trendline", "Laguerre Filter", "Leader Exponential Moving Average", "Linear Regression Value - LSMA (Least Squares Moving Average)" , "Linear Weighted Moving Average - LWMA", "McGinley Dynamic", "McNicholl EMA", "Non-Lag Moving Average", "Parabolic Weighted Moving Average" , "Recursive Moving Trendline", "Simple Moving Average - SMA", "Sine Weighted Moving Average", "Smoothed Moving Average - SMMA" , "Smoother", "Super Smoother", "Three-pole Ehlers Butterworth", "Three-pole Ehlers Smoother" , "Triangular Moving Average - TMA", "Triple Exponential Moving Average - TEMA", "Two-pole Ehlers Butterworth", "Two-pole Ehlers smoother" , "Volume Weighted EMA - VEMA", "Zero-Lag DEMA - Zero Lag Double Exponential Moving Average", "Zero-Lag Moving Average" , "Zero Lag TEMA - Zero Lag Triple Exponential Moving Average"], group = "Heikin-Ashi Settings") haper = input.int(14, "Heikin-Ashi RSI Period", group= "Heikin-Ashi Settings") hamsthper = input.int(5, "Heikin-Ashi Candles Smoothing Period", group= "Heikin-Ashi Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") showrsi = input.bool(true, "Show RSI?", group = "UI Options") frama_FC = input.int(defval=1, title="* Fractal Adjusted (FRAMA) Only - FC", group = "Moving Average Inputs") frama_SC = input.int(defval=200, title="* Fractal Adjusted (FRAMA) Only - SC", group = "Moving Average Inputs") instantaneous_alpha = input.float(defval=0.07, minval = 0, title="* Instantaneous Trendline (INSTANT) Only - Alpha", group = "Moving Average Inputs") _laguerre_alpha = input.float(title="* Laguerre Filter (LF) Only - Alpha", minval=0, maxval=1, step=0.1, defval=0.7, group = "Moving Average Inputs") lsma_offset = input.int(defval=0, title="* Least Squares Moving Average (LSMA) Only - Offset", group = "Moving Average Inputs") _pwma_pwr = input.int(2, "* Parabolic Weighted Moving Average (PWMA) Only - Power", minval=0, group = "Moving Average Inputs") kfl=input.float(0.666, title="* Kaufman's Adaptive MA (KAMA) Only - Fast End", group = "Moving Average Inputs") ksl=input.float(0.0645, title="* Kaufman's Adaptive MA (KAMA) Only - Slow End", group = "Moving Average Inputs") amafl = input.int(2, title="* Adaptive Moving Average (AMA) Only - Fast", group = "Moving Average Inputs") amasl = input.int(30, title="* Adaptive Moving Average (AMA) Only - Slow", group = "Moving Average Inputs") haclose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) haopen = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open) hahigh = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high) halow = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low) hamedian = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hl2) hatypical = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlc3) haweighted = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlcc4) haaverage = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, ohlc4) src = switch srcoption "Close" => loxxexpandedsourcetypes.rclose() "Open" => loxxexpandedsourcetypes.ropen() "High" => loxxexpandedsourcetypes.rhigh() "Low" => loxxexpandedsourcetypes.rlow() "Median" => loxxexpandedsourcetypes.rmedian() "Typical" => loxxexpandedsourcetypes.rtypical() "Weighted" => loxxexpandedsourcetypes.rweighted() "Average" => loxxexpandedsourcetypes.raverage() "Average Median Body" => loxxexpandedsourcetypes.ravemedbody() "Trend Biased" => loxxexpandedsourcetypes.rtrendb() "Trend Biased (Extreme)" => loxxexpandedsourcetypes.rtrendbext() "HA Close" => loxxexpandedsourcetypes.haclose(haclose) "HA Open" => loxxexpandedsourcetypes.haopen(haopen) "HA High" => loxxexpandedsourcetypes.hahigh(hahigh) "HA Low" => loxxexpandedsourcetypes.halow(halow) "HA Median" => loxxexpandedsourcetypes.hamedian(hamedian) "HA Typical" => loxxexpandedsourcetypes.hatypical(hatypical) "HA Weighted" => loxxexpandedsourcetypes.haweighted(haweighted) "HA Average" => loxxexpandedsourcetypes.haaverage(haaverage) "HA Average Median Body" => loxxexpandedsourcetypes.haavemedbody(haclose, haopen) "HA Trend Biased" => loxxexpandedsourcetypes.hatrendb(haclose, haopen, hahigh, halow) "HA Trend Biased (Extreme)" => loxxexpandedsourcetypes.hatrendbext(haclose, haopen, hahigh, halow) "HAB Close" => loxxexpandedsourcetypes.habclose(smthtype, amafl, amasl, kfl, ksl) "HAB Open" => loxxexpandedsourcetypes.habopen(smthtype, amafl, amasl, kfl, ksl) "HAB High" => loxxexpandedsourcetypes.habhigh(smthtype, amafl, amasl, kfl, ksl) "HAB Low" => loxxexpandedsourcetypes.hablow(smthtype, amafl, amasl, kfl, ksl) "HAB Median" => loxxexpandedsourcetypes.habmedian(smthtype, amafl, amasl, kfl, ksl) "HAB Typical" => loxxexpandedsourcetypes.habtypical(smthtype, amafl, amasl, kfl, ksl) "HAB Weighted" => loxxexpandedsourcetypes.habweighted(smthtype, amafl, amasl, kfl, ksl) "HAB Average" => loxxexpandedsourcetypes.habaverage(smthtype, amafl, amasl, kfl, ksl) "HAB Average Median Body" => loxxexpandedsourcetypes.habavemedbody(smthtype, amafl, amasl, kfl, ksl) "HAB Trend Biased" => loxxexpandedsourcetypes.habtrendb(smthtype, amafl, amasl, kfl, ksl) "HAB Trend Biased (Extreme)" => loxxexpandedsourcetypes.habtrendbext(smthtype, amafl, amasl, kfl, ksl) => haclose variant(type, src, len) => sig = 0.0 trig = 0.0 special = false if type == "ADXvma - Average Directional Volatility Moving Average" [t, s, b] = loxxmas.adxvma(src, len) sig := s trig := t special := b else if type == "Ahrens Moving Average" [t, s, b] = loxxmas.ahrma(src, len) sig := s trig := t special := b else if type == "Alexander Moving Average - ALXMA" [t, s, b] = loxxmas.alxma(src, len) sig := s trig := t special := b else if type == "Double Exponential Moving Average - DEMA" [t, s, b] = loxxmas.dema(src, len) sig := s trig := t special := b else if type == "Double Smoothed Exponential Moving Average - DSEMA" [t, s, b] = loxxmas.dsema(src, len) sig := s trig := t special := b else if type == "Exponential Moving Average - EMA" [t, s, b] = loxxmas.ema(src, len) sig := s trig := t special := b else if type == "Fast Exponential Moving Average - FEMA" [t, s, b] = loxxmas.fema(src, len) sig := s trig := t special := b else if type == "Fractal Adaptive Moving Average - FRAMA" [t, s, b] = loxxmas.frama(src, len, frama_FC, frama_SC) sig := s trig := t special := b else if type == "Hull Moving Average - HMA" [t, s, b] = loxxmas.hma(src, len) sig := s trig := t special := b else if type == "IE/2 - Early T3 by Tim Tilson" [t, s, b] = loxxmas.ie2(src, len) sig := s trig := t special := b else if type == "Integral of Linear Regression Slope - ILRS" [t, s, b] = loxxmas.ilrs(src, len) sig := s trig := t special := b else if type == "Instantaneous Trendline" [t, s, b] = loxxmas.instant(src, instantaneous_alpha) sig := s trig := t special := b else if type == "Laguerre Filter" [t, s, b] = loxxmas.laguerre(src, _laguerre_alpha) sig := s trig := t special := b else if type == "Leader Exponential Moving Average" [t, s, b] = loxxmas.leader(src, len) sig := s trig := t special := b else if type == "Linear Regression Value - LSMA (Least Squares Moving Average)" [t, s, b] = loxxmas.lsma(src, len, lsma_offset) sig := s trig := t special := b else if type == "Linear Weighted Moving Average - LWMA" [t, s, b] = loxxmas.lwma(src, len) sig := s trig := t special := b else if type == "McGinley Dynamic" [t, s, b] = loxxmas.mcginley(src, len) sig := s trig := t special := b else if type == "McNicholl EMA" [t, s, b] = loxxmas.mcNicholl(src, len) sig := s trig := t special := b else if type == "Non-Lag Moving Average" [t, s, b] = loxxmas.nonlagma(src, len) sig := s trig := t special := b else if type == "Parabolic Weighted Moving Average" [t, s, b] = loxxmas.pwma(src, len, _pwma_pwr) sig := s trig := t special := b else if type == "Recursive Moving Trendline" [t, s, b] = loxxmas.rmta(src, len) sig := s trig := t special := b else if type == "Simple Moving Average - SMA" [t, s, b] = loxxmas.sma(src, len) sig := s trig := t special := b else if type == "Sine Weighted Moving Average" [t, s, b] = loxxmas.swma(src, len) sig := s trig := t special := b else if type == "Smoothed Moving Average - SMMA" [t, s, b] = loxxmas.smma(src, len) sig := s trig := t special := b else if type == "Smoother" [t, s, b] = loxxmas.smoother(src, len) sig := s trig := t special := b else if type == "Super Smoother" [t, s, b] = loxxmas.super(src, len) sig := s trig := t special := b else if type == "Three-pole Ehlers Butterworth" [t, s, b] = loxxmas.threepolebuttfilt(src, len) sig := s trig := t special := b else if type == "Three-pole Ehlers Smoother" [t, s, b] = loxxmas.threepolesss(src, len) sig := s trig := t special := b else if type == "Triangular Moving Average - TMA" [t, s, b] = loxxmas.tma(src, len) sig := s trig := t special := b else if type == "Triple Exponential Moving Average - TEMA" [t, s, b] = loxxmas.tema(src, len) sig := s trig := t special := b else if type == "Two-pole Ehlers Butterworth" [t, s, b] = loxxmas.twopolebutter(src, len) sig := s trig := t special := b else if type == "Two-pole Ehlers smoother" [t, s, b] = loxxmas.twopoless(src, len) sig := s trig := t special := b else if type == "Volume Weighted EMA - VEMA" [t, s, b] = loxxmas.vwema(src, len) sig := s trig := t special := b else if type == "Zero-Lag DEMA - Zero Lag Double Exponential Moving Average" [t, s, b] = loxxmas.zlagdema(src, len) sig := s trig := t special := b else if type == "Zero-Lag Moving Average" [t, s, b] = loxxmas.zlagma(src, len) sig := s trig := t special := b else if type == "Zero Lag TEMA - Zero Lag Triple Exponential Moving Average" [t, s, b] = loxxmas.zlagtema(src, len) sig := s trig := t special := b trig //thanks to @author=JayRogers for the base, modded by myself, @loxx _zrsi(src, per) => ta.rsi(src, per) - 50 //thanks to @author=JayRogers for the base, modded by myself, @loxx _rsi(_source, per) => zrsi = _zrsi(_source, per) smth = variant(typersi, zrsi, smthlen) smth //thanks to @author=JayRogers for the base, modded by myself, @loxx _rsiHeikinAshi(per, smthper) => clsRSI = _zrsi(close, per) opnRSI = nz(clsRSI[1], clsRSI) hiRSIraw = _zrsi(high, per) loRSIraw = _zrsi(low, per) hiRSI = math.max(hiRSIraw, loRSIraw) loRSI = math.min(hiRSIraw, loRSIraw) cls = (opnRSI + hiRSI + loRSI + clsRSI) / 4 opn = 0. opn := na(opn[1]) ? (opnRSI + clsRSI) / 2 : (opn[1] + cls[1]) / 2 hi = math.max(hiRSI, math.max(opn, cls)) lo = math.min(loRSI, math.min(opn, cls)) opn := variant(type, opn, smthper) hi := variant(type, hi, smthper) lo := variant(type, lo, smthper) cls := variant(type, cls, smthper) [opn, hi, lo, cls] rsiout = _rsi(src, rsiper) [opn, hi, lo, cls] = _rsiHeikinAshi(haper, hamsthper) colorout = cls > opn ? greencolor : redcolor middle = 0 plot(middle, color = bar_index % 2 ? color.gray : na) plotcandle(opn, hi, lo, cls, "HARSI", colorout, colorout, bordercolor=colorout) plot(showrsi ? rsiout : na, "RSI", color = color.white) barcolor(colorbars ? colorout : na) goLong = colorout == greencolor and nz(colorout[1]) == redcolor goShort = colorout == redcolor and nz(colorout[1]) == greencolor plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="Smoothed RSI Heikin-Ashi Oscillator w/ Expanded Types [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="Smoothed RSI Heikin-Ashi Oscillator w/ Expanded Types [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
Larry Williams Proxy Index (LWPI) [Loxx]
https://www.tradingview.com/script/79npN017-Larry-Williams-Proxy-Index-LWPI-Loxx/
loxx
https://www.tradingview.com/u/loxx/
125
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Larry Williams Proxy Index (LWPI) [Loxx]", shorttitle="LWPI [Loxx]", overlay = false, timeframe="", timeframe_gaps = true) greencolor = #2DD204 redcolor = #D2042D variant(type, src, len) => sig = 0.0 if type == "SMA" sig := ta.sma(src, len) else if type == "EMA" sig := ta.ema(src, len) else if type == "WMA" sig := ta.wma(src, len) else if type == "RMA" sig := ta.rma(src, len) sig per = input.int(8, "Period", group = "Basic Settings") smthit = input.bool(false, "Smooth LWPI?", group = "Basic Settings") type = input.string("SMA", "Smoothing Type", options = ["EMA", "WMA", "RMA", "SMA"], group = "BasicR Settings") smthper = input.int(5, "Smoothing Period", group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") ma = ta.sma(open - close, per) atr = ta.atr(per) out = 50*ma/atr+50 out := smthit ? variant(type, out, smthper) : out colorout = out < 50 ? greencolor : redcolor plot(out, color = colorout, linewidth = 2) barcolor(colorbars ? colorout : na) middle = 50 plot(middle, color = bar_index % 2 ? color.gray : na) goLong = ta.crossunder(out, middle) goShort = ta.crossover(out, middle) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="Larry Williams Proxy Index (LWPI) [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="Larry Williams Proxy Index (LWPI) [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
Market Sessions(4sessions)
https://www.tradingview.com/script/Apq0cjwf-market-sessions-4sessions/
maksimkantemir5
https://www.tradingview.com/u/maksimkantemir5/
124
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © boitoki //@version=5 indicator('FX Market Sessions', overlay=true, max_boxes_count=500, max_labels_count=500, max_lines_count=500, max_bars_back=1000) import boitoki/AwesomeColor/4 as ac /////////////// // Groups /////////////// g0 = '𐋉𐊤𐑿𐊤𐊯𐋎𐑖Ⴝ' g1 = '♯1 Ⴝ𐊤ႽႽ𐊦Θ𐑿' g2 = '♯2 Ⴝ𐊤ႽႽ𐊦Θ𐑿' g3 = '♯3 Ⴝ𐊤ႽႽ𐊦Θ𐑿' g4 = '𐌱Θ𐋂' g6 = '𐑖𐋎𐌱𐊤𐑖Ⴝ' g5 = 'ΘϷ𐊤𐑿𐊦𐑿𐋉 𐊯𐋎𐑿𐋉𐊤' g7 = '𐊥𐊦𐌱Θ𐑿𐋎𐊢𐊢𐊦 𐑖𐊤𐌱𐊤𐑖Ⴝ' g8 = 'ΘϷ𐨝𐊦Θ𐑿Ⴝ' g10 = 'ΘႽ𐊢𐊦𐑖𐑖𐋎𐨝Θ𐊯 𐊰Θᱚ𐊤' g11 = '𐊢𐋎𐑿ᱚ𐑖𐊤' g12 = '♯4 Ⴝ𐊤ႽႽ𐊦Θ𐑿' /////////////// // Defined /////////////// show = true pips = syminfo.mintick * 10 max_bars = 500 option_yes = 'Yes' option_no = '× No' option_extend1 = 'Extend' option_hide = '× Hide' fmt_price = '{0,number,#.#####}' fmt_pips = '{0,number,#.#}' icon_separator = ' • ' c_none = color.new(color.black, 100) is_weekends = dayofweek == 7 or dayofweek == 1 /////////////// // Functions /////////////// f_get_time_by_bar(bar_count) => timeframe.multiplier * bar_count * 60 * 1000 f_get_period (_session, _start, _lookback) => result = math.max(_start, 1) for i = result to _lookback if na(_session[i+1]) and _session[i] result := i+1 break result f_get_label_position (_y, _side) => switch _y 'top' => _side == 'outside' ? label.style_label_lower_left : label.style_label_upper_left 'bottom' => _side == 'outside' ? label.style_label_upper_left : label.style_label_lower_left f_get_day (n) => switch n 1 => 'Sun' 2 => 'Mon' 3 => 'Tue' 4 => 'Wed' 5 => 'Thu' 6 => 'Fri' 7 => 'Sat' f_get_started (_session) => na(_session[1]) and _session f_get_ended (_session) => na(_session) and _session[1] /////////////// // Inputs /////////////// // Timezone i_tz = input.string('GMT+1', title='Timezone', options=['GMT-11', 'GMT-10', 'GMT-9', 'GMT-8', 'GMT-7', 'GMT-6', 'GMT-5', 'GMT-4', 'GMT-3', 'GMT-2', 'GMT-1', 'GMT', 'GMT+1', 'GMT+2', 'GMT+3', 'GMT+4', 'GMT+5', 'GMT+6', 'GMT+7', 'GMT+8', 'GMT+9', 'GMT+10', 'GMT+11', 'GMT+12'], tooltip='e.g. \'America/New_York\', \'Asia/Tokyo\', \'GMT-4\', \'GMT+9\'...', group=g0) i_show_history = input.string(option_yes, 'History', options=[option_yes, option_no], group=g0) == option_yes i_lookback = 12 * 60 // Sessions i_show_sess1 = input.bool(true, 'Session 1: ', group=g1, inline='session1_1') and show i_sess1_label = input.string('London', ' ', group=g1, inline='session1_1') i_sess1_color = input.color(#66D9EF, ' ', group=g1, inline='session1_1') i_sess1 = input.session('0800-1700', 'Time', group=g1) i_sess1_extend = input.string(option_no, option_extend1, options=[option_no, option_extend1], group=g1) i_sess1_fib = input.string(option_no, 'Fibonacci levels', group=g1, options=[option_yes, option_no]) != option_no i_sess1_op = input.string(option_no, 'Opening range', group=g1, options=[option_yes, option_no]) != option_no and show i_show_sess2 = input.bool(true, 'Session 2: ', group=g2, inline='session2_1') and show i_sess2_label = input.string('New York', ' ', group=g2, inline='session2_1') i_sess2_color = input.color(#FD971F, ' ', group=g2, inline='session2_1') i_sess2 = input.session('1300-2200', 'Time', group=g2) i_sess2_extend = input.string(option_no, option_extend1, options=[option_no, option_extend1], group=g2) i_sess2_fib = input.string(option_no, 'Fibonacci levels', group=g2, options=[option_yes, option_no]) != option_no i_sess2_op = input.string(option_no, 'Opening range', group=g2, options=[option_yes, option_no]) != option_no and show i_show_sess3 = input.bool(true, 'Session 3: ', group=g3, inline='session3_1') and show i_sess3_label = input.string('Tokyo', ' ', group=g3, inline='session3_1') i_sess3_color = input.color(#AE81FF, ' ', group=g3, inline='session3_1') i_sess3 = input.session('0100-1000', 'Time', group=g3) i_sess3_extend = input.string(option_no, option_extend1, options=[option_no, option_extend1], group=g3) i_sess3_fib = input.string(option_no, 'Fibonacci levels', group=g3, options=[option_yes, option_no]) != option_no i_sess3_op = input.string(option_no, 'Opening range', group=g3, options=[option_yes, option_no]) != option_no and show i_show_sess4 = input.bool(true, 'Session 4: ', group=g12, inline='session4_1') and show i_sess4_label = input.string('London(CO)', ' ', group=g12, inline='session4_1') i_sess4_color = input.color(#AE81FF, ' ', group=g12, inline='session4_1') i_sess4 = input.session('0100-1000', 'Time', group=g12) i_sess4_extend = input.string(option_no, option_extend1, options=[option_no, option_extend1], group=g12) i_sess4_fib = input.string(option_no, 'Fibonacci levels', group=g12, options=[option_yes, option_no]) != option_no i_sess4_op = input.string(option_no, 'Opening range', group=g12, options=[option_yes, option_no]) != option_no and show // Show & Styles i_sess_border_style = input.string(line.style_dashed, 'Style', options=[line.style_solid, line.style_dotted, line.style_dashed], group=g4) i_sess_border_width = input.int(1, 'Thickness', minval=0, group=g4) i_sess_bgopacity = input.int(94, 'Transp', minval=0, maxval=100, step=1, group=g4, tooltip='Setting the 100 is no background color') // Candle option_candle_body = 'Show (Body only)' option_candle_wick = 'Show' i_candle = input.string(option_hide, 'Display', options=[option_candle_wick, option_candle_body, option_hide], group=g11) i_show_candle = i_candle != option_hide i_show_candle_wick = i_candle == option_candle_wick i_candle_border_width = input.int(2, 'Thickness', minval=0, group=g11) option_candle_color1 = 'Session\'s' option_candle_color2 = 'Red/Green' i_candle_color = input.string(option_candle_color2, 'Candle color', options=[option_candle_color1, option_candle_color2], group=g11, inline='candle_color') i_candle_color_g = input.color(#A6E22E, '', group=g11, inline='candle_color') i_candle_color_r = input.color(#F92672, '', group=g11, inline='candle_color') // Labels i_label_show = input.bool(true, 'Show labels', inline='label_show', group=g6) and show i_label_size = str.lower(input.string('Small', '', options=['Auto', 'Tiny', 'Small', 'Normal', 'Large', 'Huge'], inline='label_show', group=g6)) i_label_position_y = str.lower(input.string('Top', '', options=['Top', 'Bottom'], inline='label_show', group=g6)) i_label_position_s = str.lower(input.string('Outside', '', options=['Inside', 'Outside'], inline='label_show', group=g6)) i_label_position = f_get_label_position(i_label_position_y, i_label_position_s) i_label_format_name = input.bool(true, 'Name', inline='label_format', group=g6) i_label_format_day = input.bool(false, 'Day', inline='label_format', group=g6) i_label_format_price = input.bool(false, 'Price', inline='label_format', group=g6) i_label_format_pips = input.bool(false, 'Pips', inline='label_format', group=g6) // Fibonacci levels i_f_linestyle = input.string(line.style_solid, title="Style", options=[line.style_solid, line.style_dotted, line.style_dashed], group=g7) i_f_linewidth = input.int(1, title="Thickness", minval=1, group=g7) // Opening range i_o_minutes = input.int(15, title='Periods (minutes)', minval=1, step=1, group=g5) i_o_minutes := math.max(i_o_minutes, timeframe.multiplier + 1) i_o_transp = input.int(88, title='Transp', minval=0, maxval=100, step=1, group=g5) // Oscillator mode i_osc = input.bool(false, 'Oscillator', inline='osc', group=g10) i_osc_min = input.float(0, '', inline='osc', group=g10) i_osc_max = input.float(100, '-', inline='osc', group=g10) // Alerts i_alert1_show = input.bool(false, 'Alerts - Sessions stard/end', group='Alerts visualized') i_alert2_show = input.bool(false, 'Alerts - Opening range breakouts', group='Alerts visualized') i_alert3_show = input.bool(false, 'Alerts - Price crossed session\'s High/Low after session closed', group='Alerts visualized') // ------------------------ // Drawing labels // ------------------------ f_render_label (_show, _session, _is_started, _color, _top, _bottom, _text, _delete_history) => var label my_label = na var int start_time = na v_position_y = (i_label_position_y == 'top') ? _top : _bottom v_label = array.new_string() v_chg = _top - _bottom if _is_started start_time := time if i_label_format_name and not na(_text) array.push(v_label, _text) if i_label_format_day array.push(v_label, f_get_day(dayofweek(start_time, i_tz))) if i_label_format_price array.push(v_label, str.format(fmt_price, v_chg)) if i_label_format_pips array.push(v_label, str.format(fmt_pips, v_chg / pips) + ' pips') if _show if _is_started my_label := label.new(time, v_position_y, array.join(v_label, icon_separator), textcolor=_color, color=c_none, size=i_label_size, style=i_label_position, xloc=xloc.bar_time) if _delete_history label.delete(my_label[1]) if _session label.set_y(my_label, v_position_y) label.set_text(my_label, array.join(v_label, icon_separator)) // ------------------------ // Drawing Fibonacci levels // ------------------------ f_render_fibonacci (_show, _session, _is_started, _x1, _x2, _color, _top, _bottom, _level, _width, _style, _is_extend, _delete_history) => var line my_line = na if _show y = (_top - _bottom) * _level + _bottom if _is_started my_line := line.new(_x1, y, _x2, y, width=_width, color=color.new(_color, 30), style=_style) if _is_extend line.set_extend(my_line, extend.right) if _delete_history line.delete(my_line[1]) if _session line.set_y1(my_line, y) line.set_y2(my_line, y) // ------------------------ // Drawing Opening range // ------------------------ f_render_oprange (_show, _session, _is_started, _x1, _x2, _color, _max, _is_extend, _delete_history) => var int start_time = na var box my_box = na top = ta.highest(high, _max) bottom = ta.lowest(low, _max) is_crossover = ta.crossover(close, box.get_top(my_box)) is_crossunder = ta.crossunder(close, box.get_bottom(my_box)) if _show if _is_started start_time := time my_box := na if _delete_history box.delete(my_box[1]) if _session time_op = start_time + (i_o_minutes * 60 * 1000) time_op_delay = time_op - f_get_time_by_bar(1) if time <= time_op and time > time_op_delay my_box := box.new(_x1, top, _x2, bottom, border_width=0, bgcolor=color.new(_color, i_o_transp)) if _is_extend box.set_extend(my_box, extend.right) my_box else //box.set_right(my_box, bar_index + 1) if is_crossover alert('Price crossed over the opening range', alert.freq_once_per_bar) if i_alert2_show label.new(bar_index, box.get_top(my_box), "×", color=color.blue, textcolor=ac.tradingview('blue'), style=label.style_none, size=size.large) if is_crossunder alert('Price crossed under the opening range', alert.freq_once_per_bar) if i_alert2_show label.new(bar_index, box.get_bottom(my_box), "×", color=color.red, textcolor=ac.tradingview('red'), style=label.style_none, size=size.large) my_box // ------------------------ // Drawing candle // ------------------------ f_render_candle (_show, _session, _is_started, _is_ended, _color, _top, _bottom, _open, _x1, _x2, _delete_history) => var box body = na var line wick1 = na var line wick2 = na border_width = i_candle_border_width cx = math.round(math.avg(_x2, _x1)) - math.round(border_width / 2) body_color = i_candle_color == option_candle_color2 ? close > _open ? i_candle_color_g : i_candle_color_r : _color if _show if _is_started body := box.new(_x1, _top, _x2, _bottom, body_color, border_width, line.style_solid, bgcolor=color.new(color.black, 100)) wick1 := i_show_candle_wick ? line.new(cx, _top, cx, _top, color=_color, width=border_width, style=line.style_solid) : na wick2 := i_show_candle_wick ? line.new(cx, _bottom, cx, _bottom, color=_color, width=border_width, style=line.style_solid) : na if _delete_history box.delete(body[1]) line.delete(wick1[1]) line.delete(wick2[1]) else if _session top = math.max(_open, close) bottom = math.min(_open, close) box.set_top(body, top) box.set_bottom(body, bottom) box.set_border_color(body, body_color) line.set_y1(wick1, _top) line.set_y2(wick1, top) line.set_color(wick1, body_color) line.set_y1(wick2, _bottom) line.set_y2(wick2, bottom) line.set_color(wick2, body_color) else if _is_ended box.set_right(body, bar_index) // ------------------------ // Drawing market // ------------------------ f_render_session (_show, _session, _is_started, _is_ended, _color, _top, _bottom, _extend, _is_extend, _delete_history) => var box my_box = na x0_1 = ta.valuewhen(na(_session[1]) and _session, bar_index, 1) x0_2 = ta.valuewhen(na(_session) and _session[1], bar_index, 0) var x1 = 0 var x2 = 0 var session_open = 0.0 var session_high = 0.0 var session_low = 0.0 if _show if _is_started diff = math.abs(x0_2 - x0_1) x1 := bar_index x2 := bar_index + (math.min(diff, max_bars)) my_box := box.new(x1, _top, x2, _bottom, _color, i_sess_border_width, i_sess_border_style, bgcolor=color.new(_color, i_sess_bgopacity)) session_open := open session_high := _top session_low := _bottom if _is_extend box.set_extend(my_box, extend.right) if _delete_history box.delete(my_box[1]) else if _session box.set_top(my_box, _top) box.set_bottom(my_box, _bottom) session_high := _top session_low := _bottom else if _is_ended session_open := na box.set_right(my_box, bar_index) [x1, x2, session_open, session_high, session_low] // ------------------------ // Drawing // ------------------------ draw (_show, _session, _color, _label, _extend, _show_fib, _show_op, _lookback) => max = f_get_period(_session, 1, _lookback) top = ta.highest(high, max) bottom = ta.lowest(low, max) if i_osc top := i_osc_max bottom := i_osc_min is_started = f_get_started(_session) is_ended = f_get_ended(_session) is_extend = _extend != option_no delete_history = (not i_show_history) or is_extend [x1, x2, _open, _high, _low] = f_render_session(_show, _session, is_started, is_ended, _color, top, bottom, _extend, is_extend, delete_history) if i_show_candle f_render_candle(_show, _session, is_started, is_ended, _color, top, bottom, _open, x1, x2, delete_history) if i_label_show f_render_label(_show, _session, is_started, _color, top, bottom, _label, delete_history) if _show_op f_render_oprange(_show, _session, is_started, x1, x2, _color, max, is_extend, delete_history) if _show_fib f_render_fibonacci(_show, _session, is_started, x1, x2, _color, top, bottom, 0.500, 2, line.style_solid, is_extend, delete_history) f_render_fibonacci(_show, _session, is_started, x1, x2, _color, top, bottom, 0.628, i_f_linewidth, i_f_linestyle, is_extend, delete_history) f_render_fibonacci(_show, _session, is_started, x1, x2, _color, top, bottom, 0.382, i_f_linewidth, i_f_linestyle, is_extend, delete_history) [_session, _open, _high, _low] /////////////////// // Calculating /////////////////// string tz = (i_tz == option_no or i_tz == '') ? na : i_tz int sess1 = time(timeframe.period, i_sess1, tz) int sess2 = time(timeframe.period, i_sess2, tz) int sess3 = time(timeframe.period, i_sess3, tz) int sess4 = time(timeframe.period, i_sess4, tz) /////////////////// // Plotting /////////////////// [is_sess1, sess1_open, sess1_high, sess1_low] = draw(i_show_sess1, sess1, i_sess1_color, i_sess1_label, i_sess1_extend, i_sess1_fib, i_sess1_op, i_lookback) [is_sess2, sess2_open, sess2_high, sess2_low] = draw(i_show_sess2, sess2, i_sess2_color, i_sess2_label, i_sess2_extend, i_sess2_fib, i_sess2_op, i_lookback) [is_sess3, sess3_open, sess3_high, sess3_low] = draw(i_show_sess3, sess3, i_sess3_color, i_sess3_label, i_sess3_extend, i_sess3_fib, i_sess3_op, i_lookback) [is_sess4, sess4_open, sess4_high, sess4_low] = draw(i_show_sess4, sess4, i_sess4_color, i_sess4_label, i_sess4_extend, i_sess4_fib, i_sess4_op, i_lookback) //////////////////// // Alerts //////////////////// // Session alerts bool sess1_started = is_sess1 and not is_sess1[1] bool sess1_ended = not is_sess1 and is_sess1[1] bool sess2_started = is_sess2 and not is_sess2[1] bool sess2_ended = not is_sess2 and is_sess2[1] bool sess3_started = is_sess3 and not is_sess3[1] bool sess3_ended = not is_sess3 and is_sess3[1] bool sess4_started = is_sess4 and not is_sess4[1] bool sess4_ended = not is_sess4 and is_sess4[1] alertcondition(sess1_started, 'Session #1 started') alertcondition(sess1_ended, 'Session #1 ended') alertcondition(sess2_started, 'Session #2 started') alertcondition(sess2_ended, 'Session #2 ended') alertcondition(sess3_started, 'Session #3 started') alertcondition(sess3_ended, 'Session #3 ended') alertcondition(sess4_started, 'Session #4 started') alertcondition(sess4_ended, 'Session #4 ended') alertcondition((not is_sess1) and ta.crossover(close, sess1_high), 'Session #1 High crossed (after session closed)') alertcondition((not is_sess1) and ta.crossunder(close, sess1_low), 'Session #1 Low crossed (after session closed)') alertcondition((not is_sess2) and ta.crossover(close, sess2_high), 'Session #2 High crossed (after session closed)') alertcondition((not is_sess2) and ta.crossunder(close, sess2_low), 'Session #2 Low crossed (after session closed)') alertcondition((not is_sess3) and ta.crossover(close, sess3_high), 'Session #3 High crossed (after session closed)') alertcondition((not is_sess3) and ta.crossunder(close, sess3_low), 'Session #3 Low crossed (after session closed)') alertcondition((not is_sess4) and ta.crossover(close, sess4_high), 'Session #4 High crossed (after session closed)') alertcondition((not is_sess4) and ta.crossunder(close, sess4_low), 'Session #4 Low crossed (after session closed)') plotshape(i_alert1_show and sess1_started, color=i_sess1_color, text='Start', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.new(color.white, 0)) plotshape(i_alert1_show and sess1_ended, color=i_sess1_color, text='End', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.new(color.white, 0)) plotshape(i_alert1_show and sess2_started, color=i_sess2_color, text='Start', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.new(color.white, 0)) plotshape(i_alert1_show and sess2_ended, color=i_sess2_color, text='End', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.new(color.white, 0)) plotshape(i_alert1_show and sess3_started, color=i_sess3_color, text='Start', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.new(color.white, 0)) plotshape(i_alert1_show and sess3_ended, color=i_sess3_color, text='End', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.new(color.white, 0)) plotshape(i_alert1_show and sess4_started, color=i_sess4_color, text='Start', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.new(color.white, 0)) plotshape(i_alert1_show and sess4_ended, color=i_sess4_color, text='End', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.new(color.white, 0)) plot(i_alert3_show ? sess1_high : na, style=plot.style_linebr, color=i_sess1_color) plot(i_alert3_show ? sess1_low : na, style=plot.style_linebr, linewidth=2, color=i_sess1_color) plot(i_alert3_show ? sess2_high : na, style=plot.style_linebr, color=i_sess2_color) plot(i_alert3_show ? sess2_low : na, style=plot.style_linebr, linewidth=2, color=i_sess2_color) plot(i_alert3_show ? sess3_high : na, style=plot.style_linebr, color=i_sess3_color) plot(i_alert3_show ? sess3_low : na, style=plot.style_linebr, linewidth=2, color=i_sess3_color) plot(i_alert3_show ? sess4_high : na, style=plot.style_linebr, color=i_sess4_color) plot(i_alert3_show ? sess4_low : na, style=plot.style_linebr, linewidth=2, color=i_sess4_color) plotshape(i_alert3_show and (not is_sess1) and ta.crossover(close, sess1_high), color=i_sess1_color, title="", style=shape.triangleup, location=location.bottom, size=size.tiny) plotshape(i_alert3_show and (not is_sess1) and ta.crossunder(close, sess1_low), color=i_sess1_color, title="", style=shape.triangledown, location=location.bottom, size=size.tiny) plotshape(i_alert3_show and (not is_sess2) and ta.crossover(close, sess2_high), color=i_sess2_color, title="", style=shape.triangleup, location=location.bottom, size=size.tiny) plotshape(i_alert3_show and (not is_sess2) and ta.crossunder(close, sess2_low), color=i_sess2_color, title="", style=shape.triangledown, location=location.bottom, size=size.tiny) plotshape(i_alert3_show and (not is_sess3) and ta.crossover(close, sess3_high), color=i_sess3_color, title="", style=shape.triangleup, location=location.bottom, size=size.tiny) plotshape(i_alert3_show and (not is_sess3) and ta.crossunder(close, sess3_low), color=i_sess3_color, title="", style=shape.triangledown, location=location.bottom, size=size.tiny) plotshape(i_alert3_show and (not is_sess4) and ta.crossover(close, sess4_high), color=i_sess4_color, title="", style=shape.triangleup, location=location.bottom, size=size.tiny) plotshape(i_alert3_show and (not is_sess4) and ta.crossunder(close, sess4_low), color=i_sess4_color, title="", style=shape.triangledown, location=location.bottom, size=size.tiny)
GCBG - RSI DIV
https://www.tradingview.com/script/NnW3KKXA-GCBG-RSI-DIV/
angeltsarov
https://www.tradingview.com/u/angeltsarov/
29
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © angeltsarov //@version=4 study(title="GCBG - RSI Divergence Indicator", shorttitle= "GCBG - RSI DIV", format=format.price) len = 14 //input(title="RSI Period", minval=1, defval=14) src = close //input(title="RSI Source", defval=close) lbR = 5 //input(title="Pivot Lookback Right", defval=5) lbL = 5 //input(title="Pivot Lookback Left", defval=5) rangeUpper = 60 //input(title="Max of Lookback Range", defval=60) rangeLower = 5 //input(title="Min of Lookback Range", defval=5) plotBull = input(title="Plot Bullish", defval=true) plotHiddenBull = input(title="Plot Hidden Bullish", defval=true) plotBear = input(title="Plot Bearish", defval=true) plotHiddenBear = input(title="Plot Hidden Bearish", defval=true) bearColor = color.red bullColor = color.green hiddenBullColor = color.new(color.green, 80) hiddenBearColor = color.new(color.red, 80) textColor = color.white noneColor = color.new(color.white, 100) osc = rsi(src, len) // ### Smoothed MA showSmma = input(title="Show Moving Average", type=input.bool, defval=true, group = "Smoothed MA") smmaLen = 50 //input(50, minval=1, title="SMMA Length", group = "Smoothed MA") smmaSrc = osc smma = 0.0 smma := na(smma[1]) ? sma(smmaSrc, smmaLen) : (smma[1] * (smmaLen - 1) + smmaSrc) / smmaLen plot(showSmma ? smma : na, linewidth=2, color=color.white) // End ### lineColor = (osc > smma) ?color.yellow : color.yellow plot(osc, title="RSI", linewidth=2, color=lineColor) hline(50, title="Middle Line", linestyle=hline.style_solid) // obLevel = hline(70, title="Overbought", linestyle=hline.style_dotted) // osLevel = hline(30, title="Oversold", linestyle=hline.style_dotted) //fill(obLevel, osLevel, title="Background", color=#9915FF, transp=90) plFound = na(pivotlow(osc, lbL, lbR)) ? false : true phFound = na(pivothigh(osc, lbL, lbR)) ? false : true _inRange(cond) => bars = barssince(cond == true) rangeLower <= bars and bars <= rangeUpper //------------------------------------------------------------------------------ // Regular Bullish // Osc: Higher Low oscHL = osc[lbR] > valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1]) // Price: Lower Low priceLL = low[lbR] < valuewhen(plFound, low[lbR], 1) bullCond = plotBull and priceLL and oscHL and plFound plot( plFound ? osc[lbR] : na, offset=-lbR, title="Regular Bullish", linewidth=2, color=(bullCond ? bullColor : noneColor), transp=0 ) plotshape( bullCond ? osc[lbR] : na, offset=-lbR, title="Regular Bullish Label", text=" Bull ", style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor, transp=0 ) //------------------------------------------------------------------------------ // Hidden Bullish // Osc: Lower Low oscLL = osc[lbR] < valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1]) // Price: Higher Low priceHL = low[lbR] > valuewhen(plFound, low[lbR], 1) hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound plot( plFound ? osc[lbR] : na, offset=-lbR, title="Hidden Bullish", linewidth=2, color=(hiddenBullCond ? hiddenBullColor : noneColor), transp=0 ) plotshape( hiddenBullCond ? osc[lbR] : na, offset=-lbR, title="Hidden Bullish Label", text=" H Bull ", style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor, transp=0 ) //------------------------------------------------------------------------------ // Regular Bearish // Osc: Lower High oscLH = osc[lbR] < valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1]) // Price: Higher High priceHH = high[lbR] > valuewhen(phFound, high[lbR], 1) bearCond = plotBear and priceHH and oscLH and phFound plot( phFound ? osc[lbR] : na, offset=-lbR, title="Regular Bearish", linewidth=2, color=(bearCond ? bearColor : noneColor), transp=0 ) plotshape( bearCond ? osc[lbR] : na, offset=-lbR, title="Regular Bearish Label", text=" Bear ", style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor, transp=0 ) //------------------------------------------------------------------------------ // Hidden Bearish // Osc: Higher High oscHH = osc[lbR] > valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1]) // Price: Lower High priceLH = high[lbR] < valuewhen(phFound, high[lbR], 1) hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound plot( phFound ? osc[lbR] : na, offset=-lbR, title="Hidden Bearish", linewidth=2, color=(hiddenBearCond ? hiddenBearColor : noneColor), transp=0 ) plotshape( hiddenBearCond ? osc[lbR] : na, offset=-lbR, title="Hidden Bearish Label", text=" H Bear ", style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor, transp=0 ) // ### Alerts if bearCond alert("Bearish Divergence") else if hiddenBearCond alert("Hidden Bearish Divergence") else if bullCond alert("Bullish Divergence") else if hiddenBullCond alert("Hidden Bullish Divergence") // END ###
VHF-Adaptive T3 w/ Expanded Source Types [Loxx]
https://www.tradingview.com/script/N3MTljF5-VHF-Adaptive-T3-w-Expanded-Source-Types-Loxx/
loxx
https://www.tradingview.com/u/loxx/
44
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("VHF-Adaptive T3 w/ Expanded Source Types [Loxx]", shorttitle="VHFAT3EST [Loxx]", overlay = true, timeframe="", timeframe_gaps = true) import loxx/loxxexpandedsourcetypes/3 greencolor = #2DD204 redcolor = #D2042D _iT3(src, per, hot, org)=> a = hot _c1 = -a * a * a _c2 = 3 * a * a + 3 * a * a * a _c3 = -6 * a * a - 3 * a - 3 * a * a * a _c4 = 1 + 3 * a + a * a * a + 3 * a * a alpha = 0. if (org) alpha := 2.0 / (1.0 + per) else alpha := 2.0 / (2.0 + (per - 1.0) / 2.0) _t30 = src, _t31 = src _t32 = src, _t33 = src _t34 = src, _t35 = src _t30 := nz(_t30[1]) + alpha * (src - nz(_t30[1])) _t31 := nz(_t31[1]) + alpha * (_t30 - nz(_t31[1])) _t32 := nz(_t32[1]) + alpha * (_t31 - nz(_t32[1])) _t33 := nz(_t33[1]) + alpha * (_t32 - nz(_t33[1])) _t34 := nz(_t34[1]) + alpha * (_t33 - nz(_t34[1])) _t35 := nz(_t35[1]) + alpha * (_t34 - nz(_t35[1])) out = _c1 * _t35 + _c2 * _t34 + _c3 * _t33 + _c4 * _t32 out smthtype = input.string("Kaufman", "Heiken-Ashi Better Smoothing", options = ["AMA", "T3", "Kaufman"], group= "Basic Settings") srcoption = input.string("Close", "Source", group= "Basic Settings", options = ["Close", "Open", "High", "Low", "Median", "Typical", "Weighted", "Average", "Average Median Body", "Trend Biased", "Trend Biased (Extreme)", "HA Close", "HA Open", "HA High", "HA Low", "HA Median", "HA Typical", "HA Weighted", "HA Average", "HA Average Median Body", "HA Trend Biased", "HA Trend Biased (Extreme)", "HAB Close", "HAB Open", "HAB High", "HAB Low", "HAB Median", "HAB Typical", "HAB Weighted", "HAB Average", "HAB Average Median Body", "HAB Trend Biased", "HAB Trend Biased (Extreme)"]) t3per = input.int(32, "T3 Period", group = "Basic Settings") t3hot = input.float(0.7, "T3 Factor", step = 0.01, maxval = 1, minval = 0, group = "Basic Settings") t3swt = input.bool(false, "T3 Original?", group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") kfl=input.float(0.666, title="* Kaufman's Adaptive MA (KAMA) Only - Fast End", group = "Moving Average Inputs") ksl=input.float(0.0645, title="* Kaufman's Adaptive MA (KAMA) Only - Slow End", group = "Moving Average Inputs") amafl = input.int(2, title="* Adaptive Moving Average (AMA) Only - Fast", group = "Moving Average Inputs") amasl = input.int(30, title="* Adaptive Moving Average (AMA) Only - Slow", group = "Moving Average Inputs") haclose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) haopen = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open) hahigh = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high) halow = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low) hamedian = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hl2) hatypical = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlc3) haweighted = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlcc4) haaverage = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, ohlc4) float src = switch srcoption "Close" => loxxexpandedsourcetypes.rclose() "Open" => loxxexpandedsourcetypes.ropen() "High" => loxxexpandedsourcetypes.rhigh() "Low" => loxxexpandedsourcetypes.rlow() "Median" => loxxexpandedsourcetypes.rmedian() "Typical" => loxxexpandedsourcetypes.rtypical() "Weighted" => loxxexpandedsourcetypes.rweighted() "Average" => loxxexpandedsourcetypes.raverage() "Average Median Body" => loxxexpandedsourcetypes.ravemedbody() "Trend Biased" => loxxexpandedsourcetypes.rtrendb() "Trend Biased (Extreme)" => loxxexpandedsourcetypes.rtrendbext() "HA Close" => loxxexpandedsourcetypes.haclose(haclose) "HA Open" => loxxexpandedsourcetypes.haopen(haopen) "HA High" => loxxexpandedsourcetypes.hahigh(hahigh) "HA Low" => loxxexpandedsourcetypes.halow(halow) "HA Median" => loxxexpandedsourcetypes.hamedian(hamedian) "HA Typical" => loxxexpandedsourcetypes.hatypical(hatypical) "HA Weighted" => loxxexpandedsourcetypes.haweighted(haweighted) "HA Average" => loxxexpandedsourcetypes.haaverage(haaverage) "HA Average Median Body" => loxxexpandedsourcetypes.haavemedbody(haclose, haopen) "HA Trend Biased" => loxxexpandedsourcetypes.hatrendb(haclose, haopen, hahigh, halow) "HA Trend Biased (Extreme)" => loxxexpandedsourcetypes.hatrendbext(haclose, haopen, hahigh, halow) "HAB Close" => loxxexpandedsourcetypes.habclose(smthtype, amafl, amasl, kfl, ksl) "HAB Open" => loxxexpandedsourcetypes.habopen(smthtype, amafl, amasl, kfl, ksl) "HAB High" => loxxexpandedsourcetypes.habhigh(smthtype, amafl, amasl, kfl, ksl) "HAB Low" => loxxexpandedsourcetypes.hablow(smthtype, amafl, amasl, kfl, ksl) "HAB Median" => loxxexpandedsourcetypes.habmedian(smthtype, amafl, amasl, kfl, ksl) "HAB Typical" => loxxexpandedsourcetypes.habtypical(smthtype, amafl, amasl, kfl, ksl) "HAB Weighted" => loxxexpandedsourcetypes.habweighted(smthtype, amafl, amasl, kfl, ksl) "HAB Average" => loxxexpandedsourcetypes.habaverage(smthtype, amafl, amasl, kfl, ksl) "HAB Average Median Body" => loxxexpandedsourcetypes.habavemedbody(smthtype, amafl, amasl, kfl, ksl) "HAB Trend Biased" => loxxexpandedsourcetypes.habtrendb(smthtype, amafl, amasl, kfl, ksl) "HAB Trend Biased (Extreme)" => loxxexpandedsourcetypes.habtrendbext(smthtype, amafl, amasl, kfl, ksl) => haclose vmax = ta.highest(src, t3per) vmin = ta.lowest(src, t3per) noise = math.sum(math.abs(ta.change(src)), t3per) vhf = (vmax - vmin) / noise len = nz(int(-math.log(vhf) * t3per), 1) len := len < 1 ? 1 : len val = _iT3(src, len, t3hot, t3swt) colorout = val > val[1] ? greencolor : redcolor plot(val, color = colorout, linewidth = 3) barcolor(colorbars ? colorout : na) goLong = ta.crossover(val, val[1]) goShort = ta.crossunder(val, val[1]) alertcondition(goLong, title="Long", message="VHF-Adaptive T3 w/ Expanded Source Types [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="VHF-Adaptive T3 w/ Expanded Source Types [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
LTI Exponential Moving Averages
https://www.tradingview.com/script/ckhIePmW-LTI-Exponential-Moving-Averages/
DTyler1997
https://www.tradingview.com/u/DTyler1997/
12
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © DTyler1997 //@version=5 indicator("LTI Exponential Moving Averages", shorttitle="LTI EMAs", overlay=true, timeframe="", timeframe_gaps=true) len1 = input.int(8, minval=1, title="Fast EMA 1 Length") src1 = input(close, title="Fast EMA 1 Source") len2 = input.int(21, minval=1, title="Fast EMA 2 Length") src2 = input(close, title="Fast EMA 2 Source") len3 = input.int(50, minval=1, title="Slow EMA 1 Length") src3 = input(close, title="Slow EMA 1 Source") len4 = input.int(200, minval=1, title="Slow EMA 2 Length") src4 = input(close, title="Slow EMA 2 Source") FastEMA1 = ta.ema(close, 8) FastEMA2 = ta.ema(close, 21) SlowEMA1 = ta.ema(close, 50) SlowEMA2 = ta.ema(close, 200) plot(FastEMA1, title="Fast EMA 1", color=color.yellow, linewidth=1) plot(FastEMA2, title="Fast EMA 2", color=color.blue, linewidth=1) plot(SlowEMA1, title="Slow EMA 1", color=color.red, linewidth=1) plot(SlowEMA2, title="Slow EMA 2", color=color.green, linewidth=1)
OTFHigh'nLows
https://www.tradingview.com/script/rrcjBGq8-OTFHigh-nLows/
RomankoJr
https://www.tradingview.com/u/RomankoJr/
5
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © RomankoJr //@version=5 // Daily High Prices indicator("OTFHigh'nLows", overlay=true) [mh, ml] = request.security(syminfo.tickerid, 'M', [high[1], low[1]], lookahead=barmerge.lookahead_on) [wh, wl] = request.security(syminfo.tickerid, 'W', [high[1], low[1]], lookahead=barmerge.lookahead_on ) [dh, dl] = request.security(syminfo.tickerid, 'D', [high[1], low[1]], lookahead=barmerge.lookahead_on) [h4h, h4l] = request.security(syminfo.tickerid, '240', [high[1], low[1]] ) [h1h, h1l] = request.security(syminfo.tickerid, '60', [high[1], low[1]]) [m30h, m30l] = request.security(syminfo.tickerid, '30', [high[1], low[1]]) isTodayM = false isTodayW = false isTodayD = false if year(timenow) == year(time) and month(timenow) == month(time) isTodayM := true else isTodayM := false if year(timenow) == year(time) and month(timenow) == month(time) and weekofyear(timenow) == weekofyear(time) isTodayW := true else isTodayW := false if year(timenow) == year(time) and month(timenow) == month(time) and dayofmonth(timenow) == dayofmonth(time) isTodayD := true else isTodayD := false if barstate.isrealtime label.new(bar_index, mh, "Prev. Month\nHigh = " + str.tostring(mh, format.mintick) + "\n🠇", style = label.style_none, textcolor = color.black, size = size.large) label.new(bar_index, ml, "Prev. Month\nLow = " + str.tostring(ml, format.mintick) + "\n🠇", style = label.style_none, textcolor = color.black, size = size.large) if barstate.isrealtime label.new(bar_index, wh, "Prev. Week\nHigh = " + str.tostring(dh, format.mintick) + "\n🠇", style = label.style_none, textcolor = color.black, size = size.normal) label.new(bar_index, wl, "Prev. Week\nLow = " + str.tostring(dl, format.mintick) + "\n🠇", style = label.style_none, textcolor = color.black, size = size.normal) if barstate.isrealtime label.new(bar_index, dh, "Prev. Day\nHigh = " + str.tostring(dh, format.mintick) + "\n🠇", style = label.style_none, textcolor = color.black, size = size.normal) label.new(bar_index, dl, "Prev. Day\nLow = " + str.tostring(dl, format.mintick) + "\n🠇", style = label.style_none, textcolor = color.black, size = size.normal) plot(mh, title="Month H", color= isTodayM[1] ? color.blue : #00000000) plot(ml, title="Month L", color= isTodayM[1] ? color.blue : #00000000) plot(wh, title="Week H", color= isTodayW[1] ? color.blue : #00000000) plot(wl, title="Week L", color= isTodayW[1] ? color.blue : #00000000) plot(dh, title="Day H", color= isTodayD[1] ? color.blue : #00000000) plot(dl, title="Day L", color= isTodayD[1] ? color.blue : #00000000)
VHF Adaptive ADXm [Loxx]
https://www.tradingview.com/script/a4pTDwXR-VHF-Adaptive-ADXm-Loxx/
loxx
https://www.tradingview.com/u/loxx/
94
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("VHF Adaptive ADXm [Loxx]", overlay = false, shorttitle="VHFAADXM [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D _iAdxm(cls, hi, lo, period)=> hc = hi lc = lo cp = nz(cls[1]) hp = nz(hi[1]) lp = nz(lo[1]) dh = (hc > hp) ? hc - hp : 0 dl = (lp > lc) ? lp - lc : 0 dh := dh == dl ? 0 : dh < dl ? 0 : dh dl := dh == dl ? 0 : dl < dh ? 0 : dl tr = math.max(hc, cp) - math.min(lc, cp) dhk = (tr != 0) ? 100.0 * dh / tr : 0 dlk = (tr != 0) ? 100.0 * dl / tr : 0 alpha = 2.0 / (period + 1.0) sdh = 0. sdl = 0. di = 0. adx = 0. sdh := nz(sdh[1]) + alpha * (dhk - nz(sdh[1])) sdl := nz(sdl[1]) + alpha * (dlk - nz(sdl[1])) di := sdh - sdl div = sdh + sdl div := math.abs(div) temp = (div != 0.0) ? 100.0 * di / div : 0 adx := nz(adx[1]) + alpha * (temp - nz(adx[1])) [adx, di] per = input.int(14, "Period", group = "Basic Settings") level = input.int(20, "Level", group = "Basic Settings") inpAdaptive = input.bool(true, "VHF Adaptive?", group = "Basic Settings") sigtype = input.string("Zero-line", "Signal Type", options = ["Zero-line", "Signal", "Levels"], group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") colorbars = input.bool(false, "Color bars?", group = "UI Options") vhfNoise = 0. vhfDiff = (close > nz(close[1])) ? close - nz(close[1]) : nz(close[1]) - close vhfNoise := nz(vhfNoise[1]) - nz(vhfDiff[per]) + vhfDiff HCP = ta.highest(close, per) LCP = ta.lowest(close, per) vhf = (HCP - LCP) / vhfNoise peradapt = per * vhf * 2.0 perout = inpAdaptive ? peradapt : per [adxm, di] = _iAdxm(close, high, low, perout) middle = 0 adxmc = 0. sigout = sigtype == "Zero-line" ? middle : nz(adxm[1]) adxmc := sigtype == "Zero-line" ? adxm > sigout ? 1 : adxm < sigout ? 2 : 3 : sigtype == "Signal" ? adxm > adxm[1] ? 1 : adxm < adxm[1] ? 2 : 3 : adxm > level ? 1 : adxm < -level ? 2 : 3 colorout = adxmc == 1 ? greencolor : adxmc == 2 ? redcolor : color.gray plot(adxm, color = colorout, linewidth = 2) plot(di, color = color.gray) plot(level, color = bar_index % 2 ? color.gray : na) plot(-level, color = bar_index % 2 ? color.gray : na) plot(middle, color = bar_index % 2 ? color.gray : na) goLong = colorout == greencolor and (colorout[1] == redcolor or colorout[1] == color.gray) goShort = colorout == redcolor and (colorout[1] == greencolor or colorout[1] == color.gray) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="VHF Adaptive ADXm [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="VHF Adaptive ADXm [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}") barcolor(colorbars ? colorout : na)
+ Multi-timeframe Multiple Moving Average Lines
https://www.tradingview.com/script/rMcUo2K6-Multi-timeframe-Multiple-Moving-Average-Lines/
ClassicScott
https://www.tradingview.com/u/ClassicScott/
321
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ClassicScott //This is a pretty simple script that plots lines for various moving averages (what I think are the most commonly used across all markets) of varying lengths of //timeframes of the user's choosing. Timeframes range from 5 minutes up to one month, so regardless if you're a scalper or a swing trader there should be something //here for you. //There are 8 lines (that can be turned on/off individually), which may seem like a lot, but if you use two averages and want to display four different timeframes //for each, you can do that. The nice thing is that because the lines start plotting from the current bar they won't clutter up the screen. And obviously having //moving averages from different timeframes on your chart makes price action more difficult to read (I mean sure, you can make them invisible, but who wants to do //that all the time). //For each line there are two labels. One with the moving average type, and the other with its specific timeframe. I can't include the moving average length because //it's not a string input. If anyone has a workaround for this, let me know, otherwise I would simply recommend setting different colors depending on the length, //or if you only use one or two lenghts and one or two moving averages this shouldn't be an issue. I had to use two labels because for the label text I couldn't //include more than one string input, this is why there is an input for the 'moving average type label distance.'' You will want to adjust this depending on if you //are trading crypto, futures, or forex because in some cases there may still be label overlap. //Pretty much everything else is self-explanatory. //I've added alerts. I might need to modify them if I can, because it would be nice for them to state the name and timeframe of the moving average. But I think //this will do for now. //Enjoy! //@version=5 indicator('+ Multi-timeframe Multiple Moving Average Lines', shorttitle='+ MTFMA Lines', overlay=true) bar_index_duration = time - time[1] ////INPUTS FOR FIRST MOVING AVERAGE //DISPLAY LINES AND LABELS? onoff = input(defval=true, title='Display Line and Label?', group='Moving Average #1') //LOOKBACK i_ma1len = input.int(defval=9, title='Lookback', group='Moving Average #1') //TYPE i_ma1 = input.string(defval='EMA', options=['EMA', 'HMA', 'SMA', 'SMMA', 'VWMA', 'WMA'], title='Moving Average Type', group='Moving Average #1') ma1 = i_ma1 == 'EMA' ? ta.ema(close, i_ma1len) : i_ma1 == 'HMA' ? ta.hma(close, i_ma1len) : i_ma1 == 'SMA' ? ta.sma(close, i_ma1len) : i_ma1 == 'SMMA' ? ta.rma(close, i_ma1len) : i_ma1 == 'VWMA' ? ta.vwma(close, i_ma1len) : i_ma1 == 'WMA' ? ta.wma(close, i_ma1len) : na //RESOLUTION i_ma1res = input.string(defval='1h', options=['5m', '12m', '15m', '30m', '1h', '4h', '8h', '12h', 'D', '3D', '4D', 'W', 'M'], title='Resolution', group='Moving Average #1') ma1res = i_ma1res == '5m' ? '5' : i_ma1res == '12m' ? '12' : i_ma1res == '15m' ? '15' : i_ma1res == '30m' ? '30' : i_ma1res == '1h' ? '60' : i_ma1res == '4h' ? '240' : i_ma1res == '8h' ? '480' : i_ma1res == '12h' ? '720' : i_ma1res == 'D' ? 'D' : i_ma1res == '3D' ? '3D' : i_ma1res == '4D' ? '4D' : i_ma1res == 'W' ? 'W' : i_ma1res == 'M' ? 'M' : na // line_color = input(color.purple, title='Line Color', group='Moving Average #1') line_style = input.string(defval='Solid', options=['Dashed', 'Dotted', 'Solid'], title='Line Style', group='Moving Average #1') line_width = input.int(defval=1, maxval=4, title="Line Width", group='Moving Average #1') line_term = input(defval=25, title='Line Length', group='Moving Average #1') label_term = input(defval=20, title='MA Type Label Distance', group='Moving Average #1') // _ma1_security = request.security(syminfo.tickerid, ma1res, ma1) //LINES AND LABELS x1 = time y1 = _ma1_security x2 = time + (line_term * bar_index_duration) y2 = _ma1_security xloc = xloc.bar_time color = line_color style = line_style == 'Dotted' ? line.style_dotted : line_style == 'Dashed' ? line.style_dashed : line_style == 'Solid' ? line.style_solid : na ma1_line = onoff ? line.new(x1, y1, x2, y2, xloc, color=color, style=style, width=line_width) : na line.delete(ma1_line[1]) ma1_reslabel = onoff ? label.new(x2, y1, xloc=xloc.bar_time, style=label.style_none, text=i_ma1res, textcolor=line_color) : na label.delete(ma1_reslabel[1]) ma1_typelabel = onoff ? label.new(x1 + (label_term * bar_index_duration), y1, xloc=xloc.bar_time, style=label.style_none, text=i_ma1, textcolor=line_color) : na label.delete(ma1_typelabel[1]) alertcondition(ta.cross(close, _ma1_security), 'Price Crossing MA 1', 'Price has crossed multi-timeframe moving average #1') //////////////////////////////////////////////////////////////////////////////// ////INPUTS FOR SECOND MOVING AVERAGE //DISPLAY LINES AND LABELS? onoff2 = input(defval=true, title='Display Line and Label?', group='Moving Average #2') //LOOKBACK i_ma2len = input.int(defval=9, title='Lookback', group='Moving Average #2') //TYPE i_ma2 = input.string(defval='EMA', options=['EMA', 'HMA', 'SMA', 'SMMA', 'VWMA', 'WMA'], title='Moving Average Type', group='Moving Average #2') ma2 = i_ma2 == 'EMA' ? ta.ema(close, i_ma2len) : i_ma2 == 'HMA' ? ta.hma(close, i_ma2len) : i_ma2 == 'SMA' ? ta.sma(close, i_ma2len) : i_ma2 == 'SMMA' ? ta.rma(close, i_ma2len) : i_ma2 == 'VWMA' ? ta.vwma(close, i_ma2len) : i_ma2 == 'WMA' ? ta.wma(close, i_ma2len) : na //RESOLUTION i_ma2res = input.string(defval='4h', options=['5m', '12m', '15m', '30m', '1h', '4h', '8h', '12h', 'D', '3D', '4D', 'W', 'M'], title='Resolution', group='Moving Average #2') ma2res = i_ma2res == '5m' ? '5' : i_ma2res == '12m' ? '12' : i_ma2res == '15m' ? '15' : i_ma2res == '30m' ? '30' : i_ma2res == '1h' ? '60' : i_ma2res == '4h' ? '240' : i_ma2res == '8h' ? '480' : i_ma2res == '12h' ? '720' : i_ma2res == 'D' ? 'D' : i_ma2res == '3D' ? '3D' : i_ma2res == '4D' ? '4D' : i_ma2res == 'W' ? 'W' : i_ma2res == 'M' ? 'M' : na // line_color2 = input(color.purple, title='Line Color', group='Moving Average #2') line_style2 = input.string(defval='Solid', options=['Dashed', 'Dotted', 'Solid'], title='Line Style', group='Moving Average #2') line_width2 = input.int(defval=1, maxval=4, title="Line Width", group='Moving Average #2') line_term2 = input(defval=25, title='Line Length', group='Moving Average #2') label_term2 = input(defval=20, title='MA Type Label Distance', group='Moving Average #2') // _ma2_security = request.security(syminfo.tickerid, ma2res, ma2) //LINES AND LABELS x1_2 = time y1_2 = _ma2_security x2_2 = time + (line_term * bar_index_duration) y2_2 = _ma2_security xloc2 = xloc.bar_time color2 = line_color2 style2 = line_style2 == 'Dotted' ? line.style_dotted : line_style2 == 'Dashed' ? line.style_dashed : line_style2 == 'Solid' ? line.style_solid : na ma2_line = onoff2 ? line.new(x1_2, y1_2, x2_2, y2_2, xloc2, color=color2, style=style2, width=line_width2) : na line.delete(ma2_line[1]) ma2_reslabel = onoff2 ? label.new(x2_2, y1_2, xloc=xloc.bar_time, style=label.style_none, text=i_ma2res, textcolor=line_color2) : na label.delete(ma2_reslabel[1]) ma2_typelabel = onoff2 ? label.new(x1_2 + (label_term2 * bar_index_duration), y1_2, xloc=xloc.bar_time, style=label.style_none, text=i_ma2, textcolor=line_color2) : na label.delete(ma2_typelabel[1]) alertcondition(ta.cross(close, _ma2_security), 'Price Crossing MA 2', 'Price has crossed multi-timeframe moving average #2.') //////////////////////////////////////////////////////////////////////////////// ////INPUTS FOR THIRD MOVING AVERAGE //DISPLAY LINES AND LABELS? onoff3 = input(defval=true, title='Display Line and Label?', group='Moving Average #3') //LOOKBACK i_ma3len = input.int(defval=9, title='Lookback', group='Moving Average #3') //TYPE i_ma3 = input.string(defval='EMA', options=['EMA', 'HMA', 'SMA', 'SMMA', 'VWMA', 'WMA'], title='Moving Average Type', group='Moving Average #3') ma3 = i_ma3 == 'EMA' ? ta.ema(close, i_ma3len) : i_ma3 == 'HMA' ? ta.hma(close, i_ma3len) : i_ma3 == 'SMA' ? ta.sma(close, i_ma3len) : i_ma3 == 'SMMA' ? ta.rma(close, i_ma3len) : i_ma3 == 'VWMA' ? ta.vwma(close, i_ma3len) : i_ma3 == 'WMA' ? ta.wma(close, i_ma3len) : na //RESOLUTION i_ma3res = input.string(defval='8h', options=['5m', '12m', '15m', '30m', '1h', '4h', '8h', '12h', 'D', '3D', '4D', 'W', 'M'], title='Resolution', group='Moving Average #3') ma3res = i_ma3res == '5m' ? '5' : i_ma3res == '12m' ? '12' : i_ma3res == '15m' ? '15' : i_ma3res == '30m' ? '30' : i_ma3res == '1h' ? '60' : i_ma3res == '4h' ? '240' : i_ma3res == '8h' ? '480' : i_ma3res == '12h' ? '720' : i_ma3res == 'D' ? 'D' : i_ma3res == '3D' ? '3D' : i_ma3res == '4D' ? '4D' : i_ma3res == 'W' ? 'W' : i_ma3res == 'M' ? 'M' : na // line_color3 = input(color.purple, title='Line Color', group='Moving Average #3') line_style3 = input.string(defval='Solid', options=['Dashed', 'Dotted', 'Solid'], title='Line Style', group='Moving Average #3') line_width3 = input.int(defval=1, maxval=4, title="Line Width", group='Moving Average #3') line_term3 = input(defval=25, title='Line Length', group='Moving Average #3') label_term3 = input(defval=20, title='MA Type Label Distance', group='Moving Average #3') // _ma3_security = request.security(syminfo.tickerid, ma3res, ma3) //LINES AND LABELS x1_3 = time y1_3 = _ma3_security x2_3 = time + (line_term * bar_index_duration) y2_3 = _ma3_security xloc3 = xloc.bar_time color3 = line_color3 style3 = line_style3 == 'Dotted' ? line.style_dotted : line_style3 == 'Dashed' ? line.style_dashed : line_style3 == 'Solid' ? line.style_solid : na ma3_line = onoff3 ? line.new(x1_3, y1_3, x2_3, y2_3, xloc3, color=color3, style=style3, width=line_width3) : na line.delete(ma3_line[1]) ma3_reslabel = onoff3 ? label.new(x2_3, y1_3, xloc=xloc.bar_time, style=label.style_none, text=i_ma3res, textcolor=line_color3) : na label.delete(ma3_reslabel[1]) ma3_typelabel = onoff3 ? label.new(x1_3 + (label_term3 * bar_index_duration), y1_3, xloc=xloc.bar_time, style=label.style_none, text=i_ma3, textcolor=line_color3) : na label.delete(ma3_typelabel[1]) alertcondition(ta.cross(close, _ma3_security), 'Price Crossing MA 3', 'Price has crossed multi-timeframe moving average #3.') //////////////////////////////////////////////////////////////////////////////// ////INPUTS FOR FOURTH MOVING AVERAGE //DISPLAY LINES AND LABELS? onoff4 = input(defval=true, title='Display Line and Label?', group='Moving Average #4') //LOOKBACK i_ma4len = input.int(defval=9, title='Lookback', group='Moving Average #4') //TYPE i_ma4 = input.string(defval='EMA', options=['EMA', 'HMA', 'SMA', 'SMMA', 'VWMA', 'WMA'], title='Moving Average Type', group='Moving Average #4') ma4 = i_ma4 == 'EMA' ? ta.ema(close, i_ma4len) : i_ma4 == 'HMA' ? ta.hma(close, i_ma4len) : i_ma4 == 'SMA' ? ta.sma(close, i_ma4len) : i_ma4 == 'SMMA' ? ta.rma(close, i_ma4len) : i_ma4 == 'VWMA' ? ta.vwma(close, i_ma4len) : i_ma4 == 'WMA' ? ta.wma(close, i_ma4len) : na //RESOLUTION i_ma4res = input.string(defval='D', options=['5m', '12m', '15m', '30m', '1h', '4h', '8h', '12h', 'D', '3D', '4D', 'W', 'M'], title='Resolution', group='Moving Average #4') ma4res = i_ma4res == '5m' ? '5' : i_ma4res == '12m' ? '12' : i_ma4res == '15m' ? '15' : i_ma4res == '30m' ? '30' : i_ma4res == '1h' ? '60' : i_ma4res == '4h' ? '240' : i_ma4res == '8h' ? '480' : i_ma4res == '12h' ? '720' : i_ma4res == 'D' ? 'D' : i_ma4res == '3D' ? '3D' : i_ma4res == '4D' ? '4D' : i_ma4res == 'W' ? 'W' : i_ma4res == 'M' ? 'M' : na // line_color4 = input(color.purple, title='Line Color', group='Moving Average #4') line_style4 = input.string(defval='Solid', options=['Dashed', 'Dotted', 'Solid'], title='Line Style', group='Moving Average #4') line_width4 = input.int(defval=1, maxval=4, title="Line Width", group='Moving Average #4') line_term4 = input(defval=25, title='Line Length', group='Moving Average #4') label_term4 = input(defval=20, title='MA Type Label Distance', group='Moving Average #4') // _ma4_security = request.security(syminfo.tickerid, ma4res, ma4) //LINES AND LABELS x1_4 = time y1_4 = _ma4_security x2_4 = time + (line_term * bar_index_duration) y2_4 = _ma4_security xloc4 = xloc.bar_time color4 = line_color4 style4 = line_style4 == 'Dotted' ? line.style_dotted : line_style4 == 'Dashed' ? line.style_dashed : line_style4 == 'Solid' ? line.style_solid : na ma4_line = onoff4 ? line.new(x1_4, y1_4, x2_4, y2_4, xloc4, color=color4, style=style4, width=line_width4) : na line.delete(ma4_line[1]) ma4_reslabel = onoff4 ? label.new(x2_4, y1_4, xloc=xloc.bar_time, style=label.style_none, text=i_ma4res, textcolor=line_color4) : na label.delete(ma4_reslabel[1]) ma4_typelabel = onoff4 ? label.new(x1_4 + (label_term4 * bar_index_duration), y1_4, xloc=xloc.bar_time, style=label.style_none, text=i_ma4, textcolor=line_color4) : na label.delete(ma4_typelabel[1]) alertcondition(ta.cross(close, _ma4_security), 'Price Crossing MA 4', 'Price has crossed multi-timeframe moving average #4.') //////////////////////////////////////////////////////////////////////////////// ////INPUTS FOR FIFTH MOVING AVERAGE //DISPLAY LINES AND LABELS? onoff5 = input(defval=true, title='Display Line and Label?', group='Moving Average #5') //LOOKBACK i_ma5len = input.int(defval=20, title='Lookback', group='Moving Average #5') //TYPE i_ma5 = input.string(defval='SMA', options=['EMA', 'HMA', 'SMA', 'SMMA', 'VWMA', 'WMA'], title='Moving Average Type', group='Moving Average #5') ma5 = i_ma5 == 'EMA' ? ta.ema(close, i_ma5len) : i_ma5 == 'HMA' ? ta.hma(close, i_ma5len) : i_ma5 == 'SMA' ? ta.sma(close, i_ma5len) : i_ma5 == 'SMMA' ? ta.rma(close, i_ma5len) : i_ma5 == 'VWMA' ? ta.vwma(close, i_ma5len) : i_ma5 == 'WMA' ? ta.wma(close, i_ma5len) : na //RESOLUTION i_ma5res = input.string(defval='1h', options=['5m', '12m', '15m', '30m', '1h', '4h', '8h', '12h', 'D', '3D', '4D', 'W', 'M'], title='Resolution', group='Moving Average #5') ma5res = i_ma5res == '5m' ? '5' : i_ma5res == '12m' ? '12' : i_ma5res == '15m' ? '15' : i_ma5res == '30m' ? '30' : i_ma5res == '1h' ? '60' : i_ma5res == '4h' ? '240' : i_ma5res == '8h' ? '480' : i_ma5res == '12h' ? '720' : i_ma5res == 'D' ? 'D' : i_ma5res == '3D' ? '3D' : i_ma5res == '4D' ? '4D' : i_ma5res == 'W' ? 'W' : i_ma5res == 'M' ? 'M' : na // line_color5 = input(color.orange, title='Line Color', group='Moving Average #5') line_style5 = input.string(defval='Solid', options=['Dashed', 'Dotted', 'Solid'], title='Line Style', group='Moving Average #5') line_width5 = input.int(defval=1, maxval=4, title="Line Width", group='Moving Average #5') line_term5 = input(defval=25, title='Line Length', group='Moving Average #5') label_term5 = input(defval=20, title='MA Type Label Distance', group='Moving Average #5') // _ma5_security = request.security(syminfo.tickerid, ma5res, ma5) //LINES AND LABELS x1_5 = time y1_5 = _ma5_security x2_5 = time + (line_term * bar_index_duration) y2_5 = _ma5_security xloc5 = xloc.bar_time color5 = line_color5 style5 = line_style5 == 'Dotted' ? line.style_dotted : line_style5 == 'Dashed' ? line.style_dashed : line_style5 == 'Solid' ? line.style_solid : na ma5_line = onoff5 ? line.new(x1_5, y1_5, x2_5, y2_5, xloc5, color=color5, style=style5, width=line_width5) : na line.delete(ma5_line[1]) ma5_reslabel = onoff5 ? label.new(x2_5, y1_5, xloc=xloc.bar_time, style=label.style_none, text=i_ma5res, textcolor=line_color5) : na label.delete(ma5_reslabel[1]) ma5_typelabel = onoff5 ? label.new(x1_5 + (label_term5 * bar_index_duration), y1_5, xloc=xloc.bar_time, style=label.style_none, text=i_ma5, textcolor=line_color5) : na label.delete(ma5_typelabel[1]) alertcondition(ta.cross(close, _ma5_security), 'Price Crossing MA 5', 'Price has crossed multi-timeframe moving average #5.') //////////////////////////////////////////////////////////////////////////////// ////INPUTS FOR SIXTH MOVING AVERAGE //DISPLAY LINES AND LABELS? onoff6 = input(defval=true, title='Display Line and Label?', group='Moving Average #6') //LOOKBACK i_ma6len = input.int(defval=20, title='Lookback', group='Moving Average #6') //TYPE i_ma6 = input.string(defval='SMA', options=['EMA', 'HMA', 'SMA', 'SMMA', 'VWMA', 'WMA'], title='Moving Average Type', group='Moving Average #6') ma6 = i_ma6 == 'EMA' ? ta.ema(close, i_ma6len) : i_ma6 == 'HMA' ? ta.hma(close, i_ma6len) : i_ma6 == 'SMA' ? ta.sma(close, i_ma6len) : i_ma6 == 'SMMA' ? ta.rma(close, i_ma6len) : i_ma6 == 'VWMA' ? ta.vwma(close, i_ma6len) : i_ma6 == 'WMA' ? ta.wma(close, i_ma6len) : na //RESOLUTION i_ma6res = input.string(defval='4h', options=['5m', '12m', '15m', '30m', '1h', '4h', '8h', '12h', 'D', '3D', '4D', 'W', 'M'], title='Resolution', group='Moving Average #6') ma6res = i_ma6res == '5m' ? '5' : i_ma6res == '12m' ? '12' : i_ma6res == '15m' ? '15' : i_ma6res == '30m' ? '30' : i_ma6res == '1h' ? '60' : i_ma6res == '4h' ? '240' : i_ma6res == '8h' ? '480' : i_ma6res == '12h' ? '720' : i_ma6res == 'D' ? 'D' : i_ma6res == '3D' ? '3D' : i_ma6res == '4D' ? '4D' : i_ma6res == 'W' ? 'W' : i_ma6res == 'M' ? 'M' : na // line_color6 = input(color.orange, title='Line Color', group='Moving Average #6') line_style6 = input.string(defval='Solid', options=['Dashed', 'Dotted', 'Solid'], title='Line Style', group='Moving Average #6') line_width6 = input.int(defval=1, maxval=4, title="Line Width", group='Moving Average #6') line_term6 = input(defval=25, title='Line Length', group='Moving Average #6') label_term6 = input(defval=20, title='MA Type Label Distance', group='Moving Average #6') // _ma6_security = request.security(syminfo.tickerid, ma6res, ma6) //LINES AND LABELS x1_6 = time y1_6 = _ma6_security x2_6 = time + (line_term * bar_index_duration) y2_6 = _ma6_security xloc6 = xloc.bar_time color6 = line_color6 style6 = line_style6 == 'Dotted' ? line.style_dotted : line_style6 == 'Dashed' ? line.style_dashed : line_style6 == 'Solid' ? line.style_solid : na ma6_line = onoff6 ? line.new(x1_6, y1_6, x2_6, y2_6, xloc6, color=color6, style=style6, width=line_width6) : na line.delete(ma6_line[1]) ma6_reslabel = onoff6 ? label.new(x2_6, y1_6, xloc=xloc.bar_time, style=label.style_none, text=i_ma6res, textcolor=line_color6) : na label.delete(ma6_reslabel[1]) ma6_typelabel = onoff6 ? label.new(x1_6 + (label_term6 * bar_index_duration), y1_6, xloc=xloc.bar_time, style=label.style_none, text=i_ma6, textcolor=line_color6) : na label.delete(ma6_typelabel[1]) alertcondition(ta.cross(close, _ma6_security), 'Price Crossing MA 6', 'Price has crossed multi-timeframe moving average #6.') //////////////////////////////////////////////////////////////////////////////// ////INPUTS FOR SEVENTH MOVING AVERAGE //DISPLAY LINES AND LABELS? onoff7 = input(defval=true, title='Display Line and Label?', group='Moving Average #7') //LOOKBACK i_ma7len = input.int(defval=20, title='Lookback', group='Moving Average #7') //TYPE i_ma7 = input.string(defval='SMA', options=['EMA', 'HMA', 'SMA', 'SMMA', 'VWMA', 'WMA'], title='Moving Average Type', group='Moving Average #7') ma7 = i_ma7 == 'EMA' ? ta.ema(close, i_ma7len) : i_ma7 == 'HMA' ? ta.hma(close, i_ma7len) : i_ma7 == 'SMA' ? ta.sma(close, i_ma7len) : i_ma7 == 'SMMA' ? ta.rma(close, i_ma7len) : i_ma7 == 'VWMA' ? ta.vwma(close, i_ma7len) : i_ma7 == 'WMA' ? ta.wma(close, i_ma7len) : na //RESOLUTION i_ma7res = input.string(defval='8h', options=['5m', '12m', '15m', '30m', '1h', '4h', '8h', '12h', 'D', '3D', '4D', 'W', 'M'], title='Resolution', group='Moving Average #7') ma7res = i_ma7res == '5m' ? '5' : i_ma7res == '12m' ? '12' : i_ma7res == '15m' ? '15' : i_ma7res == '30m' ? '30' : i_ma7res == '1h' ? '60' : i_ma7res == '4h' ? '240' : i_ma7res == '8h' ? '480' : i_ma7res == '12h' ? '720' : i_ma7res == 'D' ? 'D' : i_ma7res == '3D' ? '3D' : i_ma7res == '4D' ? '4D' : i_ma7res == 'W' ? 'W' : i_ma7res == 'M' ? 'M' : na // line_color7 = input(color.orange, title='Line Color', group='Moving Average #7') line_style7 = input.string(defval='Solid', options=['Dashed', 'Dotted', 'Solid'], title='Line Style', group='Moving Average #7') line_width7 = input.int(defval=1, maxval=4, title="Line Width", group='Moving Average #7') line_term7 = input(defval=25, title='Line Length', group='Moving Average #7') label_term7 = input(defval=20, title='MA Type Label Distance', group='Moving Average #7') // _ma7_security = request.security(syminfo.tickerid, ma7res, ma7) //LINES AND LABELS x1_7 = time y1_7 = _ma7_security x2_7 = time + (line_term * bar_index_duration) y2_7 = _ma7_security xloc7 = xloc.bar_time color7 = line_color7 style7 = line_style7 == 'Dotted' ? line.style_dotted : line_style7 == 'Dashed' ? line.style_dashed : line_style7 == 'Solid' ? line.style_solid : na ma7_line = onoff7 ? line.new(x1_7, y1_7, x2_7, y2_7, xloc7, color=color7, style=style7, width=line_width7) : na line.delete(ma7_line[1]) ma7_reslabel = onoff7 ? label.new(x2_7, y1_7, xloc=xloc.bar_time, style=label.style_none, text=i_ma7res, textcolor=line_color7) : na label.delete(ma7_reslabel[1]) ma7_typelabel = onoff7 ? label.new(x1_7 + (label_term7 * bar_index_duration), y1_7, xloc=xloc.bar_time, style=label.style_none, text=i_ma7, textcolor=line_color7) : na label.delete(ma7_typelabel[1]) alertcondition(ta.cross(close, _ma7_security), 'Price Crossing MA 7', 'Price has crossed multi-timeframe moving average #7.') //////////////////////////////////////////////////////////////////////////////// ////INPUTS FOR EIGHTH MOVING AVERAGE //DISPLAY LINES AND LABELS? onoff8 = input(defval=true, title='Display Line and Label?', group='Moving Average #8') //LOOKBACK i_ma8len = input.int(defval=20, title='Lookback', group='Moving Average #8') //TYPE i_ma8 = input.string(defval='SMA', options=['EMA', 'HMA', 'SMA', 'SMMA', 'VWMA', 'WMA'], title='Moving Average Type', group='Moving Average #8') ma8 = i_ma8 == 'EMA' ? ta.ema(close, i_ma8len) : i_ma8 == 'HMA' ? ta.hma(close, i_ma8len) : i_ma8 == 'SMA' ? ta.sma(close, i_ma8len) : i_ma8 == 'SMMA' ? ta.rma(close, i_ma8len) : i_ma8 == 'VWMA' ? ta.vwma(close, i_ma8len) : i_ma8 == 'WMA' ? ta.wma(close, i_ma8len) : na //RESOLUTION i_ma8res = input.string(defval='D', options=['5m', '12m', '15m', '30m', '1h', '4h', '8h', '12h', 'D', '3D', '4D', 'W', 'M'], title='Resolution', group='Moving Average #8') ma8res = i_ma8res == '5m' ? '5' : i_ma8res == '12m' ? '12' : i_ma8res == '15m' ? '15' : i_ma8res == '30m' ? '30' : i_ma8res == '1h' ? '60' : i_ma8res == '4h' ? '240' : i_ma8res == '8h' ? '480' : i_ma8res == '12h' ? '720' : i_ma8res == 'D' ? 'D' : i_ma8res == '3D' ? '3D' : i_ma8res == '4D' ? '4D' : i_ma8res == 'W' ? 'W' : i_ma8res == 'M' ? 'M' : na // line_color8 = input(color.orange, title='Line Color', group='Moving Average #8') line_style8 = input.string(defval='Solid', options=['Dashed', 'Dotted', 'Solid'], title='Line Style', group='Moving Average #8') line_width8 = input.int(defval=1, maxval=4, title="Line Width", group='Moving Average #8') line_term8 = input(defval=25, title='Line Length', group='Moving Average #8') label_term8 = input(defval=20, title='MA Type Label Distance', group='Moving Average #8') // _ma8_security = request.security(syminfo.tickerid, ma8res, ma8) //LINES AND LABELS x1_8 = time y1_8 = _ma8_security x2_8 = time + (line_term * bar_index_duration) y2_8 = _ma8_security xloc8 = xloc.bar_time color8 = line_color8 style8 = line_style8 == 'Dotted' ? line.style_dotted : line_style8 == 'Dashed' ? line.style_dashed : line_style8 == 'Solid' ? line.style_solid : na ma8_line = onoff8 ? line.new(x1_8, y1_8, x2_8, y2_8, xloc8, color=color8, style=style8, width=line_width8) : na line.delete(ma8_line[1]) ma8_reslabel = onoff8 ? label.new(x2_8, y1_8, xloc=xloc.bar_time, style=label.style_none, text=i_ma8res, textcolor=line_color8) : na label.delete(ma8_reslabel[1]) ma8_typelabel = onoff8 ? label.new(x1_8 + (label_term8 * bar_index_duration), y1_8, xloc=xloc.bar_time, style=label.style_none, text=i_ma8, textcolor=line_color8) : na label.delete(ma8_typelabel[1]) alertcondition(ta.cross(close, _ma8_security), 'Price Crossing MA 8', 'Price has crossed multi-timeframe moving average #8.') ////////////////////////////////////////////////////////////////////////////////
ATR Multiplier
https://www.tradingview.com/script/om06o3eR-ATR-Multiplier/
bjr117
https://www.tradingview.com/u/bjr117/
36
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © bjr117 //@version=5 indicator(title = "ATR Multiplier", shorttitle = "ATRX", overlay = false) //============================================================================== // Input Parameters //============================================================================== atr_length = input.int(14, title = "ATR Length", minval = 0, group = "ATR Indicator Settings") atr1_multiplier = input.float(1.5, title = "ATR Multiplier #1", minval = 0, group = "ATR Multiplier Settings") show_atr2 = input.bool(false, title = "Show 2nd ATR line?", group = "ATR Multiplier Settings") atr2_multiplier = input.float(3, title = "ATR Multiplier #2", minval = 0, group = "ATR Multiplier Settings") //============================================================================== //============================================================================== // ATR #1 and ATR #2 Calculation //============================================================================== // Calculate basic ATR value with given smoothing parameters atr = ta.rma(ta.tr, atr_length) // Multiply atr by the given atr1 multiplier to get atr1 atr1 = atr * atr1_multiplier // Multiply atr by the given atr2 multiplier to get atr2 atr2 = atr * atr2_multiplier //============================================================================== //============================================================================== // Plot ATR #1 and ATR #2 //============================================================================== atr1_color = show_atr2 ? color.red : color.new(#000000, 0) atr1_plot = plot(atr1, title = "ATR #1", color = atr1_color) atr2_plot = plot(show_atr2 ? atr2 : na, title = "ATR #2", color = color.green) //==============================================================================
VHF-Adaptive CCI [Loxx]
https://www.tradingview.com/script/OLahKvyK-VHF-Adaptive-CCI-Loxx/
loxx
https://www.tradingview.com/u/loxx/
39
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator(title="VHF-Adaptive CCI [Loxx]", shorttitle="VHFACCI [Loxx]", overlay = false, timeframe="", timeframe_gaps = true) greencolor = #2DD204 redcolor = #D2042D variant(type, src, len) => sig = 0.0 if type == "SMA" sig := ta.sma(src, len) else if type == "EMA" sig := ta.ema(src, len) else if type == "WMA" sig := ta.wma(src, len) else if type == "RMA" sig := ta.rma(src, len) sig _smoother(float src, len)=> wrk = src, wrk2 = src, wrk4 = src wrk0 = 0., wrk1 = 0., wrk3 = 0. alpha = 0.45 * (len - 1.0) / (0.45 * (len - 1.0) + 2.0) wrk0 := src + alpha * (nz(wrk[1]) - src) wrk1 := (src - wrk) * (1 - alpha) + alpha * nz(wrk1[1]) wrk2 := wrk0 + wrk1 wrk3 := (wrk2 - nz(wrk4[1])) * math.pow(1.0 - alpha, 2) + math.pow(alpha, 2) * nz(wrk3[1]) wrk4 := wrk3 + nz(wrk4[1]) wrk4 src = input(hlc3, title="Source", group = "Basic Settings") cciper = input.int(25, "CCI Period", minval=1, group = "Basic Settings") type = input.string("SMA", "Signal Smoothing Type", options = ["EMA", "WMA", "RMA", "SMA"], group = "Basic Settings") maper = input.int(7, "Signal Period", minval=1, group = "Basic Settings") showsignals = input.bool(false, "Show signals?", group = "UI Options") colorbars = input.bool(false, "Color bars?", group = "UI Options") vmax = ta.highest(src, cciper) vmin = ta.lowest(src, cciper) noise = math.sum(math.abs(ta.change(src)), cciper) vhf = (vmax - vmin) / noise len = nz(int(-math.log(vhf) * cciper), 1) len := len < 1 ? 1 : len ma = ta.sma(src, cciper) cci = _smoother((src - ma) / (0.015 * ta.dev(src, cciper)), len) maout = variant(type, cci, maper) plot(0, color = bar_index % 2 ? color.gray : na) colorout = cci > 0 ? greencolor : redcolor plot(cci, "CCI", color=colorout , linewidth = 2) plot(maout, "Signal", color = color.white) barcolor(colorbars ? colorout : na) goLong = ta.crossover(cci, 0) goShort = ta.crossunder(cci, 0) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="VHF-Adaptive CCI [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="VHF-Adaptive CCI [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
EMA Mountains
https://www.tradingview.com/script/A3cjYwbw-EMA-Mountains/
AndrewGlouberman
https://www.tradingview.com/u/AndrewGlouberman/
25
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © AndrewGlouberman //@version=5 indicator("EMA Mountain v2", overlay=false) show1 = input(true, "Show Mountain 1") len1 = input(7, "EMA Length 1") len2 = input(63, "EMA Length 2") show2 = input(false, "Show Mountain 2") len3 = input(126, "EMA Length 3") len4 = input(189, "EMA Length 4") show3 = input(false, "Show Mountain 3") len5 = input(252, "EMA Length 4") len6 = input(315, "EMA Length 5") show4 = input(false, "Show Mountain 4") len7 = input(7, "EMA Length 6") len8 = input(21, "EMA Length 7") ema1 = ta.ema(close, len1) ema2 = ta.ema(close, len2) ema1plot = plot(show1 ? ema1 : na, color=#7698f5, style=plot.style_line, linewidth=4, title="Drews Car") ema2plot = plot(show1 ? ema2 : na, color=#f00b0b, style=plot.style_line, linewidth=1, title="63 EMA") fill(ema1plot, ema2plot, color=ema1 > ema2 ? color.new(color.green, 80) : color.new(color.red, 80)) // ema3 = ta.ema(close, len3) ema4 = ta.ema(close, len4) ema3plot = plot(show2 ? ema3 : na, color=#4caf50, style=plot.style_line, linewidth=2, title="126 EMA") ema4plot = plot(show2 ? ema4 : na, color=#00bcd4, style=plot.style_line, linewidth=2, title="189 EMA") fill(ema3plot, ema4plot, color=ema3 > ema4 ? color.new(color.teal, 80) : color.new(color.red, 80)) // ema5 = ta.ema(close, len5) ema6 = ta.ema(close, len6) ema5plot = plot(show3 ? ema5 : na, color=#ffeb3b, style=plot.style_line, linewidth=3, title="252 EMA") ema6plot = plot(show3 ? ema6 : na, color=#f06292, style=plot.style_line, linewidth=3, title="315 EMA") fill(ema5plot, ema6plot, color=ema5 > ema6 ? color.new(color.yellow, 80) : color.new(color.red, 80)) // ema7 = ta.ema(close, len7) ema8 = ta.ema(close, len8) ema7plot = plot(show4 ? ema7 : na, color=#ffeb3b, style=plot.style_line, linewidth=3, title="7 EMA") ema8plot = plot(show4 ? ema8 : na, color=#f06292, style=plot.style_line, linewidth=3, title="21 EMA") fill(ema7plot, ema8plot, color=ema7 > ema8 ? color.new(color.yellow, 80) : color.new(color.red, 80))
nifty gann & 100 levels
https://www.tradingview.com/script/OuDoK7mj-nifty-gann-100-levels/
bumalla
https://www.tradingview.com/u/bumalla/
84
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © bumalla //@version=5 indicator('nifty gann & 100 levels', overlay=true) toadd = 0. incval = 0. selectedprice1 = 0. selectedprice2 = 0. selectedprice1 := input(title='Type Your Starting Gann Level', defval=17457.01) selectedprice2 := input(title='Type Your Starting Gann Level', defval=17424) incval := input(title='Increment Value', defval=33.01) toadd := math.abs(selectedprice1 - selectedprice2) line.new(bar_index, selectedprice1, bar_index[100], selectedprice1, width=2, color=color.green, style=line.style_dashed) for i = -25 to 5 by 1 line.new(bar_index, selectedprice1 + toadd * i, bar_index[100], selectedprice1 + toadd * i, width=1, color=color.black, style=line.style_dashed) toadd1 = 0. incval1 = 0. selectedprice3 = 0. selectedprice3 := input.float(title='Type Your Start 100 Level', defval=17000) incval1 := input.float(title='Increment Value', defval=100) toadd1 := incval1 line.new(bar_index, selectedprice3, bar_index[100], selectedprice3, width=2, color=color.red) for j = -7 to 7 by 1 line.new(bar_index, selectedprice3 + toadd1 * j, bar_index[100], selectedprice3 + toadd1 * j, width=2, color=color.red, style=line.style_solid) line.new(bar_index, selectedprice3 - toadd1 * j, bar_index[100], selectedprice3 - toadd1 * j, width=2, color=color.red, style=line.style_solid) [PDO,PDH,PDL,PDT] = request.security(syminfo.tickerid,"D", [open[1],high[1],low[1],time[1]]) var line l_pdh = na var line l_pdo = na var line l_pdl = na if barstate.islast l_pdh := line.new(bar_index - 1, PDH, bar_index, PDH, extend=extend.both, color=color.blue,width=2) l_pdl := line.new(bar_index - 1, PDL, bar_index, PDL, extend=extend.both, color=color.blue,width=2) l_pdl line.delete(l_pdh[1]) line.delete(l_pdl[1])
Koalafied RSI Decision Points
https://www.tradingview.com/script/8WWzVQDu-Koalafied-RSI-Decision-Points/
Koalafied_3
https://www.tradingview.com/u/Koalafied_3/
170
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TJ_667 // Momentum conditions as detailed in RSI : The Complete Guide by John Hayden // Decision points are conditions based on changes of these rsi values. Pauses in an uptrend, exiting high momentum values, breakouts and failures. // 2:1 momentum is associated with RSI values of 66.67 and 33.33 respectfully. In an Uptrend an RSI value of 40 should not be broken and in a downtrend // a RSI value of 60 should not be exceeded. If so, then there is buying/selling pressure in the opposite direction (but not necessarily enough for a trend reversal). // Alternatively it may show the presence of HTF traders. // 4:1 momentum (RSI values of 80/20) can be associated with extreme market conditions, typically thought of as being Overbought or Oversold. //@version=5 indicator('Koalafied RSI Decision Points', overlay=true) // ---------- INPUTS ---------- // var GRP1 = "INPUTS" len = input.int(14, minval=1, title='RSI Length', group = GRP1) var GRP2 = "PLOTS" showBG = input(true, 'Show RSI Background State', group = GRP2) showlines = input(true, "Show Decision Point Levels", group = GRP2) plot_sel = input.string(title='Plot Selection', defval='Both', options=['Both', 'Shapes', 'Candles'], group = GRP2) transp = input.int(92, "Background Transparency", minval = 0, maxval = 100, group = GRP2) // ---------- CALCS ---------- // rsi = ta.rsi(close, len) // Trend State var state = 0 if ta.crossover(rsi, 66.67) state := 1 state if ta.crossunder(rsi, 33.33) state := 2 state if state == 1 and ta.crossunder(rsi, 40) state := 3 state if state == 2 and ta.crossover(rsi, 60) state := 3 state state := state // Decision Point Conditions pause1 = state == 3 and state[1] == 1 pause2 = state == 3 and state[1] == 2 mom_bull = state == 1 and state[1] == 3 mom_bear = state == 2 and state[1] == 3 exit_bull = state == 1 and ta.crossunder(rsi, 66.67) exit_bear = state == 2 and ta.crossover(rsi, 33.33) failure_bullrev = state == 1 and ta.crossunder(rsi[1], 66.67) and ta.crossover(rsi, 66.67) failure_bearrev = state == 2 and ta.crossover(rsi[1], 33.33) and ta.crossunder(rsi, 33.33) var float pause_bull = na var float pause_bear = na pause_bull := pause1 ? low : pause_bull[1] pause_bear := pause2 ? high : pause_bear[1] candles = plot_sel == 'Candles' shapes = plot_sel == 'Shapes' both = plot_sel == 'Both' // ---------- PLOTS ---------- // // Plot Decision Points plot(showlines ? pause_bull : na, title = "Bull Decision Point Level", color = color.new(color.blue, 50), style = plot.style_circles) plot(showlines ? pause_bear : na, title = "Bear Decision Point Level", color = color.new(color.red, 50), style = plot.style_circles) plotshape(shapes or both ? pause1 : na, style=shape.square, location=location.belowbar, color=color.new(color.blue, 0)) plotshape(shapes or both ? pause2 : na, style=shape.square, location=location.abovebar, color=color.new(color.red, 0)) plotshape(shapes or both ? mom_bull : na, style=shape.triangleup, location=location.belowbar, color=color.new(color.blue, 0)) plotshape(shapes or both ? mom_bear : na, style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0)) plotshape(shapes or both ? exit_bull : na, style=shape.xcross, location=location.abovebar, color=color.new(color.orange, 0)) plotshape(shapes or both ? exit_bear : na, style=shape.xcross, location=location.belowbar, color=color.new(color.orange, 0)) plotshape(shapes or both ? failure_bullrev : na, style=shape.triangleup, location=location.belowbar, color=color.new(color.lime, 0)) plotshape(shapes or both ? failure_bearrev : na, style=shape.triangledown, location=location.abovebar, color=color.new(color.purple, 0)) candle_col = pause1 or mom_bull ? color.blue : pause2 or mom_bear ? color.red : exit_bull or exit_bear ? color.orange : failure_bullrev ? color.lime : failure_bearrev ? color.purple : na barcolor(candles or both ? candle_col : na) // Trend state_col = state == 1 ? color.new(color.blue, transp) : state == 2 ? color.new(color.red, transp) : na bgcolor(showBG ? state_col : na, title='Trend State') // 2:1 Momentum BG_col = rsi > 66.67 ? color.new(color.blue, transp) : rsi < 33.33 ? color.new(color.red, transp) : na bgcolor(showBG ? BG_col : na, title='Trend Momentum') // 4:1 Momentum OB = rsi > 80 ? color.new(color.red, transp) : na OS = rsi < 20 ? color.new(color.blue, transp) : na bgcolor(showBG ? OB : na, title='Overbought') bgcolor(showBG ? OS : na, title='Oversold')
Candle Count
https://www.tradingview.com/script/QKjPqAi7-Candle-Count/
hakum582
https://www.tradingview.com/u/hakum582/
20
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © hakum582 //@version=5 indicator("Price Action Vortex") //Candle Count strength g = close > open ? 1 : 0 r = close < open ? 1 : 0 lengthInput = input(5, "Length") plot(ta.ema(g,lengthInput),color = color.blue) plot(ta.ema(r,lengthInput),color = color.black)
watermark
https://www.tradingview.com/script/aK8NkHTy-watermark/
Ness92
https://www.tradingview.com/u/Ness92/
91
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Ness92 //@version=5 indicator("watermark", overlay=true) ///////////////////////////////////////////////// // FONTS ///////////////////////////////////////////////// //{ var FONT1 = array.new<string>(0) var FONT2 = array.new<string>(0) if barstate.isfirst array.push(FONT1, "░█████╗░,██████╗░,░█████╗░,██████╗░,███████╗,███████╗,░██████╗░,██╗░░██╗,██╗,░░░░░██╗,██╗░░██╗,██╗░░░░░,███╗░░░███╗,███╗░░██╗,░█████╗░,██████╗░,░██████╗░,██████╗░,░██████╗,████████╗,██╗░░░██╗,██╗░░░██╗,░██╗░░░░░░░██╗,██╗░░██╗,██╗░░░██╗,███████╗,░█████╗░,░░███╗░░,██████╗░,██████╗░,░░██╗██╗,███████╗,░█████╗░,███████╗,░█████╗░,░█████╗░,░░░░") array.push(FONT1, "██╔══██╗,██╔══██╗,██╔══██╗,██╔══██╗,██╔════╝,██╔════╝,██╔════╝░,██║░░██║,██║,░░░░░██║,██║░██╔╝,██║░░░░░,████╗░████║,████╗░██║,██╔══██╗,██╔══██╗,██╔═══██╗,██╔══██╗,██╔════╝,╚══██╔══╝,██║░░░██║,██║░░░██║,░██║░░██╗░░██║,╚██╗██╔╝,╚██╗░██╔╝,╚════██║,██╔══██╗,░████║░░,╚════██╗,╚════██╗,░██╔╝██║,██╔════╝,██╔═══╝░,╚════██║,██╔══██╗,██╔══██╗,░░░░") array.push(FONT1, "███████║,██████╦╝,██║░░╚═╝,██║░░██║,█████╗░░,█████╗░░,██║░░██╗░,███████║,██║,░░░░░██║,█████═╝░,██║░░░░░,██╔████╔██║,██╔██╗██║,██║░░██║,██████╔╝,██║██╗██║,██████╔╝,╚█████╗░,░░░██║░░░,██║░░░██║,╚██╗░██╔╝,░╚██╗████╗██╔╝,░╚███╔╝░,░╚████╔╝░,░░███╔═╝,██║░░██║,██╔██║░░,░░███╔═╝,░█████╔╝,██╔╝░██║,██████╗░,██████╗░,░░░░██╔╝,╚█████╔╝,╚██████║,░░░░") array.push(FONT1, "██╔══██║,██╔══██╗,██║░░██╗,██║░░██║,██╔══╝░░,██╔══╝░░,██║░░╚██╗,██╔══██║,██║,██╗░░██║,██╔═██╗░,██║░░░░░,██║╚██╔╝██║,██║╚████║,██║░░██║,██╔═══╝░,╚██████╔╝,██╔══██╗,░╚═══██╗,░░░██║░░░,██║░░░██║,░╚████╔╝░,░░████╔═████║░,░██╔██╗░,░░╚██╔╝░░,██╔══╝░░,██║░░██║,╚═╝██║░░,██╔══╝░░,░╚═══██╗,███████║,╚════██╗,██╔══██╗,░░░██╔╝░,██╔══██╗,░╚═══██║,░░░░") array.push(FONT1, "██║░░██║,██████╦╝,╚█████╔╝,██████╔╝,███████╗,██║░░░░░,╚██████╔╝,██║░░██║,██║,╚█████╔╝,██║░╚██╗,███████╗,██║░╚═╝░██║,██║░╚███║,╚█████╔╝,██║░░░░░,░╚═██╔═╝░,██║░░██║,██████╔╝,░░░██║░░░,╚██████╔╝,░░╚██╔╝░░,░░╚██╔╝░╚██╔╝░,██╔╝╚██╗,░░░██║░░░,███████╗,╚█████╔╝,███████╗,███████╗,██████╔╝,╚════██║,██████╔╝,╚█████╔╝,░░██╔╝░░,╚█████╔╝,░█████╔╝,░░░░") array.push(FONT1, "╚═╝░░╚═╝,╚═════╝░,░╚════╝░,╚═════╝░,╚══════╝,╚═╝░░░░░,░╚═════╝░,╚═╝░░╚═╝,╚═╝,░╚════╝░,╚═╝░░╚═╝,╚══════╝,╚═╝░░░░░╚═╝,╚═╝░░╚══╝,░╚════╝░,╚═╝░░░░░,░░░╚═╝░░░,╚═╝░░╚═╝,╚═════╝░,░░░╚═╝░░░,░╚═════╝░,░░░╚═╝░░░,░░░╚═╝░░░╚═╝░░,╚═╝░░╚═╝,░░░╚═╝░░░,╚══════╝,░╚════╝░,╚══════╝,╚══════╝,╚═════╝░,░░░░░╚═╝,╚═════╝░,░╚════╝░,░░╚═╝░░░,░╚════╝░,░╚════╝░,░░░░") array.push(FONT2, "╭━━━╮,╭━━╮╱,╭━━━╮,╭━━━╮,╭━━━╮,╭━━━╮,╭━━━╮,╭╮╱╭╮,╭━━╮,╱╱╭╮,╭╮╭━╮,╭╮╱╱╱,╭━╮╭━╮,╭━╮╱╭╮,╭━━━╮,╭━━━╮,╭━━━╮,╭━━━╮,╭━━━╮,╭━━━━╮,╭╮╱╭╮,╭╮╱╱╭╮,╭╮╭╮╭╮,╭━╮╭━╮,╭╮╱╱╭╮,╭━━━━╮,╭━━━╮,╱╭╮╱,╭━━━╮,╭━━━╮,╭╮╱╭╮,╭━━━╮,╭━━━╮,╭━━━╮,╭━━━╮,╭━━━╮,╱╱") array.push(FONT2, "┃╭━╮┃,┃╭╮┃╱,┃╭━╮┃,╰╮╭╮┃,┃╭━━╯,┃╭━━╯,┃╭━╮┃,┃┃╱┃┃,╰┫┣╯,╱╱┃┃,┃┃┃╭╯,┃┃╱╱╱,┃┃╰╯┃┃,┃┃╰╮┃┃,┃╭━╮┃,┃╭━╮┃,┃╭━╮┃,┃╭━╮┃,┃╭━╮┃,┃╭╮╭╮┃,┃┃╱┃┃,┃╰╮╭╯┃,┃┃┃┃┃┃,╰╮╰╯╭╯,┃╰╮╭╯┃,╰━━╮━┃,┃╭━╮┃,╭╯┃╱,┃╭━╮┃,┃╭━╮┃,┃┃╱┃┃,┃╭━━╯,┃╭━━╯,┃╭━╮┃,┃╭━╮┃,┃╭━╮┃,╱╱") array.push(FONT2, "┃┃╱┃┃,┃╰╯╰╮,┃┃╱╰╯,╱┃┃┃┃,┃╰━━╮,┃╰━━╮,┃┃╱╰╯,┃╰━╯┃,╱┃┃╱,╱╱┃┃,┃╰╯╯╱,┃┃╱╱╱,┃╭╮╭╮┃,┃╭╮╰╯┃,┃┃╱┃┃,┃╰━╯┃,┃┃╱┃┃,┃╰━╯┃,┃╰━━╮,╰╯┃┃╰╯,┃┃╱┃┃,╰╮┃┃╭╯,┃┃┃┃┃┃,╱╰╮╭╯╱,╰╮╰╯╭╯,╱╱╭╯╭╯,┃┃┃┃┃,╰╮┃╱,╰╯╭╯┃,╰╯╭╯┃,┃╰━╯┃,┃╰━━╮,┃╰━━╮,╰╯╭╯┃,┃╰━╯┃,┃╰━╯┃,╱╱") array.push(FONT2, "┃╰━╯┃,┃╭━╮┃,┃┃╱╭╮,╱┃┃┃┃,┃╭━━╯,┃╭━━╯,┃┃╭━╮,┃╭━╮┃,╱┃┃╱,╭╮┃┃,┃╭╮┃╱,┃┃╱╭╮,┃┃┃┃┃┃,┃┃╰╮┃┃,┃┃╱┃┃,┃╭━━╯,┃╰━╯┃,┃╭╮╭╯,╰━━╮┃,╱╱┃┃╱╱,┃┃╱┃┃,╱┃╰╯┃╱,┃╰╯╰╯┃,╱╭╯╰╮╱,╱╰╮╭╯╱,╱╭╯╭╯╱,┃┃┃┃┃,╱┃┃╱,╭━╯╭╯,╭╮╰╮┃,╰━━╮┃,╰━━╮┃,┃╭━╮┃,╱╱┃╭╯,┃╭━╮┃,╰━━╮┃,╱╱") array.push(FONT2, "┃╭━╮┃,┃╰━╯┃,┃╰━╯┃,╭╯╰╯┃,┃╰━━╮,┃┃╱╱╱,┃╰┻━┃,┃┃╱┃┃,╭┫┣╮,┃╰╯┃,┃┃┃╰╮,┃╰━╯┃,┃┃┃┃┃┃,┃┃╱┃┃┃,┃╰━╯┃,┃┃╱╱╱,╰━━╮┃,┃┃┃╰╮,┃╰━╯┃,╱╱┃┃╱╱,┃╰━╯┃,╱╰╮╭╯╱,╰╮╭╮╭╯,╭╯╭╮╰╮,╱╱┃┃╱╱,╭╯━┻━╮,┃╰━╯┃,╭╯╰╮,┃━━┻╮,┃╰━╯┃,╱╱╱┃┃,╭━━╯┃,┃╰━╯┃,╱╱┃┃╱,┃╰━╯┃,╭━━╯┃,╱╱") array.push(FONT2, "╰╯╱╰╯,╰━━━╯,╰━━━╯,╰━━━╯,╰━━━╯,╰╯╱╱╱,╰━━━╯,╰╯╱╰╯,╰━━╯,╰━━╯,╰╯╰━╯,╰━━━╯,╰╯╰╯╰╯,╰╯╱╰━╯,╰━━━╯,╰╯╱╱╱,╱╱╱╰╯,╰╯╰━╯,╰━━━╯,╱╱╰╯╱╱,╰━━━╯,╱╱╰╯╱╱,╱╰╯╰╯╱,╰━╯╰━╯,╱╱╰╯╱╱,╰━━━━╯,╰━━━╯,╰━━╯,╰━━━╯,╰━━━╯,╱╱╱╰╯,╰━━━╯,╰━━━╯,╱╱╰╯╱,╰━━━╯,╰━━━╯,╱╱") var FONT_REF = array.from("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"," ") //} ///////////////////////////////////////////////// // SETTINGS ///////////////////////////////////////////////// //{ WATERMARK_TEXT = input.string("YOUR TEXT", "Text") WATERMARK_STYLE = input.string("Type1", "Style", options=["Type1","Type2"]) WATERMARK_COLOR = input.color(color.new(color.gray,85), "Color") WATERMARK_SIZE_OPT = input.string("Normal", "Size", options=["Huge","Large","Normal","Small","Tiny"]) WATERMARK_POS_OPT = input.string("Middle-Center", "Position", options=["Bottom-Center","Bottom-Left","Bottom-Right","Middle-Center","Middle-Left","Middle-Right","Top-Center","Top-Left","Top-Right"]) WATERMARK_REP_ROW = input.int(1, "Repetition: Row ", 1, inline="repetition") WATERMARK_REP_COL = input.int(1, "Col ", 1, inline="repetition") WATERMARK_SPACING_H = input.int(1, "Spacing: H", 1, inline="spacing") WATERMARK_SPACING_V = input.int(1, "V", 1, inline="spacing") WATERMARK_FRAME = input.bool(true, "Enable frame") WATERMARK_SIZE = switch WATERMARK_SIZE_OPT "Huge" => size.huge "Large" => size.large "Normal" => size.normal "Small" => size.small "Tiny" => size.tiny WATERMARK_POS = switch WATERMARK_POS_OPT "Bottom-Center" => position.bottom_center "Bottom-Left" => position.bottom_left "Bottom-Right" => position.bottom_right "Middle-Center" => position.middle_center "Middle-Left" => position.middle_left "Middle-Right" => position.middle_right "Top-Center" => position.top_center "Top-Left" => position.top_left "Top-Right" => position.top_right FONT = switch WATERMARK_STYLE "Type1" => FONT1 "Type2" => FONT2 CHAR_FRAME_TOP = ( WATERMARK_FRAME == false )? "" : ( WATERMARK_STYLE == "Type1" )? "▀" : "━" CHAR_FRAME_TOP_LEFT = ( WATERMARK_FRAME == false )? "" : ( WATERMARK_STYLE == "Type1" )? "▛" : "┏" CHAR_FRAME_TOP_RIGHT = ( WATERMARK_FRAME == false )? "" : ( WATERMARK_STYLE == "Type1" )? "▜" : "┓" CHAR_FRAME_BOTTOM = ( WATERMARK_FRAME == false )? "" : ( WATERMARK_STYLE == "Type1" )? "▄" : "━" CHAR_FRAME_BOTTOM_LEFT = ( WATERMARK_FRAME == false )? "" : ( WATERMARK_STYLE == "Type1" )? "▙" : "┗" CHAR_FRAME_BOTTOM_RIGHT = ( WATERMARK_FRAME == false )? "" : ( WATERMARK_STYLE == "Type1" )? "▟" : "┛" CHAR_FRAME_LEFT = ( WATERMARK_FRAME == false )? "" : ( WATERMARK_STYLE == "Type1" )? "▌" : "┃" CHAR_FRAME_RIGHT = ( WATERMARK_FRAME == false )? "" : ( WATERMARK_STYLE == "Type1" )? "▐" : "┃" //} ///////////////////////////////////////////////// // MAIN ///////////////////////////////////////////////// var watermark_table = table.new(WATERMARK_POS, WATERMARK_REP_COL, WATERMARK_REP_ROW, na, na) gen_watermark(message) => msg = str.split(str.upper(message), "") idx_list = array.new<int>(0) for ii=0 to array.size(msg)-1 for jj=0 to array.size(FONT_REF)-1 if array.get(msg, ii) == array.get(FONT_REF, jj) array.push(idx_list, jj) break spacing_h = "" if (WATERMARK_REP_COL > 1) for jj=0 to WATERMARK_SPACING_H-1 spacing_h := spacing_h + "\t" watermark_width = 0 watermark_msg = "" for ii=0 to array.size(FONT)-1 watermark_msg := watermark_msg + spacing_h + CHAR_FRAME_LEFT font_line = str.split(array.get(FONT,ii), ",") for jj=0 to array.size(idx_list)-1 idx = array.get(idx_list, jj) watermark_msg := watermark_msg + array.get(font_line, idx) watermark_width := ( ii == 0 )? watermark_width + str.length(array.get(font_line, idx)) : watermark_width watermark_msg := watermark_msg + CHAR_FRAME_RIGHT + spacing_h + "\n" if( WATERMARK_FRAME == true ) frame_top = spacing_h + CHAR_FRAME_TOP_LEFT frame_bottom = spacing_h + CHAR_FRAME_BOTTOM_LEFT for ii=0 to watermark_width-1 frame_top := frame_top + CHAR_FRAME_TOP frame_bottom := frame_bottom + CHAR_FRAME_BOTTOM frame_top := frame_top + CHAR_FRAME_TOP_RIGHT frame_bottom := frame_bottom + CHAR_FRAME_BOTTOM_RIGHT watermark_msg := frame_top + "\n" + watermark_msg + frame_bottom for mm=0 to WATERMARK_REP_COL-1 for nn=0 to WATERMARK_REP_ROW-1 spacing_v = "" if (WATERMARK_REP_ROW > 1) and (nn < WATERMARK_REP_ROW-1) for jj=0 to WATERMARK_SPACING_V-1 spacing_v := spacing_v + "\n" table.cell(watermark_table, mm, nn, watermark_msg+spacing_v, text_color=WATERMARK_COLOR, text_halign=text.align_left, text_size=WATERMARK_SIZE) if barstate.islastconfirmedhistory gen_watermark(WATERMARK_TEXT)
kpatel 5 min orb bollinger band with vwap
https://www.tradingview.com/script/P8YzuZCi-kpatel-5-min-orb-bollinger-band-with-vwap/
keertikpatel
https://www.tradingview.com/u/keertikpatel/
33
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © sskcharts //@version=5 indicator(title='ORB-PreDay_PerM_Levels', shorttitle='ORB-PreDay_PerM_Levels', overlay=true) //User Input showORB = input(true, title='Show ORB', inline='1') showORBExt = input(true, title='Show ORB Extension (Select Ext Below)', inline='1') showExt1 = input(true, title='', inline='2') valueExt1 = input.float(161.8, "%", inline='2', options = [127.2, 161.8, 200, 261.8]) showExt2 = input(true, "", inline='2') valueExt2 = input.float(261.8, "%", inline='2', options = [127.2, 161.8, 200, 261.8]) showExt3 = input(true, "", inline='2') valueExt3 = input.float(200, "%", inline='2', options = [127.2, 161.8, 200, 261.8]) showPMHL = input(true, title='Show Pre-Market H/L', inline='3') aftermarket = input(title='Include After-Market', defval=false, inline='3') showPrevDayHighLow = input(true, title='Show previous day\'s High & Low') showPrev2DayHighLow = input(false, title='Show previous 2+ days High & Low') showPrevDayClose = input(true, title='Show previous day\'s Close') orbTimeFrame = input.timeframe("15", title='ORB timeframe') sessSpec = input.session('0930-1600', title='Session time') ORBHColor = input.color(title='ORBH Color', defval=color.new(#0bd68a, 30), inline='10') ORBLColor = input.color(title='ORBL Color', defval=color.new(#d3396d, 30), inline='10') PDHColor = input.color(title='PDH Color', defval=color.new(#81c784, 70), inline='11') PDLColor = input.color(title='PDL Color', defval=color.new(#f06292, 75), inline='11') PDCColor = input.color(title='PDC Color', defval=color.new(#2196f3, 20), inline='12') ORBExtColor = input.color(title='ORBExt Color', defval=color.new(#5d606b, 50), inline='13') PMHLColor = input.color(title='PMHL Color', defval=color.new(#ff9800, 10), inline='14') plotSignals = input(false, title='Show Buy/Sell Signal', inline='15') ORBWidth = input.int(title='', defval=1, minval=1, inline='10') PDHLWidth = input.int(title='', defval=3, minval=1, inline='11') PDCWidth = input.int(title='', defval=1, minval=1, inline='12') ORBExtWidth = input.int(title='', defval=2, minval=1, inline='13') PMHLWidth = input.int(title='', defval=1, minval=1, inline='14') ORBOption = input.string(title='', options=['solid', 'dotted', 'dashed'], defval='solid', inline='10') PDHLOption = input.string(title='', options=['solid', 'dotted', 'dashed'], defval='solid', inline='11') PDCOption = input.string(title='', options=['solid', 'dotted', 'dashed'], defval='dashed', inline='12') ORBExtOption = input.string(title='', options=['solid', 'dotted', 'dashed'], defval='solid', inline='13') PMHLOption = input.string(title='', options=['solid', 'dotted', 'dashed'], defval='dashed', inline='14') ORBStyle = ORBOption == 'dotted' ? line.style_dotted : ORBOption == 'dashed' ? line.style_dashed : line.style_solid PDHLStyle = PDHLOption == 'dotted' ? line.style_dotted : PDHLOption == 'dashed' ? line.style_dashed : line.style_solid PDCStyle = PDCOption == 'dotted' ? line.style_dotted : PDCOption == 'dashed' ? line.style_dashed : line.style_solid ORBExtStyle = ORBExtOption == 'dotted' ? line.style_dotted : ORBExtOption == 'dashed' ? line.style_dashed : line.style_solid PMHLStyle = PMHLOption == 'dotted' ? line.style_dotted : PMHLOption == 'dashed' ? line.style_dashed : line.style_solid // Get ORB t = ticker.new(syminfo.prefix, syminfo.ticker) getSeries(_e, _timeFrame) => request.security(t, _timeFrame, _e, lookahead=barmerge.lookahead_on) is_newbar(res, sess) => t1 = time(res, sess) na(t1[1]) and not na(t1) or t1[1] < t1 newbar = is_newbar('1440', sessSpec) var float orbH = na var float orbL = na if newbar orbH := getSeries(high[0], orbTimeFrame) orbH orbL := getSeries(low[0], orbTimeFrame) orbL // Get ORB Extension ORWidth = orbH-orbL orb_ext_up1 = orbH + ORWidth*((valueExt1/100)-1) orb_ext_down1 = orbL - ORWidth*((valueExt1/100)-1) orb_ext_up2= orbH + ORWidth*((valueExt2/100)-1) orb_ext_down2 = orbL - ORWidth*((valueExt2/100)-1) orb_ext_up3= orbH + ORWidth*((valueExt3/100)-1) orb_ext_down3 = orbL - ORWidth*((valueExt3/100)-1) //Previous Days High Low PrevDayHigh = getSeries(high[1], 'D') PrevDayLow = getSeries(low[1], 'D') PrevDayOpen = getSeries(open[1], 'D') PrevDayClose = getSeries(close[1], 'D') //Previous 2 Days High Low PrevDayHigh1 = getSeries(high[2], 'D') > PrevDayHigh ? getSeries(high[2], 'D') : getSeries(high[3], 'D') > PrevDayHigh ? getSeries(high[3], 'D') : na PrevDayLow1 = getSeries(low[2], 'D') < PrevDayLow ? getSeries(low[2], 'D') : getSeries(low[3], 'D') < PrevDayLow ? getSeries(low[3], 'D') : na PrevDayHigh2 = PrevDayHigh1 == getSeries(high[2], 'D') ? getSeries(high[3], 'D') > getSeries(high[2], 'D') ? getSeries(high[3], 'D') : getSeries(high[4], 'D') > getSeries(high[3], 'D') ? getSeries(high[4], 'D') : na : na PrevDayLow2 = PrevDayLow1 == getSeries(low[2], 'D') ? getSeries(low[3], 'D') < getSeries(low[2], 'D') ? getSeries(low[3], 'D') : getSeries(low[4], 'D') < getSeries(low[3], 'D') ? getSeries(low[4], 'D') : na : na //PM High Low ending_hour = 9 ending_minute = 30 // LastOnly = input(title="Last only", type=input.bool, defval=false) pmt = aftermarket == false ? time('1440', '0000-1530:23456') : time('1440', '1600-0000:23456') is_first = na(pmt[1]) and not na(pmt) or pmt[1] < pmt pm_high = float(na) pm_low = float(na) k = int(na) if is_first and barstate.isnew and (hour < ending_hour or hour >= 16 or hour == ending_hour and minute < ending_minute) pm_high := high pm_low := low pm_low else pm_high := pm_high[1] pm_low := pm_low[1] pm_low if high > pm_high and (hour < ending_hour or hour >= 16 or hour == ending_hour and minute < ending_minute) pm_high := high pm_high if low < pm_low and (hour < ending_hour or hour >= 16 or hour == ending_hour and minute < ending_minute) pm_low := low pm_low // Today's Session Start timestamp y = year(timenow) m = month(timenow) d = dayofmonth(timenow) d1 = d - 4 // Start & End time for Today start = timestamp(y, m, d, 09, 00) pmstart = timestamp(y, m, d, 04, 00) start1 = timestamp(y, m, d1, 09, 30) end = start + 86400000 pmend = start + 36000000 daysLeft = 0 _MilliSec_In_Day = 24 * 60 * 60 * 1000 if (60*hour(timenow)+minute(timenow)) < (60*hour(time)+minute(time)) daysLeft := math.floor((timenow - time) / _MilliSec_In_Day)+1 else daysLeft := math.floor((timenow - time) / _MilliSec_In_Day) //if daysLeft == 0 // daysLeft := daysLeft+1 orbstart = timestamp(y, m, d, 09, 00) orbend = orbstart + 25200000 if time < timestamp(y, m, d, 09, 30) orbstart := timestamp(y, m, d-daysLeft, 09, 00) orbend := orbstart + 25200000 else orbstart := timestamp(y, m, d, 09, 00) orbend := orbstart + 25200000 if time < timestamp(y, m, d, 04, 00) pmstart := timestamp(y, m, d-daysLeft, 04, 00) pmend := pmstart + 43200000 else pmstart := timestamp(y, m, d, 04, 00) pmend := pmstart + 43200000 // Plot only if session started isToday = timenow > start // Plot selected timeframe's High, Low & Avg // Plot lines if isToday if showORB _h = line.new(orbstart, orbH, orbend, orbH, xloc.bar_time, color=ORBHColor, style=ORBStyle, width=ORBWidth) line.delete(_h[1]) _l = line.new(orbstart, orbL, orbend, orbL, xloc.bar_time, color=ORBLColor, style=ORBStyle, width=ORBWidth) line.delete(_l[1]) if showORBExt if showExt1 _orb_ext_up1 = line.new(orbstart, orb_ext_up1, orbend, orb_ext_up1, xloc.bar_time, color=ORBExtColor, style=ORBExtStyle, width=ORBExtWidth) line.delete(_orb_ext_up1[1]) _orb_ext_down1 = line.new(orbstart, orb_ext_down1, orbend, orb_ext_down1, xloc.bar_time, color=ORBExtColor, style=ORBExtStyle, width=ORBExtWidth) line.delete(_orb_ext_down1[1]) if showExt2 _orb_ext_up2 = line.new(orbstart, orb_ext_up2, orbend, orb_ext_up2, xloc.bar_time, color=ORBExtColor, style=ORBExtStyle, width=ORBExtWidth) line.delete(_orb_ext_up2[1]) _orb_ext_down2 = line.new(orbstart, orb_ext_down2, orbend, orb_ext_down2, xloc.bar_time, color=ORBExtColor, style=ORBExtStyle, width=ORBExtWidth) line.delete(_orb_ext_down2[1]) if showExt3 _orb_ext_up3 = line.new(orbstart, orb_ext_up3, orbend, orb_ext_up3, xloc.bar_time, color=ORBExtColor, style=ORBExtStyle, width=ORBExtWidth) line.delete(_orb_ext_up3[1]) _orb_ext_down3 = line.new(orbstart, orb_ext_down3, orbend, orb_ext_down3, xloc.bar_time, color=ORBExtColor, style=ORBExtStyle, width=ORBExtWidth) line.delete(_orb_ext_down3[1]) if showPrevDayHighLow _pdh = line.new(start1, PrevDayHigh, end, PrevDayHigh, xloc.bar_time, color=PDHColor, style=PDHLStyle, width=PDHLWidth) line.delete(_pdh[1]) _pdl = line.new(start1, PrevDayLow, end, PrevDayLow, xloc.bar_time, color=PDLColor, style=PDHLStyle, width=PDHLWidth) line.delete(_pdl[1]) if showPrevDayClose _pdc = line.new(orbstart, PrevDayClose, orbend, PrevDayClose, xloc.bar_time, color=PDCColor, style=PDCStyle, width=PDCWidth) line.delete(_pdc[1]) if showPrev2DayHighLow _p2dh1 = line.new(start1, PrevDayHigh1, end, PrevDayHigh1, xloc.bar_time, color=PDHColor, style=PDHLStyle, width=PDHLWidth) line.delete(_p2dh1[1]) if showPrev2DayHighLow _p2dl1 = line.new(start1, PrevDayLow1, end, PrevDayLow1, xloc.bar_time, color=PDLColor, style=PDHLStyle, width=PDHLWidth) line.delete(_p2dl1[1]) if showPrev2DayHighLow _p2dh2 = line.new(start1, PrevDayHigh2, end, PrevDayHigh2, xloc.bar_time, color=PDHColor, style=PDHLStyle, width=PDHLWidth) line.delete(_p2dh2[1]) if showPrev2DayHighLow _p2dl2 = line.new(start1, PrevDayLow2, end, PrevDayLow2, xloc.bar_time, color=PDLColor, style=PDHLStyle, width=PDHLWidth) line.delete(_p2dl2[1]) if timenow > pmstart if showPMHL _pmh = line.new(pmstart, pm_high, pmend, pm_high, xloc.bar_time, color=PMHLColor, style=PMHLStyle, width=PMHLWidth) line.delete(_pmh[1]) _pml = line.new(pmstart, pm_low, pmend, pm_low, xloc.bar_time, color=PMHLColor, style=PMHLStyle, width=PMHLWidth) line.delete(_pml[1]) plotshape(plotSignals ? ta.crossover(close, orbH) : na, style=shape.triangleup, location=location.belowbar, color=color.new(color.blue, 0), text='Buy', textcolor=color.new(color.blue, 0)) plotshape(plotSignals ? ta.crossover(orbL, close) : na, style=shape.triangledown, location=location.abovebar, color=color.new(color.blue, 0), text='Sell', textcolor=color.new(color.blue, 0)) //indicator(title="Bollinger Bands", overlay=true, timeframe="", timeframe_gaps=true) length = input.int(20, minval=1) src = input(close, title="Source") mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev") basis = ta.sma(src, length) dev = mult * ta.stdev(src, length) upper = basis + dev lower = basis - dev offset = input.int(0, "Offset", minval = -500, maxval = 500) plot(basis, "Basis", color=#363A45, offset = offset) p1 = plot(upper, "Upper", color=#363A45, offset = offset) p2 = plot(lower, "Lower", color=#363A45, offset = offset) fill(p1, p2, title = "Background", color=color.rgb(33, 150, 243, 95)) plotvwap = input(title="plot VWAP", defval=true) //////////SMA////////// plotema5 = input(title="plot 5 SMA", defval=true) sma5 = ta.sma(close, 5) plot(plotema5 ==true ? sma5 : na, "5 SMA", color=#fcc703) plotema9 = input(title="plot 9 SMA", defval=true) sma9 = ta.sma(high, 9) plot(plotema9 ==true ? sma9 : na, "9 SMA", color=#4CAF50) //Intraday longCondition = ta.crossover(sma5, sma9) shortCondition = ta.crossunder(sma5, sma9) plotshape(longCondition, title='Buy Label', style=shape.labelup, location=location.belowbar, size=size.normal, text='Buy', textcolor=color.new(color.white, 0), color=color.new(color.green, 0)) plotshape(shortCondition, title='Sell Label', style=shape.labeldown, location=location.abovebar, size=size.normal, text='Sell', textcolor=color.new(color.white, 0), color=color.new(color.red, 0)) long = ta.crossover(sma9, basis) short = ta.crossunder(sma9, basis) plotchar(short, "short", "▼", location.abovebar, color=color.red, size = size.tiny) plotchar(long, "long", "▲", location.belowbar, color=color.green, size = size.tiny) //// CONVERGENCE //// plotema50 = input(title="plot 50 SMA", defval=true) sma50 = ta.sma(close, 50) plot(plotema50 ==true ? sma50 : na, "50 SMA", color=#dc7633) plotema100 = input(title="plot 100 SMA", defval=true) sma100 = ta.sma(close, 100) plot(plotema100 ==true ? sma100 : na, "100 SMA", color=#873600) plotema150 = input(title="plot 150 SMA", defval=true) sma150 = ta.sma(close, 150) plot(plotema150 ==true ? sma150 : na, "150 SMA", color=#3498db) plotema200 = input(title="plot 200 SMA", defval=true) sma200 = ta.sma(close, 200) plot(plotema200 ==true ? sma200 : na, "200 SMA", color=#186a3b) //////////VWAP//////////////// plot(timeframe.isintraday and plotvwap ==true ? ta.vwap : na , "VWAP", color=#f44336, linewidth=2)
CME Open
https://www.tradingview.com/script/cU6w9mJw-CME-Open/
nickmara
https://www.tradingview.com/u/nickmara/
23
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Unown //@version=5 indicator(title='CME Open', shorttitle='CME Open', overlay=true) plotCME = input.bool(false, title="CME Open Line") UTCTimeInput = input.string('0620-0621', title='SET TIME MANUALLY', tooltip='Write or Copy/Paste the correct time into the text box from the list of brokers provided below\nCheck the broker hovering on the info icon') br1 = input.string('0620-0621', title='List 1', tooltip='OANDA\nFOREX.COM\nSAXO\nGLOBALPRIME\nVANTAGE\nEASYMARKETS\nPHILLIPNOVA\nFXCM\nCURRENCYCOM\nCAPITALCOM') br2 = input.string('1020-1021', title='List 3', tooltip='PEPPERSTONE\nSKILLING\nIDC') br3 = input.string('1320-1321', title='List 4', tooltip='EIGHTCAP\nBLACKBULL\nFXOPEN') OpenValueTime = time('1', UTCTimeInput) var OpenPA = 0.0 if OpenValueTime if not OpenValueTime[1] OpenPA := open OpenPA plot(plotCME and not OpenValueTime ? OpenPA : na, title='CME Line', color=color.new(color.blue, 0), linewidth=1, style=plot.style_linebr)
EMA ON MA SET
https://www.tradingview.com/script/Tri1vvNE-EMA-ON-MA-SET/
adishaz
https://www.tradingview.com/u/adishaz/
37
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © adishaz //@version=5 indicator("EMA ON MA SET" ,shorttitle ='EMA ON MA', overlay = true) emaFastPeriod = input.int(13, title='EMA Fast', group='EMA1') ma(source, length, type) => switch type "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length) "HMA" => ta.hma(source, length) CALCemaFastPeriod = input.int(title = 'EMA Fast CALC', defval = 5, minval = 1, maxval = 1000, group='EMA1') typeMA = input.string(title = 'EMA Fast CALC type', defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group='EMA1') CALCemaFastValue = ma(close,CALCemaFastPeriod, typeMA) emaMediumPeriod = input.int(20, title='EMA Medium', group='EMA2') ma1(source, length, type) => switch type "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length) "HMA" => ta.hma(source, length) CALCemaMediumPeriod = input.int(8, title='EMA Medium CALC', group='EMA2') typeMA1 = input.string(title = 'EMA MEDIUM CALC type', defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group='EMA2') CALCemaMediumValue = ma1(close,CALCemaMediumPeriod, typeMA1) emaSlowPeriod = input.int(50, title='EMA Slow', group='EMA3') ma2(source, length, type) => switch type "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length) "HMA" => ta.hma(source, length) CALCemaSlowPeriod = input.int(13, title='EMA Medium CALC', group='EMA3') typeMA2 = input.string(title = 'EMA SLOW CALC type', defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group='EMA3') CALCemaSlowValue = ma2(close,CALCemaSlowPeriod, typeMA2) emaSslowPeriod = input.int(100, title='EMA Sslow', group='EMA4') ma3(source, length, type) => switch type "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length) "HMA" => ta.hma(source, length) CALCemaSslowPeriod = input.int(20, title='EMA Sslow CALC', group='EMA4') typeMA3 = input.string(title = 'EMA SLOW CALC type', defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group='EMA4') CALCemaSslowValue = ma3(close,CALCemaSslowPeriod, typeMA3) emaSsslowPeriod = input.int(200, title='EMA Ssslow', group='EMA5') ma4(source, length, type) => switch type "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length) "HMA" => ta.hma(source, length) CALCemaSsslowPeriod = input.int(50,title='EMA Sslow CALC', group='EMA5') typeMA4 = input.string(title = 'EMA SLOW CALC type', defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group='EMA5') CALCemaSsslowValue = ma4(close,CALCemaSsslowPeriod, typeMA4) //EMA emaFastValue = ta.ema(CALCemaFastValue, emaFastPeriod) emaMediumValue = ta.ema(CALCemaMediumValue, emaMediumPeriod) emaSlowValue = ta.ema(CALCemaSlowValue, emaSlowPeriod) emaSslowValue = ta.ema(CALCemaSslowValue, emaSslowPeriod) emaSsslowValue = ta.ema(CALCemaSsslowValue, emaSsslowPeriod) plot(emaFastValue, color=color.new(color.white, 0), linewidth=2, style=plot.style_line, title='EMA Fast') plot(emaMediumValue, color=color.new(color.orange, 0), linewidth=2, style=plot.style_line, title='EMA Medium') plot(emaSlowValue, color=color.new(color.purple, 0), linewidth=2, style=plot.style_line, title='EMA SLow') plot(emaSslowValue, color=color.new(color.yellow, 0), linewidth=2, style=plot.style_line, title='EMA SsLow') plot(emaSsslowValue, color=color.new(color.red, 0), linewidth=2, style=plot.style_line, title='EMA SssLow') CROSS1 = ta.crossover( emaFastValue, emaMediumValue) or ta.crossover( emaFastValue, emaSlowValue ) or ta.crossover( emaFastValue, emaSslowValue ) or ta.crossover( emaFastValue, emaSsslowValue ) CROSS11 = ta.crossunder( emaFastValue, emaMediumValue) or ta.crossunder( emaFastValue, emaSlowValue ) or ta.crossunder( emaFastValue, emaSslowValue ) or ta.crossunder( emaFastValue, emaSsslowValue ) plot(CROSS1 ? emaFastValue : na ,title='EMA1 GOLDENCROSS', color=color.silver, style = plot.style_circles, linewidth = 5) plot(CROSS11 ? emaFastValue : na,title='EMA1 DEATHCROSS' , color=color.red, style = plot.style_cross, linewidth = 4) CROSS2 = ta.crossover( emaMediumValue, emaSlowValue ) or ta.crossover( emaMediumValue, emaSslowValue ) or ta.crossover( emaMediumValue, emaSsslowValue ) CROSS22 = ta.crossunder( emaMediumValue, emaSlowValue ) or ta.crossunder( emaMediumValue, emaSslowValue ) or ta.crossunder( emaMediumValue, emaSsslowValue ) plot(CROSS2 ? emaMediumValue : na ,title='EMA2 GOLDENCROSS', color=color.silver, style = plot.style_circles, linewidth = 5) plot(CROSS22 ? emaMediumValue : na,title='EMA2 DEATHCROSS' , color=color.red, style = plot.style_cross, linewidth = 4) CROSS3 = ta.crossover( emaSlowValue, emaSslowValue ) or ta.crossover( emaSlowValue, emaSsslowValue ) CROSS33 = ta.crossunder( emaSlowValue, emaSslowValue ) or ta.crossunder( emaSlowValue, emaSsslowValue ) plot(CROSS3 ? emaSlowValue : na ,title='EMA3 GOLDENCROSS', color=color.silver, style = plot.style_circles, linewidth = 5) plot(CROSS33 ? emaSlowValue : na,title='EMA3 DEATHCROSS' , color=color.red, style = plot.style_cross, linewidth = 4) CROSS4 = ta.crossover( emaSslowValue, emaSsslowValue ) CROSS44 = ta.crossunder( emaSslowValue, emaSsslowValue ) plot(CROSS4 ? emaSslowValue : na,title='EMA4 GOLDENCROSS' , color=color.silver, style = plot.style_circles, linewidth = 5) plot(CROSS44 ? emaSslowValue : na,title='EMA4 DEATHCROSS' , color=color.red, style = plot.style_cross, linewidth = 4)
Carrey's Structure Supply and Demand
https://www.tradingview.com/script/Bpa6xYvj-Carrey-s-Structure-Supply-and-Demand/
CarreyTrades
https://www.tradingview.com/u/CarreyTrades/
325
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © CarreyTrades //@version=5 indicator("Carrey's Structure Supply and Demand", shorttitle="Structure S/D", overlay=true) // Inputs bigbar = input.int(68, title="Big Bar Body Size", minval=0, maxval=100, tooltip="This is the percentage of the full candle size that the body must be to consider it a Big Bar") smallbar = input.int(20, title="Big Bar Body Size", minval=0, maxval=100, tooltip="This is the percentage of the full candle size that the body must be to consider it a Small Bar") Offset = input.int(25, title="Box Width", minval=0) eRBR = input.bool(true, "Rally Base Rally") eDBD = input.bool(true, "Drop Base Drop") eDBR = input.bool(true, "Drop Base Rally") eRBD = input.bool(true, "Rally Base Drop") labels = input.bool(false, title="Enable Labels") var extendRight = input(false, 'Extend Boxes Right', inline="extend", group="BB Course Indicators") // Calculations bigb = bigbar / 100 // Convert input to decimal smallb = smallbar / 100 // Convert input to decimal rng = high - low body = math.abs(open - close) size = body / rng bull = open < close bear = close < open big = size >= bigb ? true : false small = size <= smallb ? true : false up = high[1] < high dn = low[1] > low rallyc = bull and big and up ? true : false dropc = bear and big and dn ? true : false basec = small ? true : false //plotshape(rallyc, title="Rally Bar", style=shape.labelup, location=location.belowbar, color=color.green, text="Rally", textcolor=color.white) //plotshape(basec, title="Base Bar", style=shape.labelup, location=location.belowbar, color=color.yellow, text="Base", textcolor=color.white) //plotshape(dropc, title="Drop Bar", style=shape.labeldown, location=location.abovebar, color=color.red, text="Drop", textcolor=color.white) // Base Rules bullret = (high[1] - (rng[1] / 2)) > low bearret = (low[1] + (rng[1] / 2)) < high bullext = (high[1] + (rng[1] / 4)) < high bearext = (low[1] - (rng[1] / 4)) > low bubase = small and not(bullret or bullext) ? true : false bebase = small and not(bearret or bearext) ? true : false base1 = bubase or bebase ? true : false bui = high[1] > high and not(bullret) ? true : false bei = low[1] < low and not(bearret) ? true : false base2 = bui or bei ? true : false base3 = base1[1] or base2[1] ? basec ? true : false : false base4 = base3[1] ? basec ? true : false : false base5 = base4[1] ? basec ? true : false : false base = base1 or base2 or base3 or base4 or base5 // Structure Logic Rally = rallyc ? true : false Drop = dropc ? true : false BaseUp = (Rally[1] and base) or (Rally[2] and base and base[1]) or (Rally[3] and base and base[1] and base[2]) or (Rally[4] and base and base[1] and base[2] and base[3]) ? true : false BaseDn = (Drop[1] and base) or (Drop[2] and base and base[1]) or (Drop[3] and base and base[1] and base[2]) or (Drop[4] and base and base[1] and base[2] and base[3]) ? true : false RBR = eRBR ? (BaseUp[1] and rallyc ? true : false) : na DBD = eDBD ? (BaseDn[1] and dropc ? true : false) : na DBR = eDBR ? (BaseDn[1] and rallyc ? true : false) : na RBD = eRBD ? (BaseUp[1] and dropc ? true : false) : na // Plot Structures plotshape(labels ? RBR : na, title="RBR", style=shape.labelup, location=location.belowbar, color=color.green, text="RBR", textcolor=color.white) plotshape(labels ? DBD : na, title="DBD", style=shape.labeldown, location=location.abovebar, color=color.red, text="DBD", textcolor=color.white) plotshape(labels ? DBR : na, title="DBR", style=shape.labelup, location=location.belowbar, color=color.orange, text="DBR", textcolor=color.white) plotshape(labels ? RBD : na, title="RBD", style=shape.labeldown, location=location.abovebar, color=color.orange, text="RBD", textcolor=color.white) var extending = extend.none if extendRight extending := extend.right if RBR or DBR box.new(bar_index - 1 , high[1], bar_index + Offset, low[1], border_color = color.green, bgcolor = color.new(color.green, 60), extend=extending) if DBD or RBD box.new(bar_index - 1 , low[1], bar_index + Offset, high[1], border_color = color.red, bgcolor = color.new(color.red, 60), extend=extending)
CHART BTC
https://www.tradingview.com/script/pVyfIZIv/
KFOO_VIP
https://www.tradingview.com/u/KFOO_VIP/
88
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © thrmohamed10 //@version=5 indicator("btc") close1 = request.security("BTCUSDT","",close) plot(close1)
LLHC/HHLC - Simple Arrows
https://www.tradingview.com/script/8bAC7ILf-LLHC-HHLC-Simple-Arrows/
Sateriok
https://www.tradingview.com/u/Sateriok/
31
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © sateriok //@version=5 //We have two strategies //HHLC and LLHC //Higher High and Lower Close is a reversal candle for an uptrend (Puts) //Lower Low and Higher Close is a reversal candle for a downtrend (Calls) indicator('LLHC/HHLC', overlay = true) LLHC = low < low[1] and close > close[1] HHLC = high > high[1] and close < close[1] plotshape(LLHC, color = color.green, style = shape.triangleup, size = size.small) plotshape(HHLC, color = color.red, style = shape.triangledown, size = size.small)
Williams %R w/ Bollinger Bands [Loxx]
https://www.tradingview.com/script/NXLHSxtw-Williams-R-w-Bollinger-Bands-Loxx/
loxx
https://www.tradingview.com/u/loxx/
421
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Williams %R w/ Bollinger Bands [Loxx]", overlay = false, shorttitle="WPRBB [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D _pr(src, len) => max = ta.highest(len) min = ta.lowest(len) temp = 100 * (src - max) / (max - min) temp variant(type, src, len) => sig = 0.0 if type == "SMA" sig := ta.sma(src, len) else if type == "EMA" sig := ta.ema(src, len) else if type == "WMA" sig := ta.wma(src, len) else if type == "RMA" sig := ta.rma(src, len) sig f_bb(type, src, length, mult) => float basis = variant(type, src, length) float dev = mult * ta.stdev(src, length) [basis, basis + dev, basis - dev] src = input.source(close, "WPR Source", group = "Williams %R Settings") per = input.int(25, "WPR Period", group = "Williams %R Settings") MA_Period= input.int(3, "WPR Smoothing Period", group = "Williams %R Settings") type = input.string("SMA", "WPR Smoothing Type", options = ["EMA", "WMA", "RMA", "SMA"], group = "Williams %R Settings") BB_Period= input.int(89, "BB Period", group = "Bollinger Bands Settings") BB_Div = input.float(1., "BB Multiplier", group = "Bollinger Bands Settings") bbtype = input.string("SMA", "BB MA Type", options = ["EMA", "WMA", "RMA", "SMA"], group = "Bollinger Bands Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") out = (_pr(src, per) + 50.0) * 2.0 out := variant(type, out, MA_Period) [middle, upper, lower] = f_bb(bbtype, out, BB_Period, BB_Div) colorout = out > upper ? greencolor : out < lower ? redcolor : color.gray outpl = plot(out, color = colorout, linewidth = 2) plot(middle, color = color.white) uppl = plot(upper, color = greencolor) dnpl = plot(lower, color = redcolor) fill(outpl, uppl, color = out > upper ? greencolor : na) fill(outpl, dnpl, color = out < lower ? redcolor : na) plot(60, color = bar_index % 2 ? color.gray : na) plot(0, color = bar_index % 2 ? color.gray : na) plot(-60, color = bar_index % 2 ? color.gray : na) goLong = ta.crossover(out, upper) goShort = ta.crossunder(out, lower) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="Williams %R w/ Bollinger Bands [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="Williams %R w/ Bollinger Bands [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}") barcolor(colorbars ? colorout : na)
Visible Range Mean Deviation Histogram [LuxAlgo]
https://www.tradingview.com/script/AEh4XKbZ-Visible-Range-Mean-Deviation-Histogram-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
2,661
study
5
CC-BY-NC-SA-4.0
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // © LuxAlgo //@version=5 indicator("Visible Range Mean Deviation Histogram [LuxAlgo]", "VRMDH [LuxAlgo]" , overlay = true , max_boxes_count = 500) //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ rows = input.int(10, "Bins Per Side" , minval = 1) mult = input.float(2, "Deviation Multiplier" , minval = 0) //Style rel = input(true, "Relative" , inline = 'inline0' , group = 'Style') width = input.float(30 , minval = 0 , maxval = 100 , inline = 'inline0' , group = 'Style') up_css = input.color(#0cb51a, "Bin Colors" , inline = 'inline1' , group = 'Style') dn_css = input.color(#ff1100, "" , inline = 'inline1' , group = 'Style') poc = input(true, "Show POCs" , group = 'Style') //-----------------------------------------------------------------------------} //Calculations //-----------------------------------------------------------------------------{ var csum1 = 0. var csum2 = 0. var idx = 0 n = bar_index left = chart.left_visible_bar_time right = chart.right_visible_bar_time if time >= left and time <= right csum1 += close csum2 += close * close idx += 1 //Display Histogram if time == right //Calculate mean/standard deviation mean1 = csum1 / idx mean2 = csum2 / idx dev = math.sqrt(mean2 - mean1 * mean1) * mult / rows //Highlight upper/lower extremities line.new(left, mean1 + dev*rows, right, mean1 + dev*rows , color = up_css , style = line.style_dashed , xloc = xloc.bar_time) line.new(left, mean1 - dev*rows, right, mean1 - dev*rows , color = dn_css , style = line.style_dashed , xloc = xloc.bar_time) //Count prices values within bins upper_bins_count = array.new_int(0) lower_bins_count = array.new_int(0) upper_levels = array.new_float(0) lower_levels = array.new_float(0) sum_dev = dev upper_prev = mean1 lower_prev = mean1 for i = 0 to rows-1 sum_up = 0 sum_dn = 0 upper = mean1 + sum_dev lower = mean1 - sum_dev array.push(upper_levels, upper) array.push(lower_levels, lower) for j = 0 to idx-1 sum_up := high[j] >= upper_prev and low[j] < upper ? sum_up + 1 : sum_up sum_dn := low[j] <= lower_prev and high[j] > lower ? sum_dn + 1 : sum_dn array.push(upper_bins_count, sum_up) array.push(lower_bins_count, sum_dn) sum_dev += dev upper_prev += dev lower_prev -= dev //Display bins incr_mult = 0. upper_prev := mean1 lower_prev := mean1 max_up = array.max(upper_bins_count) max_dn = array.max(lower_bins_count) max = math.max(max_up, max_dn) for i = 0 to rows-1 upper_right = 0 lower_right = 0 get_up_bin = array.get(upper_bins_count, i) get_dn_bin = array.get(lower_bins_count, i) upper = array.get(upper_levels, i) lower = array.get(lower_levels, i) incr_mult += mult / rows if rel upper_right := math.round(get_up_bin / max * width / 100 * (idx - 1)) lower_right := math.round(get_dn_bin / max * width / 100 * (idx - 1)) else upper_right := get_up_bin lower_right := get_dn_bin //Upper side bins box.new(n - idx + 1, upper, n - idx + 1 + upper_right, upper_prev , border_color = up_css , bgcolor = color.new(up_css, 90) , text = '+' + str.tostring(incr_mult, '#.##') , text_color = up_css , text_halign = text.align_left) if get_up_bin == max_up and poc avg = math.avg(upper, upper_prev) line.new(n - idx + 1 + upper_right, avg, n, avg , color = up_css , style = line.style_dotted) //Lower side bins box.new(n - idx + 1, lower_prev, n - idx + 1 + lower_right, lower , border_color = dn_css , bgcolor = color.new(dn_css, 90) , text = '-' + str.tostring(incr_mult, '#.##') , text_color = dn_css , text_halign = text.align_left) if get_dn_bin == max_dn and poc avg = math.avg(lower, lower_prev) line.new(n - idx + 1 + lower_right, avg, n, avg , color = dn_css , style = line.style_dotted) upper_prev := upper lower_prev := lower //-----------------------------------------------------------------------------}
Price Action Top/Bottom
https://www.tradingview.com/script/P0Cr4yFW/
MRFILARDI
https://www.tradingview.com/u/MRFILARDI/
971
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © MRFILARDI //@version=5 indicator("Top/Bottom", overlay=true) devTooltip = "Deviation is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot." depthTooltip = "The minimum number of bars that will be taken into account when calculating the indicator." // pivots threshold threshold_multiplier = input.float(title="Deviation", defval=2, minval=0, tooltip=devTooltip) dev_threshold = ta.atr(10) / close * 100 * threshold_multiplier depth = input.int(title="Depth", defval=17, minval=1, tooltip=depthTooltip) LineColor = input.color(color.new(color.gray,0),"Line Color") deleteLastLine = input(false, "Show Lines") ShapePlot = input (true, "Plot marks") var line lineLast = na var int iLast = 0 var int iPrev = 0 var float pLast = 0 var isHighLast = false // otherwise the last pivot is a low pivot var top = false var bottom = false pivots(src, length, isHigh) => l2 = length c = nz(src[length]) ok = true for i = 0 to l2 if isHigh and src[i] > c ok := false if not isHigh and src[i] < c ok := false if ok [bar_index[length], c] else [int(na), float(na)] [iH, pH] = pivots(high, depth , true) [iL, pL] = pivots(low, depth , false) calc_dev(base_price, price) => 100 * (price - base_price) / price pivotFound(dev, isHigh, index, price) => pivotH = false if isHighLast == isHigh and not na(lineLast) // same direction if isHighLast ? price > pLast : price < pLast pivotH := true line.set_xy2(lineLast, index, price) [lineLast, isHighLast] else [line(na), bool(na)] else // reverse the direction (or create the very first line) if math.abs(dev) > dev_threshold // price move is significant id = line.new(iLast, pLast, index, price, color=LineColor, width=2, style=line.style_dashed) if ShapePlot if pLast > price label.new(iLast,high, color=color.red, yloc=yloc.abovebar) else label.new(iLast,low, color=color.green, yloc=yloc.belowbar) [id, isHigh] else [line(na), bool(na)] if not na(iH) dev = calc_dev(pLast, pH) [id, isHigh] = pivotFound(dev, true, iH, pH) if not na(id) if id != lineLast and not deleteLastLine line.delete(lineLast) lineLast := id isHighLast := isHigh iPrev := iLast iLast := iH pLast := pH else if not na(iL) dev = calc_dev(pLast, pL) [id, isHigh] = pivotFound(dev, false, iL, pL) if not na(id) if id != lineLast and not deleteLastLine line.delete(lineLast) lineLast := id isHighLast := isHigh iPrev := iLast iLast := iL pLast := pL //if ShapePlot // plotshape(iLast, style=shape.arrowup) //plotshape(top, style=shape.arrowdown,color=color.red, location=location.abovebar) //plotshape(bottom, style=shape.arrowup,color=color.green, location=location.belowbar)
High/Low Indicator
https://www.tradingview.com/script/l8oWj4gQ-High-Low-Indicator/
lazy_capitalist
https://www.tradingview.com/u/lazy_capitalist/
101
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © lazy_capitalist //@version=5 indicator("High/Low Indicator", overlay=true) highGroup = "High Settings" highSource = input.source( title="High Source", defval=high, group=highGroup) highLookbackInput = input.int( title="High Lookback Period", defval=28, group=highGroup) lowGroup = "Low Settings" lowSource = input.source( title="Low Source", defval=low, group=lowGroup) lowLookbackInput = input.int( title="Low Lookback Period", defval=55, group=lowGroup) // #################### [ Technicals ] ##################### highest = ta.highest(highSource, highLookbackInput) lowest = ta.lowest(lowSource, lowLookbackInput) // #################### [ Plots ] ##################### plot( title="High", series=highest, color=color.green) plot( title="Low", series=lowest, color=color.red)
Smoothed Repulse w/ Floating Levels [Loxx]
https://www.tradingview.com/script/7T29wwVD-Smoothed-Repulse-w-Floating-Levels-Loxx/
loxx
https://www.tradingview.com/u/loxx/
65
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Smoothed Repulse w/ Floating Levels [Loxx]", shorttitle = "SRFL [Loxx]", overlay = false, timeframe="", timeframe_gaps = true) variant(type, src, len) => sig = 0.0 if type == "SMA" sig := ta.sma(src, len) else if type == "EMA" sig := ta.ema(src, len) else if type == "WMA" sig := ta.wma(src, len) else if type == "RMA" sig := ta.rma(src, len) sig greencolor = #2DD204 redcolor = #D2042D per = input.int(14, 'Period', group = "Basic Settings") type = input.string("EMA", "Smoothing Type", options = ["EMA", "WMA", "RMA", "SMA"], group = "Basic Settings") avgmult = input.int(5, 'Average Multiplier', group = "Floating Levels Settings") lvlper = input.int(50, 'Level Period', group = "Floating Levels Settings") upper = input.float(90, 'Upper Level %', group = "Floating Levels Settings") dnper = input.float(10, 'Lower Level %', group = "Floating Levels Settings") colortype = input.string("Middle Cross", "Signal Type", options = ["Level Cross", "Middle Cross", "Slope"], group = "Signal Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showfloat = input.bool(true, "Show Floating Levels?", group = "UI Options") showfill = input.bool(true, "Fil Floating Levels?", group = "UI Options") showSigs = input.bool(false, "Show signals?", group= "UI Options") min = ta.lowest(low, per) max = ta.highest(high, per) bull = variant(type, 100 * (3.0 * close - 2.0 * min- nz(open[per]))/close, per * avgmult) bear = variant(type, 100 * (nz(open[per]) + 2.0 * max - 3.0 * close)/close, per * avgmult) rep = bull - bear minf = ta.lowest(rep, lvlper) maxf = ta.highest(rep, lvlper) rn = maxf - minf fup = minf + rn * upper / 100.0 fdn = minf + rn * dnper / 100.0 mid = (fup + fdn) / 2.0 repc = 0. if colortype == 'Level Cross' repc := (rep > fup) ? 1 : (rep < fdn) ? 2 : (rep < fup and rep > fdn) ? 0 : nz(repc[1]) else if colortype == 'Middle Cross' repc := (rep > mid) ? 1 : (rep < mid) ? 2 : nz(repc[1]) else repc := (rep > rep[1]) ? 1 : (rep < rep[1]) ? 2 : repc[1] colorout = repc == 1 ? greencolor : repc == 2 ? redcolor : color.gray plot(rep, "Smoothed Repulse", color = colorout, linewidth=2) uppl = plot(fup, "Float Upper Level", color= color.gray) dnpl = plot(fdn, "Float Lower Level", color= color.gray) midpl = plot(mid, "Float Middle", color = bar_index % 2 ? color.gray : na) fill(uppl, midpl, title = "Top fill color", color = showfill ? color.new(greencolor, 95) : na) fill(dnpl, midpl, title = "Bottom fill color", color = showfill ? color.new(redcolor, 95) : na) barcolor(colorbars ? colorout : na) goLong = repc == 1 and repc[1] !=1 goShort = repc == 2 and repc[1] !=2 plotshape(showSigs and goLong, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(showSigs and goShort, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message='Smoothed Repulse w/ Floating Levels [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}') alertcondition(goShort, title="Short", message='Smoothed Repulse w/ Floating Levels [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}')
Efficiency-Ratio-Adaptive EMA [Loxx]
https://www.tradingview.com/script/AjwFoOrC-Efficiency-Ratio-Adaptive-EMA-Loxx/
loxx
https://www.tradingview.com/u/loxx/
58
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Efficiency-Ratio-Adaptive EMA [Loxx]", shorttitle = "ERAEMA [Loxx]", overlay = true, timeframe="", timeframe_gaps = true) greencolor = #2DD204 redcolor = #D2042D src = input.source(close, "Source", group = "Basic Settings") per = input.int(14, "Period", group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") m_fastEnd = math.max(per / 2.0, 1) m_slowEnd = per * 5 signal = 0. noise = 0. difference = src - nz(src[1]) if (bar_index > per) signal := math.abs(src - nz(src[per])) noise := nz(noise[1]) + difference - nz(difference[per]) else noise := difference for k = 1 to per - 1 noise += nz(difference[k]) efratio = signal / noise averagePeriod = noise > 0 ? (efratio * (m_slowEnd - m_fastEnd)) + m_fastEnd : per val = 0., valc = 0. val := nz(val[1]) + (2.0 / (1.0 + averagePeriod)) * (src - nz(val[1])) valc := val > nz(val[1]) ? 1 : val < nz(val[1]) ? 2 : nz(valc[1]) colorout = valc == 1 ? greencolor : valc == 2 ? redcolor : color.gray plot(val, color = colorout, linewidth = 3) barcolor(colorbars ? colorout : na)
Ayvebotem
https://www.tradingview.com/script/BgTmLOOe/
lenevtgngr
https://www.tradingview.com/u/lenevtgngr/
43
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © lenevtgngr //@version=5 indicator("Ayvebotem",overlay=true,shorttitle="Ayve") Ay1=ta.highest(40) Ay2=ta.lowest(40) leftBars = input(20) rightBars=input(20) Ay3 = ta.pivothigh(leftBars, rightBars) [supertrend, direction] = ta.supertrend(3, 10) plot(direction < 40 ? supertrend : na, "Up direction", color = color.green, style=plot.style_linebr) plot(direction > 40 ? supertrend : na, "Down direction", color = color.red, style=plot.style_linebr) plot(Ay1) plot(Ay2) plot(Ay3) pine_sar(start, inc, max) => var float result = na var float maxMin = na var float acceleration = na var bool isBelow = na bool isFirstTrendBar = false if bar_index == 1 if close > close[1] isBelow := true maxMin := high result := low[1] else isBelow := false maxMin := low result := high[1] isFirstTrendBar := true acceleration := start result := result + acceleration * (maxMin - result) if isBelow if result > low isFirstTrendBar := true isBelow := false result := math.max(high, maxMin) maxMin := low acceleration := start else if result < high isFirstTrendBar := true isBelow := true result := math.min(low, maxMin) maxMin := high acceleration := start if not isFirstTrendBar if isBelow if high > maxMin maxMin := high acceleration := math.min(acceleration + inc, max) else if low < maxMin maxMin := low acceleration := math.min(acceleration + inc, max) if isBelow result := math.min(result, low[1]) if bar_index > 1 result := math.min(result, low[2]) else result := math.max(result, high[1]) if bar_index > 1 result := math.max(result, high[2]) result plot(pine_sar(0.02, 0.02, 0.2), style=plot.style_cross, linewidth=3) rsi_on = input.bool(false, "+ RSI") l_bar = input.int(150, "(BUY) Lowest Bar", minval=1) rsi_low_value = input.int(27, "(BUY) RSI value <") sell_on = input.bool(true, "+ SELL") h_bar = input.int(150, "(SELL) Highest Bar", minval=1) rsi_high_value = input.int(73, "(SELL) RSI value >") rsi = ta.rsi(close, 14) lowclosebar = ta.lowestbars(close, l_bar) highclosebar = ta.highestbars(close, h_bar) color labelbuy = color(color.green) color labelsell = color(color.red) buy_condition = lowclosebar == 0 and rsi_on == false buy_condition_rsi = lowclosebar == 0 and rsi_on == true and rsi < rsi_low_value sell_condition = highclosebar == 0 and rsi_on == false and sell_on sell_condition_rsi = highclosebar == 0 and rsi_on == true and rsi > rsi_high_value and sell_on if buy_condition label.new(bar_index, low, yloc = yloc.belowbar, color=labelbuy, style=label.style_triangleup, size=size.tiny) if buy_condition_rsi label.new(bar_index, low, yloc = yloc.belowbar, color=labelbuy, style=label.style_triangleup, size=size.tiny) if sell_condition label.new(bar_index, low, yloc = yloc.abovebar, color=labelsell, style=label.style_triangledown, size=size.tiny) if sell_condition_rsi label.new(bar_index, low, yloc = yloc.abovebar, color=labelsell, style=label.style_triangledown, size=size.tiny) alertcondition(buy_condition or buy_condition_rsi, title="Low Price Detected", message="Low Price Detected") alertcondition(sell_condition or sell_condition_rsi, title="High Price Detected", message="High Price Detected")
Daily SMA In Lower Timeframe public version
https://www.tradingview.com/script/PqeLD6Gp-Daily-SMA-In-Lower-Timeframe-public-version/
signalp1
https://www.tradingview.com/u/signalp1/
29
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © signalp1 //@version=5 //change to make it public indicator("Daily SMA In Lower Timeframe") out50 = ta.sma(close, 50) s50 = request.security(syminfo.tickerid, "1D", out50) out100 = ta.sma(close, 100) s100 = request.security(syminfo.tickerid, "1D", out100) out200 = ta.sma(close, 200) s200 = request.security(syminfo.tickerid, "1D", out200) isInRange(cl,s)=>cl*1.05>s and cl*0.95<s if(barstate.islast) if(isInRange(close[0],s50[0])) line.new(bar_index -78, s50, bar_index, s50,extend=extend.right,color=color.blue) label.new(bar_index-78,s50,text="50SMA",color=color.aqua) if(isInRange(close[0],s100[0])) line.new(bar_index -78, s100, bar_index, s100,extend=extend.right,color=color.green) label.new(bar_index-78,s100,text="100SMA",color=color.aqua) if(isInRange(close[0],s200[0])) line.new(bar_index -78, s200, bar_index, s200,extend=extend.right,color=color.red) label.new(bar_index-78,s200,text="200SMA",color=color.aqua)
Sherry on Crypto - MACD Scalping
https://www.tradingview.com/script/I56pmClX-Sherry-on-Crypto-MACD-Scalping/
kshadabshayir
https://www.tradingview.com/u/kshadabshayir/
39
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © kshadabshayir //@version=5 indicator(title="Sherry on Crypto - MACD Scalping", shorttitle="Sherry on Crypto - MACD Scalping", timeframe="", timeframe_gaps=true) // Getting inputs slow_length1 = input(title="EMA Trend 1", defval=50) slow_length2 = input(title="EMA Trend 2 ", defval=200) fast_length = input(title="MACD Fast Length", defval=12) slow_length = input(title="MACD Slow Length", defval=26) signal_length = input.int(title="MACD Signal Smoothing", minval = 1, maxval = 50, defval = 9) src = input(title="MACD Source", defval=close) i_switch = input.string(title="Tick Highlight", defval="Moving average" ,options=["Moving average","Fixed value" ]) i_switch2 = input.string(title="Tick Source", defval="Highest bar" ,options=["Highest bar","Average","Last bar"]) signal_lengthup = input.int(title="Upticks Avg. Length", minval = 1, maxval = 5000, defval = 72) signal_lengthdown = input.int(title="Downticks Avg. Length", minval = 1, maxval = 5000, defval = 72) signal_lengthMA = input.int(title="Ticks Avg. Multiplier", minval = 1, maxval = 5000, defval = 2) sma_source = "EMA" sma_signal = "EMA" // Plot colors col_grow_above = #26A69A col_fall_above =#B2DFDB col_grow_below = #FFCDD2 col_fall_below = #FF5252 // Calculating fast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length) slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length) time_macd=timeframe.period=="1"?"1": timeframe.period=="3"?"1": timeframe.period=="5"?"1": timeframe.period=="15"?"3":timeframe.period=="30"?"5":timeframe.period=="60"?"15":timeframe.period=="120"?"30":timeframe.period=="240"?"60":timeframe.period=="D"?"240":timeframe.period=="W"?"D":timeframe.period=="M"?"W":timeframe.period=="12M"?"M":timeframe.period macd = fast_ma - slow_ma macd1=request.security(syminfo.tickerid, time_macd, macd) signal = sma_signal == "SMA" ? ta.sma(macd1, signal_length) : ta.ema(macd1, signal_length) ema50=ta.ema(close,slow_length1) ema200=ta.ema(close ,slow_length2) hist = request.security(syminfo.tickerid, time_macd, macd1 - signal) f() => [hist[4],hist[3],hist[2],hist[1], hist] ss=request.security(syminfo.tickerid, time_macd, hist, barmerge.gaps_on,barmerge.lookahead_off) [ss5,ss4,ss3,ss2,ss1]=request.security(syminfo.tickerid, time_macd, f(), barmerge.gaps_on,barmerge.lookahead_off) a = array.from(ss5,ss4,ss3,ss2,ss1) s3=i_switch2=="Highest bar"?(ss>0? array.max(a, 0) : array.min(a, 0)):i_switch2=="Average"?array.avg(a):i_switch2=="Last bar"?ss1:0 saa=timeframe.period == '1'? ss:s3 saa2=timeframe.period == '1'? ss:s3*signal_lengthMA colorss=(s3>=0 ? (s3[1] < s3 ? col_grow_above : col_fall_above) : (s3[1] < s3 ? col_grow_below : col_fall_below)) saadown = saa2 saaup = saa2 saadown:=saa>=0? saa2:saadown[1] saaup:=saa<0? saa2:saaup[1] verr=ta.ema(saadown,signal_lengthup) dowww=ta.ema(saaup,signal_lengthdown) ss22=plot(verr, title="Avg. Cloud Upper 1", color=color.new(color.white, 100)) ss33=plot(dowww, title="Avg. Cloud Lower 1", color=color.new(color.white, 100)) fill(ss22, ss33, color.new(color.white, 93), title="Avg. Cloud Background") fixeduptick = input(title="Fixed Uptick Value", defval=30) fixeddowntick = input(title="Fixed Downtick Value", defval=-30) minl = i_switch=="Fixed value"? fixeduptick : verr maxl = i_switch=="Fixed value"? fixeddowntick : dowww plot(minl, title="Avg. Cloud Upper 2", color=color.new(color.white, 81)) plot(maxl, title="Avg. Cloud Lower 2", color=color.new(color.white, 81)) colors2= s3<=minl and s3>=maxl ? #2a2e39 : colorss coro2=s3>0? ema50>ema200 ? #2a2e39 : colors2 : ema50<ema200 ? #2a2e39: colors2 plot(saa, title="Histogram", style=plot.style_columns, color=coro2) alertcondition(#2a2e39 != coro2 , title='MACD Tick Alert', message='Sherry on Crypto - MACD Tick Alert')
Corrected QWMA (Quadratic Weighted Moving Average) [Loxx]
https://www.tradingview.com/script/O4P00PlS-Corrected-QWMA-Quadratic-Weighted-Moving-Average-Loxx/
loxx
https://www.tradingview.com/u/loxx/
127
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator('Corrected QWMA (Quadratic Weighted Moving Average) [Loxx]', shorttitle = "CQWMA [Loxx]", overlay = true, timeframe="", timeframe_gaps = true) greencolor = #2DD204 redcolor = #D2042D _iQwma(src, period, speed)=> workQwma = src sumw = math.pow(period, speed) sum = sumw * src for k = 0 to period - 1 weight = math.pow(period - k, speed) sumw += weight sum += weight * workQwma[k] out = sum / sumw out price = input.source(close, "Source", group = "Basic Settings") MaPeriod = input.int(25, "MA Period", group = "Basic Settings") MaSpeed = input.int(2, "MA Speed", group = "Basic Settings") CorrectionPeriod = input.int(0, "Correction Period", group = "Basic Settings") FlPeriod = input.int(25, "Floating Levels Period", group = "Floating Levels Settings") FlUp = input.int(90, "Floating Levels % Up", group = "Floating Levels Settings") FlDown = input.int(10, "Floating Levels % Down", group = "Floating Levels Settings") colorOn = input.string("Middle", "Coloring Type", options = ["Middle", "Level", "QWMA"], group = "UI Options") colorbars = input.bool(false, "Color bars?", group = "UI Options") showfloat = input.bool(true, "Show Floating Levels?", group = "UI Options") showfill = input.bool(true, "Fil Floating Levels?", group = "UI Options") showSigs = input.bool(false, "Show signals?", group= "UI Options") qwma = 0. deviationsPeriod = (CorrectionPeriod > 0) ? CorrectionPeriod : (CorrectionPeriod < 0) ? 0 : MaPeriod work = _iQwma(price, MaPeriod, MaSpeed) v1 = math.pow(ta.stdev(price, deviationsPeriod), 2) v2 = math.pow(nz(nz(qwma[1])) - work, 2) c = (v2 < v1 or v2 == 0) ? 0 : 1 - v1 / v2 qwma := nz(qwma[1]) + c * (work - nz(qwma[1])) min = ta.lowest(qwma, FlPeriod) max = ta.highest(qwma, FlPeriod) rng = max - min fup = min + FlUp * rng / 100.0 fdn = min + FlDown * rng / 100.0 mid = (fup + fdn) * 0.5 val = qwma qwmac = 0. qwmac := switch colorOn "Middle" => (qwma > fup) ? 1 : (qwma < fdn) ? 2 : (qwma == nz(qwma[1])) ? nz(qwmac[1]) : 0 "Level" => (qwma > mid) ? 1 : (qwma < mid) ? 2 : (qwma == nz(qwma[1])) ? nz(qwmac[1]) : 0 "QWMA" => (qwma < work) ? 1 : (qwma > work) ? 2 : (qwma == nz(qwma[1])) ? nz(qwmac[1]) : 0 => (qwma > nz(qwma[1])) ? 1 : (qwma < nz(qwma[1])) ? 2 : (qwma == nz(qwma[1])) ? nz(qwmac[1]) : 0 colorout = qwmac == 1 ? greencolor : qwmac == 2 ? redcolor : color.gray top = plot(showfloat ? fup : na, "Top float", color = color.new(greencolor, 50), linewidth = 1) bot = plot(showfloat ? fdn : na, "bottom float", color = color.new(redcolor, 50), linewidth = 1) midpl = plot(showfloat ? mid : na, "Mid Float", color = color.new(color.white, 10), linewidth = 1) goLong = qwmac == 1 and qwmac[1] !=1 goShort = qwmac == 2 and qwmac[1] !=2 fill(top, midpl, title = "Top fill color", color = showfill ? color.new(greencolor, 95) : na) fill(bot, midpl,title = "Bottom fill color", color = showfill ? color.new(redcolor, 95) : na) plot(val,"QWMA", color = colorout, linewidth = 3) barcolor(colorbars ? colorout: na) plotshape(showSigs and goLong, title = "Long", color = color.yellow, textcolor = color.yellow, text = "L", style = shape.triangleup, location = location.belowbar, size = size.small) plotshape(showSigs and goShort, title = "Short", color = color.fuchsia, textcolor = color.fuchsia, text = "S", style = shape.triangledown, location = location.abovebar, size = size.small) alertcondition(goLong, title="Long", message='Corrected QWMA (Quadratic Weighted Moving Average) [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}') alertcondition(goShort, title="Short", message='Corrected QWMA (Quadratic Weighted Moving Average) [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}')
Historical US Bond Yield Curve
https://www.tradingview.com/script/faurpTxW-Historical-US-Bond-Yield-Curve/
BarefootJoey
https://www.tradingview.com/u/BarefootJoey/
70
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Editor: © BarefootJoey // Authors: © longfiat, OpptionsOnly // //@version=5 indicator('Historical US Bond Yield Curve', overlay=false) primarycol = input.color(color.orange, "Primary color") secondcol = input.color(color.gray, "Secondary color") width = input(8, 'Spacing between labels', tooltip="Measured in bars") size = input.string(size.small, "Label Size", options=[size.tiny, size.small, size.normal, size.large, size.huge]) lb = input.int(180, "Lookback for Historical Curve 1", minval=1) lb2 = input.int(360, "Lookback for Historical Curve 2", minval=1) percentdecimals = input.int(defval=3, title='% Decimals', minval=0, maxval=10) hline(0, color=color.new(secondcol,50)) symbols = 12 us30y = request.security('US30Y', "D", close) // instead of "D" the original script used timeframe.period us20y = request.security('US20Y', "D", close) us10y = request.security('US10Y', "D", close) us7y = request.security('US07Y', "D", close) us5y = request.security('US05Y', "D", close) us3y = request.security('US03Y', "D", close) us2y = request.security('US02Y', "D", close) us1y = request.security('US01Y', "D", close) us6m = request.security('US06MY', "D", close) us3m = request.security('US03MY', "D", close) us2m = request.security('US02MY', "D", close) us1m = request.security('US01MY', "D", close) pos(idx) => bar_index - (symbols - idx) * width truncatepercent(number, percentdecimals) => factor = math.pow(10, percentdecimals) int(number * factor) / factor draw_label(idx, src, txt, tip, col) => var label la = na label.delete(la) la := label.new(pos(idx), src, text=txt, color=color.new(color.black,100), style=label.style_label_up, textcolor=col, size=size, tooltip=tip) la draw_line(idx1, src1, idx2, src2) => var line li = na line.delete(li) li := line.new(pos(idx1), src1, pos(idx2), src2, color=primarycol, width=2) li draw_line2(idx1, src1, idx2, src2) => var line li = na line.delete(li) li := line.new(pos(idx1), src1, pos(idx2), src2, style=line.style_dotted, color=color.new(primarycol,33), width=2) li draw_line3(idx1, src1, idx2, src2) => var line li = na line.delete(li) li := line.new(pos(idx1), src1, pos(idx2), src2, style=line.style_dotted, color=color.new(primarycol,66), width=2) li draw_label(0, us1m, '1M' ,"Current: " + str.tostring(truncatepercent(us1m,percentdecimals)) + (us1m>us1m[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us1m[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us1m[lb2],percentdecimals)) + " %",secondcol) draw_label(1, us2m, '2M' ,"Current: " + str.tostring(truncatepercent(us2m,percentdecimals)) + (us2m>us2m[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us2m[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us2m[lb2],percentdecimals)) + " %",secondcol) draw_label(2, us3m, '3M' ,"Current: " + str.tostring(truncatepercent(us3m,percentdecimals)) + (us3m>us3m[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us3m[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us3m[lb2],percentdecimals)) + " %",primarycol) draw_label(3, us6m, '6M' ,"Current: " + str.tostring(truncatepercent(us6m,percentdecimals)) + (us6m>us6m[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us6m[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us6m[lb2],percentdecimals)) + " %",secondcol) draw_label(4, us1y, '1Y' ,"Current: " + str.tostring(truncatepercent(us1y,percentdecimals)) + (us1y>us1y[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us1y[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us1y[lb2],percentdecimals)) + " %",secondcol) draw_label(5, us2y, '2Y' ,"Current: " + str.tostring(truncatepercent(us2y,percentdecimals)) + (us2y>us2y[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us2y[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us2y[lb2],percentdecimals)) + " %",primarycol) draw_label(6, us3y, '3Y' ,"Current: " + str.tostring(truncatepercent(us3y,percentdecimals)) + (us3y>us3y[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us3y[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us3y[lb2],percentdecimals)) + " %",secondcol) draw_label(7, us5y, '5Y' ,"Current: " + str.tostring(truncatepercent(us5y,percentdecimals)) + (us5y>us5y[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us5y[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us5y[lb2],percentdecimals)) + " %",secondcol) draw_label(8, us7y, '7Y' ,"Current: " + str.tostring(truncatepercent(us7y,percentdecimals)) + (us7y>us7y[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us7y[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us7y[lb2],percentdecimals)) + " %",secondcol) draw_label(9, us10y, '10Y' ,"Current: " + str.tostring(truncatepercent(us10y,percentdecimals)) + (us10y>us10y[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us10y[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us10y[lb2],percentdecimals)) + " %",primarycol) draw_label(10, us20y, '20Y' ,"Current: " + str.tostring(truncatepercent(us20y,percentdecimals)) + (us20y>us20y[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us20y[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us20y[lb2],percentdecimals)) + " %",secondcol) draw_label(11, us30y, '30Y' ,"Current: " + str.tostring(truncatepercent(us30y,percentdecimals)) + (us30y>us30y[1]?" % & rising":" % & falling") + "\n" + str.tostring(lb) + " days ago: " + str.tostring(truncatepercent(us30y[lb],percentdecimals)) + " %\n" + str.tostring(lb2) + " days ago: " + str.tostring(truncatepercent(us30y[lb2],percentdecimals)) + " %",primarycol) a = draw_line(0, us1m, 1, us2m) b = draw_line(1, us2m, 2, us3m) c = draw_line(2, us3m, 3, us6m) d = draw_line(3, us6m, 4, us1y) e = draw_line(4, us1y, 5, us2y) f = draw_line(5, us2y, 6, us3y) g = draw_line(6, us3y, 7, us5y) h = draw_line(7, us5y, 8, us7y) i = draw_line(8, us7y, 9, us10y) j = draw_line(9, us10y, 10, us20y) k = draw_line(10, us20y, 11, us30y) a2 = draw_line2(0, us1m[lb], 1, us2m[lb]) b2 = draw_line2(1, us2m[lb], 2, us3m[lb]) c2 = draw_line2(2, us3m[lb], 3, us6m[lb]) d2 = draw_line2(3, us6m[lb], 4, us1y[lb]) e2 = draw_line2(4, us1y[lb], 5, us2y[lb]) f2 = draw_line2(5, us2y[lb], 6, us3y[lb]) g2 = draw_line2(6, us3y[lb], 7, us5y[lb]) h2 = draw_line2(7, us5y[lb], 8, us7y[lb]) i2 = draw_line2(8, us7y[lb], 9, us10y[lb]) j2 = draw_line2(9, us10y[lb], 10, us20y[lb]) k2 = draw_line2(10, us20y[lb], 11, us30y[lb]) a3 = draw_line3(0, us1m[lb2], 1, us2m[lb2]) b3 = draw_line3(1, us2m[lb2], 2, us3m[lb2]) c3 = draw_line3(2, us3m[lb2], 3, us6m[lb2]) d3 = draw_line3(3, us6m[lb2], 4, us1y[lb2]) e3 = draw_line3(4, us1y[lb2], 5, us2y[lb2]) f3 = draw_line3(5, us2y[lb2], 6, us3y[lb2]) g3 = draw_line3(6, us3y[lb2], 7, us5y[lb2]) h3 = draw_line3(7, us5y[lb2], 8, us7y[lb2]) i3 = draw_line3(8, us7y[lb2], 9, us10y[lb2]) j3 = draw_line3(9, us10y[lb2], 10, us20y[lb2]) k3 = draw_line3(10, us20y[lb2], 11, us30y[lb2]) // Labels var label langle = na langle := label.new(pos(11), y=us30y[lb], size=size.small, text=str.tostring(lb,"#") + " day", color=color.new(color.white,100), style=label.style_label_left, textcolor=color.new(primarycol,33)) label.delete(langle[1]) var label langle2 = na langle2 := label.new(pos(11), y=us30y[lb2], size=size.small, text=str.tostring(lb2,"#") + " day", color=color.new(color.white,100), style=label.style_label_left, textcolor=color.new(primarycol,66)) label.delete(langle2[1]) var label langle3 = na langle3 := label.new(pos(11), y=us30y, size=size.small, text="Current", color=color.new(color.white,100), style=label.style_label_left, textcolor=color.new(primarycol,0)) label.delete(langle3[1]) // Important Spreads us10y3m = (us10y - us3m) * 100 us10y2y = (us10y - us2y) * 100 us10y30y = (us30y - us10y) * 100 last103inv = ta.barssince(us10y3m<0) last103inv2 = ta.barssince(ta.crossunder(us10y3m,0)) last102inv = ta.barssince(us10y2y<0) last102inv2 = ta.barssince(ta.crossunder(us10y2y,0)) last1030inv = ta.barssince(us10y30y<0) last1030inv2 = ta.barssince(ta.crossunder(us10y30y,0)) // ---------------------------- Ticker ---------------------------------------// // Important Spreads position = input.string(position.bottom_center, "Important Spreads Info Panel Position", [position.top_right, position.middle_right, position.bottom_right, position.bottom_left, position.middle_left, position.top_left, position.bottom_center, position.top_center]) //, group=grtk) var table Ticker = na Ticker := table.new(position, 1, 4) if barstate.islast table.cell(Ticker, 0, 0, text = "Important spreads:", text_size = size, text_color = secondcol) table.cell(Ticker, 0, 1, text = '10Y/3M: ' + str.tostring(us10y3m) + ' bps ' + (us10y3m>0?'👍':'🚨'), // alt danger 💀 🚧 🚩 🎢 text_size = size, text_color = primarycol, tooltip=str.tostring(last103inv) + " days since last inversion. Inverted for " + (last103inv == 0 ? str.tostring(last103inv2) : "0") + " days.") table.cell(Ticker, 0, 2, text = '10Y/2Y: ' + str.tostring(us10y2y) + ' bps ' + (us10y2y>0?'👍':'🚨'), text_size = size, text_color = primarycol, tooltip=str.tostring(last102inv) + " days since last inversion. Inverted for " + (last102inv == 0 ? str.tostring(last102inv2) + (last102inv2 >= 5 ? " 💀" : " 😬") : "0") + " days." + (last102inv == 0 ? "\nInvestors expecting recession." : na)) table.cell(Ticker, 0, 3, text = '10Y/30Y: ' + str.tostring(us10y30y) + ' bps ' + (us10y30y>0?'👍':'🚨'), text_size = size, text_color = primarycol, tooltip=str.tostring(last1030inv) + " days since last inversion. Inverted for " + (last1030inv == 0 ? str.tostring(last1030inv2) : "0") + " days." + (last1030inv == 0 ? "\nInvestors expect central-bank policy tightening to lead to inflation & slower economic growth." : na)) cctxtbb = (us10y > us10y[lb]) and (us3m > us3m[lb]) ? "Bear" : (us10y < us10y[lb]) and (us3m < us3m[lb]) ? "Bull" : "Undetermined" cctxtst = (us10y - us3m) > (us10y[lb] - us3m[lb]) ? "Steepening" : (us10y - us3m) < (us10y[lb] - us3m[lb]) ? "Flattening" : na cctxttt = ((us10y > us10y[lb]) and (us3m > us3m[lb])) and ((us10y - us3m) < (us10y[lb] - us3m[lb])) ? "Fed tightening. Market expects slower growth. Overheating: Seek commodities, high-yield bonds, & cyclical value. Expect: Rate hikes." : // Bear Flattening = Overheat ((us10y > us10y[lb]) and (us3m > us3m[lb])) and ((us10y - us3m) > (us10y[lb] - us3m[lb])) ? "Fed tightening. Market expects faster growth. Recovery: Seek stocks, corporate bonds, & cyclical growth." : //Bear Steepening = Recovery ((us10y < us10y[lb]) and (us3m < us3m[lb])) and ((us10y - us3m) > (us10y[lb] - us3m[lb])) ? "Fed loosening. Market expects faster growth. Reflation: Seek bonds, government bonds, & defensive growth. Expect: Rate cuts. " : // Bull Steepening = Reflation ((us10y < us10y[lb]) and (us3m < us3m[lb])) and ((us10y - us3m) < (us10y[lb] - us3m[lb])) ? "Fed loosening. Market expects slower growth. Stagflation: Seek cash (money market), inflation-linked bonds, & defensive value." : // Bull Flattening = Stagflation na position2 = input.string(position.top_center, "Curve Analysis Info Panel Position", [position.top_right, position.middle_right, position.bottom_right, position.bottom_left, position.middle_left, position.top_left, position.bottom_center, position.top_center]) //, group=grtk) var table Ticker3 = na Ticker3 := table.new(position2, 1, 3) if barstate.islast table.cell(Ticker3, 0, 0, text = cctxtbb + " " + cctxtst, text_size = size, text_color = cctxtbb == "Bear" ? color.new(color.red,20) : cctxtbb == "Bull" ? color.new(color.green,20) : color.new(color.gray,20), tooltip = cctxttt) // EoS made w/ ❤ by @BarefootJoey
Standard-Deviation Adaptive Smoother MA [Loxx]
https://www.tradingview.com/script/poj89PjL-Standard-Deviation-Adaptive-Smoother-MA-Loxx/
loxx
https://www.tradingview.com/u/loxx/
65
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Standard Deviation Adaptive Smoother [Loxx]", shorttitle = "STDAS [Loxx]", overlay = true, timeframe="", timeframe_gaps = true) greencolor = #2DD204 redcolor = #D2042D _smoother(float src, len)=> wrk = src, wrk2 = src, wrk4 = src wrk0 = 0., wrk1 = 0., wrk3 = 0. alpha = 0.45 * (len - 1.0) / (0.45 * (len - 1.0) + 2.0) wrk0 := src + alpha * (nz(wrk[1]) - src) wrk1 := (src - wrk) * (1 - alpha) + alpha * nz(wrk1[1]) wrk2 := wrk0 + wrk1 wrk3 := (wrk2 - nz(wrk4[1])) * math.pow(1.0 - alpha, 2) + math.pow(alpha, 2) * nz(wrk3[1]) wrk4 := wrk3 + nz(wrk4[1]) wrk4 _stdPer(src, per, adaptper)=> dev = ta.stdev(src, adaptper) avg = ta.sma(dev, adaptper) period = (dev!=0) ? math.max(per * avg/dev, 2) : math.max(per, 1) period := int(period) src = input.source(close, "Source", group = "Basic Settings") SmtPeriod = input.int(15, "Smoother Period", group = "Basic Settings") AdaptivePeriod = input.int(25, "Adaptive Period", group = "Basic Settings") ColorSteps = input.int(50, "Color Period", group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") len = _stdPer(src, SmtPeriod, AdaptivePeriod) smt = _smoother(src, len) min = ta.lowest(smt, ColorSteps) max = ta.highest(smt, ColorSteps) mid = (max + min) / 2 colorBuffer = color.from_gradient(smt, min, mid, redcolor, greencolor) plot(smt, color = colorBuffer, linewidth = 5) barcolor(colorbars ? colorBuffer : na)
Swing Points & FVG
https://www.tradingview.com/script/uezbpmCc-Swing-Points-FVG/
Vulnerable_human_x
https://www.tradingview.com/u/Vulnerable_human_x/
525
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 indicator('Swing Points & FVG', overlay=true, max_labels_count=500) var inputHighlightIntermediates = input(true, 'Highlight Intermediate Swing Highs and Lows') var inputIntermediateSize = input.string('Tiny', 'Intermediate Swing Label Size', options=['Auto', 'Tiny', 'Small', 'Normal']) var inputShowShortTermSwings = input(false, 'Short Term Swings') var inputPivotBars = input(2, 'Pivot Candles') var highcolor = input.color(color.red, title="High", tooltip="select a color for ST/IT Highs") var lowcolor = input.color(color.green, title="Low", tooltip="select a color for ST/IT Lows") var intermediateLabelSize = inputIntermediateSize == 'Auto' ? size.auto : inputIntermediateSize == 'Tiny' ? size.tiny : inputIntermediateSize == 'Small' ? size.small : size.normal // Parallel arrays for Swing High Data var float[] swingHighs = array.new_float() var label[] swingHighLabels = array.new_label() var bool[] swingHighIsHigher = array.new_bool() var bool[] swingHighIsIntermediate = array.new_bool() // Parallel arrays for Swing Low Data var float[] swingLows = array.new_float() var label[] swingLowLabels = array.new_label() var bool[] swingLowIsLower = array.new_bool() var bool[] swingLowIsIntermediate = array.new_bool() // see last element pushed an an array array_peek(arrayId) => int arraySize = array.size(arrayId) if arraySize > 0 array.get(arrayId, arraySize - 1) else na // filters out swings that were not intermediate swings after all swings have been recorded. remove_short_term_swings() => if not inputShowShortTermSwings and barstate.islast var swingHighCount = array.size(swingHighLabels) var swingLowCount = array.size(swingLowLabels) for i = 0 to swingHighCount - 1 by 1 if not array.get(swingHighIsIntermediate, i) label.delete(array.get(swingHighLabels, i)) for i = 0 to swingLowCount - 1 by 1 if not array.get(swingLowIsIntermediate, i) label.delete(array.get(swingLowLabels, i)) // detect swing highs and lows swingHighPrice = ta.pivothigh(high, inputPivotBars, inputPivotBars) swingLowPrice = ta.pivotlow(low, inputPivotBars, inputPivotBars) if not na(swingHighPrice) lastSwingHighPrice = array_peek(swingHighs) isHigherHigh = swingHighPrice > lastSwingHighPrice isLowerHigh = swingHighPrice < lastSwingHighPrice swingLabel = label.new(bar_index[inputPivotBars], swingHighPrice, color=highcolor, yloc=yloc.price, style=label.style_circle, size=size.tiny) // check if last swing high was intermediate if isLowerHigh and array_peek(swingHighIsHigher) // lower high after a higher high means the previous swing high was intermediate if inputHighlightIntermediates label.set_size(array_peek(swingHighLabels), intermediateLabelSize) array.set(swingHighIsIntermediate, array.size(swingHighIsIntermediate) - 1, true) // save swing array.push(swingHighs, swingHighPrice) array.push(swingHighLabels, swingLabel) array.push(swingHighIsHigher, isHigherHigh) array.push(swingHighIsIntermediate, false) // can be filled in later, if a lower high forms next if not na(swingLowPrice) lastSwingLowPrice = array_peek(swingLows) isHigherLow = swingLowPrice > lastSwingLowPrice isLowerLow = swingLowPrice < lastSwingLowPrice swingLabel = label.new(bar_index[inputPivotBars], swingLowPrice, color=lowcolor, yloc=yloc.price, style=label.style_circle, size=size.tiny) // check if last swing low was intermediate if isHigherLow and array_peek(swingLowIsLower) // higher low after a lower low means the previous swing low was intermediate if inputHighlightIntermediates label.set_size(array_peek(swingLowLabels), intermediateLabelSize) array.set(swingLowIsIntermediate, array.size(swingLowIsIntermediate) - 1, true) // save swing array.push(swingLows, swingLowPrice) array.push(swingLowLabels, swingLabel) array.push(swingLowIsLower, isLowerLow) array.push(swingLowIsIntermediate, false) // can be filled in later if a higher low forms next remove_short_term_swings() //IMBALANCE show_IMB = input.bool(true, "Imbalance", group='IMBALANCE') imbalancecolor = input.color(color.yellow, title="Imbalance Color", group='IMBALANCE') fvgTransparency = input(title="Transparency", defval=60, group='IMBALANCE') fvgboxLength = input.int(title='Length', defval=0, group='IMBALANCE') fvgisUp(index) => close[index] > open[index] fvgisDown(index) => close[index] < open[index] fvgisObUp(index) => fvgisDown(index + 1) and fvgisUp(index) and close[index] > high[index + 1] fvgisObDown(index) => fvgisUp(index + 1) and fvgisDown(index) and close[index] < low[index + 1] bullishFvg = low[0] > high[2] bearishFvg = high[0] < low[2] if bullishFvg and show_IMB box.new(left=bar_index - 1, top=low[0], right=bar_index + fvgboxLength, bottom=high[2], bgcolor=color.new(imbalancecolor, fvgTransparency), border_color=color.new(imbalancecolor, fvgTransparency)) if bearishFvg and show_IMB box.new(left=bar_index - 1, top=low[2], right=bar_index + fvgboxLength, bottom=high[0], bgcolor=color.new(imbalancecolor, fvgTransparency), border_color=color.new(imbalancecolor, fvgTransparency)) //////////////////// FVG //////////////////
Indicator Daily-Weekly-Range-In-Price
https://www.tradingview.com/script/1Vj1jhgl/
Maurizio-Ciullo
https://www.tradingview.com/u/Maurizio-Ciullo/
16
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Maurizio-Ciullo //@version=5 indicator("Indicatore Daily-Weekly-Range-In-Price", overlay=true) //Inputs input_daily_range = input.bool(defval=true) input_weekly_range = input.bool(defval=false) //Daily sessions and range dailySessionDataHigh = request.security(syminfo.tickerid,"D", high) dailySessionDataLow = request.security(syminfo.tickerid,"D", low) dailyRangeInPrice = dailySessionDataHigh - dailySessionDataLow plot(input_daily_range == true ? dailySessionDataHigh : na, title="weeklySessionDataHigh", color=color.blue) plot(input_daily_range == true ? dailySessionDataLow : na, title="weeklySessionDataLow", color=color.blue) plot(input_daily_range == true ? dailyRangeInPrice : na, style=plot.style_histogram, color=color.blue) //Weekly sessions and range weeklySessionDataHigh = request.security("","W", high) weeklySessionDataLow = request.security("","W", low) weeklyRangeInPrice = weeklySessionDataHigh - weeklySessionDataLow plot(input_weekly_range == true ? weeklySessionDataHigh : na, title="weeklySessionDataHigh", color=color.blue) plot(input_weekly_range == true ? weeklySessionDataLow : na, title="weeklySessionDataLow", color=color.blue) plot(input_weekly_range == true ? weeklyRangeInPrice : na, style=plot.style_histogram, color=color.blue) label_daily_range_text = input_daily_range == true ? str.tostring(dailyRangeInPrice) : na label_daily_range = label.new(x=bar_index, y=na, yloc=yloc.belowbar, text=label_daily_range_text, style=label.style_label_lower_left, textcolor=color.white, size=size.normal) label_weekly_range_text = input_weekly_range == true ? str.tostring(weeklyRangeInPrice) : na label_weekly_range = label.new(x=bar_index, y=na, yloc=yloc.belowbar, text=label_weekly_range_text, style=label.style_label_down, textcolor=color.white, size=size.normal)
Volatility Pivot Support and Resistance [Loxx]
https://www.tradingview.com/script/dnlZRl9Z-Volatility-Pivot-Support-and-Resistance-Loxx/
loxx
https://www.tradingview.com/u/loxx/
87
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Volatility Pivot Support and Resistance [Loxx]", shorttitle="VPSR [Loxx]", overlay = true, timeframe="", timeframe_gaps = true) greencolor = #2DD204 redcolor = #D2042D atrrng = input.int(100, "ATR Range", group = "Basic Settings") inpAtrFactor = input.int(3, "ATR Factor", group = "Basic Settings") marng = input.int(10, "MA Range", group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") out = math.sum(ta.tr(true), atrrng)/atrrng atr = 0. atr := ta.ema(out, marng) val = close _deltaStop = atr * inpAtrFactor while (true) if (close == nz(val[1])) val := nz(val[1]) break if (nz(close[1]) < nz(val[1]) and close < nz(val[1])) val := math.min(nz(val[1]), close + _deltaStop) break if (nz(close[1]) > nz(val[1]) and close > nz(val[1])) val := math.max(nz(val[1]), close - _deltaStop) break if (close > nz(val[1])) val := close - _deltaStop else val := close + _deltaStop break goLong_pre = ta.crossover(val, val[1]) goShort_pre = ta.crossunder(val, val[1]) contSwitch = 0 contSwitch := nz(contSwitch[1]) contSwitch := goLong_pre ? 1 : goShort_pre ? -1 : contSwitch goLong = goLong_pre and ta.change(contSwitch) goShort = goShort_pre and ta.change(contSwitch) plot(val,"Volatility Pivot", color = contSwitch == 1 ? greencolor : redcolor, linewidth = 3) barcolor(colorbars ? contSwitch == 1 ? greencolor : redcolor : na)
VWAP + EMA Analysis [Joshlo]
https://www.tradingview.com/script/8WKLZOok-VWAP-EMA-Analysis-Joshlo/
Joshlo
https://www.tradingview.com/u/Joshlo/
46
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Joshlo //@version=5 indicator("VWAP Analysis", overlay=true) ioDailyVWAP = input.bool(true, "Daily VWAP", group="VWAP") ioWeeklyVWAP = input.bool(false, "Weekly VWAP", group="VWAP") ioMonthlyVWAP = input.bool(false, "Monthly VWAP", group="VWAP") stdevMultiplierInput = input.float(2.0, "Standard Deviation Multiplier", group="VWAP") vwapDColor = input.color(color.rgb(0,100,245,0), "VWAP Equilibrium (Daily)", group="VWAP") vwapDResistanceColor = input.color(color.rgb(255,0,0,0), "VWAP Resistance (Daily)", group="VWAP") vwapDSupportColor = input.color(color.rgb(0,255,0,0), "VWAP Support (Daily)", group="VWAP") vwapWColor = input.color(color.rgb(0,100,245,30), "VWAP Equilibrium (Weekly)", group="VWAP") vwapWResistanceColor = input.color(color.rgb(255,0,0,30), "VWAP Resistance (Weekly)", group="VWAP") vwapWSupportColor = input.color(color.rgb(0,255,0,30), "VWAP Support (Weekly)", group="VWAP") vwapMColor = input.color(color.rgb(0,100,245,80), "VWAP Equilibrium (Monthly)", group="VWAP") vwapMResistanceColor = input.color(color.rgb(255,0,0,80), "VWAP Resistance (Monthly)", group="VWAP") vwapMSupportColor = input.color(color.rgb(0,255,0,80), "VWAP Support (Monthly)", group="VWAP") io200 = input.bool(true, "200 EMA", group="Exponential Moving Averages") emaColor1 = input.color(color.orange, "200 EMA Color", group="Exponential Moving Averages") io50 = input.bool(true, "50 EMA", group="Exponential Moving Averages") emaColor2 = input.color(color.purple, "50 EMA Color", group="Exponential Moving Averages") io20 = input.bool(true, "20 EMA", group="Exponential Moving Averages") emaColor3 = input.color(color.white, "20 EMA Color", group="Exponential Moving Averages") anchorD = timeframe.change("1D") [vwapD, upperD, lowerD] = ta.vwap(close, anchorD, stdevMultiplierInput) anchorW = timeframe.change("1W") [vwapW, upperW, lowerW] = ta.vwap(close, anchorW, stdevMultiplierInput) anchorM = timeframe.change("1M") [vwapM, upperM, lowerM] = ta.vwap(close, anchorM, stdevMultiplierInput) plot(ioDailyVWAP ? vwapD : na, color = vwapDColor ,title="VWAP Equilibrium (Daily)", editable=true) plot(ioDailyVWAP ? upperD : na, color = vwapDResistanceColor,title="VWAP Resistance (Daily)", editable=true) plot(ioDailyVWAP ? lowerD : na, color = vwapDSupportColor,title="VWAP Support (Daily)", editable=true) plot(ioWeeklyVWAP ? vwapW : na, color = vwapWColor ,title="VWAP Equilibrium (Weekly)", style=plot.style_circles, editable=true) plot(ioWeeklyVWAP ? upperW : na, color = vwapWResistanceColor,title="VWAP Resistance (Weekly)", style=plot.style_circles,editable=true) plot(ioWeeklyVWAP ? lowerW : na, color = vwapWSupportColor,title="VWAP Support (Weekly)", style=plot.style_circles,editable=true) plot(ioMonthlyVWAP ? vwapM : na, color = vwapMColor ,title="VWAP Equilibrium (Monthly)", style=plot.style_stepline_diamond,editable=true) plot(ioMonthlyVWAP ? upperM : na, color = vwapMResistanceColor,title="VWAP Resistance (Monthly)", style=plot.style_stepline_diamond,editable=true) plot(ioMonthlyVWAP ? lowerM : na, color = vwapMSupportColor,title="VWAP Support (Monthly)", style=plot.style_stepline_diamond,editable=true) plot(io200 ? ta.ema(close,200) : na, color = emaColor1, linewidth=1,title="200 EMA", editable=true) plot(io50 ? ta.ema(close,50) : na, color = emaColor2, linewidth=1,title="50 EMA", editable=true) plot(io20 ? ta.ema(close,20) : na, color = emaColor3, linewidth=1,title="20 EMA", editable=true)
Phase Accumulation Adaptive Fisher Transform [Loxx]
https://www.tradingview.com/script/d1iEObUb-Phase-Accumulation-Adaptive-Fisher-Transform-Loxx/
loxx
https://www.tradingview.com/u/loxx/
64
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Phase Accumulation Adaptive Fisher Transform [Loxx]", overlay = false, shorttitle="PAAFT [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) import loxx/loxxpaaspecial/1 greencolor = #2DD204 redcolor = #D2042D SM02 = 'Zero-Line Cross' SM03 = 'Signal Crossover' signalMode = input.string(SM02, 'Signal Type', options=[SM02, SM03], group = "Basic Settings") fisherOb1 = input.float(2, minval=1, step = 0.1, title='Overbought Level', group = "Basic Settings") fisherOs1 = input.float(-2, maxval=-1, step = 0.1, title='Oversold Level', group = "Basic Settings") regcycles = input.float(1, title = "PA Cycles", group= "Phase Accumulation Cycle Settings") regfilter = input.float(0, title = "PA Filter", group= "Phase Accumulation Cycle Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") int len = math.floor(loxxpaaspecial.paa(close, 1., 0.)) len := len < 1 ? 1 : len high_ = ta.highest(hl2, len) low_ = ta.lowest(hl2, len) round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val value = 0.0 value := round_(.66 * ((hl2 - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) fish1 = 0.0 fish1 := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1[1]) fish2 = fish1[1] hth = fisherOb1 lth = fisherOs1 middle = 0. plot(hth+1.5, color = color.new(color.white, 100), title = "Upper UI Constraint") plot(lth-1.5, color = color.new(color.white, 100), title = "Lower UI Constraint") tl = plot(hth+1, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 2") tl1 = plot(hth, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 1") plot(middle, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero") bl1 = plot(lth, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 1") bl = plot(lth-1, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 2") fill(tl, tl1, color=color.new(color.gray, 85), title = "Top Boundary Fill Color") fill(bl, bl1, color=color.new(color.gray, 85), title = "Bottom Boundary Fill Color") color_out = signalMode == SM03 ? (fish1 > fish2 ? greencolor : redcolor) : (fish1 >= 0 and fish1 > fish2 ? greencolor : fish1 < 0 and fish1 < fish2 ? redcolor : color.gray) plot(fish1, color = color_out, title='Fisher', linewidth = 3) plot(fish2, color = color.white, title = "Signale") barcolor(colorbars ? color_out : na) goLong = signalMode == SM03 ? ta.crossover(fish1, fish2) : ta.crossover(fish1, 0) goShort = signalMode == SM03 ? ta.crossunder(fish1, fish2) : ta.crossunder(fish1, 0) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="Phase Accumulation Adaptive Fisher Transform [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="Phase Accumulation Adaptive Fisher Transform [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
APA Adaptive Fisher Transform [Loxx]
https://www.tradingview.com/script/iyRDwkHk-APA-Adaptive-Fisher-Transform-Loxx/
loxx
https://www.tradingview.com/u/loxx/
48
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("APA Adaptive Fisher Transform [Loxx]", overlay = false, shorttitle="APAAFT [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D SM02 = 'Zero-Line Cross' SM03 = 'Signal Crossover' _f_hp(_src, int max_len) => c = 360 * math.pi / 180 _alpha = (1 - math.sin(c / max_len)) / math.cos(c / max_len) _hp = 0.0 _hp := 0.5 * (1 + _alpha) * (_src - nz(_src[1])) + _alpha * nz(_hp[1]) _hp _f_ess(_src, int _len) => s = 1.414 //sqrt 2 _a = math.exp(-s * math.pi / _len) _b = 2 * _a * math.cos(s * math.pi / _len) _c2 = _b _c3 = -_a * _a _c1 = 1 - _c2 - _c3 _out = 0.0 _out := _c1 * (_src + nz(_src[1])) / 2 + _c2 * nz(_out[1], nz(_src[1], _src)) + _c3 * nz(_out[2], nz(_src[2], nz(_src[1], _src))) _out _auto_dom_imp(src, min_len, max_len, ave_len) => c = 2 * math.pi s = 1.414 filt = _f_ess(_f_hp(src, max_len), min_len) arr_size = max_len * 2 var corr = array.new_float(arr_size, initial_value=0) var cospart = array.new_float(arr_size, initial_value=0) var sinpart = array.new_float(arr_size, initial_value=0) var sqsum = array.new_float(arr_size, initial_value=0) var r1 = array.new_float(arr_size, initial_value=0) var r2 = array.new_float(arr_size, initial_value=0) var pwr = array.new_float(arr_size, initial_value=0) for lag = 0 to max_len by 1 m = ave_len == 0 ? lag : ave_len Sx = 0.0 Sy = 0.0 Sxx = 0.0 Syy = 0.0 Sxy = 0.0 for i = 0 to m - 1 by 1 x = nz(filt[i]) y = nz(filt[lag + i]) Sx += x Sy += y Sxx += x * x Sxy += x * y Syy += y * y Syy if (m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy) > 0 array.set(corr, lag, (m * Sxy - Sx * Sy) / math.sqrt((m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy))) for period = min_len to max_len by 1 array.set(cospart, period, 0) array.set(sinpart, period, 0) for n = ave_len to max_len by 1 array.set(cospart, period, nz(array.get(cospart, period)) + nz(array.get(corr, n)) * math.cos(c * n / period)) array.set(sinpart, period, nz(array.get(sinpart, period)) + nz(array.get(corr, n)) * math.sin(c * n / period)) array.set(sqsum, period, math.pow(nz(array.get(cospart, period)), 2) + math.pow(nz(array.get(sinpart, period)), 2)) for period = min_len to max_len by 1 array.set(r2, period, nz(array.get(r1, period))) array.set(r1, period, 0.2 * math.pow(nz(array.get(sqsum, period)), 2) + 0.8 * nz(array.get(r2, period))) maxpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(r1, period)) > maxpwr maxpwr := nz(array.get(r1, period)) for period = ave_len to max_len by 1 array.set(pwr, period, nz(array.get(r1, period)) / maxpwr) peakpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) > peakpwr peakpwr := nz(array.get(pwr, period)) spx = 0.0, sp = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) >= 0.5 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) for period = min_len to max_len by 1 if peakpwr >= 0.25 and nz(array.get(pwr, period)) >= 0.25 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) dominantcycle = 0.0 dominantcycle := sp != 0 ? spx / sp : dominantcycle dominantcycle := sp < 0.25 ? dominantcycle[1] : dominantcycle dominantcycle := dominantcycle < 1 ? 1 : dominantcycle dominantcycle signalMode = input.string(SM02, 'Signal Type', options=[SM02, SM03], group = "Basic Settings") fisherOb1 = input.float(2, minval=1, step = 0.1, title='Overbought Level', group = "Basic Settings") fisherOs1 = input.float(-2, maxval=-1, step = 0.1, title='Oversold Level', group = "Basic Settings") auto_src = input.source(close, "Auto Source", group = "Autocorrelation Periodogram Settings") auto_min = input.int(10, title='Auto Minnimum Length',minval = 1, group = "Autocorrelation Periodogram Settings") auto_max = input.int(48, title='Auto Maximum Length', minval = 1, group = "Autocorrelation Periodogram Settings") auto_avg = input.int(3, title='Auto Average Length', minval = 1, group = "Autocorrelation Periodogram Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") masterdom = _auto_dom_imp(auto_src, auto_min, auto_max, auto_avg) int len = math.floor(masterdom) < 1 ? 1 : math.floor(masterdom) len := nz(len, 1) high_ = ta.highest(hl2, len) low_ = ta.lowest(hl2, len) round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val value = 0.0 value := round_(.66 * ((hl2 - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) fish1 = 0.0 fish1 := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1[1]) fish2 = fish1[1] hth = fisherOb1 lth = fisherOs1 middle = 0. plot(hth+1.5, color = color.new(color.white, 100), title = "Upper UI Constraint") plot(lth-1.5, color = color.new(color.white, 100), title = "Lower UI Constraint") tl = plot(hth+1, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 2") tl1 = plot(hth, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 1") plot(middle, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero") bl1 = plot(lth, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 1") bl = plot(lth-1, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 2") fill(tl, tl1, color=color.new(color.gray, 85), title = "Top Boundary Fill Color") fill(bl, bl1, color=color.new(color.gray, 85), title = "Bottom Boundary Fill Color") color_out = signalMode == SM03 ? (fish1 > fish2 ? greencolor : redcolor) : (fish1 >= 0 and fish1 > fish2 ? greencolor : fish1 < 0 and fish1 < fish2 ? redcolor : color.gray) plot(fish1, color = color_out, title='Fisher', linewidth = 3) plot(fish2, color = color.white, title = "Signale") barcolor(colorbars ? color_out : na) goLong = signalMode == SM03 ? ta.crossover(fish1, fish2) : ta.crossover(fish1, 0) goShort = signalMode == SM03 ? ta.crossunder(fish1, fish2) : ta.crossunder(fish1, 0) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="APA Adaptive Fisher Transform [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="APA Adaptive Fisher Transform [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
VHF Adaptive Fisher Transform [Loxx]
https://www.tradingview.com/script/ioyA0JHc-VHF-Adaptive-Fisher-Transform-Loxx/
loxx
https://www.tradingview.com/u/loxx/
56
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("VHF Adaptive Fisher Transform [Loxx]", overlay = false, shorttitle="VHFAFT [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) import loxx/loxxjuriktools/1 greencolor = #2DD204 redcolor = #D2042D SM02 = 'Zero-Line Cross' SM03 = 'Signal Crossover' signalMode = input.string(SM02, 'Signal Type', options=[SM02, SM03], group = "Basic Settings") fisherOb1 = input.float(2, minval=1, step = 0.1, title='Overbought Level', group = "Basic Settings") fisherOs1 = input.float(-2, maxval=-1, step = 0.1, title='Oversold Level', group = "Basic Settings") vhfper = input.int(15, "VHF Sample Period", minval = 1, group = "CFB Ingest Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") vmax = ta.highest(hl2, vhfper) vmin = ta.lowest(hl2, vhfper) noise = math.sum(math.abs(ta.change(hl2)), vhfper) vhf = math.abs(vmax - vmin) / noise len = nz(int(-math.log(vhf) * vhfper), 1) len := len < 1 ? 1 : len high_ = ta.highest(hl2, len) low_ = ta.lowest(hl2, len) round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val value = 0.0 value := round_(.66 * ((hl2 - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) fish1 = 0.0 fish1 := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1[1]) fish2 = fish1[1] hth = fisherOb1 lth = fisherOs1 middle = 0. plot(hth+1.5, color = color.new(color.white, 100), title = "Upper UI Constraint") plot(lth-1.5, color = color.new(color.white, 100), title = "Lower UI Constraint") tl = plot(hth+1, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 2") tl1 = plot(hth, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 1") plot(middle, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero") bl1 = plot(lth, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 1") bl = plot(lth-1, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 2") fill(tl, tl1, color=color.new(color.gray, 85), title = "Top Boundary Fill Color") fill(bl, bl1, color=color.new(color.gray, 85), title = "Bottom Boundary Fill Color") color_out = signalMode == SM03 ? (fish1 > fish2 ? greencolor : redcolor) : (fish1 >= 0 and fish1 > fish2 ? greencolor : fish1 < 0 and fish1 < fish2 ? redcolor : color.gray) plot(fish1, color = color_out, title='Fisher', linewidth = 3) plot(fish2, color = color.white, title = "Signale") barcolor(colorbars ? color_out : na) goLong = signalMode == SM03 ? ta.crossover(fish1, fish2) : ta.crossover(fish1, 0) goShort = signalMode == SM03 ? ta.crossunder(fish1, fish2) : ta.crossunder(fish1, 0) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="VHF Adaptive Fisher Transform [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="VHF Adaptive Fisher Transform [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
CFB Adaptive Fisher Transform [Loxx]
https://www.tradingview.com/script/kfcubPWp-CFB-Adaptive-Fisher-Transform-Loxx/
loxx
https://www.tradingview.com/u/loxx/
43
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("CFB Adaptive Fisher Transform [Loxx]", overlay = false, shorttitle="CFBAFT [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) import loxx/loxxjuriktools/1 greencolor = #2DD204 redcolor = #D2042D SM02 = 'Zero-Line Cross' SM03 = 'Signal Crossover' signalMode = input.string(SM02, 'Signal Type', options=[SM02, SM03], group = "Basic Settings") fisherOb1 = input.float(2, minval=1, step = 0.1, title='Overbought Level', group = "Basic Settings") fisherOs1 = input.float(-2, maxval=-1, step = 0.1, title='Oversold Level', group = "Basic Settings") nlen = input.int(50, "CFB Normal Period", minval = 1, group = "CFB Ingest Settings") cfb_len = input.int(10, "CFB Depth", maxval = 10, group = "CFB Ingest Settings") smth = input.int(8, "CFB Smooth Period", minval = 1, group = "CFB Ingest Settings") slim = input.int(10, "CFB Short Limit", minval = 1, group = "CFB Ingest Settings") llim = input.int(20, "CFB Long Limit", minval = 1, group = "CFB Ingest Settings") jcfbsmlen = input.int(10, "CFB Jurik Smooth Period", minval = 1, group = "CFB Ingest Settings") jcfbsmph = input.float(0, "CFB Jurik Smooth Phase", group = "CFB Ingest Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") cfb_draft = loxxjuriktools.jcfb(hl2, cfb_len, smth) cfb_pre = loxxjuriktools.jurik_filt(loxxjuriktools.jurik_filt(cfb_draft, jcfbsmlen, jcfbsmph), jcfbsmlen, jcfbsmph) max = ta.highest(cfb_pre, nlen) min = ta.lowest(cfb_pre, nlen) denom = max - min ratio = (denom > 0) ? (cfb_pre - min) / denom : 0.5 len = math.ceil(slim + ratio * (llim - slim)) high_ = ta.highest(hl2, len) low_ = ta.lowest(hl2, len) round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val value = 0.0 value := round_(.66 * ((hl2 - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) fish1 = 0.0 fish1 := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1[1]) fish2 = fish1[1] hth = fisherOb1 lth = fisherOs1 middle = 0. plot(hth+1.5, color = color.new(color.white, 100), title = "Upper UI Constraint") plot(lth-1.5, color = color.new(color.white, 100), title = "Lower UI Constraint") tl = plot(hth+1, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 2") tl1 = plot(hth, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 1") plot(middle, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero") bl1 = plot(lth, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 1") bl = plot(lth-1, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 2") fill(tl, tl1, color=color.new(color.gray, 85), title = "Top Boundary Fill Color") fill(bl, bl1, color=color.new(color.gray, 85), title = "Bottom Boundary Fill Color") color_out = signalMode == SM03 ? (fish1 > fish2 ? greencolor : redcolor) : (fish1 >= 0 and fish1 > fish2 ? greencolor : fish1 < 0 and fish1 < fish2 ? redcolor : color.gray) plot(fish1, color = color_out, title='Fisher', linewidth = 3) plot(fish2, color = color.white, title = "Signale") barcolor(colorbars ? color_out : na) goLong = signalMode == SM03 ? ta.crossover(fish1, fish2) : ta.crossover(fish1, 0) goShort = signalMode == SM03 ? ta.crossunder(fish1, fish2) : ta.crossunder(fish1, 0) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="CFB Adaptive Fisher Transform [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="CFB Adaptive Fisher Transform [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
CryptoCurrency Short X-Ray
https://www.tradingview.com/script/wkufZXgl-CryptoCurrency-Short-X-Ray/
EsIstTurnt
https://www.tradingview.com/u/EsIstTurnt/
78
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © EsIstTurnt //@version=5 indicator("CryptoCurrency Short X-Ray") tf =input.timeframe('',title='TimeFrame') btcshorts ='BTCUSDSHORTS' ethshorts ='ETHUSDSHORTS' solshorts ='SOLUSDSHORTS' adashorts ='ADAUSDSHORTS' xmrshorts ='XMRUSDSHORTS' xrpshorts ='XRPUSDSHORTS' allshorts ='BTCUSDSHORTS+ETHUSDSHORTS+SOLUSDSHORTS+ADAUSDSHORTS+XMRUSDSHORTS+XRPUSDSHORTS' o_btc_short =request.security('BTCUSDSHORTS',tf,open ) h_btc_short =request.security('BTCUSDSHORTS',tf,high ) l_btc_short =request.security('BTCUSDSHORTS',tf,low ) c_btc_short =request.security('BTCUSDSHORTS',tf,close) o_eth_short =request.security('ETHUSDSHORTS',tf,open ) h_eth_short =request.security('ETHUSDSHORTS',tf,high ) l_eth_short =request.security('ETHUSDSHORTS',tf,low ) c_eth_short =request.security('ETHUSDSHORTS',tf,close) o_sol_short =request.security('SOLUSDSHORTS',tf,open ) h_sol_short =request.security('SOLUSDSHORTS',tf,high ) l_sol_short =request.security('SOLUSDSHORTS',tf,low ) c_sol_short =request.security('SOLUSDSHORTS',tf,close) o_ada_short =request.security('ADAUSDSHORTS',tf,open ) h_ada_short =request.security('ADAUSDSHORTS',tf,high ) l_ada_short =request.security('ADAUSDSHORTS',tf,low ) c_ada_short =request.security('ADAUSDSHORTS',tf,close) o_xmr_short =request.security('XMRUSDSHORTS',tf,open ) h_xmr_short =request.security('XMRUSDSHORTS',tf,high ) l_xmr_short =request.security('XMRUSDSHORTS',tf,low ) c_xmr_short =request.security('XMRUSDSHORTS',tf,close) o_xrp_short =request.security('XRPUSDSHORTS',tf,open ) h_xrp_short =request.security('XRPUSDSHORTS',tf,high ) l_xrp_short =request.security('XRPUSDSHORTS',tf,low ) c_xrp_short =request.security('XRPUSDSHORTS',tf,close) current =request.security(syminfo.ticker ,tf,close) all =request.security('allshorts',tf,close) combined =math.avg(c_btc_short,c_eth_short,c_sol_short,c_ada_short,c_xmr_short,c_xrp_short) shortdata =input.string(btcshorts,"Short Data Stream",options = [btcshorts,ethshorts,solshorts,adashorts,xmrshorts,xrpshorts,allshorts]) o_datastream=request.security(shortdata,tf,open ) h_datastream=request.security(shortdata,tf,high ) l_datastream=request.security(shortdata,tf,low ) c_datastream=request.security(shortdata,tf,close) shortsup =(c_datastream>=c_datastream[1]) shortsdn =(c_datastream<=c_datastream[1]) currentup =( current >= current[1]) currentdn =(current <=current[1]) shorting = shortsup and currentdn covering = shortsdn and currentup buying = currentup and not covering selling = currentdn and not shorting shortcolor=shorting?color.new(input.color(color.orange,title='Shorts Shorting'),0):selling?color.new(input.color(color.red,title='People are Selling'),0):covering?color.new(input.color(color.blue,title='Shorts are Covering'),0):buying?color.new(input.color(color.green,title='People are Buying'),0):color.gray highshorts=ta.highest(h_datastream,1024) lowshorts=ta.lowest(l_datastream ,1024) avshorts=math.avg(highshorts,lowshorts) havshorts=math.avg(highshorts,avshorts) lavshorts=math.avg(avshorts,lowshorts) //plot(factorstream,color=currentchange>datachange?color.red:color.green) plotcandle(o_datastream,h_datastream,l_datastream,c_datastream,color=shortcolor,wickcolor=shortcolor,bordercolor=shortcolor) plot(highshorts,color=color.new(h_datastream>=highshorts?na:color.gray,20) ,linewidth=1) plot(lowshorts ,color=color.new(l_datastream<=lowshorts ?na:color.gray,20) ,linewidth=1) plot(avshorts ,color=color.new(color.white,50) ,linewidth=1) plot(havshorts ,color=color.new(color.black,20) ,linewidth=1) plot(lavshorts ,color=color.new(color.black,20) ,linewidth=1) //plot(formatted)
Goertzel Cycle Period Adaptive Fisher Transform [Loxx]
https://www.tradingview.com/script/t0cwj3Ba-Goertzel-Cycle-Period-Adaptive-Fisher-Transform-Loxx/
loxx
https://www.tradingview.com/u/loxx/
67
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Goertzel Cycle Period Adaptive Fisher Transform [Loxx]", overlay = false, shorttitle="GCPFT [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D SM02 = 'Zero-Line Cross' SM03 = 'Signal Crossover' _goertzel_cycle_period(float src, int per)=> float[] goeWork1 = array.new_float(per * 3, 0.) //Power array float[] goeWork2 = array.new_float(per * 3, 0.) //Theta array float[] goeWork3 = array.new_float(per * 3, 0.) //Store cylces float[] goeWork4 = array.new_float(per * 3, 0.) //Store ingest values float temp1 = nz(src[3 * per - 1]) //get first bar for calculation float temp2 = (src - temp1) / (3 * per - 1) // Real float temp3 = 0. //Imaginary for k = 3 * per - 1 to 1 float temp = src[k - 1] - (temp1 + temp2 * (3 * per - k)) array.set(goeWork4, k, temp) array.set(goeWork3, k, 0.) for k = 2 to per float w = 0., float x = 0., float y = 0. float z = math.pow(k, -1) temp1 := 2.0 * math.cos(2.0 * math.pi * z) //The first stage calculates an intermediate sequence, s[n] for i = 3 * per-1 to 1 w := temp1 * x - y + nz(array.get(goeWork4, i)) y := x x := w // The second stage applies the following filter to y[n] // 1. The first filter stage can be observed to be a second-order IIR filter with a direct-form structure TBD // 2. The second-stage filter can be observed to be a FIR filter, since its calculations do not use any of its past outputs. TBD // calculate Real component temp2 := x - y / 2.0 * temp1 if (temp2 == 0.0) temp2 := 0.0000001 // calculate Imaginary component temp3 := y * math.sin(2.0 * math.pi * z) // calculate Power array.set(goeWork1, k, math.pow(temp2, 2) + math.pow(temp3, 2)) // calculate Theta array.set(goeWork2, k, math.atan(temp3 / temp2)) if (temp2 < 0.0) array.set(goeWork2, k, nz(array.get(goeWork2, k)) + math.pi) else if (temp3 < 0.0) array.set(goeWork2, k, nz(array.get(goeWork2, k)) + 2.0 * math.pi) // Parse cycles for k = 3 to per - 1 if (nz(array.get(goeWork1, k)) > nz(array.get(goeWork1, k + 1)) and nz(array.get(goeWork1, k)) > nz(array.get(goeWork1, k-1))) array.set(goeWork3, k, k * math.pow(10, -4)) else array.set(goeWork3, k, 0.0) // count cycles int number_of_cycles = 0 for i = 0 to per + 1 if (nz(array.get(goeWork3, i)) > 0.0) number_of_cycles := number_of_cycles + 1 number_of_cycles signalMode = input.string(SM02, 'Signal Type', options=[SM02, SM03], group = "Basic Settings") fisherOb1 = input.float(2, minval=1, step = 0.1, title='Overbought Level', group = "Basic Settings") fisherOs1 = input.float(-2, maxval=-1, step = 0.1, title='Oversold Level', group = "Basic Settings") src = input.source(close, "Source", group = "Goertzel Cycle Period Settings") per = input.int(80, "Max Period", group = "Goertzel Cycle Period Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") showsignals = input.bool(false, "Show signals?", group = "UI Options") len = _goertzel_cycle_period(src, per) len := len < 1 ? 1 : len high_ = ta.highest(hl2, len) low_ = ta.lowest(hl2, len) round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val value = 0.0 value := round_(.66 * ((hl2 - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) fish1 = 0.0 fish1 := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1[1]) fish2 = fish1[1] hth = fisherOb1 lth = fisherOs1 middle = 0. plot(hth+1.5, color = color.new(color.white, 100), title = "Upper UI Constraint") plot(lth-1.5, color = color.new(color.white, 100), title = "Lower UI Constraint") tl = plot(hth+1, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 2") tl1 = plot(hth, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 1") plot(middle, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero") bl1 = plot(lth, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 1") bl = plot(lth-1, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 2") fill(tl, tl1, color=color.new(color.gray, 85), title = "Top Boundary Fill Color") fill(bl, bl1, color=color.new(color.gray, 85), title = "Bottom Boundary Fill Color") color_out = signalMode == SM03 ? (fish1 > fish2 ? greencolor : redcolor) : (fish1 >= 0 and fish1 > fish2 ? greencolor : fish1 < 0 and fish1 < fish2 ? redcolor : color.gray) plot(fish1, color = color_out, title='Fisher', linewidth = 3) plot(fish2, color = color.white, title = "Signale") barcolor(colorbars ? color_out : na) goLong = signalMode == SM03 ? ta.crossover(fish1, fish2) : ta.crossover(fish1, 0) goShort = signalMode == SM03 ? ta.crossunder(fish1, fish2) : ta.crossunder(fish1, 0) plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) alertcondition(goLong, title="Long", message="Goertzel Cycle Period Adaptive Fisher Transform [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title="Short", message="Goertzel Cycle Period Adaptive Fisher Transform [Loxx]: Short\nSymbol: {{ticker}}\nPrice: {{close}}")
Titans Trend Lines
https://www.tradingview.com/script/C4YqlS94-Titans-Trend-Lines/
mmmarsh
https://www.tradingview.com/u/mmmarsh/
273
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © mmmarsh //@version=4 study("Trend Lines",overlay=true) //This indicator will plot out trend lines based on recent pivot highs and lows pivotSensitivityL=input(defval=9,type=input.integer,title="Pivot Sensitivity Left") pivotSensitivityR=input(defval=9,type=input.integer,title="Pivot Sensitivity Right") pivotHigh=pivothigh(pivotSensitivityL,pivotSensitivityR) pivotLow=pivotlow(pivotSensitivityL,pivotSensitivityR) plotchar(pivotHigh, char='H', location=location.abovebar, color=color.purple, offset=-pivotSensitivityR) plotchar(pivotLow, char='L', location=location.belowbar, color=color.purple, offset=-pivotSensitivityR) searchWindow=input(defval=100,type=input.integer,title="Search Window") //Find the first pivot high barHigh1=0 barHigh2=0 for i=0 to searchWindow if pivotHigh[i]>0 barHigh1:=i break //Find the second pivot high barHigh2:=barHigh1+1 for j=barHigh2 to barHigh2+searchWindow if pivotHigh[j]>0 barHigh2:=j break barHigh1:=barHigh1+pivotSensitivityR barHigh2:=barHigh2+pivotSensitivityR lineHigh=line.new(bar_index-barHigh2, high[barHigh2], bar_index-barHigh1, high[barHigh1], extend=extend.both, color=color.purple, style=line.style_dotted, width=2) line.set_color(id=lineHigh[1],color=color.new(color.gray,50)) line.delete(id=lineHigh[2]) //Find the first pivot low barLow1=0 barLow2=0 for k=0 to searchWindow if pivotLow[k]>0 barLow1:=k break //Find the second pivot low barLow2:=barLow1+1 for m=barLow2 to barLow2+searchWindow if pivotLow[m]>0 barLow2:=m break barLow1:=barLow1+pivotSensitivityR barLow2:=barLow2+pivotSensitivityR lineLow=line.new(bar_index-barLow2, low[barLow2], bar_index-barLow1, low[barLow1], extend=extend.both, color=color.purple, style=line.style_dotted, width=2) line.set_color(id=lineLow[1],color=color.new(color.gray,50)) line.delete(id=lineLow[2])
switches [experimental / tools]
https://www.tradingview.com/script/lox9kzQ4-switches-experimental-tools/
fikira
https://www.tradingview.com/u/fikira/
61
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © fikira //@version=5 indicator("Switches v2") c = '     color line' // –––––––––––––––––––––––––––––––––––––––––––––[ BOX 1 ]––––––––––––––––––––––––––––––––––––––––––––––––––– // // ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– // // c2 = input.color (color.orange , title=c , group='🔶   set 1' , inline='s') // // –––––––[ input.time -> location switch ]––––––– tB2 = input.time (timestamp("1 Jul 2022") , title='     ' , group='     🔹  line ' , inline='1') // // –––––––[ different ticker options ]––––––– tck1 = input.symbol ('BINANCE:BTCUSDT' , title='      1' , group='     🔹  Ticker' , inline='1') tck2 = input.symbol ('BINANCE:ETHUSDT' , title='      2' , group='     🔹  Ticker' , inline='2') tck3 = input.symbol ('BINANCE:BNBUSDT' , title='      3' , group='     🔹  Ticker' , inline='3') // ––––––––––––––––––––––––––––––––––––––––––––––[ BOX 2 ]––––––––––––––––––––––––––––––––––––––––––––––––––– // // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– // // c3 = input.color (color.fuchsia , title=c , group='🔶   set 2' , inline='s') // // –––––––[ input.time -> location switch ]––––––– tB3 = input.time (timestamp("4 Jul 2022") , title='     ' , group='     🔹  line ' , inline='2') // // –––––––[ different timeframe options ]––––––– res1 = input.timeframe( 'D' , title='      1' , group='     🔹  Timeframe' , inline='1') res2 = input.timeframe('3D' , title='      2' , group='     🔹  Timeframe' , inline='2') res3 = input.timeframe( 'W' , title='      3' , group='     🔹  Timeframe' , inline='3') // ––––––––––––––––––––––––––––––––––––––––––––––[ BOX 3 ]––––––––––––––––––––––––––––––––––––––––––––––––––– // // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– // // c1 = input.color (color.blue , title=c , group='🔶   set 3' , inline='s') // // –––––––[ input.time -> location switch ]––––––– tB1 = input.time (timestamp("7 Jul 2022") , title='     ' , group='     🔹  line' , inline='3') // // –––––––[ different lengths for sma ]––––––– l1 = input.int ( 7 , title='      1' , group='     🔹  Length RSI', inline='1') l2 = input.int ( 10 , title='      2' , group='     🔹  Length RSI', inline='2') l3 = input.int ( 14 , title='      3' , group='     🔹  Length RSI', inline='3') l4 = input.int ( 21 , title='      4' , group='     🔹  Length RSI', inline='4') // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– // // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– // // –––––––[ variables ]––––––– res = '' var label lab = label.new(bar_index , 0, xloc=xloc.bar_index, style=label.style_none , text='', textcolor=color.white) var line lnA_1 = line.new (time, 0, time, 0, xloc=xloc.bar_time , style=line.style_solid , color=color.new(c1, 25), extend=extend.none, width=5) var line lnB_1 = line.new (time, 0, time, 0, xloc=xloc.bar_time , style=line.style_dotted, color=color.new(c1, 50), extend=extend.both, width=1) var box box_1 = box.new (time, 0, time, 0, xloc=xloc.bar_time , bgcolor=na, border_color=na) var line lnA_2 = line.new (time, 0, time, 0, xloc=xloc.bar_time , style=line.style_solid , color=color.new(c2, 25), extend=extend.none, width=5) var line lnB_2 = line.new (time, 0, time, 0, xloc=xloc.bar_time , style=line.style_dotted, color=color.new(c2, 50), extend=extend.both, width=1) var box box_2 = box.new (time, 0, time, 0, xloc=xloc.bar_time , bgcolor=na, border_color=na) var line lnA_3 = line.new (time, 0, time, 0, xloc=xloc.bar_time , style=line.style_solid , color=color.new(c3, 25), extend=extend.none, width=5) var line lnB_3 = line.new (time, 0, time, 0, xloc=xloc.bar_time , style=line.style_dotted, color=color.new(c3, 50), extend=extend.both, width=1) var box box_3 = box.new (time, 0, time, 0, xloc=xloc.bar_time , bgcolor=na, border_color=na) var float rsi = na var float[] a_rsi = array.new_float(36) var color[] a_c_1 = array.from( #FF0000 , color.blue , color.yellow, color.lime) var color[] a_c_2 = array.from(color.red , color.blue , color.lime ) var color[] a_c_3 = array.from(color.red , color.blue , color.lime ) var int[] aTime1 = array.new_int (4) var int[] aTime2 = array.new_int (3) var int[] aTime3 = array.new_int (3) var label[] lb1 = array.new_label() var label[] lb2 = array.new_label() var label[] lb3 = array.new_label() var string[] a_str = array.from( tck1 , tck2 , tck3 ) var int [] a_len = array.from( l1 , l2 , l3 , l4 ) var string[] a_st3 = array.from( res1 , res2 , res3 ) var int ix1 = 0, var int ix2 = 0, var int ix3 = 0 var int tA1 = 0, var int tA2 = 0, var int tA3 = 0 var int b1 = -1 var int width = na sec(ticker, res, len) => request.security(ticker, res, ta.rsi(close, len)) set(value , n) => array.set (a_rsi , n, value) if time >= chart.left_visible_bar_time and b1 < 0 b1 := bar_index width := last_bar_index - b1 part = (chart.right_visible_bar_time - chart.left_visible_bar_time) / width pos1_1 = chart.right_visible_bar_time - (part * 5) pos2_1 = chart.right_visible_bar_time - (part * 4) pos3_1 = chart.right_visible_bar_time - (part * 3) pos4_1 = chart.right_visible_bar_time - (part * 2) pos1_2 = chart.right_visible_bar_time - (part * 9) pos2_2 = chart.right_visible_bar_time - (part * 8) pos3_2 = chart.right_visible_bar_time - (part * 7) pos1_3 = chart.right_visible_bar_time - (part * 13) pos2_3 = chart.right_visible_bar_time - (part * 12) pos3_3 = chart.right_visible_bar_time - (part * 11) ix1 := tB1 <= pos1_1 ? 0 : tB1 > pos1_1 and tB1 <= pos2_1 ? 1 : tB1 > pos2_1 and tB1 <= pos3_1 ? 2 : 3 tA1 := tB1 <= pos1_1 ? pos1_1 : tB1 > pos1_1 and tB1 <= pos2_1 ? pos2_1 : tB1 > pos2_1 and tB1 <= pos3_1 ? pos3_1 : pos4_1 ix2 := tB2 <= pos1_2 ? 0 : tB2 > pos1_2 and tB2 <= pos2_2 ? 1 : 2 tA2 := tB2 <= pos1_2 ? pos1_2 : tB2 > pos1_2 and tB2 <= pos2_2 ? pos2_2 : pos3_2 ix3 := tB3 <= pos1_3 ? 0 : tB3 > pos1_3 and tB3 <= pos2_3 ? 1 : 2 tA3 := tB3 <= pos1_3 ? pos1_3 : tB3 > pos1_3 and tB3 <= pos2_3 ? pos2_3 : pos3_3 if bar_index == b1 aTime1 := array.from(pos1_1, pos2_1, pos3_1, pos4_1) aTime2 := array.from(pos1_2, pos2_2, pos3_2 ) aTime3 := array.from(pos1_3, pos2_3, pos3_3 ) n = 0 tf1_ticker1_len1 = sec(tck1, res1, l1), set(tf1_ticker1_len1, n), n += 1 tf1_ticker1_len2 = sec(tck1, res1, l2), set(tf1_ticker1_len2, n), n += 1 tf1_ticker1_len3 = sec(tck1, res1, l3), set(tf1_ticker1_len3, n), n += 1 tf1_ticker1_len4 = sec(tck1, res1, l4), set(tf1_ticker1_len4, n), n += 1 tf1_ticker2_len1 = sec(tck2, res1, l1), set(tf1_ticker2_len1, n), n += 1 tf1_ticker2_len2 = sec(tck2, res1, l2), set(tf1_ticker2_len2, n), n += 1 tf1_ticker2_len3 = sec(tck2, res1, l3), set(tf1_ticker2_len3, n), n += 1 tf1_ticker2_len4 = sec(tck2, res1, l4), set(tf1_ticker2_len4, n), n += 1 tf1_ticker3_len1 = sec(tck3, res1, l1), set(tf1_ticker3_len1, n), n += 1 tf1_ticker3_len2 = sec(tck3, res1, l2), set(tf1_ticker3_len2, n), n += 1 tf1_ticker3_len3 = sec(tck3, res1, l3), set(tf1_ticker3_len3, n), n += 1 tf1_ticker3_len4 = sec(tck3, res1, l4), set(tf1_ticker3_len4, n), n += 1 tf2_ticker1_len1 = sec(tck1, res2, l1), set(tf2_ticker1_len1, n), n += 1 tf2_ticker1_len2 = sec(tck1, res2, l2), set(tf2_ticker1_len2, n), n += 1 tf2_ticker1_len3 = sec(tck1, res2, l3), set(tf2_ticker1_len3, n), n += 1 tf2_ticker1_len4 = sec(tck1, res2, l4), set(tf2_ticker1_len4, n), n += 1 tf2_ticker2_len1 = sec(tck2, res2, l1), set(tf2_ticker2_len1, n), n += 1 tf2_ticker2_len2 = sec(tck2, res2, l2), set(tf2_ticker2_len2, n), n += 1 tf2_ticker2_len3 = sec(tck2, res2, l3), set(tf2_ticker2_len3, n), n += 1 tf2_ticker2_len4 = sec(tck2, res2, l4), set(tf2_ticker2_len4, n), n += 1 tf2_ticker3_len1 = sec(tck3, res2, l1), set(tf2_ticker3_len1, n), n += 1 tf2_ticker3_len2 = sec(tck3, res2, l2), set(tf2_ticker3_len2, n), n += 1 tf2_ticker3_len3 = sec(tck3, res2, l3), set(tf2_ticker3_len3, n), n += 1 tf2_ticker3_len4 = sec(tck3, res2, l4), set(tf2_ticker3_len4, n), n += 1 tf3_ticker1_len1 = sec(tck1, res3, l1), set(tf3_ticker1_len1, n), n += 1 tf3_ticker1_len2 = sec(tck1, res3, l2), set(tf3_ticker1_len2, n), n += 1 tf3_ticker1_len3 = sec(tck1, res3, l3), set(tf3_ticker1_len3, n), n += 1 tf3_ticker1_len4 = sec(tck1, res3, l4), set(tf3_ticker1_len4, n), n += 1 tf3_ticker2_len1 = sec(tck2, res3, l1), set(tf3_ticker2_len1, n), n += 1 tf3_ticker2_len2 = sec(tck2, res3, l2), set(tf3_ticker2_len2, n), n += 1 tf3_ticker2_len3 = sec(tck2, res3, l3), set(tf3_ticker2_len3, n), n += 1 tf3_ticker2_len4 = sec(tck2, res3, l4), set(tf3_ticker2_len4, n), n += 1 tf3_ticker3_len1 = sec(tck3, res3, l1), set(tf3_ticker3_len1, n), n += 1 tf3_ticker3_len2 = sec(tck3, res3, l2), set(tf3_ticker3_len2, n), n += 1 tf3_ticker3_len3 = sec(tck3, res3, l3), set(tf3_ticker3_len3, n), n += 1 tf3_ticker3_len4 = sec(tck3, res3, l4), set(tf3_ticker3_len4, n), n += 1 if barstate.isfirst for i = 0 to 4 array.unshift(lb1, label.new(bar_index, 105, xloc=xloc.bar_time, style=label.style_none, size=size.tiny)) for i = 0 to 3 array.unshift(lb2, label.new(bar_index, 105, xloc=xloc.bar_time, style=label.style_none, size=size.tiny)) for i = 0 to 3 array.unshift(lb3, label.new(bar_index, 105, xloc=xloc.bar_time, style=label.style_none, size=size.tiny)) if barstate.islast box.set_bgcolor (box_1, color.new(array.get(a_c_1, ix1), 50)) box.set_border_color (box_1, color.new(array.get(a_c_1, ix1), 50)) box.set_lefttop (box_1, pos1_1, 102), box.set_rightbottom(box_1, pos4_1, 112) line.set_xy1 (lnA_1, tA1 , 102), line.set_xy2 (lnA_1, tA1 , 112) line.set_xy1 (lnB_1, tB1 , 102), line.set_xy2 (lnB_1, tB1 , 112) // box.set_bgcolor (box_2, color.new(array.get(a_c_2, ix2), 50)) box.set_border_color (box_2, color.new(array.get(a_c_2, ix2), 50)) box.set_lefttop (box_2, pos1_2, 102), box.set_rightbottom(box_2, pos3_2, 112) line.set_xy1 (lnA_2, tA2 , 102), line.set_xy2 (lnA_2, tA2 , 112) line.set_xy1 (lnB_2, tB2 , 102), line.set_xy2 (lnB_2, tB2 , 112) // // box.set_bgcolor (box_3, color.new(array.get(a_c_3, ix3), 50)) box.set_border_color (box_3, color.new(array.get(a_c_3, ix3), 50)) box.set_lefttop (box_3, pos1_3, 102), box.set_rightbottom(box_3, pos3_3, 112) line.set_xy1 (lnA_3, tA3 , 102), line.set_xy2 (lnA_3, tA3 , 112) line.set_xy1 (lnB_3, tB3 , 102), line.set_xy2 (lnB_3, tB3 , 112) // for i = 0 to 3 label.set_x (array.get(lb1, i ), array.get(aTime1, i)) label.set_text (array.get(lb1, i ), str.tostring(i+1)) label.set_textcolor(array.get(lb1, i ), color.white ) label.set_y (array.get(lb1, ix1), 115 ) label.set_size (array.get(lb1, ix1), size.small ) label.set_textcolor (array.get(lb1, ix1), color.yellow ) // label.set_x (array.get(lb1, 4 ), array.get(aTime1, 2)) label.set_y (array.get(lb1, 4 ), 95 ) label.set_size (array.get(lb1, 4 ), size.small ) label.set_text (array.get(lb1, 4 ), 'Length sma' ) label.set_textcolor (array.get(lb1, 4 ), color.yellow ) // for i = 0 to 2 label.set_x (array.get(lb2, i ), array.get(aTime2, i)) label.set_text (array.get(lb2, i ), str.tostring(i+1)) label.set_textcolor(array.get(lb2, i ), color.white ) // label.set_x (array.get(lb3, i ), array.get(aTime3, i)) label.set_text (array.get(lb3, i ), str.tostring(i+1)) label.set_textcolor(array.get(lb3, i ), color.white ) // label.set_y (array.get(lb2, ix2), 115 ) label.set_size (array.get(lb2, ix2), size.small ) label.set_textcolor (array.get(lb2, ix2), color.yellow ) // label.set_x (array.get(lb2, 3 ), array.get(aTime2, 1)) label.set_y (array.get(lb2, 3 ), 95 ) label.set_size (array.get(lb2, 3 ), size.small ) label.set_text (array.get(lb2, 3 ), 'ticker' ) label.set_textcolor (array.get(lb2, 3 ), color.yellow ) // label.set_y (array.get(lb3, ix3), 115 ) label.set_size (array.get(lb3, ix3), size.small ) label.set_textcolor (array.get(lb3, ix3), color.yellow ) // label.set_x (array.get(lb3, 3 ), array.get(aTime3, 1)) label.set_y (array.get(lb3, 3 ), 95 ) label.set_size (array.get(lb3, 3 ), size.small ) label.set_text (array.get(lb3, 3 ), 'tf' ) label.set_textcolor (array.get(lb3, 3 ), color.yellow ) // label.set_xy (lab, bar_index + 3, 50) label.set_text(lab, array.get(a_str, ix2) + '\nRSI length : ' + str.tostring(array.get(a_len, ix1)) + '\ntimeframe  : ' + array.get(a_st3, ix3)) beginPos_timeframe = ix3 * (4 * 3) beginPos_ticker = ix2 * 4 position_len = ix1 positionInArray = beginPos_timeframe + beginPos_ticker + position_len rsi := array.size(a_rsi) > 0 ? array.get(a_rsi, positionInArray) : na plot(rsi, color=array.get(a_c_1, ix1)) hline(100, color=color.new(color.white, 75), linestyle= hline.style_solid, linewidth= 1) hline( 80, color=color.new(color.red , 50), linestyle= hline.style_solid, linewidth= 3) hline( 50, color=color.new(color.white, 75), linestyle= hline.style_solid, linewidth= 1) hline( 20, color=color.new(color.lime , 50), linestyle= hline.style_solid, linewidth= 3) hline( 0, color=color.new(color.white, 75), linestyle= hline.style_solid, linewidth= 1)
Unrecovered Imbalanced Zone with PVRSA
https://www.tradingview.com/script/gzA3P3pr-Unrecovered-Imbalanced-Zone-with-PVRSA/
theodrak
https://www.tradingview.com/u/theodrak/
460
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Credit to frozon, infernixx, Traders Reality and creengrack for ideas towards how to put this indicator togther //@version=5 indicator(title='Unrecovered Imbalanced Zone with PVSRA', shorttitle="Imbalanced PVSRA", overlay=true , max_boxes_count=500, max_lines_count=500) // Release Notes 10/Aug/2022 // 1. Added the ability to mark the entire body of the candle with an imbalance. // 2. Added an Option to also include the wicks of the imbalanced candles. // 3. Increased the default opacity of the midline colour to be more visible // 4. Fixed issue with repainting candles when overriding the colume profile with another symbol. // 5. Introduced more grannualr alert for PVSRA candles with imbalances // 6. Code improvements for stability // Release Notes 29/Dec/2022 // 1. Renamed settings to be more intuitive (Penetration Percentage to Invalidation Percentage) // 2. Improved Symbol Override Functionality to Automatically Override with the BINANCE Exchange Equivalent - This helps when switching between currencies // 3. Updated logic to display Imbalances on Previous Candle in real time. // 4. Fixed Bug surrounding all alerts. These are now working both in realtime and on candle closes. // 5. Introduced Flag to only show Confirmed Imbalances (i.e. on Candle Close) // Release Notes 29/Dec/2022 Part 2 // Introduced functionality to reduce the size of the Imbalanced zones if it is partially recovered. (Only displaying the unrecovered poortion of the candle/imbalanced zone) // Release Notes 12/Jan/2023 // 1. Update/Bug Fix for Calculation of the PVSRA. // ########################################################### // ##### // ##### Indicator Settings // ##### // ########################################################### var showImbalancedZones = input.bool(defval=true, title="Show Imbalanced Zones", group="Imbalanced Zone Settings") var showOnHigherTimeFrames = input.bool(defval=true, title="Higher Timeframes Only" , tooltip="Only Show on 1hr timeframe or above", group="Imbalanced Zone Settings") var showNormalVolImbalance = input.bool(title='Show Imbalances with Normal Volume', defval=false, group="Imbalanced Zone Settings") var markEntireCandle = input.bool(title='Mark Candle Body', defval=false, group="Imbalanced Zone Settings", tooltip="If checked the candle body with an imbalance is marked, If unchecked only the area of imbalance is displayed.") var includeWicks = input.bool(title=' - Include Wicks when Marking Candle Body', defval=false, group="Imbalanced Zone Settings", tooltip="If checked the wicks are also included when marking the entire candle. Note: Must also have the 'Mark Entire Candle Body' option checked.") var extendBoxes = input.bool(defval=false, title="Extend Zones", group="Imbalanced Zone Settings") var onlyDisplayUnrecoveredPortion = input.bool(defval=false, title="Only Display the Unrecovered Portion of the Candle", group="Imbalanced Zone Settings", tooltip="When set will only show the unrecovered zone of the candle.") var confirmedImbalancesOnly = input.bool(defval=false, title="Only Show Confirmed Imbalances (ie Candle Close)", group="Imbalanced Zone Settings") var invalidationRatioInput = input.int(defval=75, minval=0, maxval=100, step=1, title="Invalidation Percentage", tooltip="The percentage of the candle, that price needs recover, which invalidates the zone", group="Imbalanced Zone Settings") var invalidationRatio = invalidationRatioInput/100 var overideCandleColours = input.bool(title='Override Candles with PVSRA Colour', defval=true, tooltip="Indicator must be dragged to the top of the Object Tree to display correctly", group="Candle Colours") var Bull200CandleColor = input.color(color.new(color.lime, 0), title="200% Volume", group="Candle Colours", inline="1") var Bear200CandleColor = input.color(color.new(color.red, 0), title="", group="Candle Colours", inline = "1") var Bull150CandleColor = input.color(color.new(color.blue, 0), title="150% Volume", group="Candle Colours", inline="2") var Bear150CandleColor = input.color(color.new(color.fuchsia, 0), title="", group="Candle Colours", inline="2") var BullNormCandleColor = input.color(color.new(color.white, 0), title="Norm Volume", group="Candle Colours", inline="3") var BearNormCandleColor = input.color(color.new(color.gray, 0), title="", group="Candle Colours", inline="3") var bool override_imnt = input.bool(defval=false, title="Overide Symbol", group="Alternate Symbol Overide Settings", inline="0") var string pvsra_sym = input.symbol(title="", defval="BINANCE:BTCUSDTPERP", group="Alternate Symbol Overide Settings", inline="0", tooltip="Note the selected symbol will be ignored if the 'Automatically Derive' option below is selected") var bool automaticallyDetermineOverideTicker = input.bool(defval=true, title="Automatically Derive the equivalent BINANCE PERP pair to overide volume", group="Alternate Symbol Overide Settings", tooltip="Must have the 'Overide Symbol' option above checked. Note This may introduce an error in the study if it cant find the pair on Binance.") var Bull200ImbalanceColor = input.color(color.new(color.lime, 85), title="200% Volume", group="Imbalance Background Colours", inline="1") var Bear200ImbalanceColor = input.color(color.new(color.red, 85), title="", group="Imbalance Background Colours", inline = "1") var Bull150ImbalanceColor = input.color(color.new(color.blue, 85), title="150% Volume", group="Imbalance Background Colours", inline="2") var Bear150ImbalanceColor = input.color(color.new(color.fuchsia, 85), title="", group="Imbalance Background Colours", inline="2") var BullNormImbalanceColor = input.color(color.new(color.white, 85), title="Norm Volume", group="Imbalance Background Colours", inline="3") var BearNormImbalanceColor = input.color(color.new(color.gray, 85), title="", group="Imbalance Background Colours", inline="3") var bullNormMidLineColor = input.color(color.new(color.green,30) , title="Mid Line Color", group="Imbalance Background Colours", inline="4") var bearNormMidLineColor = input.color(color.new(color.red,30) , title="", group="Imbalance Background Colours", inline="4") var useOriginalCalc = input.bool(defval=false, title="Use Original PVSRA Calc", group="Miscellaneous", tooltip="Original Calc had a bug, This option will be phased out in the near future") var color candleColor = na var color imbalanceColor = na var color imbalancedLineColor = na var color NO_COLOR = na var bool chartIs60MinOrMore = false if showOnHigherTimeFrames if (timeframe.isintraday and timeframe.multiplier >=60 ) or timeframe.isdaily or timeframe.ismonthly or timeframe.isweekly chartIs60MinOrMore := true else chartIs60MinOrMore := true // ########################################################### // ##### // ##### Functions/Utils // ##### // ########################################################### f_print(_text) => var table _t = table.new(position.bottom_right, 1, 1) table.cell(_t, 0, 0, _text, bgcolor = color.yellow) // ########################################################### // ##### // ##### Core Logic // ##### // ########################################################### // Logic to reference another Instruments Volume Profile var string binancePerpSymbol = na binancePerpSymbol := "BINANCE:"+syminfo.basecurrency + syminfo.currency+"PERP" pvsra_imnt(sresolution,sseries) => request.security(override_imnt ? automaticallyDetermineOverideTicker? binancePerpSymbol :pvsra_sym : syminfo.tickerid ,sresolution,sseries, barmerge.gaps_off,barmerge.lookahead_off) volume_imnt = override_imnt == true? pvsra_imnt("",volume): volume high_imnt = override_imnt == true? pvsra_imnt("",high): high low_imnt = override_imnt == true? pvsra_imnt("",low): low close_imnt = override_imnt == true? pvsra_imnt("",close): close open_imnt = override_imnt == true? pvsra_imnt("",open): open var float highest10_hl_weightedVolume = na var float hl_weightedVolume = na var float av = na //Update to Code to reflect Last 10 Candles if useOriginalCalc av := ta.sma(volume_imnt, 10)//sum_2 = math.sum(volume, 10) hl_weightedVolume := volume_imnt * (high_imnt - low_imnt) highest10_hl_weightedVolume := ta.highest(hl_weightedVolume, 10) else av := ta.sma(volume_imnt[1], 10)//sum_2 = math.sum(volume, 10) hl_weightedVolume := volume_imnt * (high_imnt - low_imnt) highest10_hl_weightedVolume := ta.highest(hl_weightedVolume[1], 10) imnt_override_pvsra_calc_part2 = volume_imnt >= av * 1.5 ? 2 : 0 va = volume_imnt >= av * 2 or hl_weightedVolume >= highest10_hl_weightedVolume ? 1 : imnt_override_pvsra_calc_part2 // Bull or bear Candle Colors isBull = close_imnt > open_imnt var bool is200Bull = na var bool is150Bull = na var bool is100Bull = na var bool is200Bear = na var bool is150Bear = na var bool is100Bear = na is200Bull := false is150Bull := false is100Bull := false is200Bear := false is150Bear := false is100Bear := false if isBull if va == 1 candleColor := Bull200CandleColor imbalanceColor := Bull200ImbalanceColor imbalancedLineColor := bullNormMidLineColor is200Bull := true else if va == 2 candleColor := Bull150CandleColor imbalanceColor := Bull150ImbalanceColor imbalancedLineColor := bullNormMidLineColor is150Bull := true else is100Bull := true if showNormalVolImbalance candleColor := BullNormCandleColor imbalanceColor := BullNormImbalanceColor imbalancedLineColor := bullNormMidLineColor else candleColor := BullNormCandleColor imbalanceColor := na imbalancedLineColor := na else if va == 1 candleColor := Bear200CandleColor imbalanceColor := Bear200ImbalanceColor imbalancedLineColor := bearNormMidLineColor is200Bear := true else if va == 2 candleColor := Bear150CandleColor imbalanceColor := Bear150ImbalanceColor imbalancedLineColor := bearNormMidLineColor is150Bear := true else is100Bear := true if showNormalVolImbalance candleColor := BearNormCandleColor imbalanceColor := BearNormImbalanceColor imbalancedLineColor := bearNormMidLineColor else candleColor := BearNormCandleColor imbalanceColor := na imbalancedLineColor := na barcolor(overideCandleColours ? candleColor : NO_COLOR) plotcandle(open, high, low, close, color=(overideCandleColours ? candleColor : NO_COLOR), wickcolor=(overideCandleColours ? candleColor : NO_COLOR), bordercolor=(overideCandleColours ? candleColor : NO_COLOR), display = display.all) var box[] imbalancedDownBoxes = array.new_box() var box[] imbalancedUpBoxes = array.new_box() var line[] imbalancedDownMidLines = array.new_line() var line[] imbalancedUpMidLines = array.new_line() extension = extend.none if extendBoxes extension := extend.right var float midpoint = na if high[3] < low[1] and showImbalancedZones and chartIs60MinOrMore and confirmedImbalancesOnly if markEntireCandle if includeWicks array.push(imbalancedDownBoxes, box.new(left=bar_index - 2, bottom=math.min(high[2],low[2]), right=bar_index + 20, top=math.max(high[2],low[2]), bgcolor=imbalanceColor[2], border_color=imbalanceColor[2], extend=extension)) midPoint = (math.max(high[2],low[2])-math.min(high[2],low[2]))/2+math.min(low[2],low[2]) array.push(imbalancedDownMidLines, line.new(bar_index - 2, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[2])) else array.push(imbalancedDownBoxes, box.new(left=bar_index - 2, bottom=math.min(open[2],close[2]), right=bar_index + 20, top=math.max(open[2],close[2]), bgcolor=imbalanceColor[2], border_color=imbalanceColor[2], extend=extension)) midPoint = (math.max(open[2],close[2])-math.min(open[2],close[2]))/2+math.min(open[2],close[2]) array.push(imbalancedDownMidLines, line.new(bar_index - 2, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[2])) else array.push(imbalancedDownBoxes, box.new(left=bar_index - 2, bottom=high[3], right=bar_index + 20, top=low[1], bgcolor=imbalanceColor[2], border_color=imbalanceColor[2], extend=extension)) midPoint = (high[3]-low[1])/2+low[1] array.push(imbalancedDownMidLines, line.new(bar_index - 2, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[2])) if high[2] < low and showImbalancedZones and chartIs60MinOrMore and not confirmedImbalancesOnly if markEntireCandle if includeWicks array.push(imbalancedDownBoxes, box.new(left=bar_index - 1, bottom=math.min(high[1],low[1]), right=bar_index + 20, top=math.max(high[1],low[1]), bgcolor=imbalanceColor[1], border_color=imbalanceColor[1], extend=extension)) midPoint = (math.max(high[1],low[1])-math.min(high[1],low[1]))/2+math.min(low[1],low[1]) array.push(imbalancedDownMidLines, line.new(bar_index - 1, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[1])) else array.push(imbalancedDownBoxes, box.new(left=bar_index - 1, bottom=math.min(open[1],close[1]), right=bar_index + 20, top=math.max(open[1],close[1]), bgcolor=imbalanceColor[1], border_color=imbalanceColor[1], extend=extension)) midPoint = (math.max(open[1],close[1])-math.min(open[1],close[1]))/2+math.min(open[1],close[1]) array.push(imbalancedDownMidLines, line.new(bar_index - 1, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[1])) else array.push(imbalancedDownBoxes, box.new(left=bar_index - 1, bottom=high[2], right=bar_index + 20, top=low, bgcolor=imbalanceColor[1], border_color=imbalanceColor[1], extend=extension)) midPoint = (high[2]-low)/2+low array.push(imbalancedDownMidLines, line.new(bar_index - 1, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[1])) if low[3] > high[1] and showImbalancedZones and chartIs60MinOrMore and confirmedImbalancesOnly if markEntireCandle if includeWicks array.push(imbalancedUpBoxes, box.new(left=bar_index - 2, top=math.max(high[2],low[2]), right=bar_index + 20, bottom=math.min(high[2],low[2]), bgcolor=imbalanceColor[2], border_color=imbalanceColor[2], extend=extension)) midPoint = (math.max(high[2],low[2])-math.min(high[2],low[2]))/2+math.min(low[2],low[2]) array.push(imbalancedUpMidLines, line.new(bar_index - 2, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[2])) else array.push(imbalancedUpBoxes, box.new(left=bar_index - 2, top=math.max(open[2],close[2]), right=bar_index + 20, bottom=math.min(open[2],close[2]), bgcolor=imbalanceColor[2], border_color=imbalanceColor[2], extend=extension)) midPoint = (math.max(open[2],close[2])-math.min(open[2],close[2]))/2+math.min(open[2],close[2]) array.push(imbalancedUpMidLines, line.new(bar_index - 2, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[2])) else array.push(imbalancedUpBoxes, box.new(left=bar_index - 2, top=low[3], right=bar_index + 20, bottom=high[1], bgcolor=imbalanceColor[2], border_color=imbalanceColor[2], extend=extension)) midPoint = (high[1]-low[3])/2+low[3] array.push(imbalancedUpMidLines, line.new(bar_index - 2, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[2])) if low[2] > high and showImbalancedZones and chartIs60MinOrMore and not confirmedImbalancesOnly if markEntireCandle if includeWicks array.push(imbalancedUpBoxes, box.new(left=bar_index - 1, top=math.max(high[1],low[1]), right=bar_index + 20, bottom=math.min(high[1],low[1]), bgcolor=imbalanceColor[1], border_color=imbalanceColor[1], extend=extension)) midPoint = (math.max(high[1],low[1])-math.min(high[1],low[1]))/2+math.min(low[1],low[1]) array.push(imbalancedUpMidLines, line.new(bar_index - 1, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[1])) else array.push(imbalancedUpBoxes, box.new(left=bar_index - 1, top=math.max(open[1],close[1]), right=bar_index + 20, bottom=math.min(open[1],close[1]), bgcolor=imbalanceColor[1], border_color=imbalanceColor[1], extend=extension)) midPoint = (math.max(open[1],close[1])-math.min(open[1],close[1]))/2+math.min(open[1],close[1]) array.push(imbalancedUpMidLines, line.new(bar_index - 1, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[1])) else array.push(imbalancedUpBoxes, box.new(left=bar_index - 1, top=low[2], right=bar_index + 20, bottom=high, bgcolor=imbalanceColor[1], border_color=imbalanceColor[1], extend=extension)) midPoint = (high-low[2])/2+low[2] array.push(imbalancedUpMidLines, line.new(bar_index - 1, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedLineColor[1])) if array.size(imbalancedUpBoxes) > 0 for i = array.size(imbalancedUpBoxes) - 1 to 0 by 1 imbalancedBox = array.get(imbalancedUpBoxes, i) top = box.get_top(imbalancedBox) bottom = box.get_bottom(imbalancedBox) invalidationLimit = (top - bottom) * invalidationRatio box.set_right(imbalancedBox, bar_index + 30) midLine = array.get(imbalancedUpMidLines, i) line.set_x2(midLine, bar_index + 30) if high >= bottom + invalidationLimit box.delete(imbalancedBox) array.remove(imbalancedUpBoxes, i) line.delete(midLine) array.remove(imbalancedUpMidLines, i) if high > box.get_bottom(imbalancedBox) and high < box.get_top(imbalancedBox) and onlyDisplayUnrecoveredPortion box.set_bottom(imbalancedBox, high) if array.size(imbalancedDownBoxes) > 0 for i = array.size(imbalancedDownBoxes) - 1 to 0 by 1 imbalancedBox = array.get(imbalancedDownBoxes, i) top = box.get_top(imbalancedBox) bottom = box.get_bottom(imbalancedBox) invalidationLimit = (top - bottom) * invalidationRatio box.set_right(imbalancedBox, bar_index + 30) midLine = array.get(imbalancedDownMidLines, i) line.set_x2(midLine, bar_index + 30) if low <= top - invalidationLimit box.delete(imbalancedBox) array.remove(imbalancedDownBoxes, i) line.delete(midLine) array.remove(imbalancedDownMidLines, i) if low < box.get_top(imbalancedBox) and low > box.get_bottom(imbalancedBox) and onlyDisplayUnrecoveredPortion box.set_top(imbalancedBox, low) // #################################################################### // ##### // ##### Alert Logic // ##### Note: Alerts are in real time. To set an alert for a // ##### Confirmed Imbalance you must set it for Candle Close // ##### // #################################################################### var bool isImbalanced = na // isImbalanced := (low[3] > high[1]) or (high[3] < low[1]) isImbalanced := (low[2] > high) or (high[2] < low) alertcondition(isImbalanced, title="Imbalanced Candle (Any)", message="New Imbalanced Candle") alertcondition(isImbalanced and (is200Bull[1] or is150Bull[1]) , title="Imbalanced PVSRA Bullish Candle", message="New Imbalanced PVSRA Bullish Candle") alertcondition(isImbalanced and is200Bull[1] , title="Imbalanced PVSRA 200% Bullish Candle", message="New Imbalanced PVSRA 200% Bullish Candle") alertcondition(isImbalanced and is150Bull[1] , title="Imbalanced PVSRA 150% Bullish Candle", message="New Imbalanced PVSRA 150% Bullish Candle") alertcondition(isImbalanced and is100Bull[1] , title="Imbalanced Bullish Candle (Avg Vol)", message="New Imbalanced Bullish Candle (Avg Vol)") alertcondition(isImbalanced and (is200Bear[1] or is150Bear[1]) , title="Imbalanced PVSRA Bearish Candle", message="New Imbalanced PVSRA Bearish Candle") alertcondition(isImbalanced and is200Bear[1] , title="Imbalanced PVSRA 200% Bearish Candle", message="New Imbalanced PVSRA 200% Bearish Candle") alertcondition(isImbalanced and is150Bear[1] , title="Imbalanced PVSRA 150% Bearish Candle", message="New Imbalanced PVSRA 150% Bearish Candle") alertcondition(isImbalanced and is100Bear[1] , title="Imbalanced Bearish Candle (Avg Vol)", message="New Imbalanced Bearish Candle (Avg Vol)") //f_print("isImbalanced = " + str.tostring(isImbalanced) + " : " + "is200Bull[1] = " + str.tostring(is200Bull[1])+ " : " + "is150Bull[1] = " + str.tostring(is150Bull[1]) + " : " + "is100Bull[1] = " + str.tostring(is100Bull[1]) ) //f_print("isImbalanced = " + str.tostring(isImbalanced) + " : " + "is200Bull[2] = " + str.tostring(is200Bull[2])+ " : " + "is150Bull[2] = " + str.tostring(is150Bull[2]) + " : " + "is100Bull[2] = " + str.tostring(is100Bull[2]) + " : " + "is200Bear[2] = " + str.tostring(is200Bear[2])+ " : " + "is150Bear[2] = " + str.tostring(is150Bear[2]) + " : " + "is100Bear[2] = " + str.tostring(is100Bear[2])) //f_print("isImbalanced = " + str.tostring(isImbalanced) + " : " + "is200Bull[1] = " + str.tostring(is200Bull[1])+ " : " + "is150Bull[1] = " + str.tostring(is150Bull[1]) + " : " + "is100Bull[1] = " + str.tostring(is100Bull[1]) + " : " + "is200Bear[1] = " + str.tostring(is200Bear[1])+ " : " + "is150Bear[1] = " + str.tostring(is150Bear[1]) + " : " + "is100Bear[1] = " + str.tostring(is100Bear[1])) //f_print(" (is200Bull[1] or is150Bull[1]) = " + str.tostring( (is200Bull[1] or is150Bull[1]) )) //
Ichimoku Imbalance
https://www.tradingview.com/script/2ZlVZP5l-Ichimoku-Imbalance/
Esfiam
https://www.tradingview.com/u/Esfiam/
92
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Esfiam //@version=5 // indicator Version = 1.0 indicator("Ichimoku Imbalance", overlay = true) string labelTexthigh=na string labelTextlow=na // External Variables TenkansenPeriod = input.int(defval = 9 , title = 'Tenkansen' ) KijunsenPeriod = input.int(defval = 26 , title = 'Kijunsen' ) SpanBeriod = input.int(defval = 52 , title = 'Senko Span B') // Get High & Low Ichimoku Lines HighTenkansen = ta.highest(high,TenkansenPeriod) LowTenkansen = ta.lowest(low,TenkansenPeriod) HighKijunsen = ta.highest(high,KijunsenPeriod) LowKijunsen = ta.lowest(low,KijunsenPeriod) HighSpanB = ta.highest(high,SpanBeriod) LowSpanB = ta.lowest(low,SpanBeriod) // Imbalance Condition TenkansenImbalanceHigh = HighTenkansen == high and LowTenkansen == low[TenkansenPeriod-1] TenkansenImbalanceLow = LowTenkansen == low and HighTenkansen == high[TenkansenPeriod-1] KijunsenImbalanceHigh = HighKijunsen == high and LowKijunsen == low[KijunsenPeriod-1] KijunsenImbalanceLow = LowKijunsen == low and HighKijunsen == high[KijunsenPeriod-1] SpanBImbalanceHigh = HighSpanB == high and LowSpanB == low[SpanBeriod-1] SpanBImbalanceLow = LowSpanB == low and HighSpanB == high[SpanBeriod-1] // Draw Signal Bar if TenkansenImbalanceHigh or KijunsenImbalanceHigh or SpanBImbalanceHigh labelTexthigh := labelTexthigh+'\n'+'■' if TenkansenImbalanceLow or KijunsenImbalanceLow or SpanBImbalanceLow labelTextlow := labelTextlow+'■' if not na(labelTexthigh) label.new(bar_index,high,text=labelTexthigh,style=label.style_none) if not na(labelTextlow) label.new(bar_index,low,text=labelTextlow,style=label.style_none)
Dynamic Stochastic
https://www.tradingview.com/script/Pe9uNVHV-Dynamic-Stochastic/
jacobfabris
https://www.tradingview.com/u/jacobfabris/
29
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © jacobfabris //@version=5 indicator("Dynamic Stochastic",overlay=true) //--- setting the periods of the stochatich and the levels P1 = input.int(defval = 50) P2 = input.int(defval = 200) Superior_level = input(defval = 80) Mid_level = input(defval = 50) Inferior_level = input(defval = 20) //---Number of Bars to show NB1 = input.int(defval=10)*2 NB2 = input.int(defval=20)*2 //--- Calculating the Highs and Lows from each period. H1 = ta.highest(high,P1) L1 = ta.lowest(low,P1) H2 = ta.highest(high,P2) L2 = ta.lowest(low,P2) //--- Calculating the levels S1 = L1+(H1-L1)*Superior_level/100 I1 = L1+(H1-L1)*Inferior_level/100 M1 = L1+(H1-L1)*Mid_level/100 S2 = L2+(H2-L2)*Superior_level/100 I2 = L2+(H2-L2)*Inferior_level/100 M2 = L2+(H2-L2)*Mid_level/100 //--- P_S1 = line.new( bar_index+NB1/2 , S1 , bar_index - NB1/2 , S1 , xloc = xloc.bar_index , extend= extend.none,style = line.style_solid , color = color.green , width=1) line.delete(P_S1[1]) P_L1 = line.new( bar_index+NB1/2 , I1 , bar_index - NB1/2 , I1 , xloc = xloc.bar_index , extend= extend.none,style = line.style_solid , color = color.green , width=1) line.delete(P_L1[1]) P_S2 = line.new( bar_index+NB2/2 , S2 , bar_index - NB2/2 , S2 , xloc = xloc.bar_index , extend= extend.none,style = line.style_solid , color = color.orange , width=1) line.delete(P_S2[1]) P_L2 = line.new( bar_index+NB2/2 , I2 , bar_index - NB2/2 , I2 , xloc = xloc.bar_index , extend= extend.none,style = line.style_solid , color = color.orange , width=1) line.delete(P_L2[1]) P_M1 = line.new( bar_index+NB1/2 , M1 , bar_index - NB1/2 , M1 , xloc = xloc.bar_index , extend= extend.none,style = line.style_solid , color = color.white , width=1) line.delete(P_M1[1]) P_M2 = line.new( bar_index+NB2/2 , M2 , bar_index - NB2/2 , M2 , xloc = xloc.bar_index , extend= extend.none,style = line.style_solid , color = color.gray , width=1) line.delete(P_M2[1]) //--- plotshape(S1, style= shape.diamond, location = location.absolute , color = color.green, offset=NB1/2+1,text = "", show_last=1) plotshape(S1, style= shape.diamond, location = location.absolute , color = color.green, offset=-NB1/2-1,text = "", show_last=1) plotshape(I1, style= shape.diamond, location = location.absolute , color = color.green, offset=NB1/2+1,text = "", show_last=1) plotshape(I1, style= shape.diamond, location = location.absolute , color = color.green, offset=-NB1/2-1,text = "", show_last=1) //--- plotshape(S2, style= shape.diamond, location = location.absolute , color = color.orange, offset=NB2/2+1,text = "", show_last=1) plotshape(S2, style= shape.diamond, location = location.absolute , color = color.orange, offset=-NB2/2-1,text = "", show_last=1) plotshape(I2, style= shape.diamond, location = location.absolute , color = color.orange, offset=NB2/2+1,text = "", show_last=1) plotshape(I2, style= shape.diamond, location = location.absolute , color = color.orange, offset=-NB2/2-1,text = "", show_last=1)
Variety Moving Average Waddah Attar Explosion (WAE) [Loxx]
https://www.tradingview.com/script/L7WGgs0b-Variety-Moving-Average-Waddah-Attar-Explosion-WAE-Loxx/
loxx
https://www.tradingview.com/u/loxx/
272
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Variety Moving Average Waddah Attar Explosion [Loxx]", shorttitle="VMAWAE [Loxx]", overlay = false, timeframe="", timeframe_gaps = true) import loxx/loxxmas/1 greencolor = #2DD204 redcolor = #D2042D lightgreencolor = #96E881 lightredcolor = #DF4F6C calcBaseUnit() => bool isForexSymbol = syminfo.type == "forex" bool isYenPair = syminfo.currency == "JPY" float result = isForexSymbol ? isYenPair ? 0.01 : 0.0001 : syminfo.mintick src = input.source(close, "Source", group = "Core Settings") Sensetive = input.int(150, "Sensitivity", group = "Core Settings") trndcut = input.bool(true, "Require Trend Rising?", group = "Core Settings") expcut = input.bool(true, "Require Explosion Rising?", group = "Core Settings") expdeadcut = input.bool(false, "Require Explosion above Dead Zone?", group = "Core Settings") macdtype = input.string("Exponential Moving Average - EMA", "MACD MA Type", options = ["ADXvma - Average Directional Volatility Moving Average", "Ahrens Moving Average" , "Alexander Moving Average - ALXMA", "Double Exponential Moving Average - DEMA", "Double Smoothed Exponential Moving Average - DSEMA" , "Exponential Moving Average - EMA", "Fast Exponential Moving Average - FEMA", "Fractal Adaptive Moving Average - FRAMA" , "Hull Moving Average - HMA", "IE/2 - Early T3 by Tim Tilson", "Integral of Linear Regression Slope - ILRS" , "Instantaneous Trendline", "Laguerre Filter", "Leader Exponential Moving Average", "Linear Regression Value - LSMA (Least Squares Moving Average)" , "Linear Weighted Moving Average - LWMA", "McGinley Dynamic", "McNicholl EMA", "Non-Lag Moving Average", "Parabolic Weighted Moving Average" , "Recursive Moving Trendline", "Simple Moving Average - SMA", "Sine Weighted Moving Average", "Smoothed Moving Average - SMMA" , "Smoother", "Super Smoother", "Three-pole Ehlers Butterworth", "Three-pole Ehlers Smoother" , "Triangular Moving Average - TMA", "Triple Exponential Moving Average - TEMA", "Two-pole Ehlers Butterworth", "Two-pole Ehlers smoother" , "Volume Weighted EMA - VEMA", "Zero-Lag DEMA - Zero Lag Double Exponential Moving Average", "Zero-Lag Moving Average" , "Zero Lag TEMA - Zero Lag Triple Exponential Moving Average"], group = "MACD Settings") Fast_MA = input.int(20, "MACD Fast MA Period", group = "MACD Settings") Slow_MA = input.int(40, "MACD Slow MA Period", group = "MACD Settings") bbtype = input.string("Exponential Moving Average - EMA", "Bollinger Bands MA Type", options = ["ADXvma - Average Directional Volatility Moving Average", "Ahrens Moving Average" , "Alexander Moving Average - ALXMA", "Double Exponential Moving Average - DEMA", "Double Smoothed Exponential Moving Average - DSEMA" , "Exponential Moving Average - EMA", "Fast Exponential Moving Average - FEMA", "Fractal Adaptive Moving Average - FRAMA" , "Hull Moving Average - HMA", "IE/2 - Early T3 by Tim Tilson", "Integral of Linear Regression Slope - ILRS" , "Instantaneous Trendline", "Laguerre Filter", "Leader Exponential Moving Average", "Linear Regression Value - LSMA (Least Squares Moving Average)" , "Linear Weighted Moving Average - LWMA", "McGinley Dynamic", "McNicholl EMA", "Non-Lag Moving Average", "Parabolic Weighted Moving Average" , "Recursive Moving Trendline", "Simple Moving Average - SMA", "Sine Weighted Moving Average", "Smoothed Moving Average - SMMA" , "Smoother", "Super Smoother", "Three-pole Ehlers Butterworth", "Three-pole Ehlers Smoother" , "Triangular Moving Average - TMA", "Triple Exponential Moving Average - TEMA", "Two-pole Ehlers Butterworth", "Two-pole Ehlers smoother" , "Volume Weighted EMA - VEMA", "Zero-Lag DEMA - Zero Lag Double Exponential Moving Average", "Zero-Lag Moving Average" , "Zero Lag TEMA - Zero Lag Triple Exponential Moving Average"], group = "Bollinger Bands Settings") BBPeriod = input.int(20, "Bollinger Bands Period", group = "Bollinger Bands Settings") BBDeviation = input.float(2, "Bollinger Bands Deviation Multiplier", group = "Bollinger Bands Settings") dztype = input.string("ATR", "Dead Zone Type", options= ["ATR", "Pips"], group="Dead Zone Settings") DeadZonePip = input.int(400, "Dead Zone Pips", group="Dead Zone Settings") dz_len = input.int(100, title="Dead Zone ATR Period", group="Dead Zone Settings") dz_mult = input.float(3.7, step = 0.1, title="Dead Zone ATR Multiplier", group="Dead Zone Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") grayout = input.bool(true, "Gray out Dead Zone?", group = "UI Options") frama_FC = input.int(defval=1, title="* Fractal Adjusted (FRAMA) Only - FC", group = "Moving Average Inputs") frama_SC = input.int(defval=200, title="* Fractal Adjusted (FRAMA) Only - SC", group = "Moving Average Inputs") instantaneous_alpha = input.float(defval=0.07, minval = 0, title="* Instantaneous Trendline (INSTANT) Only - Alpha", group = "Moving Average Inputs") _laguerre_alpha = input.float(title="* Laguerre Filter (LF) Only - Alpha", minval=0, maxval=1, step=0.1, defval=0.7, group = "Moving Average Inputs") lsma_offset = input.int(defval=0, title="* Least Squares Moving Average (LSMA) Only - Offset", group = "Moving Average Inputs") _pwma_pwr = input.int(2, "* Parabolic Weighted Moving Average (PWMA) Only - Power", minval=0, group = "Moving Average Inputs") kfl=input.float(0.666, title="* Kaufman's Adaptive MA (KAMA) Only - Fast End", group = "Moving Average Inputs") ksl=input.float(0.0645, title="* Kaufman's Adaptive MA (KAMA) Only - Slow End", group = "Moving Average Inputs") amafl = input.int(2, title="* Adaptive Moving Average (AMA) Only - Fast", group = "Moving Average Inputs") amasl = input.int(30, title="* Adaptive Moving Average (AMA) Only - Slow", group = "Moving Average Inputs") variant(type, src, len) => sig = 0.0 trig = 0.0 special = false if type == "ADXvma - Average Directional Volatility Moving Average" [t, s, b] = loxxmas.adxvma(src, len) sig := s trig := t special := b else if type == "Ahrens Moving Average" [t, s, b] = loxxmas.ahrma(src, len) sig := s trig := t special := b else if type == "Alexander Moving Average - ALXMA" [t, s, b] = loxxmas.alxma(src, len) sig := s trig := t special := b else if type == "Double Exponential Moving Average - DEMA" [t, s, b] = loxxmas.dema(src, len) sig := s trig := t special := b else if type == "Double Smoothed Exponential Moving Average - DSEMA" [t, s, b] = loxxmas.dsema(src, len) sig := s trig := t special := b else if type == "Exponential Moving Average - EMA" [t, s, b] = loxxmas.ema(src, len) sig := s trig := t special := b else if type == "Fast Exponential Moving Average - FEMA" [t, s, b] = loxxmas.fema(src, len) sig := s trig := t special := b else if type == "Fractal Adaptive Moving Average - FRAMA" [t, s, b] = loxxmas.frama(src, len, frama_FC, frama_SC) sig := s trig := t special := b else if type == "Hull Moving Average - HMA" [t, s, b] = loxxmas.hma(src, len) sig := s trig := t special := b else if type == "IE/2 - Early T3 by Tim Tilson" [t, s, b] = loxxmas.ie2(src, len) sig := s trig := t special := b else if type == "Integral of Linear Regression Slope - ILRS" [t, s, b] = loxxmas.ilrs(src, len) sig := s trig := t special := b else if type == "Instantaneous Trendline" [t, s, b] = loxxmas.instant(src, instantaneous_alpha) sig := s trig := t special := b else if type == "Laguerre Filter" [t, s, b] = loxxmas.laguerre(src, _laguerre_alpha) sig := s trig := t special := b else if type == "Leader Exponential Moving Average" [t, s, b] = loxxmas.leader(src, len) sig := s trig := t special := b else if type == "Linear Regression Value - LSMA (Least Squares Moving Average)" [t, s, b] = loxxmas.lsma(src, len, lsma_offset) sig := s trig := t special := b else if type == "Linear Weighted Moving Average - LWMA" [t, s, b] = loxxmas.lwma(src, len) sig := s trig := t special := b else if type == "McGinley Dynamic" [t, s, b] = loxxmas.mcginley(src, len) sig := s trig := t special := b else if type == "McNicholl EMA" [t, s, b] = loxxmas.mcNicholl(src, len) sig := s trig := t special := b else if type == "Non-Lag Moving Average" [t, s, b] = loxxmas.nonlagma(src, len) sig := s trig := t special := b else if type == "Parabolic Weighted Moving Average" [t, s, b] = loxxmas.pwma(src, len, _pwma_pwr) sig := s trig := t special := b else if type == "Recursive Moving Trendline" [t, s, b] = loxxmas.rmta(src, len) sig := s trig := t special := b else if type == "Simple Moving Average - SMA" [t, s, b] = loxxmas.sma(src, len) sig := s trig := t special := b else if type == "Sine Weighted Moving Average" [t, s, b] = loxxmas.swma(src, len) sig := s trig := t special := b else if type == "Smoothed Moving Average - SMMA" [t, s, b] = loxxmas.smma(src, len) sig := s trig := t special := b else if type == "Smoother" [t, s, b] = loxxmas.smoother(src, len) sig := s trig := t special := b else if type == "Super Smoother" [t, s, b] = loxxmas.super(src, len) sig := s trig := t special := b else if type == "Three-pole Ehlers Butterworth" [t, s, b] = loxxmas.threepolebuttfilt(src, len) sig := s trig := t special := b else if type == "Three-pole Ehlers Smoother" [t, s, b] = loxxmas.threepolesss(src, len) sig := s trig := t special := b else if type == "Triangular Moving Average - TMA" [t, s, b] = loxxmas.tma(src, len) sig := s trig := t special := b else if type == "Triple Exponential Moving Average - TEMA" [t, s, b] = loxxmas.tema(src, len) sig := s trig := t special := b else if type == "Two-pole Ehlers Butterworth" [t, s, b] = loxxmas.twopolebutter(src, len) sig := s trig := t special := b else if type == "Two-pole Ehlers smoother" [t, s, b] = loxxmas.twopoless(src, len) sig := s trig := t special := b else if type == "Volume Weighted EMA - VEMA" [t, s, b] = loxxmas.vwema(src, len) sig := s trig := t special := b else if type == "Zero-Lag DEMA - Zero Lag Double Exponential Moving Average" [t, s, b] = loxxmas.zlagdema(src, len) sig := s trig := t special := b else if type == "Zero-Lag Moving Average" [t, s, b] = loxxmas.zlagma(src, len) sig := s trig := t special := b else if type == "Zero Lag TEMA - Zero Lag Triple Exponential Moving Average" [t, s, b] = loxxmas.zlagtema(src, len) sig := s trig := t special := b trig f_bb(src, length, mult, type) => float basis = variant(type, src, length) float dev = mult * ta.stdev(src, length) [basis, basis + dev, basis - dev] macd = variant(macdtype, src, Fast_MA) - variant(macdtype, src, Slow_MA) Trend1= (macd - nz(macd[1])) * Sensetive Trend2= (nz(macd[2]) - nz(macd[3])) * Sensetive [middle, upper, lower] = f_bb(src, BBPeriod, BBDeviation, bbtype) Explo1 = upper - lower Explo2= nz(upper[1]) - nz(lower[1]) Dead = dztype == "ATR" ? ta.atr(dz_len) * dz_mult : calcBaseUnit() * DeadZonePip outTrend1 = math.abs(Trend1) var color colorout = na status = 0. pwrt = 0. pwre = 0. explbool = expcut ? Explo1 > Explo2 : true expldeadbool = expdeadcut ? Explo1 > Dead: true trendbool = trndcut ? math.abs(Trend1) > math.abs(Trend2) : true if (Trend1 >= 0 and Trend1 > Explo1 and Trend1 > Dead and expldeadbool and explbool and trendbool) status := 1 if (Trend1 < 0 and math.abs(Trend1) > Explo1 and math.abs(Trend1) > Dead and expldeadbool and explbool and trendbool) status := 2 if Trend1 > 0 colorout := outTrend1 > nz(outTrend1[1]) ? greencolor : lightgreencolor if Trend1 < 0 colorout := outTrend1 > nz(outTrend1[1]) ? redcolor : lightredcolor if math.abs(Trend1) < Dead and grayout colorout := color.gray plotshape(status == 1, style=shape.triangleup, location=location.top, size=size.auto, color = colorout, title="Uptrend") plotshape(status == 2, style=shape.triangledown, location=location.top, size=size.auto, color = colorout, title="Downtrend") plot(outTrend1, "Trend", color = colorout, style = plot.style_columns) plot(Explo1, "Explostion Line", color = Explo1 > nz(Explo1[1]) ? color.new(color.yellow, 40) : color.new(color.gray, 40), style = plot.style_area) plot(Dead, "Dead Zone", color = color.white, linewidth = 2) barcolor(colorbars ? colorout : na) alertcondition(status == 1, title = "Uptrend", message = "Variety Moving Average Waddah Attar Explosion [Loxx]: Uptrend\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(status == 2, title = "Downtrend", message = "Variety Moving Average Waddah Attar Explosion [Loxx]: Downtrend\nSymbol: {{ticker}}\nPrice: {{close}}")
RSI + rCalc
https://www.tradingview.com/script/PxDIhTSP-RSI-rCalc/
TinyTtrades
https://www.tradingview.com/u/TinyTtrades/
41
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TdB1 //@version=5 indicator(title="Relative Strength Index", shorttitle="RSI", format=format.price, precision=2) //User Inputs// len = input.int(14, minval=1, title="RSI Length", group="RSI Settings") src = input.source(close, "Source", group="RSI Settings") maTypeInput = input.string("SMA", title="MA Type", options=["SMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA", "ALMA", "HMA"], group="MA Settings") maLengthInput = input.int(14, title="MA Length", group="MA Settings") bbMultInput = input.float(2.0, minval=0.001, maxval=50, title="BB StdDev", group="MA Settings") ob = input.float(70.0, 'Overbought Input', minval=0, step=5) os = input.float(30.0, 'Oversold Input', minval=0, step=5) pan = input(true, ' Show Information Panel') off = input.int(35, '  Panel Position Offset', minval=0) s = input(true, 'Show Entered RSI Price Level') ersi = input(40.0, '  Entered RSI Input') s2 = input(false, 'Show RSI Level for Input Price') ip = input.float(10000, '  Entered Price for RSI') dec = input.int(1, 'Decimals', minval=0, maxval=10) bg = input(false, 'Invisible Background') //alma// stperiod = input.int(title='Period for ALMA', defval=21, group='MA Settings') stoffset = input.float(title='Offset for ALMA', step=0.025, defval=0.8, group='MA Settings') stsigma = input.float(title='Sigma for ALMA', step=0.5, defval=6, group='MA Settings') ma(source, length, type) => switch type "SMA" => ta.sma(source, length) "Bollinger Bands" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length) "ALMA" =>ta.alma(source, stperiod, stoffset, stsigma) "HMA" => ta.hma(source, length) up = ta.rma(math.max(ta.change(src), 0), len) down = ta.rma(-math.min(ta.change(src), 0), len) rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) rsiMA = ma(rsi, maLengthInput, maTypeInput) isBB = maTypeInput == "Bollinger Bands" stalma=ta.alma(rsi, stperiod, stoffset, stsigma) up_color = input.color(#66bb6a, 'RSI Cross Down', group='Short-term ALMA') down_color = input.color(#ef5350, 'RSI Cross Up', group='Short-term ALMA') macolor = rsiMA>rsi ? up_color : down_color Round(value, decimals) => float v = math.pow(10, decimals) math.round(math.abs(value) * v) / (v * math.sign(value)) // plot(rsi, "RSI", color=#7E57C2) plot(rsiMA, "RSI-based MA", color=macolor) rsiUpperBand = hline(70, "RSI Upper Band", color=#787B86) hline(50, "RSI Middle Band", color=color.new(#787B86, 50)) rsiLowerBand = hline(30, "RSI Lower Band", color=#787B86) fill(rsiUpperBand, rsiLowerBand, color=color.rgb(126, 87, 194, 90), title="RSI Background Fill") bbUpperBand = plot(isBB ? rsiMA + ta.stdev(rsi, maLengthInput) * bbMultInput : na, title = "Upper Bollinger Band", color=color.green) bbLowerBand = plot(isBB ? rsiMA - ta.stdev(rsi, maLengthInput) * bbMultInput : na, title = "Lower Bollinger Band", color=color.green) fill(bbUpperBand, bbLowerBand, color= isBB ? color.new(color.green, 90) : na, title="Bollinger Bands Background Fill") /// reverse RSI/// //Reverse RSI Functions reverse(Level) => x1 = (len - 1) * (ta.rma(math.max(nz(src[1], src) - src, 0), len) * Level / (100 - Level) - ta.rma(math.max(src - nz(src[1], src), 0), len)) x1 >= 0 ? src + x1 : src + x1 * (100 - Level) / Level //Reverse RSI Price Level Calculations revma = reverse(rsiMA) revob = reverse(ob) revos = reverse(os) reversi = reverse(ersi) //Reverse Reverse RSI rr(input) => alpha = 1 / len up1 = ta.rma(math.max(ta.change(src), 0), len) down1 = ta.rma(-math.min(ta.change(src), 0), len) up = alpha * math.max(input - src[1], 0) + (1 - alpha) * nz(up1[1]) down = alpha * -math.min(input - src[1], 0) + (1 - alpha) * nz(down1[1]) rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down) rsi rrrsi = rr(ip) //Information Panel labelstyle = label.style_label_center labelstyle2 = label.style_label_down labelc = bg ? color.new(#000000, 100) : color.new(#000000, 45) //Offset xp(offset) => time + math.round(ta.change(time) * offset) lable1(offset, P, T, s, color_PnL) => label PnL_Label = na PnL_Label := label.new(xp(offset), P, text=T, color=color_PnL, textcolor=#b2b5be, style=s, yloc=yloc.price, xloc=xloc.bar_time, size=size.normal) label.delete(PnL_Label[1]) ud() => if rsi < rsiMA 'UP MA' else 'DOWN MA' //Panel Plot if pan lable1(off, 50, 'RSI Cross ' + ud() + ' Price : ' + str.tostring(Round(revma, dec)) + '\n\n' + str.tostring(Round(ob, dec)) + ' Overbought Level Price : ' + str.tostring(Round(revob, dec)) + '\n\n' + str.tostring(Round(os, dec)) + ' Oversold Level Price : ' + str.tostring(Round(revos, dec)), labelstyle, labelc) if s lable1(off, 50, str.tostring(Round(ersi, dec)) + ' RSI Price : ' + str.tostring(Round(reversi, dec)), labelstyle2, labelc) if s2 lable1(1, rrrsi, 'RSI ' + str.tostring(Round(rrrsi, dec)) + ' For Input Price ' + str.tostring(Round(ip, dec)), labelstyle2, labelc)
Andean Oscillator
https://www.tradingview.com/script/x9qYvBYN-Andean-Oscillator/
alexgrover
https://www.tradingview.com/u/alexgrover/
1,411
study
5
CC-BY-NC-SA-4.0
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // © alexgrover //Original post : Alpaca.markets/learn/andean-oscillator-a-new-technical-indicator-based-on-an-online-algorithm-for-trend-analysis/ //@version=5 indicator("Andean Oscillator") //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ length = input(50) sig_length = input(9,'Signal Length') //-----------------------------------------------------------------------------} //Exponential Envelopes //-----------------------------------------------------------------------------{ var alpha = 2/(length+1) var up1 = 0.,var up2 = 0. var dn1 = 0.,var dn2 = 0. C = close O = open up1 := nz(math.max(C, O, up1[1] - (up1[1] - C) * alpha), C) up2 := nz(math.max(C * C, O * O, up2[1] - (up2[1] - C * C) * alpha), C * C) dn1 := nz(math.min(C, O, dn1[1] + (C - dn1[1]) * alpha), C) dn2 := nz(math.min(C * C, O * O, dn2[1] + (C * C - dn2[1]) * alpha), C * C) //Components bull = math.sqrt(dn2 - dn1 * dn1) bear = math.sqrt(up2 - up1 * up1) signal = ta.ema(math.max(bull, bear), sig_length) //-----------------------------------------------------------------------------} //Plots //-----------------------------------------------------------------------------{ plot(bull, 'Bullish Component', #089981) plot(bear, 'Bearish Component', #f23645) plot(signal, 'Signal', #ff9800) //-----------------------------------------------------------------------------}
Colour palette NCM
https://www.tradingview.com/script/HpsbHOUt-Colour-palette-NCM/
NelsonM1984
https://www.tradingview.com/u/NelsonM1984/
32
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © NelsonM1984g //@version=5 indicator("Colour palettes") //-----------------////Bar and Status Indication////-----------------//{ tablePosition = input.string(title="Summary Table Position", defval=position.middle_center, options=[position.bottom_left, position.top_left, position.middle_center, position.middle_left, position.middle_right, position.bottom_right, position.top_right], group="Summary Table") tableTextSize = input.string(title="Table Text Size", defval=size.small, options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group="Summary Table") var testTable = table.new(position=tablePosition, columns=1, rows=15, frame_color=color.new(#000000, 100), frame_width=1, bgcolor=color.white, border_color=color.black, border_width=1) if barstate.islast table.cell(table_id=testTable, column=0, row=0, text='1. Cyber Grape - #69488C', text_size=tableTextSize, bgcolor=#69488C, text_color= #000000) table.cell(table_id=testTable, column=0, row=1, text='2. Dark Cornflower Blue - #2C4899', text_size=tableTextSize, bgcolor=#2C4899, text_color= #000000) table.cell(table_id=testTable, column=0, row=2, text='3. Lapis Lazuli - #0359A8', text_size=tableTextSize, bgcolor=#0359A8, text_color= #000000) table.cell(table_id=testTable, column=0, row=3, text='4. Blue Munsell - #0C97B3', text_size=tableTextSize, bgcolor=#0C97B3, text_color= #000000) table.cell(table_id=testTable, column=0, row=4, text='5. Turquoise - #16DBCE', text_size=tableTextSize, bgcolor=#16DBCE, text_color= #000000) table.cell(table_id=testTable, column=0, row=5, text='6. Light Green #2 - #76E38A', text_size=tableTextSize, bgcolor=#76E38A, text_color= #000000) table.cell(table_id=testTable, column=0, row=6, text='7. Green Pantone - #03A82D', text_size=tableTextSize, bgcolor=#93E868, text_color= #000000) table.cell(table_id=testTable, column=0, row=7, text='8. Lime Green - #51DB16', text_size=tableTextSize, bgcolor=#C8F05B, text_color= #000000) table.cell(table_id=testTable, column=0, row=8, text='9. Icterine - #FOF252', text_size=tableTextSize, bgcolor=#F0F252, text_color= #000000) table.cell(table_id=testTable, column=0, row=9, text='10. Naples Yellow - #F2D14B', text_size=tableTextSize, bgcolor=#F2D14B, text_color= #000000) table.cell(table_id=testTable, column=0, row=10, text='11. Straw - #E3D376', text_size=tableTextSize, bgcolor=#E3D376, text_color= #000000) table.cell(table_id=testTable, column=0, row=11, text='12. Sandy Brown - #E8A068', text_size=tableTextSize, bgcolor=#E8A068, text_color= #000000) table.cell(table_id=testTable, column=0, row=12, text='13. Fire Opal - #F0605B', text_size=tableTextSize, bgcolor=#F0605B, text_color= #000000) table.cell(table_id=testTable, column=0, row=13, text='14. Brink Pink - #F25275', text_size=tableTextSize, bgcolor=#F25275, text_color= #000000) table.cell(table_id=testTable, column=0, row=14, text='15. French Fuschia - #F24B94', text_size=tableTextSize, bgcolor=#F24B94, text_color= #000000) //}
Extreme Bars
https://www.tradingview.com/script/sc8OkjVO/
faytterro
https://www.tradingview.com/u/faytterro/
159
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © faytterro //@version=5 indicator("Extreme Bars", overlay=true, max_bars_back = 500) x=ta.rsi((volume)/(high-low),14)*16-750 len=input.int(100, title="sensitivity", minval=1, maxval=100) y=0.0 if barstate.islast y:=100 else y:=x>len? 100 : x<5? 5 : x plotcandle(open, high, low, close, title='Transo bars', color = open < close ? color.rgb(76, 175, 80, 100-y) : color.rgb(255, 82, 82, 100-y), wickcolor=open < close ? color.rgb(76, 175, 80, 100-y) : color.rgb(255, 82, 82, 100-y), bordercolor=open < close ? color.rgb(76, 175, 80, 100-y) : color.rgb(255, 82, 82, 100-y)) lb=(x[1]-x[2]<-80 and math.abs(close[1]-open[1])>high[2]*2-2*low[2] and close[1]<open[1]) or ( (math.abs(close[1]-open[1])+math.abs(close-open)>high[2]*3-3*low[2]) and x[2]>x[1]+x and (close<open and close[1]<open[1]) ) lb:= lb and lb[1]==false //plotshape(lb, offset =-2) ass= ta.crossover(close,high[ta.barssince(lb)+2]) for i = 1 to ta.barssince(lb) ass:= ass and ass[i]==false k=ta.barssince(ass)<ta.barssince(lb)? ta.barssince(ass) : -2 box=box.new(last_bar_index-ta.barssince(lb)-2,high[ta.barssince(lb)+2], last_bar_index-k-2,low[ta.barssince(lb)+2], bgcolor = color.rgb(255,0,0,80), border_color = color.rgb(71, 89, 139,100)) box.delete(box[1]) ls=(x[1]-x[2]<-80 and math.abs(close[1]-open[1])>high[2]*2-2*low[2] and close[1]>open[1]) or ( (math.abs(close[1]-open[1])+math.abs(close-open)>high[2]*3-3*low[2]) and x[2]>x[1]+x and (close>open and close[1]>open[1]) ) ls:= ls and ls[1]==false //plotshape(ls, offset =-2) akk = ta.crossunder(close,low[ta.barssince(ls)+2]) for i=1 to ta.barssince(ls) akk:= akk and akk[i]==false k2=ta.barssince(akk)<ta.barssince(ls)? ta.barssince(akk) : -2 box2=box.new(last_bar_index-ta.barssince(ls)-2,high[ta.barssince(ls)+2], last_bar_index-k2-2,low[ta.barssince(ls)+2], bgcolor = color.rgb(0,255,0,80), border_color = color.rgb(71, 89, 139,100)) box.delete(box2[1])
ATR-Stepped PDF MA [Loxx]
https://www.tradingview.com/script/Z0JedxTS-ATR-Stepped-PDF-MA-Loxx/
loxx
https://www.tradingview.com/u/loxx/
467
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("ATR-Stepped PDF MA [Loxx]", shorttitle="ATRSPDFMA [Loxx]", overlay = true, timeframe="", timeframe_gaps = true) greencolor = #2DD204 redcolor = #D2042D lightgreencolor = #96E881 lightredcolor = #DF4F6C src = input.source(close, "Source", group = "Basic Settings") per = input.int(21, "Period", group = "Basic Settings") vari = input.float(2, "Variance", step = 0.1, minval = 0.1, group = "Basic Settings") mean = input.float(0, "Mean", step = 0.1, minval = -1, maxval = 1, group = "Basic Settings") mult = input.float(20, "Step Size", group = "Basic Settings") atrper = input.int(50, "ATR Period", group = "Basic Settings") showSigs = input.bool(false, "Show signals?", group= "UI Options") colorbars = input.bool(false, "Color bars?", group = "UI Options") _pdf(x, variance, mean)=> out = (1.0/math.sqrt(2 * math.pi * math.pow(variance,2)) * math.exp(-math.pow(x-mean, 2)/(2 * math.pow(variance, 2)))) out _pdfma(src, period, variance, mean)=> maxx = 3.5 step = math.pi/(period-1) coeff = array.new_float(period, 0) for k = 0 to period - 1 array.set(coeff, k, _pdf(k * step, variance, mean * math.pi)) sumw = array.get(coeff, 0) sum = array.get(coeff, 0) * src for k = 1 to period -1 weight = nz(array.get(coeff, k)) * src sumw += weight sum += weight * nz(src[k]) out = sum/sumw out multout = mult/100.0 atr = ta.atr(atrper) val = _pdfma(src, per, vari, mean) stepSize = multout * atr _diff = val - nz(val[1]) val := nz(val[1]) + ((_diff < stepSize and _diff > -stepSize) ? 0 : (_diff / stepSize) * stepSize) goLong_pre = ta.crossover(val, val[1]) goShort_pre = ta.crossunder(val, val[1]) contSwitch = 0 contSwitch := nz(contSwitch[1]) contSwitch := goLong_pre ? 1 : goShort_pre ? -1 : contSwitch goLong = goLong_pre and ta.change(contSwitch) goShort = goShort_pre and ta.change(contSwitch) plot(val,"ATR-Stepped, PDF MA", color = contSwitch == 1 ? greencolor : redcolor, linewidth = 3) barcolor(colorbars ? contSwitch == 1 ? greencolor : redcolor : na) plotshape(showSigs and goLong, title = "Long", color = color.yellow, textcolor = color.yellow, text = "Long", style = shape.triangleup, location = location.belowbar, size = size.tiny) plotshape(showSigs and goShort, title = "Short", color = color.fuchsia, textcolor = color.fuchsia, text = "Short", style = shape.triangledown, location = location.abovebar, size = size.tiny) alertcondition(goLong, title = "Long", message = "ATR-Stepped PDF MA [Loxx]: Uptrend\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(goShort, title = "Short", message = "ATR-Stepped PDF MA [Loxx]: Downtrend\nSymbol: {{ticker}}\nPrice: {{close}}")
Stepped Heiken Ashi Moving Average w/ Jurik Filtering [Loxx]
https://www.tradingview.com/script/j00th9ni-Stepped-Heiken-Ashi-Moving-Average-w-Jurik-Filtering-Loxx/
loxx
https://www.tradingview.com/u/loxx/
90
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx //@version=5 indicator("Stepped Heiken Ashi Moving Average w/ Jurik Filtering [Loxx]", shorttitle = "SHAMAJF [Loxx]", overlay = true, timeframe="", timeframe_gaps = true) import loxx/loxxexpandedsourcetypes/3 import loxx/loxxjuriktools/1 calcBaseUnit() => bool isForexSymbol = syminfo.type == "forex" bool isYenPair = syminfo.currency == "JPY" float result = isForexSymbol ? isYenPair ? 0.01 : 0.0001 : syminfo.mintick _declen()=> mtckstr = str.tostring(syminfo.mintick) da = str.split(mtckstr, ".") temp = array.size(da) dlen = 0. if syminfo.mintick < 1 dstr = array.get(da, 1) dlen := str.length(dstr) dlen greencolor = #2DD204 redcolor = #D2042D per= input.int(13, "Period", group = "Basic Settings") step = input.int(1, "Step", group = "Basic Settings", minval = 1) better = input.bool(false, "Better HA?", group = "Basic Settings") jurik = input.bool(true, "Juirk Filtered?", group = "Basic Settings") jper= input.int(34, "Juirk Length", group = "Basic Settings") jphs= input.int(0, "Juirk Phase", group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group= "UI Options") showcandles = input.bool(false, "Show candles?", group= "UI Options") showfill = input.bool(false, "Show fill?", group= "UI Options") maOpen = 0. maClose = 0. maLow = 0. maHigh =0. if jurik maOpen := loxxjuriktools.jurik_filt(open, jper, jphs) maClose := loxxjuriktools.jurik_filt(close, jper, jphs) maLow := loxxjuriktools.jurik_filt(low, jper, jphs) maHigh := loxxjuriktools.jurik_filt(high, jper, jphs) else maOpen := ta.sma(open, per) maClose := ta.sma(close, per) maHigh := ta.sma(high, per) maLow := ta.sma(low, per) haClose = 0. if better if (maHigh != maLow) haClose := (maOpen + maClose) / 2 + (((maClose - maOpen) / (maHigh - maLow)) * math.abs((maClose - maOpen) / 2)) else haClose := (maOpen + maClose) / 2 else haClose := (maOpen + maHigh + maLow + maClose) / 4 haOpen = 0. haOpen := (nz(haOpen[1]) + nz(haClose[1]))/2 haHigh = math.max(maHigh, math.max(haOpen, haClose)) haLow = math.min(maOpen, math.min(haOpen, haClose)) color colorhigh = na color colorlow = na if (haOpen < haClose) colorlow := color.fuchsia colorhigh := color.yellow else colorlow := color.fuchsia colorhigh := color.yellow outLow = haLow outHigh = haHigh outOpen = haOpen outClose = haClose if (math.abs(outLow - nz(outLow[1])) < step * _declen() * calcBaseUnit()) outLow := nz(outLow[1]) if (math.abs(outHigh - nz(outHigh[1])) < step * _declen() * calcBaseUnit()) outHigh := nz(outHigh[1]) if (math.abs(outOpen - nz(outOpen[1])) < step * _declen() * calcBaseUnit()) outOpen := nz(outOpen[1]) if (math.abs(outClose - nz(outClose[1])) < step * _declen() * calcBaseUnit()) outClose := nz(outClose[1]) colorout = outClose > outOpen ? greencolor : redcolor coloroutf = outClose > outOpen ? color.yellow : color.fuchsia plotcandle(outOpen, outHigh, outLow, outClose, color = showcandles ? coloroutf : na, wickcolor = showcandles ? coloroutf : na) l = plot(outLow, color = colorlow) h = plot(outHigh, color = colorhigh) fill(h, l, color = showfill ? color.new(coloroutf, 80) : na) barcolor(colorbars ? colorout : na)
Auto Trendline Indicator (based on fractals)
https://www.tradingview.com/script/xYaiqwD8-Auto-Trendline-Indicator-based-on-fractals/
DojiEmoji
https://www.tradingview.com/u/DojiEmoji/
4,629
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © DojiEmoji // A tool that automatically draws out trend lines by connecting the most recent fractals. //@version=5 indicator("Auto Trendline [DojiEmoji]", format=format.price, precision=0, overlay=true, max_lines_count=500) var int TYPE_UP = 1 var int TYPE_DOWN = -1 var string LINE_WIDTH1_STR = "Width 1" var string LINE_WIDTH2_STR = "Width 2" _get_width(string str_input) => switch str_input // {string:int} LINE_WIDTH1_STR => 1 LINE_WIDTH2_STR => 2 // ---------------------------------------------------------------------------- // Settings: // { var string GROUP_FRACT = "Fractals" var int n = input.int(10, title="Fractal Period", minval=2, group=GROUP_FRACT) var color col_hl = input.color(color.blue, title="Plot:", inline="plot_low", group=GROUP_FRACT) var bool show_hl = input.bool(true, title="HL", inline="plot_low", group=GROUP_FRACT) var color col_ll = input.color(color.gray, title=", Plot:", inline="plot_low", group=GROUP_FRACT) var bool show_ll = input.bool(false, title="LL", inline="plot_low", group=GROUP_FRACT) var color col_lh = input.color(color.red, title="Plot:", inline="plot_high", group=GROUP_FRACT) var bool show_lh = input.bool(true, title="LH", inline="plot_high", group=GROUP_FRACT) var color col_hh = input.color(color.gray, title=", Plot:", inline="plot_high", group=GROUP_FRACT) var bool show_hh = input.bool(false, title="HH", inline="plot_high", group=GROUP_FRACT) var string GROUP_ATL = "Auto trendlines" var string subgroup1 = "recent line" var color ln_col_recent = input.color(color.new(color.purple, 0), title="Recent Line", group=GROUP_ATL, inline=subgroup1) var int lnwidth_recent = _get_width(input.string(LINE_WIDTH1_STR, options=[LINE_WIDTH1_STR, LINE_WIDTH2_STR], title="", inline=subgroup1, group=GROUP_ATL)) var string subgroup2 = "historical line" var color ln_col_prev = input.color(color.new(color.gray, 50), title="Historical Line", group=GROUP_ATL, inline=subgroup2) var int lnwidth_prev = _get_width(input.string(LINE_WIDTH1_STR, options=[LINE_WIDTH1_STR, LINE_WIDTH2_STR], title="", inline=subgroup2, group=GROUP_ATL)) var int max_tl = input.int(1, title="Max pair of lines", maxval=250, minval=1, group=GROUP_ATL)*2 var string _str_extend = input.string("Right", options=["Right", "Both ways"], title="Which way to extend lines", group=GROUP_ATL) var string str_extend = _str_extend == "Both ways" ? extend.both : extend.right var bool show_crosses = input.bool(false, title="Show crosses", tooltip="Instances when closing price of a bar has crossed lower/upper trendlines", group=GROUP_ATL) // } // ---------------------------------------------------------------------------- // Fractal UDT and other relevant data structures: // Handle fractals and trendlines associated with them // { type fractal int up_or_down = na // either TYPE_UP or TYPE_DOWN int xloc = na float yloc = na int xloc_parent = na float yloc_parent = na var fractal[] arr_fract = array.new<fractal>() // Can be used for multiple purposes such as: // (a) connecting trendlines but added condition to skip X no. of fractals in between // (b) create a zigzag, since knowing foo.parent's x and y // ... possibilities are endless var line[] arr_ln_up = array.new_line() // Array of lines, newest elements inserted to front var line[] arr_ln_dn = array.new_line() // @function init_fractal() returns instance of fractal that has been init'ed init_fractal(int fract_type, int xloc, float yloc, int xparent, float yparent)=> f = fractal.new() f.up_or_down := fract_type f.xloc := xloc f.yloc := yloc f.xloc_parent := xparent f.yloc_parent := yparent ln = line.new(xloc, yloc, xparent, yparent, xloc.bar_index, str_extend, color=ln_col_recent, style=line.style_dashed, width=lnwidth_recent) if f.up_or_down == TYPE_UP array.unshift(arr_ln_up, ln) else if f.up_or_down == TYPE_DOWN array.unshift(arr_ln_dn, ln) array.unshift(arr_fract, f) f // <- return // @function drop_and_roll(new fractal) returns void // Clean up: Drop oldest trendlines, change colors for previous trendline drop_and_roll(fractal f) => arr_ln = f.up_or_down == TYPE_UP ? arr_ln_up : f.up_or_down == TYPE_DOWN ? arr_ln_dn : na if array.size(arr_ln) > 1 line.set_color(array.get(arr_ln, 1), ln_col_prev) line.set_width(array.get(arr_ln, 1), lnwidth_prev) while array.size(arr_ln) > math.floor(max_tl/2) line.delete(array.pop(arr_ln)) // @function draw_trendline() returns void draw_trendline(fract_type, x2, y2, x1, y1) => f = init_fractal(fract_type, x2, y2, x1, y1) drop_and_roll(f) // } end of handle for fractals // ---------------------------------------------------------------------------- // Fractals, implemented using ta.pivot high && low // ---------------------------------------------------------------------------- // A Fractal is always a Pivot H/L (but a Pivot H/L is not always a Fractal): float ph = ta.pivothigh(n, n)[1], bool upfract = not na(ph) float pl = ta.pivotlow(n, n)[1], bool downfract = not na(pl) alertcondition(not na(ph) or not na(pl), title="New trendline formed", message="New trendline formed") // Pointers -> Recent fractals // { var float recent_dn1 = na, var int i_recent_dn1 = na var float recent_up1 = na, var int i_recent_up1 = na var float recent_dn2 = na, var int i_recent_dn2 = na var float recent_up2 = na, var int i_recent_up2 = na if downfract recent_dn2:=recent_dn1, i_recent_dn2 := i_recent_dn1 recent_dn1:=low[n+1], i_recent_dn1 := bar_index-n-1 draw_trendline(TYPE_DOWN, i_recent_dn2, recent_dn2, i_recent_dn1, recent_dn1) if upfract recent_up2:=recent_up1, i_recent_up2 := i_recent_up1 recent_up1:=high[n+1], i_recent_up1 := bar_index-n-1 draw_trendline(TYPE_UP, i_recent_up2, recent_up2, i_recent_up1, recent_up1) // } // Plotting fractals bool hh = upfract and recent_up1 > recent_up2 ? high[n+1] : na bool lh = upfract and recent_up1 < recent_up2 ? high[n+1] : na bool hl = downfract and recent_dn1 > recent_dn2 ? low[n+1] : na bool ll = downfract and recent_dn1 < recent_dn2 ? low[n+1] : na plotshape(show_hh and hh, style=shape.circle, size=size.tiny, offset=-n-1, title="HH", text="HH", location=location.abovebar, textcolor=col_hh, color=na, editable=false) plotshape(show_lh and lh, style=shape.circle, size=size.tiny, offset=-n-1, title="LH", text="LH", location=location.abovebar, textcolor=col_lh, color=na, editable=false) plotshape(show_ll and ll, style=shape.circle, size=size.tiny, offset=-n-1, title="LL", text="LL", location=location.belowbar, textcolor=col_ll, color=na, editable=false) plotshape(show_hl and hl, style=shape.circle, size=size.tiny, offset=-n-1, title="HL", text="HL", location=location.belowbar, textcolor=col_hl, color=na, editable=false) // ---------------------------------------------------------------------------- // Finding crosses between closing price & pair of most recent trendlines // ---------------------------------------------------------------------------- // @function get_slope() get_slope(xA, yA, xB, yB) => (yB - yA) / (xB - xA) // Solving for price at current x (bar_index), given two pairs of fractals with x values < bar_index. float m_dn = get_slope(i_recent_dn1, recent_dn1, i_recent_dn2, recent_dn2) float y_dn = (m_dn * bar_index) + recent_dn1 - (m_dn * i_recent_dn1) float m_up = get_slope(i_recent_up1, recent_up1, i_recent_up2, recent_up2) float y_up = (m_up * bar_index) + recent_up1 - (m_up * i_recent_up1) // Plotting crosses bool cross_upper = ta.cross(close, y_up) bool cross_lower = ta.cross(close, y_dn) plotshape(show_crosses and cross_upper, title = "Crossed upper trendline", style = shape.xcross, location = location.belowbar, color = color.new(color = color.blue, transp = 50), size = size.small) plotshape(show_crosses and cross_lower, title = "Crossed lower trendline", style = shape.xcross, location = location.abovebar, color = color.new(color = color.red, transp = 50), size = size.small) alertcondition(cross_upper or cross_lower, title="Upper/lower trendline crossed", message="Upper/lower trendline crossed")
Actieve Inversiones EMABBOL by EDOHEN
https://www.tradingview.com/script/FMAeLoSn-Actieve-Inversiones-EMABBOL-by-EDOHEN/
Jesus_Salvatierra
https://www.tradingview.com/u/Jesus_Salvatierra/
49
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Jesus_Salvatierra //@version=5 indicator("Actieve Inversiones EMABBOL by EDOHEN",shorttitle= "EMABBOL", overlay=true) hideSma= input.bool(defval=true,title="Show Moving Averages", group= "Moving Averages") hideBB= input.bool(defval=false,title="Show BB", group= "Bollinger Bands") fuente= input.source(hlc3,title= "Source", group= "Bollinger Bands") longitud= input.int(defval=20,title= "Length", group= "Bollinger Bands") multiplo= input.float(defval=2.0,title= "Mult", group= "Bollinger Bands") centro = ta.sma(fuente, longitud) dev = multiplo * ta.stdev(fuente, longitud) upper = centro + dev lower = centro - dev plot(hideBB? centro:na, "BB Moving Average", color=color.new(color.black,50), style=plot.style_circles) p1 = plot(hideBB?upper:na, "Upper Band", color=color.new(color.black,70)) p2 = plot(hideBB?lower:na, "Lower Band", color=color.new(color.black,70)) fill(p1, p2, title = "Fill", color=color.rgb(33, 150, 243, 95)) // EMA CROSS{ longitud1= input.int(9,title= "Fast Moving Average",group= "Moving Averages") longitud2= input.int(21,title= "Medium Moving Average",group= "Moving Averages") longitud3= input.int(50,title= "Slow Moving Average",group= "Moving Averages") slowma= ta.ema(fuente,longitud1) midma= ta.ema(fuente,longitud2) fastma= ta.ema(fuente,longitud3) // } CrossDown = ta.crossunder(close,slowma) and ta.crossunder(close,midma) and ta.crossunder(close,fastma) and ta.rsi(close,14) <60 CrossUp = ta.crossover(close,slowma) and ta.crossover(close,midma) and ta.crossover(close,fastma) and ta.rsi(close,14) >40 plot( hideSma? slowma:na,color=color.green,linewidth=2,title= "Slow") plot(hideSma? midma:na,color=color.orange,linewidth=2,title= "Medium") plot(hideSma?fastma:na,color=color.red,linewidth=2,title= "Fast") plotshape(CrossDown? close:na, title="Cross Down",location=location.abovebar,size=size.auto,text="Sell", textcolor= color.red, color=color.red) plotshape(CrossUp? close:na, title="Cross Up",location=location.belowbar,size=size.auto,text="Buy", textcolor= color.green, color=color.green) alertcondition(CrossDown, "Sell") alertcondition(CrossUp, "Buy")
All TimeFrame Oscillators
https://www.tradingview.com/script/gbrHaEGK-All-TimeFrame-Oscillators/
engemcsakugyhoztak
https://www.tradingview.com/u/engemcsakugyhoztak/
149
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // @author: Engemcsakugyhoztak //@version=4 study(title="All TimeFrame Oscillators", shorttitle="All Tf Osc") oscType = input("Stoch", title="Oscillator", options=["Stoch", "SMI", "Rsi", "StochRsi", "WaveTrend", "CCI", "CCIStoch", "Williams Percent Range", "Norm. MACD", "Norm. MACD Hist", "PVT", "MFI", "CMF", "Chande Momentum", "Volume", "CandleValue", "BBWP"], group="Oscillator") gps = input("Smooth", title="Line type", options=["Smooth", "Step"], group="Oscillator") f_secureSecurity(_symbol, _res, _src) => (gps == "Step" ? security(_symbol, _res, _src, lookahead = barmerge.lookahead_on, gaps = barmerge.gaps_off) : security(_symbol, _res, _src, lookahead = barmerge.lookahead_on, gaps = barmerge.gaps_on)) //security(_symbol, _res, _src, lookahead = barmerge.lookahead_off, gaps = barmerge.gaps_off) plot_osc = input("Oscillator", title="Plot Oscillator or it's Slope", options=["Oscillator", "Slope"], group="Oscillator") dot_type = input("Cross Up/Down oversold/overbougt level", title="Print dots when", options=["Cross Up/Down oversold/overbougt level", "Cross os/ob and the one higher TF is about to cross", "Cross above/below middle line"], group="signals") triangle_type = input("All above/below oversold/overbougt", title="Print triangles when", options=["All Slope Match", "All above/belove middle line", "All above/belove middle line and slope match", "All above/below oversold/overbougt", "Lower TF in order", "Higher TF in order", "4H-1D in order"], group="signals") triangle_gaps = input("Print only last triangles", title="Print triangles", options=["Print all triangles", "Print only first triangles", "Print only last triangles"], group="signals") is1 = input(true, title="1m", inline ="1", group="Timeframes to show") is5 = input(true, title="5m", inline ="1", group="Timeframes to show") is15 = input(true, title="15m", inline ="1", group="Timeframes to show") is30 = input(true, title="30m", inline ="2", group="Timeframes to show") is1H = input(true, title="1H", inline ="2", group="Timeframes to show") is4H = input(true, title="4H", inline ="2", group="Timeframes to show") //is12H = input(false, title="12H") is1D = input(true, title="1D", inline ="3", group="Timeframes to show") is5D = input(false, title="5D", inline ="3", group="Timeframes to show") is1W = input(true, title="1W", inline ="3", group="Timeframes to show") is1M = input(false, title="1M", inline ="3", group="Timeframes to show") // Stochastic Main Parameters len = input(14, minval=1, title="Stoch Length", group="Stoch") smoothK = input(3, minval=1, title="Stoch Smooth", group="Stoch") smik = input(10, "Stochastic momentum Index (SMI) Percent K Length", group="Stochastic momentum Index (SMI)") smid = input(3, "Stochastic momentum Index (SMI) Percent D Length", group="Stochastic momentum Index (SMI)") ccilen = input(defval = 20, title="CCI Length", minval = 1, group="Comodity channel index (CCI)") //momlen = input(defval = 10, title="Momentum Length", minval = 1) CCI_stoch_period = input(28, "CCI Stoch Period", group="Stochastic Comodity channel index (CCIStoch)") cmf_length = input (20, minval=1, title="Chaikin money flow Length", group="Chaikin money flow (CMF)") cmo_length = input(title="Chande Momentum Oscillator Length", type=input.integer, defval=9, group="Chande Momentum Oscillator") ///////////////////// // "Williams Percent Range" shorttitle="Williams %R" wpr_length = input(14, title="Williams %R Length", group="Williams %R") wpr_src = input(close, "Source", group="Williams %R") ///////////////////// // Macd //study("Normalized MACD",shorttitle='N MACD') macd_sma = input(12,title='Fast MA', group="Normalized MACD") macd_lma = input(26,title='Slow MA', group="Normalized MACD") macd_tsp = input(9,title='Trigger', group="Normalized MACD") macd_np = input(50,title='Normalize', group="Normalized MACD") //macd_type = input(1,minval=1,maxval=3,title="1=Ema, 2=Wma, 3=Sma") get_macd() => macd_sh = sma(close,macd_sma) //macd_type == 1 ? ema(close,macd_sma) // : macd_type == 2 ? wma(close, macd_sma) // : macd_sma(close, macd_sma) macd_lon=sma(close,macd_lma) //macd_type == 1 ? ema(close,macd_lma) //: macd_type == 2 ? wma(close, macd_lma) //: sma(close, macd_lma) macd_ratio = min(macd_sh,macd_lon)/max(macd_sh,macd_lon) macd_Mac = (iff(macd_sh>macd_lon,2-macd_ratio,macd_ratio)-1) macd_MacNorm = ((macd_Mac-lowest(macd_Mac, macd_np)) /(highest(macd_Mac, macd_np)-lowest(macd_Mac, macd_np)+.000001)*2)- 1 macd_MacNorm2 = iff(macd_np<2,macd_Mac,macd_MacNorm) macd_Trigger = wma(macd_MacNorm2, macd_tsp) macd_Hist = (macd_MacNorm2-macd_Trigger) macd_Hist2 = macd_Hist>1?1:macd_Hist<-1?-1:macd_Hist //macd_swap=macd_Hist2>macd_Hist2[1]?color.green:color.red //macd_swap2 = macd_docol ? macd_MacNorm2 > macd_MacNorm2[1] ? #0094FF : #FF006E : color.red //plot(h?Hist2:na,color=swap,style=columns,title='Hist',histbase=0) //plot(MacNorm2,color=swap2,title='MacNorm') //plot(dofill?MacNorm2:na,color=MacNorm2>0?green:red,style=columns) //plot(Trigger,color=yellow,title='Trigger') //hline(0) ret = (macd_MacNorm2+1)*50 ret_h = (macd_Hist2+1)*50 [ret, ret_h] /////////////////// ///////////////////// // pvt //pvt_maType = input(kEma, title="Smoothing Type", options=[kEma, kSma, kVwma, kWma]) pvt_short = input(3, title="Short Period", minval=1, group="Normalized Price Volume Trend (PVT)") pvt_long = input(10, title="Long Period", minval=2, group="Normalized Price Volume Trend (PVT)") pvt_shouldNormalize = input(true, title="Normalize data", group="Normalized Price Volume Trend (PVT)") pvt_normalizeLookback = input(25, title="Normalization look-back period", group="Normalized Price Volume Trend (PVT)") // Functionality smoothpvt(sig, len) => ma = ema(sig, len) calc_pvt( sig, short, long) => src = sig vt = cum(change(src) / src[1] * volume) sh = smoothpvt(vt, short) lg = smoothpvt(vt, long) sh - lg maxAbs(series, len) => max = float(0) for i = 0 to len-1 max := max(max, abs(series[i])) max // PVT /////////////// /////////////// // Candle Value cvLen = input (60, 'Candle Value Length', minval=1, group='Candle Value') cvMult = input (300, 'Candle Value multiplier', minval=1, group='Candle Value') candleValue()=> MVC= vwma((close-open)/(high-low), cvLen) MVC := MVC * cvMult + 50 MVC // Candle Value /////////////// ////////////// // WaveTrend wtShow = true //wtBuyShow = input(true, title = 'Show Buy dots', type = input.bool) //wtGoldShow = input(true, title = 'Show Gold dots', type = input.bool) //wtSellShow = input(true, title = 'Show Sell dots', type = input.bool) //wtDivShow = input(true, title = 'Show Div. dots', type = input.bool) //vwapShow = input(true, title = 'Show Fast WT', type = input.bool) wtChannelLen = input(9, title = 'WT Channel Length', type = input.integer, group="WaveTrend") wtAverageLen = input(12, title = 'WT Average Length', type = input.integer, group="WaveTrend") wtMASource = input(hlc3, title = 'WT MA Source', type = input.source, group="WaveTrend") wtMALen = input(3, title = 'WT MA Length', type = input.integer, group="WaveTrend") // WaveTrend f_wavetrend(tfsrc, chlen, avg, malen) => esa = ema(tfsrc, chlen) de = ema(abs(tfsrc - esa), chlen) ci = (tfsrc - esa) / (0.015 * de) wt1 = ema(ci, avg) //wt2 = sma(wt1, malen) //wtVwap = wt1 - wt2 //wtOversold = wt2 <= l //osLevel //wtOverbought = wt2 >= h //obLevel //wtCross = cross(wt1, wt2) //wtCrossUp = wt2 - wt1 <= 0 //wtCrossDown = wt2 - wt1 >= 0 //wtCrosslast = cross(wt1[2], wt2[2]) //wtCrossUplast = wt2[2] - wt1[2] <= 0 //wtCrossDownlast = wt2[2] - wt1[2] >= 0 //[wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCrosslast, wtCrossUplast, wtCrossDownlast, wtVwap] wt1 // WaveTrend ///////////// // Volume OSC ///////////// volshortlen = input(5, minval=1, title = "Short Length", group = "Volume Oscillator") vollonglen = input(10, minval=1, title = "Long Length", group = "Volume Oscillator") ///////////// // Volume Osc /////////////// // BBWP i_priceSrc = input ( close, 'Price Source', group='Bollinger Band Width Percentile (BBWP)') i_bbwpLen = input ( 13, 'Length', minval=1, group='Bollinger Band Width Percentile (BBWP)') i_basisType = input ( 'SMA', 'Basis Type', options=['SMA', 'EMA', 'VWMA'], group='Bollinger Band Width Percentile (BBWP)') i_bbwpLkbk = input ( 100, 'Lookback', minval=1, group='Bollinger Band Width Percentile (BBWP)') f_bbwp ( _priceSrc, _bbwLen, _type, _lookback ) => _basis = sma(_priceSrc, _bbwLen) if _type == "EMA" _basis := ema(_priceSrc, _bbwLen) if _type == "VWMA" _basis := vwma(_priceSrc, _bbwLen) _dev = stdev(_priceSrc, _bbwLen) _upper = _basis + _dev _lower = _basis - _dev _bbw = (_upper-_lower)/_basis //_dev = stdev ( _priceSrc, _bbwLen ) //_bbw = ( _basis + _dev - ( _basis - _dev )) / _basis _bbwSum = 0.0 _len = bar_index < _lookback ? bar_index : _lookback for _i = 1 to _len by 1 _bbwSum += ( _bbw[_i] > _bbw ? 0 : 1 ) _bbwSum _return = bar_index >= _lookback ? ( _bbwSum / _len) * 100 : na _return // BBWP /////////////// // Plot Tresholds h = (plot_osc=="Slope" ? 0 : oscType=="SMI" ? 40 : oscType=="Rsi" ? 70 : oscType=="CCI" ? 100 : oscType=="CMF" ? 20 : oscType=="WaveTrend" ? 60 : oscType=="Volume" ? 20 : oscType == "Chande Momentum" ? 50 : oscType == "Williams Percent Range" ? -20 : 80) l = (plot_osc=="Slope" ? 0 : oscType=="SMI" ? -40 : oscType=="Rsi" ? 30 : oscType=="CCI" ? -100 : oscType=="CMF" ? -20 : oscType=="WaveTrend" ? -60 : oscType=="Volume" ? -20 : oscType == "Chande Momentum" ? -50 : oscType == "Williams Percent Range" ? -80 : 20) m = (plot_osc=="Slope" ? 0 : oscType=="Rsi" or oscType=="Norm. MACD Hist" or oscType=="PVT" or oscType=="BBWP" ? 50 : oscType=="SMI" or oscType=="CCI" or oscType=="CMF" or oscType=="WaveTrend" or oscType=="Volume" or oscType == "Chande Momentum" ? 0 : oscType == "Williams Percent Range" ? -50 : 50) doth = (plot_osc=="Slope" ? 30 : oscType=="SMI" ? 100 : oscType=="Rsi" ? 90 : oscType=="CCI" ? 300 : oscType=="CMF" ? 30 : oscType=="WaveTrend" ? 100 : oscType=="Volume" ? 30 : oscType == "Chande Momentum" ? 80 : oscType == "Williams Percent Range" ? 0 : 100) dotl = (plot_osc=="Slope" ? -30 : oscType=="SMI" ? -100 : oscType=="Rsi" ? 10 : oscType=="CCI" ? -300 : oscType=="CMF" ? -30 : oscType=="WaveTrend" ? -100 : oscType=="Volume" ? -30 : oscType == "Chande Momentum" ? -80 : oscType == "Williams Percent Range" ? -100 : 0) span = ( oscType=="CCI" ? 12 : oscType=="WaveTrend" ? 6 : oscType=="CMF" ? 3 : 3) p1 = hline(plot_osc != "Slope" ? h : na, title='Overbought', color=color.gray, linestyle=hline.style_dashed, linewidth=1) p2 = hline(plot_osc != "Slope" ? l : na, title='Oversold', color=color.gray, linestyle=hline.style_dashed, linewidth=1) p3 = hline(plot_osc != "Slope" ? m : 0, title='Middle', color=color.gray, linestyle=hline.style_dashed, linewidth=1) // ————— Converts current chart resolution into a float minutes value. f_resInMinutes() => _resInMinutes = timeframe.multiplier * ( timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na) // ————— Returns the float minutes value of the string _res. f_tfResInMinutes(_res) => // _res: resolution of any TF (in "timeframe.period" string format). // Dependency: f_resInMinutes(). security(syminfo.tickerid, _res, f_resInMinutes()) // —————————— Determine if current timeframe is smaller that higher timeframe selected in Inputs. currentTfInMinutes = f_resInMinutes() // Compare current TF to higher TF to make sure it is smaller, otherwise our plots don't make sense. //chartOnLowerTf = currentTfInMinutes < higherTfInMinutes /////////////////////////// // calculate the oscillator osc(t, len) => k = sma(stoch(close, high, low, len), smoothK) // Stoch if t == "Stoch" // Stock k := sma(stoch(close, high, low, len), smoothK) if t == "SMI" // Range Calculation ll = lowest (low, smik) hh = highest (high, smik) diff = hh - ll rdiff = close - (hh+ll)/2 avgrel = ema(ema(rdiff,smid),smid) avgdiff = ema(ema(diff,smid),smid) // SMI calculations SMI = avgdiff != 0 ? (avgrel/(avgdiff/2)*100) : 0 k := ema(SMI,smid) if t == "Rsi" // RSI k := rsi(close, len) if t == "StochRsi" // stochRsi k := sma(stoch(rsi(close, len), rsi(close, len), rsi(close, len), len), smoothK) if t == "CCI" k := cci(close, ccilen) if t == "CCIStoch" cci = cci(close, ccilen) stoch_cci_k = sma(stoch(cci, cci, cci, CCI_stoch_period), smoothK) stoch_cci_d = sma(stoch_cci_k, smoothK) k := stoch_cci_d if t == "Williams Percent Range" max = highest(wpr_length) min = lowest(wpr_length) k := 100 * (wpr_src - max) / (max - min) if t == "Norm. MACD" or t == "Norm. MACD Hist" [macd, macd_hist] = get_macd() if t == "Norm. MACD" k := macd else k := macd_hist if t == "PVT" raw_pvt = calc_pvt( close, pvt_short, pvt_long) maxAbs_pvt = maxAbs(raw_pvt, pvt_normalizeLookback) range_pvt = 1.0 // range to fit values into k := (iff(pvt_shouldNormalize, (raw_pvt / maxAbs_pvt * range_pvt), raw_pvt) +1) * 50 if t == "MFI" k := mfi(close, len) if t == "CMF" //"Chaikin Money Flow" var cumVol = 0. cumVol += nz(volume) //if barstate.islast and cumVol == 0 runtime.error("No volume is provided by the data vendor.") ad = close==high and close==low or high==low ? 0 : ((2*close-low-high)/(high-low))*volume k := 100 * sum(ad, cmf_length) / sum(volume, cmf_length) if t == "Chande Momentum" mom = change(close) upSum = sum(max(mom, 0), cmo_length) downSum = sum(-min(mom, 0), cmo_length) k := 100 * (upSum - downSum) / (upSum + downSum) if t == "Volume" var cumVol = 0. cumVol += nz(volume) short = ema(volume, volshortlen) long = ema(volume, vollonglen) k := 100 * (short - long) / long if t == "CandleValue" k := candleValue() if t == "WaveTrend" //[wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCross_last, wtCrossUp_last, wtCrossDown_last, wtVwap] = f_wavetrend(wtMASource, wtChannelLen, wtAverageLen, wtMALen) wt1 = f_wavetrend(wtMASource, wtChannelLen, wtAverageLen, wtMALen) k:= wt1 if t == "BBWP" k := f_bbwp ( i_priceSrc, i_bbwpLen, i_basisType, i_bbwpLkbk ) slope = k - k[1] [k, slope] [k, t] = osc(oscType, len) outK1 = is1 ? f_secureSecurity(syminfo.tickerid, tostring(1), k) : na t1 = is1 ? fixnan(f_secureSecurity(syminfo.tickerid, tostring(1), t)) : na outK2 = is5 ? f_secureSecurity(syminfo.tickerid, tostring(5), k) : na t2 = is5 ? fixnan(f_secureSecurity(syminfo.tickerid, tostring(5), t)) : na outK3 = is15 ? f_secureSecurity(syminfo.tickerid, tostring(15), k) : na t3 = is15 ? fixnan(f_secureSecurity(syminfo.tickerid, tostring(15), t)) : na outK4 = is30 ? f_secureSecurity(syminfo.tickerid, tostring(30), k) : na t4 = is30 ? fixnan(f_secureSecurity(syminfo.tickerid, tostring(30), t)) : na outK5 = is1H ? f_secureSecurity(syminfo.tickerid, tostring(60), k) : na t5 = is1H ? fixnan(f_secureSecurity(syminfo.tickerid, tostring(60), t)) : na outK6 = is4H ? f_secureSecurity(syminfo.tickerid, tostring(240), k) : na t6 = is4H ? fixnan(f_secureSecurity(syminfo.tickerid, tostring(240), t)) : na //outK12H = is12H ? f_secureSecurity(syminfo.tickerid, tostring(720), k) : na //t12H = is12H ? fixnan(f_secureSecurity(syminfo.tickerid, tostring(720), t)) : na outK7 = is1D ? f_secureSecurity(syminfo.tickerid, tostring(1440), k) : na t7 = is1D ? fixnan(f_secureSecurity(syminfo.tickerid, tostring(1440), t)) : na outK8 = is1W ? f_secureSecurity(syminfo.tickerid, 'W', k) : na t8 = is1W ? fixnan(f_secureSecurity(syminfo.tickerid, 'W', t)) : na outK9 = is1M ? f_secureSecurity(syminfo.tickerid, 'M', k) : na t9 = is1M ? fixnan(f_secureSecurity(syminfo.tickerid, 'M', t)) : na outK10 = is5D ? f_secureSecurity(syminfo.tickerid, '5D', k) : na t10 = is5D ? fixnan(f_secureSecurity(syminfo.tickerid, '5D', t)) : na c1m=color.new(color.teal, transp=60) c5m=color.new(color.aqua, transp=50) c15m=color.new(color.rgb(165, 214, 167), transp=40) c30m=color.new(color.yellow, transp=30) c60m=color.new(color.white, transp=20) c240m=color.new(color.red, transp=10) //c720m=color.new(color.blue, transp=10) c1440m=color.new(color.green, transp=0) c7200m=color.new(color.olive, transp=10) c1W=color.new(color.orange, transp=20) c1M=color.new(color.maroon, transp=20) plot(plot_osc != "Slope" and currentTfInMinutes<=1? outK1 : na, title= "1 min", style=plot.style_line, linewidth=2, color=c1m) plot(plot_osc != "Slope" and currentTfInMinutes<=5? outK2 : na, title= "5 min", style=plot.style_line, linewidth=2, color=c5m) plot(plot_osc != "Slope" and currentTfInMinutes<=15? outK3 : na, title= "15 min", style=plot.style_line, linewidth=2, color=c15m) plot(plot_osc != "Slope" and currentTfInMinutes<=30? outK4 : na, title= "30 min", style=plot.style_line, linewidth=2, color=c30m) plot(plot_osc != "Slope" and currentTfInMinutes<=60? outK5 : na, title= "1 H", style=plot.style_line, linewidth=2, color=c60m) plot(plot_osc != "Slope" and currentTfInMinutes<=240? outK6 : na, title= "4 H", style=plot.style_line, linewidth=2, color=c240m) //plot(plot_osc != "Slope" and currentTfInMinutes<=720? outK12H : na, title= "12 H", style=plot.style_line, linewidth=2, color=c720m) plot(plot_osc != "Slope" and currentTfInMinutes<=1440? outK7 : na, title= "1 D", style=plot.style_line, linewidth=2, color=c1440m) plot(plot_osc != "Slope" and currentTfInMinutes<=7200? outK10 : na, title= "5 D", style=plot.style_line, linewidth=2, color=c7200m) plot(plot_osc != "Slope" and currentTfInMinutes<=10080? outK8 : na, title= "1 W", style=plot.style_line, linewidth=2, color=c1W) plot(plot_osc != "Slope" and currentTfInMinutes<=45000? outK9 : na, title= "1 M", style=plot.style_line, linewidth=2, color=c1M) // plot trends plot(plot_osc == "Slope" and currentTfInMinutes<=1? t1 : na, title= "1 min", style=plot.style_line, linewidth=2, color=c1m) plot(plot_osc == "Slope" and currentTfInMinutes<=5? t2 : na, title= "5 min", style=plot.style_line, linewidth=2, color=c5m) plot(plot_osc == "Slope" and currentTfInMinutes<=15? t3 : na, title= "15 min", style=plot.style_line, linewidth=2, color=c15m) plot(plot_osc == "Slope" and currentTfInMinutes<=30? t4 : na, title= "30 min", style=plot.style_line, linewidth=2, color=c30m) plot(plot_osc == "Slope" and currentTfInMinutes<=60? t5 : na, title= "1 H", style=plot.style_line, linewidth=2, color=c60m) plot(plot_osc == "Slope" and currentTfInMinutes<=240? t6 : na, title= "4 H", style=plot.style_line, linewidth=2, color=c240m) //plot(plot_osc == "Slope" and currentTfInMinutes<=720? t12H : na, title= "12 H", style=plot.style_line, linewidth=2, color=c720m) plot(plot_osc == "Slope" and currentTfInMinutes<=1440? t7 : na, title= "1 D", style=plot.style_line, linewidth=2, color=c1440m) plot(plot_osc == "Slope" and currentTfInMinutes<=7200? t10 : na, title= "5 D", style=plot.style_line, linewidth=2, color=c7200m) plot(plot_osc == "Slope" and currentTfInMinutes<=10080? t8 : na, title= "1 W", style=plot.style_line, linewidth=2, color=c1W) plot(plot_osc == "Slope" and currentTfInMinutes<=45000? t9 : na, title= "1 M", style=plot.style_line, linewidth=2, color=c1M) lowercond(_osc, _line, _hTfOsc, _htfSlope) => c = crossover(_osc, _line) if dot_type == "Cross os/ob and the one higher TF is about to cross" c := crossover(_osc, _line) and fixnan(_hTfOsc) < _line and _htfSlope >=0 if dot_type == "Cross above/below middle line" c := crossover(_osc, m) c uppercond(_osc, _line, _hTfOsc, _htfSlope) => c = crossunder(_osc, _line) if dot_type == "Cross os/ob and the one hiegher TF is about to cross" c := crossunder(_osc, _line) and fixnan(_hTfOsc) > _line and _htfSlope <=0 if dot_type == "Cross above/below middle line" c := crossunder(_osc, m) c shapeup = shape.circle shapedown = shape.circle dot1l = currentTfInMinutes<=1 and lowercond(outK1, l, outK2, t2) dot1u = currentTfInMinutes<=1 and uppercond(outK1, h, outK2, t2) dot5l = currentTfInMinutes<=5 and lowercond(outK2, l, outK3, t3) dot5u = currentTfInMinutes<=5 and uppercond(outK2, h, outK3, t3) dot15l = currentTfInMinutes<=15 and lowercond(outK3, l, outK4, t4) dot15u = currentTfInMinutes<=15 and uppercond(outK3, h, outK4, t4) dot30l = currentTfInMinutes<=30 and lowercond(outK4, l, outK5, t5) dot30u = currentTfInMinutes<=30 and uppercond(outK4, h, outK5, t5) dot1Hl = currentTfInMinutes<=60 and lowercond(outK5, l, outK6, t6) dot1Hu = currentTfInMinutes<=60 and uppercond(outK5, h, outK6, t6) //dot4Hl = currentTfInMinutes<=240 and lowercond(outK6, l, outK12H, t12H) //dot4Hu = currentTfInMinutes<=240 and uppercond(outK6, h, outK12H, t12H) dot4Hl = currentTfInMinutes<=240 and lowercond(outK6, l, outK7, t7) dot4Hu = currentTfInMinutes<=240 and uppercond(outK6, h, outK7, t7) //dot12Hl = currentTfInMinutes<=720 and lowercond(outK12H, l, outK7, t7) //dot12Hu = currentTfInMinutes<=720 and uppercond(outK12H, h, outK7, t7) dot1Dl = currentTfInMinutes<=1440 and lowercond(outK7, l, outK10, t10) dot1Du = currentTfInMinutes<=1440 and uppercond(outK7, h, outK10, t10) dot5Dl = currentTfInMinutes<=1440 and lowercond(outK10, l, outK8, t8) dot5Du = currentTfInMinutes<=1440 and uppercond(outK10, h, outK8, t8) dot1Wl = currentTfInMinutes<=10080 and lowercond(outK8, l, outK9, t9) dot1Wu = currentTfInMinutes<=10080 and uppercond(outK8, h, outK9, t9) dot1Ml = currentTfInMinutes<=45000 and lowercond(outK9, l, outK9, t9) dot1Mu = currentTfInMinutes<=45000 and uppercond(outK9, h, outK9, t9) plotshape(plot_osc != "Slope" and dot1l ? dotl-span : na, title="Buy", style=shapeup, color=c1m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot1u ? doth+span : na, title='Sell', style=shapedown, color=c1m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot5l ? dotl-2*span : na, title="Buy", style=shapeup, color=c5m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot5u ? doth+2*span : na, title='Sell', style=shapedown, color=c5m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot15l ? dotl-3*span : na, title="Buy", style=shapeup, color=c15m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot15u ? doth+3*span : na, title='Sell', style=shapedown, color=c15m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot30l ? dotl-4*span : na, title="Buy", style=shapeup, color=c30m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot30u ? doth+4*span : na, title='Sell', style=shapedown, color=c30m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot1Hl ? dotl-5*span : na, title="Buy", style=shapeup, color=c60m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot1Hu ? doth+5*span : na, title='Sell', style=shapedown, color=c60m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot4Hl ? dotl-6*span : na, title="Buy", style=shapeup, color=c240m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot4Hu ? doth+6*span : na, title='Sell', style=shapedown, color=c240m, location=location.absolute, size=size.auto) //plotshape(plot_osc != "Slope" and dot12Hl ? dotl-7*span : na, title="Buy", style=shapeup, color=c720m, location=location.absolute, size=size.auto) //plotshape(plot_osc != "Slope" and dot12Hu ? doth+7*span : na, title='Sell', style=shapedown, color=c720m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot1Dl ? dotl-8*span : na, title="Buy", style=shapeup, color=c1440m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot1Du ? doth+8*span : na, title='Sell', style=shapedown, color=c1440m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot5Dl ? dotl-9*span : na, title="Buy", style=shapeup, color=c7200m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot5Du ? doth+9*span : na, title='Sell', style=shapedown, color=c7200m, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot1Wl ? dotl-10*span : na, title="Buy", style=shapeup, color=c1W, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot1Wu ? doth+10*span : na, title='Sell', style=shapedown, color=c1W, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot1Ml ? dotl-11*span : na, title="Buy", style=shapeup, color=c1M, location=location.absolute, size=size.auto) plotshape(plot_osc != "Slope" and dot1Mu ? doth+11*span : na, title='Sell', style=shapedown, color=c1M, location=location.absolute, size=size.auto) //alertcondition( ((dot1l or dot1u or dot5l or dot5u or dot15l or dot15u or dot30l or dot30u or dot1Hl or dot1Hu or dot4Hl or dot4Hu or dot12Hl or dot12Hu or dot1Dl or dot1Du or dot5Dl or dot5Du or dot1Wl or dot1Wu or dot1Ml or dot1Mu)? true:na), title="Dot alert", message="Dot on the MTF Stoch!") alertcondition( ((dot1l or dot1u or dot5l or dot5u or dot15l or dot15u or dot30l or dot30u or dot1Hl or dot1Hu or dot4Hl or dot4Hu or dot1Dl or dot1Du or dot5Dl or dot5Du or dot1Wl or dot1Wu or dot1Ml or dot1Mu)? true:na), title="Dot alert", message="Dot on the MTF Stoch!") //4H 1D crosses //plotshape(crossover(fixnan(outK6), fixnan(outK7)) and fixnan(t7)>0 and fixnan(outK7)<50 ? 0 : na, title="Buy", style=shape.triangleup, color=c1440m, location=location.absolute, size=size.tiny) //plotshape(crossunder(fixnan(outK6), fixnan(outK7)) and fixnan(t7)<0 and fixnan(outK7)>50? 100 : na, title="Sell", style=shape.triangledown, color=c1440m, location=location.absolute, size=size.tiny) //1D 1W crosses //plotshape(crossover(fixnan(outK7), fixnan(outK8)) and fixnan(t8)>0 and fixnan(outK8)<50 ? 0 : na, title="Buy", style=shape.triangleup, color=c1W, location=location.absolute, size=size.tiny) //plotshape(crossunder(fixnan(outK7), fixnan(outK8)) and fixnan(t8)<0 and fixnan(outK8)>50? 100 : na, title="Sell", style=shape.triangledown, color=c1W, location=location.absolute, size=size.tiny) //1W 1M crosses //plotshape(crossover(fixnan(outK8), fixnan(outK9)) and fixnan(t9)>0 and fixnan(outK9)<50 ? 0 : na, title="Buy", style=shape.triangleup, color=c1M, location=location.absolute, size=size.tiny) //plotshape(crossunder(fixnan(outK8), fixnan(outK9)) and fixnan(t9)<0 and fixnan(outK9)>50? 100 : na, title="Sell", style=shape.triangledown, color=c1M, location=location.absolute, size=size.tiny) alert_cond = ((currentTfInMinutes<=1 and is1 ? t1>=0 : true ) and (currentTfInMinutes<=5 and is5 ? t2>=0 : true ) and (currentTfInMinutes<=15 and is15 ? t3>=0 : true ) and (currentTfInMinutes<=30 and is30 ? t4>=0 : true ) and (currentTfInMinutes<=60 and is1H ? t5>=0 : true ) and (currentTfInMinutes<=240 and is4H ? t6>=0 : true ) and // (currentTfInMinutes<=720 and is12H ? t12H>=0 : true ) and (currentTfInMinutes<=1440 and is1D ? t7>=0 : true ) and (currentTfInMinutes<=7200 and is5D ? t10>=0 : true ) and (currentTfInMinutes<=10080 and is1W ? t8>=0 : true ) and (currentTfInMinutes<=45000 and is1M ? t9>=0 : true ) ? "green" : ( (currentTfInMinutes<1 and is1 ? t1<=0 : true ) and (currentTfInMinutes<=5 and is5 ? t2<=0 : true ) and (currentTfInMinutes<=15 and is15 ? t3<=0 : true ) and (currentTfInMinutes<=30 and is30 ? t4<=0 : true ) and (currentTfInMinutes<=60 and is1H ? t5<=0 : true ) and (currentTfInMinutes<=240 and is4H ? t6<=0 : true ) and // (currentTfInMinutes<=720 and is12H ? t12H<=0 : true ) and (currentTfInMinutes<=1440 and is1D ? t7<=0 : true ) and (currentTfInMinutes<=7200 and is5D ? t10<=0 : true ) and (currentTfInMinutes<=10080 and is1W ? t8<=0 : true ) and (currentTfInMinutes<=45000 and is1M ? t9<=0 : true ) ? "red" : na)) alltriangles = triangle_type == "All Slope Match" ? true : false m_chk = triangle_type == "All above/belove middle line and slope match" or triangle_type == "All above/belove middle line" ? true : false hl_chk = triangle_type == "All above/below oversold/overbougt" ? true : false noslope_chk = triangle_type == "All above/belove middle line" or triangle_type == "All above/below oversold/overbougt" ? true : false triangles = "" if triangle_type != "Lower TF in order" and triangle_type != "Higher TF in order" and triangle_type != "4H-1D in order" triangles := ( (currentTfInMinutes<=1 and is1 ? (noslope_chk or t1>=0) and (alltriangles or (m_chk and fixnan(outK1)>=m) or (hl_chk and fixnan(outK1) <= l)) : true ) and (currentTfInMinutes<=5 and is5 ? (noslope_chk or t2>=0) and (alltriangles or (m_chk and fixnan(outK2)>=m) or (hl_chk and fixnan(outK2) <= l)) : true ) and (currentTfInMinutes<=15 and is15 ? (noslope_chk or t3>=0) and (alltriangles or (m_chk and fixnan(outK3)>=m) or (hl_chk and fixnan(outK3) <= l)) : true ) and (currentTfInMinutes<=30 and is30 ? (noslope_chk or t4>=0) and (alltriangles or (m_chk and fixnan(outK4)>=m) or (hl_chk and fixnan(outK4) <= l)) : true ) and (currentTfInMinutes<=60 and is1H ? (noslope_chk or t5>=0) and (alltriangles or (m_chk and fixnan(outK5)>=m) or (hl_chk and fixnan(outK5) <= l)) : true ) and (currentTfInMinutes<=240 and is4H ? (noslope_chk or t6>=0) and (alltriangles or (m_chk and fixnan(outK6)>=m) or (hl_chk and fixnan(outK6) <= l)) : true ) and // (currentTfInMinutes<=720 and is12H ? (noslope_chk or t12H>=0) and (alltriangles or (m_chk and fixnan(outK12H)>=m) or (hl_chk and fixnan(outK12H) <= l)) : true ) and (currentTfInMinutes<=1440 and is1D ? (noslope_chk or t7>=0) and (alltriangles or (m_chk and fixnan(outK7)>=m) or (hl_chk and fixnan(outK7) <= l)) : true ) and (currentTfInMinutes<=7200 and is5D ? (noslope_chk or t10>=0) and (alltriangles or (m_chk and fixnan(outK10)>=m) or (hl_chk and fixnan(outK10) <= l)) : true ) and (currentTfInMinutes<=10080 and is1W ? (noslope_chk or t8>=0) and (alltriangles or (m_chk and fixnan(outK8)>=m) or (hl_chk and fixnan(outK8) <= l)) : true ) and (currentTfInMinutes<=45000 and is1M ? (noslope_chk or t9>=0) and (alltriangles or (m_chk and fixnan(outK9)>=m) or (hl_chk and fixnan(outK9) <= l)) : true ) ? "green" : ( (currentTfInMinutes<=1 and is1 ? (noslope_chk or t1<=0) and (alltriangles or (m_chk and fixnan(outK1)<=m) or (hl_chk and fixnan(outK1) >= h)) : true ) and (currentTfInMinutes<=5 and is5 ? (noslope_chk or t2<=0) and (alltriangles or (m_chk and fixnan(outK2)<=m) or (hl_chk and fixnan(outK2) >= h)) : true ) and (currentTfInMinutes<=15 and is15 ? (noslope_chk or t3<=0) and (alltriangles or (m_chk and fixnan(outK3)<=m) or (hl_chk and fixnan(outK3) >= h)) : true ) and (currentTfInMinutes<=30 and is30 ? (noslope_chk or t4<=0) and (alltriangles or (m_chk and fixnan(outK4)<=m) or (hl_chk and fixnan(outK4) >= h)) : true ) and (currentTfInMinutes<=60 and is1H ? (noslope_chk or t5<=0) and (alltriangles or (m_chk and fixnan(outK5)<=m) or (hl_chk and fixnan(outK5) >= h)) : true ) and (currentTfInMinutes<=240 and is4H ? (noslope_chk or t6<=0) and (alltriangles or (m_chk and fixnan(outK6)<=m) or (hl_chk and fixnan(outK6) >= h)) : true ) and // (currentTfInMinutes<=720 and is12H ? (noslope_chk or t12H<=0) and (alltriangles or (m_chk and fixnan(outK12H)<=m) or (hl_chk and fixnan(outK12H) >= h)) : true ) and (currentTfInMinutes<=1440 and is1D ? (noslope_chk or t7<=0) and (alltriangles or (m_chk and fixnan(outK7)<=m) or (hl_chk and fixnan(outK7) >= h)) : true ) and (currentTfInMinutes<=7200 and is5D ? (noslope_chk or t10<=0) and (alltriangles or (m_chk and fixnan(outK10)<=m) or (hl_chk and fixnan(outK10) >= h)) : true ) and (currentTfInMinutes<=10080 and is1W ? (noslope_chk or t8<=0) and (alltriangles or (m_chk and fixnan(outK8)<=m) or (hl_chk and fixnan(outK8) >= h)) : true ) and (currentTfInMinutes<=45000 and is1M ? (noslope_chk or t9<=0) and (alltriangles or (m_chk and fixnan(outK9)<=m) or (hl_chk and fixnan(outK9) >= h)) : true ) ? "red" : na)) if triangle_type == "Lower TF in order" or triangle_type == "Higher TF in order" or triangle_type == "4H-1D in order" all_up = false all_down = false if triangle_type == "4H-1D in order" all_up := fixnan(outK6)>fixnan(outK7) all_down := fixnan(outK6)<fixnan(outK7) if triangle_type == "Higher TF in order" all_up := fixnan(outK6)>fixnan(outK7) and fixnan(outK7)>fixnan(outK8) // and fixnan(outK5)>fixnan(outK6) all_down := fixnan(outK6)<fixnan(outK7) and fixnan(outK7)<fixnan(outK8) //and fixnan(outK5)<fixnan(outK6) if triangle_type == "Lower TF in order" all_up := fixnan(outK2)>fixnan(outK3) and fixnan(outK3)>fixnan(outK4) and fixnan(outK4)>fixnan(outK5) all_down := fixnan(outK2)<fixnan(outK3) and fixnan(outK3)<fixnan(outK4) and fixnan(outK4)<fixnan(outK5) var on_up = false var on_down = false var last_sign = "" if triangle_gaps == "Print all triangles" on_up := all_up on_down := all_down if triangle_gaps == "Print only first triangles" on_up := all_up and last_sign != "up" // or (on_up and not all_up) on_down := all_down and last_sign != "down"// or (on_down and not all_down) if triangle_gaps == "Print only last triangles" on_up := all_up and all_up[1] == false on_down := all_down and all_down[1] == false if all_up last_sign := "up" if all_down last_sign := "down" triangles := ( on_up ) ? "green" : ( on_down) ? "red" : na buy = triangles == "green" ? true : false sell = triangles == "red" ? true : false if triangle_gaps == "Print only first triangles" prevbuy=0 prevsell=0 for i = 0 to 1000 if triangles[i] == "green" prevbuy:=5 break if triangles[i] == "red" prevsell:=5 break buy := crossover(prevbuy, prevsell) sell := crossunder(prevbuy, prevsell) if triangle_gaps == "Print only last triangles" buy := triangles[1] == "green" and triangles == na sell := triangles[1] == "red" and triangles == na plotshape (dotl, color=(buy ? color.green : na), style=shape.triangleup, location=location.absolute, size=size.small) plotshape (doth, color=(sell ? color.red : na), style=shape.triangledown, location=location.absolute, size=size.small) //plotshape (50, color=(triangles=="green" and triangles[1]!="green" ? color.green : ( triangles=="red" and triangles[1]!="red" ? color.red : color.new(color.black, 100))), style=shape., location=location.absolute, size=size.tiny) plotshape (dotl, color=(triangles=="green" and triangles[1]!="green" ? color.green : na), style=shape.triangleup, location=location.absolute, size=size.tiny) plotshape (doth, color=(triangles=="red" and triangles[1]!="red" ? color.red : na), style=shape.triangledown, location=location.absolute, size=size.tiny) alertcondition( (buy or sell), title="Triangle alert", message="Triangle Signal!\n{{time}}\n{{exchange}}:{{ticker}}, price = {{close}}") Round( _val, _decimals) => // Rounds _val to _decimals places. _p = pow(10,_decimals) round(abs(_val)*_p)/_p*sign(_val) Dark_Red = color.new(#8B0000, 30) Red = color.new(#FF0000, 30) Dark_Green = color.new(#006400, 30) Green = color.new(#008000, 30) //blue_ob = color.new(#87CEFA, 30) blue_bull = color.new(#00BFFF, 30) blue_bear = color.new(#007FFF, 30) //blue os = color.new(#0000FF, 30) gray = color.new(color.gray, 0) f_val_color(_val) => //(_val < l ? color.new(color.green, 30) : _val > h ? color.new(color.red, 30) : color.black ) (_val < l ? Dark_Green : _val >=l and _val < m ? blue_bear : _val >= m and _val < h ? blue_bull : _val >= h ? Dark_Red : gray) f_slope_color(_s) => (Round(_s, 0) > 0 ? Green : Round(_s, 0) < 0 ? Red : color.black ) VC_1m = f_val_color(fixnan(outK1)) VC_5m = f_val_color(fixnan(outK2)) VC_15m = f_val_color(fixnan(outK3)) VC_30m = f_val_color(fixnan(outK4)) VC_1H = f_val_color(fixnan(outK5)) VC_4H = f_val_color(fixnan(outK6)) //VC_12H = f_val_color(fixnan(outK12H)) VC_D = f_val_color(fixnan(outK7)) VC_5D = f_val_color(fixnan(outK10)) VC_W = f_val_color(fixnan(outK8)) VC_M = f_val_color(fixnan(outK9)) SC_1m = f_slope_color(fixnan(t1)) SC_5m = f_slope_color(fixnan(t2)) SC_15m = f_slope_color(fixnan(t3)) SC_30m = f_slope_color(fixnan(t4)) SC_1H = f_slope_color(fixnan(t5)) SC_4H = f_slope_color(fixnan(t6)) //SC_12H = f_slope_color(fixnan(t12H)) SC_D = f_slope_color(fixnan(t7)) SC_5D = f_slope_color(fixnan(t10)) SC_W = f_slope_color(fixnan(t8)) SC_M = f_slope_color(fixnan(t9)) tableYposInput = input ("middle", "Panel position", options = ["top", "middle", "bottom"], group = "info panel") tableXposInput = input ("left", "", options = ["left", "center", "right"]) var table TTM = table.new( tableYposInput + "_" + tableXposInput, 30, 12, border_width = 0, frame_width=0 ) THC = input (color.new(#000000, 0), "Table Header Color") TC = input (color.new(color.white, 0), "Table Text Color") TS = size.tiny //, "Table Text Size", options = [size.tiny, size.small, size.normal, size.large]) table.cell(TTM, 0, 0, oscType, text_color = THC, bgcolor = gray, text_size = size.small) table.cell(TTM, 1, 0, "Value", text_color = THC, bgcolor = gray, text_size = size.small) table.cell(TTM, 2, 0, "Slope", text_color = THC, bgcolor = gray, text_size = size.small) if (currentTfInMinutes<=1 and is1) table.cell(TTM, 0, 1, "1m", text_color = THC, bgcolor = c1m, text_size = TS) table.cell(TTM, 1, 1, tostring(Round(fixnan(outK1), 0)), text_color = TC, bgcolor = VC_1m, text_size = TS) table.cell(TTM, 2, 1, tostring(Round(fixnan(t1), 2)), text_color = TC, bgcolor = SC_1m, text_size = TS) if (currentTfInMinutes<=5 and is5) table.cell(TTM, 0, 2, "5m", text_color = THC, bgcolor = c5m, text_size = TS) table.cell(TTM, 1, 2, tostring(Round(fixnan(outK2), 0)), text_color = TC, bgcolor = VC_5m, text_size = TS) table.cell(TTM, 2, 2, tostring(Round(fixnan(t2), 2)), text_color = TC, bgcolor = SC_5m, text_size = TS) if (currentTfInMinutes<=15 and is15) table.cell(TTM, 0, 3, "15m", text_color = THC, bgcolor = c15m, text_size = TS) table.cell(TTM, 1, 3, tostring(Round(fixnan(outK3), 0)), text_color = TC, bgcolor = VC_15m, text_size = TS) table.cell(TTM, 2, 3, tostring(Round(fixnan(t3), 2)), text_color = TC, bgcolor = SC_15m, text_size = TS) if (currentTfInMinutes<=30 and is30) table.cell(TTM, 0, 4, "30m", text_color = THC, bgcolor = c30m, text_size = TS) table.cell(TTM, 1, 4, tostring(Round(fixnan(outK4), 0)), text_color = TC, bgcolor = VC_30m, text_size = TS) table.cell(TTM, 2, 4, tostring(Round(fixnan(t4), 2)), text_color = TC, bgcolor = SC_30m, text_size = TS) if (currentTfInMinutes<=60 and is1H) table.cell(TTM, 0, 5, "1H", text_color = THC, bgcolor = c60m, text_size = TS) table.cell(TTM, 1, 5, tostring(Round(fixnan(outK5), 0)), text_color = TC, bgcolor = VC_1H, text_size = TS) table.cell(TTM, 2, 5, tostring(Round(fixnan(t5), 2)), text_color = TC, bgcolor = SC_1H, text_size = TS) if (currentTfInMinutes<=240 and is4H) table.cell(TTM, 0, 6, "4H", text_color = THC, bgcolor = c240m, text_size = TS) table.cell(TTM, 1, 6, tostring(Round(fixnan(outK6), 0)), text_color = TC, bgcolor = VC_4H, text_size = TS) table.cell(TTM, 2, 6, tostring(Round(fixnan(t6), 2)), text_color = TC, bgcolor = SC_4H, text_size = TS) //if (currentTfInMinutes<=720 and is12H) // table.cell(TTM, 0, 7, "12H", text_color = THC, bgcolor = c720m, text_size = TS) // table.cell(TTM, 1, 7, tostring(Round(fixnan(outK12H), 0)), text_color = TC, bgcolor = VC_12H, text_size = TS) // table.cell(TTM, 2, 7, tostring(Round(fixnan(t12H), 2)), text_color = TC, bgcolor = SC_12H, text_size = TS) if (currentTfInMinutes<=1440 and is1D) table.cell(TTM, 0, 8, "D", text_color = THC, bgcolor = c1440m, text_size = TS) table.cell(TTM, 1, 8, tostring(Round(fixnan(outK7), 0)), text_color = TC, bgcolor = VC_D, text_size = TS) table.cell(TTM, 2, 8, tostring(Round(fixnan(t7), 2)), text_color = TC, bgcolor = SC_D, text_size = TS) if (currentTfInMinutes<=7200 and is5D) table.cell(TTM, 0, 9, "5D", text_color = THC, bgcolor = c7200m, text_size = TS) table.cell(TTM, 1, 9, tostring(Round(fixnan(outK10), 0)), text_color = TC, bgcolor = VC_5D, text_size = TS) table.cell(TTM, 2, 9, tostring(Round(fixnan(t10), 2)), text_color = TC, bgcolor = SC_5D, text_size = TS) if (currentTfInMinutes<=10080 and is1W) table.cell(TTM, 0, 10, "W", text_color = THC, bgcolor = c1W, text_size = TS) table.cell(TTM, 1, 10, tostring(Round(fixnan(outK8), 0)), text_color = TC, bgcolor = VC_W, text_size = TS) table.cell(TTM, 2, 10, tostring(Round(fixnan(t8), 2)), text_color = TC, bgcolor = SC_W, text_size = TS) if (currentTfInMinutes<=45000 and is1M) table.cell(TTM, 0, 11, "M", text_color = THC, bgcolor = c1M, text_size = TS) table.cell(TTM, 1, 11, tostring(Round(fixnan(outK9), 0)), text_color = TC, bgcolor = VC_M, text_size = TS) table.cell(TTM, 2, 11, tostring(Round(fixnan(t9), 2)), text_color = TC, bgcolor = SC_M, text_size = TS) // time ticks new_week = change(time("W")) new_day = change(time("D")) new_H = change(time("60")) plotshape (new_week and currentTfInMinutes<10080 ? dotl-20*span : na, color=color.new(color.white,25) , style=shape.arrowup, location=location.absolute, size=size.normal) plotshape (new_day and currentTfInMinutes<1440 ? dotl-15*span : na, color=color.new(color.white,50) , style=shape.arrowup, location=location.absolute, size=size.small) plotshape (new_H and currentTfInMinutes<60 ? dotl-10*span : na, color=color.new(color.white,70) , style=shape.arrowup, location=location.absolute, size=size.tiny)
SweetSweetLucia: OnceADay
https://www.tradingview.com/script/pRgSZROH-SweetSweetLucia-OnceADay/
privatepizza111
https://www.tradingview.com/u/privatepizza111/
12
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © privatepizza111 // a psychological sentiment indicator // Digital Signal Processing // For Crypto: Change the Precision in the gui menu //@version=5 indicator("SweetSweetLucia: 3.0", overlay = false, format=format.price, precision=2) //open transform float open_transform_exponential_stream_one = ta.ema(ta.rma(ta.wma(open[1], length= 5), length= 2), length = 7) float open_transform_exponential_stream_three = ta.ema(ta.rma(ta.wma(open[1], length= 5), length= 2), length = 7) float open_transform_exponential_stream_four = ta.ema(ta.rma(ta.wma(open[1], length= 5), length= 2), length = 7) //close transform float close_transform_exponential_stream_one = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) float close_transform_exponential_stream_two = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) float close_transform_exponential_stream_three = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) float close_transform_exponential_stream_four = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) float close_transform_exponential_stream_five = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) //typical price transform float typical_price_transform_exponential_stream_two = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) float typical_price_transform_exponential_stream_three = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) float typical_price_transform_exponential_stream_four = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) float typical_price_transform_exponential_stream_five = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) float typical_price_transform_exponential_stream_six = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) //instananeous trendline is smooth only float wave_instant_stream_one = ta.sma(ta.rma(ta.wma(hl2[1], length = 5), length = 2), length = 21) float wave_instant_stream_two = ta.sma(ta.rma(ta.wma(hl2[1], length = 5), length = 2), length = 21) float wave_instant_stream_three = ta.sma(ta.rma(ta.wma(hl2[1], length = 5), length = 2), length = 21) //plot the indicator to a new window, with titles plot(series=open_transform_exponential_stream_one, color = color.green, title="Open Transform") plot(series=typical_price_transform_exponential_stream_two, color = color.red, title="Typical Price Transform") plotshape(series = ta.crossover(open_transform_exponential_stream_three, typical_price_transform_exponential_stream_three), title = "Bullish Opening", color= color.green, style=shape.cross, location = location.abovebar) plotshape(series = ta.crossunder(open_transform_exponential_stream_four, typical_price_transform_exponential_stream_four), title = "Bearish Opening", color = color.red, style = shape.cross, location = location.abovebar) plotshape(series = ta.crossover(close_transform_exponential_stream_one, typical_price_transform_exponential_stream_five), title = "Bullish Pivot", color = color.olive, style = shape.square, location = location.belowbar) plotshape(series = ta.crossunder(close_transform_exponential_stream_two, typical_price_transform_exponential_stream_six), title = "Bearish Pivot", color = color.maroon, style = shape.square, location = location.belowbar) plot(series = wave_instant_stream_one, title= "Instant Trend Line", color = color.orange) plotshape(series = ta.crossover(close_transform_exponential_stream_three, wave_instant_stream_two), title = "Close Transform Crossing Trend Upward", color = color.lime, style = shape.circle, location = location.bottom) plotshape(series = ta.crossunder(close_transform_exponential_stream_four, wave_instant_stream_three), title = " Close Transform Crossing Trend Downward", color = color.fuchsia, style = shape.circle, location = location.top) plot(close, title = "Line Graph", color = color.aqua) plot(series = close_transform_exponential_stream_five, color = color.purple, title = "Close Transform")
Titans Empirical Levels
https://www.tradingview.com/script/lyJ0yK1S-Titans-Empirical-Levels/
mmmarsh
https://www.tradingview.com/u/mmmarsh/
43
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © mmmarsh //@version=5 indicator("Empirical Levels", overlay=true, max_lines_count=500, max_boxes_count=500) //Select timeframe TFLong=string(input.timeframe('D',title='Longer Time Frame')) TFMedium=string(input.timeframe('240',title='Medium Time Frame')) //Select pivot sensitivity PivotSenseLong=input.int(9,'Sensitivity Longer TF') PivotSenseMedium=input.int(9,'Sensitivity Medium TF') //Generate data series for longer timeframe O_Long=request.security(syminfo.ticker,TFLong,open) C_Long=request.security(syminfo.ticker,TFLong,close) H_Long=request.security(syminfo.ticker,TFLong,high) L_Long=request.security(syminfo.ticker,TFLong,low) //Generate data series for medium timeframe O_Medium=request.security(syminfo.ticker,TFMedium,open) C_Medium=request.security(syminfo.ticker,TFMedium,close) H_Medium=request.security(syminfo.ticker,TFMedium,high) L_Medium=request.security(syminfo.ticker,TFMedium,low) //Find pivot high PivotHighLong=ta.pivothigh(H_Long,PivotSenseLong,PivotSenseLong) PivotHighMedium=ta.pivothigh(H_Medium,PivotSenseMedium,PivotSenseMedium) //Find pivot low PivotLowLong=ta.pivotlow(L_Long,PivotSenseLong,PivotSenseLong) PivotLowMedium=ta.pivotlow(L_Medium,PivotSenseMedium,PivotSenseMedium) line.new(bar_index - 1, PivotHighLong, bar_index + 200, PivotHighLong, color=color.new(color.blue,50), width=2) line.new(bar_index - 1, PivotHighMedium, bar_index + 200, PivotHighMedium, color=color.new(color.orange,50), width=2) line.new(bar_index - 1, PivotLowLong, bar_index + 200, PivotLowLong, color=color.new(color.blue,50), width=2) line.new(bar_index - 1, PivotLowMedium, bar_index + 200, PivotLowMedium, color=color.new(color.orange,50), width=2)
Elliott Wave 3 Finder
https://www.tradingview.com/script/Hr28hxzL-Elliott-Wave-3-Finder/
StonkSignaler
https://www.tradingview.com/u/StonkSignaler/
655
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // created by Chris Guthrie © StonkSignaler // I have added an input field for uesers to determine the last n bars to consider for highest highs and lowest lows // July 13, 2022 // @version=5 // indicator(title = "Elliott Wave 3 Finder_v2", shorttitle="EW_3_v2") n_bars = input(50, "Consider how many bars?") math_diff = ta.ema(close, 5) - ta.ema(close, 35) myColor = math_diff >= 0 ? color.lime : color.red // Extremes theTop = ta.highest(math_diff, n_bars) == math_diff and math_diff > 0 theBot = ta.lowest(math_diff, n_bars) == math_diff and math_diff < 0 // Plots plot(math_diff, color = myColor, style = plot.style_histogram, linewidth = 3) bgcolor(theTop ? color.new(#87cefa, 50) : na) bgcolor(theBot ? color.new(#ff00ff, 50) : na)
SweetSweetLucia: OnceADay
https://www.tradingview.com/script/vMgvM0KD-SweetSweetLucia-OnceADay/
privatepizza111
https://www.tradingview.com/u/privatepizza111/
15
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © privatepizza111 // a psychological sentiment indicator // Digital Signal Processing // For Crypto: Change the Precision in the gui menu //@version=5 indicator("SweetSweetLucia: 3.0", overlay = false, format=format.price, precision=2) //open transform float open_transform_exponential_stream_one = ta.ema(ta.rma(ta.wma(open[1], length= 5), length= 2), length = 7) float open_transform_exponential_stream_three = ta.ema(ta.rma(ta.wma(open[1], length= 5), length= 2), length = 7) float open_transform_exponential_stream_four = ta.ema(ta.rma(ta.wma(open[1], length= 5), length= 2), length = 7) //close transform float close_transform_exponential_stream_one = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) float close_transform_exponential_stream_two = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) float close_transform_exponential_stream_three = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) float close_transform_exponential_stream_four = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) float close_transform_exponential_stream_five = ta.ema(ta.rma(ta.wma(close[1], length = 5), length = 2), length = 7) //typical price transform float typical_price_transform_exponential_stream_two = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) float typical_price_transform_exponential_stream_three = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) float typical_price_transform_exponential_stream_four = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) float typical_price_transform_exponential_stream_five = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) float typical_price_transform_exponential_stream_six = ta.ema(ta.rma(ta.wma(hlc3[4], length = 7), length = 2), length = 9) //instananeous trendline is smooth only float wave_instant_stream_one = ta.sma(ta.rma(ta.wma(hl2[1], length = 5), length = 2), length = 21) float wave_instant_stream_two = ta.sma(ta.rma(ta.wma(hl2[1], length = 5), length = 2), length = 21) float wave_instant_stream_three = ta.sma(ta.rma(ta.wma(hl2[1], length = 5), length = 2), length = 21) //plot the indicator to a new window, with titles plot(series=open_transform_exponential_stream_one, color = color.green, title="Open Transform") plot(series=typical_price_transform_exponential_stream_two, color = color.red, title="Typical Price Transform") plotshape(series = ta.crossover(open_transform_exponential_stream_three, typical_price_transform_exponential_stream_three), title = "Bullish Opening", color= color.green, style=shape.cross, location = location.abovebar) plotshape(series = ta.crossunder(open_transform_exponential_stream_four, typical_price_transform_exponential_stream_four), title = "Bearish Opening", color = color.red, style = shape.cross, location = location.abovebar) plotshape(series = ta.crossover(close_transform_exponential_stream_one, typical_price_transform_exponential_stream_five), title = "Bullish Pivot", color = color.olive, style = shape.square, location = location.belowbar) plotshape(series = ta.crossunder(close_transform_exponential_stream_two, typical_price_transform_exponential_stream_six), title = "Bearish Pivot", color = color.maroon, style = shape.square, location = location.belowbar) plot(series = wave_instant_stream_one, title= "Instant Trend Line", color = color.orange) plotshape(series = ta.crossover(close_transform_exponential_stream_three, wave_instant_stream_two), title = "Close Transform Crossing Trend Upward", color = color.lime, style = shape.circle, location = location.bottom) plotshape(series = ta.crossunder(close_transform_exponential_stream_four, wave_instant_stream_three), title = " Close Transform Crossing Trend Downward", color = color.fuchsia, style = shape.circle, location = location.top) plot(close, title = "Line Graph", color = color.aqua) plot(series = close_transform_exponential_stream_five, color = color.purple, title = "Close Transform")
Heikin Ashi Volatility Percentile - TraderHalai
https://www.tradingview.com/script/Xpwvf6nM-Heikin-Ashi-Volatility-Percentile-TraderHalai/
TraderHalai
https://www.tradingview.com/u/TraderHalai/
67
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // This Volatility Oscillator was inspired by the legendary Bollinger Band Width Percentile indicator(known as BBWP), written by Caretaker, and made famous by Eric Krown, a famous influencer. // // This script borrows aspects of the BBWP indicator which enables the HAVP oscillator to visually match the look and feel of BBWP and allows similar configuration functions (such as colouring function and alerts) // // The fundamentals of this script are however different to BBWP. Instead of bollinger band width, this script uses a reverse function of heikin ashi close implemented in my Smoothed Heikin Ashi Trend // indicator. This reverse Heikin Ashi close is smoothed using Ehler's SuperSmoother function, which provides very smooth oscillation and earlier signals of volatility tops and bottoms. // From backtesting this on BTCUSD index pair, I have observed comparable performance to BBWP across multiple timeframes when combining with stochastic direction to give a bias // on overall direction. Using parameters I have tested, it performs better on mid term timeframes such as 3h,4h and 6h. BBWP outperforms on 1h and 1d, with lower timeframes being comparable. // The sharper oscillations tend to result in reduced holding time and more frequent trades, which may or may not be desirable, although these can be adjusted using the parameters provided. // This makes it a viable (but not necessarily better) alternative to BBWP, and I would encourage you to try out both oscillators and see which fits your trading style. // Releasing this as open source to allow for the betterment of the communuity and to allow further development, criticism and discussion. // © TraderHalai //@version=5 indicator("Heikin Ashi Volatility Percentile - TraderHalai", " HAVP", overlay=false, format=format.percent, precision=2, max_bars_back = 1000) timeperiod = timeframe.period var string STM = 'Spectrum' var string SLD = 'Solid' var string BGR = 'Blue Green Red' var string BR = 'Blue Red' var string SH1 = "Red ⮀ Green" var string SH2 = "Purple ⮀ Blue" var string SH3 = "Yellow ⮀ DarkGreen" var string SH4 = "White ⮀ Black" var string SH5 = "White ⮀ Blue" var string SH6 = "White ⮀ Red" var string SH7 = "Rainbow" //Inputs i_lookback = input.int (252, "Bars Lookback", minval=10, group='HAVP Calculation Settings') ssfLength = input.int (13, "HAVP Smoothing Length", minval=1, group='HAVP Calculation Settings') i_havp_maType = input.string ("Three-pole Ehlers Smoother", "HAVP Smoothing type", options= ["Two-pole Ehlers Butterworth", "Two-pole Ehlers smoother", "Three-pole Ehlers Butterworth", "Three-pole Ehlers Smoother"], group='HAVP Calculation Settings') i_haCandleType = input.string ("Heikin Ashi", "Heikin Ashi Candle Type", options=["Heikin Ashi", "Heikin Ashi Better"], group='HAVP Calculation Settings') i_roofingOn = input.bool (false, 'High Pass Roofing Filter', inline='1', group='HAVP Calculation Settings') i_roofingPeriod = input.int (192, 'Length', inline='1', group='HAVP Calculation Settings') i_c_havpTyped = input.string ( STM, 'Color Type', options=[STM, SLD], inline='1', group='HAVP Plot Settings') i_c_spctrmType = input.string ( BGR, 'Spectrum', options=[BR, BGR, SH1, SH2, SH3, SH4, SH5, SH6, SH7], inline='1', group='HAVP Plot Settings') i_c_havpsolid = input.color ( #FFFF00, 'Solid', inline='1', group='HAVP Plot Settings') i_havpWidth = input.int ( 2, 'Line Width', minval=1, maxval=4, inline='2', group='HAVP Plot Settings') i_repaint = input.bool (true, "Repaint", inline='2', group='HAVP Plot Settings') i_invert = input.bool (false, "Invert Colors - e2 only") i_ma1On = input.bool ( true, '', inline='1', group='Moving Average Settings') i_ma1Type = input.string ( 'SMA', 'MA 1 Type', options=['SMA', 'EMA', 'VWMA'], inline='1', group='Moving Average Settings') i_c_ma1 = input.color ( #FFFFFF, '', inline='1', group='Moving Average Settings') i_ma1Len = input.int ( 3, 'Length', minval=1, inline='1', group='Moving Average Settings') i_ma2On = input.bool ( false, '', inline='2', group='Moving Average Settings') i_ma2Type = input.string ( 'SMA', 'MA 2 Type', options=['SMA', 'EMA', 'VWMA'], inline='2', group='Moving Average Settings') i_c_ma2 = input.color ( #00FFFF, '', inline='2', group='Moving Average Settings') i_ma2Len = input.int ( 5, 'Length', minval=1, inline='2', group='Moving Average Settings') i_alrtsOn = input.bool ( true, 'Alerts On', group='Visual Alerts') i_upperLevel = input.int ( 98, 'Extreme High', minval=1, inline='1', group='Visual Alerts') i_lowerLevel = input.int ( 2, 'Extreme Low', minval=1, inline='1', group='Visual Alerts') var c_prcntSpctrm1 = array.new_color(na) if barstate.isfirst array.push ( c_prcntSpctrm1, #0000FF ) array.push ( c_prcntSpctrm1, #000AFF ), array.push ( c_prcntSpctrm1, #0014FF ), array.push ( c_prcntSpctrm1, #001FFF ), array.push ( c_prcntSpctrm1, #0029FF ), array.push ( c_prcntSpctrm1, #0033FF ), array.push ( c_prcntSpctrm1, #003DFF ), array.push ( c_prcntSpctrm1, #0047FF ), array.push ( c_prcntSpctrm1, #0052FF ), array.push ( c_prcntSpctrm1, #005CFF ), array.push ( c_prcntSpctrm1, #0066FF ), array.push ( c_prcntSpctrm1, #0070FF ), array.push ( c_prcntSpctrm1, #007AFF ), array.push ( c_prcntSpctrm1, #0085FF ), array.push ( c_prcntSpctrm1, #008FFF ), array.push ( c_prcntSpctrm1, #0099FF ), array.push ( c_prcntSpctrm1, #00A3FF ), array.push ( c_prcntSpctrm1, #00ADFF ), array.push ( c_prcntSpctrm1, #00B8FF ), array.push ( c_prcntSpctrm1, #00C2FF ), array.push ( c_prcntSpctrm1, #00CCFF ), array.push ( c_prcntSpctrm1, #00D6FF ), array.push ( c_prcntSpctrm1, #00E0FF ), array.push ( c_prcntSpctrm1, #00EBFF ), array.push ( c_prcntSpctrm1, #00F5FF ), array.push ( c_prcntSpctrm1, #00FFFF ), array.push ( c_prcntSpctrm1, #00FFF5 ), array.push ( c_prcntSpctrm1, #00FFEB ), array.push ( c_prcntSpctrm1, #00FFE0 ), array.push ( c_prcntSpctrm1, #00FFD6 ), array.push ( c_prcntSpctrm1, #00FFCC ), array.push ( c_prcntSpctrm1, #00FFC2 ), array.push ( c_prcntSpctrm1, #00FFB8 ), array.push ( c_prcntSpctrm1, #00FFAD ), array.push ( c_prcntSpctrm1, #00FFA3 ), array.push ( c_prcntSpctrm1, #00FF99 ), array.push ( c_prcntSpctrm1, #00FF8F ), array.push ( c_prcntSpctrm1, #00FF85 ), array.push ( c_prcntSpctrm1, #00FF7A ), array.push ( c_prcntSpctrm1, #00FF70 ), array.push ( c_prcntSpctrm1, #00FF66 ), array.push ( c_prcntSpctrm1, #00FF5C ), array.push ( c_prcntSpctrm1, #00FF52 ), array.push ( c_prcntSpctrm1, #00FF47 ), array.push ( c_prcntSpctrm1, #00FF3D ), array.push ( c_prcntSpctrm1, #00FF33 ), array.push ( c_prcntSpctrm1, #00FF29 ), array.push ( c_prcntSpctrm1, #00FF1F ), array.push ( c_prcntSpctrm1, #00FF14 ), array.push ( c_prcntSpctrm1, #00FF0A ), array.push ( c_prcntSpctrm1, #00FF00 ), array.push ( c_prcntSpctrm1, #0AFF00 ), array.push ( c_prcntSpctrm1, #14FF00 ), array.push ( c_prcntSpctrm1, #1FFF00 ), array.push ( c_prcntSpctrm1, #29FF00 ), array.push ( c_prcntSpctrm1, #33FF00 ), array.push ( c_prcntSpctrm1, #3DFF00 ), array.push ( c_prcntSpctrm1, #47FF00 ), array.push ( c_prcntSpctrm1, #52FF00 ), array.push ( c_prcntSpctrm1, #5CFF00 ), array.push ( c_prcntSpctrm1, #66FF00 ), array.push ( c_prcntSpctrm1, #70FF00 ), array.push ( c_prcntSpctrm1, #7AFF00 ), array.push ( c_prcntSpctrm1, #85FF00 ), array.push ( c_prcntSpctrm1, #8FFF00 ), array.push ( c_prcntSpctrm1, #99FF00 ), array.push ( c_prcntSpctrm1, #A3FF00 ), array.push ( c_prcntSpctrm1, #ADFF00 ), array.push ( c_prcntSpctrm1, #B8FF00 ), array.push ( c_prcntSpctrm1, #C2FF00 ), array.push ( c_prcntSpctrm1, #CCFF00 ), array.push ( c_prcntSpctrm1, #D6FF00 ), array.push ( c_prcntSpctrm1, #E0FF00 ), array.push ( c_prcntSpctrm1, #EBFF00 ), array.push ( c_prcntSpctrm1, #F5FF00 ), array.push ( c_prcntSpctrm1, #FFFF00 ), array.push ( c_prcntSpctrm1, #FFF500 ), array.push ( c_prcntSpctrm1, #FFEB00 ), array.push ( c_prcntSpctrm1, #FFE000 ), array.push ( c_prcntSpctrm1, #FFD600 ), array.push ( c_prcntSpctrm1, #FFCC00 ), array.push ( c_prcntSpctrm1, #FFC200 ), array.push ( c_prcntSpctrm1, #FFB800 ), array.push ( c_prcntSpctrm1, #FFAD00 ), array.push ( c_prcntSpctrm1, #FFA300 ), array.push ( c_prcntSpctrm1, #FF9900 ), array.push ( c_prcntSpctrm1, #FF8F00 ), array.push ( c_prcntSpctrm1, #FF8500 ), array.push ( c_prcntSpctrm1, #FF7A00 ), array.push ( c_prcntSpctrm1, #FF7000 ), array.push ( c_prcntSpctrm1, #FF6600 ), array.push ( c_prcntSpctrm1, #FF5C00 ), array.push ( c_prcntSpctrm1, #FF5200 ), array.push ( c_prcntSpctrm1, #FF4700 ), array.push ( c_prcntSpctrm1, #FF3D00 ), array.push ( c_prcntSpctrm1, #FF3300 ), array.push ( c_prcntSpctrm1, #FF2900 ), array.push ( c_prcntSpctrm1, #FF1F00 ), array.push ( c_prcntSpctrm1, #FF1400 ), array.push ( c_prcntSpctrm1, #FF0000 ), array.push ( c_prcntSpctrm1, #FF0000 ) var c_prcntSpctrm2 = array.new_color(na) if barstate.isfirst array.push ( c_prcntSpctrm2, #0000FF ) array.push ( c_prcntSpctrm2, #0200FC ), array.push ( c_prcntSpctrm2, #0500F9 ), array.push ( c_prcntSpctrm2, #0700F7 ), array.push ( c_prcntSpctrm2, #0A00F4 ), array.push ( c_prcntSpctrm2, #0C00F2 ), array.push ( c_prcntSpctrm2, #0F00EF ), array.push ( c_prcntSpctrm2, #1100ED ), array.push ( c_prcntSpctrm2, #1400EA ), array.push ( c_prcntSpctrm2, #1600E8 ), array.push ( c_prcntSpctrm2, #1900E5 ), array.push ( c_prcntSpctrm2, #1C00E2 ), array.push ( c_prcntSpctrm2, #1E00E0 ), array.push ( c_prcntSpctrm2, #2100DD ), array.push ( c_prcntSpctrm2, #2300DB ), array.push ( c_prcntSpctrm2, #2600D8 ), array.push ( c_prcntSpctrm2, #2800D6 ), array.push ( c_prcntSpctrm2, #2B00D3 ), array.push ( c_prcntSpctrm2, #2D00D1 ), array.push ( c_prcntSpctrm2, #3000CE ), array.push ( c_prcntSpctrm2, #3300CC ), array.push ( c_prcntSpctrm2, #3500C9 ), array.push ( c_prcntSpctrm2, #3800C6 ), array.push ( c_prcntSpctrm2, #3A00C4 ), array.push ( c_prcntSpctrm2, #3D00C1 ), array.push ( c_prcntSpctrm2, #3F00BF ), array.push ( c_prcntSpctrm2, #4200BC ), array.push ( c_prcntSpctrm2, #4400BA ), array.push ( c_prcntSpctrm2, #4700B7 ), array.push ( c_prcntSpctrm2, #4900B5 ), array.push ( c_prcntSpctrm2, #4C00B2 ), array.push ( c_prcntSpctrm2, #4F00AF ), array.push ( c_prcntSpctrm2, #5100AD ), array.push ( c_prcntSpctrm2, #5400AA ), array.push ( c_prcntSpctrm2, #5600A8 ), array.push ( c_prcntSpctrm2, #5900A5 ), array.push ( c_prcntSpctrm2, #5B00A3 ), array.push ( c_prcntSpctrm2, #5E00A0 ), array.push ( c_prcntSpctrm2, #60009E ), array.push ( c_prcntSpctrm2, #63009B ), array.push ( c_prcntSpctrm2, #660099 ), array.push ( c_prcntSpctrm2, #680096 ), array.push ( c_prcntSpctrm2, #6B0093 ), array.push ( c_prcntSpctrm2, #6D0091 ), array.push ( c_prcntSpctrm2, #70008E ), array.push ( c_prcntSpctrm2, #72008C ), array.push ( c_prcntSpctrm2, #750089 ), array.push ( c_prcntSpctrm2, #770087 ), array.push ( c_prcntSpctrm2, #7A0084 ), array.push ( c_prcntSpctrm2, #7C0082 ), array.push ( c_prcntSpctrm2, #7F007F ), array.push ( c_prcntSpctrm2, #82007C ), array.push ( c_prcntSpctrm2, #84007A ), array.push ( c_prcntSpctrm2, #870077 ), array.push ( c_prcntSpctrm2, #890075 ), array.push ( c_prcntSpctrm2, #8C0072 ), array.push ( c_prcntSpctrm2, #8E0070 ), array.push ( c_prcntSpctrm2, #91006D ), array.push ( c_prcntSpctrm2, #93006B ), array.push ( c_prcntSpctrm2, #960068 ), array.push ( c_prcntSpctrm2, #990066 ), array.push ( c_prcntSpctrm2, #9B0063 ), array.push ( c_prcntSpctrm2, #9E0060 ), array.push ( c_prcntSpctrm2, #A0005E ), array.push ( c_prcntSpctrm2, #A3005B ), array.push ( c_prcntSpctrm2, #A50059 ), array.push ( c_prcntSpctrm2, #A80056 ), array.push ( c_prcntSpctrm2, #AA0054 ), array.push ( c_prcntSpctrm2, #AD0051 ), array.push ( c_prcntSpctrm2, #AF004F ), array.push ( c_prcntSpctrm2, #B2004C ), array.push ( c_prcntSpctrm2, #B50049 ), array.push ( c_prcntSpctrm2, #B70047 ), array.push ( c_prcntSpctrm2, #BA0044 ), array.push ( c_prcntSpctrm2, #BC0042 ), array.push ( c_prcntSpctrm2, #BF003F ), array.push ( c_prcntSpctrm2, #C1003D ), array.push ( c_prcntSpctrm2, #C4003A ), array.push ( c_prcntSpctrm2, #C60038 ), array.push ( c_prcntSpctrm2, #C90035 ), array.push ( c_prcntSpctrm2, #CC0033 ), array.push ( c_prcntSpctrm2, #CE0030 ), array.push ( c_prcntSpctrm2, #D1002D ), array.push ( c_prcntSpctrm2, #D3002B ), array.push ( c_prcntSpctrm2, #D60028 ), array.push ( c_prcntSpctrm2, #D80026 ), array.push ( c_prcntSpctrm2, #DB0023 ), array.push ( c_prcntSpctrm2, #DD0021 ), array.push ( c_prcntSpctrm2, #E0001E ), array.push ( c_prcntSpctrm2, #E2001C ), array.push ( c_prcntSpctrm2, #E50019 ), array.push ( c_prcntSpctrm2, #E80016 ), array.push ( c_prcntSpctrm2, #EA0014 ), array.push ( c_prcntSpctrm2, #ED0011 ), array.push ( c_prcntSpctrm2, #EF000F ), array.push ( c_prcntSpctrm2, #F2000C ), array.push ( c_prcntSpctrm2, #F4000A ), array.push ( c_prcntSpctrm2, #F70007 ), array.push ( c_prcntSpctrm2, #F90005 ), array.push ( c_prcntSpctrm2, #FC0002 ), array.push ( c_prcntSpctrm2, #FF0000 ) // —————————— e2 Color(s) array { var color[] c_gradients = array.new_color(na) // ————— Fill the array with colors only on the first iteration of the script if barstate.isfirst if i_c_spctrmType == SH1 array.push(c_gradients, #ff0000), array.push(c_gradients, #ff2c00), array.push(c_gradients, #fe4200), array.push(c_gradients, #fc5300), array.push(c_gradients, #f96200), array.push(c_gradients, #f57000), array.push(c_gradients, #f07e00), array.push(c_gradients, #ea8a00), array.push(c_gradients, #e39600), array.push(c_gradients, #dca100), array.push(c_gradients, #d3ac00), array.push(c_gradients, #c9b600), array.push(c_gradients, #bfc000), array.push(c_gradients, #b3ca00), array.push(c_gradients, #a6d400), array.push(c_gradients, #97dd00), array.push(c_gradients, #86e600), array.push(c_gradients, #71ee00), array.push(c_gradients, #54f700), array.push(c_gradients, #1eff00) else if i_c_spctrmType == SH2 array.push(c_gradients, #ff00d4), array.push(c_gradients, #f71fda), array.push(c_gradients, #ef2ee0), array.push(c_gradients, #e63ae5), array.push(c_gradients, #de43ea), array.push(c_gradients, #d44bee), array.push(c_gradients, #cb52f2), array.push(c_gradients, #c158f6), array.push(c_gradients, #b75df9), array.push(c_gradients, #ac63fb), array.push(c_gradients, #a267fe), array.push(c_gradients, #966bff), array.push(c_gradients, #8b6fff), array.push(c_gradients, #7e73ff), array.push(c_gradients, #7276ff), array.push(c_gradients, #6479ff), array.push(c_gradients, #557bff), array.push(c_gradients, #437eff), array.push(c_gradients, #2e80ff), array.push(c_gradients, #0082ff) else if i_c_spctrmType == SH3 array.push(c_gradients, #fafa6e), array.push(c_gradients, #e0f470), array.push(c_gradients, #c7ed73), array.push(c_gradients, #aee678), array.push(c_gradients, #97dd7d), array.push(c_gradients, #81d581), array.push(c_gradients, #6bcc86), array.push(c_gradients, #56c28a), array.push(c_gradients, #42b98d), array.push(c_gradients, #2eaf8f), array.push(c_gradients, #18a48f), array.push(c_gradients, #009a8f), array.push(c_gradients, #00908d), array.push(c_gradients, #008589), array.push(c_gradients, #007b84), array.push(c_gradients, #0c707d), array.push(c_gradients, #196676), array.push(c_gradients, #215c6d), array.push(c_gradients, #275263), array.push(c_gradients, #2a4858) else if i_c_spctrmType == SH4 array.push(c_gradients, #ffffff), array.push(c_gradients, #f0f0f0), array.push(c_gradients, #e1e1e1), array.push(c_gradients, #d2d2d2), array.push(c_gradients, #c3c3c3), array.push(c_gradients, #b5b5b5), array.push(c_gradients, #a7a7a7), array.push(c_gradients, #999999), array.push(c_gradients, #8b8b8b), array.push(c_gradients, #7e7e7e), array.push(c_gradients, #707070), array.push(c_gradients, #636363), array.push(c_gradients, #575757), array.push(c_gradients, #4a4a4a), array.push(c_gradients, #3e3e3e), array.push(c_gradients, #333333), array.push(c_gradients, #272727), array.push(c_gradients, #1d1d1d), array.push(c_gradients, #121212), array.push(c_gradients, #000000) else if i_c_spctrmType == SH5 array.push(c_gradients, #ffffff), array.push(c_gradients, #f4f5fa), array.push(c_gradients, #e9ebf5), array.push(c_gradients, #dee1f0), array.push(c_gradients, #d3d7eb), array.push(c_gradients, #c8cde6), array.push(c_gradients, #bdc3e1), array.push(c_gradients, #b2b9dd), array.push(c_gradients, #a7b0d8), array.push(c_gradients, #9ca6d3), array.push(c_gradients, #919dce), array.push(c_gradients, #8594c9), array.push(c_gradients, #7a8bc4), array.push(c_gradients, #6e82bf), array.push(c_gradients, #6279ba), array.push(c_gradients, #5570b5), array.push(c_gradients, #4768b0), array.push(c_gradients, #385fab), array.push(c_gradients, #2557a6), array.push(c_gradients, #004fa1) else if i_c_spctrmType == SH6 array.push(c_gradients, #ffffff), array.push(c_gradients, #fff4f1), array.push(c_gradients, #ffe9e3), array.push(c_gradients, #ffded6), array.push(c_gradients, #ffd3c8), array.push(c_gradients, #fec8bb), array.push(c_gradients, #fdbdae), array.push(c_gradients, #fbb2a1), array.push(c_gradients, #f8a794), array.push(c_gradients, #f69c87), array.push(c_gradients, #f3917b), array.push(c_gradients, #f0856f), array.push(c_gradients, #ec7a62), array.push(c_gradients, #e86e56), array.push(c_gradients, #e4634a), array.push(c_gradients, #df563f), array.push(c_gradients, #db4933), array.push(c_gradients, #d63a27), array.push(c_gradients, #d0291b), array.push(c_gradients, #cb0e0e) else if i_c_spctrmType == SH7 array.push(c_gradients, #E50000), array.push(c_gradients, #E6023B), array.push(c_gradients, #E70579), array.push(c_gradients, #E908B7), array.push(c_gradients, #E00BEA), array.push(c_gradients, #A70DEB), array.push(c_gradients, #6E10ED), array.push(c_gradients, #3613EE), array.push(c_gradients, #162DEF), array.push(c_gradients, #1969F1), array.push(c_gradients, #1CA4F2), array.push(c_gradients, #1FDFF4), array.push(c_gradients, #22F5D2), array.push(c_gradients, #25F69C), array.push(c_gradients, #28F867), array.push(c_gradients, #2CF933), array.push(c_gradients, #5DFA2F), array.push(c_gradients, #96FC32), array.push(c_gradients, #CDFD35), array.push(c_gradients, #FFF938) // Invert colors in array if i_invert array.reverse(c_gradients) // ————— Rescale function // Credits to LucF, https://www.pinecoders.com/faq_and_code/#how-can-i-rescale-an-indicator-from-one-scale-to-another f_rescale(_src, _min, _max) => // Rescales series with known min/max to the color array size. // Dependency : c_gradients array // _src : series to rescale. // _min, _max : min/max values of series to rescale. var int _size = array.size(c_gradients) - 1 int _colorStep = int(_size * (_src - _min)) / int(math.max(_max - _min, 10e-10)) _colorStep := _colorStep > _size ? _size : _colorStep < 0 ? 0 : _colorStep int(_colorStep) // ————— Result // Dependency : c_gradients array f_colGrad(_src, _min, _max) => array.get(c_gradients, f_rescale(_src, _min, _max)) //FUNCTIONS //EHLER Smoothers //Three pole Ehlers Butterworth _3polebuttfilt(src, len)=> a1 = 0., b1 = 0., c1 = 0. coef1 = 0., coef2 = 0., coef3 = 0., coef4 = 0. bttr = 0., trig = 0. a1 := math.exp(-math.pi / len) b1 := 2 * a1 * math.cos(1.738 * math.pi / len) c1 := a1 * a1 coef2 := b1 + c1 coef3 := -(c1 + b1 * c1) coef4 := c1 * c1 coef1 := (1 - b1 + c1) * (1 - c1) / 8 bttr := coef1 * (src + 3 * nz(src[1]) + 3 * nz(src[2]) + nz(src[3])) + coef2 * nz(bttr[1]) + coef3 * nz(bttr[2]) + coef4 * nz(bttr[3]) bttr := bar_index < 4 ? src : bttr trig := nz(bttr[1]) bttr _ssf3(src, length) => arg = math.pi / length a1 = math.exp(-arg) b1 = 2 * a1 * math.cos(1.738 * arg) c1 = math.pow(a1, 2) coef4 = math.pow(c1, 2) coef3 = -(c1 + b1 * c1) coef2 = b1 + c1 coef1 = 1 - coef2 - coef3 - coef4 src1 = nz(src[1], src) src2 = nz(src[2], src1) src3 = nz(src[3], src2) ssf = 0.0 ssf := coef1 * src + coef2 * nz(ssf[1], src1) + coef3 * nz(ssf[2], src2) + coef4 * nz(ssf[3], src3) //Three pole Ehlers smoother _3polesss(src, len)=> a1 = 0., b1 = 0., c1 = 0. coef1 = 0., coef2 = 0., coef3 = 0., coef4 = 0. filt = 0., trig = 0. a1 := math.exp(-math.pi / len) b1 := 2 * a1 * math.cos(1.738 * math.pi / len) c1 := a1 * a1 coef2 := b1 + c1 coef3 := -(c1 + b1 * c1) coef4 := c1 * c1 coef1 := 1 - coef2 - coef3 - coef4 filt := coef1 * src + coef2 * nz(filt[1]) + coef3 * nz(filt[2]) + coef4 * nz(filt[3]) filt := bar_index < 4 ? src : filt trig := nz(filt[1]) filt //Two pole Ehlers Butterworth _2polebutter(src, len)=> a1 = 0., b1 = 0. coef1 = 0., coef2 = 0., coef3 = 0. bttr = 0., trig = 0. a1 := math.exp(-1.414 * math.pi / len) b1 := 2 * a1 * math.cos(1.414 * math.pi / len) coef2 := b1 coef3 := -a1 * a1 coef1 := (1 - b1 + a1 * a1) / 4 bttr := coef1 * (src + 2 * nz(src[1]) + nz(src[2])) + coef2 * nz(bttr[1]) + coef3 * nz(bttr[2]) bttr := bar_index < 3 ? src : bttr trig := nz(bttr[1]) bttr //Two pole Ehlers smoother _2poless(src, len)=> a1 = 0., b1 = 0. coef1 = 0., coef2 = 0., coef3 = 0. filt = 0., trig = 0. a1 := math.exp(-1.414 * math.pi / len) b1 := 2 * a1 * math.cos(1.414 * math.pi / len) coef2 := b1 coef3 := -a1 * a1 coef1 := 1 - coef2 - coef3 filt := coef1 * src + coef2 * nz(filt[1]) + coef3 * nz(filt[2]) filt := bar_index < 3 ? src : filt trig := nz(filt[1]) filt _roofingFilt(src, len)=> alpha1 = 0.00, HP = 0.00 //Highpass filter cyclic components whose periods are shorter than x bars alpha1 := (math.cos(2*math.pi / len) + math.sin(2*math.pi / len) - 1) / math.cos(2*math.pi / len) HP := (1 - alpha1 / 2)*(src - nz(src[1])) + (1 - alpha1)*nz(HP[1]) HP //Other functions f_security(_symbol, _res, _src, _repaint) => request.security(_symbol, _res, _src[_repaint ? 0 : barstate.isrealtime ? 1 : 0])[_repaint ? 0 : barstate.isrealtime ? 0 : 1] f_clrSlct ( _percent, _select, _type, _solid, _array1, _array2 ) => _select == 'Solid' ? _solid : _type == BGR or _type == BR ? array.get ( _type == 'Blue Green Red' ? _array1 : _array2, math.round ( _percent ) ) : f_colGrad(math.round (_percent), 0, 100) f_havpMaType (_price, _len, _type) => _type == 'Three-pole Ehlers Smoother' ? _3polesss(_price, _len) : _type == "Two-pole Ehlers Butterworth" ? _2polebutter(_price, _len) : _type == "Two-pole Ehlers smoother" ? _2poless(_price, _len) : _type == "Three-pole Ehlers Butterworth" ? _3polebuttfilt(_price, _len) : _ssf3(_price, _len) f_maType ( _price, _len, _type ) => _type == 'SMA' ? ta.sma ( _price, _len ) : _type == 'EMA' ? ta.ema ( _price, _len ) : ta.vwma ( _price, _len ) f_delta () => candleClose = f_security(syminfo.tickerid, timeperiod, close, i_repaint) candleOpen = f_security(syminfo.tickerid, timeperiod, open, i_repaint) candleLow = f_security(syminfo.tickerid, timeperiod, low, i_repaint) candleHigh = f_security(syminfo.tickerid, timeperiod, high, i_repaint) haTicker = ticker.heikinashi(syminfo.tickerid) haClose = f_security(haTicker, timeperiod, close, i_repaint) haOpen = f_security(haTicker, timeperiod, open, i_repaint) haLow = f_security(haTicker, timeperiod, low, i_repaint) haHigh= f_security(haTicker, timeperiod, high, i_repaint) reverseClose = (2 * (haOpen[1] + haClose[1])) - candleHigh - candleLow - candleOpen if(reverseClose < candleLow) reverseClose := (candleLow + reverseClose) / 2 if(reverseClose > candleHigh) reverseClose := (candleHigh + reverseClose) / 2 delta = close - reverseClose delta //Heikin Ashi Better Close Delta f_betterDelta() => candleClose = f_security(syminfo.tickerid, timeperiod, close, i_repaint) candleOpen = f_security(syminfo.tickerid, timeperiod, open, i_repaint) candleLow = f_security(syminfo.tickerid, timeperiod, low, i_repaint) candleHigh = f_security(syminfo.tickerid, timeperiod, high, i_repaint) habClose = ((candleOpen + candleClose) /2 ) + ((candleClose - candleOpen)/(candleHigh-candleLow)) * (math.abs(candleClose - candleOpen) / 2) habOpen = 0. habOpen := (nz(habOpen[1]) + habClose[1])/2 //Calculate reverse Better HA close - as this formula uses Square roots, it is possible for non real values to be produced, therefore we need to try all 4 permutations // c = 1/2 (sqrt(-8 a h + 8 a l + h^2 - 2 h l + 8 h o + l^2 - 8 l o) + h - l + 2 o) - Formula sourced from Wolfram Alpha, solving for close price. reverseBetterA = (-math.sqrt(candleHigh - candleLow) * math.sqrt(candleHigh - candleLow + 8 * candleOpen - 8 * habOpen) + candleHigh - candleLow + 2*candleOpen) /2 reverseBetterB = (math.sqrt(candleHigh - candleLow) * math.sqrt(candleHigh - candleLow - 8 * candleOpen + 8 * habOpen) + candleHigh - candleLow + 2*candleOpen) /2 reverseBetterC = (-math.sqrt(candleHigh - candleLow) * math.sqrt(candleHigh - candleLow - 8 * candleOpen + 8 * habOpen) - candleHigh + candleLow + 2*candleOpen) /2 reverseBetterD = (math.sqrt(candleHigh - candleLow) * math.sqrt(candleHigh - candleLow - 8 * candleOpen + 8 * habOpen) - candleHigh + candleLow + 2*candleOpen) /2 //Try reverse reverse function to see which one fits rreverseBetterA = ((candleOpen + reverseBetterA) /2 ) + ((reverseBetterA - candleOpen)/(candleHigh-candleLow)) * (math.abs(reverseBetterA - candleOpen) / 2) rreverseBetterB = ((candleOpen + reverseBetterB) /2 ) + ((reverseBetterB - candleOpen)/(candleHigh-candleLow)) * (math.abs(reverseBetterB - candleOpen) / 2) rreverseBetterC = ((candleOpen + reverseBetterC) /2 ) + ((reverseBetterC - candleOpen)/(candleHigh-candleLow)) * (math.abs(reverseBetterC - candleOpen) / 2) rreverseBetterD = ((candleOpen + reverseBetterD) /2 ) + ((reverseBetterD - candleOpen)/(candleHigh-candleLow)) * (math.abs(reverseBetterD - candleOpen) / 2) float reverseClose = na if(rreverseBetterA == habOpen) reverseClose := reverseBetterA else if(rreverseBetterB == habOpen) reverseClose := reverseBetterB else if(rreverseBetterC == habOpen) reverseClose := reverseBetterC else if(rreverseBetterD == habOpen) reverseClose := reverseBetterD if(reverseClose < candleLow) reverseClose := (candleLow + reverseClose) / 2 if(reverseClose > candleHigh) reverseClose := (candleHigh + reverseClose) / 2 delta = close - reverseClose delta f_haType (_type) => _type == 'Heikin Ashi' ? f_delta() : _type == 'Heikin Ashi Better' ? f_betterDelta() : f_delta() f_havp (_lookbackPeriod, _ssfLength, _type, _haType, _roofing, _roofingPeriod) => _delta = math.abs(f_haType(_haType)) if(_roofing) _delta := _roofingFilt(_delta, _roofingPeriod) _havp = f_havpMaType(_delta,_ssfLength, _type) _havpSum = 0.0 _len = bar_index < _lookbackPeriod ? bar_index : _lookbackPeriod for _i = 1 to _len by 1 _havpSum += ( _havp[_i] > _havp ? 0 : 1 ) _havpSum _return = bar_index >= _ssfLength ? ( _havpSum / _len) * 100 : na _return // calculations havp = f_havp(i_lookback, ssfLength, i_havp_maType, i_haCandleType, i_roofingOn, i_roofingPeriod) c_havp = f_clrSlct ( havp, i_c_havpTyped, i_c_spctrmType, i_c_havpsolid, c_prcntSpctrm1, c_prcntSpctrm2 ) havpMA = i_ma1On ? f_maType ( havp, i_ma1Len, i_ma1Type ) : na havpMA2 = i_ma2On ? f_maType ( havp, i_ma2Len, i_ma2Type ) : na hiAlrtBar = i_alrtsOn and havp >= i_upperLevel ? havp : na loAlrtBar = i_alrtsOn and havp <= i_lowerLevel ? havp : na // plots p_scaleHi = hline ( 100, 'Scale High', #ff0000, hline.style_solid ) p_midLine = hline ( 50, 'Mid-Line', color.silver, hline.style_dashed ) p_scaleLo = hline ( 0, 'Scale Low', #0000ff, hline.style_solid ) p_bbwp = plot ( havp, 'HAVP', c_havp, i_havpWidth, plot.style_line, editable=false ) p_hiAlrt = plot ( hiAlrtBar, 'Extreme Hi', c_havp, 1, plot.style_columns, histbase=0, editable=false ) p_loAlrt = plot ( loAlrtBar, 'Extreme Lo', c_havp, 1, plot.style_columns, histbase=100, editable=false ) p_ma1 = plot ( havpMA, 'MA 1', i_c_ma1, 1, plot.style_line, 0 ) p_ma2 = plot ( havpMA2, 'MA 2', i_c_ma2, 1, plot.style_line, 0 )
Forex Lot Size Calculator
https://www.tradingview.com/script/1DGxRmAb-Forex-Lot-Size-Calculator/
cryptonnnite
https://www.tradingview.com/u/cryptonnnite/
1,128
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © cryptonnnite //@version=5 indicator("Forex Lot Size Calculator", max_bars_back=100, overlay=true, linktoseries=true, scale=scale.none, precision=5, format=format.price) toString(x)=> str.tostring(x) numberToLotSizeFormat(size) => str.format("{0,number,#.##}", size) roundPrice(price) => math.round(price, 5) getTicksForNR(stopLossTickSize, commission, rCount) => stopLossTickSize * rCount + commission * rCount + commission getPriceForNR(entryPrice, stopLossPrice, ticks, mintick) => roundPrice(entryPrice > stopLossPrice ? entryPrice + (ticks * mintick) : entryPrice - (ticks * mintick)) // USER SETTINGS GROUPS PRICE_LEVELS_GROUP = "Entry & SL Price" RISK_MANAGE_GROUP = 'Risk Manager' TABLE_APPEARANCE_GROUP = 'Table appearance' // Price isUserTakeProfit = input.bool(defval = false, title = 'Manual Target Price') isStaticTakeProfit = input.bool(defval = true, title = 'Static Target Prices') isShowOnlyLastProfitTargetLine = input.bool(defval = false, title = 'Show only last profit target line') rewardCount = input.int(defval = 3, title = 'What is your profit target in R', step = 1, minval = 1, maxval = 10) // RISK MANAGER accountSize = input(5000, 'Account Size in $', group=RISK_MANAGE_GROUP) risk = input.float(1, title='Risk in %', group=RISK_MANAGE_GROUP) commission = input.float(3, title='Commission in $', group = RISK_MANAGE_GROUP) entryPrice = roundPrice(input.price(defval = 1.00000, title = 'Entry Price   ', group = PRICE_LEVELS_GROUP, inline= '1', confirm = true)) entryColor = input.color(color.green, title = '', inline= '1', group = PRICE_LEVELS_GROUP) stopLossPrice = roundPrice(input.price(defval = 0.99950, title = 'Stop Price    ', inline= '2', group = PRICE_LEVELS_GROUP, confirm = true)) stopLossColor = input.color(defval = color.red , title = '', inline= '2', group = PRICE_LEVELS_GROUP) takeProfitPrice = roundPrice(input.price(defval = 1.00050, title = 'Target Price  ', inline= '3', group = PRICE_LEVELS_GROUP)) takeColor = input.color(defval = color.blue, title = '', inline= '3', group = PRICE_LEVELS_GROUP) // CALCULATION riskInUSD = int(risk * accountSize / 100) stopLossSize = math.abs(entryPrice - stopLossPrice) stopLossTickSize = int(roundPrice(stopLossSize / syminfo.mintick)) stopLossTickSizeWithCommission = int(stopLossTickSize + commission) lotsWithCommission = riskInUSD / stopLossTickSizeWithCommission takeProfitSize = math.abs(entryPrice - takeProfitPrice) takeProfitTickSize = int(roundPrice(takeProfitSize / syminfo.mintick)) takeProfitInUSD = takeProfitTickSize * lotsWithCommission - commission * lotsWithCommission // Smart Table tabPosI = input.string('top', 'Table Position', ['top', 'middle', 'bottom'], group = TABLE_APPEARANCE_GROUP) textSize = input.string('normal', 'Text Size', ['small', 'tiny', 'normal', 'large'], group=TABLE_APPEARANCE_GROUP) tabCol = input.color(color.new(#5b606b, 0), 'Background', group = TABLE_APPEARANCE_GROUP) textCol = input.color(color.white, 'Text Color', group = TABLE_APPEARANCE_GROUP) borderColor = input.color(color.white, 'Border', group = TABLE_APPEARANCE_GROUP) tabPos = tabPosI == 'top' ? position.top_right : tabPosI == 'bottom' ? position.bottom_right : position.middle_right var smartTable = table.new(position = tabPos, columns = 50, rows = 50, bgcolor = color.new(color.black, 100), frame_color = borderColor, frame_width = 1, border_color = borderColor, border_width = 1) table.cell(smartTable, 0, 0, 'Account Size', text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 1, 'Risk', text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 2, 'Entry', text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 3, 'Stoploss', text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 4, 'SL Tick', text_color=textCol, text_size=textSize, bgcolor=tabCol) if isUserTakeProfit table.cell(smartTable, 0, 5, 'Profit in $', text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 6, 'Lot Size', text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 0, toString(accountSize), text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 1, toString(risk), text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 2, toString(entryPrice), text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 3, toString(stopLossPrice), text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 4, toString(stopLossTickSize), text_color=textCol, text_size=textSize, bgcolor=tabCol) if isUserTakeProfit table.cell(smartTable, 1, 5, numberToLotSizeFormat(takeProfitInUSD), text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 6, numberToLotSizeFormat(lotsWithCommission), text_color=textCol, text_size=textSize, bgcolor=tabCol) var rewardLines = array.new_line() var rewardLabels = array.new_label() if array.size(rewardLines) < rewardCount for i = 1 to rewardCount rewardLine = line.new(bar_index, 0, bar_index+10, 0, extend=extend.left, style=line.style_dotted, color=takeColor) rewardLabel = label.new(bar_index+10, 0, textcolor=takeColor, color= color.new(color.silver, 100), style=label.style_label_left) array.push(rewardLines, rewardLine) array.push(rewardLabels, rewardLabel) var entryLine = line.new (bar_index, 0, bar_index+10, 0, extend=extend.left, style=line.style_dotted, color=entryColor) var stopLossLine = line.new (bar_index, 0, bar_index+10, 0, extend=extend.left, style=line.style_dotted, color=stopLossColor) var entryLineLabel = label.new(bar_index+10, 0, '', textcolor=entryColor, color=color.new(color.silver, 100), style=label.style_label_left) var stopLossLineLabel = label.new(bar_index+10, 0, '', textcolor=stopLossColor, color=color.new(color.silver, 100), style=label.style_label_left) var takeProfitLine = line.new(bar_index, takeProfitPrice, bar_index+10, takeProfitPrice, extend=extend.left, style=line.style_dotted, color=takeColor) var takeProfitLabel = label.new(bar_index+10, takeProfitPrice, 'Target: ' + toString(takeProfitPrice) + ' (' + toString(takeProfitTickSize) + ')', textcolor=takeColor, color=color.new(color.silver, 100), style=label.style_label_left) if barstate.islast // Entry line & label line.set_xy1(entryLine, bar_index, entryPrice) line.set_xy2(entryLine, bar_index + 10, entryPrice) label.set_xy(entryLineLabel, bar_index+10, entryPrice) label.set_text(entryLineLabel, 'Entry: ' + toString(entryPrice)) // Stop loss line & label line.set_xy1(stopLossLine, bar_index, stopLossPrice) line.set_xy2(stopLossLine, bar_index + 10, stopLossPrice) label.set_xy(stopLossLineLabel, bar_index+10, stopLossPrice) label.set_text(stopLossLineLabel, 'Stop: ' + toString(stopLossPrice) + ' (' + toString(stopLossTickSize) + ')') // Take profit line & label line.set_xy1(takeProfitLine, bar_index, takeProfitPrice) line.set_xy2(takeProfitLine, bar_index + 10, takeProfitPrice) label.set_xy(takeProfitLabel, bar_index+10, takeProfitPrice) for i = 1 to rewardCount rewardLine = array.get(rewardLines, i - 1) rewardLabel = array.get(rewardLabels, i - 1) ticks = getTicksForNR(stopLossTickSize, commission, i) price = getPriceForNR(entryPrice, stopLossPrice, ticks, syminfo.mintick) line.set_xy1(rewardLine, bar_index, price) line.set_xy2(rewardLine, bar_index+10, price) label.set_xy(rewardLabel, bar_index+10, price) label.set_text(rewardLabel, toString(i) + 'R: ' + toString(price)) rewardLine if not isStaticTakeProfit for i = 1 to rewardCount rewardLine = array.get(rewardLines, i - 1) rewardLabel = array.get(rewardLabels, i - 1) line.delete(rewardLine) label.delete(rewardLabel) if isShowOnlyLastProfitTargetLine and rewardCount > 1 for i = 1 to rewardCount - 1 rewardLine = array.get(rewardLines, i - 1) rewardLabel = array.get(rewardLabels, i - 1) line.delete(rewardLine) label.delete(rewardLabel) if not isUserTakeProfit line.delete(takeProfitLine) label.delete(takeProfitLabel)
Realtime Volume Analysis Toolbar
https://www.tradingview.com/script/ipT3t1zV-Realtime-Volume-Analysis-Toolbar/
noop-noop
https://www.tradingview.com/u/noop-noop/
1,332
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © noop42 //@version=5 indicator("Realtime Volume Analysis Toolbar", shorttitle="RVAT", overlay=false, max_boxes_count=10000, max_lines_count=500, max_labels_count=500) // Tooltips // Options varip cumulative_vol = 0.0 varip lastPrice = close varip lastVolume = 0.0 varip upvol = 0.0 varip downvol = 0.0 varip ticknumber = 0 if barstate.isrealtime v = ticknumber == 0 ? volume : volume - lastVolume if close > lastPrice //cumulative_vol += v upvol += v else downvol += v delta = upvol - downvol delta_col = delta > 0 ? color.lime : color.red float askv_per = (upvol / (upvol + downvol)) *100 askv_color = askv_per > 50.0 ? color.lime : color.red label.new(bar_index, 4.5, text=str.tostring(volume), style=label.style_none, textcolor=color.white) label.new(bar_index, 3.5, text="↑ "+str.tostring(upvol), style=label.style_none, textcolor=color.lime) label.new(bar_index, 2.5, text="↓ "+str.tostring(downvol), style=label.style_none, textcolor=color.red) label.new(bar_index, 1.5, text="⍙ "+str.tostring(delta), style=label.style_none, textcolor=delta_col) label.new(bar_index, 0.5, text="⇅ "+str.tostring(askv_per, "#.#")+"%", style=label.style_none, textcolor=askv_color) lastVolume := volume lastPrice := close ticknumber += 1 if barstate.isconfirmed lastVolume := 0.0 lastPrice := close cumulative_vol := 0.0 upvol := 0.0 downvol := 0.0 ticknumber := 0 hline(4.25, linestyle=hline.style_solid) hline(3.25, linestyle=hline.style_dotted) hline(2.25, linestyle=hline.style_dotted) hline(1.25, linestyle=hline.style_dotted) hline(0.25, linestyle=hline.style_dotted)
Mexnepal price convert By Np Trader's Pro
https://www.tradingview.com/script/FpDks7oE-Mexnepal-price-convert-By-Np-Trader-s-Pro/
NpTradersPro
https://www.tradingview.com/u/NpTradersPro/
45
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © xclusivefashionwears //@version=5 indicator("Mexnepal price convert By Np Trader's Pro") c = input(32.22, title="conversion value") plotcandle(open * c, high * c, low * c, close * c, title = 'Candelstick setting', color = open < close ? #52ff00 : #ff0000, wickcolor = open < close ? #52ff00 : #ff0000)
Lower TimeFrame Mini Candle[rsu]
https://www.tradingview.com/script/L4PJGvWr/
rsu9
https://www.tradingview.com/u/rsu9/
69
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © rsu9 // 5m and 30m Mini Candle and Support 200MA Crossing Alert //@version=5 indicator("LTF-MiniCandle[rsu]",max_bars_back=500,max_lines_count=500) leftTF=input.timeframe("5", "Lower Time Frame", options=['1', '5', '15','30','60','120','240'],group="Left Window") lefeWindow=input.int(50,"Windows Position, Offset 100 bars from right to left",group="Left Window") LeftTFR=leftTF==timeframe.period?"":leftTF rightTF=input.timeframe('30', "Lower Time Frame", options=['1', '5', '15','30','60','120','240'],group="Right Window") rightWindow=input.int(-10,"Windows Position, push 10 to the right",group="Right Window") RightTFR=rightTF==timeframe.period?"":rightTF if rightTF==timeframe.period lefeWindow:=rightWindow //shorten lower data to 60 shortenData(array1)=> m=60 ret=array.size(array1)>m?array.slice(array1,array.size(array1)-m+1,array.size(array1)-1):array1 // order the Candle shift_left_candles(array1,offest)=> // 3 "for" loops, not to get loop error for x = 0 to (array.size(array1) > 0 ? array.size(array1) - 1 : na) line.set_x1(array.get(array1, x), bar_index - x-offest) line.set_x2(array.get(array1, x), bar_index - x-offest) //Label if timeframe.period!=leftTF s1=label.new(bar_index-lefeWindow-50,high,text="["+str.tostring(LeftTFR)+"]",textcolor=color.new(color.gray,30),style=label.style_none) label.delete(s1[1]) if timeframe.period!=rightTF s2=label.new(bar_index-rightWindow-50,high,text="["+str.tostring(rightTF)+"]",textcolor=color.new(color.gray,30),style=label.style_none) label.delete(s2[1]) //------ //5m //------ close_5m_array=shortenData(request.security_lower_tf(syminfo.tickerid, LeftTFR, close)) open_5m_array=shortenData(request.security_lower_tf(syminfo.tickerid, LeftTFR, open)) high_5m_array=shortenData(request.security_lower_tf(syminfo.tickerid, LeftTFR, high)) low_5m_array=shortenData(request.security_lower_tf(syminfo.tickerid, LeftTFR, low)) ma20_5m_array=shortenData(request.security_lower_tf(syminfo.tickerid, LeftTFR, ta.sma(close,20))) ema20_5m_array=shortenData(request.security_lower_tf(syminfo.tickerid, LeftTFR, ta.ema(close,20))) ma200h_5m_array=shortenData(request.security_lower_tf(syminfo.tickerid, LeftTFR, ta.sma(high,200))) ma200l_5m_array=shortenData(request.security_lower_tf(syminfo.tickerid, LeftTFR, ta.sma(low,200))) var candles_line_5mArray = array.new_line(0) var avg20_line_5mArray = array.new_line(0) var avg200_line_5mArray = array.new_line(0) var float pre200_5m=na kcross200_5m=false // PLOT Candle if array.size(close_5m_array) >0 and leftTF!=timeframe.period // draw/keep candle body for x=0 to array.size(close_5m_array)-1 o=array.get(open_5m_array,x) c=array.get(close_5m_array,x) array.unshift(candles_line_5mArray,line.new(x1 = bar_index-array.size(close_5m_array)-x, y1 = c, x2 = bar_index-array.size(close_5m_array)-x, y2 = o,width = 3,color=c>o?color.green:color.red)) // remove old array elements if array.size(candles_line_5mArray) > 50 line.delete(array.pop(candles_line_5mArray)) o1=array.get(ma20_5m_array,x) c1=array.get(ema20_5m_array,x) array.unshift(avg20_line_5mArray,line.new(x1 = bar_index-array.size(avg20_line_5mArray)-x, y1 = c1, x2 = bar_index-array.size(avg20_line_5mArray)-x, y2 = o1,width = 2,color=color.gray)) // remove old array elements if array.size(avg20_line_5mArray) > 50 line.delete(array.pop(avg20_line_5mArray)) o2=array.get(ma200h_5m_array,x) c2=array.get(ma200l_5m_array,x) array.unshift(avg200_line_5mArray,line.new(x1 = bar_index-array.size(avg200_line_5mArray)-x, y1 = c2, x2 = bar_index-array.size(avg200_line_5mArray)-x, y2 = o2,width = 1,color=c2>=pre200_5m?color.new(color.green,0):color.new(color.red,0))) pre200_5m:=c2 // remove old array elements if array.size(avg200_line_5mArray) > 50 line.delete(array.pop(avg200_line_5mArray)) h=array.get(high_5m_array,x) l=array.get(low_5m_array,x) if (h>o2 and l<o2) or (h>c2 and l<c2) kcross200_5m:=true shift_left_candles(candles_line_5mArray,lefeWindow) shift_left_candles(avg20_line_5mArray,lefeWindow) shift_left_candles(avg200_line_5mArray,lefeWindow) //------ //30m //------ close_30m_array=shortenData(request.security_lower_tf(syminfo.tickerid, RightTFR, close)) open_30m_array=shortenData(request.security_lower_tf(syminfo.tickerid, RightTFR, open)) high_30m_array=shortenData(request.security_lower_tf(syminfo.tickerid, RightTFR, high)) low_30m_array=shortenData(request.security_lower_tf(syminfo.tickerid, RightTFR, low)) ma20_30m_array=shortenData(request.security_lower_tf(syminfo.tickerid, RightTFR, ta.sma(close,20))) ema20_30m_array=shortenData(request.security_lower_tf(syminfo.tickerid, RightTFR, ta.ema(close,20))) ma200h_30m_array=shortenData(request.security_lower_tf(syminfo.tickerid, RightTFR, ta.sma(high,200))) ma200l_30m_array=shortenData(request.security_lower_tf(syminfo.tickerid, RightTFR, ta.sma(low,200))) var candles_line_30mArray = array.new_line(0) var avg20_line_30mArray = array.new_line(0) var avg200_line_30mArray = array.new_line(0) var float pre200_30m=na kcross200_30m=false // PLOT Candle if array.size(close_30m_array) >0 and rightTF!=timeframe.period // draw/keep candle body for x=0 to array.size(close_30m_array)-1 o=array.get(open_30m_array,x) c=array.get(close_30m_array,x) array.unshift(candles_line_30mArray,line.new(x1 = bar_index-array.size(close_30m_array)-x, y1 = c, x2 = bar_index-array.size(close_30m_array)-x, y2 = o,width = 3,color=c>o?color.green:color.red)) // remove old array elements if array.size(candles_line_30mArray) > 50 line.delete(array.pop(candles_line_30mArray)) o1=array.get(ma20_30m_array,x) c1=array.get(ema20_30m_array,x) array.unshift(avg20_line_30mArray,line.new(x1 = bar_index-array.size(avg20_line_30mArray)-x, y1 = c1, x2 = bar_index-array.size(avg20_line_30mArray)-x, y2 = o1,width = 2,color=color.gray)) // remove old array elements if array.size(avg20_line_30mArray) > 50 line.delete(array.pop(avg20_line_30mArray)) o2=array.get(ma200h_30m_array,x) c2=array.get(ma200l_30m_array,x) array.unshift(avg200_line_30mArray,line.new(x1 = bar_index-array.size(avg200_line_30mArray)-x, y1 = c2, x2 = bar_index-array.size(avg200_line_30mArray)-x, y2 = o2,width = 1,color=c2>=pre200_30m?color.new(color.green,0):color.new(color.red,0))) pre200_30m:=c2 // remove old array elements if array.size(avg200_line_30mArray) > 50 line.delete(array.pop(avg200_line_30mArray)) h=array.get(high_30m_array,x) l=array.get(low_30m_array,x) if (h>o2 and l<o2) or (h>c2 and l<c2) kcross200_5m:=true shift_left_candles(candles_line_30mArray,rightWindow) shift_left_candles(avg20_line_30mArray,rightWindow) shift_left_candles(avg200_line_30mArray,rightWindow) //////////// // Alerts // //////////// alertname=syminfo.ticker if kcross200_5m alert(alertname+" 5m k cross 200",alert.freq_once_per_bar) if kcross200_30m alert(alertname+" 30m k cross 200",alert.freq_once_per_bar)
JPY PPL
https://www.tradingview.com/script/HzOv82UW-JPY-PPL/
BogusTrades
https://www.tradingview.com/u/BogusTrades/
69
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ploo31 //@version=4 //this indcator is applicable for JPY Pairs //syminfo : forex - JPY pairs // Psychological Key Levels for JPY pairs. study("PPL", shorttitle="PPL", overlay=true) tick = tickerid(syminfo.prefix, syminfo.ticker, session.regular, adjustment.splits) sintra = input(true, title="Show PPL") col = input(title="Color", type=input.color, defval=color.orange) sty = input(title="Line", type=input.string, options=["Solid", "Dotted", "Dashed"], defval="Solid") lineWidth = input(1, title="Line width", type=input.integer) nbintra = input(3, title="Number of Levels", type=input.integer) //style function style(z) => z=="Dotted"?line.style_dotted:z=="Dashed"?line.style_dashed:line.style_solid //i_srLnColor = input(#4dd0e141, "" , inline = "SR", group = group_support_and_resistance) //i_srLnWidth = input(3 , "" , inline = "SR", group = group_support_and_resistance) //i_srLnStyle = input("Solid" , "", options = ["Dashed", "Dotted", "Solid"], inline = "SR", group = group_support_and_resistance) //tracage des instit 100 pips //ne seront pas affiché sur les daily et au dela (A CODER) step = syminfo.mintick*1000 if barstate.islast and syminfo.type == 'forex' and sintra //label.new(bar_index, low, text=syminfo.type, yloc=yloc.abovebar) for counter = 0 to nbintra - 1 //20 stepUp = ceil(close / step) * step + (counter * step) stepUp20 = stepUp + 0.2 * step line.new(bar_index, stepUp20, bar_index - 1, stepUp20, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty)) stepUp50 = stepUp + 0.5 * step line.new(bar_index, stepUp50, bar_index - 1, stepUp50, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty)) stepUp80 = stepUp + 0.8 * step line.new(bar_index, stepUp80, bar_index - 1, stepUp80, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty)) stepUp100 = stepUp + 1.0 * step line.new(bar_index, stepUp100, bar_index - 1, stepUp100, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty)) stepDown = ceil(close / step) * step - (counter * step) stepDown00 = stepDown + 0.0 * step line.new(bar_index, stepDown00, bar_index - 1, stepDown00, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty)) stepDown20 = stepDown + 0.2 * step line.new(bar_index, stepDown20, bar_index - 1, stepDown20, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty)) stepDown50 = stepDown + 0.5 * step line.new(bar_index, stepDown50, bar_index - 1, stepDown50, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty)) stepDown80 = stepDown + 0.8 * step line.new(bar_index, stepDown80, bar_index - 1, stepDown80, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty)) //label.delete(l[1]) //price_now = security(tick, "D", close)
A_HMS_RSI_COMPOSIT
https://www.tradingview.com/script/a50tbIz4-A-HMS-RSI-COMPOSIT/
morady0hamid
https://www.tradingview.com/u/morady0hamid/
20
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © morady0hamid //@version=4 study(title="A_HMS_RSI_COMPOSIT", overlay=false) ////////////////////////////////////////////////Stochastica/////////////////////////////////// //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // smoothK = input(14, minval=1), smoothD = input(3, minval=1) // k = sma(stoch(close, high, low, smoothK), 3) // d = sma(k, smoothD) // plot(k-80, color=#880e4f ,linewidth=2 , title = "StochK line" ) // plot(d-80, color=#44cccc ,linewidth=2 , title = "StochD line" ) // h0 = hline(0) // h1 = hline(-60) // h2 = hline(-30) // fill(h0, h1, color=color.gray, transp=95) // stochKema = ema(k , 12) // stochKema2 = ema(k , 21) // stochDema = ema(d , 21) // plot(stochKema-80, color=color.orange ,linewidth=2 , transp= 10 , title = "StochKEma line" ) // plot(stochDema-80 , color=#4400cc , transp= 90 , linewidth=1 , title = "StochDEma line") ////////////////////////////////////////////////Stochastica/////////////////////////////////// //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ////////////////////////////////////////////////////////Comporsi//////////////////////////////// //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ len = input(14, title="Length") source= input(hl2 , type = input.source ) mom = input(4, title="Momentum",minval=0) mom20 = input(33 , title="Momentum20",minval=0) ob = input(70,title="Overbought") os = input(30,title="Oversold") c = close //histo docol = input(true,title="Change Color?") dohist = input(true ,title="Show Hist?") //rsi showrsi = input(true , title = "Show RSI?") showrsi2 = input(false , title = "Show RSI2?") showrsiemas = input(false , title = "Show RSI EMAs?") //composit showcomposite = input(true , title = "Show Composite?") showcomposite2 = input(false , title = "Show Composite2?") showcomposignal = input(false , title = "Show Copmposite Signal Line?") //rmi smaLength = input(9 , title = "SMA Length") sigone = input(9,title="Signal One Length") sigtwo = input(33,title="Signal Two Length") showrmi = input(false , title = "Show RMI?") showrmi33 = input(true , title = "Show RMI33?") showemasignal = input(false,title="Show EMA Signal Line?") //calc up = ema(max(c - c[mom],0),len) dn = ema(max(c[mom] - c,0),len) rmi = dn == 0 ? 0 : 100 - 100 / (1 + up / dn) up20 = ema(max(c - c[mom20],0),len) dn20 = ema(max(c[mom20] - c,0),len) rmi20 = dn == 0 ? 0 : 100 - 100 / (1 + up20 / dn20) rmiema = ema(rmi , smaLength) signalone = ema(rmi,sigone) signaltwo = ema(rmi,sigtwo) //Calculate Histogram histogram = dohist ? (rmi - rmiema)+50 : na histup = true ? histogram >=50 : na histdown = true ? histogram <50 : na //Plot histogram plot(histup ? histogram :na , title = "RMIs Histogram UP" , color = color.rgb(68, 168 , 100 , 85) ,histbase=50,style=plot.style_histogram ,linewidth=4 ) plot(histdown ? histogram: na , title = "RMIs Histogram DOWN" , color = color.rgb(166 , 95 , 168 , 85) ,histbase=50,style=plot.style_histogram ,linewidth=4 ) //Second hist // histogram2 = dohist ? ((rmi - 70 ) - (rmiema - 70)) -70 : na // histup2 = true ? histogram >=-20 : na // histdown2 = true ? histogram <-20 : na // plot(histup2 ? histogram :na , title = "RMIs Histogram UP" , color = color.rgb(0, 68 , 0 , 80) ,histbase=50,style=plot.style_histogram ,linewidth=4 ) // plot(histdown2 ? histogram: na , title = "RMIs Histogram DOWN" , color = color.rgb(106 , 1 , 168 , 80) ,histbase=50,style=plot.style_histogram ,linewidth=4 ) //plots //hline(ob) //hline(os) //plot( dohist?(rmi-rmisma)+50:na , color=color.rgb(0, 68, 89 , 58) ,histbase=50,style=plot.style_histogram ,linewidth=3 , title = "RMI's Histogram") //plot( histogram ? color.rgb(0,68,0,50) : color.rgb(255,0,0,50) ,histbase=50,style=plot.style_histogram ,linewidth=3 , title = "RMI's Histogram") plot( showemasignal?signalone:na,color=color.orange , title = "RMI's EMA ONE line") plot( showemasignal?signaltwo:na,color=color.green , title = "RMI's EMA TWO line") col = docol ? rmi > rmi[1] ? color.rgb(148, 13, 194 , 85) : color.rgb(241, 92, 236 , 85) : #0094FF //plot rmi plot(showrmi ? rmi : na , color=col,linewidth=2 , title = "RMI line") plot(showrmi33 ? rmi20/2 + 25 : na , color=col ,linewidth=2 , title = "RMI33 line") /////composite rsi_length=input(14, title="RSI Length") rsi_mom_length=input(9, title="RSI Momentum Length") rsi_ma_length=input(3, title="RSI MA Length") ma_length=input(3, title="SMA Length") fastLength=input(13) slowLength=input(33) r=rsi(source , rsi_length) rsidelta = mom(r, rsi_mom_length) rsisma = sma(rsi(source, rsi_ma_length), ma_length) composit=rsidelta+rsisma compositline = (composit / 2 + 25) greenline = (sma(composit , fastLength) / 2 + 25) redline = (sma(composit , slowLength) / 2 + 25) rsiemasignalone = ema(r , 12) rsiemasignaltwo = ema(r , 66) //Plot Composit plot(showcomposite ? compositline : na , color=color.rgb(254, 0, 1 , 80 ), linewidth=2 , title = "Composite Line" ) //Second composit plot(showcomposite2 ? compositline - 70 : na , color=color.rgb(254, 0, 1), linewidth=2 , title = "Composite Line2 " ) plot(showcomposignal ? greenline -70 : na , color=color.green , transp = 68 , title = "Green Line") plot(showcomposignal ? redline -70 : na , color=color.red , transp = 68 , title = "Red Line") //Plot RSI plot(showrsi ? r : na , color=color.rgb(10, 17, 161) , linewidth=2 , title = "RSI line" ) //Second RSI plot(showrsi2 ? r - 70 : na , color=color.rgb(10 , 0, 0 , 90) ,linewidth=2 , title = "RSI line2" ) plot(showrsiemas ? rsiemasignalone : na , color=color.rgb(255, 100, 0) ,linewidth=2 , title = "RSI EMA ONE" ) plot(showrsiemas ? rsiemasignaltwo : na , color=color.green ,linewidth=1 , title = "RSI EMA TWO" ) //LINES // rmizeroline = hline(0, color=color.rgb(68,0,0,68) , title = "RMI 0 Level" ) //rsiN50 = hline(-50, color=color.rgb(68 , 0 , 0 ,68) , title = "RSI -50 Level" ) //rsiN40 = hline(-40, color=color.rgb(68 , 0 , 0 ,68) , title = "RSI -40 Level" ) //rsiN30 = hline(-30, color=color.rgb(68 , 0 , 0 ,68) , title = "RSI -30 Level" ) rsi0 = hline(0, color=color.rgb(68 , 0 , 0 ,86 ) , title = "RSI 0 Level" ) //rsi10 = hline(-50, color=color.rgb(241,246,242,68) , title = "RSI -50 Level" ) //rsi20 = hline(-10, color=color.rgb(241,246,242,68) , title = "RSI -10 Level" ) //rsi30 = hline(-30, color=color.rgb(241,246,242,68) , title = "RSI -30 Level" ) rsi33 = hline(33.3, color=color.rgb(0, 68, 0 , 86) , title = "RSI 33.3 Level" ) rsiMiddleUpLevel = hline(50,color=color.rgb(70 , 70 ,200 ,68) , title = "RSI50 Middle Up Level") rsiMiddleDownLevel = hline(40, color=color.rgb(70 , 70 ,200 ,86) , title = "RSI42 Middle Down Level") rsi60 = hline(60, color=color.rgb(0 , 0 , 0 ,86) , title = "RSI 60 Level" ) rsi67 = hline(66.67, color=color.rgb(0, 68, 0 , 86) , title = "RSI 66.67 Level" ) // rsi70 = hline(70, color=color.rgb(241,246,242,68) , title = "RSI 70 Level" ) rsi80 = hline(80, color=color.rgb(68 , 0 , 0 ,86), title = "RSI 80 Level" ) rsi85 = hline(85, color=color.rgb(0, 68, 0 , 86) , title = "RSI 85 Level" ) rmihanderedline = hline(100, color=color.rgb(0, 68, 0 , 86) , title = "RMI 100 Level" ) // fill(rsi85 , rsi80 , color=color.rgb(222, 219, 227 , 80) , title = "RSI MIDDLE Level") fill(rsi60 , rsi67 , color=color.rgb(103, 151, 34 , 85) , title = "RSI MIDDLE Level") fill(rsiMiddleDownLevel , rsiMiddleUpLevel, color=color.aqua , transp = 85 , title = "RSI MIDDLE Level") fill(rsi33 , rsiMiddleDownLevel , color=color.rgb(255, 87, 80 , 85) , title = "RSI MIDDLE Level") // fill(rsi20 , rsi15 , color=color.rgb(222, 219, 227 , 80) , title = "RSI MIDDLE Level") ////////////////////////////////////////////////////////Comporsi//////////////////////////////// //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ///////////////////////////////////////////////////////////Lets Lets Lets Go Go Go//////////////////////////////////////////// //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // if you took a trade for every bars close for the duration of the length // how would those trades fair atm? // values closer to (100 | -100) are better for its (bull | bear), closer to 0 will be closer to break eaven. // this indicator is optimal for trending markets. // length = input(100) // avg_length = input(25) // f_compound_risk(_source, _length)=> // _total = 0.0 // _absolute = 0.0 // for _i = 1 to _length // _container0 = _total // _container1 = _absolute // _total := _container0 + (_source[0] - _source[_i]) // _absolute := _container1 + abs(_source[0] - _source[_i]) // if _total > 0 // _container = _total // _total := _total / _absolute // else // _container = _total // _total := 0 - (abs(_container) / _absolute) // _total * 100 // cr = f_compound_risk(close, length) // ma = ema(cr, avg_length) // plot(series=(cr/3)-25, color=#880e4f ,linewidth=2 , title="A1") // plot(series=(ma/3)-25, color=#4400cc ,linewidth=2 , title = "A2") // hline(10) // hline(-25) // hline(-60) ///////////////////////////////////////////////////////////Lets Lets Lets Go Go Go//////////////////////////////////////////// //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Logarithmic Volume Profile
https://www.tradingview.com/script/mV4ur0j6-Logarithmic-Volume-Profile/
SwingSystems
https://www.tradingview.com/u/SwingSystems/
242
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © SwingSystems //@version=5 indicator("My script", overlay=true, max_lines_count = 500) // will use the figure below as the index, so LBP of 252 - 1 = 251. 251 to endCandle of 0 is 252 candles LBP = input.int(252, "VP primary lookback period", 10, 1000, tooltip="The volume of bars within this period will all be given the same weight") - 1 useSecondaryPeriod = input.bool(title="", defval=true, inline = "02") LBPA = input.int(252, "VP secondary (additional) lookback period", 0, 1000, inline = "02", tooltip="Tick to add an additional secondary period, where the impact of secondary bars tapers to nothing from the end to the the start of that period. The volume of the last bar in the secondary period will be weighted the same as bars in the primary period, but this will taper to a weighting of 0 at the start of the period") NOR = input.int(65, "VP number of rows", 2, 200) WOI = input.int(128, "VP width of indicator left", minval=50, inline = "05", tooltip="The larger this number the more accurate (due to rounding the location on x-axis of the lines to the nearest bar)") applyLeftCol1 = input.color(#040042FF, "", inline = "05") applyLeftCol2 = input.color(#55005EFF, "", inline = "05") showRightIndic = input.bool(true, "VP show bull bear to right?", inline = "06") bearColor1 = input.color(#FF0015FF, "", inline = "06") bullColor1 = input.color(#00FF08FF, "", inline = "06") OFLC = input.int(10, "VP offset from last candle", tooltip="Larger values move indicator to the right") VPLW = input.int(4, "VP line width", inline = "08") yBordersOn = input.bool(title="Show ranges", defval=false, inline = "08") yBordersColor = input.color(#00000018, "", inline = "08") averageOpenToOpenChangePC = 0.0 numberInAverageOpenToOpenChangePC = 0 xx = 0 while xx <= 200 if barstate.isfirst != true averageOpenToOpenChangePC := averageOpenToOpenChangePC + math.abs((1 / ohlc4[1]) * ohlc4) numberInAverageOpenToOpenChangePC := numberInAverageOpenToOpenChangePC + 1 xx += 1 candleCount = 0 if barstate.isfirst != true candleCount := candleCount[1] + 1 if barstate.islast == true if (LBP > candleCount) LBP := candleCount LBPA := 0 else if (LBPA + LBP > candleCount) LBPA := candleCount - LBP thisAverageOpenToOpenChangePC = math.abs(1 - (averageOpenToOpenChangePC / numberInAverageOpenToOpenChangePC)) //if barstate.islast // label.new(bar_index + 1, close, str.tostring(thisAverageOpenToOpenChangePC)) ha_open = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open) ha_high = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high) ha_low = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low) ha_close = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) ha_ohlc4 = (ha_open + ha_close + ha_low + ha_high) / 4 graph_ma(_type, _src, _period) => _src2 = close if (_src == "open") _src2 := open else if (_src == "close") _src2 := close else if (_src == "high") _src2 := high else if (_src == "low") _src2 := low else if (_src == "ohlc4") _src2 := ohlc4 else if (_src == "hl2") _src2 := hl2 else if (_src == "hlc3") _src2 := hlc3 else if (_src == "hlcc4") _src2 := hlcc4 else if (_src == "Heikin-Ashi-Close") _src2 := ha_close else if (_src == "Heikin-Ashi-OHLC4") _src2 := ha_ohlc4 _return = (_type == "SMA") ? ta.sma(_src2, _period) : (_type == "EMA") ? ta.ema(_src2, _period) : (_type == "WMA") ? ta.wma(_src2, _period) : (_type == "SMMA") ? ta.rma(_src2, _period) : (_type == "HMA") ? ta.hma(_src2, _period) : (_type == "RMA") ? ta.rma(_src2, _period) : (_type == "ALMA") ? ta.alma(_src2, _period, 0.5, 10) : (_type == "VWMA") ? ta.vwma(_src2, _period) : (_type == "VWAP") ? ta.vwap(_src2) : (_type == "SWMA") ? ta.swma(_src2) : 0.0 // In doubt, return zero _return ma101Plot = input.bool(false, "", inline = "09", group = "Other indicators") ma101Type = input.string(title="", defval="EMA", options=["SMA", "EMA", "WMA", "SMMA", "HMA", "SWMA", "RMA", "ALMA", "VWMA", "VWAP"], inline = "09", group = "Other indicators", tooltip="For ALMA, offset=0.5, sigma=10 and floor=false. RMA and SMMA are the same thing") ma101Source = input.string(title="", defval="Heikin-Ashi-Close", options=["open", "close", "high", "low", "ohlc4", "hl2", "hlc3", "hlcc4", "Heikin-Ashi-Close", "Heikin-Ashi-OHLC4"], inline = "09", group = "Other indicators") ma101Value = input.int(100, "", minval=2, inline = "09", group = "Other indicators") ma101Color = input.color(#00FBFF19, "", inline = "09", group = "Other indicators") if (ma101Plot == false) ma101Color := #00000000 ma101 = graph_ma(ma101Type, ma101Source, ma101Value) ///ma101SmoothVal = input.int(0, "", minval=0, inline = "09", group = "Other indicators") ///ma101Smooth = ma101 ///if ma101SmoothVal >= 2 /// ma101Smooth := ta.sma(ma101, ma101SmoothVal) plot(ma101, color=ma101Color, style=plot.style_areabr) ma102Plot = input.bool(true, "", inline = "10", group = "Other indicators") ma102Type = input.string(title="", defval="SMA", options=["SMA", "EMA", "WMA", "SMMA", "HMA", "SWMA", "RMA", "ALMA", "VWMA", "VWAP"], inline = "10", group = "Other indicators", tooltip="For ALMA, offset=0.5, sigma=10 and floor=false. RMA and SMMA are the same thing") ma102Source = input.string(title="", defval="close", options=["open", "close", "high", "low", "ohlc4", "hl2", "hlc3", "hlcc4", "Heikin-Ashi-Close", "Heikin-Ashi-OHLC4"], inline = "10", group = "Other indicators") ma102Value = input.int(200, "", minval=2, inline = "10", group = "Other indicators") ma102Color = input.color(#0011FFFF, "", inline = "10", group = "Other indicators") if (ma102Plot == false) ma102Color := #00000000 ma102 = graph_ma(ma102Type, ma102Source, ma102Value) plot(ma102, color=ma102Color) ma103Plot = input.bool(true, "", inline = "11", group = "Other indicators") ma103Type = input.string(title="", defval="EMA", options=["SMA", "EMA", "WMA", "SMMA", "HMA", "SWMA", "RMA", "ALMA", "VWMA", "VWAP"], inline = "11", group = "Other indicators", tooltip="For ALMA, offset=0.5, sigma=10 and floor=false. RMA and SMMA are the same thing") ma103Source = input.string(title="", defval="close", options=["open", "close", "high", "low", "ohlc4", "hl2", "hlc3", "hlcc4", "Heikin-Ashi-Close", "Heikin-Ashi-OHLC4"], inline = "11", group = "Other indicators") ma103Value = input.int(50, "", minval=2, inline = "11", group = "Other indicators") ma103Color = input.color(#00FBFF54, "", inline = "11", group = "Other indicators") if (ma103Plot == false) ma103Color := #00000000 ma103 = graph_ma(ma103Type, ma103Source, ma103Value) plot(ma103, color=ma103Color) ma104Plot = input.bool(true, "", inline = "12", group = "Other indicators") ma104Type = input.string(title="", defval="EMA", options=["SMA", "EMA", "WMA", "SMMA", "HMA", "SWMA", "RMA", "ALMA", "VWMA", "VWAP"], inline = "12", group = "Other indicators", tooltip="For ALMA, offset=0.5, sigma=10 and floor=false. RMA and SMMA are the same thing") ma104Source = input.string(title="", defval="close", options=["open", "close", "high", "low", "ohlc4", "hl2", "hlc3", "hlcc4", "Heikin-Ashi-Close", "Heikin-Ashi-OHLC4"], inline = "12", group = "Other indicators") ma104Value = input.int(100, "", minval=2, inline = "12", group = "Other indicators") ma104Color = input.color(#00AAFF68, "", inline = "12", group = "Other indicators") if (ma104Plot == false) ma104Color := #00000000 ma104 = graph_ma(ma104Type, ma104Source, ma104Value) plot(ma104, color=ma104Color) ma105Plot = input.bool(true, "", inline = "13", group = "Other indicators") ma105Type = input.string(title="", defval="EMA", options=["SMA", "EMA", "WMA", "SMMA", "HMA", "SWMA", "RMA", "ALMA", "VWMA", "VWAP"], inline = "13", group = "Other indicators", tooltip="For ALMA, offset=0.5, sigma=10 and floor=false. RMA and SMMA are the same thing") ma105Source = input.string(title="", defval="close", options=["open", "close", "high", "low", "ohlc4", "hl2", "hlc3", "hlcc4", "Heikin-Ashi-Close", "Heikin-Ashi-OHLC4"], inline = "13", group = "Other indicators") ma105Value = input.int(146, "", minval=2, inline = "13", group = "Other indicators") ma105Color = input.color(#0091FFCC, "", inline = "13", group = "Other indicators") if (ma105Plot == false) ma105Color := #00000000 ma105 = graph_ma(ma105Type, ma105Source, ma105Value) plot(ma105, color=ma105Color) plotMACloud = input.bool(false, "5MA Cloud", inline = "14", group = "Other indicators") MACloudLongValue = input.int(100, "", minval=80, step=10, inline = "14", group = "Other indicators") MACloudType = input.string(title="", defval="WMA", options=["SMA", "EMA", "WMA", "SMMA", "HMA", "SWMA", "RMA", "ALMA", "VWMA", "VWAP"], inline = "14", group = "Other indicators", tooltip="For ALMA, offset=0.5, sigma=10 and floor=false. RMA and SMMA are the same thing") MACloudSource = input.string(title="", defval="ohlc4", options=["open", "close", "high", "low", "ohlc4", "hl2", "hlc3", "hlcc4", "Heikin-Ashi-Close", "Heikin-Ashi-OHLC4"], inline = "14", group = "Other indicators") MACloudChannel = input.bool(false) MACloudChannelCol = input.color(#00000018, "", inline = "15", group = "Other indicators") MACloudChannelMultiplier = input.float(6.0, "", minval=0.0, step=0.1, inline = "15", group = "Other indicators") MACloud1 = graph_ma(MACloudType, MACloudSource, math.round(MACloudLongValue)) MACloud2 = graph_ma(MACloudType, MACloudSource, math.round(MACloudLongValue * 0.9)) MACloud3 = graph_ma(MACloudType, MACloudSource, math.round(MACloudLongValue * 0.8)) MACloud4 = graph_ma(MACloudType, MACloudSource, math.round(MACloudLongValue * 0.7)) MACloud5 = graph_ma(MACloudType, MACloudSource, math.round(MACloudLongValue * 0.6)) numberGoingUp = 0 if (MACloud1 > MACloud1[1]) numberGoingUp := numberGoingUp + 1 if (MACloud2 > MACloud2[1]) numberGoingUp := numberGoingUp + 1 if (MACloud3 > MACloud3[1]) numberGoingUp := numberGoingUp + 1 if (MACloud4 > MACloud4[1]) numberGoingUp := numberGoingUp + 1 if (MACloud5 > MACloud5[1]) numberGoingUp := numberGoingUp + 1 MACloudMax = math.max(MACloud1,MACloud2,MACloud3,MACloud4,MACloud5) MACloudMin = math.min(MACloud1,MACloud2,MACloud3,MACloud4,MACloud5) fillTrans = 90 fillBorderTrans = 70 fillCol = color.rgb(0, 0, 0, fillTrans) fillBorder = color.rgb(0, 0, 0, fillBorderTrans) if numberGoingUp == 5 fillCol := color.rgb(0, 255, 0, fillTrans) fillBorder := color.rgb(0, 255, 0, fillBorderTrans) if numberGoingUp == 4 fillCol := color.rgb(102, 255, 0, fillTrans) fillBorder := color.rgb(102, 255, 0, fillBorderTrans) if numberGoingUp == 3 fillCol := color.rgb(204, 255, 0, fillTrans) fillBorder := color.rgb(204, 255, 0, fillBorderTrans) if numberGoingUp == 2 fillCol := color.rgb(255, 204, 0, fillTrans) fillBorder := color.rgb(255, 204, 0, fillBorderTrans) if numberGoingUp == 1 fillCol := color.rgb(255, 102, 0, fillTrans) fillBorder := color.rgb(255, 102, 0, fillBorderTrans) if numberGoingUp == 0 fillCol := color.rgb(255, 0, 0, fillTrans) fillBorder := color.rgb(255, 0, 0, fillBorderTrans) if (plotMACloud == false) fillCol := #00000000 fillBorder := #00000000 channelCol = #00000000 MACloudMaxLine = plot(MACloudMax, color=fillBorder) MACloudMinLine = plot(MACloudMin, color=fillBorder) fill(MACloudMaxLine,MACloudMinLine,fillCol) atrToUse = ta.atr(100) MACloudForChannel = (MACloudMax + MACloudMin) / 2 atrOffset = atrToUse * MACloudChannelMultiplier if MACloudChannel == false MACloudChannelCol := #00000000 atrOffset := 0 plot(MACloudForChannel + atrOffset, color=MACloudChannelCol) plot(MACloudForChannel - atrOffset, color=MACloudChannelCol) ///plot(MACloudForChannel + atrToUse * 10, color=MACloudChannelCol) ///plot(MACloudForChannel - atrToUse * 10, color=MACloudChannelCol) //smoothed30wkEMA1 = ta.wma(ohlc4, 200) //plot(smoothed30wkEMA1, color=#FF9500FF) //smoothed30wkEMA2 = ta.wma(ohlc4, 150) //plot(smoothed30wkEMA2) //smoothed30wkEMA3 = ta.wma(ohlc4, 100) //plot(smoothed30wkEMA3, color=#27003DFF) /////numberAbove = 0 /////totalOutOfPlace = 0 /////thisOutOfPlace = 0 /////jTempVal = 0.0 /////iTempVal = 0.0 ////////var int[] maArray = array.from(200,198,196,194,192,190,188,186,184,182) /////var int[] maArray = array.from(100,120,140,160,180) ///////maArray = [ta.wma(ohlc4, 200),ta.wma(ohlc4, 190),ta.wma(ohlc4, 180),ta.wma(ohlc4, 170),ta.wma(ohlc4, 160),ta.wma(ohlc4, 150),ta.wma(ohlc4, 140),ta.wma(ohlc4, 130),ta.wma(ohlc4, 120),ta.wma(ohlc4, 110)] /////possibleOutcomesSum = 0 /////modifier = -2 /////a = array.size(maArray) /////while a <= array.size(maArray) ///// possibleOutcomesSum := possibleOutcomesSum + a ///// if a == 1 ///// possibleOutcomesSum := possibleOutcomesSum + 1 ///// if (a < 1.5) ///// modifier := +2 ///// a := a + (modifier) /////if barstate.islast == true ///// label.new(bar_index[0], high, str.tostring(possibleOutcomesSum)) ///// /////for i = 0 to array.size(maArray) - 1 ///// numberAbove := 0 ///// for j = 0 to array.size(maArray) - 1 ///// jTempVal := ta.wma(ohlc4, array.get(maArray, j)) ///// iTempVal := ta.wma(ohlc4, array.get(maArray, i)) ///// if jTempVal > iTempVal ///// numberAbove := numberAbove + 1 ///// if i == numberAbove ///// thisOutOfPlace := 0 ///// else if i > numberAbove ///// thisOutOfPlace := i - numberAbove ///// else ///// thisOutOfPlace := numberAbove - i ///// totalOutOfPlace := totalOutOfPlace + thisOutOfPlace /////topLine = 0.0 /////bottomLine = 100000000.0 /////for k = 0 to array.size(maArray) - 1 ///// if ta.wma(ohlc4, array.get(maArray, k)) > topLine ///// topLine := ta.wma(ohlc4, array.get(maArray, k)) ///// if ta.wma(ohlc4, array.get(maArray, k)) < bottomLine ///// bottomLine := ta.wma(ohlc4, array.get(maArray, k)) /////halfMaxOutOfPlace = possibleOutcomesSum / 2 /////top1 = plot(topLine, color=#00000019) /////bot1 = plot(bottomLine, color=#00000019) /////ribbonColor = color.rgb(0.0, 255.0, 0.0, 90) /////if (totalOutOfPlace < halfMaxOutOfPlace) ///// ribbonColor := color.rgb((255.0 / halfMaxOutOfPlace) * totalOutOfPlace, 255.0, 0.0, 90) /////if (totalOutOfPlace == halfMaxOutOfPlace) ///// ribbonColor := color.rgb(255.0, 255.0, 0.0, 90) /////minus25 = totalOutOfPlace - 25 /////minus25Fig = (255.0 / 25.0) * minus25 /////minus25Fig := math.abs(minus25Fig - 255) /////if (minus25Fig < 0.0) ///// minus25Fig := 0.0 /////if (minus25Fig > 255.0) ///// minus25Fig := 255.0 /////if (totalOutOfPlace > halfMaxOutOfPlace) ///// ribbonColor := color.rgb(255.0, minus25Fig, 0.0, 90) /////fill(top1, bot1, ribbonColor) /// endCandle = input.int(0, "End at candle # (0 = last candle)... doesn't work yet", 0, 0) endCandle = 0 startCandle = endCandle + LBP + LBPA if (useSecondaryPeriod == false) LBPA := 0 highestPriceInRange = ta.highest(high, LBP + 1 + LBPA) lowestPriceInRange = ta.lowest(low, LBP + 1 + LBPA) ///atr1 = ta.atr(LBP) thisVolume1 = 0.0 thisVolumeBear = 0.0 thisVolumeBull = 0.0 largestVol = 0.0 volWeight = 0.0 logBase = math.pow((highestPriceInRange / lowestPriceInRange), 1.0 / NOR) leftCol1 = #004CFFFF if (barstate.islast == true) /// dt = time - time[1] largestVol := 0.0 // ascertain what percentage of candle in each range i = 1.0 rangeStart = lowestPriceInRange rangeEnd = lowestPriceInRange * logBase candleHeight = 0.0 pcCandleInThisRange = 0.0 while i <= NOR thisVolume1 := 0.0 j = startCandle candleHeight := 0.0 pcCandleInThisRange := 0.0 while j >= endCandle // calculate percentage of that candle in this range and add that % of volume to thisVolume1 pcCandleInThisRange := 0.0 candleHeight := high[j] - low[j] if (rangeStart <= low[j] and rangeEnd >= high[j]) pcCandleInThisRange := 1 else if (rangeStart <= low[j] and rangeEnd >= low[j] and rangeEnd <= high[j]) pcCandleInThisRange := (1 / candleHeight) * (rangeEnd - low[j]) else if (rangeStart >= low[j] and rangeStart <= high[j] and rangeEnd <= high[j]) belowR = (1 / candleHeight) * (rangeStart - low[j]) aboveR = (1 / candleHeight) * (high[j] - rangeEnd) pcCandleInThisRange := (1 - belowR - aboveR) else if (rangeStart <= high[j] and rangeStart >= low[j] and rangeEnd >= high[j]) pcCandleInThisRange := (1 / candleHeight) * (rangeEnd - high[j]) if (j <= endCandle + LBP) thisVolume1 := thisVolume1 + (pcCandleInThisRange * volume[j]) else volWeight := 1 - (1 / (startCandle - LBP)) * (j - LBP) thisVolume1 := thisVolume1 + (pcCandleInThisRange * volume[j] * volWeight) j := j - 1 if (largestVol < thisVolume1) largestVol := thisVolume1 rangeStart := rangeEnd rangeEnd := rangeEnd * logBase i := i + 1.0 x1 = 0 x2 = 0 x1R = 0 x2R = 0 i := 1.0 midPointForLine = 0.0 rangeStart := lowestPriceInRange rangeEnd := lowestPriceInRange * logBase candleHeight := 0.0 pcCandleInThisRange := 0.0 while i <= NOR thisVolume1 := 0.0 thisVolumeBear := 0.0 thisVolumeBull := 0.0 j = startCandle candleHeight := 0.0 pcCandleInThisRange := 0.0 while j >= endCandle // calculate percentage of that candle in this range and add that % of volume to thisVolume1 pcCandleInThisRange := 0.0 candleHeight := high[j] - low[j] if (rangeStart <= low[j] and rangeEnd >= high[j]) pcCandleInThisRange := 1 else if (rangeStart <= low[j] and rangeEnd >= low[j] and rangeEnd <= high[j]) pcCandleInThisRange := (1 / candleHeight) * (rangeEnd - low[j]) else if (rangeStart >= low[j] and rangeStart <= high[j] and rangeEnd <= high[j]) belowR = (1 / candleHeight) * (rangeStart - low[j]) aboveR = (1 / candleHeight) * (high[j] - rangeEnd) pcCandleInThisRange := (1 - belowR - aboveR) else if (rangeStart <= high[j] and rangeStart >= low[j] and rangeEnd >= high[j]) pcCandleInThisRange := (1 / candleHeight) * (rangeEnd - high[j]) if (j <= endCandle + LBP) thisVolume1 := thisVolume1 + (pcCandleInThisRange * volume[j]) else volWeight := 1 - (1 / (startCandle - LBP)) * (j - LBP) thisVolume1 := thisVolume1 + (pcCandleInThisRange * volume[j] * volWeight) if (showRightIndic == true) if (open[j] > close[j]) // down if (j <= endCandle + LBP) thisVolumeBear := thisVolumeBear + (pcCandleInThisRange * volume[j]) else volWeight := 1 - (1 / (startCandle - LBP)) * (j - LBP) thisVolumeBear := thisVolumeBear + (pcCandleInThisRange * volume[j] * volWeight) if (close[j] > open[j]) // up if (j <= endCandle + LBP) thisVolumeBull := thisVolumeBull + (pcCandleInThisRange * volume[j]) else volWeight := 1 - (1 / (startCandle - LBP)) * (j - LBP) thisVolumeBull := thisVolumeBull + (pcCandleInThisRange * volume[j] * volWeight) j -= 1 midPointForLine := math.pow(rangeStart * rangeEnd, 0.5) ///midPointForLine := rangeStart + ((rangeEnd - rangeStart) / 2) x1 := math.round((WOI + OFLC) - ((WOI / largestVol) * thisVolume1)) x2 := math.round(WOI + OFLC) //dt2 = time - time[1] ///line.new(time + x1 * dt2, midPointForLine, time + x2 * dt2, midPointForLine, xloc = xloc.bar_time, width=VPLW) if (leftCol1 == applyLeftCol1) leftCol1 := applyLeftCol2 else leftCol1 := applyLeftCol1 line.new(bar_index + x1, midPointForLine, bar_index + x2, midPointForLine, width=VPLW, color=leftCol1) if (yBordersOn == true) line.new(bar_index[LBP + LBPA], rangeEnd, bar_index + x2, rangeEnd, width=1, color=yBordersColor, style=line.style_dotted) if (i == 1.0 and yBordersOn == true) line.new(bar_index[LBP + LBPA], rangeStart, bar_index + x2, rangeStart, width=1, color=yBordersColor, style=line.style_dotted) /// line.new(bar_index + x2, rangeStart, bar_index + x2, rangeEnd, width=1, color=#000000FF, style=line.style_dashed) if (showRightIndic == true and thisVolumeBull > thisVolumeBear) x2R := math.round((WOI + OFLC) + ((WOI / largestVol) * (thisVolumeBull - thisVolumeBear))) x1R := math.round(WOI + OFLC) line.new(bar_index + x1R, midPointForLine, bar_index + x2R, midPointForLine, width=VPLW, color=bullColor1) else if (showRightIndic == true and thisVolumeBear > thisVolumeBull) x2R := math.round((WOI + OFLC) + ((WOI / largestVol) * (thisVolumeBear - thisVolumeBull))) x1R := math.round(WOI + OFLC) line.new(bar_index + x1R, midPointForLine, bar_index + x2R, midPointForLine, width=VPLW, color=bearColor1) line.new(bar_index[LBP], low[LBP], bar_index[LBP], high[LBP], extend=extend.both, color=#948FFF37, style=line.style_dashed) if (LBPA > 0) line.new(bar_index[LBP + LBPA], low[LBP + LBPA], bar_index[LBP + LBPA], high[LBP + LBPA], extend=extend.both, color=#948FFF37, style=line.style_dashed) /// l = line.new(time + 5 * dt, high, time + 10 * dt, high, xloc = xloc.bar_time) rangeStart := rangeEnd rangeEnd := rangeEnd * logBase i := i + 1.0
MACD Candle
https://www.tradingview.com/script/OHPnGObN-MACD-Candle/
isyirsyad
https://www.tradingview.com/u/isyirsyad/
86
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © isyirsyad //@version=5 indicator(title="MACD Candle", shorttitle="MACD Candle", overlay=true) // Input fastLength = input(title="Fast Length", defval=12) slowLength = input(title="Slow Length", defval=26) src = input(title="Source", defval=close) signalLength = input.int(title="Signal Smoothing", minval = 1, maxval = 50, defval = 9) // Data reference [macd, signal, hist] = ta.macd(src, fastLength, slowLength, signalLength) // 4 level of green greenHigh = #1B5E20 greenMidHigh = #388E3C greenMidLow = #4CAF50 greenLow = #81C784 // Yellow yellowLow = #FFE0B2 // 4 level of red redHigh = #B71C1C redMidHigh = #D32F2F redMidLow = #F44336 redLow = #E57373 // Default color candleBody = yellowLow // Ranging trend if hist > 0 if hist > hist[1] and hist[1] > 0 candleBody := greenLow if hist < 0 if hist < hist[1] and hist[1] < 0 candleBody := redLow // Bullish trend if macd > 0 and hist > 0 candleBody := greenMidLow if hist > hist[1] and macd[1] > 0 and hist[1] > 0 candleBody := greenMidHigh if hist > hist[2] and macd[2] > 0 and hist[2] > 0 candleBody := greenHigh // Bearish trend if macd < 0 and hist < 0 candleBody := redMidLow if hist < hist[1] and macd[1] < 0 and hist[1] < 0 candleBody := redMidHigh if hist < hist[2] and macd[2] < 0 and hist[2] < 0 candleBody := redHigh barcolor(candleBody) // Include suggestion by Shaheen204
A_HMS_EMAs
https://www.tradingview.com/script/f4iGjUmS-A-HMS-EMAs/
morady0hamid
https://www.tradingview.com/u/morady0hamid/
3
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © morady0hamid //@version=4 study(title="A_HMS_LAST", overlay=true , max_lines_count=500 , max_bars_back=500) ////////////////////////////////pivots/////////////// pvtLenL = input(10,minval=1,title="Length Left") pvtLenR = input(10,minval=1,title="Length Right") ShowPivotLabels = input(false) pvthi = pivothigh(pvtLenL,pvtLenR) pvtlo = pivotlow(pvtLenL,pvtLenR) plotshape(ShowPivotLabels? pvthi[1]: na, title='Pivot High Label', style=shape.triangledown, size = size.tiny ,color = color.red, location=location.abovebar,size=size.auto ,offset=-pvtLenR-1,transp=0) plotshape(ShowPivotLabels? pvtlo[1]: na, title='Pivot Low Label', style=shape.triangleup, size = size.tiny ,color = color.green , location=location.belowbar,size=size.auto , offset=-pvtLenR-1,transp=0) /////////////////////////////////////////////////$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$/////////////////////////// //EMA_Lines__START****************************************************************************************************************** //***************************************************************************************************************************** source = input(type = input.source , defval = ohlc4 , title = "Source:") showema9 = input(true , title = "Show EMA9 Lines ?") showema19 = input(true , title = "Show EMA19 Lines ?") showema33 = input(true , title = "Show ema33 Line ?") showema66 = input(true , title = "Show ema66 Line ?") showema99 = input(true , title = "Show ema99 Line ?") showema199 = input(true , title = "Show ema199 Line ?") show_emas = input(true , title = "Show EMA LineS ?") ema9n = input(title = "EMA9" , type = input.integer , defval = 9) ema19n = input(title = "EMA19" , type = input.integer , defval = 19) ema33n = input(title = "EMA33" , type = input.integer , defval = 33) ema66n = input(title = "EMA66" , type = input.integer , defval = 66) ema99n = input(title = "EMA99" , type = input.integer , defval = 99) ema199n = input(title = "EMA199" , type = input.integer , defval = 199) ema9 = ema(source , ema9n) ema19 = ema(source , ema19n) ema33 = ema(source , ema33n) ema66 = ema(source , ema66n) ema99 = ema(source , ema99n) ema199 = ema(source , ema199n) plot(showema9 and show_emas ? ema9 : na ,color = color.navy , transp=80 , linewidth = 1 , title = "EMA9") plot(showema19 and show_emas ? ema19 : na ,color = color.orange , linewidth = 2 , title = "EMA19") plot(showema33 and show_emas ? ema33 : na , color = color.rgb(59, 113, 115 , 80) , linewidth = 1 , title = "EMA33") plot(showema66 and show_emas ? ema66 : na , color = color.black, linewidth = 1 , title = "EMA66") plot(showema99 and show_emas ? ema99 : na , color = color.aqua, linewidth = 1 , title = "EMA99") plot(showema199 and show_emas ? ema199 : na , color = #9333FF , linewidth = 1, title = "EMA199 ") //High EMAs showema299 = input(true , title = "Show ema299 Line ?") ema299n = input(title = "EMA299" , type = input.integer , defval = 299) ema299 = ema(source , ema299n) plot(showema299 or show_emas ? ema299 : na , color = color.rgb(159, 113, 115 , 85) , linewidth = 1, title = "EMA299 ") showema399 = input(true , title = "Show ema399 Line ?") ema399n = input(title = "EMA399" , type = input.integer , defval = 399) ema399 = ema(source , ema399n) plot(showema399 or show_emas ? ema399 : na , color = color.rgb(159, 113, 115 , 85) , linewidth = 1, title = "EMA399 ") showema499 = input(true , title = "Show ema499 Line ?") ema499n = input(title = "EMA499" , type = input.integer , defval = 499) ema499 = ema(source , ema499n) plot(showema499 or show_emas ? ema499 : na , color = color.rgb(159, 113, 115 , 85) , linewidth = 1, title = "EMA499 ") showema599 = input(true , title = "Show ema599 Line ?") ema599n = input(title = "EMA599" , type = input.integer , defval = 599) ema599 = ema(source , ema599n) plot(showema599 or show_emas ? ema599 : na , color = color.rgb(159, 113, 115, 85) , linewidth = 1, title = "EMA599 ") showema699 = input(true , title = "Show ema699 Line ?") ema699n = input(title = "EMA699" , type = input.integer , defval = 699) ema699 = ema(source , ema699n) plot(showema699 or show_emas ? ema699 : na , color = color.rgb(159, 113, 115, 85) , linewidth = 1, title = "EMA699 ") showema799 = input(true , title = "Show ema799 Line ?") ema799n = input(title = "EMA799" , type = input.integer , defval = 799) ema799 = ema(source , ema799n) plot(showema799 or show_emas ? ema799 : na , color = color.rgb(159, 113, 115, 85) , linewidth = 1, title = "EMA799 ") showema899 = input(true , title = "Show ema899 Line ?") ema899n = input(title = "EMA899" , type = input.integer , defval = 899) ema899 = ema(source , ema899n) plot(showema899 or show_emas ? ema899 : na , color = color.rgb(159, 113, 115, 85) , linewidth = 1, title = "EMA899 ") showema999 = input(true , title = "Show ema999 Line ?") ema999n = input(title = "EMA999" , type = input.integer , defval = 999) ema999 = ema(source , ema999n) plot(showema999 or show_emas ? ema999 : na , color = color.rgb(159, 113, 115, 85) , linewidth = 1, title = "EMA999 ") //EMALines__END**************************************************************************************************************************** //****************************************************************************************************************************************** //EMAStrategy__START**************************************************************************************************************************** //****************************************************************************************************************************************** showemastrateg = input(false , title = "Show EMA Strateg?") ema9s = ema(source , 9) ema19s = ema(source , 19) ema33s = ema(source , 33) ema66s = ema(source , 66) ema199s = ema(source , 199) ///////////////////////CROSSOVERS??????????????????????????????????????????? crossoverpoint1 = (crossover(ema19s , ema66s) and crossover(ema19s , ema199s)) crossoverpoint2 = (crossover(ema9s , ema33s) and crossover(ema9s , ema66s)) crossoverpoint3 = crossover(ema9s , ema33s) and crossover(ema9s , ema66s) and crossover(ema9s , ema199s) crossoverpoint4 = (crossover(ema9s , ema19s) and crossover(ema9s , ema33s) and crossover(ema9s , ema66s)) crossoverpoint5 = (crossover(ema9s , ema19s) and crossover(ema9s , ema33s) and crossover(ema9s , ema66s)) bgcolor(crossoverpoint1 and showemastrateg ? color.blue : na , transp = 50) bgcolor(crossoverpoint2 and showemastrateg ? color.green : na , transp = 50) bgcolor(crossoverpoint3 and showemastrateg ? color.red : na , transp = 50) //bgcolor(crossoverpoint4 and showemastrateg ? color.black : na , transp = 50) //bgcolor(crossoverpoint5 and showemastrateg ? color.purple : na , transp = 50) //////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////CROSSUNDERS??????????????????????????/ crossunderpoint1 = (crossunder(ema19s , ema66s) and crossunder(ema19s , ema199s)) crossunderpoint2 = (crossunder(ema9s , ema33s) and crossunder(ema9s , ema66s)) crossunderpoint3 = (crossunder(ema9s , ema19s) and crossunder(ema9s , ema66s) and crossunder(ema9s , ema199s)) crossunderpoint4 = (crossunder(ema9s , ema19s) and crossunder(ema9s , ema33s) and crossunder(ema9s , ema66s)) crossunderpoint5 = (crossunder(ema9s , ema19s) and crossunder(ema9s , ema33s) and crossunder(ema9s , ema66s)) bgcolor(crossunderpoint1 and showemastrateg ? color.blue : na , transp = 50) bgcolor(crossunderpoint2 and showemastrateg ? color.aqua : na , transp = 50) bgcolor(crossunderpoint3 and showemastrateg ? color.orange : na , transp = 50) //bgcolor(crossunderpoint4 and showemastrateg ? color.lime : na , transp = 50) //bgcolor(crossunderpoint5 and showemastrateg ? color.olive : na , transp = 50) ///////////////////////////////////////////////////////////////////////////////// //EMAStrategy__END**************************************************************************************************************************** //******************************************************************************************************************************************
Reductionism candle chart
https://www.tradingview.com/script/q4KScf7i-Reductionism-candle-chart/
BillionaireLau
https://www.tradingview.com/u/BillionaireLau/
17
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © BillionaireLau //@version=5 indicator("Reductionism candle chart",overlay=true) colorr = input.color(color.blue, "Plot Color") plot(close,style= plot.style_circles, color = colorr ) plot(open,style= plot.style_circles, color = colorr ) plot(high,style= plot.style_circles, color = colorr ) plot(low,style= plot.style_circles, color = colorr ) dir = close - open algo = math.abs(dir) cum_bar_number = ta.barssince(barstate.isfirst) init = cum_bar_number<1?1:cum_bar_number>100?100: cum_bar_number upBound = input(95,title="Volatility boundary of candle") selector = ta.percentile_nearest_rank(algo, init, upBound) colorAA = algo> selector and dir>0? color.green : algo > selector and dir<0? color.red : color.new(color.red, 100) plotcandle(open, high, low, close, title='Title', color = colorAA, wickcolor=color.new(color.red, 100),bordercolor=color.new(color.red, 100))
MA cloud + divergence tension
https://www.tradingview.com/script/BbPqX9yU-MA-cloud-divergence-tension/
dickymoore
https://www.tradingview.com/u/dickymoore/
45
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © dickymoore //@version=5 indicator("MA cloud + divergence tension", overlay=true) length = input.int(title="Length", defval=200, minval=0, maxval=500) // How many bars back are we using for our calculations? sensitivity = input.int(title="Sensitivity", defval=99, minval=0, maxval=100) // How sensitive is this indicator? showCloudProximity = input.bool(title="Show Cloud Proximity", defval=false) simpAverage = ta.sma(close, length) // SMA expoAverage = ta.ema(close, length) // EMA average = math.avg(simpAverage,expoAverage) // THe midpoint between the two moving averages distances = array.new_float(length) // declare an array called distances for i=0 to (length - 1) // look back and set how far from the average is the close price of each candle array.set(distances, i, close[i]>average ? close[i]-average : 0-(close[i]-average)) topDist = array.max(distances) // find the most extreme historic divergence from the average tensionPct = (array.get(distances,0)/topDist)*100 // track how far each price diverges as a percentage of the most extreme case simpLine = plot(simpAverage, color=color.navy) // SMA plot expoLine = plot(expoAverage, color=color.fuchsia) // EMA plot fill(simpLine, expoLine, color.new(color.blue, (100-(((tensionPct/100))*tensionPct))),"MA spread") // fill the space between the two moving averages, and set the transparency based on how extreme is the current divergence maxTension = tensionPct>sensitivity // If we've crossed the sensitivity threshold (the percentage divergence is more than the sensitivity) above = close > average // if we're above the average, it's good to know or not plot((maxTension and not(above)) ? (low*0.9) : na, color = color.new(#0E0E0E, 5), style=plot.style_circles, linewidth = 9) plot((maxTension and not(above)) ? (low*0.9) : na, color = color.new(#FAFeFa, 5), style=plot.style_circles, linewidth = 7) plot((maxTension and not(above)) ? (low*0.9) : na, color = color.new(#0aff0a, 5), style=plot.style_circles, linewidth = 5) plot((maxTension and above) ? (high*1.1) : na, color = color.new(#0E0E0E, 5), style=plot.style_circles, linewidth = 9) plot((maxTension and above) ? (high*1.1) : na, color = color.new(#FAFeFa, 5), style=plot.style_circles, linewidth = 7) plot((maxTension and above) ? (high*1.1) : na, color = color.new(#ff000a, 5), style=plot.style_circles, linewidth = 5) alertcondition(condition=maxTension and not(above), title='MA Extreme Tension below', message="Price at extreme levels below moving averages") alertcondition(condition=maxTension and above, title='MA Extreme Tension above', message="Price at extreme levels above moving averages") sensitiveCloudBottom = simpAverage>expoAverage ? ((expoAverage/100)*sensitivity):((simpAverage/100)*sensitivity) // what's the top of the cloud? sensitiveCloudTop = simpAverage<expoAverage ? expoAverage+(expoAverage/100)*(100-sensitivity):simpAverage+(simpAverage/100)*(100-sensitivity) // what's the bottom of the cloud? plot(not(showCloudProximity) ? na:sensitiveCloudBottom, color=color.red) // define the bottom of the cloud sensitivity range, if we want to plot(not(showCloudProximity) ? na:sensitiveCloudTop, color=color.red) // define the top of the cloud sensitivity range, if we want to lastExtremeCondition = ta.barssince(maxTension) // how many bars since we had max tension? withinCloud = high >= sensitiveCloudBottom and low <= sensitiveCloudTop tensionSet = ta.barssince(maxTension)<ta.barssince(withinCloud) // have we had max tension that's not been released by touching the cloud? tensionReleased = false // let's set the default state of this as false if (tensionSet[1] and withinCloud) // and if we've touched the cloud after having max tension tensionSet := false // unset max tension tensionReleased := true // and confirm we've had the tension released plot((tensionReleased and not(above[1])) ? (sensitiveCloudBottom) : na, color = color.new(#0E0E0E, 5), style=plot.style_circles, linewidth = 9) plot((tensionReleased and not(above[1])) ? (sensitiveCloudBottom) : na, color = color.new(#FAFeFa, 5), style=plot.style_circles, linewidth = 7) plot((tensionReleased and not(above[1])) ? (sensitiveCloudBottom) : na, color = color.new(#30a3ff, 5), style=plot.style_circles, linewidth = 5) plot((tensionReleased and above[1]) ? (sensitiveCloudTop) : na, color = color.new(#0E0E0E, 5), style=plot.style_circles, linewidth = 9) plot((tensionReleased and above[1]) ? (sensitiveCloudTop) : na, color = color.new(#FAFeFa, 5), style=plot.style_circles, linewidth = 7) plot((tensionReleased and above[1]) ? (sensitiveCloudTop) : na, color = color.new(#30a3ff, 5), style=plot.style_circles, linewidth = 5) alertcondition(condition=tensionReleased and not(above), title='MA Extreme Tension below released', message="Price returning from extreme levels below moving averages") alertcondition(condition=tensionReleased and above, title='MA Extreme Tension above released', message="Price returning from extreme levels above moving averages")
2 MA Ratio Can Help with Moving Averages
https://www.tradingview.com/script/LoOvwbyJ-2-MA-Ratio-Can-Help-with-Moving-Averages/
TradeStation
https://www.tradingview.com/broker/TradeStation/
559
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TradeStation //@version=5 //MA types are: // 1 - simple // 2 - exponential // Define the variables indicator(title="2 MA Ratio", shorttitle="2 MA Ratio", overlay=false) fastLength = input(8, title="Fast MA Length") slowLength = input(21, title="Slow MA Length") fastSrc = input(close, title="Fast MA Price Source") slowSrc = input(close, title="Slow MA Price Source") fastMAType = input(2, title="Fast AvgType") slowMAType = input(2, title="Slow AvgType") color plotColor = input.color(color.gray, "Ratio Plot Color") var float fastAvg = 0 var float slowAvg = 0 var float ratio = 0 // Handle user choices if ( fastMAType == 1 ) fastAvg := ta.sma(fastSrc, fastLength) if ( fastMAType == 2 ) fastAvg := ta.ema(fastSrc, fastLength) if ( slowMAType == 1 ) slowAvg := ta.sma(slowSrc, slowLength) if ( fastMAType == 2 ) slowAvg := ta.ema(slowSrc, slowLength) // Perform calculation if (slowAvg != 0) ratio := (fastAvg / slowAvg) - 1 else ratio := 0 //Set the color if ( ratio > 0 ) plotColor := input.color(color.green, "Ratio Plot Color") if ( ratio < 0 ) plotColor := input.color(color.red, "Ratio Plot Color") // Plot the ratio with a zero midline plot(ratio, color=plotColor) plot(0)
Chart gain/loss
https://www.tradingview.com/script/bwzWqRd8-Chart-gain-loss/
xpersiandroid
https://www.tradingview.com/u/xpersiandroid/
28
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © xpersiandroid //@version=5 indicator("Chart gain/loss", "", true) // Save the `open` of the leftmost visible bar. var float chartOpen = na if time == chart.left_visible_bar_time chartOpen := open else if time == chart.right_visible_bar_time // Run the following code on the chart's rightmost visible bar. color arrowColor = close > chartOpen ? color.lime : color.fuchsia // Draw arrow once, then modify it. var line arrow = line.new(na, na, na, na, xloc.bar_time, extend.none, na, line.style_arrow_right, 3) line.set_xy1(arrow, chart.left_visible_bar_time, chartOpen) line.set_xy2(arrow, chart.right_visible_bar_time, close) line.set_color(arrow, arrowColor) // Draw percentage label once, then modify it. var label percentage = label.new(na, na, na, xloc.bar_time, yloc.price, #00000000, label.style_label_down, size = size.huge) int midTime = int(math.avg(chart.left_visible_bar_time, chart.right_visible_bar_time)) label.set_xy(percentage, midTime, math.avg(chartOpen, close)) label.set_text(percentage, str.tostring((close - chartOpen) / chartOpen * 100, format.percent)) label.set_textcolor(percentage, arrowColor)