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
Triple-Angle Trend Signal
https://www.tradingview.com/script/FF8eKJEf-Triple-Angle-Trend-Signal/
mdeacey
https://www.tradingview.com/u/mdeacey/
86
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/ //@version=4 study("Triple-Angle Trend Signal", overlay=true) calcDegree(src, period) => rad2degree = 180 / 3.14159265359 ang = rad2degree * atan((src[0] - src[period]) / atr(period)) ang show = input(true, title="Show Line", group="angles setting") i_anglePriceSrc = input(close, title="Price source", type=input.source, group="angles setting") i_anglePeriod = input(28, minval=1, title="Angle period", group="angles setting") i_showLabel = input(true, title="Show label", group="angles setting") spessore= input(1, title='Line thickness', group="angles setting") colore= input(color.blue, title='Line color', group="angles setting") verde= input(20, title="higher degrees", group="angles setting") colore1= input(#00ff0a, title='color by higher degrees', group="angles setting") rosso= input(-20, title="lower degrees", group="angles setting") colore2= input(#ff0000 , title='color by lower degrees', group="angles setting") colore3= input(color.orange , title='intermediate color between upper and lower grades', group="angles setting") angle = round(calcDegree(i_anglePriceSrc, i_anglePeriod)) cCandle = angle > verde ? colore1 : angle <= verde and angle >= rosso ? colore3 : angle < rosso ? colore2 : colore2 barcolor(cCandle, title = "bar color") line l = na line.delete(l[1]) l := line.new( show ? bar_index[i_anglePeriod] : na, i_anglePriceSrc[i_anglePeriod], bar_index, i_anglePriceSrc, color=colore, width= spessore) if (i_showLabel) label lab = na label.delete(lab[1]) lab := label.new(bar_index[i_anglePeriod], angle < angle[i_anglePeriod] ? high[i_anglePeriod] : low[i_anglePeriod] , text= tostring(angle) + 'Β°', color=cCandle, style= angle < angle[i_anglePeriod] ? label.style_label_down : label.style_label_up ) // angle indicator 2 show2 = input(false, title="Show Line 2", group="angles setting 2") i_anglePriceSrc2 = input(close, title="Price source", type=input.source, group="angles setting 2") i_anglePeriod2 = input(35, minval=1, title="Angle period", group="angles setting 2") i_showLabel2 = input(false, title="Show label", group="angles setting 2") spessore2= input(1, title='Line thickness', group="angles setting 2") colore222= input(color.purple, title='Line color', group="angles setting 2") verde2 = input(20, title="higher degrees", group="angles setting 2") colore12= input(#00ff0a, title='color by higher degrees', group="angles setting 2") rosso2= input(-20, title="lower degrees", group="angles setting 2") colore22= input(#ff0000 , title='color by lower degrees', group="angles setting 2") colore32= input(color.orange , title='intermediate color between upper and lower grades', group="angles setting 2") angle2 = round(calcDegree(i_anglePriceSrc2, i_anglePeriod2)) cCandle2 = angle2 > verde2 ? colore12 : angle2 <= verde2 and angle2 >= rosso2 ? colore32 : angle2 < rosso2 ? colore22 : colore22 line l2 = na line.delete(l2[1]) l2 := line.new( show2 ? bar_index[i_anglePeriod2] : na, i_anglePriceSrc2[i_anglePeriod2], bar_index, i_anglePriceSrc2, color=colore222, width= spessore2) if (i_showLabel2 and show2) label lab2 = na label.delete(lab2[1]) lab2 := label.new(bar_index[i_anglePeriod2], angle2 < angle2[i_anglePeriod2] ? high[i_anglePeriod2] : low[i_anglePeriod2] , text= tostring(angle2) + 'Β°', color=cCandle2, style= angle2 < angle2[i_anglePeriod2] ? label.style_label_down : label.style_label_up ) // angle indicator 3 show3 = input(false, title="Show Line 3", group="angles setting 3") i_anglePriceSrc3 = input(close, title="Price source", type=input.source, group="angles setting 3") i_anglePeriod3 = input(50, minval=1, title="Angle period", group="angles setting 3") i_showLabel3 = input(false, title="Show label", group="angles setting 3") spessore3= input(1, title='Line thickness', group="angles setting 3") colore333= input(color.fuchsia, title='Line color', group="angles setting 3") verde3 = input(20, title="higher degrees", group="angles setting 3") colore13= input(#00ff0a, title='color by higher degrees', group="angles setting 3") rosso3= input(-20, title="lower degrees", group="angles setting 3") colore23= input(#ff0000 , title='color by lower degrees', group="angles setting 3") colore33= input(color.orange , title='intermediate color between upper and lower grades', group="angles setting 3") angle3 = round(calcDegree(i_anglePriceSrc3, i_anglePeriod3)) cCandle3 = angle3 > verde3 ? colore13 : angle3 <= verde3 and angle3 >= rosso3 ? colore33 : angle3 < rosso3 ? colore23 : colore23 line l3 = na line.delete(l3[1]) l3 := line.new( show3 ? bar_index[i_anglePeriod3] : na, i_anglePriceSrc3[i_anglePeriod3], bar_index, i_anglePriceSrc3, color=colore333, width= spessore3) if (i_showLabel3 and show3) label lab3 = na label.delete(lab3[1]) lab3 := label.new(bar_index[i_anglePeriod3], angle3 < angle3[i_anglePeriod3] ? high[i_anglePeriod3] : low[i_anglePeriod3], text= tostring(angle3) + 'Β°', color=cCandle3, style= angle3 < angle3[i_anglePeriod3] ? label.style_label_down : label.style_label_up ) // background sfondo= angle > verde and angle2 > verde2 and angle3 > verde3 ? #00ff0a : angle < rosso and angle2 < rosso2 and angle3 < rosso3 ? #ff0000 : na bgcolor(sfondo) // alerts i_showBottomExtremeAlerts = input(true, title="Alerts bottom extreme", group="alerts") i_bottomExtremeThreshold = input(-70, title="Bottom extreme threshold", group="alerts", minval=-1) i_showTopExtremeAlerts = input(true, title="Alerts top extreme", group="alerts") i_topExtremeThreshold = input(70, title="Top extreme threshold", group="alerts", minval=1) if (i_showBottomExtremeAlerts and crossunder(angle, i_bottomExtremeThreshold)) alert('Bottom extreme cross under: ' + tostring(i_bottomExtremeThreshold), alert.freq_once_per_bar_close ) if (i_showBottomExtremeAlerts and crossover(angle, i_bottomExtremeThreshold)) alert('Bottom extreme cross over: ' + tostring(i_bottomExtremeThreshold), alert.freq_once_per_bar_close ) if (i_showTopExtremeAlerts and crossunder(angle, i_bottomExtremeThreshold)) alert('Top extreme cross under: ' + tostring(i_bottomExtremeThreshold), alert.freq_once_per_bar_close ) if (i_showTopExtremeAlerts and crossover(angle, i_topExtremeThreshold)) alert('Top extreme cross over: ' + tostring(i_topExtremeThreshold), alert.freq_once_per_bar_close )
XBT Price Delta
https://www.tradingview.com/script/NXADwLkA-XBT-Price-Delta/
CryptoCyborgTheReal
https://www.tradingview.com/u/CryptoCyborgTheReal/
45
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/ // Β© bitbox //@version=4 study("XBT Price Delta") cb = security('COINBASE:BTCUSD', '1', close) bybit = security('BYBIT:BTCUSD', '1', close) diff = ((bybit - cb)/cb) * 1000 plot(series=diff, style=plot.style_columns, color = diff >= 0 ? color.red : color.green)
EMA Confirmations & Rejections
https://www.tradingview.com/script/zqWewkHs-EMA-Confirmations-Rejections/
Zuage337
https://www.tradingview.com/u/Zuage337/
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/ // Β© Zuage337 //@version=5 int val = na bool holdingAbove = na bool holdingBelow = na bool holdingAboveEMA = na bool holdingBelowEMA = na indicator("EMA Confirmation Break", timeframe="", overlay = true) x = input.int(5, minval = 1, title="EMA") xEMA = ta.ema(close, x) buy = ta.crossunder(xEMA[1], close[1]) sell = ta.crossover(xEMA[1], close[1]) if (buy) if ((close > close[1]) and (high > high[1])) val := 1 else if (high <= high[1] or (close < xEMA)) holdingAbove := true if (close >= xEMA) holdingAboveEMA := true else if (sell) if ((close < close[1]) and (low < low[1])) val := -1 else if (low >= low[1] or (close > xEMA)) holdingBelow := true if (close <= xEMA) holdingBelowEMA := true //crosses to indicate failed break. Blue = more bullish, Red = more bearish. plotshape(holdingAbove, style=shape.xcross, color=holdingAboveEMA ? color.blue : color.red , location=location.abovebar) plotshape(holdingBelow, style=shape.xcross, color=holdingBelowEMA ? color.red : color.blue, location=location.belowbar) //plots arrows to indicate buy/sell. plotarrow(val, title = "ARROW", colorup = color.green, colordown = color.orange, minheight = 35, maxheight = 35)
Wicked signals
https://www.tradingview.com/script/zKi377ZA-Wicked-signals/
Troptrap
https://www.tradingview.com/u/Troptrap/
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/ // Β© mildSnail31034 //@version=5 indicator("Wicked signals") len = input.int(title="Lookback for wicks",defval=6) lenc = 0 volf = input.bool(title="Volume filter",defval=true) lenvolma = input.int(title="Volume MA",defval=20) volma = ta.ema(volume,lenvolma) usehtf = input.bool(title="Use Higher Timeframe",defval=true) //timeframe helper f_chartTfInMinutes() => float _return = 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) tf = f_chartTfInMinutes() shtf()=> if timeframe.isintraday htf = tf if usehtf and tf<5 htf:=5 if usehtf and tf==5 htf:=15 if usehtf and tf>15 and tf<60 htf:=60 if usehtf and tf>60 and tf<240 htf:=240 if usehtf and tf>=240 and tf<1440 htf:=1440 str.tostring(htf) else timeframe.period phiex = ta.pivothigh(len,lenc) ploex = ta.pivotlow(len,lenc) phi = request.security(syminfo.tickerid,shtf(),phiex) plo = request.security(syminfo.tickerid,shtf(),ploex) htfclose = request.security(syminfo.tickerid,shtf(),close) volcond = volume>volma?true:false volfilter=volf?volcond:true wickup=open>close?high-open:high-close wickdown=open<close?open-low:close-low wicks = wickup>wickdown?wickup:wickdown wicksma=ta.rma(wicks,55) top = phi and phi>phi[1] and wicks>wicksma and volfilter bottom = plo and plo<plo[1] and wicks>wicksma and volfilter bgcolor(top?color.red:na) bgcolor(bottom?color.green:na) // Getting inputs RSI = input.int(title="RSI length",defval=3, minval=1) out = ta.rsi(close,RSI) fast_length = input(title="Fast Length", defval=3) slow_length = input(title="Slow Length", defval=6) src = out signal_length = input.int(title="Signal Smoothing", minval = 1, maxval = 50, defval = 5) sma_source = input.string(title="Oscillator MA Type", defval="EMA", options=["RMA", "EMA"]) sma_signal = input.string(title="Signal Line MA Type", defval="EMA", options=["RMA", "EMA"]) // Plot colors col_macd = input(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD") col_signal = input(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal") 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") // Calculating fast_ma = sma_source == "RMA" ? ta.rma(src, fast_length) : ta.ema(src, fast_length) slow_ma = sma_source == "RMA" ? ta.rma(src, slow_length) : ta.ema(src, slow_length) macd = fast_ma - slow_ma signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length) hist = macd - signal plot(hist, title="Histogram", style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : (hist[1] < hist ? col_grow_below : col_fall_below))) plot(macd, title="MACD", color=col_macd) plot(signal, title="Signal", color=col_signal)
RSI Moving Average Crossovers
https://www.tradingview.com/script/Ma3hCkZe-RSI-Moving-Average-Crossovers/
noop-noop
https://www.tradingview.com/u/noop-noop/
486
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(title="RSI Moving Average Crossovers", shorttitle="RSIMAC", overlay=false) ma(source, length, type) => type == "SMA" ? ta.sma(source, length) : type == "EMA" ? ta.ema(source, length) : type == "SMMA (RMA)" ? ta.rma(source, length) : type == "WMA" ? ta.wma(source, length) : type == "VWMA" ? ta.vwma(source, length) : na // Options fastMA_len = input.int(20, "Fast Moving average Length", group="Moving averages") slowMA_len = input.int(50, "Slow Moving average Length", group="Moving averages") ma_type = input.string("EMA", title="MA Type", inline="MA #1", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Moving averages") ma_source = input.source(close, "MA Source", group="Moving averages") rsi_src = input.source(close, "RSI source", group="RSI") rsi_len = input.int(14, "RSI Length", group="RSI") rsi_ma_len = input.int(20, "Moving Average Length", group="RSI") rsi_ma_type = input.string("SMMA (RMA)", title="RSI MA Type", inline="MA #1", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="RSI") ob_level = input.int(70, "Overbought level", group="RSI") os_level = input.int(30, "Oversold level", group="RSI") show_rsi_crossovers = input.bool(true, "Plot RSI/MA crossovers", group="Options") show_ma_crossovers = input.bool(true, "Plot Trend MA crossovers", group="Options") show_screener = input.bool(true, "Show screener", group="Options") // RSI rsi = ta.rsi(rsi_src, rsi_len) rsi_ma = ma(rsi, rsi_ma_len, rsi_ma_type) // Moving Averages s = ma(ma_source, fastMA_len, ma_type) s2 = ma(ma_source, slowMA_len, ma_type) // Colors uncertain_color=#bababa50 bull_color=#0676cc40 bear_color=#aa000040 bg_bear_trend = #aa000040 bg_bear_correct = #aa000020 bg_bull_trend = #0560f540 bg_bull_correct = #0560f520 up_shape_col=#069ecc down_shape_col=#aa0000 // Conditions bull = s > s2 and close > s2 bear = s < s2 and close < s2 col = (bull or bear) ? (rsi > rsi_ma ? bull_color : bear_color) : uncertain_color // Plots rsilinecol = (bull or bear) ? (rsi > rsi_ma ? #0676cc : color.red): color.black malinecol = (bull or bear) ? (rsi < rsi_ma ? #0676cc : color.red): uncertain_color rsi_line = plot(rsi, color=rsilinecol, title="RSI") ma_line = plot(rsi_ma, color=malinecol, title="RSI MA") fill(rsi_line, ma_line, color=col, title="RSI Moving average fill color") plotshape(show_rsi_crossovers and ta.crossover(rsi, rsi_ma) ? 1 : 0, color=up_shape_col, style=shape.triangleup, location=location.bottom, offset=-1, title="RSI/MA Crossup") plotshape(show_rsi_crossovers and ta.crossunder(rsi, rsi_ma) ? 1 : 0, color=down_shape_col, style=shape.triangledown, location=location.top, offset=-1, title="RSI/MA Crossdown") plotshape(show_ma_crossovers and ta.crossover(s, s2) ? 1 : 0, color=up_shape_col, style=shape.xcross, location=location.bottom, offset=-1, title="MA Crossup") plotshape(show_ma_crossovers and ta.crossunder(s, s2) ? 1 : 0, color=down_shape_col, style=shape.xcross, location=location.top, offset=-1, title="MA Crossdown") // Table Data trend = bull ? "Bullish" : bear ? "Bearish": "Uncertain" rsi_cell_col = rsi > rsi_ma ? bull_color : bear_color rsi_ma_cell_color = rsi < rsi_ma ? bull_color : bear_color trend_cell_col = bull ? bull_color : bear ? bear_color : uncertain_color status = trend != "Uncertain" ? (bull and rsi < rsi_ma and rsi[1] < rsi_ma[1]) or (bear and rsi > rsi_ma and rsi[1] > rsi_ma[1]) ? "Correction" : "Impulse" : trend status_col = trend == "Uncertain" ? uncertain_color : (bull and rsi < rsi_ma) or (bear and rsi > rsi_ma) ? bear_color : bull_color var tbl = table.new(position.bottom_left, 5, 5) if show_screener and barstate.islast table.cell(tbl, 0, 0, "RSI", bgcolor = #cccccc) table.cell(tbl, 1, 0, "RSI MA", bgcolor = #cccccc) table.cell(tbl, 2, 0, "MA Trend", bgcolor = #cccccc) table.cell(tbl, 3, 0, "Status", bgcolor = #cccccc) table.cell(tbl, 0, 1, str.tostring(rsi, "#.##"), bgcolor = rsi_cell_col, text_color=color.white) table.cell(tbl, 1, 1, str.tostring(rsi_ma, "#.##"), bgcolor = rsi_ma_cell_color, text_color=color.white) table.cell(tbl, 2, 1, trend, bgcolor = trend_cell_col, text_color=color.white) table.cell(tbl, 3, 1, status, bgcolor = status_col, text_color=color.white) // Background Color bgcol = (trend == "Bullish" ? (status == "Impulse" ? bg_bull_trend : bg_bull_correct) : trend == "Bearish" ? (status == "Impulse" ? bg_bear_trend : bg_bear_correct) : na) // Overbought & Oversold levels h = hline(ob_level, title="Overbought level", color=color.red) l = hline(os_level, title="Oversold level", color=#0676cc) m = hline(50, title="middle level", color=color.gray) // Fill normal zone with trend color fill(h, l, color=bgcol, title="Trend background color")
republish US sector rrg (Relative Rotation Graph)
https://www.tradingview.com/script/FszOna0N-republish-US-sector-rrg-Relative-Rotation-Graph/
hkorange2007
https://www.tradingview.com/u/hkorange2007/
379
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/ // Β© hkorange2007 //@version=4 study("My Script") period = input(14) getStatus(ticker) => securityClose = security(ticker, timeframe.period, close) spx = security("SPX", timeframe.period, close) rs = 100 * (securityClose / spx) rsr = 101 + ((rs - sma(rs, period)) / stdev(rs, period)) rsrRoc = 100 * ((rsr / rsr[1]) - 1) rsm = 101 + ((rsrRoc - sma(rsrRoc, period)) / stdev(rsrRoc, period)) status = "null" bgcolor = color.white if rsr < 100 and rsm > 100 status := "improving" bgcolor := color.blue else if rsr > 100 and rsm > 100 status := "leading" bgcolor := color.green else if rsr > 100 and rsm < 100 status := "weakening" bgcolor := color.yellow else if rsr < 100 and rsm < 100 status := "lagging" bgcolor := color.red status // [rsrRoc, rsr, rsm, status, bgcolor] var table rrgTtable = table.new(position.bottom_center, 2, 9, frame_color = color.white, bgcolor = color.white, border_width = 1, frame_width = 1, border_color = color.black) table.cell(rrgTtable, 0, 0, "Energy") table.cell(rrgTtable, 1, 0, getStatus("XLE")) table.cell(rrgTtable, 0, 1, "Utilities") table.cell(rrgTtable, 1, 1, getStatus("XLU")) table.cell(rrgTtable, 0, 2, "Industrial") table.cell(rrgTtable, 1, 2, getStatus("XLI")) table.cell(rrgTtable, 0, 3, "Consumer Staples") table.cell(rrgTtable, 1, 3, getStatus("XLP")) table.cell(rrgTtable, 0, 4, "Consumer Discretionary") table.cell(rrgTtable, 1, 4, getStatus("XLY")) table.cell(rrgTtable, 0, 5, "Material") table.cell(rrgTtable, 1, 5, getStatus("XLB")) table.cell(rrgTtable, 0, 6, "Financial") table.cell(rrgTtable, 1, 6, getStatus("XLF")) table.cell(rrgTtable, 0, 7, "Health Care") table.cell(rrgTtable, 1, 7, getStatus("XLV")) table.cell(rrgTtable, 0, 8, "Technology") table.cell(rrgTtable, 1, 8, getStatus("XLK"))
GREEN MILE & RED SKY by Onur
https://www.tradingview.com/script/8tXs7jrO-GREEN-MILE-RED-SKY-by-Onur/
SenatorVonShaft
https://www.tradingview.com/u/SenatorVonShaft/
188
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/ // Β© onurenginogutcu //@version=4 study("GREEN MILE & RED SKY by Onur" , overlay = true) i = input(title="Periyod", type=input.integer, defval=1500, minval=10, maxval=3500) /////////////////////////calculating fibo levels up = highest (high , i) down = lowest (low , i) up1 = down + ((up - down) * 0.382) up2 = down + ((up - down) * 0.236) up3 = down + ((up - down) * 0.786) up4 = down + ((up - down) * 0.618) middle = down + ((up - down) * 0.5) ////////////////////////////labeling all fibo levels and buy/sell alert dt = time - time[1] if barstate.islast label.new(time + 3*dt, up, text = tostring (up), textcolor=color.new(color.blue,60), style=label.style_none, xloc=xloc.bar_time) label.new(time + 3*dt, up4,text = tostring (up4), textcolor=color.new(color.blue,60), style=label.style_none, xloc=xloc.bar_time) label.new(time + 3*dt, up3,text = tostring (up3), textcolor=color.new(color.blue,60), style=label.style_none, xloc=xloc.bar_time) label.new(time + 3*dt, up2,text = tostring (up2), textcolor=color.new(color.blue,60), style=label.style_none, xloc=xloc.bar_time) label.new(time + 3*dt, up1,text = tostring (up1), textcolor=color.new(color.blue,60), style=label.style_none, xloc=xloc.bar_time) label.new(time + 3*dt, down,text = tostring (down), textcolor=color.new(color.blue,60), style=label.style_none, xloc=xloc.bar_time) if close > up3 label.new(time + 3*dt, close, text = "STRONG SELL AREA", textcolor=color.new(color.red,30), style=label.style_none, xloc=xloc.bar_time) if close > up4 if close <= up3 label.new(time + 3*dt, close, text = "SELL AREA", textcolor=color.new(color.red,30), style=label.style_none, xloc=xloc.bar_time) if close >= down if close < up2 label.new(time + 3*dt, close, text = "STRONG BUY AREA", textcolor=color.new(color.green,30), style=label.style_none, xloc=xloc.bar_time) if close >= up2 if close < up1 label.new(time + 3*dt, close, text = "BUY AREA", textcolor=color.new(color.green,30), style=label.style_none, xloc=xloc.bar_time) ///////plotting buying levels of fibonacci a = plot(up1 , color = color.new(color.green,0) ) b = plot(up2 , color = color.new(color.green,0) ) c = plot(down , color = color.new(color.green, 0) ) ////////plotting %50 level of fibo g = plot(middle , color = color.new(color.gray,0) ) //////plotting selling levels of fibonacci d = plot(up3 , color = color.new(color.red,0) ) e = plot(up4 , color = color.new(color.red,0) ) f = plot(up , color = color.new(color.red, 0) ) //////////colouring area of buying levels fill(a, b, color = color.new(color.green,95)) fill(b, c, color = color.new(color.green,75)) ////////colouring area of selling levels fill(f, d, color = color.new(color.red,75)) fill(e, d, color = color.new(color.red,95))
Dip Buyer
https://www.tradingview.com/script/DctiSpr9-Dip-Buyer/
jumpr
https://www.tradingview.com/u/jumpr/
54
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/ // Β© jumpr // This was created for a friend and only has SPY in mind. // This indicator gives signals based on the previous All-Time High // Default values are Watch Signal: 4% from ATH, Buy Signal: 5% from ATH and Stop Loss: 13% from ATH // All values are configurable //@version=5 indicator('Dip Buyer', 'Dip Buyer', overlay=true) // input AthL = input.int(title='All-time-high period', defval=30, minval=0, maxval=365) WatchSignal = input.int(title='Watch Signal (% Down from ATH)', defval=4, minval=0, maxval=100) BuySignal = input.int(title='Buy Signal (% Down from ATH)', defval=5, minval=0, maxval=100) SLSignal = input.int(title='Stop-Loss Signal (% Down from ATH)', defval=13, minval=0, maxval=100) hiHighs = ta.highest(high, AthL) watch = hiHighs * (100 - WatchSignal) / 100 buy = hiHighs * (100 - BuySignal) / 100 stoploss = hiHighs * (100 - SLSignal) / 100 // Plot values on the chart plot(series=hiHighs, color=color.new(color.maroon, 100), linewidth=2) plot(series=watch, color=color.new(color.yellow, 100), linewidth=2) plot(series=buy, color=color.new(color.green, 25), linewidth=2) plot(series=stoploss, color=color.new(color.red, 25), linewidth=2) plotshape(ta.crossunder(low,watch), 'long', location=location.belowbar, color=color.new(color.yellow, transp=70), style=shape.triangleup, size=size.small) plotshape(ta.crossunder(low,buy), 'long', location=location.belowbar, color=color.new(color.green, 0), style=shape.triangleup, size=size.small) plotshape(ta.crossunder(low,stoploss), 'short', location=location.abovebar, color=color.new(color.red, transp=70), style=shape.triangledown, size=size.small)
Market Breadth EMAs V2
https://www.tradingview.com/script/Kckloq7F-Market-Breadth-EMAs-V2/
OverexposedPhotoOfADress
https://www.tradingview.com/u/OverexposedPhotoOfADress/
140
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/ // Β© OverexposedPhotoOfADress //@version=5 indicator("Market Breadth EMAs", overlay=false) s20 = request.security("S5TW", "D", ohlc4) // 20 Day s50 = request.security("S5FI", "D", ohlc4) // 50 Day s100 = request.security("S5OH", "D", ohlc4) // 100 Day s200 = request.security("S5TH", "D", ohlc4) // 200 Day //Reversal areas for the "% above 20 EMA" h1 = hline(0, color=color.new(color.white,100)) h2 = hline(2, color=color.new(color.white,100)) h3 = hline(14, color=color.new(color.white,100)) h4 = hline(21, color=color.new(color.white,100)) h5 = hline(33, color=color.new(color.white,100)) h6 = hline(70, color=color.new(color.white,100)) h7 = hline(78, color=color.new(color.white,100)) h8 = hline(85, color=color.new(color.white,100)) h9 = hline(95, color=color.new(color.white,100)) h10 = hline(100, color=color.new(color.white,100)) h11 = hline(49.5, color=color.new(color.white,100)) h12 = hline(50.5, color=color.new(color.white,100)) //Color background for reversal areas fill(h1, h5, color=color.new(color.lime,95)) fill(h1, h4, color=color.new(color.lime,95)) fill(h1, h3, color=color.new(color.lime,95)) fill(h1, h2, color=color.new(color.lime,95)) fill(h6, h10, color=color.new(color.red,95)) fill(h7, h10, color=color.new(color.red,95)) fill(h8, h10, color=color.new(color.red,95)) fill(h9, h10, color=color.new(color.red,95)) fill(h11, h12, color=color.new(color.white,75)) hs = (s20 - s20[3])/5 + (s50 - s50[3])/2 +(s100 - s100[3]) + (s200 - s200[3])*2 + 50 avg= s20/5 + s50/2 + s100 + s200*2 //Histogram, strength of the General breadth change (white line) in different timeframes havg1 = (avg - avg[1]) + 50 hcolor1 = havg1 > 50 ? color.new(color.green,80) : color.new(color.red,80) plot(havg1, color=hcolor1, linewidth=10, style=plot.style_columns, histbase=50) havg2 = (avg - avg[4]) + 50 hcolor2 = havg2 > 50 ? color.new(color.green,80) : color.new(color.red,80) plot(havg2, color=hcolor2, linewidth=10, style=plot.style_columns, histbase=50) havg3 = (avg - avg[10]) + 50 hcolor3 = havg3 > 50 ? color.new(color.green,80) : color.new(color.red,80) plot(havg3, color=hcolor3, linewidth=10, style=plot.style_columns, histbase=50) havg4 = (avg - avg[20]) + 50 hcolor4 = havg4 > 50 ? color.new(color.green,80) : color.new(color.red,80) plot(havg4, color=hcolor4, linewidth=10, style=plot.style_columns, histbase=50) //Twitch, Long-Term, and General lines plot(s20, color=color.green, linewidth=2) plot(s200, color=color.red, linewidth=2) plot(avg/4, color=color.white, linewidth=4)
Two sided mean deviation Indicator [SQT]
https://www.tradingview.com/script/gj7h8ff0-Two-sided-mean-deviation-Indicator-SQT/
SwissQuantTrader
https://www.tradingview.com/u/SwissQuantTrader/
38
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/ // Β© SwissQuantTrader //@version=5 indicator(title="Two sided mean deviation Indicator [SQT]", shorttitle="Mean Deviation [SQT]", precision=2, overlay=false) // user parameters last_n_observations = input.int(defval=50, title="Use N candles", minval=5, maxval=1000, step=5, tooltip="How many candles to include for calculating the return means and standard deviations to derive the lower and upper bounds. The return means and standard deviations for up and down moves are calculated separately.") sigmas = input.float(defval=2, title="Sigma bounds", minval=0.3, maxval=5, step=0.1, tooltip="How many standard deviations (sigmas) should the lower and upper bounds be away from the mean return. The return means and standard deviations for up and down moves are calculated separately.") decay = input.string(defval="equally weighted", title="Decay", options=["equally weighted", "age weighted"], tooltip='How the lower and upper bounds decay back to their mean, if "equally weighted" then the bounds decay with equally weighing the observations, if "age weighted" then the bounds decay with giving more weight to more recent observations.') // hard parameters sum_and_ema = 3 source = close weight = 20 // create array with latest N down percent changes (equally weighted) var downs = array.new_float(size=last_n_observations) if (source - source[1]) / source[1] < 0 array.shift(id=downs) array.push(id=downs, value=100 * ((source - source[1]) / source[1])) // create array with latest N down percent changes (age weighted) var downs_forget = array.new_float(size=last_n_observations) for i = 0 to last_n_observations - 1 array.shift(id=downs_forget) array.push(id=downs_forget, value=array.get(id=downs, index=last_n_observations - i - 1) * ((last_n_observations - i) / weight)) // create array with latest N up percent changes (equally weighted) var ups = array.new_float(size=last_n_observations) if (source - source[1]) / source[1] > 0 array.shift(id=ups) array.push(id=ups, value=100 * ((source - source[1]) / source[1])) // create array with latest N up percent changes (age weighted) var ups_forget = array.new_float(size=last_n_observations) for i = 0 to last_n_observations - 1 array.shift(id=ups_forget) array.push(id=ups_forget, value=array.get(id=ups, index=last_n_observations - i - 1) * ((last_n_observations - i) / weight)) // instantiate lower and upper bounds var lower = float(x=0) var upper = float(x=0) // calculate lowere and upper bounds if decay == "equally weighted" lower := array.avg(id=downs) - (array.stdev(id=downs) * sigmas) upper := array.avg(id=ups) + (array.stdev(id=ups) * sigmas) else lower := array.avg(id=downs_forget) - (array.stdev(id=downs_forget) * sigmas) upper := array.avg(id=ups_forget) + (array.stdev(id=ups_forget) * sigmas) // plot the lower and upper bounds lower_plot = plot(series=lower, color=#FF00FF) upper_plot = plot(series=upper, color=#FF00FF) // fill the area between the lower and upper bounds fill(plot1=upper_plot, plot2=lower_plot, color=color.new(color=#FF00FF, transp=90)) // create and plot signal line as sum and EMA from last 'sum_and_ema' values signal = 100 * ((source - source[1]) / source[1]) signal := math.sum(source=signal, length=sum_and_ema) signal := ta.ema(source=signal, length=sum_and_ema) plot(series=signal, color=#00FFFF, linewidth=2) // plot a horizontal line at 0 hline(price=0, color=color.gray, linestyle=hline.style_dashed, linewidth=1)
REPLAY
https://www.tradingview.com/script/demACaHu-REPLAY/
kheirandish_v
https://www.tradingview.com/u/kheirandish_v/
278
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/ // Β© kheirandish_v //@version=5 indicator("REPLAY" , overlay=false) // you can change the overlay to "true" and use the indicator by hiding the main chart TIME = input.time(defval = timestamp('22 Nov 2021') , confirm=true) RP = time < TIME OPEN = RP ? open : na HIGH = RP ? high : na LOW = RP ? low : na CLOSE = RP ? close : na COLOR = close>open ? color.green : close<open ? color.red : color.black plotcandle(OPEN, HIGH , LOW , CLOSE , color=COLOR , wickcolor = COLOR , bordercolor = COLOR) //////////////////////////////////////////////////////////////// // Moving Average indicator has been added to this indicator, for example // You can also add your desired indicators to the REPLAY in the same way show_MA = input.bool(false , "Show Moving Average" , tooltip="this is an example and you can add your desired indicator") len = input.int(55, minval=1, title="MA Length") MA = ta.sma(close, len) out =RP and show_MA ? MA : na plot(out)
[JL] Trend or Range
https://www.tradingview.com/script/r5lHf1Iv-JL-Trend-or-Range/
Jesse.Lau
https://www.tradingview.com/u/Jesse.Lau/
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/ // Β© jesselau76 //@version=5 indicator(title="[JL] Trend or Range", shorttitle="ToR") // Getting inputs fast_length = input.int(20,title="Fast Length") slow_length = input.int(200,title="Slow Length") length = input.int(200,title="Trend or Range Period") torindex = input.float(3,title="Trend or Range index") src = input.source(close,title="Source") atr_length = input.int(20,title="ATR Length") // Calculating fast_ma = ta.sma(src, fast_length) slow_ma = ta.sma(src, slow_length) atr = ta.atr(atr_length) bars = ta.cum((fast_ma - slow_ma)/atr) tor = bars - bars[length] plot(tor, title="ToR", style=plot.style_columns, color=(math.abs(tor)>=torindex*length ? color.lime : color.gray), transp=0 )
High-Low Index
https://www.tradingview.com/script/WDAaGDMJ-High-Low-Index/
LonesomeTheBlue
https://www.tradingview.com/u/LonesomeTheBlue/
1,383
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/ // Β© LonesomeTheBlue //@version=5 indicator("High Low Index", explicit_plot_zorder = true) timeFrame = input.timeframe(defval = 'D', title = "Time Frame", group = "Setup") length = input.int(defval = 22, title = "Length", minval = 1, group = "Setup") source = input.string(defval = "High/Low", title = "Source", options = ["High/Low", "Close"], group = "Setup") smoothLength = input.int(defval = 10, title = "Smoothing Length", minval = 1, group = "Setup") showRecordHighPercent = input.bool(defval = true, title = "Record High Percent", group = "Setup") showTable= input.bool(defval = true, title = "Show Table", inline = "table", group = "Setup") textsize = input.string(defval = size.small, title = " | Text Size", options = [size.tiny, size.small, size.normal], inline = "table", group = "Setup") ShowExchange = input.bool(defval = false, title = "Show Exchange Info in the Table", group = "Setup") showEma = input.bool(defval = true, title = "EMA", inline = "ema", group = "Setup") emaLength = input.int(defval = 10, title = " | Length", minval = 1, inline = "ema", group = "Setup") symbol1 = input.string(defval = "BINANCE:BTCUSDT", group = "Symbols") symbol2 = input.string(defval = "BINANCE:XRPUSDT", group = "Symbols") symbol3 = input.string(defval = "BINANCE:BCHUSDT", group = "Symbols") symbol4 = input.string(defval = "BINANCE:LTCUSDT", group = "Symbols") symbol5 = input.string(defval = "BINANCE:BNBUSDT", group = "Symbols") symbol6 = input.string(defval = "BINANCE:EOSUSDT", group = "Symbols") symbol7 = input.string(defval = "BINANCE:XTZUSDT", group = "Symbols") symbol8 = input.string(defval = "BINANCE:ETHUSDT", group = "Symbols") symbol9 = input.string(defval = "BINANCE:XMRUSDT", group = "Symbols") symbol10 = input.string(defval = "BINANCE:XLMUSDT", group = "Symbols") symbol11 = input.string(defval = "BINANCE:ADAUSDT", group = "Symbols") symbol12 = input.string(defval = "BINANCE:TRXUSDT", group = "Symbols") symbol13 = input.string(defval = "BINANCE:DASHUSDT", group = "Symbols") symbol14 = input.string(defval = "BINANCE:ETCUSDT", group = "Symbols") symbol15 = input.string(defval = "BINANCE:OMGUSDT", group = "Symbols") symbol16 = input.string(defval = "BINANCE:NEOUSDT", group = "Symbols") symbol17 = input.string(defval = "BINANCE:ATOMUSD", group = "Symbols") symbol18 = input.string(defval = "BINANCE:IOTAUSDT", group = "Symbols") symbol19 = input.string(defval = "BINANCE:ALGOUSDT", group = "Symbols") symbol20 = input.string(defval = "BINANCE:ONTUSDT", group = "Symbols") symbol21 = input.string(defval = "BINANCE:FTTUSDT", group = "Symbols") symbol22 = input.string(defval = "BINANCE:DOGEUSDT", group = "Symbols") symbol23 = input.string(defval = "BINANCE:BATUSDT", group = "Symbols") symbol24 = input.string(defval = "BINANCE:ZECUSDT", group = "Symbols") symbol25 = input.string(defval = "BINANCE:VETUSDT", group = "Symbols") symbol26 = input.string(defval = "BINANCE:SCUSDT", group = "Symbols") symbol27 = input.string(defval = "BINANCE:ZILUSDT", group = "Symbols") symbol28 = input.string(defval = "BINANCE:QTUMUSDT", group = "Symbols") symbol29 = input.string(defval = "BINANCE:THETAUSDT", group = "Symbols") symbol30 = input.string(defval = "BINANCE:LSKUSDT", group = "Symbols") symbol31 = input.string(defval = "BINANCE:HOTUSDT", group = "Symbols") symbol32 = input.string(defval = "BINANCE:REPUSDT", group = "Symbols") symbol33 = input.string(defval = "BINANCE:WAVESUSDT", group = "Symbols") symbol34 = input.string(defval = "BINANCE:BTSUSDT", group = "Symbols") symbol35 = input.string(defval = "BINANCE:HBARUSDT", group = "Symbols") symbol36 = input.string(defval = "BINANCE:ICXUSDT", group = "Symbols") symbol37 = input.string(defval = "BINANCE:RVNUSDT", group = "Symbols") symbol38 = input.string(defval = "BINANCE:NANOUSDT", group = "Symbols") symbol39 = input.string(defval = "BINANCE:SOLUSDT", group = "Symbols") symbol40 = input.string(defval = "BINANCE:BTCUSDTPERP", group = "Symbols") HighsLows = array.new_int(40, 0) getHighLow(length)=> highest_ = ta.highest(length)[1] lowest_ = ta.lowest(length)[1] int ret = 0 if na(highest_) ret := 2 else bool h_ = ((source == "High/Low" ? high : close) > highest_) bool l_ = ((source == "High/Low" ? low : close) < lowest_) ret := h_ ? 1 : l_ ? -1 : 0 ret getHLindexForTheSymbol(symbol, timeFrame, length, index)=> highlow = request.security(symbol, timeFrame, getHighLow(length), ignore_invalid_symbol = true) array.set(HighsLows, index, na(highlow) ? 2 : highlow) getHLindexForTheSymbol(symbol1, timeFrame, length, 0) getHLindexForTheSymbol(symbol2, timeFrame, length, 1) getHLindexForTheSymbol(symbol3, timeFrame, length, 2) getHLindexForTheSymbol(symbol4, timeFrame, length, 3) getHLindexForTheSymbol(symbol5, timeFrame, length, 4) getHLindexForTheSymbol(symbol6, timeFrame, length, 5) getHLindexForTheSymbol(symbol7, timeFrame, length, 6) getHLindexForTheSymbol(symbol8, timeFrame, length, 7) getHLindexForTheSymbol(symbol9, timeFrame, length, 8) getHLindexForTheSymbol(symbol10, timeFrame, length, 9) getHLindexForTheSymbol(symbol11, timeFrame, length, 10) getHLindexForTheSymbol(symbol12, timeFrame, length, 11) getHLindexForTheSymbol(symbol13, timeFrame, length, 12) getHLindexForTheSymbol(symbol14, timeFrame, length, 13) getHLindexForTheSymbol(symbol15, timeFrame, length, 14) getHLindexForTheSymbol(symbol16, timeFrame, length, 15) getHLindexForTheSymbol(symbol17, timeFrame, length, 16) getHLindexForTheSymbol(symbol18, timeFrame, length, 17) getHLindexForTheSymbol(symbol19, timeFrame, length, 18) getHLindexForTheSymbol(symbol20, timeFrame, length, 19) getHLindexForTheSymbol(symbol21, timeFrame, length, 20) getHLindexForTheSymbol(symbol22, timeFrame, length, 21) getHLindexForTheSymbol(symbol23, timeFrame, length, 22) getHLindexForTheSymbol(symbol24, timeFrame, length, 23) getHLindexForTheSymbol(symbol25, timeFrame, length, 24) getHLindexForTheSymbol(symbol26, timeFrame, length, 25) getHLindexForTheSymbol(symbol27, timeFrame, length, 26) getHLindexForTheSymbol(symbol28, timeFrame, length, 27) getHLindexForTheSymbol(symbol29, timeFrame, length, 28) getHLindexForTheSymbol(symbol30, timeFrame, length, 29) getHLindexForTheSymbol(symbol31, timeFrame, length, 30) getHLindexForTheSymbol(symbol32, timeFrame, length, 31) getHLindexForTheSymbol(symbol33, timeFrame, length, 32) getHLindexForTheSymbol(symbol34, timeFrame, length, 33) getHLindexForTheSymbol(symbol35, timeFrame, length, 34) getHLindexForTheSymbol(symbol36, timeFrame, length, 35) getHLindexForTheSymbol(symbol37, timeFrame, length, 36) getHLindexForTheSymbol(symbol38, timeFrame, length, 37) getHLindexForTheSymbol(symbol39, timeFrame, length, 38) getHLindexForTheSymbol(symbol40, timeFrame, length, 39) highs = 0 total = 0 for x = 0 to 39 highs += (array.get(HighsLows, x) == 1 ? 1 : 0) total += (array.get(HighsLows, x) == 1 or array.get(HighsLows, x) == -1 ? 1 : 0) // calculate & show Record High Percent / High Low Index / EMA var float RecordHighPercent = 50 RecordHighPercent := total == 0 ? RecordHighPercent : 100 * highs / total HighLowIndex = ta.sma(RecordHighPercent, smoothLength) hline0 = hline(0, linestyle = hline.style_dotted) hline50 = hline(50, linestyle = hline.style_dotted) hline100 = hline(100, linestyle = hline.style_dotted) fill(hline0, hline50, color = color.rgb(255, 0, 0, 75)) fill(hline50, hline100, color = color.rgb(0, 255, 0, 75)) plot(showRecordHighPercent ? RecordHighPercent : na, color = showRecordHighPercent ? #9598a1 : na) plot(showEma ? ta.ema(HighLowIndex, emaLength) : na, color = showEma ? color.red : na) plot(HighLowIndex, color = color.blue, linewidth = 2) removeexchange(string [] symbols)=> for x = 0 to array.size(symbols) - 1 array.set(symbols, x, array.get(str.split(array.get(symbols, x), ':'), 1)) // Keep symbol names in an array var symbols = array.from( symbol1, symbol2, symbol3, symbol4, symbol5, symbol6, symbol7, symbol8, symbol9, symbol10, symbol11, symbol12, symbol13, symbol14, symbol15, symbol16, symbol17, symbol18, symbol19, symbol20, symbol21, symbol22, symbol23, symbol24, symbol25, symbol26, symbol27, symbol28, symbol29, symbol30, symbol31, symbol32, symbol33, symbol34, symbol35, symbol36, symbol37, symbol38, symbol39, symbol40) // remove Exchange from the symbols if barstate.isfirst and not ShowExchange removeexchange(symbols) // show the table if barstate.islast and showTable var Table = table.new(position=position.bottom_left, columns=5, rows=8, frame_color=color.gray, frame_width=1, border_width=1, border_color=color.black) index = 0 for c = 0 to 4 for r = 0 to 7 bcolor = array.get(HighsLows, index) == 1 ? color.lime : array.get(HighsLows, index) == -1 ? color.red : array.get(HighsLows, index) == 2 ? color.black : color.gray tcolor = array.get(HighsLows, index) == 1 ? color.black : array.get(HighsLows, index) == -1 ? color.white : array.get(HighsLows, index) == 2 ? color.gray : color.black table.cell(table_id=Table, column=c, row=r, text=array.get(symbols, index), bgcolor=bcolor, text_color = tcolor, text_size=textsize) index += 1
Elevated Leverage index System - ELiS
https://www.tradingview.com/script/C4IpqgiB/
KivancOzbilgic
https://www.tradingview.com/u/KivancOzbilgic/
3,200
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/ // Β© KivancOzbilgic //@version=5 indicator('Elevated Leverage index System', 'ELiS', overlay=false, format=format.price, precision=0, timeframe='') gear = input.int(defval=2, title='Conservative=1 Standard=2 Average=3 Risky=4 Agressive=5', minval=1, maxval=5) src = input(close, title='Source') period = input(title='Length', defval=50) mult = 2 basis = ta.sma(src, period) dev = mult * ta.stdev(src, period) upper = basis + dev lower = basis - dev nATR = ta.atr(period) / src hATR = ta.highest(nATR, period) lATR = ta.lowest(nATR, period) nSD = ta.stdev(src, period) / src hSD = ta.highest(nSD, period) lSD = ta.lowest(nSD, period) MA = ta.wma(nATR, period) perm = 100 * math.abs(nATR - MA) / MA pers = 100 * (nSD - lSD) / (hSD - lSD) pera = 100 * (nATR - lATR) / (hATR - lATR) perb = 100 * (src - lower)/(upper - lower) per = gear == 4 or gear == 5 ? (perm + pers + pera + perb) / 4 : gear==1 ? math.min(100 , (pers + pera + perb) / 2.5) : (pers + pera + perb) / 3 EL = (100 - per) / (6-gear) ELiS = math.max(1,int(EL + .5)) plot(ELiS, 'ELiS', color.new(#5218FA, 0), 2)
level_stats
https://www.tradingview.com/script/k6lzULAo-level-stats/
voided
https://www.tradingview.com/u/voided/
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/ // Β© voided //@version=5 indicator("level_stats", overlay = true) // HISTOGRAM histogram(x, num_buckets, chart_width, chart_height, position, level) => max_ = array.max(x) min_ = array.min(x) bucket_width = (max_ - min_) / num_buckets int[] counts = array.new_int(num_buckets + 1, 0) for i = 0 to array.size(x) - 1 val = array.get(x, i) bucket = math.floor((val - min_) / bucket_width) count = array.get(counts, bucket) array.set(counts, bucket, count + 1) count_max = array.max(counts) count_min = array.min(counts) bucket_height = (count_max - count_min) / num_buckets hist = table.new(position, num_buckets + 1, num_buckets + 1) empty = color.new(color.white, 100) less_than = color.new(color.blue, 70) greater_than = color.new(color.red, 70) cell_width = chart_width / num_buckets cell_height = chart_height / num_buckets for i = 0 to num_buckets for j = 0 to num_buckets count = array.get(counts, i) bucket = min_ + i * bucket_width height = math.floor((count - count_min) / bucket_height) bg_clr = height >= j ? bucket < level ? less_than : greater_than : empty table.cell(hist, i, num_buckets - j, width = cell_width, height = cell_height, bgcolor = bg_clr) // PROGRAM float level = input(0., title = "level") int num_buckets = input(50, title = "number of buckets") int width = input(30, title = "histogram width %") int height = input(20, title = "histogram height %") start = input.time(timestamp("1 Jan 1950 00:00 +0300"), "start") end = input.time(timestamp("1 Jan 2300 00:00 +0300"), "end") above_clr = color.new(color.red, 70) below_clr = color.new(color.blue, 70) var above = array.new_int(0) var below = array.new_int(0) var x = array.new_float(0) in_range = time >= start and time < end a = close >= level and in_range b = close < level and in_range if a array.push(above, 1) array.push(x, close) else if b array.push(above, 0) array.push(x, close) bgcolor(a ? above_clr : b ? below_clr : na) hline(level, title="level", color=above_clr, linestyle = hline.style_solid, editable = true) if barstate.islast stats = table.new(position.top_right, 3, 6) label_clr_a = color.new(color.green, 70) label_clr_b = color.new(color.yellow, 70) total = array.size(above) above_total = array.sum(above) below_total = total - above_total above_pct = above_total / total below_pct = below_total / total table.cell(stats, 0, 0) table.cell(stats, 1, 0, "total", bgcolor = label_clr_a) table.cell(stats, 2, 0, "ratio", bgcolor = label_clr_a) table.cell(stats, 0, 1, "above", bgcolor = label_clr_a) table.cell(stats, 1, 1, str.tostring(above_pct, "#.##")) table.cell(stats, 2, 1, str.tostring(above_total) + " / " + str.tostring(total)) table.cell(stats, 0, 2, "below", bgcolor = label_clr_a) table.cell(stats, 1, 2, str.tostring(below_pct, "#.##")) table.cell(stats, 2, 2, str.tostring(below_total) + " / " + str.tostring(total)) table.cell(stats, 0, 3, "mean", bgcolor = label_clr_b) table.cell(stats, 1, 3, str.tostring(array.avg(x), "#.##")) table.cell(stats, 0, 4, "median", bgcolor = label_clr_b) table.cell(stats, 1, 4, str.tostring(array.median(x), "#.##")) table.cell(stats, 0, 5, "stdev", bgcolor = label_clr_b) table.cell(stats, 1, 5, str.tostring(array.stdev(x), "#.##")) histogram(x, num_buckets, width, height, position.bottom_right, level)
Moving Average Multitool Crossover
https://www.tradingview.com/script/dQ0RZcoO-Moving-Average-Multitool-Crossover/
bjr117
https://www.tradingview.com/u/bjr117/
235
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('Moving Average Multitool Crossover', shorttitle = '[MAMX]', overlay = true) //============================================================================== // Function: Calculate a given type of moving average //============================================================================== get_ma_out(type, src, len, alma_offset, alma_sigma, kama_fastLength, kama_slowLength, vama_vol_len, vama_do_smth, vama_smth, mf_beta, mf_feedback, mf_z) => float baseline = 0.0 if type == 'SMA | Simple MA' baseline := ta.sma(src, len) else if type == 'EMA | Exponential MA' baseline := ta.ema(src, len) else if type == 'DEMA | Double Exponential MA' e = ta.ema(src, len) baseline := 2 * e - ta.ema(e, len) else if type == 'TEMA | Triple Exponential MA' e = ta.ema(src, len) baseline := 3 * (e - ta.ema(e, len)) + ta.ema(ta.ema(e, len), len) else if type == 'TMA | Triangular MA' // by everget baseline := ta.sma(ta.sma(src, math.ceil(len / 2)), math.floor(len / 2) + 1) else if type == 'WMA | Weighted MA' baseline := ta.wma(src, len) else if type == 'VWMA | Volume-Weighted MA' baseline := ta.vwma(src, len) else if type == 'SMMA | Smoothed MA' w = ta.wma(src, len) baseline := na(w[1]) ? ta.sma(src, len) : (w[1] * (len - 1) + src) / len else if type == 'WWMA (RMA) | Welles Wilder/Rolling MA' baseline := ta.rma(src, len) else if type == 'HMA | Hull MA' baseline := ta.wma(2 * ta.wma(src, len / 2) - ta.wma(src, len), math.round(math.sqrt(len))) else if type == 'LSMA | Least Squares MA' baseline := ta.linreg(src, len, 0) else if type == 'Kijun' //Kijun-sen kijun = math.avg(ta.lowest(len), ta.highest(len)) baseline := kijun else if type == 'MD | McGinley Dynamic' mg = 0.0 mg := na(mg[1]) ? ta.ema(src, len) : mg[1] + (src - mg[1]) / (len * math.pow(src / mg[1], 4)) baseline := mg else if type == 'JMA | Jurik MA' // by everget DEMAe1 = ta.ema(src, len) DEMAe2 = ta.ema(DEMAe1, len) baseline := 2 * DEMAe1 - DEMAe2 else if type == 'ALMA | Arnaud Legoux MA' baseline := ta.alma(src, len, alma_offset, alma_sigma) else if type == 'VAR | Vector Autoregression MA' valpha = 2 / (len+1) vud1 = (src > src[1]) ? (src - src[1]) : 0 vdd1 = (src < src[1]) ? (src[1] - src) : 0 vUD = math.sum(vud1, 9) vDD = math.sum(vdd1, 9) vCMO = nz( (vUD - vDD) / (vUD + vDD) ) baseline := nz(valpha * math.abs(vCMO) * src) + (1 - valpha * math.abs(vCMO)) * nz(baseline[1]) else if type == 'ZLEMA | Zero-Lag Exponential MA' // by HPotter xLag = (len) / 2 xEMAData = (src + (src - src[xLag])) baseline := ta.ema(xEMAData, len) else if type == 'AHMA | Ahrens Moving Average' // by everget baseline := nz(baseline[1]) + (src - (nz(baseline[1]) + nz(baseline[len])) / 2) / len else if type == 'EVWMA | Elastic Volume Weighted MA' volumeSum = math.sum(volume, len) baseline := ( (volumeSum - volume) * nz(baseline[1]) + volume * src ) / volumeSum else if type == 'SWMA | Sine Weighted MA' // by everget sum = 0.0 weightSum = 0.0 for i = 0 to len - 1 weight = math.sin(i * math.pi / (len + 1)) sum := sum + nz(src[i]) * weight weightSum := weightSum + weight baseline := sum / weightSum else if type == 'LMA | Leo MA' baseline := 2 * ta.wma(src, len) - ta.sma(src, len) else if type == 'VIDYA | Variable Index Dynamic Average' // by KivancOzbilgic mom = ta.change(src) upSum = math.sum(math.max(mom, 0), len) downSum = math.sum(-math.min(mom, 0), len) out = (upSum - downSum) / (upSum + downSum) cmo = math.abs(out) alpha = 2 / (len + 1) baseline := src * alpha * cmo + nz(baseline[1]) * (1 - alpha * cmo) else if type == 'FRAMA | Fractal Adaptive MA' length2 = math.floor(len / 2) hh2 = ta.highest(length2) ll2 = ta.lowest(length2) N1 = (hh2 - ll2) / length2 N2 = (hh2[length2] - ll2[length2]) / length2 N3 = (ta.highest(len) - ta.lowest(len)) / len D = (math.log(N1 + N2) - math.log(N3)) / math.log(2) factor = math.exp(-4.6 * (D - 1)) baseline := factor * src + (1 - factor) * nz(baseline[1]) else if type == 'VMA | Variable MA' // by LazyBear k = 1.0/len pdm = math.max((src - src[1]), 0) mdm = math.max((src[1] - src), 0) pdmS = float(0.0) mdmS = float(0.0) pdmS := ((1 - k)*nz(pdmS[1]) + k*pdm) mdmS := ((1 - k)*nz(mdmS[1]) + k*mdm) s = pdmS + mdmS pdi = pdmS/s mdi = mdmS/s pdiS = float(0.0) mdiS = float(0.0) pdiS := ((1 - k)*nz(pdiS[1]) + k*pdi) mdiS := ((1 - k)*nz(mdiS[1]) + k*mdi) d = math.abs(pdiS - mdiS) s1 = pdiS + mdiS iS = float(0.0) iS := ((1 - k)*nz(iS[1]) + k*d/s1) hhv = ta.highest(iS, len) llv = ta.lowest(iS, len) d1 = hhv - llv vI = (iS - llv)/d1 baseline := (1 - k*vI)*nz(baseline[1]) + k*vI*src else if type == 'GMMA | Geometric Mean MA' lmean = math.log(src) smean = math.sum(lmean, len) baseline := math.exp(smean / len) else if type == 'CMA | Corrective MA' // by everget sma = ta.sma(src, len) baseline := sma v1 = ta.variance(src, len) v2 = math.pow(nz(baseline[1], baseline) - baseline, 2) v3 = v1 == 0 or v2 == 0 ? 1 : v2 / (v1 + v2) var tolerance = math.pow(10, -5) float err = 1 // Gain Factor float kPrev = 1 float k = 1 for i = 0 to 5000 by 1 if err > tolerance k := v3 * kPrev * (2 - kPrev) err := kPrev - k kPrev := k kPrev baseline := nz(baseline[1], src) + k * (sma - nz(baseline[1], src)) else if type == 'MM | Moving Median' // by everget baseline := ta.percentile_nearest_rank(src, len, 50) else if type == 'QMA | Quick MA' // by everget peak = len / 3 num = 0.0 denom = 0.0 for i = 1 to len + 1 mult = 0.0 if i <= peak mult := i / peak else mult := (len + 1 - i) / (len + 1 - peak) num := num + src[i - 1] * mult denom := denom + mult baseline := (denom != 0.0) ? (num / denom) : src else if type == 'KAMA | Kaufman Adaptive MA' // by everget mom = math.abs(ta.change(src, len)) volatility = math.sum(math.abs(ta.change(src)), len) // Efficiency Ratio er = volatility != 0 ? mom / volatility : 0 fastAlpha = 2 / (kama_fastLength + 1) slowAlpha = 2 / (kama_slowLength + 1) alpha = math.pow(er * (fastAlpha - slowAlpha) + slowAlpha, 2) baseline := alpha * src + (1 - alpha) * nz(baseline[1], src) else if type == 'VAMA | Volatility Adjusted MA' // by Joris Duyck (JD) mid = ta.ema(src, len) dev = src - mid vol_up = ta.highest(dev, vama_vol_len) vol_down = ta.lowest(dev, vama_vol_len) vama = mid + math.avg(vol_up, vol_down) baseline := vama_do_smth ? ta.wma(vama, vama_smth) : vama else if type == 'Modular Filter' // by alexgrover //---- b = 0.0, c = 0.0, os = 0.0, ts = 0.0 //---- alpha = 2/(len+1) a = mf_feedback ? mf_z*src + (1-mf_z)*nz(baseline[1],src) : src //---- b := a > alpha*a+(1-alpha)*nz(b[1],a) ? a : alpha*a+(1-alpha)*nz(b[1],a) c := a < alpha*a+(1-alpha)*nz(c[1],a) ? a : alpha*a+(1-alpha)*nz(c[1],a) os := a == b ? 1 : a == c ? 0 : os[1] //---- upper = mf_beta*b+(1-mf_beta)*c lower = mf_beta*c+(1-mf_beta)*b baseline := os*upper+(1-os)*lower baseline //============================================================================== //============================================================================== // Inputs for first moving average //============================================================================== // General indicator settings for 1st and 2nd moving averages ma_type_1 = input.string('EMA | Exponential MA', 'MA Type', options=[ 'EMA | Exponential MA', 'SMA | Simple MA', 'WMA | Weighted MA', 'DEMA | Double Exponential MA', 'TEMA | Triple Exponential MA', 'TMA | Triangular MA', 'VWMA | Volume-Weighted MA', 'SMMA | Smoothed MA', 'HMA | Hull MA', 'LSMA | Least Squares MA', 'Kijun', 'MD | McGinley Dynamic', 'WWMA (RMA) | Welles Wilder/Rolling MA', 'JMA | Jurik MA', 'ALMA | Arnaud Legoux MA', 'VAR | Vector Autoregression MA', 'ZLEMA | Zero-Lag Exponential MA', 'AHMA | Ahrens Moving Average', 'EVWMA | Elastic Volume Weighted MA', 'SWMA | Sine Weighted MA', 'LMA | Leo MA', 'VIDYA | Variable Index Dynamic Average', 'FRAMA | Fractal Adaptive MA', 'VMA | Variable MA', 'GMMA | Geometric Mean MA', 'CMA | Corrective MA', 'MM | Moving Median', 'QMA | Quick MA', 'KAMA | Kaufman Adaptive MA', 'VAMA | Volatility Adjusted MA', 'Modular Filter' ], group = 'General MA Settings', inline = 'ma_type') ma_len_1 = input.int(13, minval=1, title='1st MA Length', inline = 'ma_len', group = 'General MA Settings') ma_src_1 = input(close, title='1st MA Source', inline = 'ma_src', group = 'General MA Settings') ma_type_2 = input.string('EMA | Exponential MA', 'MA Type', options=[ 'EMA | Exponential MA', 'SMA | Simple MA', 'WMA | Weighted MA', 'DEMA | Double Exponential MA', 'TEMA | Triple Exponential MA', 'TMA | Triangular MA', 'VWMA | Volume-Weighted MA', 'SMMA | Smoothed MA', 'HMA | Hull MA', 'LSMA | Least Squares MA', 'Kijun', 'MD | McGinley Dynamic', 'WWMA (RMA) | Welles Wilder/Rolling MA', 'JMA | Jurik MA', 'ALMA | Arnaud Legoux MA', 'VAR | Vector Autoregression MA', 'ZLEMA | Zero-Lag Exponential MA', 'AHMA | Ahrens Moving Average', 'EVWMA | Elastic Volume Weighted MA', 'SWMA | Sine Weighted MA', 'LMA | Leo MA', 'VIDYA | Variable Index Dynamic Average', 'FRAMA | Fractal Adaptive MA', 'VMA | Variable MA', 'GMMA | Geometric Mean MA', 'CMA | Corrective MA', 'MM | Moving Median', 'QMA | Quick MA', 'KAMA | Kaufman Adaptive MA', 'VAMA | Volatility Adjusted MA', 'Modular Filter' ], group = 'General MA Settings', inline = 'ma_type') ma_len_2 = input.int(21, minval=1, title='2nd MA Length', inline = 'ma_len', group = 'General MA Settings') ma_src_2 = input(close, title='2nd MA Source', inline = 'ma_src', group = 'General MA Settings') ma_do_signals = input(true, title = 'Show MA Crossover Signals?', group = 'General MA Settings') // Specific indicator settings for 1st and 2nd moving averages alma_offset_1 = input.float(title = "Offset", defval = 0.85, step = 0.05, group = 'ALMA Settings') alma_sigma_1 = input.int(title = '1st MA: Sigma', defval = 6, group = 'ALMA Settings') alma_offset_2 = input.float(title = "Offset", defval = 0.85, step = 0.05, group = 'ALMA Settings') alma_sigma_2 = input.int(title = '2nd MA: Sigma', defval = 6, group = 'ALMA Settings') kama_fastLength_1 = input(title = '1st MA: Fast EMA Length', defval=2, group = 'KAMA Settings') kama_slowLength_1 = input(title = '1st MA: Slow EMA Length', defval=30, group = 'KAMA Settings') kama_fastLength_2 = input(title = '2nd MA: Fast EMA Length', defval=2, group = 'KAMA Settings') kama_slowLength_2 = input(title = '2nd MA: Slow EMA Length', defval=30, group = 'KAMA Settings') vama_vol_len_1 = input.int(title = '1st MA: Volatality Length', defval = 51, group = 'VAMA Settings') vama_do_smth_1 = input.bool(title = '1st MA: Do Smoothing?', defval = false, group = 'VAMA Settings') vama_smth_1 = input.int(title = '1st MA: Smoothing length', defval = 5, minval = 1, group = 'VAMA Settings') vama_vol_len_2 = input.int(title = '2nd MA: Volatality Length', defval = 51, group = 'VAMA Settings') vama_do_smth_2 = input.bool(title = '2nd MA: Do Smoothing?', defval = false, group = 'VAMA Settings') vama_smth_2 = input.int(title = '2nd MA: Smoothing length', defval = 5, minval = 1, group = 'VAMA Settings') mf_beta_1 = input.float(title = '1st MA: Beta', defval = 0.8, step = 0.1, minval = 0, maxval=1, group = 'Modular Filter Settings') mf_feedback_1 = input.bool(title = '1st MA: Feedback?', defval = false, group = 'Modular Filter Settings') mf_z_1 = input.float(title = '1st MA: Feedback Weighting', defval = 0.5, step = 0.1, minval = 0, maxval = 1, group = 'Modular Filter Settings') mf_beta_2 = input.float(title = '2nd MA: Beta', defval = 0.8, step = 0.1, minval = 0, maxval=1, group = 'Modular Filter Settings') mf_feedback_2 = input.bool(title = '2nd MA: Feedback?', defval = false, group = 'Modular Filter Settings') mf_z_2 = input.float(title = '2nd MA: Feedback Weighting', defval = 0.5, step = 0.1, minval = 0, maxval = 1, group = 'Modular Filter Settings') //============================================================================== //============================================================================== // Calculate and plot both moving averages //============================================================================== // Initalize MAs ma1 = float(0.0) ma2 = float(0.0) // Calculate and add each MA value to the ma1 and ma2 lines ma1 := get_ma_out(ma_type_1, ma_src_1, ma_len_1, alma_offset_1, alma_sigma_1, kama_fastLength_1, kama_slowLength_1, vama_vol_len_1, vama_do_smth_1, vama_smth_1, mf_beta_1, mf_feedback_1, mf_z_1) ma2 := get_ma_out(ma_type_2, ma_src_2, ma_len_2, alma_offset_2, alma_sigma_2, kama_fastLength_2, kama_slowLength_2, vama_vol_len_2, vama_do_smth_2, vama_smth_2, mf_beta_2, mf_feedback_2, mf_z_2) // Plot the ma1 and ma2 lines plot(ma1, title = '1st MA', color = color.blue, linewidth = 1) plot(ma2, title = '2nd MA', color = #000000, linewidth = 1) //============================================================================== //============================================================================== // Plot ma1 and ma2 crossover signals //============================================================================== buySignal = ta.crossover(ma1, ma2) plotshape(buySignal and ma_do_signals ? ma2 - ta.atr(14) : na, title='Buy', text='Buy', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.new(color.white, 0)) sellSignal = ta.crossunder(ma1, ma2) plotshape(sellSignal and ma_do_signals ? ma2 + ta.atr(14) : na, title='Sell', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.new(color.white, 0)) //==============================================================================
Daily Sun Flares Class C
https://www.tradingview.com/script/MIK3JUML-Daily-Sun-Flares-Class-C/
firerider
https://www.tradingview.com/u/firerider/
6
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/ // Β© firerider //@version=5 indicator('Daily Sun Flares Class C') // from SunPy python package / GOES varip int[] f_class = array.from(3, 3, 10, 5, 6, 6, 6, 5, 5, 5, 8, 7, 3, 14, 5, 1, 0, 2, 3, 2, 7, 6, 6, 3, 4, 6, 5, 6, 16, 4, 5, 6, 3, 7, 2, 3, 3, 7, 7, 9, 5, 2, 2, 0, 0, 0, 0, 0, 2, 2, 3, 2, 0, 1, 1, 0, 0, 1, 7, 3, 14, 5, 3, 4, 6, 4, 2, 13, 13, 14, 10, 6, 12, 7, 7, 2, 18, 2, 1, 2, 2, 3, 2, 8, 4, 5, 10, 8, 5, 0, 0, 2, 1, 2, 3, 2, 1, 1, 5, 4, 4, 11, 9, 0, 2, 8, 6, 3, 3, 3, 4, 9, 10, 10, 1, 2, 0, 1, 1, 1, 1, 0, 6, 8, 18, 9, 8, 9, 5, 7, 7, 4, 7, 6, 8, 0, 0, 2, 1, 2, 2, 1, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 2, 5, 2, 5, 0, 2, 9, 19, 10, 14, 5, 5, 7, 6, 8, 8, 3, 5, 4, 2, 4, 1, 3, 1, 2, 6, 2, 1, 5, 7, 1, 0, 10, 7, 1, 1, 1, 1, 0, 0, 2, 0, 0, 0, 1, 1, 0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 11, 4, 1, 0, 1, 0, 0, 4, 1, 0, 0, 0, 0, 6, 3, 13, 5, 17, 12, 6, 7, 17, 4, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 6, 10, 12, 4, 2, 2, 4, 0, 7, 2, 1, 3, 14, 13, 8, 8, 7, 13, 10, 0, 0, 0, 0, 0, 0, 0, 1, 1, 5, 2, 14, 7, 13, 3, 7, 4, 8, 1, 0, 3, 0, 1, 6, 5, 12, 15, 14, 14, 9, 5, 7, 0, 6, 4, 0, 1, 3, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 6, 9, 4, 0, 1, 0, 0, 0, 0, 1, 2, 1, 1, 2, 2, 1, 2, 3, 3, 1, 2, 12, 1, 1, 1, 1, 2, 2, 5, 8, 9, 4, 2, 3, 6, 4, 2, 4, 4, 2, 2, 3, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 2, 4, 0, 0, 1, 2, 1, 1, 4, 5, 0, 0, 1, 1, 5, 7, 5, 3, 3, 1, 1, 1, 3, 4, 6, 7, 15, 9, 16, 5, 6, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 1, 8, 2, 3, 2, 1, 2, 1, 3, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 2, 1, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 8, 2, 1, 0, 0, 0, 1, 0, 0, 1, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 11, 6, 1, 2, 7, 9, 3, 6, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 7, 6, 2, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 4, 0, 0, 0, 3, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 5, 0, 0, 2, 2, 7, 14, 13, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 3, 7, 3, 3, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 4, 1, 1, 0, 4, 2, 5, 5, 2, 5, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 2, 0, 0, 2, 9, 4, 4, 3, 4, 2, 1, 0, 1, 1, 3, 4, 0, 3, 4, 2, 8, 7, 2, 8, 16, 10, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 7, 2, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 2, 0, 1, 5, 11, 6, 1, 2, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 1, 2, 1, 4, 1, 5, 2, 0, 3, 0, 3, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 11, 6, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 10, 4, 0, 0, 7, 3, 2, 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 2, 0, 2, 0, 0, 3, 4, 2, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 4, 0, 3, 0, 2, 1, 3, 3, 7, 3, 7, 0, 3, 1, 0, 0, 0, 0, 1, 6, 1, 1, 1, 0, 0, 1, 0, 0, 1, 2, 1, 0, 3, 1, 2, 1, 0) calculateCandleTimeDiff() => // 2015-01-01 00:00 signal day time serie start. referenceUnixTime = 1420066800 candleUnixTime = time / 1000 + 1 timeDiff = candleUnixTime - referenceUnixTime timeDiff < 0 ? na : timeDiff getSignalCandleIndex() => timeDiff = calculateCandleTimeDiff() // Day index, days count elapsed from reference date. candleIndex = math.floor(timeDiff / 86400) candleIndex < 0 ? na : candleIndex getSignal() => // Map array data items indexes to candles. int candleIndex = getSignalCandleIndex() int itemsCount = array.size(f_class) // Return na for candles where indicator data is not available. int index = candleIndex >= itemsCount ? na : candleIndex signal = if index >= 0 and itemsCount > 1 array.get(f_class, index) else na signal // Compose signal time serie from array data. int SignalSerie = getSignal() // Calculate plot offset estimating market week open days plot(series=SignalSerie, style=plot.style_histogram, linewidth=4, color=color.new(color.yellow, 0))
Indicators Combination Framework v3 IND [DTU]
https://www.tradingview.com/script/zl3vQaat-Indicators-Combination-Framework-v3-IND-DTU/
dturkuler
https://www.tradingview.com/u/dturkuler/
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/ // Β© dturkuler //@version=5 // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ HISTORY{ //v3.02 //UPD: Indicator factor inputs displays with factor descriptions //UPD: Indicator Parameter inputs displays with parameter descriptions //v3.01 //ADD: 23 new indicators added to indicators list from the library. Current Total number of Indicators are 93. (to be continued to adding) //ADD: 2 more Parameters (P1,P2) for indicator calculation added. Par:(Use Defaults) uses only indicator(Source,Length) with library's default parameters. Par:(Use Extra Parameters P1,P2) use indicator(Source,Length,p1,p2) with additional parameters if indicator needs. //ADD: log calculation (simple, log10) option added on indicator function entries //ADD: New Output Signals added for compatibility on exporting condition signals to different Strategy templates. //ADD: Alerts Added according to conditions results //UPD: Indicator source inputs now display with indicators descriptions //UPD: Most off the source code rearranged and some functions moved to the new library. Now system work like a little bit frontend/backend //UPD: Performance improvement made on factorization and other source code //UPD: Input GUI rearranged //UPD: Tooltips corrected //REM: Extended indicators removed //UPD: IND1-IND4 added to indicator data source. Now it is possible to create new indicators with the previously defined indicators value. ex: IND1=ema(close,14) and IND2=rsi(IND1,20) means IND2=rsi(ema(close,14),20) //UPD: Custom Indicator (CUST) added to indicator data source and Combination Indicator source. //UPD: Volume added to indicator data source and Combination Indicator source. //REM: Custom indicators removed and only one custom indicator left //REM: Plot Type "Org. Range (-1,1)" removed //UPD: angle, rising, falling type operators moved to indicator library //v2.01 //UPD: angle, rising, falling functions moved from conditions to extended indicator data source parameters //ADD: tooltips added Extended indicator tooltip constants //UPD: Source Code remodified for extended indicators usage //ADD: fn_get_xsource function added //ADD: math.round_to_mintick added to fn_security function calculation //v1.07 //IMPORTANT NOTE: !!! double, triple factored indicators like DEMA, TEMA.. and indictor factorization is limited to 5000 bars due to TV limitation.. Make Attention on long term calculations //ADD: angle(IND,VALUE) added to combinations, added fn_angle(src1_,src2_) // USAGE: in combination=> 1st Indicator: (select any option), Operator:(Select any operator except rising, falling), 2nd Indicator: ("angle(1st IND,1st IND[1])"), Value: (angle value) // ex: c1:IND1 c2:> c3:"angle(1st IND,1st IND[1])", c4:12 means that => isAngle(IND1[0],IND1[1])>12 //UPD: 1st indicator options updated on inputs //UPD: 2nd indicators constants updated on constants //UPD: functions fn_get_Condition_Indicator(...), fn_get_Condition_Result(...) updated //v1.06 //ADD: Custom CRONEX T DEMARKER indicator added to custom indicator 4 //ADD: Plotting Type constants added, fn_plotFunction and Inputs options updated //UPD: Increased number of spare operators to be used in future //UPD: Condition tooltip updated //v1.05 //ADD: Number of custom indicators increased from 3 to 5 (see the cutom indicator inputs and functions) //ADD: Added double triple, Quatr factorizer for all indicators (like convert EMA to DEMA, TEMA, QEMA...) //ADD: fn_factor function added //UPD: fn_get_indicator updated //UPD: Some tooltips updated //v1.04 //ADD: Number condition increased from 3 to 4 for aech combination (longentry, shortentry, longclose, shortclose) //ADD: Stochastic, Percent value added for each indicator //ADD: Source data added for each indicator //UPD: Calculation bug on src_data removed //UPD: Indicators default values updated (Arranged to BTCUSDT for testing purpose) //v1.03 //UPD: Longlose and shortclose codes updated. Now works as expected //v1.02 //ADD: Tooltips addec to the settings screen. (Tooltip constants added) //ADD: Falling and rising operators added to combinations. USAGE:(1st Indicator---Falling---IS(1st Indicator,VALUE)----int VALUE) // Calculates: ta.falling(1st indicator, VALUE)... VALUE Should be integer (1,2...n) // Desc: if the 1st indicator is falling since the previous # of bars (VALUE). //ADD: use Simple Log addded for testing purpose but not available for usage (to be corrected) //UPD: Strategy part improved. Long close and short close now works as expected (without opposite close) //UPD: Constants Updated: CONDITION INDICATOR SOURCE CONSTANTS, CONDITION OPERATOR CONSTANTS //UPD: functions updated: fn_get_source() , fn_plotFunction(), fn_get_indicator(), fn_get_Condition_Indicator(), fn_get_Condition_Result() //v1.01 //UPD: Document violations removed //v1.00 //UPD: Condition indicator value input will be previous value of the selected indicator if "VALUE" is not selected //ADD: Added Profit gfx (should be improved!!!) //UPD: Updated condition result & join conditions functions with constants variables //ADD: Added area for Custom indicators on input panel //ADD: Added External indicator import on settings panel //ADD: Prepared documentation //v_x.xx //TODO: Add factorized Fibo avg range indicator (good for trend definition and entry exit points) //TODO: Add bands to the indicator and conditions //TODO: Add debug window for exporting indicator's parameters //TODO: Add Alerts, Condiional alerts for indicator (study) part //TODO: Create export function v3 for @Pinecoders Strategy Template //************ HISTORY} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ STRATEGY VARIABLES{ SystemVersion= 'v3' ScriptType= 'IND' stage= '' SystemName = 'Indicators Combination Framework '+SystemVersion+' '+ScriptType+' ' + stage + ' [DTU]' TradeId = 'IND COMB FRMWRK '+SystemVersion + ' '+ ScriptType+' ' +stage InitCapital = 1000 InitPosition = 100.0 // %10 of capital with x10 leverage InitCommission = 0.04 InitPyramidMax = 5 // Arrange it regarding to no margin call in strategy/performance tab CalcOnorderFills = false ProcessOrdersOnClose = false CalcOnEveryTick = false marginlong= 1./10*50 // (1/10x leverage) * 50 (Margin ratio in general) marginshort= 1./10*50 // (1/10x leverage) * 50 (Margin ratio in general) precision_= 4 // Keep it >=4 (I use it for data export ) //************ END STRATEGY VARIABLES} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ indicator(title=SystemName,shorttitle=TradeId,overlay=true, precision=precision_) //strategy( title=SystemName, shorttitle=TradeId, overlay=true, // margin_short=marginshort, margin_long=marginlong, // pyramiding=InitPyramidMax, initial_capital=InitCapital, // default_qty_type=strategy.percent_of_equity, default_qty_value=InitPosition, // commission_type=strategy.commission.percent, commission_value=InitCommission, // calc_on_order_fills=CalcOnorderFills, precision=precision_, // process_orders_on_close=ProcessOrdersOnClose, calc_on_every_tick=CalcOnEveryTick, // scale=scale.left, currency=currency.USD) import dturkuler/lib_Indicators_v2_DTU/2 as dtu // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ CONSTANTS{ //_______________GROUP NAME CONSTANTS s_grp_settings= "A) ═════════════ SETTINGS ══════════" s_grp_plottype= "B)══════════ PLOT TYPE OPS ═════════" s_grp_indicators= "C)════════════ INDICATORS ══════════" s_grp_indicator1= "C1)══════════ INDICATOR 1 ══════════" s_grp_indicator2= "C2)══════════ INDICATOR 2 ══════════" s_grp_indicator3= "C3)══════════ INDICATOR 3 ══════════" s_grp_indicator4= "C4)══════════ INDICATOR 4 ══════════" s_grp_indicator5= "C5)══════════ INDICATOR 5 ══════════" s_grp_LEC= "D1)══════ LONG ENTRY CONDITION ═════" s_grp_SEC= "D2)══════ SHORT ENTRY CONDITION ════" s_grp_LCC= "D3)══════ LONG CLOSE CONDITION ═════" s_grp_SCC= "D4)══════ SHORT CLOSE CONDITION ════" s_grp_custom_ind= "E) ════ CUSTOM INDICATOR (CRONEX) ══" s_grp_signal= "F) ═════════ SIGNAL EXPORT ═════════" s_grp_strategy= "G) ════════════ STRATEGY ═══════════" //_______________INDICATORS CONSTANTS // Indicator constants are defined with descriptions to better display in inputs dropdowns // To use them to call library function, It should be splitted with ".-" separator by using fn_split(indicator_constant,".-"). splitted first part will be used on library function part // ex: "cma(src,len)" ovrly = 'β–Όβ–Όβ–Ό OVERLAY β–Όβ–Όβ–Ό.-------------------------(Not used as indicator, info Only)Just used to separate input options of overlayable indicators ', org = 'Original Value.--------------------------Return input source value as output', hide = 'DONT DISPLAY.----------------------------Dont display/calculate the indicator. (For my framework usage)', alma = 'alma(src,len,offset=0.85,sigma=6).-------Arnaud Legoux Moving Average ', ama = 'ama(src,len,fast=14,slow=100).-----------Adjusted Moving Average', acdst = 'accdist().-------------------------------Accumulation/distribution index. ', cma = 'cma(src,len).----------------------------Corrective Moving average ', dema = 'dema(src,len).---------------------------Double EMA (Same as EMA with 2 factor)', ema = 'ema(src,len).----------------------------Exponential Moving Average ', gmma = 'gmma(src,len).---------------------------Geometric Mean Moving Average', hghst = 'highest(src,len).------------------------Highest value for a given number of bars back. ', hl2ma = 'hl2ma(src,len).--------------------------higest lowest moving average', hma = 'hma(src,len).----------------------------Hull Moving Average.', lgAdt = 'lagAdapt(src,len,perclen=5,fperc=50).----Ehlers Adaptive Laguerre filter', lgAdV = 'lagAdaptV(src,len,perclen=5,fperc=50).---Ehlers Adaptive Laguerre filter variation', lguer = 'laguerre(src,len).-----------------------Ehlers Laguerre filter', lsrcp = 'lesrcp(src,len).-------------------------lowest exponential esrcpanding moving line', lexp = 'lexp(src,len).---------------------------lowest exponential expanding moving line ', linrg = 'linreg(src,len,loffset=1).---------------Linear regression', lowst = 'lowest(src,len).-------------------------Lovest value for a given number of bars back.', mgi = 'mcginley(src, len).----------------------McGinley Dynamic adjusts for market speed shifts, which sets it apart from other moving averages, in addition to providing clear moving average lines', pcnl = 'percntl(src,len).------------------------percentile nearest rank. Calculates percentile using method of Nearest Rank.', pcnli = 'percntli(src,len).-----------------------percentile linear interpolation. Calculates percentile using method of linear interpolation between the two nearest ranks.', prev = 'previous(src,len).-----------------------Previous n (len) value of the source ', pvth = 'pivothigh(src,BarsLeft=len,BarsRight=2).-Previous pivot high. src=src, BarsLeft=len, BarsRight=p1=2', pvtl = 'pivotlow(src,BarsLeft=len,BarsRight=2).--Previous pivot low. src=src, BarsLeft=len, BarsRight=p1=2', rema = 'rema(src,len).---------------------------Range EMA (REMA) ', rma = 'rma(src,len).----------------------------Moving average used in RSI. It is the exponentially weighted moving average with alpha = 1 / length.', sar = 'sar(start=len, inc=0.02, max=0.02).------Parabolic SAR (parabolic stop and reverse) is a method to find potential reversals in the market price direction of traded goods.start=len, inc=p1, max=p2. ex: sar(0.02, 0.02, 0.02) ', sma = 'sma(src,len).----------------------------Smoothed Moving Average', smma = 'smma(src,len).---------------------------Smoothed Moving Average', supr2 = 'super2(src,len).-------------------------Ehlers super smoother, 2 pole ', supr3 = 'super3(src,len).-------------------------Ehlers super smoother, 3 pole', strnd = 'supertrend(src,len,period=3).------------Supertrend indicator', swma = 'swma(src,len).---------------------------Sine-Weighted Moving Average', tema = 'tema(src,len).---------------------------Triple EMA (Same as EMA with 3 factor)', tma = 'tma(src,len).----------------------------Triangular Moving Average', vida = 'vida(src,len).---------------------------Variable Index Dynamic Average ', vwma = 'vwma(src,len).---------------------------Volume Weigted Moving Average', vstop = 'volstop(src,len,atrfactor=2).------------Volatility Stop is a technical indicator that is used by traders to help place effective stop-losses. atrfactor=p1', wma = 'wma(src,len).----------------------------Weigted Moving Average ', vwap = 'vwap(src_).------------------------------Volume Weighted Average Price (VWAP) is used to measure the average price weighted by volume ', nvrly = 'β–Όβ–Όβ–Ό NON OVERLAY β–Όβ–Ό.----------------------(Not used as indicator, info Only)Just used to separate input options of non overlayable indicators ', adx = 'adx(dilen=len, adxlen=14, adxtype=0).----adx. The Average Directional Index (ADX) is a used to determine the strength of a trend. len=>dilen, p1=adxlen (default=14), p2=adxtype 0:ADX, 1:+DI, 2:-DI (def:0)', angle = 'angle(src,len).--------------------------angle of the series (Use its Input as another indicator output)', aroon = 'aroon(len,dir=0).------------------------aroon indicator. Aroons major function is to identify new trends as they happen.p1 = dir: 0=mid (default), 1=upper, 2=lower', atr = 'atr(src,len).----------------------------average true range. RMA of true range. ', awsom = 'awesome(fast=len=5,slow=34,type=0).------Awesome Oscilator is an indicator used to measure market momentum. defaults : fast=len= 5, p1=slow=34, p2=type: 0=Awesome, 1=difference', bbr = 'bbr(src,len,mult=1).---------------------bollinger %%', bbw = 'bbw(src,len,mult=2).---------------------Bollinger Bands Width. The Bollinger Band Width is the difference between the upper and the lower Bollinger Bands divided by the middle band.', cci = 'cci(src,len).----------------------------commodity channel index', cctbb = 'cctbbo(src,len).-------------------------CCT Bollinger Band Oscilator', chng = 'change(src,len).-------------------------A.K.A. Momentum. Difference between current value and previous, source - source[length]. is most commonly referred to as a rate and measures the acceleration of the price and/or volume of a security', cmf = 'cmf(len=20).-----------------------------Chaikin Money Flow Indicator used to measure Money Flow Volume over a set period of time. Default use is len=20', cmo = 'cmo(src,len).----------------------------Chande Momentum Oscillator. Calculates the difference between the sum of recent gains and the sum of recent losses and then divides the result by the sum of all price movement over the same period.', cog = 'cog(src,len).----------------------------The cog (center of gravity) is an indicator based on statistics and the Fibonacci golden ratio.', cpcrv = 'copcurve(src,len).-----------------------Coppock Curve. was originally developed by Edwin Sedge Coppock (Barrons Magazine, October 1962).', corrl = 'correl(src,len).-------------------------Correlation coefficient. Describes the degree to which two series tend to deviate from their ta.sma values.', count = 'count(src,len).--------------------------green avg - red avg', cti = 'cti(src,len).----------------------------Ehler s Correlation Trend Indicator by ', dev = 'dev(src,len).----------------------------ta.dev() Measure of difference between the series and its ta.sma', dpo = 'dpo(len).--------------------------------Detrended Price OScilator is used to remove trend from price. ', efi = 'efi(len).--------------------------------Elders Force Index (EFI) measures the power behind a price movement using price and volume.', eom = 'eom(len=14,div=10000).-------------------Ease of Movement.It is designed to measure the relationship between price and volume.p1 = div: 10000= (default)', fall = 'falling(src,len).------------------------ta.falling() Test if the `source` series is now falling for `length` bars long. (Use its Input as another indicator output)', fit = 'fisher(len).-----------------------------Fisher Transform is a technical indicator that converts price to Gaussian normal distribution and signals when prices move significantly by referencing recent price data', hvo = 'histvol(len).----------------------------Historical volatility is a statistical measure used to analyze the general dispersion of security or market index returns for a specified period of time.', kcr = 'kcr(src,len,mult=2).---------------------Keltner Channels Range ', kcw = 'kcw(src,len,mult=2).---------------------ta.kcw(). Keltner Channels Width. The Keltner Channels Width is the difference between the upper and the lower Keltner Channels divided by the middle channel.', kli = 'klinger(type=len).-----------------------Klinger oscillator aims to identify money flow’s long-term trend. type=len: 0:Oscilator 1:signal', macd = 'macd(src,len).---------------------------MACD (Moving Average Convergence/Divergence)', mfi = 'mfi(src,len).----------------------------Money Flow Index s a tool used for measuring buying and selling pressure', msi = 'msi(len=10).-----------------------------Mass Index (def=10) is used to examine the differences between high and low stock prices over a specific period of time', nvi = 'nvi().-----------------------------------Negative Volume Index', obv = 'obv().-----------------------------------On Balance Volume', pvi = 'pvi().-----------------------------------Positive Volume Index ', pvt = 'pvt().-----------------------------------Price Volume Trend', rangs = 'ranges(src,upper=len, lower=-5).---------ranges of the source. src=src, upper=len, v1:lower=upper . returns: -1 source<lower, 1 source>=upper otherwise 0', rise = 'rising(src,len).-------------------------ta.rising() Test if the `source` series is now rising for `length` bars long. (Use its Input as another indicator output)', roc = 'roc(src,len).----------------------------Rate of Change', rsi = 'rsi(src,len).----------------------------Relative strength Index', rvi = 'rvi(src,len).----------------------------The Relative Volatility Index (RVI) is calculated much like the RSI, although it uses high and low price standard deviation instead of the RSI’s method of absolute change in price.', smosc = 'smi_osc(src,len,fast=5, slow=34).--------smi Oscillator', smsig = 'smi_sig(src,len,fast=5, slow=34).--------smi Signal', stc = 'stc(src,len,fast=23,slow=50).------------Schaff Trend Cycle (STC) detects up and down trends long before the MACD. Code imported from ', stdev = 'stdev(src,len).--------------------------Standart deviation', trix = 'trix(src,len) .--------------------------the rate of change of a triple exponentially smoothed moving average.', tsi = 'tsi(src,len).----------------------------The True Strength Index indicator is a momentum oscillator designed to detect, confirm or visualize the strength of a trend.', ulos = 'ultimateOsc(len.-------------------------Ultimate Oscillator indicator (UO) indicator is a technical analysis tool used to measure momentum across three varying timeframes', vari = 'variance(src,len).-----------------------ta.variance(). Variance is the expectation of the squared deviation of a series from its mean (ta.sma), and it informally measures how far a set of numbers are spread out from their mean.', wilpc = 'willprc(src,len).------------------------Williams %R', wad = 'wad().-----------------------------------Williams Accumulation/Distribution.', wvad = 'wvad().----------------------------------Williams Variable Accumulation/Distribution.', //_______________INDICATOR PLOTTING TYPE CONSTANTS //Currently there are 4 plotting type exist in the system p01='Original' , p02='Stochastic' , p03='PercentRank' //, p04='Org. Range (-1,1)' //_______________CONDITION INDICATOR SOURCE CONSTANTS s00= "NONE", s01="IND1", s02="IND2", s03="IND3", s04="IND4", s05="IND5", s06="VALUE", s07="close", s08="open", s09="high", s10="low", s11="hl2", s12="hlc3", s13="ohlc4", s14="volume", s15="EXT",s16="CUST" //_______________CONDITION OPERATOR CONSTANTS op01="crossover", op02="crossunder", op03="cross", op04=">", op05="<", op06=">=", op07="<=", op08="=", op09="!=" //_______________PARAMETER VERSION CONSTANTS v01="Use Defaults", v02="Use Extra Parameters P1, P2" //_______________FACTOR VERSION CONSTANTS f01="None", f02 = "Double", f03 = "Triple", f04 = "Quadruple" //_______________TOOLTIPS CONSTANTS{ s_tt_settings= "GENERAL SETTINGS:\n" + "Select the Source, timeframe and Secure type that your indicators will use.\n" + "TIMEFRAME: indicators timeframe \n" + "SECURE: option is defined as reducing repaint in tradingview calculations as much as possible. The following function is used.\n" + "Here, the Secure entry consists of 3 parts and the f_security function is used to determine it.\n" + "a) SECURE: This option is defined as reducing repaint in tradingview calculations as much as possible\n" + "b) SEMI SECURE : While this option can reduce repaint in tradingview calculations as much as possible, it is less secure. \n" + "c) REPAINT: This option turns on the repaint feature." s_tt_data_ext= "EXT SOURCE: You can import external Indicator sources from here . It appears on condition/combination/Indicator area as EXT.\n" + "To import it as EXT, you should add your indicator to the chart and export your indicator value as PLOT with any defined title.\n" + "Then It will be visible in Ext data source dropdown input " s_tt_testPeriod= "TEST PERIOD: Determine your strategy testing period range by selecting start and end date/time" s_tt_settings1= "PLOT ALERTS: Plot condition result as alerts arrows on the chart's bottom for LONG and the top for SHORT entries, exits\n" + "CLOSE ON OPPOSITE: When selected, a long entry gets closed when a short entry opens and vice versa" s_tt_PlotType= "PLOTTING TYPE:\n"+ "This will be used to display non overlay indicators in the chart by using stochastic, percentrank selection in indicator setting \n"+ "1) MULT:Sets the multiplier for the selected Plot Type EXAMPLE: When 1000 is selected, the indicator in the range of (-1,1) will appear in the range of (-1000, 1000) on the screen other than Original\n"+ "2) SHIFT:It determines the shift that will appear on the screen for the selected Plot Type ( stochastic , Percentrank) in the range (-1,1) other than Original.\n"+ "3) SMOOTH:This option (only for Stochastic & PercentRank) allows to smooth the indicator to be displayed.\n"+ "4) HLINE:Diplay the horizontal lines to appear on the screen according to the mult factor for the range (-1,1). The lines represent the values (-1, -05, 0, 05 , 1)" s_tt_ind1= "INDICATOR INPUTS:\n"+ "1) LIBRARY INDICATOR (INDx):\n" + " a) MOVING AVERAGES : These are indicators such as EMA , SMA that you can overlay on the chart via plotting type='original'. \n " + " b) OTHER INDICATORS : These are other indicators that you can overlay on the chart due to their small value such as RSI , COG. (you can use plotting type stoch, %.. to overlay on the chart) \n" + "2) INDICATOR SOURCE: \n" + " indicator source such as close, open.. and you can also use custom (CUST), External (EXT) and Previous (IND1-IND4) Indicators as data source for current indicator calculation\n" + "3) INDICATOR LENGTH (Len): \n" + " indicator length value . (Not: it does not work for custom indicators since they have their parameter on cust. Ind. input screen ) \n" s_tt_ind2= "PARAMETERS \n" + "1) (Par): Used for indicator Extra parameters availability.\n"+ " a) (Use Defaults) use only indicator(Source,Length) with default parameters.\n" + " b) (Use Extra Parameters P1, P2) use indicator(Source,Length,p1,p2) with additional parameters (p1,p2) if indicator needs\n" + "2) (P1), (P2) : If V=2 (ADVANCED) is selected and if the requested indicator needs extra parameter P1, P2 then fill this area\n" s_tt_ind3= "1) FACTORIZER VALUE (Factor):\n" + " Double, Triple, Quadruple factorizer value (like convert EMA to DEMA, TEMA, QEMA...) 1= returns indicator Original value \n" + "2) LOG VALUE (Log):\n" + " log calculation option added on indicator function entries such as simple and log10\n" s_tt_ind4= "1) INDICATOR PLOTTING TYPE (PType): This is an input selection field about how indicaor will be displayed on the screen. \n" + " a) ORIGINAL: The indicator is displayed on the screen with its current values. Can be used to display moving average indicators such as ( EMA , SMA ) \n" + " b) STOCHASTIC: The indicator is displayed on the screen with stochastic calculation in the range of -1.1.It uses the stochastic (ST/%) calculation method to spread indicators such as ( RSI , COB) in the range (-1,1). You can see the original values of the relevant indicator on the TV Data Window screen.\n" + " c) PERCENTRANK: The indicator is displayed on the screen with Percentrank calculation in the range of -1.1.It uses the Percentrank (ST/%) calculation method to spread indicators such as ( RSI , COB) in the range (-1,1). You can see the original values of the relevant indicator on the TV Data Window screen.\n" + " d) ORG RANGE (-1,1): If your indicator is in the range of -1.1, your indicator will be displayed on the screen with its original calculation in the range of -1.1.\n" + "2) STOCHASTIC/PERCENTAGE VALUE (ST/%):\n" + " Stoch, Perc% plot type value. for realistic not filtered results you can enter a bigger value (ex:4999 max bars according to your subscription) (Note: this value does not impact plot type ORIGINAL and ORG RANGE )\n" + "3) INDICATOR COLOR:\n" + " Define indicator color and other drawing properties on the chart " s_tt_combination= "COMBINATION:\n"+ "Each combination are build from 4 parts\n"+ "1)1ST INDICATOR: If is set to NONE this combination and following combinations in the condition will not be used on calculations.You can select \n"+ " IND1-5: from indicators (See above),\n"+ " VALUE: a float value defined in the combinations value parameter\n "+ " EXT: value from externally imported indicator.\n"+ " Stock builtin values: close,open...\n"+ "2)OPERATOR : Selected Operator compares 1st Indicator with the 2nd one. You can select different operators such as crossover, crossunder, cross,>,<,=....\n"+ " Standart operators USAGE 1: [ 1)1st Indicator 2)cross 3)2nd Indicator 4)2nd indicator[VALUE] ] \n"+ " Standart operators USAGE 2: [ 1)1st Indicator 2)cross 3)VALUE 4)Value ] \n"+ "3)2ND INDICATOR : This indicator will be compared with the 1st one via selected Operator. You can select\n" + " IND1-5: from indicators (See above),\n"+ " VALUE: a float value defined in the combinations value parameter\n "+ " EXT: value from externally imported indicator.\n"+ " Stock builtin values: close,open...\n"+ "4)VALUE: When the 2nd indicator field selected as \n"+ " a)VALUE, value area compares the entered flaot value with indicator 1\n"+ " b)Other than VALUE, Value area define 2nd indicator's previous value ex: If 2ND INDICATOR='close' and VALUE =2 this mean 2ND INDICATOR=close[2]" s_tt_comb_op= "COMBINATION OPERATOR:\n" + "Each combination in Condition is compared with the next one via JOIN operator. The join operator can be selected as AND or OR." s_tt_custind= "CUSTOM INDICATOR:\n" + "There is an area in the code for design/import your Custom Indicator.\n" + "Here you can design/import your own indicator and use them in the framework.\n" + "You can also create unlimited parameters for your indicator in the custom indicator area.\n" + "CRONEX custom indicator is entered in the code area for demonstration. (See Source Code for Implementation) " s_tt_signals= "SIGNAL EXPORT:\n"+ "1) Select already defined strategy framework/template for exporting your signals that produced by your Indicators combinations \n"+ "In strategy framework/template there will be a import signal input and here select the source which include 'connect' word\n"+ "2) When 'Custom' is selected, you can define your signal such as long, short, longexit, shortexit for unlisted strategy framework or templates " s_tt_Profit= "STRATEGY PART:\n"+ "You can use this script as a simple raw strategy by remarking strategy part at the end and the switching the strategy to study at the start of the script source code\n"+ "Note: When you use it as a strategy you can not export signals to another strategy\n"+ "1)SHOW PROFIT:It appears if the script is in strategy mode (not in study) this can display current or open profit for better reanalyzing your strategy entry exit points. (Currently under development)" //_______________END TOOLTIPS CONSTANTS} //************END CONSTANTS} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ VARIABLES{ float f_indicator1=0 float f_indicator2=0 float f_indicator3=0 float f_indicator4=0 float f_indicator5=0 float f_custom_ind=0 //******** END VARIABLES} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ INPUTS{ //*************** GENERAL SETTINGS INPUTS{ //_______________F_SECURITY***NOREPAINT Timeframe = input.timeframe(defval='', title='Timeframe', group=s_grp_settings, inline="settings", tooltip=s_tt_settings) secure = input.string( defval='Secure',options=['Secure', 'Semi Secure', 'Repaint'], title='', group=s_grp_settings, inline="settings") data_ext = input.source( defval=close, title='Ext Source', group=s_grp_settings, inline="data_ext", tooltip=s_tt_data_ext) //The ext source Accept extrenal Indicator sources also. To export the External indicator plot it with a title. It will be visible in source dropdown input //_______________SETTINGS t_testPeriodStart= input.time( defval=timestamp('01 Apr 2021 00:00'),title='Start Time:', group=s_grp_settings, inline='test period', tooltip=s_tt_testPeriod) t_testPeriodStop = input.time( defval=timestamp('30 Dec 2022 23:30'),title='End Time :', group=s_grp_settings, inline='test period') b_plotalert = input.bool( defval=true, title='Plot Alerts', group=s_grp_settings, inline="settings1", tooltip=s_tt_settings1) b_isopposite = input.bool( defval=true, title="Close on opposite", group=s_grp_settings, inline="settings1") //_______________PLOT TYPE INPUTS i_ind_mult= input.int( defval=2000, title="mult", group= s_grp_plottype,inline="plot type", step=100, tooltip=s_tt_PlotType) i_ind_shift= input.int( defval=35000, title="shift", group= s_grp_plottype,inline="plot type", step=1000) b_ind_hline= input.bool( defval=true, title="hline", group= s_grp_plottype,inline="plot type") //************ END GENERAL SETTINGS INPUTS} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //*************** INDICATOR INPUTS{ //_______________INDICATOR 1 s_ind1_src= input.string( defval=ema, title='IND1:', options=[hide, org, ovrly, alma, ama , acdst, cma, dema, ema, gmma, hghst, hl2ma, hma, lgAdt, lgAdV, lguer, lsrcp, lexp, linrg, lowst, mgi,pcnl, pcnli, prev , pvth, pvtl, rema, rma, sar, sma, smma, supr2, supr3, strnd, swma, tema, tma, vida, vwma, vstop, wma, vwap, nvrly, adx, angle, aroon, atr, awsom, bbr, bbw, cci, cctbb, chng, cmf, cmo, cog, cpcrv, corrl, count, cti, dev, dpo, efi, eom, fall, fit, hvo, kcr, kcw, kli, macd, mfi, msi, nvi, obv, pvi, pvt, rangs, rise, roc, rsi, rvi, smosc, smsig, stc, stdev, trix, tsi, vari, wilpc, wad, wvad] , group=s_grp_indicator1, inline="ind1", tooltip=s_tt_ind1) s_ind1_data = input.string( defval="close", title='', group=s_grp_indicator1, inline="ind1", options=[s07, s08, s09, s10, s11, s12, s13, s14, s15, s16] ) f_ind1_len = input.float( defval=7, title='Len', group=s_grp_indicator1, inline="ind1") s_ind1_ver = input.string( defval=v01, title="Par", group=s_grp_indicator1, inline="ind2", options=[v01,v02], tooltip=s_tt_ind2) f_ind1_p1 = input.float( defval=0, title='P1', group=s_grp_indicator1, inline="ind2") f_ind1_p2 = input.float( defval=0, title='P2', group=s_grp_indicator1, inline="ind2") s_ind1_fact = input.string( defval=f01, title='factor', group=s_grp_indicator1, inline="ind4", options=[f01,f02,f03,f04], tooltip=s_tt_ind3) s_ind1_log = input.string( defval="None", title='Log', group=s_grp_indicator1, inline="ind4", options=['None', 'Simple', 'Log10']) s_ind1_pType = input.string( defval=p01, title="PType", group=s_grp_indicator1, inline="ind3", options=[p01,p02,p03], tooltip=s_tt_ind4) i_ind1_stlen = input.int( defval=50, title='St/% val', group=s_grp_indicator1, inline="ind3") b_ind1_pSWMA= input.bool( defval=false, title="Smooth", group=s_grp_indicator1, inline="ind3") c_ind1_color = input( defval=color.green, title="", group=s_grp_indicator1, inline="ind3") b_plt1_candle = false b_plt1_ind = true b_plt1_heikin = false //f_ind1_p3 = input.float( defval=0, title='P3', group=s_grp_indicator1, inline="ind2") //to be activated in the future //_______________INDICATOR 2 s_ind2_src= input.string( defval=ema, title='IND2:', options=[hide, org, ovrly, alma, ama , acdst, cma, dema, ema, gmma, hghst, hl2ma, hma, lgAdt, lgAdV, lguer, lsrcp, lexp, linrg, lowst, mgi,pcnl, pcnli, prev , pvth, pvtl, rema, rma, sar, sma, smma, supr2, supr3, strnd, swma, tema, tma, vida, vwma, vstop, wma, vwap, nvrly, adx, angle, aroon, atr, awsom, bbr, bbw, cci, cctbb, chng, cmf, cmo, cog, cpcrv, corrl, count, cti, dev, dpo, efi, eom, fall, fit, hvo, kcr, kcw, kli, macd, mfi, msi, nvi, obv, pvi, pvt, rangs, rise, roc, rsi, rvi, smosc, smsig, stc, stdev, trix, tsi, vari, wilpc, wad, wvad] , group=s_grp_indicator2, inline="ind1", tooltip=s_tt_ind1) s_ind2_data = input.string( defval="close", title='', group=s_grp_indicator2, inline="ind1", options=[s07, s08, s09, s10, s11, s12, s13, s14, s15, s16, s01]) f_ind2_len = input.float( defval=14, title='Len', group=s_grp_indicator2, inline="ind1") s_ind2_ver = input.string( defval=v01, title="Par", group=s_grp_indicator2, inline="ind2", options=[v01,v02], tooltip=s_tt_ind2) f_ind2_p1 = input.float( defval=0, title='P1', group=s_grp_indicator2, inline="ind2") f_ind2_p2 = input.float( defval=0, title='P2', group=s_grp_indicator2, inline="ind2") s_ind2_fact = input.string( defval=f01, title='factor', group=s_grp_indicator2, inline="ind4", options=[f01,f02,f03,f04], tooltip=s_tt_ind3) s_ind2_log = input.string( defval="None", title='Log', group=s_grp_indicator2, inline="ind4", options=['None', 'Simple', 'Log10']) s_ind2_pType = input.string( defval=p01, title="PType", group=s_grp_indicator2, inline="ind3", options=[p01,p02,p03], tooltip=s_tt_ind4) i_ind2_stlen = input.int( defval=50, title='St/% val', group=s_grp_indicator2, inline="ind3") b_ind2_pSWMA= input.bool( defval=false, title="Smooth", group=s_grp_indicator2, inline="ind3") c_ind2_color = input( defval=color.red, title="", group=s_grp_indicator2, inline="ind3") b_plt2_candle = false b_plt2_ind = true b_plt2_heikin = false //ind2_p3 = input.float( defval=0, title='P3', group=s_grp_indicator2, inline="ind2") //to be activated in the future //_______________INDICATOR 3 s_ind3_src= input.string( defval=ema, title='IND3:', options=[hide, org, ovrly, alma, ama , acdst, cma, dema, ema, gmma, hghst, hl2ma, hma, lgAdt, lgAdV, lguer, lsrcp, lexp, linrg, lowst, mgi,pcnl, pcnli, prev , pvth, pvtl, rema, rma, sar, sma, smma, supr2, supr3, strnd, swma, tema, tma, vida, vwma, vstop, wma, vwap, nvrly, adx, angle, aroon, atr, awsom, bbr, bbw, cci, cctbb, chng, cmf, cmo, cog, cpcrv, corrl, count, cti, dev, dpo, efi, eom, fall, fit, hvo, kcr, kcw, kli, macd, mfi, msi, nvi, obv, pvi, pvt, rangs, rise, roc, rsi, rvi, smosc, smsig, stc, stdev, trix, tsi, vari, wilpc, wad, wvad] , group=s_grp_indicator3, inline="ind1", tooltip=s_tt_ind1) s_ind3_data = input.string( defval="close", title='', group=s_grp_indicator3, inline="ind1", options=[s07, s08, s09, s10, s11, s12, s13, s14, s15, s16, s01,s02]) f_ind3_len = input.float( defval=21, title='Len', group=s_grp_indicator3, inline="ind1") s_ind3_ver = input.string( defval=v01, title="Par", group=s_grp_indicator3, inline="ind2", options=[v01,v02], tooltip=s_tt_ind2) f_ind3_p1 = input.float( defval=0, title='P1', group=s_grp_indicator3, inline="ind2") f_ind3_p2 = input.float( defval=0, title='P2', group=s_grp_indicator3, inline="ind2") s_ind3_fact = input.string( defval=f01, title='factor', group=s_grp_indicator3, inline="ind4", options=[f01,f02,f03,f04], tooltip=s_tt_ind3) s_ind3_log = input.string( defval="None", title='Log', group=s_grp_indicator3, inline="ind4", options=['None', 'Simple', 'Log10']) s_ind3_pType = input.string( defval=p01, title="PType", group=s_grp_indicator3, inline="ind3", options=[p01,p02,p03], tooltip=s_tt_ind4) i_ind3_stlen = input.int( defval=50, title='St/% val', group=s_grp_indicator3, inline="ind3") b_ind3_pSWMA= input.bool( defval=false, title="Smooth", group=s_grp_indicator3, inline="ind3") c_ind3_color = input( defval=color.blue, title="", group=s_grp_indicator3, inline="ind3") b_plt3_candle = false, b_plt3_ind = true b_plt3_heikin = false //ind3_p3 = input.float( defval=0, title='P3', group=s_grp_indicator3, inline="ind2") //to be activated in the future //_______________INDICATOR 4 s_ind4_src= input.string( defval=ema, title='IND4:', options=[hide, org, ovrly, alma, ama , acdst, cma, dema, ema, gmma, hghst, hl2ma, hma, lgAdt, lgAdV, lguer, lsrcp, lexp, linrg, lowst, mgi,pcnl, pcnli, prev , pvth, pvtl, rema, rma, sar, sma, smma, supr2, supr3, strnd, swma, tema, tma, vida, vwma, vstop, wma, vwap, nvrly, adx, angle, aroon, atr, awsom, bbr, bbw, cci, cctbb, chng, cmf, cmo, cog, cpcrv, corrl, count, cti, dev, dpo, efi, eom, fall, fit, hvo, kcr, kcw, kli, macd, mfi, msi, nvi, obv, pvi, pvt, rangs, rise, roc, rsi, rvi, smosc, smsig, stc, stdev, trix, tsi, vari, wilpc, wad, wvad] , group=s_grp_indicator4, inline="ind1", tooltip=s_tt_ind1) s_ind4_data = input.string( defval="close", title='', group=s_grp_indicator4, inline="ind1", options=[s07, s08, s09, s10, s11, s12, s13, s14, s15, s16, s01,s02,s03]) f_ind4_len = input.float( defval=50, title='Len', group=s_grp_indicator4, inline="ind1") s_ind4_ver = input.string( defval=v01, title="Par", group=s_grp_indicator4, inline="ind2", options=[v01,v02], tooltip=s_tt_ind2) f_ind4_p1 = input.float( defval=0, title='P1', group=s_grp_indicator4, inline="ind2") f_ind4_p2 = input.float( defval=0, title='P2', group=s_grp_indicator4, inline="ind2") s_ind4_fact = input.string( defval=f01, title='factor', group=s_grp_indicator4, inline="ind4", options=[f01,f02,f03,f04], tooltip=s_tt_ind3) s_ind4_log = input.string( defval="None", title='Log', group=s_grp_indicator4, inline="ind4", options=['None', 'Simple', 'Log10']) s_ind4_pType = input.string( defval=p01, title="PType", group=s_grp_indicator4, inline="ind3", options=[p01,p02,p03], tooltip=s_tt_ind4) i_ind4_stlen = input.int( defval=50, title='St/% val', group=s_grp_indicator4, inline="ind3") b_ind4_pSWMA= input.bool( defval=false, title="Smooth", group=s_grp_indicator4, inline="ind3") c_ind4_color = input( defval=color.purple, title="", group=s_grp_indicator4, inline="ind3") b_plt4_candle = false b_plt4_ind = true b_plt4_heikin = false //ind4_p3 = input.float( defval=0, title='P3', group=s_grp_indicator4, inline="ind2") //to be activated in the future //_______________INDICATOR 5 s_ind5_src= input.string( defval=ema, title='IND5:', options=[hide, org, ovrly, alma, ama , acdst, cma, dema, ema, gmma, hghst, hl2ma, hma, lgAdt, lgAdV, lguer, lsrcp, lexp, linrg, lowst, mgi,pcnl, pcnli, prev , pvth, pvtl, rema, rma, sar, sma, smma, supr2, supr3, strnd, swma, tema, tma, vida, vwma, vstop, wma, vwap, nvrly, adx, angle, aroon, atr, awsom, bbr, bbw, cci, cctbb, chng, cmf, cmo, cog, cpcrv, corrl, count, cti, dev, dpo, efi, eom, fall, fit, hvo, kcr, kcw, kli, macd, mfi, msi, nvi, obv, pvi, pvt, rangs, rise, roc, rsi, rvi, smosc, smsig, stc, stdev, trix, tsi, vari, wilpc, wad, wvad] , group=s_grp_indicator5, inline="ind1", tooltip=s_tt_ind1) s_ind5_data = input.string( defval="close", title='', group=s_grp_indicator5, inline="ind1", options=[s07, s08, s09, s10, s11, s12, s13, s14, s15, s16, s01,s02,s03,s04]) f_ind5_len = input.float( defval=100, title='Len', group=s_grp_indicator5, inline="ind1") s_ind5_ver = input.string( defval=v01, title="Par", group=s_grp_indicator5, inline="ind2", options=[v01,v02], tooltip=s_tt_ind2) f_ind5_p1 = input.float( defval=0, title='P1', group=s_grp_indicator5, inline="ind2") f_ind5_p2 = input.float( defval=0, title='P2', group=s_grp_indicator5, inline="ind2") s_ind5_fact = input.string( defval=f01, title='factor', group=s_grp_indicator5, inline="ind4", options=[f01,f02,f03,f04], tooltip=s_tt_ind3) s_ind5_log = input.string( defval="None", title='Log', group=s_grp_indicator5, inline="ind4", options=['None', 'Simple', 'Log10']) s_ind5_pType = input.string( defval=p01, title="PType", group=s_grp_indicator5, inline="ind3", options=[p01,p02,p03], tooltip=s_tt_ind4) i_ind5_stlen = input.int( defval=50, title='St/% val', group=s_grp_indicator5, inline="ind3") b_ind5_pSWMA= input.bool( defval=false, title="Smooth", group=s_grp_indicator5, inline="ind3") c_ind5_color = input( defval=color.orange, title="", group=s_grp_indicator5, inline="ind3") b_plt5_candle = false b_plt5_ind = true b_plt5_heikin = false //ind5_p3 = input.float( defval=0, title='P3', group=s_grp_indicator5, inline="ind2") //to be activated in the future //************END INDICATOR INPUTS} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //*************** CONDITION INPUTS{ //************ LONG ENTRY CONDITIONS INPUTS //_______________LONG ENTRY 1 CONDITION s_Cond_LE_1_ind1= input.string(defval="IND1", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LEC,inline="LE_cond1") s_Cond_LE_1_op= input.string(defval="crossover", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_LEC,inline="LE_cond1") s_Cond_LE_1_ind2= input.string(defval="IND2", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LEC,inline="LE_cond1") f_Cond_LE_1_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_LEC,inline="LE_cond1") //_______________LONG ENTRY 1-2 JOIN s_Cond_LE_1_join_2= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_LEC, tooltip=s_tt_comb_op) //_______________LONG ENTRY 2 CONDITION s_Cond_LE_2_ind1= input.string(defval="IND2", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LEC,inline="LE_cond2") s_Cond_LE_2_op= input.string(defval="<", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_LEC,inline="LE_cond2") s_Cond_LE_2_ind2= input.string(defval="VALUE", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LEC,inline="LE_cond2") f_Cond_LE_2_ind2_val=input.float( defval=-0.9, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_LEC,inline="LE_cond2") //_______________LONG ENTRY 2-3 JOIN s_Cond_LE_2_join_3= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_LEC, tooltip=s_tt_comb_op) //_______________LONG ENTRY 3 CONDITION s_Cond_LE_3_ind1= input.string(defval="IND1", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LEC,inline="LE_cond3") s_Cond_LE_3_op= input.string(defval="<", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_LEC,inline="LE_cond3") s_Cond_LE_3_ind2= input.string(defval="low", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LEC,inline="LE_cond3") f_Cond_LE_3_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_LEC,inline="LE_cond3") //_______________LONG ENTRY 3-4 JOIN s_Cond_LE_3_join_4= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_LEC, tooltip=s_tt_comb_op) //_______________LONG ENTRY 4 CONDITION s_Cond_LE_4_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LEC,inline="LE_cond4") s_Cond_LE_4_op= input.string(defval="<", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_LEC,inline="LE_cond4") s_Cond_LE_4_ind2= input.string(defval="low", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LEC,inline="LE_cond4") f_Cond_LE_4_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_LEC,inline="LE_cond4") //************SHORT ENTRY CONDITIONS INPUTS //_______________SHORT ENTRY 1 CONDITION s_Cond_SE_1_ind1= input.string(defval="IND2", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SEC,inline="SE_cond1") s_Cond_SE_1_op= input.string(defval="crossunder", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_SEC,inline="SE_cond1") s_Cond_SE_1_ind2= input.string(defval="IND3", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SEC,inline="SE_cond1") f_Cond_SE_1_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_SEC,inline="SE_cond1") //_______________SHORT ENTRY 1-2 JOIN s_Cond_SE_1_join_2= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_SEC, tooltip=s_tt_comb_op) //_______________SHORT ENTRY 2 CONDITION s_Cond_SE_2_ind1= input.string(defval="IND2", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SEC,inline="SE_cond2") s_Cond_SE_2_op= input.string(defval=">", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_SEC,inline="SE_cond2") s_Cond_SE_2_ind2= input.string(defval="VALUE", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SEC,inline="SE_cond2") f_Cond_SE_2_ind2_val=input.float( defval=0.9, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_SEC,inline="SE_cond2") //_______________SHORT ENTRY 2-3 JOIN s_Cond_SE_2_join_3= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_SEC, tooltip=s_tt_comb_op) //_______________SHORT ENTRY 3 CONDITION s_Cond_SE_3_ind1= input.string(defval="IND1", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SEC,inline="SE_cond3") s_Cond_SE_3_op= input.string(defval=">", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_SEC,inline="SE_cond3") s_Cond_SE_3_ind2= input.string(defval="high", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SEC,inline="SE_cond3") f_Cond_SE_3_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_SEC,inline="SE_cond3") //_______________SHORT ENTRY 3-4 JOIN s_Cond_SE_3_join_4= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_SEC, tooltip=s_tt_comb_op) //_______________SHORT ENTRY 4 CONDITION s_Cond_SE_4_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SEC,inline="SE_cond4") s_Cond_SE_4_op= input.string(defval=">", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_SEC,inline="SE_cond4") s_Cond_SE_4_ind2= input.string(defval="high", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SEC,inline="SE_cond4") f_Cond_SE_4_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_SEC,inline="SE_cond4") //************LONG CLOSE CONDITIONS INPUTS //_______________LONG CLOSE 1 CONDITION s_Cond_LC_1_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LCC,inline="LC_cond1") s_Cond_LC_1_op= input.string(defval="crossover", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_LCC,inline="LC_cond1") s_Cond_LC_1_ind2= input.string(defval="IND1", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LCC,inline="LC_cond1") f_Cond_LC_1_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_LCC,inline="LC_cond1") //_______________LONG CLOSE 1-2 JOIN s_Cond_LC_1_join_2= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_LCC, tooltip=s_tt_comb_op) //_______________LONG CLOSE 2 CONDITION s_Cond_LC_2_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LCC,inline="LC_cond2") s_Cond_LC_2_op= input.string(defval="crossover", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_LCC,inline="LC_cond2") s_Cond_LC_2_ind2= input.string(defval="IND2", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LCC,inline="LC_cond2") f_Cond_LC_2_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_LCC,inline="LC_cond2") //_______________LONG CLOSE 2-3 JOIN s_Cond_LC_2_join_3= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_LCC, tooltip=s_tt_comb_op) //_______________LONG CLOSE 3 CONDITION s_Cond_LC_3_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LCC,inline="LC_cond3") s_Cond_LC_3_op= input.string(defval="crossover", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_LCC,inline="LC_cond3") s_Cond_LC_3_ind2= input.string(defval="IND3", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LCC,inline="LC_cond3") f_Cond_LC_3_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_LCC,inline="LC_cond3") //_______________LONG CLOSE 3-4 JOIN s_Cond_LC_3_join_4= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_LCC, tooltip=s_tt_comb_op) //_______________LONG CLOSE 4 CONDITION s_Cond_LC_4_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LCC,inline="LC_cond4") s_Cond_LC_4_op= input.string(defval="crossover", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_LCC,inline="LC_cond4") s_Cond_LC_4_ind2= input.string(defval="IND3", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_LCC,inline="LC_cond4") f_Cond_LC_4_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_LCC,inline="LC_cond4") //************ SHORT CLOSE CONDITIONS INPUTS //_______________SHORT CLOSE 1 CONDITION s_Cond_SC_1_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SCC,inline="SC_cond1") s_Cond_SC_1_op= input.string(defval="crossover", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_SCC,inline="SC_cond1") s_Cond_SC_1_ind2= input.string(defval="IND1", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SCC,inline="SC_cond1") f_Cond_SC_1_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_SCC,inline="SC_cond1") //_______________SHORT CLOSE 1-2 JOIN s_Cond_SC_1_join_2= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_SCC, tooltip=s_tt_comb_op) //_______________SHORT CLOSE 2 CONDITION s_Cond_SC_2_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SCC,inline="SC_cond2") s_Cond_SC_2_op= input.string(defval="crossover", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_SCC,inline="SC_cond2") s_Cond_SC_2_ind2= input.string(defval="IND2", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SCC,inline="SC_cond2") f_Cond_SC_2_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_SCC,inline="SC_cond2") //_______________SHORT CLOSE 2-3 JOIN s_Cond_SC_2_join_3= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_SCC, tooltip=s_tt_comb_op) //_______________SHORT CLOSE 3 CONDITION s_Cond_SC_3_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SCC,inline="SC_cond3") s_Cond_SC_3_op= input.string(defval="crossover", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_SCC,inline="SC_cond3") s_Cond_SC_3_ind2= input.string(defval="IND3", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SCC,inline="SC_cond3") f_Cond_SC_3_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_SCC,inline="SC_cond3") //_______________SHORT CLOSE 3-4 JOIN s_Cond_SC_3_join_4= input.string(defval="AND", title="", options=["AND","OR"] , group= s_grp_SCC, tooltip=s_tt_comb_op) //_______________SHORT CLOSE 4 CONDITION s_Cond_SC_4_ind1= input.string(defval="NONE", title="", options=[s00, s01, s02, s03, s04, s05, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SCC,inline="SC_cond4") s_Cond_SC_4_op= input.string(defval="crossover", title="", options=[op01, op02, op03, op04, op05, op06, op07, op08, op09], group= s_grp_SCC,inline="SC_cond4") s_Cond_SC_4_ind2= input.string(defval="IND3", title="", options=[s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15, s16], group= s_grp_SCC,inline="SC_cond4") f_Cond_SC_4_ind2_val=input.float( defval=0, title="", step=0.1, tooltip=s_tt_combination, group= s_grp_SCC,inline="SC_cond4") //************ END CONDITION INPUTS} //************END INPUTS} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ FUNCTIONS{ //**************** GENERIC FUNCTIONS{ //___________________PERIOD DEFINITION fn_testPeriod() => time >= t_testPeriodStart and time <= t_testPeriodStop ? true : false //___________________F_SECURITY***NOREPAINT (or Minimize it) f_security(_symbol, _res, _src, _secure) => math.round_to_mintick(_secure == 'Secure' ? request.security(_symbol, _res, _src[1], lookahead=barmerge.lookahead_on) : _secure == 'Semi Secure' ? request.security(_symbol, _res, _src[barstate.isrealtime ? 1 : 0])[barstate.isrealtime ? 0 : 1] : _secure == 'Repaint' ? request.security(_symbol, _res, _src[0])[0] : na) src_open = f_security(syminfo.tickerid, Timeframe, open, secure) src_close = f_security(syminfo.tickerid, Timeframe, close, secure) src_high = f_security(syminfo.tickerid, Timeframe, high, secure) src_low = f_security(syminfo.tickerid, Timeframe, low, secure) src_hl2 = f_security(syminfo.tickerid, Timeframe, hl2, secure) src_hlc3 = f_security(syminfo.tickerid, Timeframe, hlc3, secure) src_ohlc4 = f_security(syminfo.tickerid, Timeframe, ohlc4, secure) //src_data = f_security(syminfo.tickerid, Timeframe, fn_get_source(data), secure) src_external = f_security(syminfo.tickerid, Timeframe, data_ext, secure) //___________________Convert string sources to series sources fn_get_source(string source_) => // source_ == 'Avg Price'? close : result = switch source_ s01 => f_indicator1 s02 => f_indicator2 s03 => f_indicator3 s04 => f_indicator4 s05 => f_indicator5 s06 => 0 s07 => src_close s08 => src_open s09 => src_high s10 => src_low s11 => src_hl2 s12 => src_hlc3 s13 => src_ohlc4 s14 => volume s15 => src_external s16 => f_custom_ind =>na result fn_split(simple string s_data,sep_=".-")=> a=str.pos(s_data,sep_) result=str.substring(s_data,0,a) //**************** END GENERIC FUNCTIONS} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //**************** CUSTOM INDICATORS FUNCTIONS{ //******************** CUSTOM INDICATOR DESIGN // define custom indicator below. Define and Get input parameters from INPUTS/CUSTOM INDICATOR 1 // you can change the name of the custom indicator by updating CONSTANTS/CUSTOM INDICATORS c01="Cust Ind1" to your preffered name Ex: c01="My Custom EMA". (name should be unique and be different from other indicators names) // NOTE:!!! Custom indicators dont use the value on the SETTINGS / INDICATOR selection screen.. Just accepts the parameters on the current custom indicator(n) setting area //Builtin tradingview EMA indicator for customization example s_cind_src= input.string( defval=sma, title='IND:' , options=[hide, org, ovrly, alma, ama , acdst, cma, dema, ema, gmma, hghst, hl2ma, hma, lgAdt, lgAdV, lguer, lsrcp, lexp, linrg, lowst, mgi,pcnl, pcnli, prev , pvth, pvtl, rema, rma, sar, sma, smma, supr2, supr3, strnd, swma, tema, tma, vida, vwma, vstop, wma, vwap, nvrly, adx, angle, aroon, atr, awsom, bbr, bbw, cci, cctbb, chng, cmf, cmo, cog, cpcrv, corrl, count, cti, dev, dpo, efi, eom, fall, fit, hvo, kcr, kcw, kli, macd, mfi, msi, nvi, obv, pvi, pvt, rangs, rise, roc, rsi, rvi, smosc, smsig, stc, stdev, trix, tsi, vari, wilpc, wad, wvad] , group= s_grp_custom_ind, inline="cind_1") s_cind_data = input.string( defval="close", title='', group= s_grp_custom_ind, inline="cind_1", options=[s07, s08, s09, s10, s11, s12, s13, s14]) i_cind_len = input.int( defval=74, title='MALen', group= s_grp_custom_ind, inline="cind_1") i_cind_demlen = input.int( defval=68, title='DemLen', group= s_grp_custom_ind, inline="cind_2") i_cind_step = input.int( defval=8, title='Step', group= s_grp_custom_ind, inline="cind_2") f_cind_curv = input.float( defval=1.27, title='Curv', group= s_grp_custom_ind, inline="cind_2") f_cind_div = input.float( defval=0.5, title='div', group= s_grp_custom_ind, inline="cind_4") s_cind_sig = input.string( defval="Signal", title='Select Signal', group= s_grp_custom_ind, inline="cind_3", options=["Signal","Demarker-T","Demarker-V"]) b_cind_cross = input.bool( defval=false, title="Cross", group= s_grp_custom_ind, inline="cind_3") s_cind_pType = input.string( defval=p01, title="PType", group= s_grp_custom_ind, inline="cind_4", options=[p01,p02,p03], tooltip=s_tt_ind4) i_cind_stlen = input.int( defval=50, title='St/% val', group= s_grp_custom_ind, inline="cind_4") c_cind_color = input( defval=color.black , title="", group= s_grp_custom_ind, inline="cind_4") fn_demarker(simple int dem_length) => deMax = src_high - src_high[1] > 0 ? src_high - src_high[1] : 0 deMin = src_low[1] - src_low > 0 ? src_low[1] - src_low : 0 // sma_deMax / (sma_deMax + sma_deMin) //------------------------------- t=ta.ema(src_close,i_cind_len) a=t>src_close // sma_deMax=f_ma(deMax, dem_length, ma_type), // sma_deMin=f_ma(deMin, dem_length, ma_type) sma_deMax = a?dtu.f_func(fn_split(s_cind_src),deMax, length_=int(dem_length/f_cind_div)):dtu.f_func(fn_split(s_cind_src),deMax, length_=int(dem_length)) sma_deMin = a?dtu.f_func(fn_split(s_cind_src),deMin, length_=int(dem_length/f_cind_div)):dtu.f_func(fn_split(s_cind_src),deMax, length_=int(dem_length)) // sma_deMax := a?f_ma(deMax,int(dem_length/cr_div),ma_type):f_ma(deMin,dem_length,ma_type) // sma_deMin := a?f_ma(deMin, int(dem_length/cr_div),ma_type):f_ma(deMin, dem_length,ma_type) sma_deMax / (sma_deMax + sma_deMin) fn_cronex() => bool crossing = b_cind_cross int demarker_length = i_cind_demlen int dem_step = i_cind_step float curvature = f_cind_curv e1 = 0.0, e2 = 0.0,e3 = 0.0, e4 = 0.0, e5 = 0.0, e6 = 0.0 n = 1 + 0.5 * (demarker_length - 1) w1 = 2 / (demarker_length + 1) w2 = 1 - w1 b2 = curvature * curvature b3 = b2 * curvature c1 = -b3 c2 = (3 * (b2 + b3)) c3 = -3 * (2 * b2 + curvature + b3) c4 = (1 + 3 * curvature + b3 + 3 * b2) demarker_v = (fn_demarker(demarker_length) + fn_demarker(demarker_length + dem_step) + fn_demarker(demarker_length + dem_step * 2) + fn_demarker(demarker_length + dem_step * 3)) * 100 / 4 - 50 e1 := not na(demarker_v) ? w1 * demarker_v + w2 * e1[1] : 0 e2 := not na(demarker_v) ? w1 * e1 + w2 * e2[1] : 0 e3 := not na(demarker_v) ? w1 * e2 + w2 * e3[1] : 0 e4 := not na(demarker_v) ? w1 * e3 + w2 * e4[1] : 0 e5 := not na(demarker_v) ? w1 * e4 + w2 * e5[1] : 0 e6 := not na(demarker_v) ? w1 * e5 + w2 * e6[1] : 0 demarker_t = c1*e6 + c2*e5 + c3*e4 + c4*e3 signal = 0 if crossing signal := ta.crossover(demarker_v,demarker_t)?1:ta.crossunder(demarker_v,demarker_t)?-1:0 else signal := (demarker_v > demarker_t)? 1:-1 [signal,demarker_v,demarker_t] fn_custom_ind()=> [x,y,z]=fn_cronex() src_=s_cind_sig=="Signal"?x:s_cind_sig=="Demarker-V"?y:z f_plot_= switch s_cind_pType "Stochastic" => ta.stoch(src_, src_, src_, i_cind_stlen) / 50 - 1 "PercentRank" => ta.percentrank(src_, i_cind_stlen) / 50 - 1 "Original" => src_ => src_ f_plot_ //********************* END CUSTOM INDICATORS DEFINITIONS} //**************** CONDITION FUNCTIONS{ fn_get_Condition_Indicator(string cond_ind1_,string cond_ind2_,float cond_ind_value_)=> // if selection other than "VALUE" // and if first_ind=flse then use condition's value field for second indicator's #previous value float cond_ind_val1_ = switch cond_ind1_ s00 => 0. s01 => f_indicator1 s02 => f_indicator2 s03 => f_indicator3 s04 => f_indicator4 s05 => f_indicator5 s07 => src_close s08 => src_open s09 => src_high s10 => src_low s11 => src_hl2 s12 => src_hlc3 s13 => src_ohlc4 s14 => volume s15 => src_external s16 => f_custom_ind s06 => cond_ind_value_ => 0. float cond_ind_val2_ = switch cond_ind2_ s00 => 0. s01 => f_indicator1[cond_ind_value_] s02 => f_indicator2[cond_ind_value_] s03 => f_indicator3[cond_ind_value_] s04 => f_indicator4[cond_ind_value_] s05 => f_indicator5[cond_ind_value_] s06 => cond_ind_value_ s07 => src_close[cond_ind_value_] s08 => src_open[cond_ind_value_] s09 => src_high[cond_ind_value_] s10 => src_low[cond_ind_value_] s11 => src_hl2[cond_ind_value_] s12 => src_hlc3[cond_ind_value_] s13 => src_ohlc4[cond_ind_value_] s14 => volume[cond_ind_value_] s15 => src_external[cond_ind_value_] s16 => f_custom_ind[cond_ind_value_] => 0. [cond_ind_val1_,cond_ind_val2_] fn_get_Condition_Result(string cond_ind1_,string cond_op_,string cond_ind2_,float cond_ind2_value_)=> result=0 if fn_testPeriod() [cond_ind1_val_,cond_ind2_val_] = fn_get_Condition_Indicator(cond_ind1_,cond_ind2_, cond_ind2_value_) // cond_ind2_val_ = fn_get_Condition_Indicator(cond_ind2_, cond_ind2_value_, false) int cond_result_= switch cond_op_ op01 => ta.crossover(cond_ind1_val_,cond_ind2_val_)? 1 : -1 op02 => ta.crossunder(cond_ind1_val_,cond_ind2_val_)? 1 : -1 op03 => ta.cross(cond_ind1_val_,cond_ind2_val_)? 1 : -1 op04 => cond_ind1_val_ > cond_ind2_val_ ? 1 : -1 op05 => cond_ind1_val_ < cond_ind2_val_ ? 1 : -1 op06 => cond_ind1_val_ >= cond_ind2_val_ ? 1 : -1 op07 => cond_ind1_val_ <= cond_ind2_val_ ? 1 : -1 op08 => cond_ind1_val_ == cond_ind2_val_ ? 1 : -1 op09 => cond_ind1_val_ != cond_ind2_val_ ? 1 : -1 => 0 result:=cond_ind1_=="NONE"?0:cond_result_ result //**************** JOIN CONDITIONS fn_join_Condition_Result(int cond1_=0,int cond2_=0,int cond3_=0,int cond4_=0, string cond_1_join_2_="AND", string cond_2_join_3_="AND", string cond_3_join_4_="AND")=> bool cond_=false if cond1_!=0 cond_:=cond1_==1 if cond1_!=0 and cond2_ !=0 cond_ := switch cond_1_join_2_ "AND" => cond1_==1 and cond2_==1 "OR" => cond1_==1 or cond2_ ==1 if cond3_ !=0 cond_:= switch cond_2_join_3_ "AND" => cond_==1 and cond3_==1 "OR" => cond_==1 or cond3_==1 if cond4_ !=0 cond_:= switch cond_3_join_4_ "AND" => cond_==1 and cond4_==1 "OR" => cond_==1 or cond4_==1 result=cond_ //**************** GET CONDITIONS fn_get_conditions(string type_)=> result=false if type_=="LONG" and (s_Cond_LE_1_ind1!="NONE" or s_Cond_LE_2_ind1!="NONE" or s_Cond_LE_3_ind1!="NONE") int long_entry1=fn_get_Condition_Result(s_Cond_LE_1_ind1,s_Cond_LE_1_op,s_Cond_LE_1_ind2,f_Cond_LE_1_ind2_val) int long_entry2=fn_get_Condition_Result(s_Cond_LE_2_ind1,s_Cond_LE_2_op,s_Cond_LE_2_ind2,f_Cond_LE_2_ind2_val) int long_entry3=fn_get_Condition_Result(s_Cond_LE_3_ind1,s_Cond_LE_3_op,s_Cond_LE_3_ind2,f_Cond_LE_3_ind2_val) int long_entry4=fn_get_Condition_Result(s_Cond_LE_4_ind1,s_Cond_LE_4_op,s_Cond_LE_4_ind2,f_Cond_LE_4_ind2_val) result := fn_join_Condition_Result(cond1_=long_entry1,cond2_=long_entry2,cond3_=long_entry3,cond4_=long_entry4, cond_1_join_2_=s_Cond_LE_1_join_2, cond_2_join_3_=s_Cond_LE_2_join_3, cond_3_join_4_=s_Cond_LE_3_join_4) if type_=="SHORT" and (s_Cond_SE_1_ind1!="NONE" or s_Cond_SE_2_ind1!="NONE" or s_Cond_SE_3_ind1!="NONE") int short_entry1=fn_get_Condition_Result(s_Cond_SE_1_ind1,s_Cond_SE_1_op,s_Cond_SE_1_ind2,f_Cond_SE_1_ind2_val) int short_entry2=fn_get_Condition_Result(s_Cond_SE_2_ind1,s_Cond_SE_2_op,s_Cond_SE_2_ind2,f_Cond_SE_2_ind2_val) int short_entry3=fn_get_Condition_Result(s_Cond_SE_3_ind1,s_Cond_SE_3_op,s_Cond_SE_3_ind2,f_Cond_SE_3_ind2_val) int short_entry4=fn_get_Condition_Result(s_Cond_SE_4_ind1,s_Cond_SE_4_op,s_Cond_SE_4_ind2,f_Cond_SE_4_ind2_val) result := fn_join_Condition_Result(cond1_=short_entry1,cond2_=short_entry2,cond3_=short_entry3,cond4_=short_entry4, cond_1_join_2_=s_Cond_SE_1_join_2, cond_2_join_3_=s_Cond_SE_2_join_3, cond_3_join_4_=s_Cond_SE_3_join_4) if type_=="LONGCLOSE" and (s_Cond_LC_1_ind1!="NONE" or s_Cond_LC_2_ind1!="NONE" or s_Cond_LC_3_ind1!="NONE") int long_close1=fn_get_Condition_Result(s_Cond_LC_1_ind1,s_Cond_LC_1_op,s_Cond_LC_1_ind2,f_Cond_LC_1_ind2_val) int long_close2=fn_get_Condition_Result(s_Cond_LC_2_ind1,s_Cond_LC_2_op,s_Cond_LC_2_ind2,f_Cond_LC_2_ind2_val) int long_close3=fn_get_Condition_Result(s_Cond_LC_3_ind1,s_Cond_LC_3_op,s_Cond_LC_3_ind2,f_Cond_LC_3_ind2_val) int long_close4=fn_get_Condition_Result(s_Cond_LC_4_ind1,s_Cond_LC_4_op,s_Cond_LC_4_ind2,f_Cond_LC_4_ind2_val) result := fn_join_Condition_Result(cond1_=long_close1,cond2_=long_close2,cond3_=long_close3,cond4_=long_close4, cond_1_join_2_=s_Cond_LC_1_join_2, cond_2_join_3_=s_Cond_LC_2_join_3, cond_3_join_4_=s_Cond_LC_3_join_4) if type_=="SHORTCLOSE" and (s_Cond_SC_1_ind1!="NONE" or s_Cond_SC_2_ind1!="NONE" or s_Cond_SC_3_ind1!="NONE") int short_close1=fn_get_Condition_Result(s_Cond_SC_1_ind1,s_Cond_SC_1_op,s_Cond_SC_1_ind2,f_Cond_SC_1_ind2_val) int short_close2=fn_get_Condition_Result(s_Cond_SC_2_ind1,s_Cond_SC_2_op,s_Cond_SC_2_ind2,f_Cond_SC_2_ind2_val) int short_close3=fn_get_Condition_Result(s_Cond_SC_3_ind1,s_Cond_SC_3_op,s_Cond_SC_3_ind2,f_Cond_SC_3_ind2_val) int short_close4=fn_get_Condition_Result(s_Cond_SC_4_ind1,s_Cond_SC_4_op,s_Cond_SC_4_ind2,f_Cond_SC_4_ind2_val) result := fn_join_Condition_Result(cond1_=short_close1,cond2_=short_close2,cond3_=short_close3,cond4_=short_close4, cond_1_join_2_=s_Cond_SC_1_join_2, cond_2_join_3_=s_Cond_SC_2_join_3, cond_3_join_4_=s_Cond_SC_3_join_4) result //**************** CONDITION FUNCTIONS} //************ END FUNCTIONS} fn_paramVer(simple string pver_)=> int ver_=switch pver_ v01 => 1 v02 => 2 ver_ fn_factorVer(simple string fver_)=> int ver_=switch fver_ f01 => 1 f02 => 2 f03 => 3 f04 => 4 ver_ // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ CUSTOM INDICATOR CALCULATIONS{ f_custom_ind:=fn_custom_ind() //dont change "float custom_ind". this is result of the indicator used by the system //******END CUSTOM INDICATORS CALCULATIONS} //**************** INDICATORS CALCULATIONS{ if s_ind1_src!=hide and b_plt1_ind!=false s_ind1_data_=fn_get_source(s_ind1_data) f_indicator1:=dtu.fn_factor(FuncType_=fn_split(s_ind1_src), src_data_=s_ind1_data_, length_=f_ind1_len, p1=f_ind1_p1, p2=f_ind1_p2, version_=fn_paramVer(s_ind1_ver), fact_=fn_factorVer(s_ind1_fact), plotingType_=s_ind1_pType, stochlen_=i_ind1_stlen, plotSWMA_=b_ind1_pSWMA, log_=s_ind1_log) if s_ind2_src!=hide and b_plt2_ind!=false s_ind2_data_=fn_get_source(s_ind2_data) f_indicator2:=dtu.fn_factor(FuncType_=fn_split(s_ind2_src), src_data_=s_ind2_data_, length_=f_ind2_len, p1=f_ind2_p1, p2=f_ind2_p2, version_=fn_paramVer(s_ind2_ver), fact_=fn_factorVer(s_ind2_fact), plotingType_=s_ind2_pType, stochlen_=i_ind2_stlen, plotSWMA_=b_ind2_pSWMA, log_=s_ind2_log) if s_ind3_src!=hide and b_plt3_ind!=false s_ind3_data_=fn_get_source(s_ind3_data) f_indicator3:=dtu.fn_factor(FuncType_=fn_split(s_ind3_src), src_data_=s_ind3_data_, length_=f_ind3_len, p1=f_ind3_p1, p2=f_ind3_p2, version_=fn_paramVer(s_ind3_ver), fact_=fn_factorVer(s_ind3_fact), plotingType_=s_ind3_pType, stochlen_=i_ind3_stlen, plotSWMA_=b_ind3_pSWMA, log_=s_ind3_log) if s_ind4_src!=hide and b_plt4_ind!=false s_ind4_data_=fn_get_source(s_ind4_data) f_indicator4:=dtu.fn_factor(FuncType_=fn_split(s_ind4_src), src_data_=s_ind4_data_, length_=f_ind4_len, p1=f_ind4_p1, p2=f_ind4_p2, version_=fn_paramVer(s_ind4_ver), fact_=fn_factorVer(s_ind4_fact), plotingType_=s_ind4_pType, stochlen_=i_ind4_stlen, plotSWMA_=b_ind4_pSWMA, log_=s_ind4_log) if s_ind5_src!=hide and b_plt5_ind!=false s_ind5_data_=fn_get_source(s_ind5_data) f_indicator5:=dtu.fn_factor(FuncType_=fn_split(s_ind5_src), src_data_=s_ind5_data_, length_=f_ind5_len, p1=f_ind5_p1, p2=f_ind5_p2, version_=fn_paramVer(s_ind5_ver), fact_=fn_factorVer(s_ind5_fact), plotingType_=s_ind5_pType, stochlen_=i_ind5_stlen, plotSWMA_=b_ind5_pSWMA, log_=s_ind5_log) //**************** END INDICATORS CALCULATIONS} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ SIGNAL CALCULATIONS{ bool long= fn_get_conditions("LONG") bool short= fn_get_conditions("SHORT") bool longclose= fn_get_conditions("LONGCLOSE") bool shortclose= fn_get_conditions("SHORTCLOSE") if b_isopposite longclose:= longclose or short shortclose:=shortclose or long //************END SIGNAL CALCULATIONS} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ ALERTS{ alertcondition(long, title="Long", message="LONG") alertcondition(short, title="Short", message="SHORT") alertcondition(longclose, title="Close Long", message="CLOSE LONG") alertcondition(longclose, title="Close Short",message="CLOSE SHORT") //************END ALERTS{ // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //************ PLOTs{ //_________PLOT TYPE CALCULATIONS FOR HLINES fn_plot(float indicator_, simple string pType_, simple int stoch_)=> float result= switch pType_ p01 => indicator_ p02 => i_ind_shift + (indicator_ * i_ind_mult) p03 => i_ind_shift + (indicator_ * i_ind_mult) result //p01='Original' , p02='Stochastic' , p03='PercentRank' , p04='Org. Range (-1,1)' //_________PLOT INDICATORS (if Indicator PlotType is "Original" plot over chart otherwise plot between HLines) plot(s_ind1_src!=hide ? fn_plot(indicator_=f_indicator1, pType_=s_ind1_pType, stoch_=i_ind1_stlen):na, "",c_ind1_color) plot(s_ind2_src!=hide ? fn_plot(indicator_=f_indicator2, pType_=s_ind2_pType, stoch_=i_ind2_stlen):na, "",c_ind2_color) plot(s_ind3_src!=hide ? fn_plot(indicator_=f_indicator3, pType_=s_ind3_pType, stoch_=i_ind3_stlen):na, "",c_ind3_color) plot(s_ind4_src!=hide ? fn_plot(indicator_=f_indicator4, pType_=s_ind4_pType, stoch_=i_ind4_stlen):na, "",c_ind4_color) plot(s_ind5_src!=hide ? fn_plot(indicator_=f_indicator5, pType_=s_ind5_pType, stoch_=i_ind5_stlen):na, "",c_ind5_color) plot(s_cind_src!=hide ? fn_plot(indicator_=f_custom_ind, pType_=s_cind_pType, stoch_=i_cind_stlen):na, "",c_cind_color) //plot(s_ind1_src!=hide ? (s_ind1_pType=="Original"?f_indicator1: i_ind_shift + (f_indicator1 * i_ind_mult)):na, "",c_ind1_color) //plot(s_ind2_src!=hide ? (s_ind2_pType=="Original"?f_indicator2: i_ind_shift + (f_indicator2 * i_ind_mult)):na, "",c_ind2_color) //plot(s_ind3_src!=hide ? (s_ind3_pType=="Original"?f_indicator3: i_ind_shift + (f_indicator3 * i_ind_mult)):na, "",c_ind3_color) //plot(s_ind4_src!=hide ? (s_ind4_pType=="Original"?f_indicator4: i_ind_shift + (f_indicator4 * i_ind_mult)):na, "",c_ind4_color) //plot(s_ind5_src!=hide ? (s_ind5_pType=="Original"?f_indicator5: i_ind_shift + (f_indicator5 * i_ind_mult)):na, "",c_ind5_color) //_________SHOW REAL INDICATOR VALUES ON DATA WINDOW plotshape(s_ind1_src!=hide ? f_indicator1:na, "INDICATOR1", text="",color=color.new(c_ind1_color,100)) plotshape(s_ind2_src!=hide ? f_indicator2:na, "INDICATOR2", text="",color=color.new(c_ind2_color,100)) plotshape(s_ind3_src!=hide ? f_indicator3:na, "INDICATOR3", text="",color=color.new(c_ind3_color,100)) plotshape(s_ind4_src!=hide ? f_indicator4:na, "INDICATOR4", text="",color=color.new(c_ind4_color,100)) plotshape(s_ind5_src!=hide ? f_indicator5:na, "INDICATOR5", text="",color=color.new(c_ind5_color,100)) plotshape(s_cind_src!=hide ? f_custom_ind:na, "IND CUSTOM", text="",color=color.new(c_cind_color,100)) //_________PLOT HLINE for Stochastic/Precentage/Org Range(-1,1) between range -1 and 1 hline(b_ind_hline?i_ind_shift + (1 * i_ind_mult):na, title="LINE 1", linestyle=hline.style_dashed ,color=color.new(color.black, 0)) hline(b_ind_hline?i_ind_shift + (0.5 *i_ind_mult):na, title="LINE 0.5", linestyle=hline.style_dashed ,color=color.new(color.black, 75)) hline(b_ind_hline?i_ind_shift + (0 * i_ind_mult):na, title="LINE 0", linestyle=hline.style_dashed ,color=color.new(color.black, 0)) hline(b_ind_hline?i_ind_shift + (-0.5*i_ind_mult):na, title="LINE -0.5",linestyle=hline.style_dashed ,color=color.new(color.black, 75)) hline(b_ind_hline?i_ind_shift + (-1 * i_ind_mult):na, title="LINE -1", linestyle=hline.style_dashed ,color=color.new(color.black, 0)) //_________PLOT ALERTS for LONG at Bottom and for SHORT at TOP of the screen plotshape(b_plotalert ? long : na, title='LONG', style=shape.triangleup, location=location.bottom, color=color.new(color.green, 0),size=size.tiny) plotshape(b_plotalert ? short : na, title='SHORT', style=shape.triangledown, location=location.top, color=color.new(color.blue, 0), size=size.tiny) plotshape(b_plotalert ? longclose : na, title='EXIT LONG', style=shape.triangledown, location=location.bottom, color=color.new(color.red, 0), size=size.tiny) plotshape(b_plotalert ? shortclose : na, title='EXIT SHORT',style=shape.triangleup, location=location.top, color=color.new(color.black, 0),size=size.tiny) //************END PLOTs} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ //********** INDICATOR's SIGNALS EXPORT{ // Followings are for my personal usage on my own strategy framework. // Created Parallel data transfer algorithm (@DTurkuler) // With this algo all builded signals can be transferred to another strategy/indicator without interferring with another signal longCondition =long shortCondition = short ExitlongCondition = longclose ExitshortCondition = shortclose s_signalVersion= input.string(defval="Strategy Framework v2 @DTU", title="Output Signal for Framework", options=["Strategy Framework v1 @DTU", "Strategy Framework v2 @DTU", "Ultimate Strategy Template @Devatt", "Backtesting & Trading Engine @Pinecoders" , "Strategy Template @Benson", "Custom"], group=s_grp_signal, inline="sig1", tooltip=s_tt_signals) //Folowing inputs are used for custom signal output design lCon = input.int( title='Long Entry', defval= 1, group=s_grp_signal, inline="sig2" ) sCon = input.int( title='Short Entry', defval=-1, group=s_grp_signal, inline="sig2" ) lConExit = input.int( title='Long Exit', defval= 2, group=s_grp_signal, inline="sig3" ) sConExit = input.int( title='Short Exit', defval=-2, group=s_grp_signal, inline="sig3" ) f_signalEncoder()=> int i_SignalVersion=switch s_signalVersion "Strategy Framework v1 @DTU" => 1 "Strategy Framework v2 @DTU" => 2 "Ultimate Strategy Template @Devatt" => 3 "Backtesting & Trading Engine @Pinecoders" => 4 "Strategy Template @Benson" => 5 "Custom Values" => 6 => na float f_Signal_=0 if i_SignalVersion==1 //_______________DATA ENCODER V1 //is used prepare indicator values as signal for my Strategy Framework v1 DTU. //Signal data added as to the fractional part //Long Entry Signals //(10:Long Entry 20:Long Exit 30:No Operation) f_Signal_ := longCondition ? 10 : ExitlongCondition ? 20 : 30 //Short Entry Signals //(10:Long Entry 20:Long Exit 30:No Operation) f_Signal_ := f_Signal_ + (shortCondition ? 1 : ExitshortCondition ? 2 : 3) //TODO: Entry/Exit Filter Signals (1:Entry 2:No Entry 3:No Operation) //Signal1 := Signal1 + (entryFilter ? 100 : exitFilter ? 200 : 300) //TODO: Trend Filter Signals (1:Up 2:down 3:Sideways) //Signal1 := Signal1 + (trend==1 ? 1000 : trend==-1 ? 2000 : 3000) if i_SignalVersion==2 //_______________DATA ENCODER V2 //(Set precision to 4) //is used prepare indicator values as signal for my Strategy Framework v1 DTU. //plot the indicator values over the stock by using close value. //Signal data shifted to digit area and close value added as carrier to the fractional part f_Signal_ := longCondition ? 10 : ExitlongCondition ? 20 : 30 f_Signal_ := f_Signal_ + (shortCondition ? 1 : ExitshortCondition ? 2 : 3) float f_carrier=int(close) f_Signal_:=0.0001*f_Signal_ f_Signal_+=f_carrier if i_SignalVersion==3 //_______________DATA ENCODER V3 //is used prepare indicator values as a signal for @Daveatt's "Ultimate Strategy Template" f_Signal_ := longCondition ? 1 : shortCondition ? -1 : ExitlongCondition ? 2 : ExitshortCondition ? -2 : 0 if i_SignalVersion==4 //_______________DATA ENCODER V4 //is used prepare indicator values as a signal for @Pinecoders's "Backtesting & Teading Engine" f_Signal_ := longCondition ? 1 : shortCondition ? -1 : ExitlongCondition ? 2 : ExitshortCondition ? -2 : 0 if i_SignalVersion==5 //_______________DATA ENCODER V5 //is used prepare indicator values as a signal for @Benson's "Strategy Template" f_Signal_ := longCondition ? 1 : shortCondition ? -1 : ExitlongCondition ? 2 : ExitshortCondition ? -2 : 0 if i_SignalVersion==6 //_______________DATA ENCODER V6 //is used prepare indicator values as a signal by using custom values f_Signal_ := longCondition ? lCon : shortCondition ? sCon : ExitlongCondition ? lConExit : ExitshortCondition ? sConExit : 0 f_Signal_ plot(f_signalEncoder(), title='πŸ”ŒConnectorπŸ”Œ', color=color.new(color.blue,100)) //************END INDICATOR's SIGNALS EXPORT} // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ ////************************************************ ////************ STRATEGY DEFINITIONS{ ////************************************************ ////For indicator usage: Mark following lines ////and Change strategy(....) to indicator(....) at start of the code ////________________STRATEGY ENTRIES & EXITS //if fn_testPeriod() and long //// strategy.entry("buy",strategy.long,alert_message=web_hook("Buy",close,bot_json)) // strategy.entry("buy", strategy.long, alert_message="L",comment="L") // //if fn_testPeriod() and short //// strategy.entry("sell",strategy.short,alert_message=web_hook("Sell",close,bot_json)) // strategy.entry("sell",strategy.short,alert_message="S",comment="S") // //if fn_testPeriod() and longclose //// strategy.close_all(alert_message=web_hook("Close",close,bot_json)) // strategy.close("buy", alert_message="CL",comment="CL") // //if fn_testPeriod() and shortclose //// strategy.close_all(alert_message=web_hook("Close",close,bot_json)) // strategy.close("sell",alert_message="CS",comment="CS") ////------------------------------------------------------------- // ////_____________SHOW PROFIT // Should be improved I am stucked !!! //s_showProfit= input.string( defval="None", title="Show Profit", options=["None", "Open+Net Profit", "Current Profit" ], group=s_grp_strategy,inline="show profit") //i_showProfit_trans= input.int( defval=80, title="Transparency", group=s_grp_strategy,inline="show profit", tooltip=s_tt_Profit) // //fn_get_profit_bytype(string s_profitType_)=> // float f_profit_=switch s_profitType_ // "None" => na // "Open+Net Profit"=> (strategy.netprofit+strategy.openprofit) // "Open Profit" => strategy.openprofit // f_profit_ //var openposprof= array.new_float(0) // //float cur=0. //float max=1. //float min=0. //if s_showProfit!="None" // array.push(openposprof,fn_get_profit_bytype(s_showProfit)/strategy.initial_capital) // cur:=array.get(openposprof,bar_index) // max:=array.max(openposprof) // min:=array.min(openposprof) //float f_profit=cur/ (max - min) //f_profitper=f_profit // //fill(plot(s_showProfit!="None"?i_ind_shift + (f_profit * i_ind_mult):na, title="",color=f_profit<0?color.new(color.red,i_showProfit_trans):color.new(color.green,i_showProfit_trans)), // plot(s_showProfit!="None"?i_ind_shift:na, title="",color=color.new(color.white,100)), // f_profit<0?color.new(color.red,i_showProfit_trans+5):color.new(color.green,i_showProfit_trans+5)) //Fill area on Profit value on between hlines //plotshape(s_showProfit!="None"?f_profit*100:na, title="PROFIT%",text="",color=color.new(color.white,100)) //Show Real Profit value on Data Window ////************END STRATEGY DEFINITIONS} // //
[JL] TEMA Difference - Divergence and Double HH/LL
https://www.tradingview.com/script/z8ofv30G-JL-TEMA-Difference-Divergence-and-Double-HH-LL/
Jesse.Lau
https://www.tradingview.com/u/Jesse.Lau/
109
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/ // Β© jesselau76 //@version=5 indicator(title="[JL] TEMA Difference", shorttitle="TEMAD", max_bars_back = 4900) // Getting inputs fast_length = input.int(50,title="Fast Length") slow_length = input.int(150,title="Slow Length") src = input.source(close,title="Source") atr_length = input.int(20,title="ATR Length") useATR = input(true, title='Use ATR to compare difference') // Plot colors col_grow_above = #26A69A col_grow_below = #FFCDD2 col_fall_above = #B2DFDB col_fall_below = #EF5350 //TEMA function tema(src,length) => ema1 = ta.ema(src, length) ema2 = ta.ema(ema1, length) ema3 = ta.ema(ema2, length) out = 3 * (ema1 - ema2) + ema3 out // Calculating fast_ma = tema(src, fast_length) slow_ma = tema(src, slow_length) atr = ta.atr(atr_length) mad = useATR ? (fast_ma - slow_ma)/atr : fast_ma - slow_ma plot(mad, title="MAD", style=plot.style_columns, color=(mad>=0 ? (mad[1] < mad ? col_grow_above : col_fall_above) : (mad[1] < mad ? col_grow_below : col_fall_below) ), transp=0 ) turnGreen = mad[1]<0 and mad >0 turnRed = mad[1]>0 and mad <0 // //plotshape(turnGreen, style = shape.triangleup, location = location.bottom, color = color.green, size=size.small) // //plotshape(turnRed, style = shape.triangledown, location = location.top, color = color.red, size=size.small) // // Alerts // alertcondition(turnGreen, title= "Long_MAD", message= "{{ticker}} LONG") // alertcondition(turnRed, title= "Short_MAD", message= "{{ticker}} SHORT") // barsturngreen = ta.barssince(turnGreen) // barsturngreen2 = ta.barssince(turnGreen[1]) // barsturnred = ta.barssince(turnRed) // barsturnred2 = ta.barssince(turnRed[1]) // phigh = ta.pivothigh(mad, barsturngreen, 1) // plow = ta.pivotlow(mad, barsturnred, 1) // phigh2 = ta.pivothigh(mad, barsturngreen2, 1) // plow2 = ta.pivotlow(mad, barsturnred2, 1) // barssincePhigh = ta.barssince(phigh) // barssincePlow = ta.barssince(plow) // barsturngreen = 1 // phigh = 0.0 // barsturnred = 1 // plow = 0.0 // barssincePhigh = 0 // barssincePlow = 0 barsturngreen = bar_index - ta.valuewhen(turnGreen, bar_index, 0) barsturngreen2 = bar_index - ta.valuewhen(turnGreen, bar_index, 1) barsturnred = bar_index - ta.valuewhen(turnRed, bar_index, 0) barsturnred2 = bar_index - ta.valuewhen(turnRed, bar_index, 1) barsg = barsturngreen>0 ? barsturngreen : 1 phigh = ta.highest(mad, barsg) h1 = ta.highest(high,barsg) barsr = barsturnred>0 ? barsturnred : 1 plow = ta.lowest(mad,barsr) l1 = ta.lowest(low,barsr) // plot(phigh,color=color.white) // plot(h1,color=color.white) // barssincePhigh = ta.barssince(mad==phigh) // barssincePlow = ta.barssince(mad==plow) //plot(barsturngreen2,color=color.white) // plow = ta.lowest(mad, barsturnred+1) // barssincePlow = ta.barssince(plow) if turnRed and h1[1]>h1[barsturnred2+1] and phigh[1]<phigh[barsturnred2+1] label1 = label.new(bar_index[1], phigh[barsturnred2+1] , text="Top Divergence", style = label.style_label_down, color = color.red, textcolor=color.white, size=size.large) if turnGreen and l1[1]<l1[barsturngreen2+1] and plow[1]>plow[barsturngreen2+1] label2 = label.new(bar_index[1], plow[barsturngreen2+1], text="Bottom Divergence", style = label.style_label_up, color = color.green, textcolor=color.white, size=size.large) if turnRed and h1[1]<h1[barsturnred2+1] and phigh[1]<phigh[barsturnred2+1] label1 = label.new(bar_index[1], phigh[barsturnred2+1] , text="Double Lower High", style = label.style_label_down, color = color.red, textcolor=color.white, size=size.large) if turnGreen and l1[1]>l1[barsturngreen2+1] and plow[1]>plow[barsturngreen2+1] label2 = label.new(bar_index[1], plow[barsturngreen2+1], text="Double Higher Low", style = label.style_label_up, color = color.green, textcolor=color.white, size=size.large)
5 emaS setup
https://www.tradingview.com/script/f4qo9ta4-5-emaS-setup/
ADNANOFAGRI
https://www.tradingview.com/u/ADNANOFAGRI/
8
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/ // Β© ADNANOFAGRI //@version=5 indicator("57 emaS setup", overlay=true) ema5 = ta.ema(close, 5) ema8 = ta.ema(close, 8) ema9 = ta.ema(close, 9) ema20 = ta.ema(close, 20) ema21 = ta.ema(close, 21) ema34 = ta.ema(close, 34) ema50 = ta.ema(close, 50) ema100 = ta.ema(close, 100) ema200 = ta.ema(close, 200) //alertSell = (low) //alertBuy = (high) //fast2 = (ta.ema(close, 5))+10 //xalertSell = ta.crossunder(ema5, alertSell) //xalertBuy =ta.crossover(ema5, alertBuy) //xSell = xalertSell>low plot(ema5,color=color.yellow, title="ema5") plot(ema8,color=color.white, title="ema8") plot(ema9,color=color.blue, title="ema9") plot(ema20,color=color.orange, title="ema20") plot(ema21,color=color.purple, title="ema21") plot(ema34,color=color.teal, title="ema34") plot(ema50,color=color.green, title="ema50") plot(ema100,color=color.gray, title="ema100") plot(ema200,color=color.red, title="ema200") //if alertSell > //plotchar(xalertSell, title="Sell", color=color.red) //sell =ta.crossunder(ema5, alertSell) //plotshape(sell, style=shape.labeldown, location= location.abovebar, color=color.red, title= "Sell", text="sell") //plotchar(xalertBuy, title="Buy", color=color.teal, location = location.belowbar) //plotchar(ta.crossunder(fast,ema), char='⇩', location = location.abovebar, color = color.red, text = "down", textcolor = color.red) //plot(close)
EIA Crude Oil Stock Statistics
https://www.tradingview.com/script/8IxXbr9e/
FX365_Thailand
https://www.tradingview.com/u/FX365_Thailand/
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/ // Β© FX365_Thailand //Revision history //v22.0 First release //@version=5 indicator('EIA Crude Oil Stock Statistics', shorttitle='EIA Crude Oil Stock', overlay=false) //Constants usoil_stock_code = 'EIA/PET_WCESTUS1_W' usoil_SPR_stock_code = 'EIA/WCSSTUS1' //Logic //Declare function to get data get_data_0(datacode) => request.quandl(datacode, barmerge.gaps_off, 0) //Get data //Ending stock excluding SPR data_l_0 = get_data_0(usoil_stock_code) //Ending stock of SPR data_l_1 = get_data_0(usoil_SPR_stock_code) //Calculate stock changes from previous week diff = data_l_0 - data_l_0[1] //Calculate % change from previous week diff_pct = diff / data_l_0[1] * 100 //Plot using plot plot(data_l_0, color=color.new(color.orange, 0), title='Crude Oil Ending Stock', style=plot.style_columns) plot(data_l_1, color=color.new(color.blue, 0), title='Crude Oil SPR Ending Stock', style=plot.style_stepline, linewidth=2) plot(diff, color=color.new(color.red, 0), title='Stock changes', style=plot.style_area) plot(diff_pct, color=color.new(color.blue, 0), title='% changes')
Alts/USDT.D ratio
https://www.tradingview.com/script/TyAxALAQ-Alts-USDT-D-ratio/
alex.crown.jr
https://www.tradingview.com/u/alex.crown.jr/
66
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/ // Β© alex.crown.jr import boitoki/ma_function/3 as ma nonRepaintingSecurity(sym, tf, src) => request.security(sym, tf, src[1], lookahead = barmerge.lookahead_on) //@version=5 indicator("Alts/USDT.D ratio", overlay=false) sym_a = input.symbol("CRYPTOCAP:USDT.D", "Symbol A") sym_b = input.symbol("CRYPTOCAP:OTHERS.D", "Symbol B") ma_type = input.string("EMA", options=["EMA", "SMA", "RMA", "WMA", "VWMA", "HMA", "TMA", "DEMA", "TEMA", "MAV", "KAMA", "ZLEMA"]) length = input(50, "MA length") ma_ratio = ma.ma_function(ma_type, close, length) ratio = nonRepaintingSecurity(sym_a+"/"+sym_b, "D", close) ma_ratio_sec = nonRepaintingSecurity(sym_a+"/"+sym_b, "D", ma_ratio) f1 = plot(ma_ratio_sec, color=color.new(color.red, 0)) f2 = plot(ratio, color=color.new(color.green, 0)) fill(f1, f2, color = ma_ratio_sec > ratio ? color.new(color.green, 50) : color.new(color.red, 50))
Dynamic Fibonacci Pivot Points & EMA Crossovers
https://www.tradingview.com/script/bx9JfK9a-Dynamic-Fibonacci-Pivot-Points-EMA-Crossovers/
PrawinPandey
https://www.tradingview.com/u/PrawinPandey/
243
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/ // Β© PrawinPandey // @version=5 indicator("Pivot Point, Fibonacci Levels, OHLC & EMA", "Pivot/OHLC/EMA", overlay=true) ohlc_tip = "This will show the OHLC for selected range. If you select D then todays high-lows and previous days high-lows both will show up, same applies for Weekly and other timeframe's as well." centrepptip = "This will show Centre Pivot Point lines for Daily, Weekly and Monthly timeframes atonce." //Pivot Point bs = input.bool(title="Enable Buy and Sell Indicator", defval=true, inline="BS", group="Buy and Sell Indicator", tooltip='This is initial release and not advised to follow it blindly. Use it on your own risk.') cpp = input.bool(title="Enable/Disable Centre PP", defval=false, tooltip = centrepptip) pivotpointsohlc = input.string(title="Timeframe", defval="D", options=["D", "W", "M", "3M", "6M", "12M"], inline="SPP", group="Fibonacci Pivot Points & OHLC") fbpp = input.bool(title="Fibonacci", defval=true, inline="SPP", group="Fibonacci Pivot Points & OHLC") ohlc = input.bool(title="OHLC", defval=false, inline="SPP", group="Fibonacci Pivot Points & OHLC") fibonaccilevels = input.string(title="Timeframe", defval="W", options=["D", "W", "M", "3M", "6M", "12M"], inline="DPP", group="Fibonacci Levels") dfl = input.bool(title="Dynamic", defval=false, inline="DPP", group="Fibonacci Levels") ffl = input.bool(title="Fixed", defval=false, inline="DPP", group="Fibonacci Levels") //OHLC for different timeframes [dOpen, dHigh, dLow, pHigh, pLow, pClose] = request.security(syminfo.tickerid, pivotpointsohlc, [open, high, low, high[1], low[1], close[1]], barmerge.gaps_off, barmerge.lookahead_on) [DHigh, DLow, fHigh, fLow] = request.security(syminfo.tickerid, fibonaccilevels, [high, low, high[1], low[1]], barmerge.gaps_off, barmerge.lookahead_on) [High, Low, Close] = request.security(syminfo.tickerid, "D", [high[1], low[1], close[1]], barmerge.gaps_off, barmerge.lookahead_on) [HIgh, LOw, CLose] = request.security(syminfo.tickerid, "W", [high[1], low[1], close[1]], barmerge.gaps_off, barmerge.lookahead_on) [HIGH, LOW, CLOsE] = request.security(syminfo.tickerid, "M", [high[1], low[1], close[1]], barmerge.gaps_off, barmerge.lookahead_on) //Calculation dRange = DHigh-DLow pRange = pHigh-pLow fRange = fHigh-fLow //CPP Calculation dcpp = (High + Low + Close) / 3.0 wcpp = (HIgh + LOw + CLose) / 3.0 mcpp = (HIGH + LOW + CLOsE) / 3.0 //Dynamic Range P1 = DHigh - dRange * 0.000 P2 = DHigh - dRange * 0.236 P3 = DHigh - dRange * 0.382 DP = DHigh - dRange * 0.500 P4 = DHigh - dRange * 0.618 P5 = DHigh - dRange * 0.764 P6 = DHigh - dRange * 1.000 //Fixed Range FP1 = fHigh - fRange * 0.000 FP2 = fHigh - fRange * 0.236 FP3 = fHigh - fRange * 0.382 FDP = fHigh - fRange * 0.500 FP4 = fHigh - fRange * 0.618 FP5 = fHigh - fRange * 0.764 FP6 = fHigh - fRange * 1.000 //Fibonacci SPP = (pHigh + pLow + pClose) / 3.0 PR1 = SPP + pRange * 0.382 PR2 = SPP + pRange * 0.618 PR3 = SPP + pRange * 1.000 PS1 = SPP - pRange * 0.382 PS2 = SPP - pRange * 0.618 PS3 = SPP - pRange * 1.000 //Dynamic Plots plot(dfl and P1 ? P1 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Dynamic R3", linewidth=2) plot(dfl and P2 ? P2 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Dynamic R2", linewidth=2) plot(dfl and P3 ? P3 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Dynamic R1", linewidth=2) plot(dfl and DP ? DP : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Dynamic PP", linewidth=2) plot(dfl and P4 ? P4 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Dynamic S1", linewidth=2) plot(dfl and P5 ? P5 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Dynamic S2", linewidth=2) plot(dfl and P6 ? P6 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Dynamic S3", linewidth=2) //Fixed Plots plot(ffl and FP1 ? FP1 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Fixed R3", linewidth=2) plot(ffl and FP2 ? FP2 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Fixed R2", linewidth=2) plot(ffl and FP3 ? FP3 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Fixed R1", linewidth=2) plot(ffl and FDP ? FDP : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Fixed PP", linewidth=2) plot(ffl and FP4 ? FP4 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Fixed S1", linewidth=2) plot(ffl and FP5 ? FP5 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Fixed S2", linewidth=2) plot(ffl and FP6 ? FP6 : na, style=plot.style_stepline, color=color.new(color.gray,65), title="Fixed S3", linewidth=2) //Fibonacci Plots plot(fbpp and PR3 ? PR3 : na, style=plot.style_stepline, color=color.new(color.orange,0), title="Fibonacci R3") plot(fbpp and PR2 ? PR2 : na, style=plot.style_stepline, color=color.new(color.orange,0), title="Fibonacci R2") plot(fbpp and PR1 ? PR1 : na, style=plot.style_stepline, color=color.new(color.orange,0), title="Fibonacci R1") plot(fbpp and SPP ? SPP : na, style=plot.style_stepline, color=color.new(color.purple,0), title="Fibonacci PP") plot(fbpp and PS1 ? PS1 : na, style=plot.style_stepline, color=color.new(color.orange,0), title="Fibonacci S1") plot(fbpp and PS2 ? PS2 : na, style=plot.style_stepline, color=color.new(color.orange,0), title="Fibonacci S2") plot(fbpp and PS3 ? PS3 : na, style=plot.style_stepline, color=color.new(color.orange,0), title="Fibonacci S3") //Centre Pivot Points plot(cpp and dcpp ? dcpp : na, style=plot.style_stepline, color=color.new(color.purple,0), title="Daily CPP", linewidth=1) plot(cpp and wcpp ? wcpp : na, style=plot.style_stepline, color=color.new(color.purple,0), title="Weekly CPP", linewidth=2) plot(cpp and mcpp ? mcpp : na, style=plot.style_stepline, color=color.new(color.purple,0), title="Monthly CPP", linewidth=2) //OHLC Plots p1 = plot(ohlc and dOpen ? dOpen : na, style=plot.style_stepline, color=color.new(color.gray,90), title="Current Open") plot(ohlc and dHigh ? dHigh : na, style=plot.style_circles, color=color.new(#13EC13,50), title="Current High") plot(ohlc and dLow ? dLow : na, style=plot.style_circles, color=color.new(#FF0000,50), title="Current Low") plot(ohlc and pHigh ? pHigh : na, style=plot.style_stepline, color=color.new(#13EC13,0), title="Previous High") plot(ohlc and pLow ? pLow : na, style=plot.style_stepline, color=color.new(#FF0000,0), title="Previous Low") p2 = plot(ohlc and pClose ? pClose : na, style=plot.style_stepline, color=color.new(color.blue,0), title="Previous Close") fill(p1, p2, color=color.new(color.gray,90)) //EMA ema = input.bool(title="EMA 14/21", defval=true, inline="EMA", group="EMA Crossover") ema_a = input.bool(title="EMA 50/100", defval=false, inline="EMA", group="EMA Crossover") ema_b = input.bool(title="EMA 150/200", defval=false, inline="EMA", group="EMA Crossover") ema_14 = ta.ema(close, 14) ema_21 = ta.ema(close, 21) ema_50 = ta.ema(close, 50) ema_100 = ta.ema(close, 100) ema_150 = ta.ema(close, 150) ema_200 = ta.ema(close, 200) plot(ema and ema_14 ? ema_14 : na, title="EMA 14", color=color.new(color.red,0), linewidth=1) plot(ema and ema_21 ? ema_21 : na, title="EMA 21", color=color.new(color.teal,0), linewidth=1) plot(ema_a and ema_50 ? ema_50 : na, title="EMA 50", color=color.new(color.red,0), linewidth=2) plot(ema_a and ema_100 ? ema_100 : na, title="EMA 100", color=color.new(color.teal,0), linewidth=2) plot(ema_b and ema_150 ? ema_150 : na, title="EMA 150", color=color.new(color.red,0), linewidth=2) plot(ema_b and ema_200 ? ema_200 : na, title="EMA 200", color=color.new(color.teal,0), linewidth=2) //Variables GC = open < close //Green Candle RC = open > close //Red Candle MC = (open + close)/2 //Middle Candle CB = math.abs(close - open) //Candle Body CR = high - low //Candle Range US = high - math.max(open, close) //Upper Shadow LS = math.min(open, close) - low //Lower Shadow //Label Position LL = low - (ta.atr(30) * 0.6)//Label Low LH = high + (ta.atr(30) * 0.6)//Label High //SPINNING CANDLE BLSC = (US <= CB and LS > 5 * CB) BRSC = (US > 5 * CB and LS <= CB) SCBuy = BLSC[1] and GC SCSell = BRSC[1] and RC if SCBuy and bs label.new(bar_index, LL, text="Buy", style=label.style_label_up, color = color.green, size=size.small, textcolor=color.white, tooltip='Buying pressure.') if SCSell and bs label.new(bar_index, LH, text="Sell", style=label.style_label_down, color = color.red, size=size.small, textcolor=color.white, tooltip='Selling pressure.') //---END---\\
Volume Weighted Volitility MACD
https://www.tradingview.com/script/yOQJ1KVc-Volume-Weighted-Volitility-MACD/
mohitkrishna010
https://www.tradingview.com/u/mohitkrishna010/
51
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/ // Β© mohitkrishna010 //@version=4 study("Volume Weighted Volitility") //+++++++++++ Inputs +++++++++++++++++++++++++++++++++++++++++++++// src_input = input(hlc3, title="Source", type=input.source) period = input(10, title="Volitility Period", minval=1, group="VWV settings") usevwap = input(true,group="VWAP(true) or Hamming Volume Weighted Moving Average(False)") Hlength = input(200, title="HWVMA", type=input.integer, minval=1, maxval=500, group="MACD settings") fastperiod = input(12, title="fastperiod MACD", type=input.integer, minval=1, maxval=500, group="MACD settings") slowperiod = input(26, title="slowperiod MACD", type=input.integer, minval=1, maxval=500, group="MACD settings") signalperiod = input(9, title="signalperiod MACD", type=input.integer, minval=1, maxval=500, group="MACD settings") kalman = input(true,group="Kalman Filter") klength = input(14,group="Kalman Filter") ac = input(true,title="Lag Reduction",group="Kalman Filter") f_kalman_filter(_src,length,ac) => AC = ac ? 1 : 0 out = 0. K = 0. src = _src + (_src - nz(out[1],_src)) out := nz(out[1],src) + nz(K[1])*(src - nz(out[1],src)) + AC*(nz(K[1])*(src - sma(src,length))) K := abs(src - out)/(abs(src - out) + stdev(src,length)*length) out f_HVWMA(src,length) => c=int(na) pi = 3.14159265359 c := nz(c[1],1) == length ? 1 : nz(c[1],1) + 1 s = 1/length h_ = volume * (0.54 - 0.46 * cos((2*pi*c)/length )) hwma = sum(h_*src,length)/sum(h_,length) src = src_input totalVolume = sum(volume, period) vwap_ = usevwap?vwap:f_HVWMA(src,Hlength) vwv_=sqrt(volume*pow(src-vwap_,2)/totalVolume) vwv = kalman?f_kalman_filter(vwv_,klength,ac):vwv_ fastMA = ema(vwv, fastperiod) slowMA = ema(vwv, slowperiod) macd = fastMA - slowMA signal = ema(macd,signalperiod) hist = macd - signal plot(macd, color=color.blue, linewidth=2) plot(signal, color=color.red, linewidth=2) plot(hist, color=hist>hist[1]?#CA64EA:#7719AA, linewidth=4, style=plot.style_histogram) plot(0, color=color.black)
Void Finder
https://www.tradingview.com/script/ckFZnF4m-Void-Finder/
jeemitsha2
https://www.tradingview.com/u/jeemitsha2/
33
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/ // Β© Travelling_Trader //@version=4 study("Void Finder", overlay=true,max_lines_count=500) boxlength = input(title="Box Length", type=input.integer, defval=1, minval=1, maxval=10, group = "Void Parameters") color c_up = input(color.green, "Color Up", type = input.color, group = "Void Parameters") color c_down = input(color.red, "Color Down", type = input.color, group = "Void Parameters") bool showdiractionalvoids = input(type=input.bool, defval=false, title="Show Voids only of the direction of Moving Average", group = "Void Parameters") len = input(3, minval=1, title="Length", group = "Moving Average Parameters") src = input(close, title="Source", group = "Moving Average Parameters") offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500, group = "Moving Average Parameters") out = sma(src, len) plot(out, color=color.blue, title="MA", offset=offset) if showdiractionalvoids UpVoid=close[1]<open[0] and (out[1] < out [0]) UpVoidsize=open[0] - close[1] if UpVoid and UpVoidsize>0 BOX1 = box.new(left=bar_index[1], top=open[0], right=bar_index[0]+boxlength, bottom=close[1]) box.set_bgcolor (BOX1,c_up) box.set_border_color (BOX1,c_up) else UpVoid=close[1]<open[0] UpVoidsize=open[0] - close[1] if UpVoid and UpVoidsize>0 BOX1 = box.new(left=bar_index[1], top=open[0], right=bar_index[0]+boxlength, bottom=close[1]) box.set_bgcolor (BOX1,c_up) box.set_border_color (BOX1,c_up) if showdiractionalvoids BottomVoid=close[1] > open[0] and (out[0] < out [1]) BottomVoidsize=close[1] - open[0] if BottomVoid and BottomVoidsize>0 BOX2 = box.new(left=bar_index[1], top=close[1], right=bar_index[0]+boxlength, bottom=open[0]) box.set_bgcolor (BOX2,c_down) box.set_border_color (BOX2,c_down) else BottomVoid=close[1] > open[0] BottomVoidsize=close[1] - open[0] if BottomVoid and BottomVoidsize>0 BOX2 = box.new(left=bar_index[1], top=close[1], right=bar_index[0]+boxlength, bottom=open[0]) box.set_bgcolor (BOX2,c_down) box.set_border_color (BOX2,c_down)
My MACD
https://www.tradingview.com/script/ZqmUaXKY-My-MACD/
csmottola71
https://www.tradingview.com/u/csmottola71/
51
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/ // Β© csmottola71 //@version=4 study("My MACD") fMa = input(title="Fast MA", type=input.integer, defval=21) sMa = input(title="Slow MA", type=input.integer, defval=55) fm = ema(close, fMa) sm = ema(close, sMa) maS = fm - sm hlc = (high+low+close)/3 cd = hlc - sm plot(maS, style=plot.style_histogram, color = maS > 0 ? color.green : color.red) plot(cd, color=color.white)
Favorite Signals w/EMA Filter
https://www.tradingview.com/script/78gdXUo8-Favorite-Signals-w-EMA-Filter/
duronic12
https://www.tradingview.com/u/duronic12/
270
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/ // Β© duronic12 //@version=5 indicator('Price Action Signals & Filters', overlay=true, max_bars_back=500, timeframe="", timeframe_gaps=true) //USER INPUTS\\ //Select Long Signals _1 = input.bool(defval=false, title= "═════════ LONG SIGNALS ════════", tooltip="These signals are very reliable in confirming a reversal, especially when used with emas, vwap, fibs or support and resistance levels. ") enableBuyTD8 = input.bool(title='TD8', defval=true) enableBuyTD9 = input.bool(title='TD9', defval=true) enableHamm = input.bool(title='Hammer', defval=true) enableBull = input.bool(title='Bullish Harami', defval=true) enableRSIBuy = input.bool(title='RSI Divergence', defval=true) //Select Short Signals _2 = input.bool(false, "═════════ SHORT SIGNALS ════════", tooltip="These signals are very reliable in confirming a reversal, especially when used with emas, vwap, fibs or support and resistance levels. ") enableSellTD8 = input.bool(title='TD8', defval=true) enableSellTD9 = input.bool(title='TD9',defval=true) enableStar = input.bool(title='Shooting Star', defval=true) enableBear = input.bool(title='Bearish Harami', defval=true) enableRSISell = input.bool(title='RSI Divergence', defval=true) // Filters Signals _3 = input.bool(false, "═══════════ FILTER ════════════", tooltip="The filters do a great job at cutting out market noise. If swing trading you may wish to just use the VWAP anchored to the Weekly or higher (see VWAP SETTINGS). If day trading, you may wish to use the EMA for entry signals and the VWAP for exit signals.") MD0 = "Both" MD1 = "Long Only" MD2 = "Short Only" markerDirection = input.string(MD0, "Signal Side", options = [MD0, MD1, MD2]) sm1 = "Off" sm2 = "EMA" sm3 = "VWAP" markerDirectionL = input.string(sm2, "Long Filter", options = [sm1, sm2, sm3]) sm4 = "Off" sm5 = "EMA" sm6 = "VWAP" markerDirectionS = input.string(sm6, "Short Filter", options = [sm4, sm5, sm6]) longsOnly = markerDirection == MD1 shortsOnly = markerDirection == MD2 showMarker1 = markerDirectionL == sm1 showMarker2 = markerDirectionL == sm2 showMarker3 = markerDirectionL == sm3 showMarker4 = markerDirectionS == sm4 showMarker5 = markerDirectionS == sm5 showMarker6 = markerDirectionS == sm6 //EMA Filter OPtions _5 = input.bool(false, "════════ EMA SETTINGS ══════════", tooltip="The EMA filter reduces signals to only those that occure as follows: Long Signal < Fast EMA & Med EMA > Slow EMA (--POSSIBLE LONG--); Short Signal > Fast EMA & Med EMA > Slow EMA (--POSSIBLE SHORT/TIGHTEN STOP/REDUCE POSITION--); Short Signal > Fast EMA & Med EMA < Slow EMA (--POSSIBLE SHORT--); Long Signal < Fast EMA & Med EMA < Slow EMA (--POSSIBLE LONG/TIGHTEN STOP /REDUCE POSITION--).") showEMAs = input(true, title="Show EMAs") EMAhideonDWM = input(true, title="Hide EMA plots on 1D charts or above", tooltip="Great for a clean chart when drawing support and resitance etc on the daily or higher.") Flen = input.int(10, title="Fast Length") Fsrc = input.source(hlc3, 'Source') FastEMA = ta.ema(Fsrc, Flen) Mlen = input.int(20, title="Med Length") Msrc = input.source(hlc3, 'Source') MedEMA = ta.ema(Msrc, Mlen) Slen = input.int(50, title="Slow Length") Ssrc = input.source(hlc3, 'Source') SlowEMA = ta.ema(Ssrc, Slen) //VWAP Filter Options _7 = input.bool(false, "════════ VWAP SETTINGS ═════════ ", tooltip="The VWAP reduces signals to only those that occure as follows: Long Signal < VWAP Cloud Bottom (--POSSIBLE LONG--); Short Signal > VWAP Cloud Top (--POSSIBLE SHORT--). If trading over longer periods of time, you can increase the Anchor Period to Week or higher. Also, you can adjust the VWAP Cloud St Dev to your liking with fib levels e.g. 0.618, 0.786, 1.000, 1.618 etc.") showVWAP = input.bool(defval=true, title='Show VWAP Cloud') hideonDWM = input(true, title="Hide VWAP plots on 1D charts or above", tooltip ="Great for a clean chart when drawing support and resitance etc on the daily or higher.") stdevMult = input(0.786, title="VWAP Cloud St Dev") var anchor = input.string(defval = "Session", title="Anchor Period", options=["Session", "Week", "Month", "Quarter", "Year", "Decade", "Century", "Earnings", "Dividends", "Splits"]) vwapsrc = input(title = "Source", defval = hlc3) offset = input(0, title="Offset") //RSI Divergence Signal Options _6 = input.bool(false, "═════ RSI DIVERGENCE SETTINGS ═════", tooltip="The RSI Divergence signal highlights the first bar after a devergence between Price and RSI has occured. For more details please check @LonesomeTheBlue's RSI Tops and Bottoms.") len = input.int(14, minval=1, title='Length') src = input.source(hlc3, 'Source') ob = input.int(defval=60, title='Overbought (OB)') os = input.int(defval=40, title='Oversold (OS)') prd = input.int(defval=1000, title='Max Bars in OB/OS') mindis = input.int(defval=0, title='Min Bars between OB/OS Signals') maxdis = input.int(defval=1000, title='Max Bars between OB/OS Signals') //HAMMER & SHOOTING STAR SIGNAL DETECTION\\ Hamm = math.abs(low - open) > math.abs(open - close) * 2 and low <= ta.lowest(low, 10) and math.abs(low - open) > math.abs(high - close) * 2 and close <= open[1] Star = math.abs(high - open) > math.abs(open - close) * 2 and high >= ta.highest(high, 10) and math.abs(high - open) > math.abs(low - close) * 2 and open <= close[1] HammB = enableHamm and Hamm StarS = enableStar and Star //BULLISH & BEARISH HARAMI SIGNAL DETETCION\\ Bull = open[1] > close[1] and close > open and close <= open[1] and close[1] <= open and math.abs(close - open) < open[1] - close[1] Bear = close[1] > open[1] and open > close and open <= close[1] and open[1] <= close and math.abs(open - close) < close[1] - open[1] BullB = enableBull and Bull BearS = enableBear and Bear //TD8&9 SIGNAL DETECTION\\ buySignals = 0 buySignals := close < close[4] ? buySignals[1] == 9 ? 1 : buySignals[1] + 1 : 0 sellSignals = 0 sellSignals := close > close[4] ? sellSignals[1] == 9 ? 1 : sellSignals[1] + 1 : 0 BuyOrSell = math.max(buySignals, sellSignals) TD8buy = enableBuyTD8 and buySignals and BuyOrSell == 8 TD9buy = enableBuyTD9 and buySignals and BuyOrSell == 9 TD8sell = enableSellTD8 and sellSignals and BuyOrSell == 8 TD9sell = enableSellTD9 and sellSignals and BuyOrSell == 9 //RSI DIVERGENCE DETECTION\\ rsi = ta.rsi(src, len) var bool belowos = false var int oscount = 0 belowos := rsi[1] >= os and rsi < os ? true : rsi > os ? false : belowos oscount := belowos ? oscount + 1 : not belowos ? 0 : oscount var float lastlowestrsi = na var float lastlowestprice = na var int lastlowestbi = na var bool itsfineos = false bool maygoup = false if belowos[1] and not belowos and nz(oscount[1]) > 0 lastlowestrsi := 101 lastlowestbi := bar_index itsfineos := true for x = 1 to oscount[1] by 1 if x > prd itsfineos := false itsfineos if rsi[x] < lastlowestrsi lastlowestrsi := rsi[x] lastlowestbi := bar_index - x lastlowestprice := low[x] lastlowestprice if ta.change(lastlowestrsi) != 0 and lastlowestrsi and lastlowestrsi[1] and lastlowestrsi > lastlowestrsi[1] and lastlowestprice < lastlowestprice[1] and bar_index - lastlowestbi[1] < maxdis and itsfineos and itsfineos[1] and bar_index - lastlowestbi[1] > mindis // line.new(x1=bar_index, y1=lastlowestrsi, x2=lastlowestbi[1], y2=lastlowestrsi[1]) maygoup := true maygoup var bool aboveob = false var int obcount = 0 aboveob := rsi[1] <= ob and rsi > ob ? true : rsi < ob ? false : aboveob obcount := aboveob ? obcount + 1 : not aboveob ? 0 : obcount var float lasthighestrsi = na var float lasthighestprice = na var int lasthighestbi = na var bool itsfineob = false bool maygodown = false if aboveob[1] and not aboveob and nz(obcount[1]) > 0 lasthighestrsi := -1 lasthighestbi := bar_index itsfineob := true for x = 1 to obcount[1] by 1 if x > prd itsfineob := false itsfineob if rsi[x] > lasthighestrsi lasthighestrsi := rsi[x] lasthighestbi := bar_index - x lasthighestprice := high[x] lasthighestprice if ta.change(lasthighestrsi) != 0 and lasthighestrsi and lasthighestrsi[1] and lasthighestrsi < lasthighestrsi[1] and lasthighestprice > lasthighestprice[1] and bar_index - lasthighestbi[1] < maxdis and itsfineob and itsfineob[1] and bar_index - lasthighestbi[1] > mindis // line.new(x1=bar_index, y1=lasthighestrsi, x2=lasthighestbi[1], y2=lasthighestrsi[1]) maygodown := true maygodown RSIbuy = enableRSIBuy and maygoup RSIsell = enableRSISell and maygodown //VWAP FILTER DETECTION\\ showBands = showMarker1 or showMarker2 or showMarker3 or showMarker4 or showMarker5 or showMarker6 var cumVol = 0. cumVol += nz(volume) if barstate.islast and cumVol == 0 runtime.error("No volume is provided by the data vendor.") computeVWAP(vwapsrc, isNewPeriod, stDevMultiplier) => var float sumSrcVol = na var float sumVol = na var float sumSrcSrcVol = na sumSrcVol := isNewPeriod ? vwapsrc * volume : vwapsrc * volume + sumSrcVol[1] sumVol := isNewPeriod ? volume : volume + sumVol[1] // sumSrcSrcVol calculates the dividend of the equation that is later used to calculate the standard deviation sumSrcSrcVol := isNewPeriod ? volume * math.pow(vwapsrc, 2) : volume * math.pow(vwapsrc, 2) + sumSrcSrcVol[1] _vwap = sumSrcVol / sumVol variance = sumSrcSrcVol / sumVol - math.pow(_vwap, 2) variance := variance < 0 ? 0 : variance stDev = math.sqrt(variance) lowerBand = _vwap - stDev * stDevMultiplier upperBand = _vwap + stDev * stDevMultiplier [_vwap, lowerBand, upperBand] timeChange(period) => ta.change(time(period)) new_earnings = request.earnings(syminfo.tickerid, earnings.actual, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true) new_dividends = request.dividends(syminfo.tickerid, dividends.gross, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true) new_split = request.splits(syminfo.tickerid, splits.denominator, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true) isNewPeriod = switch anchor "Earnings" => not na(new_earnings) "Dividends" => not na(new_dividends) "Splits" => not na(new_split) "Session" => timeChange("D") "Week" => timeChange("W") "Month" => timeChange("M") "Quarter" => timeChange("3M") "Year" => timeChange("12M") "Decade" => timeChange("12M") and year % 10 == 0 "Century" => timeChange("12M") and year % 100 == 0 => false isEsdAnchor = anchor == "Earnings" or anchor == "Dividends" or anchor == "Splits" if na(vwapsrc[1]) and not isEsdAnchor isNewPeriod := true float vwapValue = na float std = na float upperBandValue = na float lowerBandValue = na if not (hideonDWM and timeframe.isdwm) [_vwap, bottom, top] = computeVWAP(vwapsrc, isNewPeriod, stdevMult) vwapValue := _vwap upperBandValue := showBands ? top : na lowerBandValue := showBands ? bottom : na //DEFINE LONG VS SHORT\\ LongSignals = HammB or BullB or TD8buy or TD9buy or RSIbuy ShortSignals = StarS or BearS or TD8sell or TD9sell or RSIsell GoLong = LongSignals GoShort = ShortSignals //DEFINIE FILTER CONDITIONS\\ //Conditions C1U = GoLong//UNFILTERED LONGS C2U = GoLong and hlc3 <= FastEMA and MedEMA > SlowEMA or GoLong and hlc3 <= FastEMA and MedEMA < SlowEMA //EMA LONG/CLOSE SHORT C3U = GoLong and hlc3 <= lowerBandValue //VWAP LONG C4D = GoShort //UNFILTERED SHORTS C5D = GoShort and hlc3 >= FastEMA and MedEMA > SlowEMA or GoShort and hlc3 >= FastEMA and MedEMA < SlowEMA //EMA SHORT/CLOSE SHORT C6D = GoShort and hlc3 >= upperBandValue //VWAP SHORT //Assembly A1U = showMarker1 and not shortsOnly and C1U A2U = showMarker2 and not shortsOnly and C2U A3U = showMarker3 and not shortsOnly and C3U A4D = showMarker4 and not longsOnly and C4D A5D = showMarker5 and not longsOnly and C5D A6D = showMarker6 and not longsOnly and C6D //PLOT SIGNALS & FILTERS\\ //Signal Plots var cMarkerUp = color.new(#33ff33, 0) var cMarkerDn = color.new(#ff2226, 0) SL = A1U or A2U or A3U plotshape(SL, "Long Signal", shape.arrowup, location.belowbar, cMarkerUp, size = size.tiny, display = display.none) BL = A1U or A2U or A3U barcolor(color=BL ? cMarkerUp : na) SS = A4D or A5D or A6D plotshape(SS, "Short Signal", shape.arrowdown, location.abovebar, cMarkerDn, size = size.tiny, display = display.none) BS = A4D or A5D or A6D barcolor(color=BS ? cMarkerDn : na) //EMA Plots hideEMA = EMAhideonDWM and timeframe.isdwm showEMA = showEMAs and not hideEMA plot(showEMA ? FastEMA : na, title = "Fast EMA", color = #9598a1) plot(showEMA ? MedEMA : na, title = "Med EMA", color = #33ff33) plot(showEMA ? SlowEMA : na, title = "Slow EMA", color = #ff2226) //VWAP Plots plot(vwapValue, title = "VWAP", color=#2962FF, display = display.none) upperBand = plot(upperBandValue, title="VWAP Cloud Top", color = #2962FF, display = display.none) lowerBand = plot(lowerBandValue, title="VWAP Cloud Bottom", color = #2962FF, display = display.none) fill(upperBand, lowerBand, title="VWAP Cloud", color= showVWAP ? color.new(#9598a1, 80) : na) //CREATE SIGNAL ALERTS\\ allalerts = A1U or A2U or A3U or A4D or A5D or A6D indicatorAbbreviation = "Price Action" alertcondition(allalerts, indicatorAbbreviation + '- Filtered Signals', indicatorAbbreviation + '- Alert for {{ticker}} on {{exchange}}')
Fisher Cycle Adaptive, Fisher Transform [loxx]
https://www.tradingview.com/script/F1OAdyqZ-Fisher-Cycle-Adaptive-Fisher-Transform-loxx/
loxx
https://www.tradingview.com/u/loxx/
121
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='Fisher Cycle Adaptive, Fisher Transform [loxx]', shorttitle='FCAFT [loxx]', timeframe="", timeframe_gaps=true, max_bars_back = 5000) src = input.source(hl2, title='Source', group = "Basic Settings") lenr = input.int(7, minval=2, step = 1, title='Length', group = "Basic Settings") cycle_selection = input.string("Fixed", title = "Calculation Method", options = ["Fixed", "Fisher Cycle"], group = "Advanced Settings") wave_selector = input.int(50, title = "Percent of Wave (%)", minval = 10, maxval = 100, group = "Advanced Settings")/100 fisherOb1 = input.float(2, minval=1, step = 0.1, title='Custom Overbought Level', group = "Thresholds") fisherOs1 = input.float(-2, maxval=-1, step = 0.1, title='Custom Oversold Level', group = "Thresholds") showbarcolor = input.bool(true, title = "Color Bars?", group = "UI Options") greencolor = #2DD204 redcolor = #D2042D round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val counter_inner = 0 len_new = math.round(nz(counter_inner[1], counter_inner) * wave_selector) len_new_mod = len_new < 2 ? 2 : len_new len_final = cycle_selection == "Fixed" ? lenr : len_new_mod high_ = ta.highest(src, len_final) low_ = ta.lowest(src, len_final) value = 0.0 value := round_(.66 * ((src - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) fish1_pre = 0.0 fish1_pre := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1_pre[1]) fish2_pre = fish1_pre[1] fish1 = nz(fish1_pre, 0) fish2 = nz(fish2_pre, 0) ff = 0.001 ff1 = -0.001 if (fish1 > 0.0) while ff > 0.00 and counter_inner < 4000 ff := fish1[counter_inner] counter_inner := counter_inner + 1 if (fish1 < 0.0) while ff1 < 0.00 and counter_inner < 4000 ff1 := fish1[counter_inner] counter_inner := counter_inner + 1 barcolor(showbarcolor ? fish1> 0 ? greencolor : redcolor : na) plot(fisherOb1+2.5, color = color.new(color.white, 100), title = "Upper UI Constraint") plot(fisherOs1-2.5, color = color.new(color.white, 100), title = "Lower UI Constraint") tl = plot(fisherOb1+1, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 2") tl1 = plot(fisherOb1, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "OB Level 1") bassisF = plot(0, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero") bl1 = plot(fisherOs1, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "OS Level 1") bl = plot(fisherOs1-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") fp1 = plot(fish1, color =fish2 > 0 and fish1 > fish2 ? greencolor : (fish2 > 0 or fish1 > fish2) and fish2 > 0 ? color.gray : fish2 < 0 and fish1 < fish2 ? redcolor : color.gray, title='Fisher', linewidth = 3) fill(fp1, bassisF, color = fish2 > 0 ? color.new(greencolor, 70) : color.new(redcolor, 70)) alertcondition(ta.crossover(fish1, fish2), title="Crossover Generic", message="Fisher: Crossover Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(ta.crossunder(fish1, fish2), title="Crossunder Generic", message="Fisher: Crossunder Short\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(ta.crossover(fish1, 0), title="Zero Crossover", message="Fisher: Zero Crossover Long\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(ta.crossunder(fish1, 0), title="Zero Crossunder", message="Fisher: Zero Crossunder Short\nSymbol: {{ticker}}\nPrice: {{close}}")
Trendalix Entries
https://www.tradingview.com/script/QGIlOuP9-Trendalix-Entries/
MarkLudgate
https://www.tradingview.com/u/MarkLudgate/
76
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/ // Β© MarkLudgate //@version=5 indicator("Trendalix Entries", overlay =true) tf = timeframe.period ticker = syminfo.ticker market_type = syminfo.type unix_end_in_secs = timenow/1000 unix_in_secs = time/1000 unix_no_break = unix_in_secs secs = time-time[1] show_candles = input(title="Show candle gap filled", defval=true) show_entry_stop = input(title="Show entry/stop lines", defval=false) if syminfo.type == 'stock' or syminfo.type == 'index' show_entry_stop:=true show_mas = input(title="Show MAs", defval=true) _open = open _high = high _low = low _close = close c_open = _close[1] atr = ta.atr(30) // dont change will break labels // sma_temp = ta.sma(src, length) // smma(src, length) => // smma = 0.0 // smma := na(smma[1]) ? sma_tem : (smma[1] * (length - 1) + src) / length // smma ma_5 = ta.sma(_close, 5) ma_10 = ta.sma(_close, 10) ma_20 = ta.sma(_close, 20) ma_30 = ta.sma(_close, 30) ma_50 = ta.sma(_close, 50) ma_100 = ta.sma(_close, 100) ma_150 = ta.sma(_close, 150) ma_200 = ta.sma(_close, 200) ma_400 = ta.sma(_close, 400) // for stocks hl_price = (_high+_low)/2 //~~~~~~~~~~~~~~~~~~~~~~~~~ aligator_a_ini = ta.sma(close, 10) aligator_b_ini = ta.sma(close, 20) aligator_c_ini = ta.sma(close, 30) aligator_a = aligator_a_ini[5] aligator_b = aligator_b_ini[7] aligator_c = aligator_c_ini[10] if(syminfo.type != 'crypto' or tf!='D') aligator_a := ma_30 aligator_b := ma_50 aligator_c := ma_100 // PLOT CANDLE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // up_col = color.lime // down_col = color.red up_col = #00ffe9 down_col = #ff4930 up_col_b = color.aqua down_col_b = color.fuchsia mas_up = color.green mas_down = color.red up_dull = #005c54 down_dull = #6b0d00 color cand_col = color.yellow if _close > c_open cand_col := up_col if _close < c_open cand_col := down_col // // highest lowest ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // highs_3 = highest(_high, 3) highs_5 = ta.highest(_high, 5) highs_10 = ta.highest(_high, 10) highs_20 = ta.highest(_high, 20) // highs_50 = highest(_high, 50) // lows_3 = lowest(_low, 3) lows_5 = ta.lowest(_low, 5) lows_10 = ta.lowest(_low, 10) lows_20 = ta.lowest(_low, 20) // lows_50 = ta.lowest(_low, 50) // FRACTALS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ get_fracs(h_xx, high_this, low_this, highs_arr,lows_arr, mid_bar, unix_in_secs)=> fr_h = high_this[mid_bar*h_xx] >= highs_arr fr_l = low_this[mid_bar*h_xx] <=lows_arr since_fr_h = ta.barssince(fr_h) since_fr_l = ta.barssince(fr_l) fr_h_a = ta.valuewhen(fr_h, high_this[mid_bar*h_xx], 0*h_xx) fr_l_a = ta.valuewhen(fr_l, low_this[mid_bar*h_xx], 0*h_xx) fr_h_b = ta.valuewhen(fr_h, high_this[mid_bar*h_xx], 1*h_xx) fr_l_b = ta.valuewhen(fr_l, low_this[mid_bar*h_xx], 1*h_xx) fr_h_c = ta.valuewhen(fr_h, high_this[mid_bar*h_xx], 2*h_xx) fr_l_c = ta.valuewhen(fr_l, low_this[mid_bar*h_xx], 2*h_xx) fr_h_d = ta.valuewhen(fr_h, high_this[mid_bar*h_xx], 3*h_xx) fr_l_d = ta.valuewhen(fr_l, low_this[mid_bar*h_xx], 3*h_xx) h_a_time = ta.valuewhen(fr_h, unix_in_secs[mid_bar*h_xx], 0*h_xx) l_a_time = ta.valuewhen(fr_l, unix_in_secs[mid_bar*h_xx], 0*h_xx) h_b_time = ta.valuewhen(fr_h, unix_in_secs[mid_bar*h_xx], 1*h_xx) l_b_time = ta.valuewhen(fr_l, unix_in_secs[mid_bar*h_xx], 1*h_xx) h_c_time = ta.valuewhen(fr_h, unix_in_secs[mid_bar*h_xx], 2*h_xx) l_c_time = ta.valuewhen(fr_l, unix_in_secs[mid_bar*h_xx], 2*h_xx) h_d_time = ta.valuewhen(fr_h, unix_in_secs[mid_bar*h_xx], 3*h_xx) l_d_time = ta.valuewhen(fr_l, unix_in_secs[mid_bar*h_xx], 3*h_xx) [fr_h_a, fr_l_a, fr_h_b, fr_l_b, fr_h_c, fr_l_c, fr_h_d, fr_l_d, fr_h, fr_l, h_a_time, l_a_time, h_b_time, l_b_time, h_c_time, l_c_time, h_d_time, l_d_time, since_fr_h, since_fr_l] frac_opt_highs = ta.highest(high, 9) frac_opt_lows = ta.lowest(low, 9) frac_opt_mid = 5 if syminfo.type == 'stock' frac_opt_highs := ta.highest(high, 15) frac_opt_lows := ta.lowest(low, 15) frac_opt_mid := 7 // [fr_h_a, fr_l_a, fr_h_b, fr_l_b, fr_h_c, fr_l_c, fr_h_d, fr_l_d,fr_h_5, fr_l_5, h_a_time, l_a_time, h_b_time, l_b_time, h_c_time, l_c_time, h_d_time, l_d_time, since_fr_h, since_fr_l] = get_fracs(1, _high, _low, highs_5, lows_5, 2, unix_in_secs) [fr_h_a, fr_l_a, fr_h_b, fr_l_b, fr_h_c, fr_l_c, fr_h_d, fr_l_d,fr_h_5, fr_l_5, h_a_time, l_a_time, h_b_time, l_b_time, h_c_time, l_c_time, h_d_time, l_d_time, since_fr_h, since_fr_l] = get_fracs(1, _high, _low, frac_opt_highs, frac_opt_lows, frac_opt_mid, unix_in_secs) min_frac_lows = math.min(fr_l_a, fr_l_b) stop_buffer = (atr/5) color col_a = #32a8a4 color col_b = mas_up color fillColourA = #32a8a4 //#424242 color fillColourB = #32a8a4 color fillColourC = #32a8a4 // --------------------------------------------- // --------------------------------------------- // STOCKS // sell_line_ini_stocks = ta.lowest(_low, 30) // sell_line_stocks = sell_line_ini_stocks[20] sell_line_stocks = fr_l_a if sell_line_stocks > lows_10 sell_line_stocks:= lows_10 if syminfo.type !='stock' and syminfo.type !='index' sell_line_stocks:=na is_stock_entry = false float buy_entry = na float buy_stop = na float stock_entry = fr_h_a // if stock_entry>highs_5 // stock_entry:=highs_5 stock_stop = fr_l_a if stock_stop>lows_10 stock_stop:=lows_10 since_low_under_50 = ta.barssince(_low<ma_50) if (syminfo.type =='stock' or syminfo.type =='index') and show_entry_stop == true if (ma_100>ma_200 or ma_100>ma_150 or ma_50>ma_100 or ma_50>ma_200 ) and ma_200>ma_400 if close < stock_entry and stock_entry>ma_200 if since_low_under_50<=10 is_stock_entry:=true buy_entry:= (stock_entry+stop_buffer) buy_stop:= (stock_stop-stop_buffer) // sell_line_stocks:=na // plotshape(is_stock_entry, style=shape.arrowup, location=location.belowbar, color=color.lime, size=size.tiny, title = 'sock entry') plot(series=buy_entry, title='stock: buy line', linewidth=1, color=color.lime, style=plot.style_linebr, join=true, offset=0) plot(series=buy_stop, title='stock: buy stop', linewidth=1, color=color.orange, style=plot.style_linebr, join=true, offset=0) plot(series=(sell_line_stocks-stop_buffer), title='stock sell line', linewidth=1, color=color.new(color.fuchsia, 35), style=plot.style_linebr, join=true) if ma_50 < ma_100 fillColourA:=mas_down col_a:=mas_down if ma_100 < ma_200 fillColourB:=mas_down col_b:=mas_down if ma_200 < ma_400 fillColourC:=mas_down ma_a_stock = ma_50 ma_b_stock = ma_100 ma_c_stock = ma_200 ma_d_stock = ma_400 if show_mas == false or (syminfo.type !='stock' and syminfo.type !='index' ) ma_a_stock := na ma_b_stock := na ma_c_stock := na ma_d_stock := na col_a_transp = color.new(col_a, 100) col_b_transp = color.new(col_b, 100) p1 = plot(series=ma_a_stock, title='stock ma a', linewidth=1, color=col_a_transp, style=plot.style_linebr, join=true, offset=0) p2 = plot(series=ma_b_stock, title='stock ma b', linewidth=1, color=col_b_transp, style=plot.style_linebr, join=true, offset=0) p3 = plot(series=ma_c_stock, title='stock ma c', linewidth=1, color=col_b_transp, style=plot.style_linebr, join=true, offset=0) ma_100_col = color.new(mas_up, 40) if _close<ma_400 ma_100_col:=color.new(mas_down, 40) p4 = plot(series=ma_d_stock, title='stock ma 400', linewidth=1, color=ma_100_col, style=plot.style_linebr, join=true, offset=0) fillA = color.new(fillColourA, 65) fillB = color.new(fillColourB, 50) fillC = color.new(fillColourC, 80) fill(plot1=p1, plot2=p2, title='stock cloud a-b', color=fillA, editable=true) fill(plot1=p2, plot2=p3, title='stock cloud b-c', color=fillB, editable=true) fill(plot1=p3, plot2=p4, title='stock cloud c-d', color=fillC, editable=true) //----------------------------- //----------------------------- // CRYPTO color col_a_crypto = mas_up color col_b_crypto = mas_up color fillColourA_crypto = color.new(#32a8a4, 60) //#424242 color fillColourB_crypto = color.new(#32a8a4, 50) if aligator_a < aligator_b fillColourA_crypto:=color.new(mas_down, 70) col_a_crypto:=mas_down if aligator_b < aligator_c fillColourB_crypto:=color.new(mas_down, 80) col_b_crypto:=mas_down ma_a_crypto = aligator_a ma_b_crypto = aligator_b ma_c_crypto = aligator_c ma_d_crypto = ma_100 sell_line = fr_l_a lows_15 = ta.lowest(_low, 15) if sell_line < lows_15 sell_line := lows_15 if show_mas == false or syminfo.type !='crypto' ma_a_crypto := na ma_b_crypto := na ma_c_crypto := na ma_d_crypto := na sell_line:=na //plot(series=(buy_line+stop_buffer), title='crypto buy line', linewidth=1, color=color.new(color.teal, 35), style=plot.style_linebr, join=true) plot(series=(sell_line-stop_buffer), title='crypto sell line', linewidth=1, color=color.new(color.fuchsia, 35), style=plot.style_linebr, join=true) col_a_crypto_transp = color.new(col_a_crypto, 100) col_b_crypto_transp = color.new(col_b_crypto, 100) p1_crypto = plot(series=ma_a_crypto, title='crypto ma a', linewidth=1, color=col_a_crypto_transp, style=plot.style_linebr, join=true, offset=0) p2_crypto = plot(series=ma_b_crypto, title='crypto ma b', linewidth=1, color=col_b_crypto_transp, style=plot.style_linebr, join=true, offset=0) p3_crypto = plot(series=ma_c_crypto, title='crypto ma c', linewidth=1, color=col_b_crypto_transp, style=plot.style_linebr, join=true, offset=0) ma_100_col_crypto = color.new(mas_up, 30) if _close<ma_d_crypto ma_100_col_crypto:= color.new(mas_down, 30) plot(series=ma_d_crypto , title='crypto ma 100', linewidth=2, color=ma_100_col_crypto, style=plot.style_linebr, join=true, offset=0) // fillA_crypto = color.new(fillColourA_crypto, 60) // fillB_crypto = color.new(fillColourB_crypto, 50) fill(plot1=p1_crypto, plot2=p2_crypto, title='crypto cloud a-b', color=fillColourA_crypto) fill(plot1=p2_crypto, plot2=p3_crypto, title='crypto cloud b-c', color=fillColourB_crypto) //----------------------------- //----------------------------- // FOREX // line_a = ta.sma(close, 20)[20] // line_b = ta.sma(close, 20)[20] // line_c = ta.sma(close, 50)[50] // if show_mas == false or (syminfo.type !='forex' and syminfo.type !='cfd') // line_b:=na // line_c:=na // cloud_high = math.max(line_b, line_c) // cloud_low = math.min(line_b, line_c) // cloud_high_p = plot(series=cloud_high , title='forex line a', linewidth=1, color=color.white) // cloud_low_p = plot(series=cloud_low , title='forex line b', linewidth=1, color=color.yellow) // cloud_fill_col = color.new(color.yellow, 50) // fill(plot1=cloud_high_p, plot2=cloud_low_p, title='forex cloud a-b', color=cloud_fill_col) if show_candles == false c_open := na _high := na _low := na _close := na plotcandle(c_open, _high, _low, _close, title='No Gap Candle', color=cand_col, wickcolor=cand_col, bordercolor=cand_col)
Market Breadth EMAs
https://www.tradingview.com/script/aTNJmB0x-Market-Breadth-EMAs/
OverexposedPhotoOfADress
https://www.tradingview.com/u/OverexposedPhotoOfADress/
55
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/ // Β© OverexposedPhotoOfADress //@version=5 indicator("Market Breadth EMAs") s20 = request.security("S5TW", "D", close) // 20 Day s50 = request.security("S5FI", "D", close) // 50 Day s100 = request.security("S5OH", "D", close) // 100 Day s200 = request.security("S5TH", "D", close) // 200 Day plot(s20, color=color.green, linewidth=2) plot(s50, color=color.yellow, linewidth=2) plot(s100, color=color.orange, linewidth=2) plot(s200, color=color.red, linewidth=2) h1 = hline(0, color=color.new(color.white,100)) h2 = hline(2, color=color.new(color.white,100)) h3 = hline(14, color=color.new(color.white,100)) h4 = hline(21, color=color.new(color.white,100)) h5 = hline(33, color=color.new(color.white,100)) h6 = hline(70, color=color.new(color.white,100)) h7 = hline(78, color=color.new(color.white,100)) h8 = hline(85, color=color.new(color.white,100)) h9 = hline(95, color=color.new(color.white,100)) h10 = hline(100, color=color.new(color.white,100)) h11 = hline(49.5, color=color.new(color.white,100)) h12 = hline(50.5, color=color.new(color.white,100)) fill(h1, h5, color=color.new(color.lime,95)) fill(h1, h4, color=color.new(color.lime,95)) fill(h1, h3, color=color.new(color.lime,95)) fill(h1, h2, color=color.new(color.lime,95)) fill(h6, h10, color=color.new(color.red,95)) fill(h7, h10, color=color.new(color.red,95)) fill(h8, h10, color=color.new(color.red,95)) fill(h9, h10, color=color.new(color.red,95)) fill(h11, h12, color=color.new(color.white,75))
watermark_ascii
https://www.tradingview.com/script/tKXOklxH-watermark-ascii/
voided
https://www.tradingview.com/u/voided/
9
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/ // Β© voided //@version=5 indicator("watermark_ascii", overlay = true) if barstate.islast t0 = "........................................................................................................................................................................................................\n" + ".................................................................................... . ... .... ....................................................................................................\n" + "....................................................................................?NMMNDDDNMMD=.................. .......... .........................................................................\n" + "...............................................................................?MO7777$$$$$$$$$$777MO.,. .........,7NMND888NMN+.. . ...................................................................\n" + "............................................................................:MZ7$$$$$$$$$$$$$$$$7$$$7$M....... +MN$7$$$$7$7777$$$M+.....................................................................\n" + "..........................................................................~M77$$$$$$$$$$$$$$$$$$$$$$$$7Z8...8D7$$7$$$$$$$$$$$$$$777M:...................................................................\n" + ".........................................................................M77$$$$$$$$$$$$$$$$$$$$$$$77$$$7MN777$$$$$$$$$$$$$$$$$$$$$7Z$. ................................................................\n" + ".......................................................................M77$7$$$$$$$$7777$$$$$$$$$77777$$$$D77$$7$$$$$$$$$$$$$$$$$$$$$78.................................................................\n" + "......................................................................M7$$$7$$$$$$$$$$$$$$77$$$77$$$7777$$$M7$$7$$$$$$$$$$$$$$$$$$$$$7Z:................................................................\n" + "....................................................................~D$$777$$$$$$$$$77$8MMN8O8DNMMO77$$$$$77M7$$$$$$$$$$$$$$$$$$$$$7$$7M .............................................................." t1 = "...................................................................~8$$7$$$$$$$$$$$ND$777$$$$$$$$777ZMD77$$$$$7$$$$$$$$$77$777$$$$$$$$7$~...............................................................\n" + "..................................................................=Z$$$$$$$$$77$M$77$$$$$$$$$$$$$$$$7$$7OM777M$77$ODMMMMMDDD88DNNMMN8Z77M ... ..........................................................\n" + ".................................................................,N$$$$$$$$$$7M7$$$7$$$$$$$$$$$$$$$$$$$$$77MMMO$777777$$$$$$$$$$$$77777$DMZ.............................................................\n" + ".................................................................M77$$$$$$$$$77$$$$$$$$$$$$$$$$$77$$$$$$$$$$7M7777$$$$$$$$$$$$$$$$$$7$7$$$$7OM+.........................................................\n" + "................................................................Z77$$$$$$$$$$$$$$$$$$$$$$$$$77$$7777ZZO888OZ$77N7$$$$$$$$$$$777$$$$$7777777$$$7ON.......................................................\n" + ".............................................................. .D$7$$$$$$$$$$$$$$$$$$$$$$$77DM8$77$$$7$777$$$$77OMN$77$7$$$777$ONMMND888DNNMMDZ777M.....................................................\n" + "...............................................................N777$$$$$$$$$$$$$$$$$$$77$$M$7$7$77$8DNMMNDO$7777$7$$D77$78MD$7$7$$777$77777$$$$$$DM7.. .................................................\n" + "..............................................................=N$$$$$$$$$$$$$$$$$$77777$MI$$7OMD77$$7777$$7777ZNM8777MM$777ZDMM8Z77777777777ONMNZ7$7IM..................................................\n" + "..........................................................~MOI87$$$$$$$$$$$$$$$$$777ZM8777ZM777ZMD?=:..,~+OMMDZ777$ZN7ZMN$77$7$$7ZNMM8ZZZONMMD$7778MZIM.................................................\n" + "........................................................ID7$$7M7$$$$$$$$$$$$$$$MMD$77778MZ78M+.MMDMMMMMM$,.......IMD77$$$$$$ZMO,..7MMMMMMM,.....=DM$77N7. .............................................." t2 = "......................................................,M7$$$7IO$$$$$$$$$77$$$77777ZNMO778N,..,MMM.~MMMMMMM ..........?M7$7MZ ....MMI.DMMMMMN....... 7MO$M...............................................\n" + "......................................................M7$$$$7O7$$$$$$$$$77$7MO$$77$777M+.....MMMNMMM~..8MMM...........,7MI......MMMMMMM..=MM8 .........8$ ..............................................\n" + ".....................................................M77777$7M7$$$$$$$$77$7$Z$$777$7M=......:MMMM+7MM:+MMMM...........,M........MMMM,MM7:MMMM ..........I~..............................................\n" + "....................................................M777$$$$7Z7$$$$$$$$$$$$77$7777OM...... .?MMMMMMMMMMMMMM ..........N........,MMMMMMMMMMMMM...........O,..............................................\n" + ".................................................. ?$7$7$$$$$$$$$$$$$$$$$$$$$$$$$$77D8.... .,MMMMMMMMMMMMMN...........M.........MMMMMMMMMMMM7..........N=...............................................\n" + "...................................................M7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77$$ZM~....DMMMMMMMMMMMM .......,.ZMD.........=NMMMMMMMMM?.......=8MN.................................................\n" + "..................................................M$$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$7777$$7OM?. ,MMMMMMMMN,.......+MDI$$MI8MNI,.....:8MMMMO,,~I8MMDZ7$77M. ...............................................\n" + ".................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$777DM77$777$ZDNMMNDD88DNNMNO7$$$$77M7$$$$$$7777$7$77777777$$$7$7MN?...................................................\n" + ".................................................M$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77$ZNNZ77$7$7$$$7$$$$$7$$$777ZMZ$7$$$$$$$$$$$$$$$$$$$$$$$$$7M......................................................\n" + "................................................?$$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7$$$77ONMMMMNNDDDNMMMMN8$777$$$$$$$$$$$$$$$$$$$$$$$$$$$7M......................................................." t3 = "................................................M7$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7$$$$7$$$$$$$$$$77$$$7$7M7$$$$$$$77$7$$777$$$77$$$$$$$$7M~. ......................................................\n" + "...............................................,$$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$777$$777M877$$$$$$$$$78MD$777777777777$NN~...........................................................\n" + "...............................................M$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7778MO7$$$$7$$$$$$$$$$$$77MZDNMNN8Z$7$7D+...........................................................\n" + "...............................................N$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$DMD$7$7$$$$$$$$$$$$$$$$$$$$$7$M$$$$$$$$$$$7M .........................................................\n" + "..............................................?77$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77$$$$$$$$$$7M. .......................................................\n" + "..............................................M$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7$$$$$$$$$$$$$Z=.......................................................\n" + "..............................................M$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7777D,......................................................\n" + "..............................................D$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$777$$M......................................................\n" + "..............................................D$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7$$$$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7$$:.....................................................\n" + "..............................................N7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7$$$$$$$$$$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7N....................................................." t4 = "..............................................M$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$777NMMMMMMMN8$777777$7$$$$$77$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7M=....................................................\n" + "..............................................M7$$$$$$$$$$$$$$$$$$$$$$$$$$$7$$7M$7777$$$777777$ONMDZ777$$$$$$$$$$$77$$$$$$$$$$$$$$$$$$$$$777$7ZMO777M...................................................\n" + "..............................................M$$$$$$$$$$$$$$$$$$$$$$$$$$$$$78Z77777777777777777777777$DNM8Z777$7$77$$$$$$777777$$$$7$777$8M87$77777N...................................................\n" + "..............................................87$$$$$$$$$$$$$$$$$$$$$$$$$$$77Z77777$O888OO$77$77$$77777777777777$ODMMMND8OOOZZOO8DNMMDZ77$777777777D=,..................................................\n" + "..............................................,7$$$7$$$$$$$$$$$$$$$$$$$$$$$7M7777777777777777$8MM8Z77777777$777777777777777777777777777777777777$ZN.....................................................\n" + "...............................................M7$$7$$$$$$$$$$$$$$$$$$$$$$77M777777777777777777777777$8NMN8$777777777777777777777777777777777$DM+.... ..................................................\n" + "...............................................D7$$$$$$$$$$$$$$$$$$$$$$7$777$87777777777777777777777777777777777O8NMMMMMMNMMNNNNMMMMMMMNDO$77$778.......................................................\n" + "................................................N$$$$$$$$$$$$$$$$$$$$$$7N77$7$7DMMMNNNMMMMNDZ$77777777777777777777777777777777777777777777777777M.......................................................\n" + "................................................I$7$$$77$$$$$$$$$$$$$$$7OZ7$$777$$$$$$$$$$$7777$ZDMM8$I777$77777777777777777777777777777777777$$I.......................................................\n" + "................................................ NI7$$77$$$$$$$$$$$$$$$$77MI77$$$$$$$$$$$$$$77$7$$$7777$8MMNO777777777777777777777777777777777M. ......................................................" t5 = "..................................................8777$$$$$$$$$$$$$$$$$7$$77DM8Z$7$$$$$$$$$$$$$$$$$777$$7$$7$$77$$Z8DNNMMMMMMMMMMMMMMMMMMMMO:...........................................................\n" + ".................................................. .MZ77$$$$$$77$$$$$$$$$$$$$777$7$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77$$$$$77N?.. ..............................................................\n" + "..................................................... $M$7777$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77MI...................................................................\n" + ".........................................................=MD77$$777$$$77$$$$7777$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7777$$$$7$7OM,.....................................................................\n" + "........................................................... .:8MD$7$77$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77OM=........................................................................\n" + "...................................................................,+8MM8Z777777$$77$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$777ZMD=............................................................................\n" + "........................................................................ . .~I8MMMN8Z$7777$77$777$777777777777$777ZNMD+...... ..........................................................................\n" + ".........................................................................................,::=I$ZO8DDNNNNNND8Z7~,........................................................................................\n" + "................................................................................................................ .......................................................................................\n" cols = 1 rows = 6 cw = 60 ch = 80 / 5 wm = table.new(position.middle_center, columns = cols, rows = rows) table.cell(wm, 0, 0, text=t0, text_color = color.new(color.black, 80))//, width = cw, height = ch) table.cell(wm, 0, 1, text=t1, text_color = color.new(color.black, 80))//, width = cw, height = ch) table.cell(wm, 0, 2, text=t2, text_color = color.new(color.black, 80))//, width = cw, height = ch) table.cell(wm, 0, 3, text=t3, text_color = color.new(color.black, 80))//, width = cw, height = ch) table.cell(wm, 0, 4, text=t4, text_color = color.new(color.black, 80))//, width = cw, height = ch) table.cell(wm, 0, 5, text=t5, text_color = color.new(color.black, 80))//, width = cw, height = ch)
watermark
https://www.tradingview.com/script/WmGNjszu-watermark/
voided
https://www.tradingview.com/u/voided/
110
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/ // Β© voided //@version=5 indicator("watermark", overlay = true) if barstate.islast w = 20 h = 20 cw = 30 / w ch = 45 / h wm = table.new(position.middle_center, columns = w, rows = h) table.cell(wm, 0, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 3, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 4, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 5, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 6, 0, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 7, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 8, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 9, 0, bgcolor=color.new(#eeeeee, 80), width = cw, height = ch) table.cell(wm, 10, 0, bgcolor=color.new(#d8d8d8, 80), width = cw, height = ch) table.cell(wm, 11, 0, bgcolor=color.new(#dadcdb, 80), width = cw, height = ch) table.cell(wm, 12, 0, bgcolor=color.new(#f8f8f8, 80), width = cw, height = ch) table.cell(wm, 13, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 14, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 15, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 16, 0, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 17, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 18, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 0, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 0, 1, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 1, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 1, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 3, 1, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 4, 1, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 5, 1, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 6, 1, bgcolor=color.new(#fffdfe, 80), width = cw, height = ch) table.cell(wm, 7, 1, bgcolor=color.new(#e7e7e7, 80), width = cw, height = ch) table.cell(wm, 8, 1, bgcolor=color.new(#b9b8b6, 80), width = cw, height = ch) table.cell(wm, 9, 1, bgcolor=color.new(#b5b2ad, 80), width = cw, height = ch) table.cell(wm, 10, 1, bgcolor=color.new(#beb9b3, 80), width = cw, height = ch) table.cell(wm, 11, 1, bgcolor=color.new(#bdb9b0, 80), width = cw, height = ch) table.cell(wm, 12, 1, bgcolor=color.new(#b4b0ad, 80), width = cw, height = ch) table.cell(wm, 13, 1, bgcolor=color.new(#cecccd, 80), width = cw, height = ch) table.cell(wm, 14, 1, bgcolor=color.new(#dcdcdc, 80), width = cw, height = ch) table.cell(wm, 15, 1, bgcolor=color.new(#f8f8f8, 80), width = cw, height = ch) table.cell(wm, 16, 1, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 17, 1, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 18, 1, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 1, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 0, 2, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 2, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 2, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 3, 2, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 4, 2, bgcolor=color.new(#fffeff, 80), width = cw, height = ch) table.cell(wm, 5, 2, bgcolor=color.new(#fefeff, 80), width = cw, height = ch) table.cell(wm, 6, 2, bgcolor=color.new(#cccbc9, 80), width = cw, height = ch) table.cell(wm, 7, 2, bgcolor=color.new(#968780, 80), width = cw, height = ch) table.cell(wm, 8, 2, bgcolor=color.new(#b0a19a, 80), width = cw, height = ch) table.cell(wm, 9, 2, bgcolor=color.new(#b7a49d, 80), width = cw, height = ch) table.cell(wm, 10, 2, bgcolor=color.new(#ad9c95, 80), width = cw, height = ch) table.cell(wm, 11, 2, bgcolor=color.new(#b4a79f, 80), width = cw, height = ch) table.cell(wm, 12, 2, bgcolor=color.new(#b1a29d, 80), width = cw, height = ch) table.cell(wm, 13, 2, bgcolor=color.new(#94817a, 80), width = cw, height = ch) table.cell(wm, 14, 2, bgcolor=color.new(#bab3ad, 80), width = cw, height = ch) table.cell(wm, 15, 2, bgcolor=color.new(#b4b3ae, 80), width = cw, height = ch) table.cell(wm, 16, 2, bgcolor=color.new(#f2f2f2, 80), width = cw, height = ch) table.cell(wm, 17, 2, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 18, 2, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 19, 2, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 0, 3, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 3, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 3, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 3, 3, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 4, 3, bgcolor=color.new(#fefefc, 80), width = cw, height = ch) table.cell(wm, 5, 3, bgcolor=color.new(#e2e2e2, 80), width = cw, height = ch) table.cell(wm, 6, 3, bgcolor=color.new(#91827d, 80), width = cw, height = ch) table.cell(wm, 7, 3, bgcolor=color.new(#a8948d, 80), width = cw, height = ch) table.cell(wm, 8, 3, bgcolor=color.new(#897871, 80), width = cw, height = ch) table.cell(wm, 9, 3, bgcolor=color.new(#4a2827, 80), width = cw, height = ch) table.cell(wm, 10, 3, bgcolor=color.new(#583730, 80), width = cw, height = ch) table.cell(wm, 11, 3, bgcolor=color.new(#6f4d44, 80), width = cw, height = ch) table.cell(wm, 12, 3, bgcolor=color.new(#7a5d57, 80), width = cw, height = ch) table.cell(wm, 13, 3, bgcolor=color.new(#7a5d57, 80), width = cw, height = ch) table.cell(wm, 14, 3, bgcolor=color.new(#ac9d98, 80), width = cw, height = ch) table.cell(wm, 15, 3, bgcolor=color.new(#d0c9c3, 80), width = cw, height = ch) table.cell(wm, 16, 3, bgcolor=color.new(#b6b5b3, 80), width = cw, height = ch) table.cell(wm, 17, 3, bgcolor=color.new(#fdfdff, 80), width = cw, height = ch) table.cell(wm, 18, 3, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 3, bgcolor=color.new(#fffeff, 80), width = cw, height = ch) table.cell(wm, 0, 4, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 4, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 4, bgcolor=color.new(#fefefc, 80), width = cw, height = ch) table.cell(wm, 3, 4, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 4, 4, bgcolor=color.new(#fefeff, 80), width = cw, height = ch) table.cell(wm, 5, 4, bgcolor=color.new(#bbb7b8, 80), width = cw, height = ch) table.cell(wm, 6, 4, bgcolor=color.new(#98847b, 80), width = cw, height = ch) table.cell(wm, 7, 4, bgcolor=color.new(#79615d, 80), width = cw, height = ch) table.cell(wm, 8, 4, bgcolor=color.new(#633623, 80), width = cw, height = ch) table.cell(wm, 9, 4, bgcolor=color.new(#a97c5f, 80), width = cw, height = ch) table.cell(wm, 10, 4, bgcolor=color.new(#cfa084, 80), width = cw, height = ch) table.cell(wm, 11, 4, bgcolor=color.new(#e2b191, 80), width = cw, height = ch) table.cell(wm, 12, 4, bgcolor=color.new(#ca9778, 80), width = cw, height = ch) table.cell(wm, 13, 4, bgcolor=color.new(#ae7856, 80), width = cw, height = ch) table.cell(wm, 14, 4, bgcolor=color.new(#642601, 80), width = cw, height = ch) table.cell(wm, 15, 4, bgcolor=color.new(#b1a49e, 80), width = cw, height = ch) table.cell(wm, 16, 4, bgcolor=color.new(#bcb9b4, 80), width = cw, height = ch) table.cell(wm, 17, 4, bgcolor=color.new(#eaeae8, 80), width = cw, height = ch) table.cell(wm, 18, 4, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 4, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 0, 5, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 5, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 5, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 3, 5, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 4, 5, bgcolor=color.new(#f5f5f5, 80), width = cw, height = ch) table.cell(wm, 5, 5, bgcolor=color.new(#a19893, 80), width = cw, height = ch) table.cell(wm, 6, 5, bgcolor=color.new(#72554f, 80), width = cw, height = ch) table.cell(wm, 7, 5, bgcolor=color.new(#633d30, 80), width = cw, height = ch) table.cell(wm, 8, 5, bgcolor=color.new(#c08d70, 80), width = cw, height = ch) table.cell(wm, 9, 5, bgcolor=color.new(#f3bc9d, 80), width = cw, height = ch) table.cell(wm, 10, 5, bgcolor=color.new(#f5c3a2, 80), width = cw, height = ch) table.cell(wm, 11, 5, bgcolor=color.new(#eab595, 80), width = cw, height = ch) table.cell(wm, 12, 5, bgcolor=color.new(#c18a6b, 80), width = cw, height = ch) table.cell(wm, 13, 5, bgcolor=color.new(#bc866a, 80), width = cw, height = ch) table.cell(wm, 14, 5, bgcolor=color.new(#78401f, 80), width = cw, height = ch) table.cell(wm, 15, 5, bgcolor=color.new(#897871, 80), width = cw, height = ch) table.cell(wm, 16, 5, bgcolor=color.new(#ab9c97, 80), width = cw, height = ch) table.cell(wm, 17, 5, bgcolor=color.new(#ccc8c9, 80), width = cw, height = ch) table.cell(wm, 18, 5, bgcolor=color.new(#fffffd, 80), width = cw, height = ch) table.cell(wm, 19, 5, bgcolor=color.new(#fffdfe, 80), width = cw, height = ch) table.cell(wm, 0, 6, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 6, bgcolor=color.new(#fffffd, 80), width = cw, height = ch) table.cell(wm, 2, 6, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 3, 6, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 4, 6, bgcolor=color.new(#d9d9d9, 80), width = cw, height = ch) table.cell(wm, 5, 6, bgcolor=color.new(#aca39e, 80), width = cw, height = ch) table.cell(wm, 6, 6, bgcolor=color.new(#79584f, 80), width = cw, height = ch) table.cell(wm, 7, 6, bgcolor=color.new(#c38a6c, 80), width = cw, height = ch) table.cell(wm, 8, 6, bgcolor=color.new(#f3bc9d, 80), width = cw, height = ch) table.cell(wm, 9, 6, bgcolor=color.new(#f1be9f, 80), width = cw, height = ch) table.cell(wm, 10, 6, bgcolor=color.new(#ebb899, 80), width = cw, height = ch) table.cell(wm, 11, 6, bgcolor=color.new(#f0bd9e, 80), width = cw, height = ch) table.cell(wm, 12, 6, bgcolor=color.new(#eab595, 80), width = cw, height = ch) table.cell(wm, 13, 6, bgcolor=color.new(#d9a283, 80), width = cw, height = ch) table.cell(wm, 14, 6, bgcolor=color.new(#9d6647, 80), width = cw, height = ch) table.cell(wm, 15, 6, bgcolor=color.new(#806c6b, 80), width = cw, height = ch) table.cell(wm, 16, 6, bgcolor=color.new(#a28e87, 80), width = cw, height = ch) table.cell(wm, 17, 6, bgcolor=color.new(#a8a3a0, 80), width = cw, height = ch) table.cell(wm, 18, 6, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 6, bgcolor=color.new(#fdfdfd, 80), width = cw, height = ch) table.cell(wm, 0, 7, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 7, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 7, bgcolor=color.new(#fdfdfd, 80), width = cw, height = ch) table.cell(wm, 3, 7, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 4, 7, bgcolor=color.new(#bcb6b6, 80), width = cw, height = ch) table.cell(wm, 5, 7, bgcolor=color.new(#958681, 80), width = cw, height = ch) table.cell(wm, 6, 7, bgcolor=color.new(#906c5e, 80), width = cw, height = ch) table.cell(wm, 7, 7, bgcolor=color.new(#ae765b, 80), width = cw, height = ch) table.cell(wm, 8, 7, bgcolor=color.new(#9f6c59, 80), width = cw, height = ch) table.cell(wm, 9, 7, bgcolor=color.new(#d19f84, 80), width = cw, height = ch) table.cell(wm, 10, 7, bgcolor=color.new(#f4c29f, 80), width = cw, height = ch) table.cell(wm, 11, 7, bgcolor=color.new(#daa98b, 80), width = cw, height = ch) table.cell(wm, 12, 7, bgcolor=color.new(#ba8a73, 80), width = cw, height = ch) table.cell(wm, 13, 7, bgcolor=color.new(#d09a7e, 80), width = cw, height = ch) table.cell(wm, 14, 7, bgcolor=color.new(#a46d4e, 80), width = cw, height = ch) table.cell(wm, 15, 7, bgcolor=color.new(#816f6b, 80), width = cw, height = ch) table.cell(wm, 16, 7, bgcolor=color.new(#967b74, 80), width = cw, height = ch) table.cell(wm, 17, 7, bgcolor=color.new(#ada7a7, 80), width = cw, height = ch) table.cell(wm, 18, 7, bgcolor=color.new(#feffff, 80), width = cw, height = ch) table.cell(wm, 19, 7, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 0, 8, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 8, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 8, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 3, 8, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 4, 8, bgcolor=color.new(#ada9a8, 80), width = cw, height = ch) table.cell(wm, 5, 8, bgcolor=color.new(#684740, 80), width = cw, height = ch) table.cell(wm, 6, 8, bgcolor=color.new(#764c3c, 80), width = cw, height = ch) table.cell(wm, 7, 8, bgcolor=color.new(#9f6c57, 80), width = cw, height = ch) table.cell(wm, 8, 8, bgcolor=color.new(#976959, 80), width = cw, height = ch) table.cell(wm, 9, 8, bgcolor=color.new(#7b4835, 80), width = cw, height = ch) table.cell(wm, 10, 8, bgcolor=color.new(#dfad8c, 80), width = cw, height = ch) table.cell(wm, 11, 8, bgcolor=color.new(#8f5f49, 80), width = cw, height = ch) table.cell(wm, 12, 8, bgcolor=color.new(#733e2e, 80), width = cw, height = ch) table.cell(wm, 13, 8, bgcolor=color.new(#93604d, 80), width = cw, height = ch) table.cell(wm, 14, 8, bgcolor=color.new(#88513c, 80), width = cw, height = ch) table.cell(wm, 15, 8, bgcolor=color.new(#6d4b42, 80), width = cw, height = ch) table.cell(wm, 16, 8, bgcolor=color.new(#542919, 80), width = cw, height = ch) table.cell(wm, 17, 8, bgcolor=color.new(#a59f9f, 80), width = cw, height = ch) table.cell(wm, 18, 8, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 8, bgcolor=color.new(#fefcfd, 80), width = cw, height = ch) table.cell(wm, 0, 9, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 9, bgcolor=color.new(#feffff, 80), width = cw, height = ch) table.cell(wm, 2, 9, bgcolor=color.new(#fffffd, 80), width = cw, height = ch) table.cell(wm, 3, 9, bgcolor=color.new(#fbfbfb, 80), width = cw, height = ch) table.cell(wm, 4, 9, bgcolor=color.new(#7f7671, 80), width = cw, height = ch) table.cell(wm, 5, 9, bgcolor=color.new(#542a1c, 80), width = cw, height = ch) table.cell(wm, 6, 9, bgcolor=color.new(#693120, 80), width = cw, height = ch) table.cell(wm, 7, 9, bgcolor=color.new(#855b45, 80), width = cw, height = ch) table.cell(wm, 8, 9, bgcolor=color.new(#986f59, 80), width = cw, height = ch) table.cell(wm, 9, 9, bgcolor=color.new(#92624b, 80), width = cw, height = ch) table.cell(wm, 10, 9, bgcolor=color.new(#cd9b80, 80), width = cw, height = ch) table.cell(wm, 11, 9, bgcolor=color.new(#a67660, 80), width = cw, height = ch) table.cell(wm, 12, 9, bgcolor=color.new(#90684f, 80), width = cw, height = ch) table.cell(wm, 13, 9, bgcolor=color.new(#845e49, 80), width = cw, height = ch) table.cell(wm, 14, 9, bgcolor=color.new(#703924, 80), width = cw, height = ch) table.cell(wm, 15, 9, bgcolor=color.new(#7d4e3c, 80), width = cw, height = ch) table.cell(wm, 16, 9, bgcolor=color.new(#3e0001, 80), width = cw, height = ch) table.cell(wm, 17, 9, bgcolor=color.new(#a8a2a2, 80), width = cw, height = ch) table.cell(wm, 18, 9, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 9, bgcolor=color.new(#fefcfd, 80), width = cw, height = ch) table.cell(wm, 0, 10, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 10, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 2, 10, bgcolor=color.new(#fefcfd, 80), width = cw, height = ch) table.cell(wm, 3, 10, bgcolor=color.new(#fffffd, 80), width = cw, height = ch) table.cell(wm, 4, 10, bgcolor=color.new(#a3a3a5, 80), width = cw, height = ch) table.cell(wm, 5, 10, bgcolor=color.new(#540000, 80), width = cw, height = ch) table.cell(wm, 6, 10, bgcolor=color.new(#cc9b7d, 80), width = cw, height = ch) table.cell(wm, 7, 10, bgcolor=color.new(#bc8a6f, 80), width = cw, height = ch) table.cell(wm, 8, 10, bgcolor=color.new(#d8a685, 80), width = cw, height = ch) table.cell(wm, 9, 10, bgcolor=color.new(#d39c7d, 80), width = cw, height = ch) table.cell(wm, 10, 10, bgcolor=color.new(#ce9c83, 80), width = cw, height = ch) table.cell(wm, 11, 10, bgcolor=color.new(#a16e59, 80), width = cw, height = ch) table.cell(wm, 12, 10, bgcolor=color.new(#d7a485, 80), width = cw, height = ch) table.cell(wm, 13, 10, bgcolor=color.new(#ddac8c, 80), width = cw, height = ch) table.cell(wm, 14, 10, bgcolor=color.new(#cb987b, 80), width = cw, height = ch) table.cell(wm, 15, 10, bgcolor=color.new(#be8b6c, 80), width = cw, height = ch) table.cell(wm, 16, 10, bgcolor=color.new(#400000, 80), width = cw, height = ch) table.cell(wm, 17, 10, bgcolor=color.new(#a19d9c, 80), width = cw, height = ch) table.cell(wm, 18, 10, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 10, bgcolor=color.new(#fdfdfd, 80), width = cw, height = ch) table.cell(wm, 0, 11, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 11, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 11, bgcolor=color.new(#fefefc, 80), width = cw, height = ch) table.cell(wm, 3, 11, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 4, 11, bgcolor=color.new(#cccdcf, 80), width = cw, height = ch) table.cell(wm, 5, 11, bgcolor=color.new(#510001, 80), width = cw, height = ch) table.cell(wm, 6, 11, bgcolor=color.new(#e5b091, 80), width = cw, height = ch) table.cell(wm, 7, 11, bgcolor=color.new(#f5c3a0, 80), width = cw, height = ch) table.cell(wm, 8, 11, bgcolor=color.new(#efbd9c, 80), width = cw, height = ch) table.cell(wm, 9, 11, bgcolor=color.new(#c29375, 80), width = cw, height = ch) table.cell(wm, 10, 11, bgcolor=color.new(#dfad92, 80), width = cw, height = ch) table.cell(wm, 11, 11, bgcolor=color.new(#b4846e, 80), width = cw, height = ch) table.cell(wm, 12, 11, bgcolor=color.new(#dcab8b, 80), width = cw, height = ch) table.cell(wm, 13, 11, bgcolor=color.new(#f4c3a3, 80), width = cw, height = ch) table.cell(wm, 14, 11, bgcolor=color.new(#e9b492, 80), width = cw, height = ch) table.cell(wm, 15, 11, bgcolor=color.new(#bc866c, 80), width = cw, height = ch) table.cell(wm, 16, 11, bgcolor=color.new(#4f0003, 80), width = cw, height = ch) table.cell(wm, 17, 11, bgcolor=color.new(#babab8, 80), width = cw, height = ch) table.cell(wm, 18, 11, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 11, bgcolor=color.new(#fdfdfd, 80), width = cw, height = ch) table.cell(wm, 0, 12, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 12, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 12, bgcolor=color.new(#fefcfd, 80), width = cw, height = ch) table.cell(wm, 3, 12, bgcolor=color.new(#fffeff, 80), width = cw, height = ch) table.cell(wm, 4, 12, bgcolor=color.new(#e4e4e4, 80), width = cw, height = ch) table.cell(wm, 5, 12, bgcolor=color.new(#5f270c, 80), width = cw, height = ch) table.cell(wm, 6, 12, bgcolor=color.new(#b88364, 80), width = cw, height = ch) table.cell(wm, 7, 12, bgcolor=color.new(#eab798, 80), width = cw, height = ch) table.cell(wm, 8, 12, bgcolor=color.new(#dba988, 80), width = cw, height = ch) table.cell(wm, 9, 12, bgcolor=color.new(#9d6a57, 80), width = cw, height = ch) table.cell(wm, 10, 12, bgcolor=color.new(#8b5a4b, 80), width = cw, height = ch) table.cell(wm, 11, 12, bgcolor=color.new(#753c33, 80), width = cw, height = ch) table.cell(wm, 12, 12, bgcolor=color.new(#d7a58a, 80), width = cw, height = ch) table.cell(wm, 13, 12, bgcolor=color.new(#f2bc9a, 80), width = cw, height = ch) table.cell(wm, 14, 12, bgcolor=color.new(#ba8468, 80), width = cw, height = ch) table.cell(wm, 15, 12, bgcolor=color.new(#8d5d46, 80), width = cw, height = ch) table.cell(wm, 16, 12, bgcolor=color.new(#87504d, 80), width = cw, height = ch) table.cell(wm, 17, 12, bgcolor=color.new(#dbd7d8, 80), width = cw, height = ch) table.cell(wm, 18, 12, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 12, bgcolor=color.new(#fcfefd, 80), width = cw, height = ch) table.cell(wm, 0, 13, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 13, bgcolor=color.new(#fffdfe, 80), width = cw, height = ch) table.cell(wm, 2, 13, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 3, 13, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 4, 13, bgcolor=color.new(#f8f6f7, 80), width = cw, height = ch) table.cell(wm, 5, 13, bgcolor=color.new(#7a615c, 80), width = cw, height = ch) table.cell(wm, 6, 13, bgcolor=color.new(#b67b5b, 80), width = cw, height = ch) table.cell(wm, 7, 13, bgcolor=color.new(#c0896b, 80), width = cw, height = ch) table.cell(wm, 8, 13, bgcolor=color.new(#ce997a, 80), width = cw, height = ch) table.cell(wm, 9, 13, bgcolor=color.new(#ddaf8e, 80), width = cw, height = ch) table.cell(wm, 10, 13, bgcolor=color.new(#c6977b, 80), width = cw, height = ch) table.cell(wm, 11, 13, bgcolor=color.new(#d9a888, 80), width = cw, height = ch) table.cell(wm, 12, 13, bgcolor=color.new(#e9b796, 80), width = cw, height = ch) table.cell(wm, 13, 13, bgcolor=color.new(#ce9979, 80), width = cw, height = ch) table.cell(wm, 14, 13, bgcolor=color.new(#9a664e, 80), width = cw, height = ch) table.cell(wm, 15, 13, bgcolor=color.new(#7b4634, 80), width = cw, height = ch) table.cell(wm, 16, 13, bgcolor=color.new(#7a433c, 80), width = cw, height = ch) table.cell(wm, 17, 13, bgcolor=color.new(#e1e1e3, 80), width = cw, height = ch) table.cell(wm, 18, 13, bgcolor=color.new(#feffff, 80), width = cw, height = ch) table.cell(wm, 19, 13, bgcolor=color.new(#fdfbfc, 80), width = cw, height = ch) table.cell(wm, 0, 14, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 14, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 14, bgcolor=color.new(#fffffd, 80), width = cw, height = ch) table.cell(wm, 3, 14, bgcolor=color.new(#fffdfe, 80), width = cw, height = ch) table.cell(wm, 4, 14, bgcolor=color.new(#fffffd, 80), width = cw, height = ch) table.cell(wm, 5, 14, bgcolor=color.new(#a49c9a, 80), width = cw, height = ch) table.cell(wm, 6, 14, bgcolor=color.new(#ab6b45, 80), width = cw, height = ch) table.cell(wm, 7, 14, bgcolor=color.new(#ce997a, 80), width = cw, height = ch) table.cell(wm, 8, 14, bgcolor=color.new(#97634b, 80), width = cw, height = ch) table.cell(wm, 9, 14, bgcolor=color.new(#8d5852, 80), width = cw, height = ch) table.cell(wm, 10, 14, bgcolor=color.new(#ab7d70, 80), width = cw, height = ch) table.cell(wm, 11, 14, bgcolor=color.new(#a87768, 80), width = cw, height = ch) table.cell(wm, 12, 14, bgcolor=color.new(#a57159, 80), width = cw, height = ch) table.cell(wm, 13, 14, bgcolor=color.new(#bd8667, 80), width = cw, height = ch) table.cell(wm, 14, 14, bgcolor=color.new(#c28c70, 80), width = cw, height = ch) table.cell(wm, 15, 14, bgcolor=color.new(#895435, 80), width = cw, height = ch) table.cell(wm, 16, 14, bgcolor=color.new(#a5a1a0, 80), width = cw, height = ch) table.cell(wm, 17, 14, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 18, 14, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 19, 14, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 0, 15, bgcolor=color.new(#fffffd, 80), width = cw, height = ch) table.cell(wm, 1, 15, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 15, bgcolor=color.new(#fefeff, 80), width = cw, height = ch) table.cell(wm, 3, 15, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 4, 15, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 5, 15, bgcolor=color.new(#f8f8fa, 80), width = cw, height = ch) table.cell(wm, 6, 15, bgcolor=color.new(#9d857b, 80), width = cw, height = ch) table.cell(wm, 7, 15, bgcolor=color.new(#c68e6b, 80), width = cw, height = ch) table.cell(wm, 8, 15, bgcolor=color.new(#ba8969, 80), width = cw, height = ch) table.cell(wm, 9, 15, bgcolor=color.new(#93554a, 80), width = cw, height = ch) table.cell(wm, 10, 15, bgcolor=color.new(#ac6963, 80), width = cw, height = ch) table.cell(wm, 11, 15, bgcolor=color.new(#85413e, 80), width = cw, height = ch) table.cell(wm, 12, 15, bgcolor=color.new(#a26a53, 80), width = cw, height = ch) table.cell(wm, 13, 15, bgcolor=color.new(#c69171, 80), width = cw, height = ch) table.cell(wm, 14, 15, bgcolor=color.new(#bb805e, 80), width = cw, height = ch) table.cell(wm, 15, 15, bgcolor=color.new(#7d6156, 80), width = cw, height = ch) table.cell(wm, 16, 15, bgcolor=color.new(#fafbfd, 80), width = cw, height = ch) table.cell(wm, 17, 15, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 18, 15, bgcolor=color.new(#fdfdfd, 80), width = cw, height = ch) table.cell(wm, 19, 15, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 0, 16, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 16, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 16, bgcolor=color.new(#fffffd, 80), width = cw, height = ch) table.cell(wm, 3, 16, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 4, 16, bgcolor=color.new(#fcfcfc, 80), width = cw, height = ch) table.cell(wm, 5, 16, bgcolor=color.new(#fffeff, 80), width = cw, height = ch) table.cell(wm, 6, 16, bgcolor=color.new(#b0afad, 80), width = cw, height = ch) table.cell(wm, 7, 16, bgcolor=color.new(#620000, 80), width = cw, height = ch) table.cell(wm, 8, 16, bgcolor=color.new(#d49f80, 80), width = cw, height = ch) table.cell(wm, 9, 16, bgcolor=color.new(#e0af8f, 80), width = cw, height = ch) table.cell(wm, 10, 16, bgcolor=color.new(#d1a382, 80), width = cw, height = ch) table.cell(wm, 11, 16, bgcolor=color.new(#dcab8b, 80), width = cw, height = ch) table.cell(wm, 12, 16, bgcolor=color.new(#d49d7e, 80), width = cw, height = ch) table.cell(wm, 13, 16, bgcolor=color.new(#c08b6c, 80), width = cw, height = ch) table.cell(wm, 14, 16, bgcolor=color.new(#7f441c, 80), width = cw, height = ch) table.cell(wm, 15, 16, bgcolor=color.new(#bbbab8, 80), width = cw, height = ch) table.cell(wm, 16, 16, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 17, 16, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 18, 16, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 16, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 0, 17, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 17, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 2, 17, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 3, 17, bgcolor=color.new(#fefeff, 80), width = cw, height = ch) table.cell(wm, 4, 17, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 5, 17, bgcolor=color.new(#d0d3d8, 80), width = cw, height = ch) table.cell(wm, 6, 17, bgcolor=color.new(#927277, 80), width = cw, height = ch) table.cell(wm, 7, 17, bgcolor=color.new(#7b4314, 80), width = cw, height = ch) table.cell(wm, 8, 17, bgcolor=color.new(#9a705a, 80), width = cw, height = ch) table.cell(wm, 9, 17, bgcolor=color.new(#eeb999, 80), width = cw, height = ch) table.cell(wm, 10, 17, bgcolor=color.new(#edb898, 80), width = cw, height = ch) table.cell(wm, 11, 17, bgcolor=color.new(#e0ad8e, 80), width = cw, height = ch) table.cell(wm, 12, 17, bgcolor=color.new(#c89276, 80), width = cw, height = ch) table.cell(wm, 13, 17, bgcolor=color.new(#844929, 80), width = cw, height = ch) table.cell(wm, 14, 17, bgcolor=color.new(#725d58, 80), width = cw, height = ch) table.cell(wm, 15, 17, bgcolor=color.new(#fafafa, 80), width = cw, height = ch) table.cell(wm, 16, 17, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 17, 17, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 18, 17, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 17, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 0, 18, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 18, bgcolor=color.new(#fdfdfd, 80), width = cw, height = ch) table.cell(wm, 2, 18, bgcolor=color.new(#fffffd, 80), width = cw, height = ch) table.cell(wm, 3, 18, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 4, 18, bgcolor=color.new(#c4c2c5, 80), width = cw, height = ch) table.cell(wm, 5, 18, bgcolor=color.new(#354d97, 80), width = cw, height = ch) table.cell(wm, 6, 18, bgcolor=color.new(#aba6bc, 80), width = cw, height = ch) table.cell(wm, 7, 18, bgcolor=color.new(#be8c71, 80), width = cw, height = ch) table.cell(wm, 8, 18, bgcolor=color.new(#864b23, 80), width = cw, height = ch) table.cell(wm, 9, 18, bgcolor=color.new(#724331, 80), width = cw, height = ch) table.cell(wm, 10, 18, bgcolor=color.new(#89553d, 80), width = cw, height = ch) table.cell(wm, 11, 18, bgcolor=color.new(#6f371e, 80), width = cw, height = ch) table.cell(wm, 12, 18, bgcolor=color.new(#6f3e2d, 80), width = cw, height = ch) table.cell(wm, 13, 18, bgcolor=color.new(#955e40, 80), width = cw, height = ch) table.cell(wm, 14, 18, bgcolor=color.new(#a68572, 80), width = cw, height = ch) table.cell(wm, 15, 18, bgcolor=color.new(#f5f6f8, 80), width = cw, height = ch) table.cell(wm, 16, 18, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 17, 18, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 18, 18, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 18, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 0, 19, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 1, 19, bgcolor=color.new(#fffeff, 80), width = cw, height = ch) table.cell(wm, 2, 19, bgcolor=color.new(#fcfcfc, 80), width = cw, height = ch) table.cell(wm, 3, 19, bgcolor=color.new(#9698a5, 80), width = cw, height = ch) table.cell(wm, 4, 19, bgcolor=color.new(#000087, 80), width = cw, height = ch) table.cell(wm, 5, 19, bgcolor=color.new(#515eac, 80), width = cw, height = ch) table.cell(wm, 6, 19, bgcolor=color.new(#abb4d1, 80), width = cw, height = ch) table.cell(wm, 7, 19, bgcolor=color.new(#b8b5c6, 80), width = cw, height = ch) table.cell(wm, 8, 19, bgcolor=color.new(#be988d, 80), width = cw, height = ch) table.cell(wm, 9, 19, bgcolor=color.new(#a26b4d, 80), width = cw, height = ch) table.cell(wm, 10, 19, bgcolor=color.new(#754433, 80), width = cw, height = ch) table.cell(wm, 11, 19, bgcolor=color.new(#84543e, 80), width = cw, height = ch) table.cell(wm, 12, 19, bgcolor=color.new(#bb8368, 80), width = cw, height = ch) table.cell(wm, 13, 19, bgcolor=color.new(#c68e6b, 80), width = cw, height = ch) table.cell(wm, 14, 19, bgcolor=color.new(#a78174, 80), width = cw, height = ch) table.cell(wm, 15, 19, bgcolor=color.new(#dbdfe2, 80), width = cw, height = ch) table.cell(wm, 16, 19, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 17, 19, bgcolor=color.new(#fefefe, 80), width = cw, height = ch) table.cell(wm, 18, 19, bgcolor=color.new(#ffffff, 80), width = cw, height = ch) table.cell(wm, 19, 19, bgcolor=color.new(#ffffff, 80), width = cw, height = ch)
Multi-timeframe Stochastic RSI
https://www.tradingview.com/script/2mVY3X5J-Multi-timeframe-Stochastic-RSI/
Snufkin420TC
https://www.tradingview.com/u/Snufkin420TC/
237
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/ // Β© Snufkin420TC //@version=5 indicator(title="Multi-timeframe Stochastic RSI", shorttitle="sRSI", format=format.price, precision=0, timeframe="", timeframe_gaps=false) //user options source = input.source(defval=close, title="Source") SRSI_bull_cutoff = input.int(defval=25, title="Stochastic RSI oversold cutoff", minval=0, maxval=100) SRSI_bear_cutoff = input.int(defval=75, title="Stochastic RSI overbought cutoff", minval=0, maxval=100) lowthreshold = input.int(defval=3, title="low bandpass", minval=0, maxval=22) highthreshold = input.int(defval=19, title="high bandpass", minval=0, maxval=22) // Use only time-frames available on the free tradingview sub freecheck = input.bool(defval=false, title="I have free TV") //select sRSI to view manually sRSIoverride = input.bool(defval=false, title="Manual sRSI") lowtime = input.timeframe('5', "sRSI 1", options = ['1','3','5','15','30','45','60','120','240','480','D','2D','W','2W','M','2M','4M']) midlowtime = input.timeframe('15', "sRSI 2", options = ['1','3','5','15','30','45','60','120','240','480','D','2D','W','2W','M','2M','4M']) midhightime = input.timeframe('30', "sRSI 3", options = ['1','3','5','15','30','45','60','120','240','480','D','2D','W','2W','M','2M','4M']) hightime = input.timeframe('60', "sRSI 4", options = ['1','3','5','15','30','45','60','120','240','480','D','2D','W','2W','M','2M','4M']) tp1 = 10 tp2 = 50 tp3 = 100 tp4 = 100 if (sRSIoverride == true) tp1 := 100 tp2 := 100 tp3 := 10 tp4 := 50 // Color Selection from drop down string colorscheme = input.string("Tron", "Color Scheme", options = ["Classic", "Rainbow", "Tron", "Blue"]) // functions k(_res) => request.security(syminfo.tickerid, _res, ta.sma(ta.stoch(ta.rsi(source, 14), ta.rsi(source, 14), ta.rsi(source, 14), 14), 3)[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off) d(_res) => request.security(syminfo.tickerid, _res, ta.sma(ta.sma(ta.stoch(ta.rsi(source, 14), ta.rsi(source, 14), ta.rsi(source, 14), 14), 3), 3)[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off) //get Timeframe of current chart and convert to a score for timeframe detection based switches timeframe = timeframe.period framescore = 0 framescore := if (timeframe == "M") 13 else if (timeframe == "W") 12 else if (timeframe == "D") 11 else if (timeframe == "480") 10 else if (timeframe == "240") 9 else if (timeframe == "180") 8 else if (timeframe == "120") 7 else if (timeframe == "60") 6 else if (timeframe == "30") 5 else if (timeframe == "15") 4 else if (timeframe == "5") 3 else if (timeframe == "3") 2 else if (timeframe == "1") 1 else 0 //Initialize time-frames and adjust according to chart time1 = "1" time2 = "3" time3 = "5" time4 = "15" time5 = "30" time6 = "45" time7 = "60" time8 = "120" time9 = "240" time10 = "480" time11 = "D" time12 = "2D" time13 = "W" time14 = "2W" time15 = "M" time16 = "2M" time17 = "4M" //Multi time-frame Stochastic RSI k and d - auto adjust for different time-frame charts k1 = k(time1) k2 = k(time3) k3 = k(time4) k4 = k(time5) k5 = k(time6) k6 = k(time7) k7 = k(time8) k8 = k(time9) k9 = k(time11) k10 = k(time13) k11 = k(time15) d1 = d(time1) d2 = d(time3) d3 = d(time4) d4 = d(time5) d5 = d(time6) d6 = d(time7) d7 = d(time8) d8 = d(time9) d9 = d(time11) d10 = d(time13) d11 = d(time15) if (framescore <= 3 and framescore > 1 and freecheck == false) k1 := k(time3) k2 := k(time4) k3 := k(time5) k4 := k(time6) k5 := k(time7) k6 := k(time8) k7 := k(time9) k8 := k(time11) k9 := k(time12) k10 := k(time13) k11 := k(time15) d1 := d(time3) d2 := d(time4) d3 := d(time5) d4 := d(time6) d5 := d(time7) d6 := d(time8) d7 := d(time9) d8 := d(time11) d9 := d(time12) d10 := d(time13) d11 := d(time15) else if (framescore == 4 and freecheck == false) k1 := k(time4) k2 := k(time5) k3 := k(time6) k4 := k(time7) k5 := k(time8) k6 := k(time9) k7 := k(time11) k8 := k(time12) k9 := k(time13) k10 := k(time14) k11 := k(time15) d1 := d(time4) d2 := d(time5) d3 := d(time6) d4 := d(time7) d5 := d(time8) d6 := d(time9) d7 := d(time11) d8 := d(time12) d9 := d(time13) d10 := d(time14) d11 := d(time15) else if (framescore > 4 and freecheck == false) k1 := k(time7) k2 := k(time8) k3 := k(time9) k4 := k(time10) k5 := k(time11) k6 := k(time12) k7 := k(time13) k8 := k(time14) k9 := k(time15) k10 := k(time16) k11 := k(time17) d1 := d(time7) d2 := d(time8) d3 := d(time9) d4 := d(time10) d5 := d(time11) d6 := d(time12) d7 := d(time13) d8 := d(time14) d9 := d(time15) d10 := d(time16) d11 := d(time17) col1 = color.new(color.yellow, tp1) col2 = color.new(color.blue, tp1) col3 = color.new(color.lime, tp1) col4 = color.new(color.red, tp1) col5 = color.new(color.yellow, tp2) col6 = color.new(color.blue, tp2) col7 = color.new(color.lime, tp2) col8 = color.new(color.red, tp2) if (colorscheme == 'Classic') //Classic Colors col1 := color.new(color.yellow, tp1) col2 := color.new(color.blue, tp1) col3 := color.new(color.lime, tp1) col4 := color.new(color.red, tp1) col5 := color.new(color.yellow, tp2) col6 := color.new(color.blue, tp2) col7 := color.new(color.lime, tp2) col8 := color.new(color.red, tp2) else if (colorscheme == 'Rainbow') //Rainbow Colors col1 := color.new(color.lime, tp1) col2 := color.new(color.yellow, tp1) col3 := color.new(color.orange, tp1) col4 := color.new(color.red, tp1) col5 := color.new(color.lime, tp2) col6 := color.new(color.yellow, tp2) col7 := color.new(color.orange, tp2) col8 := color.new(color.red, tp2) else if (colorscheme == 'Tron') //Tron Colors col1 := color.new(color.orange, tp1) col2 := color.new(color.red, tp1) col3 := color.new(color.purple, tp1) col4 := color.new(color.blue, tp1) col5 := color.new(color.orange, tp2) col6 := color.new(color.red, tp2) col7 := color.new(color.purple, tp2) col8 := color.new(color.blue, tp2) else if (colorscheme == 'Blue') //Blue Colors col1 := color.new(color.blue, tp1) col2 := color.new(color.blue, tp1) col3 := color.new(color.blue, tp1) col4 := color.new(color.blue, tp1) col5 := color.new(color.blue, tp2) col6 := color.new(color.blue, tp2) col7 := color.new(color.blue, tp2) col8 := color.new(color.blue, tp2) // colors to make backward compatible.. there's a better way to do this aco1 = color.new(color.yellow, tp3) aco2 = color.new(color.blue, tp3) aco3 = color.new(color.lime, tp3) aco4 = color.new(color.red, tp3) aco5 = color.new(color.yellow, tp4) aco6 = color.new(color.blue, tp4) aco7 = color.new(color.lime, tp4) aco8 = color.new(color.red, tp4) if (colorscheme == 'Classic') //Classic Colors aco1 := color.new(color.yellow, tp3) aco2 := color.new(color.blue, tp3) aco3 := color.new(color.lime, tp3) aco4 := color.new(color.red, tp3) aco5 := color.new(color.yellow, tp4) aco6 := color.new(color.blue, tp4) aco7 := color.new(color.lime, tp4) aco8 := color.new(color.red, tp4) else if (colorscheme == 'Rainbow') //Rainbow Colors aco1 := color.new(color.lime, tp3) aco2 := color.new(color.yellow, tp3) aco3 := color.new(color.orange, tp3) aco4 := color.new(color.red, tp3) aco5 := color.new(color.lime, tp4) aco6 := color.new(color.yellow, tp4) aco7 := color.new(color.orange, tp4) aco8 := color.new(color.red, tp4) else if (colorscheme == 'Tron') //Tron Colors aco1 := color.new(color.orange, tp3) aco2 := color.new(color.red, tp3) aco3 := color.new(color.purple, tp3) aco4 := color.new(color.blue, tp3) aco5 := color.new(color.orange, tp4) aco6 := color.new(color.red, tp4) aco7 := color.new(color.purple, tp4) aco8 := color.new(color.blue, tp4) else if(colorscheme == 'Blue') //Blue Colors aco1 := color.new(color.blue, tp3) aco2 := color.new(color.blue, tp3) aco3 := color.new(color.blue, tp3) aco4 := color.new(color.blue, tp3) aco5 := color.new(color.blue, tp4) aco6 := color.new(color.blue, tp4) aco7 := color.new(color.blue, tp4) aco8 := color.new(color.blue, tp4) //count number of sRSI that are in your favor bullcount = 0 if (k1 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k2 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k3 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k4 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k5 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k6 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k7 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k8 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k9 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k10 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (k11 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d1 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d2 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d3 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d4 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d5 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d6 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d7 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d8 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d9 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d10 <= SRSI_bull_cutoff) bullcount := bullcount + 1 if (d11 <= SRSI_bull_cutoff) bullcount := bullcount + 1 bearcount = 0 if (k1 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k2 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k3 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k4 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k5 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k6 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k7 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k8 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k9 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k10 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (k11 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d1 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d2 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d3 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d4 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d5 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d6 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d7 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d8 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d9 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d10 >= SRSI_bear_cutoff) bearcount := bearcount + 1 if (d11 >= SRSI_bear_cutoff) bearcount := bearcount + 1 //Plot and colors bulllow = color.new(color.green, 100) bullhigh = color.new(color.green, 0) bearlow = color.new(color.red, 100) bearhigh = color.new(color.red, 0) bullcolor = color.from_gradient(bullcount, lowthreshold, highthreshold, bulllow, bullhigh) bearcolor = color.from_gradient(bearcount, lowthreshold, highthreshold, bearlow, bearhigh) hbear = hline(SRSI_bear_cutoff, linestyle=hline.style_solid, color=color.new(color.gray,100), linewidth=1, editable=false) hbull = hline(SRSI_bull_cutoff, linestyle=hline.style_solid, color=color.new(color.gray,100), linewidth=1, editable=false) htop = hline(100, linestyle=hline.style_solid, color=color.new(color.gray,100), linewidth=1, editable=false) hbottom = hline(0, linestyle=hline.style_solid, color=color.new(color.gray,100), linewidth=1, editable=false) fill(hbear, htop, color=bearcolor, editable=false) fill(hbull, hbottom, color=bullcolor, editable=false) // Normal auto adjusting plots plot1 = plot(k2, linewidth=1, color=col5) plot2 = plot(d2, linewidth=1, color=col1) plot3 = plot(k3, linewidth=1, color=col6) plot4 = plot(d3, linewidth=1, color=col2) plot5 = plot(k4, linewidth=1, color=col7) plot6 = plot(d4, linewidth=1, color=col3) plot7 = plot(k5, linewidth=1, color=col8) plot8 = plot(d5, linewidth=1, color=col4) // Alternative plots with manual override plot9 = plot(k(lowtime), linewidth=1, color=aco5) plot10 = plot(d(lowtime), linewidth=1, color=aco1) plot11 = plot(k(midlowtime), linewidth=1, color=aco6) plot12 = plot(d(midlowtime), linewidth=1, color=aco2) plot13 = plot(k(midhightime), linewidth=1, color=aco7) plot14 = plot(d(midhightime), linewidth=1, color=aco3) plot15 = plot(k(hightime), linewidth=1, color=aco8) plot16 = plot(d(hightime), linewidth=1, color=aco4) // END
P/L panel
https://www.tradingview.com/script/BQWstRAD-P-L-panel/
NumberGames
https://www.tradingview.com/u/NumberGames/
75
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/ // Β© nandawithu //@version=4 study("P/L panel", overlay=true) price=input(0.00,title="Entry Price",tooltip="Input ENTRY PRICE of position",confirm=true) quantity=input(0,title="Qty ", tooltip='Input the QUANTITY'+ '\n' +'for Long enter + value'+ '\n' +'for Short enter - value',confirm=true) tableposition=input("bottom_left",title="Table position", options=["top_left", "top_center", "top_right", "middle_left", "middle_center", "middle_right", "bottom_left", "bottom_center", "bottom_right"]) PNL= (close-price)*quantity tabpos= tableposition== "top_left"? position.top_left:tableposition== "top_center"?position.top_center : tableposition== "top_right"? position.top_right : tableposition== "middle_left"? position.middle_left : tableposition== "middle_center"? position.middle_center : tableposition== "middle_right"? position.middle_right : tableposition== "bottom_left"? position.bottom_left : tableposition== "bottom_center"? position.bottom_center: tableposition== "bottom_right"? position.bottom_right: position.top_right var testTable = table.new(position = tabpos, columns = 4, rows = 3, bgcolor = color.yellow,frame_color=color.black,border_color=color.black, border_width = 1, frame_width=1) if barstate.islast table.cell(table_id = testTable, column = 0, row = 0, text = quantity>0?"Long":"Short") table.cell(table_id = testTable, column = 1, row = 0, text = 'Price: '+ tostring(round(price,2)) + '\n' + 'Qty: ' + tostring(abs(quantity))) table.cell(table_id = testTable, column = 0, row = 1, text = "Points") table.cell(table_id = testTable, column = 1, row = 1, text = (quantity>0 or quantity<0)?tostring(abs(round((close-price),2))):"0") table.cell(table_id = testTable, column = 0, row = 2, text = "P/L") table.cell(table_id = testTable, column = 1, row = 2, text = tostring(round(PNL,2)),bgcolor=PNL>0?color.green:PNL<0?color.red:na)
Bar Percent Complete
https://www.tradingview.com/script/rE5svZts-Bar-Percent-Complete/
cmthoman
https://www.tradingview.com/u/cmthoman/
24
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/ // Β© cmthoman //@version=5 indicator("Bar Percent Complete") percent = input.int(title="Percent", defval=50, minval=1, maxval=100, step=1) //varip variables allow intrabar states to be saved varip bool conditionMet = false varip bool stop = false //----Calculate Bar Completion Percentage barPercentage(percent) => int barLen = math.abs(time - time[1]) int barPercentThreshold = math.round((percent / 100 * barLen) + time) timenow >= barPercentThreshold ? true : false //Reset stop if barstate.isrealtime and barstate.isnew stop := false conditionMet := false //On the realtime bar and if the stop condition is false, test the time percentage if barstate.isrealtime and not stop conditionMet := barPercentage(percent) if conditionMet alert("Bar is at least " + str.tostring(percent) + "% complete!", alert.freq_all) stop := true plot(close, display=display.none)
UK Sectors Comparison SMA
https://www.tradingview.com/script/Djs44FGb-UK-Sectors-Comparison-SMA/
Berengrave
https://www.tradingview.com/u/Berengrave/
34
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/ // Β© Berengrave //@version=5 indicator("UK Sectors", shorttitle="UKS", overlay=false) smalength = input.int(50, title="SMA Length", tooltip="Default = 50\n Another good option is 100 or 200", group="Settings") absolute = input.bool(false, title="Show absolute value", tooltip="Selected = show the absolute index value.\nNot Selected = show as a percentage increase / decrease baselined from baseline index (see tooltip below for more)", group="Settings") base = input.symbol("CBOEEU:BUKAC", title="Baseline Index", tooltip="Default = UK All Companies Index\nWhen Show absolute value is checked, this shows as a filled area (to easily see which is below it).\nWhen show absolute is not checked, it this index is represented by the 0% line", group="Baseline") conc = input.symbol("CBOEEU:BUKCONC", title="UK Consumer Cyclicals", group="Sectors") minp = input.symbol("CBOEEU:BUKMINP", title="UK Mining and Minerals Products", group="Sectors") fin = input.symbol("CBOEEU:BUKFIN", title="UK Financials", group="Sectors") tec = input.symbol("CBOEEU:BUKTEC", title="UK Technology", group="Sectors") tel = input.symbol("CBOEEU:BUKTEL", title="UK Telecoms", group="Sectors") cons = input.symbol("CBOEEU:BUKCONS", title="UK Consumer Services", group="Sectors") hlth = input.symbol("CBOEEU:BUKHLTH", title="UK Healthcare", group="Sectors") engy = input.symbol("CBOEEU:BUKENGY", title="UK Energy", group="Sectors") utl = input.symbol("CBOEEU:BUKUTL", title="UK Utilities", group="Sectors") bus = input.symbol("CBOEEU:BUKBUS", title="UK Business Services", group="Sectors") cnc = input.symbol("CBOEEU:BUKCNC", title="UK Consumer Non-Cyclicals", group="Sectors") ind = input.symbol("CBOEEU:BUKIND", title="UK Industrials", group="Sectors") nem = input.symbol("CBOEEU:BUKNEM", title="UK Non-Energy Materials", group="Sectors") baseline = request.security(base, "D", close) baselinesma = ta.sma(baseline, smalength) getSma(sec, length) => ss = request.security(sec, "D", close) sma = ta.sma(ss, length) pc = ((sma / baselinesma)*100)-100 output = absolute ? sma : pc // return either the percentage value (vs baseline) or the raw sma data plot(getSma(conc, length=smalength), color=#d98880, linewidth=1, editable=true, title="Cons Cyclicals") plot(getSma(minp, length=smalength), color=#f1948a, linewidth=1, editable=true, title="Mining Minerals") plot(getSma(fin, length=smalength), color=#ff0021, linewidth=1, editable=true, title="Finance") plot(getSma(tec, length=smalength), color=#c39bd3, linewidth=1, editable=true, title="Tech") plot(getSma(tel, length=smalength), color=#ff0041, linewidth=1, editable=true, title="Tel") plot(getSma(cons, length=smalength), color=#bb8fce, linewidth=1, editable=true, title="Cons Servs") plot(getSma(hlth, length=smalength), color=#7fb3d5, linewidth=1, editable=true, title="Health") plot(getSma(engy, length=smalength), color=#85c1e9, linewidth=1, editable=true, title="Energy") plot(getSma(utl, length=smalength), color=#76d7c4, linewidth=1, editable=true, title="Utilities") plot(getSma(bus, length=smalength), color=#f5b041, linewidth=1, editable=true, title="Bus Svcs") plot(getSma(cnc, length=smalength), color=#7dcea0, linewidth=1, editable=true, title="Cons NonCyc") plot(getSma(ind, length=smalength), color=#82e0aa, linewidth=1, editable=true, title="Industrial") plot(getSma(nem, length=smalength), color=#f7dc6f, linewidth=1, editable=true, title="NonEngergy Mats") plot(getSma(base, length=smalength)[1], color=#00000009, linewidth=2, editable=true, style=plot.style_area, title="Baseline")
Moving Average exponential by krishnam 200
https://www.tradingview.com/script/6OHsgzYf-Moving-Average-exponential-by-krishnam-200/
liarpradyumn
https://www.tradingview.com/u/liarpradyumn/
8
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/ // Β© liarpradyumn //@version=5 indicator(title="Moving Average", shorttitle="MA", overlay=true, timeframe="", timeframe_gaps=true) len = input.int(200, minval=1, title="Length") src = input(close, title="Source") offset = input.int(title="Offset", defval=0, minval=-500, maxval=500) out = ta.sma(src, len) plot(out, color=color.blue, title="MA", offset=offset)
Dip Volume V1
https://www.tradingview.com/script/Th81t3t9-Dip-Volume-V1/
Dipankar_Biswas
https://www.tradingview.com/u/Dipankar_Biswas/
37
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/ // Β© Dipankar_Biswas // @version=4 study("Dip Volume V1") futures_volume = input(defval = 'NSE:BANKNIFTY1!',title = "Volume Data",options = ['NSE:BANKNIFTY1!','NSE:NIFTY1!']) referenceData = security(futures_volume, resolution=timeframe.period, expression=volume) plot(referenceData, color=(open > close) ? #ef5350 : #26a69a,style=plot.style_columns, title="Volume", transp=50)
K's Volatility Bands
https://www.tradingview.com/script/Pb3QDV5G-K-s-Volatility-Bands/
Sofien-Kaabar
https://www.tradingview.com/u/Sofien-Kaabar/
71
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/ // Β© Sofien-Kaabar //@version=5 indicator("K's Volatility Bands", overlay = true) lookback = input(defval = 13, title = 'Lookback') multiplier = input(defval = 2, title = 'Multiplier') median = (ta.highest(high, lookback) + ta.lowest(low, lookback)) / 2 maximum_volatility = ta.highest(ta.stdev(close, lookback), lookback) upper_band = median + (multiplier * maximum_volatility) lower_band = median - (multiplier * maximum_volatility) plot(upper_band, color = color.red) plot(median, color = close > median ? color.blue: color.black, linewidth = 2) plot(lower_band, color = color.green)
Speed Indicator
https://www.tradingview.com/script/LSb23VWz-Speed-Indicator/
maksumit
https://www.tradingview.com/u/maksumit/
171
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/ // Β© sumitmak //@version=5 indicator("Speed Indicator", shorttitle="SI") //Time and Speed Range t = input.int(20, "Speed Period", 1) mp = input.int(20, "Moving Average Period", 1) h = input.int(20, "Channel Period", 1) hl = input.bool(false, "High/Low", "To use either close values or high/low") p = input.bool(false, "Speed Price Percentage", "Display Speed in Percentage to Closing Price") ma = input.bool(false, "Speed EMA", "Applies an EMA line to the Indicator") mm = input.bool(true, "Minimum Maximum Speed Bands", "Shows a min-max channel like the Donchian Channels on the Indicator") bb = input.bool(false, "Triple Bollinger Bands", "Shows three different Bollinger Band channels") //Distance gu = low > high[1] ? (low - high[1]):na gd = high < low[1] ? (low[1] - high):na hlg = low > high[1] ? (high - low + gu) : high < low[1] ? (high - low + gd) : (high - low) clc = math.abs(close - close[1]) dis = hl ? hlg : clc d = math.sum(dis, t) //Speed s = d/t sp = s/close*100 sv = p ? sp:s //Speedometer Min-Max Bands max = ta.highest(sv, h) min = ta.lowest(sv, h) sr = (max - min)/3 hs = max - sr ls = min + sr //Speed Standard Deviation Bands ema = ta.ema(sv, mp) std = ta.stdev(sv, h) bbu1 = ema+1*std bbl1 = ema-1*std bbu2 = ema+2*std bbl2 = ema-2*std bbu3 = ema+3*std bbl3 = ema-3*std //Plots and Fills p1 = plot(mm ? max:na, "Max", color.red) p2 = plot(mm ? hs:na, "High", color.yellow) plot(mm ? ls:na, "Low", color.green) plot(mm ? min:na, "Min", color.blue) plot(ma ? ema:na, "Average Speed", color.orange) plot(bb ? bbu1:na, "Upper 1 SD", color.green) plot(bb ? bbl1:na, "Lower 1 SD", color.green) bb1 = plot(bb ? bbu2:na, "Upper 2 SD", color.yellow) bb2 = plot(bb ? bbl2:na, "Lower 2 SD", color.yellow) bb3 = plot(bb ? bbu3:na, "Upper 3 SD", color.red) bb4 = plot(bb ? bbl3:na, "Lower 3 SD", color.red) plot(sv, "Speed", #FF0000, 2) fill(p1, p2, color.new(color.red, 90),"Top Range") fill(bb1, bb3, color.new(color.red, 90), "Upper 3 SD Range") fill(bb2, bb4, color.new(color.red, 90), "Lower 3 SD Range")
NADFULL-MACDU
https://www.tradingview.com/script/fSv9senJ/
rsxyk
https://www.tradingview.com/u/rsxyk/
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/ // Β© qq182004797 //@version=5 //ε˜θ‰²MACDοΌˆι™„ε›ΎζŒ‡ζ ‡οΌ‰ indicator("NADFULL-MACDU")//ζŒ‡ζ ‡εη§° [macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)//12,26,9是MACD参数 //显瀺MACDζŒ‡ζ ‡ float macd=macdLine-signalLine plot(macdLine, "DIFF", ta.rising(macdLine, 1) ? #FF0000 : #ffffff, 5)//DIFFηš„ι’œθ‰²εŠη²—η»† plot(signalLine, "DEA", ta.rising(signalLine, 1) ? #FF0000 : #ffffff, 1)//DEAηš„ι’œθ‰²εŠη²—η»† plot(macd>0?macd:0, "MACD", ta.rising(macd, 1) ? #ff0080 : #00ffff, 4, style = plot.style_histogram)//0θ½΄δΉ‹δΈŠMACDζŸ±ε­ηš„ι’œθ‰²εŠη²—η»† plot(macd<0?macd:0, "MACD", ta.rising(macd, 1) ? #ffff00 : #008000, 4, style = plot.style_histogram)//0轴之下MACDζŸ±ε­ηš„ι’œθ‰²εŠη²—η»†
Traders Paradise
https://www.tradingview.com/script/gpuc0vQF-Traders-Paradise/
Lazylady
https://www.tradingview.com/u/Lazylady/
26
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/ // Β© Bull Club Bias //@version=5 indicator(title="Traders Paradise", shorttitle="BCB_TP", format=format.price, precision=2, timeframe="", timeframe_gaps=true, overlay = true) //define colours color1 = #808080 color2 = #ff0000 color3 = #90ee90 color4 = #90ee90 color5 = #008000 color6 = #e0b0ff color7 = #ffa500 color8 = #00ff00 //define choppiness length = input.int(14, minval=1) ci = 100 * math.log10(math.sum(ta.atr(1), length) / (ta.highest(length) - ta.lowest(length))) / math.log10(length) offset = input.int(0, "Offset", minval = -500, maxval = 500) //plot(ci, "CHOP", color=#2962FF, offset = offset) //band1 = hline(100, "Upper Band", color=#ffffff, linestyle=hline.style_dashed) //band0 = hline(0, "Lower Band", color=#ffffff, linestyle=hline.style_dashed) //fill(band1, band0, color = color.rgb(33, 150, 243,100), title = "Background") ma1 = ta.sma(ci,25) //plot(ma1, "CHOP MA", color=#000000, offset = offset) //Define ATR lengthATR = input.int(title="Length ATR", defval=14, minval=1) smoothing = input.string(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"]) ma_function(source, lengthATR) => switch smoothing "RMA" => ta.rma(source, lengthATR) "SMA" => ta.sma(source, lengthATR) "EMA" => ta.ema(source, lengthATR) => ta.wma(source, lengthATR) //plot(ma_function(ta.tr(true), lengthATR), title = "ATR", color=color.new(#B71C1C, 0)) ma2 = ta.sma(ma_function(ta.tr(true), lengthATR),25) //plot(ma2, "CHOP MA", color=#000000, offset = offset) atrPLOT = ma_function(ta.tr(true), lengthATR) x = 0 //Define COlour selection if ((ci >= ma1) and (atrPLOT <= ma2))// and (ci > ci[1])) x := 1 if ((ci >= ma1) and (atrPLOT <= ma2))// and (ci < ci[1])) x := 1 if ((ci >= ma1) and (atrPLOT > ma2))// and (ci > ci[1])) x := 2 if ((ci >= ma1) and (atrPLOT > ma2))// and (ci < ci[1])) x := 2 if ((ci < ma1) and (atrPLOT <= ma2))// and (ci > ci[1])) x := 3 if ((ci < ma1) and (atrPLOT <= ma2))// and (ci < ci[1])) x := 3 if ((ci < ma1) and (atrPLOT > ma2))// and (ci > ci[1])) x := 4 if ((ci < ma1) and (atrPLOT > ma2))// and (ci < ci[1])) x := 4 //plot (10*x,"X") //Colour the background sessioncolor = (x<2)?color1:(x<3 and x>1)?color2:(x<4and x>2)?color3:(x<5and x>3)?color4:color1//(x<6 and x>4)?color5:(x<7and x>5)?color6:(x<8and x>6)?color7:(x<9and x>7)?color8:color1 bgcolor(sessioncolor,transp = 90,title = "Trading")
Price Action [Morty]
https://www.tradingview.com/script/A2XSWX5J-Price-Action-Morty/
M0rty
https://www.tradingview.com/u/M0rty/
1,106
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/ // Β© M0rty //@version=5 indicator('Price Action [Morty]', overlay=true, timeframe="", timeframe_gaps=true) //------------------------------------------------------------------------------ // inputs mode = input.string(title='HTF Method', defval='Auto', options=['Auto', 'Manual'], group='SSL Channel') //auto higher time frame HTF_auto = timeframe.period == '1' ? '30' : timeframe.period == '2' ? '30' : timeframe.period == '3' ? '60' : timeframe.period == '5' ? '60' : timeframe.period == '15' ? '120' : timeframe.period == '30' ? '240' : timeframe.period == '45' ? '240' : timeframe.period == '60' ? '240' : timeframe.period == '120' ? '480' : timeframe.period == '180' ? '720' : timeframe.period == '240' ? 'D' : timeframe.period == '360' ? 'D' : timeframe.period == '480' ? '2D' : timeframe.period == '720' ? '3D' : timeframe.period == 'D' ? '3D' : timeframe.period == '3D' ? 'W' : '5W' HTF_manual = input.timeframe('240', title='Timeframe (if HTF Method=Manual)', group='SSL Channel') HTF = mode == 'Auto' ? HTF_auto : HTF_manual show_htf_ssl = input.bool(false, title='Show HTF SSL Channel', group='SSL Channel') highlight_bg = input.bool(true, title='Highlight background', group='SSL Channel') src = input.source(close, title='EMA Source', group='EMA') ema_fast_length = input.int(10, minval=1, title='Fast EMA Length', group='EMA') ema_slow_length = input.int(20, minval=1, title='Slow EMA Length', group='EMA') len = input.int(60, minval=1, title='Long Period EMA Length', group='EMA') C_LongShadowPercent = input.int(65, 'Long Shadow Percent', minval=40, maxval=90, group='Candlestick Pattern') enable_engulfing = input.bool(true, 'Enable Engulfing', group='Candlestick Pattern') enable_harami = input.bool(false, 'Enable Harami', group='Candlestick Pattern') enable_pinbar = input.bool(true, 'Enable Pin Bar', group='Candlestick Pattern') enable_2bar_reversal = input.bool(true, 'Enable 2 Bar Reversal', group='Candlestick Pattern') show_c_pattern = input.bool(true, 'Show candlestick patterns', group='Signal') show_buy_sell = input.bool(true, 'Show buy and sell signals', group='Signal') filter_by_trend = input.bool(true, 'Filter signals by trend', group='Signal') filter_by_adx = input.bool(true, title='Filter signals by ADX >', inline='adx', group='Signal') adx_th = input.float(20.0, title='ADX_th', inline='adx', group='Signal') filter_by_squeeze = input.bool(false, 'Filter by Squeeze (Bbands inside Keltner Channels)', group='Signal') filter_by_low_volume = input.bool(false, 'Filter by low volume', group='Signal') show_squeeze = input.bool(true, 'Show Squeeze', group='Signal') //------------------------------------------------------------------------------ // calc adx dirmov(len) => up = ta.change(high) down = -ta.change(low) plusDM = na(up) ? na : up > down and up > 0 ? up : 0 minusDM = na(down) ? na : down > up and down > 0 ? down : 0 truerange = ta.rma(ta.tr, len) plus = fixnan(100 * ta.rma(plusDM, len) / truerange) minus = fixnan(100 * ta.rma(minusDM, len) / truerange) [plus, minus] adx(dilen, adxlen) => [plus, minus] = dirmov(dilen) sum = plus + minus adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) adx adx_value = adx(14, 14) strong_trend = adx_value > adx_th //------------------------------------------------------------------------------ // calc squeeze f_squeeze(source) => // Calculate BB basis = ta.sma(source, 20) dev = 2 * ta.stdev(source, 20) upperBB = basis + dev lowerBB = basis - dev // Calculate KC ma = ta.sma(source, 20) rangema = ta.sma(ta.tr, 20) upperKC = ma + rangema * 1.5 lowerKC = ma - rangema * 1.5 // return squeeze squeeze = lowerBB > lowerKC and upperBB < upperKC squeeze squeeze = f_squeeze(close) // plot squeeze on the top of main chart mom = ta.mom(close, 20) // squeeze circle location is base on momentum plotshape(show_squeeze ? (squeeze and mom >= 0) : na, title='Volatility Squeeze', location=location.belowbar, color=color.new(color.orange, 60), style=shape.circle, size=size.tiny) plotshape(show_squeeze ? (squeeze and mom < 0) : na, title='Volatility Squeeze', location=location.abovebar, color=color.new(color.orange, 60), style=shape.circle, size=size.tiny) //------------------------------------------------------------------------------ // calc higher timeframe SSL Channel [h, l, c] = request.security(syminfo.tickerid, HTF, [high, low, close], gaps=barmerge.gaps_on, lookahead=barmerge.lookahead_on) smaHigh = ta.sma(h, 10) smaLow = ta.sma(l, 10) Hlv = float(na) Hlv := c > smaHigh ? 1 : c < smaLow ? -1 : Hlv[1] sslDown = Hlv < 0 ? smaHigh : smaLow sslUp = Hlv < 0 ? smaLow : smaHigh plot(show_htf_ssl ? sslDown : na, title='SSL Channel Down', linewidth=2, color=color.new(color.red, 0)) plot(show_htf_ssl ? sslUp : na, title='SSL Channel Up', linewidth=2, color=color.new(color.lime, 0)) //------------------------------------------------------------------------------ // Calc EMA ema = ta.ema(src, len) ema_fast = ta.ema(src, ema_fast_length) ema_slow = ta.ema(src, ema_slow_length) // plot EMAs plot(ema, title='EMA Long Period', color=color.new(color.blue, 0), linewidth=2) l1 = plot(ema_fast, 'EMA Fast', color=color.new(color.green, 0)) l2 = plot(ema_slow, 'EMA Slow', color=color.new(color.red, 0)) fill(l1, l2, color=ema_fast > ema_slow ? color.new(color.green, 80) : color.new(color.red, 80), title='Backgroud of EMA cradle') //------------------------------------------------------------------------------ // detect trend C_DownTrend = true C_UpTrend = true C_DownTrend := sslUp < sslDown C_UpTrend := sslUp > sslDown // highlight background base on trend bgcolor(highlight_bg ? C_UpTrend ? color.new(color.green, 80) : na : na, title='Up trend background') bgcolor(highlight_bg ? C_DownTrend ? color.new(color.red, 80) : na : na, title='Down trend background') // low volume is_low_volume = volume < ta.sma(volume, 14) //------------------------------------------------------------------------------ // candlestick pattern variables C_Len = 7 // ema depth for bodyAvg, original 14 C_ShadowPercent = 5.0 // size of shadows C_ShadowEqualsPercent = 100.0 C_DojiBodyPercent = 8.5 // original 5.0 C_Factor = 2.0 // shows the number of times the shadow dominates the candlestick body C_BodyHi = math.max(close, open) C_BodyLo = math.min(close, open) C_Body = C_BodyHi - C_BodyLo C_BodyAvg = ta.ema(C_Body, C_Len) C_SmallBody = C_Body < C_BodyAvg C_LongBody = C_Body > C_BodyAvg C_UpShadow = high - C_BodyHi C_DnShadow = C_BodyLo - low C_HasUpShadow = C_UpShadow > C_ShadowPercent / 100 * C_Body C_HasDnShadow = C_DnShadow > C_ShadowPercent / 100 * C_Body C_WhiteBody = open < close C_BlackBody = open > close C_Range = high - low C_IsInsideBar = C_BodyHi[1] > C_BodyHi and C_BodyLo[1] < C_BodyLo C_BodyMiddle = C_Body / 2 + C_BodyLo C_ShadowEquals = C_UpShadow == C_DnShadow or math.abs(C_UpShadow - C_DnShadow) / C_DnShadow * 100 < C_ShadowEqualsPercent and math.abs(C_DnShadow - C_UpShadow) / C_UpShadow * 100 < C_ShadowEqualsPercent C_IsDojiBody = C_Range > 0 and C_Body <= C_Range * C_DojiBodyPercent / 100 C_Doji = C_IsDojiBody and C_ShadowEquals //------------------------------------------------------------------------------ // Candlestick patterns recognition // Engulfing C_EngulfingBullish = enable_engulfing and C_WhiteBody and C_LongBody and C_BlackBody[1] and C_SmallBody[1] and close >= open[1] and open <= close[1] and (close > open[1] or open < close[1]) C_EngulfingBearish = enable_engulfing and C_BlackBody and C_LongBody and C_WhiteBody[1] and C_SmallBody[1] and close <= open[1] and open >= close[1] and (close < open[1] or open > close[1]) // Harami C_HaramiBullish = enable_harami and C_LongBody[1] and C_BlackBody[1] and C_WhiteBody and C_SmallBody and high <= C_BodyHi[1] and low >= C_BodyLo[1] C_HaramiBearish = enable_harami and C_LongBody[1] and C_WhiteBody[1] and C_BlackBody and C_SmallBody and high <= C_BodyHi[1] and low >= C_BodyLo[1] // Pin bar Aka long shadow C_PinbarBullish = enable_pinbar and C_DnShadow > C_Range / 100 * C_LongShadowPercent C_PinbarBearish = enable_pinbar and C_UpShadow > C_Range / 100 * C_LongShadowPercent // 2 bar reversal C_2BarReversalBullish = enable_2bar_reversal and C_LongBody[1] and C_BlackBody[1] and C_WhiteBody and C_Body > C_Body[1] C_2BarReversalBearish = enable_2bar_reversal and C_LongBody[1] and C_WhiteBody[1] and C_BlackBody and C_Body > C_Body[1] // bullish and bearish patterns C_Bullish = C_EngulfingBullish or C_HaramiBullish or C_PinbarBullish or C_2BarReversalBullish C_Bearish = C_EngulfingBearish or C_HaramiBearish or C_PinbarBearish or C_2BarReversalBearish //------------------------------------------------------------------------------ // plot patterns labels plotshape(show_c_pattern ? C_EngulfingBullish : na, 'Engulfing Bullish', location=location.belowbar, color=color.new(color.green, 0), style=shape.diamond, size=size.tiny) plotshape(show_c_pattern ? C_EngulfingBearish : na, 'Engulfing Bearish', location=location.abovebar, color=color.new(color.red, 0), style=shape.diamond, size=size.tiny) plotshape(show_c_pattern ? C_HaramiBullish : na, 'Harami Bullish', location=location.belowbar, color=color.new(color.green, 0), style=shape.circle, size=size.tiny) plotshape(show_c_pattern ? C_HaramiBearish : na, 'Harami Bearish', location=location.abovebar, color=color.new(color.red, 0), style=shape.circle, size=size.tiny) plotshape(show_c_pattern ? C_PinbarBullish : na, 'Pin Bar Bullish', location=location.belowbar, color=color.new(#00897b, 65), style=shape.triangleup, size=size.tiny) plotshape(show_c_pattern ? C_PinbarBearish : na, 'Pin Bar Bearish', location=location.abovebar, color=color.new(color.red, 65), style=shape.triangledown, size=size.tiny) plotshape(show_c_pattern ? C_2BarReversalBullish : na, '2 Bar Reversal Bullish', location=location.belowbar, color=color.new(#00897b, 0), style=shape.triangleup, size=size.tiny) plotshape(show_c_pattern ? C_2BarReversalBearish : na, '2 Bar Reversal Bearish', location=location.abovebar, color=color.new(color.red, 0), style=shape.triangledown, size=size.tiny) //------------------------------------------------------------------------------ // buy and sell signals // Only entry after pullback buy = (filter_by_trend ? C_UpTrend : true) and (filter_by_adx ? strong_trend : true) and (filter_by_squeeze ? squeeze : true) and C_Bullish and low < ema_fast and ema_fast > ema_slow and (filter_by_low_volume ? is_low_volume : true) sell = (filter_by_trend ? C_DownTrend : true) and (filter_by_adx ? strong_trend : true) and (filter_by_squeeze ? squeeze : true) and C_Bearish and high > ema_fast and ema_fast < ema_slow and (filter_by_low_volume ? is_low_volume : true) plotshape(show_buy_sell and buy, text='buy', style=shape.labelup, textcolor=color.new(color.white, 0), color=color.new(color.green, 0), location=location.belowbar, title='buy') plotshape(show_buy_sell and sell, text='sell', style=shape.labeldown, textcolor=color.new(color.white, 0), color=color.new(color.red, 0), location=location.abovebar, title='sell')
RSI Levels, Multi-Timeframe
https://www.tradingview.com/script/3ucH7Ccz-RSI-Levels-Multi-Timeframe/
jmosullivan
https://www.tradingview.com/u/jmosullivan/
68
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/ // Β© jmosullivan // The relative strength index (RSI) is a momentum indicator that measures the magnitude of recent price changes to evaluate // overbought or oversold conditions. The RSI is normally displayed as an oscillator separately from price and can have a // reading from 0 to 100. This indicator takes the RSI and plots the 30 & 70 levels onto the price chart so you can see when // price is going to meet the 30 or 70 levels. The reason the 30 & 70 levels are important is because many traders (and bots) // use those as signals to buy (at 30 RSI) or sell (at 70 RSI). Additionally, this indicator allows you to display not just // the RSI levels of your currently viewed timeframe on the chart, but also shows the RSI levels of up to 6 different // timeframes on the same chart. This allows you to quickly see if multiple RSI levels are aligning across different timelines, // which is an even stronger indication that price is going to change direction when it meets those levels on the chart. There // are a lot of nice configuration options, like: // * Style customization (color, thickness, size) // * Labels on the chart so you can tell which plots are the RSI levels // * Optionally display the plot as a horizontal line if all you care about is the RSI level right now // * Toggle overbought (RSI 70) or oversold (RSI 30) on/off completely // Credit to @abdomi for the RSI Levels script, which inspired this one. That script only allows you to see RSI levels for your // current timeframe on your current timeframe. //@version=5 indicator("RSI Lvls MTF", overlay = true) // Functions tf_toint(tf) => int rtf = switch tf "1" => 60 "2" => 120 "3" => 180 "5" => 300 "10" => 600 "13" => 780 "15" => 900 "30" => 1800 "45" => 2700 "60" => 3600 "120" => 7200 "180" => 10800 "240" => 14400 "360" => 21600 "480" => 28800 "720" => 43200 "1D" => 86400 "D" => 86400 "1W" => 604800 "W" => 604800 "1M" => 2592000 "M" => 2592000 => 1 // default rtf tfm_toint() => int rtf = 0 if (timeframe.isseconds) rtf := timeframe.multiplier if (timeframe.isminutes) rtf := timeframe.multiplier * 60 if (timeframe.isdaily) rtf := timeframe.multiplier * 60 * 60 * 24 if (timeframe.isweekly) rtf := timeframe.multiplier * 60 * 60 * 24 * 7 if (timeframe.ismonthly) rtf := timeframe.multiplier * 60 * 60 * 24 * 30 rtf tf_tostring(tf) => string rtf = switch tf "1" => "1m" "2" => "2m" "3" => "3m" "5" => "5m" "13" => "13m" "15" => "15m" "30" => "30m" "45" => "45m" "60" => "1h" "120" => "2h" "180" => "3h" "240" => "4h" "360" => "6h" "480" => "8h" "720" => "12h" "D" => "1D" "W" => "1W" "M" => "1M" => tf // default rtf tf_str(tf, suffix) => tf_tostring(tf) + " " + suffix // Function to do the plotting (adapted from abdomi's script) rsi_to_plot(tf, rsi_lvl, len) => ep = 2 * len - 1 auc = request.security(syminfo.tickerid, tf, ta.ema(math.max(close - close[1], 0), ep)) adc = request.security(syminfo.tickerid, tf, ta.ema(math.max(close[1] - close, 0), ep)) x = (len - 1) * ( adc * rsi_lvl / (100 - rsi_lvl) - auc) x >= 0 ? close + x : close + x * (100 - rsi_lvl) / rsi_lvl // Configuration grp_mn = "Global Line Settings" length = input( group=grp_mn, defval=14, title="RSI Length") linewidth = input.int( group=grp_mn, defval=1, title="Line Weight", options=[1,2,3,4]) lbl_txtsize = input.string(group=grp_mn, defval=size.normal, title="Label Text Size", options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge]) lbl_offset = input.int( group=grp_mn, defval=4, title="Label Offset", minval=0, maxval=100) show_labels = input.bool( group=grp_mn, defval=true, title="Show Labels") do_line = input.bool( group=grp_mn, defval=false, title="Do Horizontal Lines") do_ob = input.bool( group=grp_mn, defval=true, title="Show Overbought RSIs") do_os = input.bool( group=grp_mn, defval=true, title="Show Oversold RSIs") grp = "Timeframe Visibility & Colors" transparency = 50 show_1 = input.bool(defval=true, title="", inline="tf1", group=grp) show_2 = input.bool(defval=true, title="", inline="tf2", group=grp) show_3 = input.bool(defval=true, title="", inline="tf3", group=grp) show_4 = input.bool(defval=true, title="", inline="tf4", group=grp) show_5 = input.bool(defval=true, title="", inline="tf5", group=grp) show_6 = input.bool(defval=true, title="", inline="tf6", group=grp) tf_1 = input.timeframe(defval="5", title="", inline="tf1", group=grp) tf_2 = input.timeframe(defval="15", title="", inline="tf2", group=grp) tf_3 = input.timeframe(defval="60", title="", inline="tf3", group=grp) tf_4 = input.timeframe(defval="240", title="", inline="tf4", group=grp) tf_5 = input.timeframe(defval="720", title="", inline="tf5", group=grp) tf_6 = input.timeframe(defval="D", title="", inline="tf6", group=grp) color_1 = input.color(defval=color.new(color.lime, transparency), title="", inline="tf1", group=grp) color_2 = input.color(defval=color.new(color.green, transparency), title="", inline="tf2", group=grp) color_3 = input.color(defval=color.new(color.aqua, transparency), title="", inline="tf3", group=grp) color_4 = input.color(defval=color.new(color.blue, transparency), title="", inline="tf4", group=grp) color_5 = input.color(defval=color.new(color.navy, transparency), title="", inline="tf5", group=grp) color_6 = input.color(defval=color.new(color.black, transparency), title="", inline="tf6", group=grp) // Prevent TFs below the current TF to be shown (TV Calculates them incorrectly) if tf_toint(tf_1) < tfm_toint() show_1 := false if tf_toint(tf_2) < tfm_toint() show_2 := false if tf_toint(tf_3) < tfm_toint() show_3 := false if tf_toint(tf_4) < tfm_toint() show_4 := false if tf_toint(tf_5) < tfm_toint() show_5 := false if tf_toint(tf_6) < tfm_toint() show_6 := false // Define the plots rsi_1_30 = show_1 and do_os ? rsi_to_plot(tf_1, 30, length) : na rsi_1_70 = show_1 and do_ob ? rsi_to_plot(tf_1, 70, length) : na rsi_2_30 = show_2 and do_os ? rsi_to_plot(tf_2, 30, length) : na rsi_2_70 = show_2 and do_ob ? rsi_to_plot(tf_2, 70, length) : na rsi_3_30 = show_3 and do_os ? rsi_to_plot(tf_3, 30, length) : na rsi_3_70 = show_3 and do_ob ? rsi_to_plot(tf_3, 70, length) : na rsi_4_30 = show_4 and do_os ? rsi_to_plot(tf_4, 30, length) : na rsi_4_70 = show_4 and do_ob ? rsi_to_plot(tf_4, 70, length) : na rsi_5_30 = show_5 and do_os ? rsi_to_plot(tf_5, 30, length) : na rsi_5_70 = show_5 and do_ob ? rsi_to_plot(tf_5, 70, length) : na rsi_6_30 = show_6 and do_os ? rsi_to_plot(tf_6, 30, length) : na rsi_6_70 = show_6 and do_ob ? rsi_to_plot(tf_6, 70, length) : na plot_offset = do_line ? -9999 : 0 // Plot them plot(rsi_1_30, title="30 RSI Level 1", color=color_1, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_1_70, title="70 RSI Level 1", color=color_1, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_2_30, title="30 RSI Level 2", color=color_2, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_2_70, title="70 RSI Level 2", color=color_2, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_3_30, title="30 RSI Level 3", color=color_3, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_3_70, title="70 RSI Level 3", color=color_3, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_4_30, title="30 RSI Level 4", color=color_4, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_4_70, title="70 RSI Level 4", color=color_4, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_5_30, title="30 RSI Level 5", color=color_5, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_5_70, title="70 RSI Level 5", color=color_5, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_6_30, title="30 RSI Level 6", color=color_6, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) plot(rsi_6_70, title="70 RSI Level 6", color=color_6, editable=false, trackprice=do_line, offset=plot_offset, linewidth=linewidth) // Labels do_label(do_lbl, ix_loc, src, txt, txtsize, clr) => if (do_lbl) var label lbl = na label.delete(lbl) lbl := label.new(x=ix_loc, y=src, text=txt, style=label.style_none, textcolor=clr, size=txtsize, textalign=text.align_left) if show_labels os="OS" ob="OB" do_label(show_1, bar_index[0] + lbl_offset, rsi_1_30, tf_str(tf_1, os), lbl_txtsize, color_1) do_label(show_1, bar_index[0] + lbl_offset, rsi_1_70, tf_str(tf_1, ob), lbl_txtsize, color_1) do_label(show_2, bar_index[0] + lbl_offset, rsi_2_30, tf_str(tf_2, os), lbl_txtsize, color_2) do_label(show_2, bar_index[0] + lbl_offset, rsi_2_70, tf_str(tf_2, ob), lbl_txtsize, color_2) do_label(show_3, bar_index[0] + lbl_offset, rsi_3_30, tf_str(tf_3, os), lbl_txtsize, color_3) do_label(show_3, bar_index[0] + lbl_offset, rsi_3_70, tf_str(tf_3, ob), lbl_txtsize, color_3) do_label(show_4, bar_index[0] + lbl_offset, rsi_4_30, tf_str(tf_4, os), lbl_txtsize, color_4) do_label(show_4, bar_index[0] + lbl_offset, rsi_4_70, tf_str(tf_4, ob), lbl_txtsize, color_4) do_label(show_5, bar_index[0] + lbl_offset, rsi_5_30, tf_str(tf_5, os), lbl_txtsize, color_5) do_label(show_5, bar_index[0] + lbl_offset, rsi_5_70, tf_str(tf_5, ob), lbl_txtsize, color_5) do_label(show_6, bar_index[0] + lbl_offset, rsi_6_30, tf_str(tf_6, os), lbl_txtsize, color_6) do_label(show_6, bar_index[0] + lbl_offset, rsi_6_70, tf_str(tf_6, ob), lbl_txtsize, color_6)
Crypto Category [Morty]
https://www.tradingview.com/script/NdciX55m-Crypto-Category-Morty/
M0rty
https://www.tradingview.com/u/M0rty/
289
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/ // Β© M0rty //@version=5 indicator("Crypto Category [Morty]") length = input.int(title="Avarage Period", defval=7, minval=2, maxval=500) s1_1 = input.symbol("BINANCE:MANAUSDT", "", group="metaverse") s1_2 = input.symbol("BINANCE:SANDUSDT", "", group="metaverse") s1_3 = input.symbol("BINANCE:ENJUSDT", "", group="metaverse") s1_4 = input.symbol("BINANCE:AXSUSDT", "", group="metaverse") s2_1 = input.symbol("BINANCE:GRTUSDT", "", group="web3") s2_2 = input.symbol("BINANCE:BATUSDT", "", group="web3") s2_3 = input.symbol("BINANCE:LITUSDT", "", group="web3") s2_4 = input.symbol("BINANCE:STORJUSDT", "", group="web3") s3_1 = input.symbol("BINANCE:SOLUSDT", "", group="layer1") s3_2 = input.symbol("BINANCE:FTMUSDT", "", group="layer1") s3_3 = input.symbol("BINANCE:AVAXUSDT", "", group="layer1") s3_4 = input.symbol("BINANCE:LUNAUSDT", "", group="layer1") s4_1 = input.symbol("BINANCE:UNIUSDT", "", group="defi") s4_2 = input.symbol("BINANCE:MKRUSDT", "", group="defi") s4_3 = input.symbol("BINANCE:AAVEUSDT", "", group="defi") s4_4 = input.symbol("BINANCE:SNXUSDT", "", group="defi") btc = request.security("BINANCE:BTCUSDT", timeframe.period, close) index0 = ta.hma(ta.cci(btc, length), length) // function to calculate index cci f_index(s1, s2, s3, s4) => p1 = request.security(s1, timeframe.period, close) p2 = request.security(s2, timeframe.period, close) p3 = request.security(s3, timeframe.period, close) p4 = request.security(s4, timeframe.period, close) cci1 = ta.cci(p1, length) cci2 = ta.cci(p2, length) cci3 = ta.cci(p3, length) cci4 = ta.cci(p4, length) index = ta.hma(math.avg(cci1, cci2, cci3, cci4), length) index1 = f_index(s1_1, s1_2, s1_3, s1_4) index2 = f_index(s2_1, s2_2, s2_3, s2_4) index3 = f_index(s3_1, s3_2, s3_3, s3_4) index4 = f_index(s4_1, s4_2, s4_3, s4_4) // plots plot(index0, "BTC", color=color.gray, linewidth=2) plot(index1, "Metaverse", color=color.orange) plot(index2, "Web 3.0", color=color.blue) plot(index3, "Layer1", color=color.green) plot(index4, "DeFi", color=color.fuchsia) // labels label0 = label.new(bar_index, index0, ' BTC', textcolor=color.gray, style= label.style_none, yloc=yloc.price) label.delete(label0[1]) label1 = label.new(bar_index, index1, ' Meta', textcolor=color.orange, style= label.style_none, yloc=yloc.price) label.delete(label1[1]) label2 = label.new(bar_index, index2, ' Web3', textcolor=color.blue, style= label.style_none, yloc=yloc.price) label.delete(label2[1]) label3 = label.new(bar_index, index3, ' Layer1', textcolor=color.green, style= label.style_none, yloc=yloc.price) label.delete(label3[1]) label4 = label.new(bar_index, index4, ' DeFi', textcolor=color.fuchsia, style= label.style_none, yloc=yloc.price) label.delete(label4[1]) // background color heatmap is based on the santiment of the market santiment = math.avg(index0, index1, index2, index3) bg_color = switch santiment > 180 => color.new(#550000, 5) santiment > 160 => color.new(#550000, 10) santiment > 140 => color.new(#801515, 20) santiment > 120 => color.new(#801515, 30) santiment > 100 => color.new(#AA3939, 40) santiment > 80 => color.new(#AA3939, 50) santiment > 60 => color.new(#D46A6A, 60) santiment > 40 => color.new(#D46A6A, 70) santiment > 20 => color.new(#FFAAAA, 80) santiment > 0 => color.new(#FFAAAA, 90) santiment > -20 => color.new(#7887AB, 90) santiment > -40 => color.new(#7887AB, 80) santiment > -60 => color.new(#4F628E, 70) santiment > -80 => color.new(#4F628E, 60) santiment > -100 => color.new(#2E4172, 50) santiment > -120 => color.new(#2E4172, 40) santiment > -140 => color.new(#162955, 30) santiment > -160 => color.new(#162955, 20) santiment > -180 => color.new(#162955, 10) santiment > -200 => color.new(#061539, 5) bgcolor(bg_color) // hlines hline(150, color=color.new(color.red, 50)) hline(0, color=color.new(color.gray, 50)) hline(-150, color=color.new(color.blue, 50))
ATR vs Daily Delta
https://www.tradingview.com/script/5UwNUAjB-ATR-vs-Daily-Delta/
seancsnm
https://www.tradingview.com/u/seancsnm/
21
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/ // Β© seancsnm //@version=4 study("ATR vs Daily Delta") atr_length = input(14, minval=1) num_devs = input(1.0, minval=0.0) normalize = input(false) show_minmax = input(true) show_std_dev_bands = input(true) // Plot colors col_grow_above = #26A69A col_grow_below = #FFCDD2 col_fall_above = #B2DFDB col_fall_below = #EF5350 diff = close > close[1] ? max(high-low, high-close[1]) : min(low-high, low-close[1]) TR = normalize ? (diff) / close[1] : diff //var d = 0.0 var accum_pos = 0.0 var pos_days = 0 var accum_neg = 0.0 var neg_days = 0 //get means for i = 0 to atr_length-1 //d := close[i] - close[i+1] if nz(TR[i], 0) > 0 accum_pos := accum_pos + nz(TR[i], 0) pos_days := pos_days + 1 else accum_neg := accum_neg + nz(TR[i], 0) neg_days := neg_days + 1 avg_pos = accum_pos / pos_days avg_neg = accum_neg / neg_days avg_neutral = (avg_pos + avg_neg) / 2 accum_pos := 0 accum_neg := 0 var res_pos = 0.0 var res_neg = 0.0 //get standard deviations for i = 0 to atr_length-1 if nz(TR[i], 0) > 0 res_pos := res_pos + pow((nz(TR[i], 0)-avg_pos), 2) else res_neg := res_neg + pow((nz(TR[i], 0)-avg_neg), 2) std_pos = sqrt(res_pos/pos_days) std_neg = sqrt(res_neg/neg_days) //reset variables pos_days := 0 neg_days := 0 res_pos := 0 res_neg := 0 atr_val = atr(atr_length) plot(TR, title="Daily Deltas", style=plot.style_columns, color=(TR>=0 ? (TR[1] < TR ? col_grow_above : col_fall_above) : (TR[1] < TR ? col_grow_below : col_fall_below)), transp=0) plot(show_std_dev_bands ? num_devs*std_pos + avg_pos : na, color=color.teal) plot(show_std_dev_bands ? -num_devs*std_neg + avg_neg: na, color=color.maroon) //plot(atr_val) plot(avg_pos, color=color.green) plot(avg_neg, color=color.red) //dd = plot(TR) plot(avg_neutral, color=color.gray) max_TR = TR max_TR := max(nz(max_TR[1], 0.0), TR) min_TR = TR min_TR := min(nz(min_TR[1], 0.0), TR) //if max_TR[1] > TR // max_TR := max_TR[1] //plotchar(max_TR, "max_TR", "", location=location.top) plot(show_minmax ? max_TR : na, color=color.green) plot(show_minmax ? min_TR : na, color=color.red) //if barstate.islast //plotchar(max_TR, "Max TR", location.top)
Penguin Trifecta
https://www.tradingview.com/script/VwuudGvc-Penguin-Trifecta/
erosejohn
https://www.tradingview.com/u/erosejohn/
8
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/ // Β© ajbrittle //@version=5 indicator(title='Penguin Trifecta') var stoch_sell_trigger = false var sell_trigger = false var max_macd = 0.0 stoch_count = 0, macd_count = 0, rsi_count = 0 stoch_trigger = false macd_trigger = false rsi_trigger = false trifecta_color = color.red smoothK = input.int(14, minval=1), smoothD = input.int(3, minval=1) k = ta.sma(ta.stoch(close, high, low, smoothK), 3) d = ta.sma(k, smoothD) if ta.crossover(k[0], d[0]) or ta.crossover(k[1], d[1]) or ta.crossover(k[2], d[2]) or ta.crossover(k[3], d[3]) stoch_trigger := true stoch_count += 1 else stoch_trigger := false fast = 12, slow = 26 fastMA = ta.ema(close, fast) slowMA = ta.ema(close, slow) macd = fastMA - slowMA signal = ta.sma(macd, 9) if math.abs(macd[0]) > max_macd max_macd := math.abs(macd[0]) // Account for circumstance where MACD crosses at top of peak // but stochastic is topped out if (ta.crossover(macd, signal) or (macd > signal)) and k < 65 macd_trigger := true macd_count += 1 else macd_trigger := false if ta.rsi(close, 14) < 75 rsi_trigger := true rsi_count += 1 else rsi_trigger := false trifecta_series = stoch_count + rsi_count + macd_count if trifecta_series == 0 trifecta_color := color.red else if trifecta_series == 1 trifecta_color := color.orange else if trifecta_series == 2 trifecta_color := color.yellow else trifecta_color := color.green sell_sum = 0 stoch_sell_trigger := ta.crossunder(k, d) ? true : false stoch_range = math.max(k[0], k[1], k[2]) - math.min(k[0], k[1], k[2]) stoch_diff = (math.abs(k[0] - k[1]) + math.abs(k[1] - k[2])) / 2 macd_diff = math.abs(macd-signal) / math.abs(signal) if stoch_sell_trigger sell_sum -= 1 if stoch_range < 3 sell_sum -= 1 if stoch_diff <= 2 sell_sum -= 1 if macd_diff < .05 sell_sum -= 1 if stoch_sell_trigger // There has been a crossover or stoch is moving substantially trifecta_series := sell_sum trifecta_color := color.from_gradient(sell_sum, -4, 0, color.rgb(235, 52, 52), color.rgb(255, 204, 255)) if sell_sum <= -3 stoch_sell_trigger := false plot(trifecta_series, title='Penguin Trifecta', style=plot.style_columns, linewidth=9, color=trifecta_color)
:: Magic Osc
https://www.tradingview.com/script/iJiOf6So-Magic-Osc/
Bluetuga
https://www.tradingview.com/u/Bluetuga/
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/ // Β© Bluetuga //@version=5 indicator(":: Magic Pro C") hline(0) gray1 = #abbad3 , gray2 = #8993a5 , blue1 = #5f85c4 , blue2 = #52679c , blue3 = #1976d2 , red1=#ef5350, red2=#d32f2f, green1=#66bb6a, green2=#009688 histA_up = #26A69A40, histA_dn = #B2DFDB40, histB_up = #FF525240, histB_dn = #FFCDD240 // ========================================================= T R E N D trendLenght = input.int(50, title='Β» EMA Lenght for trend defenition', group='Data', inline='1') PriceAvg = ta.ema(close, trendLenght) DownTrend = close < PriceAvg UpTrend = close > PriceAvg plotshape(DownTrend, "Downtrend", color=color.new(color.red,50), style=shape.diamond, location=location.top) plotshape(UpTrend, "Uptrend", color=color.new(color.green,50), style=shape.diamond, location=location.bottom) // ========================================================= R S I rsiLenght = input.int(34, title='Β» RSI Lenght', group='Data', inline='1') rsiMaLenght = input.int(34, title=' - EMA Lenght', group='Data', inline='1') rsi = ta.rsi(close,rsiLenght) smooth_rsi = rsi + (0.5* (rsi[1]-rsi)) rsi_ma = ta.ema(rsi,rsiMaLenght) rsi_log = math.log(rsi/rsi_ma) // RSI signal rsi_up = rsi_log > 0 rsi_dn = rsi_log < 0 // Var Statements for histogram Color Change var rsiA_IsUp = false var rsiA_IsDown = false var rsiB_IsDown = false var rsiB_IsUp = false rsiA_IsUp := rsi_log == rsi_log[1] ? rsiA_IsUp[1] : rsi_log > rsi_log[1] and rsi_log > 0 rsiA_IsDown := rsi_log == rsi_log[1] ? rsiA_IsDown[1] : rsi_log < rsi_log[1] and rsi_log > 0 rsiB_IsDown := rsi_log == rsi_log[1] ? rsiB_IsDown[1] : rsi_log < rsi_log[1] and rsi_log <= 0 rsiB_IsUp := rsi_log == rsi_log[1] ? rsiB_IsUp[1] : rsi_log > rsi_log[1] and rsi_log <= 0 rsi_color = rsiA_IsUp ? #26A69A40 : rsiA_IsDown ? #B2DFDB40 : rsiB_IsDown ? #FF525240 : rsiB_IsUp ? #FFCDD240 : color.silver //rsi_color = rsi_up ? color.new(color.green,70) : rsi_dn ? color.new(color.green,70) : color.new(color.silver,70) plot(rsi_log, title='RSI', color = rsi_color, style=plot.style_columns) // ========================================================= F I L T E R S // –––––– Filter 1 (Sohrt EMA) f1Lenght = input.int(34, title='Β» Ema1 Lenght', group='Data', inline='2') filter1 = ta.ema(close,f1Lenght) f1_long = close > filter1 f1_short = close < filter1 f1_signal = math.log(close/filter1)*2 f1_color = f1_long ? color.new(color.green,50) : f1_short ? color.new(color.red,50) : color.new(color.orange,50) plot(f1_signal, title='MA Filter', color=f1_color, style=plot.style_area) // –––––– Filter 2 (Long SMA) smaLongLenght = input.int(128, title='Β» SMA Long Vision Length', group='Data', inline='3', tooltip="Testar entre 50/128/200") smaf = ta.sma(ohlc4,smaLongLenght) + (0.5* (ta.sma(ohlc4,smaLongLenght)[1]-ta.sma(ohlc4,smaLongLenght))) smaf_signal = math.log(close/smaf)*2 smaf_long = close > smaf smaf_short = close < smaf smaf_color = smaf_long ? color.new(color.green,30) : smaf_short ? color.new(color.red,30) : color.new(color.gray,0) plot(smaf_signal, title='MA Long Vision', color=smaf_color, style=plot.style_circles, linewidth=2) // –––––– Long vision signal emaLup = ta.crossover(smaf_signal,0) emaLdn = ta.crossunder(smaf_signal,0) // ========================================================= S Q U E E Z E // –––––– Calculate BB for SQUEEZE sqzbasis = ta.sma(close, 20) sqzdev = 1.5 * ta.stdev(close, 20) upperBB = sqzbasis + sqzdev lowerBB = sqzbasis - sqzdev // –––––– Calculate KC sqzma = ta.sma(close, 20) rangema = ta.sma(ta.tr, 20) upperKC = sqzma + rangema * 1.2 //1.5 lowerKC = sqzma - rangema * 1.2 //1.5 sqzOn = lowerBB > lowerKC and upperBB < upperKC sqzOff = lowerBB < lowerKC and upperBB > upperKC noSqz = sqzOn == false and sqzOff == false val = ta.linreg(close - math.avg(math.avg(ta.highest(high, 20), ta.lowest(low, 20)), ta.sma(close, 20)), 20, 0) sqzcolor= noSqz ? color.new(color.blue,50) : sqzOn ? color.new(color.orange,20) : color.new(color.gray,100) plot(0, title='Squeeze points', color=sqzcolor, style=plot.style_circles, linewidth=2) sqzbgcolor = noSqz ? color.new(blue2,50) : sqzOn ? color.new(blue3,95) : color.new(gray2,100) bgcolor(sqzbgcolor, title='Squeeze BG') // - - - - - - - -- - OBV _obv = ta.sma(ta.obv,1) _obv_ma = ta.sma(_obv,20) _obv_view = math.log(_obv_ma/_obv)*2 * -1 plot(timeframe.period == '15' ? request.security(syminfo.tickerid, "60", _obv_view, gaps = barmerge.gaps_on) : timeframe.period == '30' ? request.security(syminfo.tickerid, "60", _obv_view, gaps = barmerge.gaps_on) : timeframe.period == '45' ? request.security(syminfo.tickerid, "60", _obv_view, gaps = barmerge.gaps_on) : timeframe.period == '60' ? request.security(syminfo.tickerid, "120", _obv_view, gaps = barmerge.gaps_on) : timeframe.period == '120' ? request.security(syminfo.tickerid, "120", _obv_view, gaps = barmerge.gaps_on) : timeframe.period == '240' ? request.security(syminfo.tickerid, "240", _obv_view, gaps = barmerge.gaps_on) : na, 'OBV Line', color=color.blue, style=plot.style_line, linewidth=1) // ========================================================= S I G N A L S // –––––– Conditions longCondition = emaLup and rsi > rsi_ma and f1_long //and sqzOff //rsi > 50 and and not sqzOff[1] shortCondition = emaLdn and rsi < rsi_ma and f1_short //and sqzOff //rsi < 50 and and not sqzOff[1] long = longCondition and not longCondition[1] short = shortCondition and not shortCondition[1] plotshape(long, style=shape.triangleup, location=location.bottom, color=color.new(green1,25), size=size.tiny, title='Signal Long') plotshape(short, style=shape.triangledown, location=location.top, color=color.new(red1,25), size=size.tiny, title='Signal Short')
Relative Strength vs SPY - real time & multi TF analysis
https://www.tradingview.com/script/Fv6M3Lz0-Relative-Strength-vs-SPY-real-time-multi-TF-analysis/
axg_
https://www.tradingview.com/u/axg_/
609
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/ // Β© axg_ // This code uses the Multiple Indicators Screener written by QuantNomad, you can view the original code here: https://www.tradingview.com/script/yLwyZpOn-Multiple-Indicators-Screener/ // RS calculation also borrowed by modhelius, the original calculation can be found here: https://www.tradingview.com/script/A4WyMCKM-Relative-Strength/ //@version=5 indicator('Relative Strength Screener', overlay=true) // Inputs _10 = input(true, 'Calculation inputs') spyId = input.symbol('SPY', title='Comparison Symbol (ex: SPY)') user_period_id = input.timeframe('5', title='Relative Strength Timeframe') spy_period = request.security(spyId, user_period_id, close) Length = input(10, title='RS calculation period length') var string LEFT = 'LEFT' var string CENTER = 'CENTER' var string RIGHT = 'RIGHT' var string TRUE = 'TRUE' var string FALSE = 'FALSE' _20 = input(true, 'Table display settings') string i_table_placement = input.string(RIGHT, 'Position of table? (Left, Center or Right)', options=[LEFT, CENTER, RIGHT]) string i_display_ticker_symb = input.string(TRUE, 'Display ticker symbol and price?', options=[TRUE, FALSE]) table_placement = i_table_placement == RIGHT ? position.top_right : i_table_placement == CENTER ? position.top_center : position.top_left _30 = input(true, 'Stock selection') // Symbol selection u01 = input.bool(true, title = "", group = 'Symbols', inline = 's01') u02 = input.bool(true, title = "", group = 'Symbols', inline = 's02') u03 = input.bool(true, title = "", group = 'Symbols', inline = 's03') u04 = input.bool(true, title = "", group = 'Symbols', inline = 's04') u05 = input.bool(true, title = "", group = 'Symbols', inline = 's05') u06 = input.bool(true, title = "", group = 'Symbols', inline = 's06') u07 = input.bool(true, title = "", group = 'Symbols', inline = 's07') u08 = input.bool(true, title = "", group = 'Symbols', inline = 's08') u09 = input.bool(true, title = "", group = 'Symbols', inline = 's09') u10 = input.bool(true, title = "", group = 'Symbols', inline = 's10') u11 = input.bool(true, title = "", group = 'Symbols', inline = 's11') u12 = input.bool(true, title = "", group = 'Symbols', inline = 's12') u13 = input.bool(true, title = "", group = 'Symbols', inline = 's13') u14 = input.bool(true, title = "", group = 'Symbols', inline = 's14') u15 = input.bool(true, title = "", group = 'Symbols', inline = 's15') u16 = input.bool(true, title = "", group = 'Symbols', inline = 's16') u17 = input.bool(true, title = "", group = 'Symbols', inline = 's17') u18 = input.bool(true, title = "", group = 'Symbols', inline = 's18') u19 = input.bool(true, title = "", group = 'Symbols', inline = 's19') u20 = input.bool(true, title = "", group = 'Symbols', inline = 's20') u21 = input.bool(true, title = "", group = 'Symbols', inline = 's21') u22 = input.bool(true, title = "", group = 'Symbols', inline = 's22') u23 = input.bool(true, title = "", group = 'Symbols', inline = 's23') u24 = input.bool(true, title = "", group = 'Symbols', inline = 's24') u25 = input.bool(true, title = "", group = 'Symbols', inline = 's25') u26 = input.bool(true, title = "", group = 'Symbols', inline = 's26') u27 = input.bool(true, title = "", group = 'Symbols', inline = 's27') u28 = input.bool(true, title = "", group = 'Symbols', inline = 's28') u29 = input.bool(true, title = "", group = 'Symbols', inline = 's29') u30 = input.bool(true, title = "", group = 'Symbols', inline = 's30') u31 = input.bool(true, title = "", group = 'Symbols', inline = 's31') u32 = input.bool(true, title = "", group = 'Symbols', inline = 's32') u33 = input.bool(true, title = "", group = 'Symbols', inline = 's33') u34 = input.bool(true, title = "", group = 'Symbols', inline = 's34') u35 = input.bool(true, title = "", group = 'Symbols', inline = 's35') u36 = input.bool(true, title = "", group = 'Symbols', inline = 's36') u37 = input.bool(true, title = "", group = 'Symbols', inline = 's37') u38 = input.bool(true, title = "", group = 'Symbols', inline = 's38') u39 = input.bool(true, title = "", group = 'Symbols', inline = 's39') s01 = input.symbol('AAPL', group = 'Symbols', inline = 's01') s02 = input.symbol('ABNB', group = 'Symbols', inline = 's02') s03 = input.symbol('AFRM', group = 'Symbols', inline = 's03') s04 = input.symbol('AMD', group = 'Symbols', inline = 's04') s05 = input.symbol('BA', group = 'Symbols', inline = 's05') s06 = input.symbol('BABA', group = 'Symbols', inline = 's06') s07 = input.symbol('BBY', group = 'Symbols', inline = 's07') s08 = input.symbol('COIN', group = 'Symbols', inline = 's08') s09 = input.symbol('DASH', group = 'Symbols', inline = 's09') s10 = input.symbol('DKS', group = 'Symbols', inline = 's10') s11 = input.symbol('DOCU', group = 'Symbols', inline = 's11') s12 = input.symbol('ETSY', group = 'Symbols', inline = 's12') s13 = input.symbol('FB', group = 'Symbols', inline = 's13') s14 = input.symbol('FUTU', group = 'Symbols', inline = 's14') s15 = input.symbol('HD', group = 'Symbols', inline = 's15') s16 = input.symbol('IONQ', group = 'Symbols', inline = 's16') s17 = input.symbol('LCID', group = 'Symbols', inline = 's17') s18 = input.symbol('MARA', group = 'Symbols', inline = 's18') s19 = input.symbol('MRNA', group = 'Symbols', inline = 's19') s20 = input.symbol('MSFT', group = 'Symbols', inline = 's20') s21 = input.symbol('MTTR', group = 'Symbols', inline = 's21') s22 = input.symbol('NFLX', group = 'Symbols', inline = 's22') s23 = input.symbol('NVAX', group = 'Symbols', inline = 's23') s24 = input.symbol('NVDA', group = 'Symbols', inline = 's24') s25 = input.symbol('PFE', group = 'Symbols', inline = 's25') s26 = input.symbol('PLTR', group = 'Symbols', inline = 's26') s27 = input.symbol('PLUG', group = 'Symbols', inline = 's27') s28 = input.symbol('PTON', group = 'Symbols', inline = 's28') s29 = input.symbol('PYPL', group = 'Symbols', inline = 's29') s30 = input.symbol('QCOM', group = 'Symbols', inline = 's30') s31 = input.symbol('RBLX', group = 'Symbols', inline = 's31') s32 = input.symbol('RIOT', group = 'Symbols', inline = 's32') s33 = input.symbol('SOFI', group = 'Symbols', inline = 's33') s34 = input.symbol('TGT', group = 'Symbols', inline = 's34') s35 = input.symbol('TSLA', group = 'Symbols', inline = 's35') s36 = input.symbol('U', group = 'Symbols', inline = 's36') s37 = input.symbol('UBER', group = 'Symbols', inline = 's37') s38 = input.symbol('V', group = 'Symbols', inline = 's38') s39 = input.symbol('XPEV', group = 'Symbols', inline = 's39') // CALCULATIONS // // Get only symbol only_symbol(s) => array.get(str.split(s, ":"), 1) // for Relative Strength to SPY RelativeStrength(SPY, src, length) => SPYPerc = ta.change(SPY, Length) / SPY[Length] * 100 SymPerc = ta.change(src, Length) / src[Length] * 100 Diff = SymPerc - SPYPerc screener_func() => // Last close price pc = ta.change(close) //Relative Strength to SPY RS = RelativeStrength(spy_period, close, Length) [math.round_to_mintick(close), RS] // Security call [cl01, rs5m01] = request.security(s01, user_period_id, screener_func()) [cl02, rs5m02] = request.security(s02, user_period_id, screener_func()) [cl03, rs5m03] = request.security(s03, user_period_id, screener_func()) [cl04, rs5m04] = request.security(s04, user_period_id, screener_func()) [cl05, rs5m05] = request.security(s05, user_period_id, screener_func()) [cl06, rs5m06] = request.security(s06, user_period_id, screener_func()) [cl07, rs5m07] = request.security(s07, user_period_id, screener_func()) [cl08, rs5m08] = request.security(s08, user_period_id, screener_func()) [cl09, rs5m09] = request.security(s09, user_period_id, screener_func()) [cl10, rs5m10] = request.security(s10, user_period_id, screener_func()) [cl11, rs5m11] = request.security(s11, user_period_id, screener_func()) [cl12, rs5m12] = request.security(s12, user_period_id, screener_func()) [cl13, rs5m13] = request.security(s13, user_period_id, screener_func()) [cl14, rs5m14] = request.security(s14, user_period_id, screener_func()) [cl15, rs5m15] = request.security(s15, user_period_id, screener_func()) [cl16, rs5m16] = request.security(s16, user_period_id, screener_func()) [cl17, rs5m17] = request.security(s17, user_period_id, screener_func()) [cl18, rs5m18] = request.security(s18, user_period_id, screener_func()) [cl19, rs5m19] = request.security(s19, user_period_id, screener_func()) [cl20, rs5m20] = request.security(s20, user_period_id, screener_func()) [cl21, rs5m21] = request.security(s21, user_period_id, screener_func()) [cl22, rs5m22] = request.security(s22, user_period_id, screener_func()) [cl23, rs5m23] = request.security(s23, user_period_id, screener_func()) [cl24, rs5m24] = request.security(s24, user_period_id, screener_func()) [cl25, rs5m25] = request.security(s25, user_period_id, screener_func()) [cl26, rs5m26] = request.security(s26, user_period_id, screener_func()) [cl27, rs5m27] = request.security(s27, user_period_id, screener_func()) [cl28, rs5m28] = request.security(s28, user_period_id, screener_func()) [cl29, rs5m29] = request.security(s29, user_period_id, screener_func()) [cl30, rs5m30] = request.security(s30, user_period_id, screener_func()) [cl31, rs5m31] = request.security(s31, user_period_id, screener_func()) [cl32, rs5m32] = request.security(s32, user_period_id, screener_func()) [cl33, rs5m33] = request.security(s33, user_period_id, screener_func()) [cl34, rs5m34] = request.security(s34, user_period_id, screener_func()) [cl35, rs5m35] = request.security(s35, user_period_id, screener_func()) [cl36, rs5m36] = request.security(s36, user_period_id, screener_func()) [cl37, rs5m37] = request.security(s37, user_period_id, screener_func()) [cl38, rs5m38] = request.security(s38, user_period_id, screener_func()) [cl39, rs5m39] = request.security(s39, user_period_id, screener_func()) // ARRAYS // s_arr = array.new_string(0) u_arr = array.new_bool(0) cl_arr = array.new_float(0) RS_arr = array.new_float(0) // Add Symbols array.push(s_arr, only_symbol(s01)) array.push(s_arr, only_symbol(s02)) array.push(s_arr, only_symbol(s03)) array.push(s_arr, only_symbol(s04)) array.push(s_arr, only_symbol(s05)) array.push(s_arr, only_symbol(s06)) array.push(s_arr, only_symbol(s07)) array.push(s_arr, only_symbol(s08)) array.push(s_arr, only_symbol(s09)) array.push(s_arr, only_symbol(s10)) array.push(s_arr, only_symbol(s11)) array.push(s_arr, only_symbol(s12)) array.push(s_arr, only_symbol(s13)) array.push(s_arr, only_symbol(s14)) array.push(s_arr, only_symbol(s15)) array.push(s_arr, only_symbol(s16)) array.push(s_arr, only_symbol(s17)) array.push(s_arr, only_symbol(s18)) array.push(s_arr, only_symbol(s19)) array.push(s_arr, only_symbol(s20)) array.push(s_arr, only_symbol(s21)) array.push(s_arr, only_symbol(s22)) array.push(s_arr, only_symbol(s23)) array.push(s_arr, only_symbol(s24)) array.push(s_arr, only_symbol(s25)) array.push(s_arr, only_symbol(s26)) array.push(s_arr, only_symbol(s27)) array.push(s_arr, only_symbol(s28)) array.push(s_arr, only_symbol(s29)) array.push(s_arr, only_symbol(s30)) array.push(s_arr, only_symbol(s31)) array.push(s_arr, only_symbol(s32)) array.push(s_arr, only_symbol(s33)) array.push(s_arr, only_symbol(s34)) array.push(s_arr, only_symbol(s35)) array.push(s_arr, only_symbol(s36)) array.push(s_arr, only_symbol(s37)) array.push(s_arr, only_symbol(s38)) array.push(s_arr, only_symbol(s39)) /////////// // FLAGS // array.push(u_arr, u01) array.push(u_arr, u02) array.push(u_arr, u03) array.push(u_arr, u04) array.push(u_arr, u05) array.push(u_arr, u06) array.push(u_arr, u07) array.push(u_arr, u08) array.push(u_arr, u09) array.push(u_arr, u10) array.push(u_arr, u11) array.push(u_arr, u12) array.push(u_arr, u13) array.push(u_arr, u14) array.push(u_arr, u15) array.push(u_arr, u16) array.push(u_arr, u17) array.push(u_arr, u18) array.push(u_arr, u19) array.push(u_arr, u20) array.push(u_arr, u21) array.push(u_arr, u22) array.push(u_arr, u23) array.push(u_arr, u24) array.push(u_arr, u25) array.push(u_arr, u26) array.push(u_arr, u27) array.push(u_arr, u28) array.push(u_arr, u29) array.push(u_arr, u30) array.push(u_arr, u31) array.push(u_arr, u32) array.push(u_arr, u33) array.push(u_arr, u34) array.push(u_arr, u35) array.push(u_arr, u36) array.push(u_arr, u37) array.push(u_arr, u38) array.push(u_arr, u39) /////////// // CLOSE // array.push(cl_arr, cl01) array.push(cl_arr, cl02) array.push(cl_arr, cl03) array.push(cl_arr, cl04) array.push(cl_arr, cl05) array.push(cl_arr, cl06) array.push(cl_arr, cl07) array.push(cl_arr, cl08) array.push(cl_arr, cl09) array.push(cl_arr, cl10) array.push(cl_arr, cl11) array.push(cl_arr, cl12) array.push(cl_arr, cl13) array.push(cl_arr, cl14) array.push(cl_arr, cl15) array.push(cl_arr, cl16) array.push(cl_arr, cl17) array.push(cl_arr, cl18) array.push(cl_arr, cl19) array.push(cl_arr, cl20) array.push(cl_arr, cl21) array.push(cl_arr, cl22) array.push(cl_arr, cl23) array.push(cl_arr, cl24) array.push(cl_arr, cl25) array.push(cl_arr, cl26) array.push(cl_arr, cl27) array.push(cl_arr, cl28) array.push(cl_arr, cl29) array.push(cl_arr, cl30) array.push(cl_arr, cl31) array.push(cl_arr, cl32) array.push(cl_arr, cl33) array.push(cl_arr, cl34) array.push(cl_arr, cl35) array.push(cl_arr, cl36) array.push(cl_arr, cl37) array.push(cl_arr, cl38) array.push(cl_arr, cl39) ///////// // Relative Strength array.push(RS_arr, rs5m01) array.push(RS_arr, rs5m02) array.push(RS_arr, rs5m03) array.push(RS_arr, rs5m04) array.push(RS_arr, rs5m05) array.push(RS_arr, rs5m06) array.push(RS_arr, rs5m07) array.push(RS_arr, rs5m08) array.push(RS_arr, rs5m09) array.push(RS_arr, rs5m10) array.push(RS_arr, rs5m11) array.push(RS_arr, rs5m12) array.push(RS_arr, rs5m13) array.push(RS_arr, rs5m14) array.push(RS_arr, rs5m15) array.push(RS_arr, rs5m16) array.push(RS_arr, rs5m17) array.push(RS_arr, rs5m18) array.push(RS_arr, rs5m19) array.push(RS_arr, rs5m20) array.push(RS_arr, rs5m21) array.push(RS_arr, rs5m22) array.push(RS_arr, rs5m23) array.push(RS_arr, rs5m24) array.push(RS_arr, rs5m25) array.push(RS_arr, rs5m26) array.push(RS_arr, rs5m27) array.push(RS_arr, rs5m28) array.push(RS_arr, rs5m29) array.push(RS_arr, rs5m30) array.push(RS_arr, rs5m31) array.push(RS_arr, rs5m32) array.push(RS_arr, rs5m33) array.push(RS_arr, rs5m34) array.push(RS_arr, rs5m35) array.push(RS_arr, rs5m36) array.push(RS_arr, rs5m37) array.push(RS_arr, rs5m38) array.push(RS_arr, rs5m39) // PLOTS // var tbl = table.new(table_placement, 6, 41, frame_color=#151715, frame_width=1, border_width=2, border_color=color.new(color.white, 100)) if barstate.islast and i_display_ticker_symb == TRUE table.cell(tbl, 0, 0, 'Symbol', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal) table.cell(tbl, 1, 0, 'Price', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal) table.cell(tbl, 2, 0, 'RS '+ user_period_id, text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal) for i = 0 to 38 if array.get(u_arr, i) rs5M_col = array.get(RS_arr, i) > 0 ? color.green : array.get(RS_arr, i) < 0 ? color.red : #aaaaaa table.cell(tbl, 0, i + 1, array.get(s_arr, i), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.small) table.cell(tbl, 1, i + 1, str.tostring(array.get(cl_arr, i)), text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.small) table.cell(tbl, 2, i + 1, str.tostring(array.get(RS_arr, i), "#.##"), text_halign = text.align_center, bgcolor = rs5M_col, text_color = color.white, text_size = size.small) else table.cell(tbl, 0, 0, 'RS '+ user_period_id, text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal) for i = 0 to 38 if array.get(u_arr, i) rs5M_col = array.get(RS_arr, i) > 0 ? color.green : array.get(RS_arr, i) < 0 ? color.red : #aaaaaa table.cell(tbl, 0, i + 1, str.tostring(array.get(RS_arr, i), "#.##"), text_halign = text.align_center, bgcolor = rs5M_col, text_color = color.white, text_size = size.small)
EMA Levels, Multi-Timeframe
https://www.tradingview.com/script/yOL9XSGU-EMA-Levels-Multi-Timeframe/
jmosullivan
https://www.tradingview.com/u/jmosullivan/
166
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/ // Β© jmosullivan // The exponential moving average (EMA) tracks price over time, giving more importance to recent price data than simple // moving average (SMA). MAs for larger timeframes are generally considered to be stronger supports/resistances for // price to move through than smaller timeframes. This indicator allows you to specify two different MA lengths that // you want to track. Additionally, this indicator allows you to display not just the EMA levels of your currently // viewed timeframe on the chart, but also shows the MA levels of up to 4 different timeframes on the same chart. This // allows you to quickly see if multiple MA levels are aligning across different timeframes, which is an even stronger // indication that price is going to meet support or resistance when it meets those levels on the chart. There are a lot // of nice configuration options, like: // // * Ability to choose Exponential MA or Simple MA // * Ability to customize the MA lengths you want to track // * Style customization (color, thickness, size) // * Hide any timeframes/levels you aren't interested in // * Labels on the chart so you can tell which plots are the EMA levels // * Optionally display the plot as a horizontal line if all you care about is the EMA level right now //@version=5 indicator("MA Lvls MTF", overlay = true) // Functions tf_tostring(tf) => string rtf = switch tf "1" => "1m" "2" => "2m" "3" => "3m" "5" => "5m" "13" => "13m" "15" => "15m" "30" => "30m" "45" => "45m" "60" => "1h" "120" => "2h" "180" => "3h" "240" => "4h" "360" => "6h" "480" => "8h" "720" => "12h" "D" => "1D" "W" => "1W" "M" => "1M" => tf // default rtf tf_str(tf, suffix, type) => ma_str = type == "Simple MA" ? "sma" : "ema" tf_tostring(tf) + " " + str.tostring(suffix) + " " + ma_str do_label(do_lbl, ix_loc, src, txt, txtsize, clr) => if (do_lbl) var label lbl = na label.delete(lbl) lbl := label.new(x=ix_loc, y=src, text=txt, style=label.style_none, textcolor=clr, size=txtsize, textalign=text.align_left) // Define some inputs to control style & visbility grp_mn = "MA Settings" ma_type = input.string (group=grp_mn, defval="Exponential MA", title="MA Type", options=["Simple MA", "Exponential MA"]) show_labels = input.bool (group=grp_mn, defval=true, title="Show Labels") lbl_txtsize = input.string (group=grp_mn, defval=size.normal, title="Label Text Size", options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge]) lbl_offset = input.int (group=grp_mn, defval=4, title="Label Offset", minval=0, maxval=100) lbl_stagger_offset = input.int (group=grp_mn, defval=0, title="Label Offset Stagger", minval=0, maxval=20) do_line = input.bool (group=grp_mn, defval=false, title="Do Horizontal Lines") linewidth = input.int (group=grp_mn, defval=1, title="Line Weight", options=[1,2,3,4]) def_label_offset = 4 transparency = 50 ma1 = "MA1" ma2 = "MA2" grp_emas = "MA Lengths" ma1length = input.int(group=grp_emas, defval=12, title="MA1", inline="malength") ma2length = input.int(group=grp_emas, defval=26, title="MA2", inline="malength") grp_tfs = "Timeframe Settings" il_1 = "inline_1" def_clr_1 = color.new(color.aqua, transparency) tf_1 = input.timeframe (group=grp_tfs, inline=il_1, defval="60", title="") color_ma1_1 = input.color (group=grp_tfs, inline=il_1, defval=def_clr_1, title="") show_ma1_1 = input.bool (group=grp_tfs, inline=il_1, defval=true, title=ma1) color_ma2_1 = input.color (group=grp_tfs, inline=il_1, defval=def_clr_1, title="") show_ma2_1 = input.bool (group=grp_tfs, inline=il_1, defval=true, title=ma2) il_2 = "inline_2" def_clr_2 = color.new(color.blue, transparency) tf_2 = input.timeframe (group=grp_tfs, inline=il_2, defval="240", title="") color_ma1_2 = input.color (group=grp_tfs, inline=il_2, defval=def_clr_2, title="") show_ma1_2 = input.bool (group=grp_tfs, inline=il_2, defval=true, title=ma1) color_ma2_2 = input.color (group=grp_tfs, inline=il_2, defval=def_clr_2, title="") show_ma2_2 = input.bool (group=grp_tfs, inline=il_2, defval=true, title=ma2) il_3 = "inline_3" def_clr_3 = color.new(color.orange, transparency) tf_3 = input.timeframe (group=grp_tfs, inline=il_3, defval="720", title="") color_ma1_3 = input.color (group=grp_tfs, inline=il_3, defval=def_clr_3, title="") show_ma1_3 = input.bool (group=grp_tfs, inline=il_3, defval=true, title=ma1) color_ma2_3 = input.color (group=grp_tfs, inline=il_3, defval=def_clr_3, title="") show_ma2_3 = input.bool (group=grp_tfs, inline=il_3, defval=true, title=ma2) il_4 = "inline_4" def_clr_4 = color.new(color.purple, transparency) tf_4 = input.timeframe (group=grp_tfs, inline=il_4, defval="D", title="") color_ma1_4 = input.color (group=grp_tfs, inline=il_4, defval=def_clr_4, title="") show_ma1_4 = input.bool (group=grp_tfs, inline=il_4, defval=true, title=ma1) color_ma2_4 = input.color (group=grp_tfs, inline=il_4, defval=def_clr_4, title="") show_ma2_4 = input.bool (group=grp_tfs, inline=il_4, defval=true, title=ma2) ta_ma1 = ma_type == "Simple MA" ? ta.sma(close, ma1length) : ta.ema(close, ma1length) ta_ma2 = ma_type == "Simple MA" ? ta.sma(close, ma2length) : ta.ema(close, ma2length) // Define the lines to be plotted ma_1_1 = show_ma1_1 ? request.security(syminfo.tickerid, tf_1, ta_ma1) : na ma_2_1 = show_ma2_1 ? request.security(syminfo.tickerid, tf_1, ta_ma2) : na ma_1_2 = show_ma1_2 ? request.security(syminfo.tickerid, tf_2, ta_ma1) : na ma_2_2 = show_ma2_2 ? request.security(syminfo.tickerid, tf_2, ta_ma2) : na ma_1_3 = show_ma1_3 ? request.security(syminfo.tickerid, tf_3, ta_ma1) : na ma_2_3 = show_ma2_3 ? request.security(syminfo.tickerid, tf_3, ta_ma2) : na ma_1_4 = show_ma1_4 ? request.security(syminfo.tickerid, tf_4, ta_ma1) : na ma_2_4 = show_ma2_4 ? request.security(syminfo.tickerid, tf_4, ta_ma2) : na // plot them plot_offset = do_line ? -9999 : 0 plot(ma_1_1, color=color_ma1_1, title="TF1 MA1", trackprice=do_line, offset=plot_offset, editable=false, style=plot.style_line, linewidth=linewidth) plot(ma_2_1, color=color_ma2_1, title="TF1 MA2", trackprice=do_line, offset=plot_offset, editable=false, style=plot.style_line, linewidth=linewidth) plot(ma_1_2, color=color_ma1_2, title="TF2 MA1", trackprice=do_line, offset=plot_offset, editable=false, style=plot.style_line, linewidth=linewidth) plot(ma_2_2, color=color_ma2_2, title="TF2 MA2", trackprice=do_line, offset=plot_offset, editable=false, style=plot.style_line, linewidth=linewidth) plot(ma_1_3, color=color_ma1_3, title="TF3 MA1", trackprice=do_line, offset=plot_offset, editable=false, style=plot.style_line, linewidth=linewidth) plot(ma_2_3, color=color_ma2_3, title="TF3 MA2", trackprice=do_line, offset=plot_offset, editable=false, style=plot.style_line, linewidth=linewidth) plot(ma_1_4, color=color_ma1_4, title="TF4 MA1", trackprice=do_line, offset=plot_offset, editable=false, style=plot.style_line, linewidth=linewidth) plot(ma_2_4, color=color_ma2_4, title="TF4 MA2", trackprice=do_line, offset=plot_offset, editable=false, style=plot.style_line, linewidth=linewidth) if (show_labels) offset_ma1_1 = lbl_offset offset_ma2_1 = lbl_offset + (lbl_stagger_offset*1) offset_ma1_2 = lbl_offset + (lbl_stagger_offset*2) offset_ma2_2 = lbl_offset + (lbl_stagger_offset*3) offset_ma1_3 = lbl_offset + (lbl_stagger_offset*4) offset_ma2_3 = lbl_offset + (lbl_stagger_offset*5) offset_ma1_4 = lbl_offset + (lbl_stagger_offset*6) offset_ma2_4 = lbl_offset + (lbl_stagger_offset*7) do_label(show_ma1_1, bar_index[0] + offset_ma1_1, ma_1_1, tf_str(tf_1, ma1length, ma_type), lbl_txtsize, color_ma1_1) do_label(show_ma2_1, bar_index[0] + offset_ma2_1, ma_2_1, tf_str(tf_1, ma2length, ma_type), lbl_txtsize, color_ma2_1) do_label(show_ma1_2, bar_index[0] + offset_ma1_2, ma_1_2, tf_str(tf_2, ma1length, ma_type), lbl_txtsize, color_ma1_2) do_label(show_ma2_2, bar_index[0] + offset_ma2_2, ma_2_2, tf_str(tf_2, ma2length, ma_type), lbl_txtsize, color_ma2_2) do_label(show_ma1_3, bar_index[0] + offset_ma1_3, ma_1_3, tf_str(tf_3, ma1length, ma_type), lbl_txtsize, color_ma1_3) do_label(show_ma2_3, bar_index[0] + offset_ma2_3, ma_2_3, tf_str(tf_3, ma2length, ma_type), lbl_txtsize, color_ma2_3) do_label(show_ma1_4, bar_index[0] + offset_ma1_4, ma_1_4, tf_str(tf_4, ma1length, ma_type), lbl_txtsize, color_ma1_4) do_label(show_ma2_4, bar_index[0] + offset_ma2_4, ma_2_4, tf_str(tf_4, ma2length, ma_type), lbl_txtsize, color_ma2_4)
Impulse levels
https://www.tradingview.com/script/PbBE2DM2-Impulse-levels/
IldarAkhmetgaleev
https://www.tradingview.com/u/IldarAkhmetgaleev/
323
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/ // Β© IldarAkhmetgaleev //@version=5 indicator("Impulse levels", overlay=true) n_bars = input.int(5, "Number of bars to average", minval=3, maxval=50) atr_impulse_thr = input.int(120, "ATR impulse thresshold % (0 to disable)", minval=0, maxval=500) vol_impulse_thr = input.int(200, "Volume impulse thresshold % (0 to disable)", minval=0, maxval=1000) level_color = input.color(color.orange, "Level color") find_impulse() => atr = ta.atr(n_bars) min_atr = ta.lowest(atr, n_bars) wide_min_atr = ta.lowest(atr, n_bars * 2) by_atr = wide_min_atr == atr[n_bars] and min_atr[n_bars + 1] > atr[n_bars] and atr > min_atr[n_bars] * (float(atr_impulse_thr) / 100.0) avg_vol = ta.sma(volume, n_bars) max_vol = ta.highest(volume, n_bars) by_vol = max_vol > avg_vol[n_bars] * (float(vol_impulse_thr) / 100.0) (atr_impulse_thr == 0 or by_atr) and (vol_impulse_thr == 0 or by_vol) impulse_price(n) => ta.valuewhen(find_impulse(), close[n_bars], n) brake_line(value) => value == value[1] ? value : na clrI = color.new(level_color, 0) imp = find_impulse() ? close[n_bars] : na plotshape(imp, "Impulse root", shape.circle, location=location.absolute, color=clrI, offset=-n_bars+1) clr0 = color.new(level_color, 15) lvl0 = brake_line(impulse_price(0)) plot(lvl0, "Impulse level 0", color=clr0, style=plot.style_linebr, offset=-n_bars+1) clr1 = color.new(level_color, 40) lvl1 = brake_line(impulse_price(1)) plot(lvl1, "Impulse level 1", color=clr1, style=plot.style_linebr, offset=-n_bars+1) clr2 = color.new(level_color, 60) lvl2 = brake_line(impulse_price(2)) plot(lvl2, "Impulse level 2", color=clr2, style=plot.style_linebr, offset=-n_bars+1) clr3= color.new(level_color, 80) lvl3 = brake_line(impulse_price(3)) plot(lvl3, "Impulse level 3", color=clr3, style=plot.style_linebr, offset=-n_bars+1) clr4= color.new(level_color, 90) lvl4 = brake_line(impulse_price(4)) plot(lvl4, "Impulse level 4", color=clr4, style=plot.style_linebr, offset=-n_bars+1)
5emaSell/buy
https://www.tradingview.com/script/rWcCBKnd-5emaSell-buy/
chinnasch
https://www.tradingview.com/u/chinnasch/
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/ // Β© chinnasch //@version=5 indicator("5emaSell/buy", overlay=true) EMA5 = ta.ema(close, 5) bgcolor(low > EMA5 ? color.new(color.yellow, 90) : na) bgcolor(EMA5 > high ? color.new(color.green,90) : na) insidebuybar = close>open and high<=high[1] and low>=low[1] insidesellbar =close<open and high<=high[1] and low>=low[1] outsidebuybar = close>open and high>high[1] and low<low[1] outsidesellbar= close<open and high>high[1] and low<low[1] plotshape(insidebuybar, title="I", style=shape.arrowup, location=location.belowbar, size=size.tiny, text="I", color=color.green, transp=0, offset=0) plotshape(insidesellbar,title="I", style=shape.arrowdown, location=location.abovebar, size=size.tiny, text="I", color=color.red, transp=0, offset=0) plotshape(outsidebuybar, title="O", style=shape.arrowup, location=location.belowbar, size=size.tiny, text="O", color=color.green, transp=0, offset=0) plotshape(outsidesellbar,title="O", style=shape.arrowdown, location=location.abovebar, size=size.tiny, text="O", color=color.red, transp=0, offset=0)
Fib Signals [MAT.SO]
https://www.tradingview.com/script/9BzAb8ln-Fib-Signals-MAT-SO/
JoshuaDanford
https://www.tradingview.com/u/JoshuaDanford/
239
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/ // Β© JoshuaDanford //@version=5 indicator("Fib Signals [MAT.SO]", overlay = true) startTime = input.time(timestamp("01 Jan 2021 00:00 +0000"), "Bar", confirm = true, group = "Range") stopTime = input.time(timestamp("01 Jan 2021 00:00 +0000"), "Bar", confirm = true, group = "Range") mode = input.string("WMA", "Signal Mode", options = ["OHLC", "SMA", "EMA", "WMA"]) modePeriod = input.int(10, "Signal Period (No effect on OHLC mode.") plotModeValue = input.bool(true, "Plot Mode Value") show1 = input(title='Show', defval=true, group = "FibLevel1") fibLevel1 = input.float(title='Fib %', defval=0.000, minval=0, group = "FibLevel1") show2 = input(title='Show', defval=true, group = "FibLevel2") fibLevel2 = input.float(title='Fib %', defval=0.236, minval=0, group = "FibLevel2") show3 = input(title='Show', defval=true, group = "FibLevel3") fibLevel3 = input.float(title='Fib %', defval=0.382, minval=0, group = "FibLevel3") show4 = input(title='Show', defval=false, group = "FibLevel4") fibLevel4 = input.float(title='Fib %', defval=0.500, minval=0, group = "FibLevel4") show5 = input(title='Show', defval=true, group = "FibLevel5") fibLevel5 = input.float(title='Fib %', defval=0.618, minval=0, group = "FibLevel5") show6 = input(title='Show', defval=true, group = "FibLevel6") fibLevel6 = input.float(title='Fib %', defval=0.786, minval=0, group = "FibLevel6") show7 = input(title='Show', defval=true, group = "FibLevel7") fibLevel7 = input.float(title='Fib %', defval=1.000, minval=0, group = "FibLevel7") show8 = input(title='Show', defval=true, group = "FibLevel8") fibLevel8 = input.float(title='Fib %', defval=1.272, minval=0, group = "FibLevel8") show9 = input(title='Show', defval=true, group = "FibLevel9") fibLevel9 = input.float(title='Fib %', defval=1.414, minval=0, group = "FibLevel9") show10 = input(title='Show', defval=true, group = "FibLevel10") fibLevel10 = input.float(title='Fib %', defval=-0.272, minval=0, group = "FibLevel10") show11 = input(title='Show', defval=true, group = "FibLevel11") fibLevel11 = input.float(title='Fib %', defval=-0.414, minval=0, group = "FibLevel11") show12 = input(title='Show', defval=true, group = "FibLevel12") fibLevel12 = input.float(title='Fib %', defval=-0.618, minval=0, group = "FibLevel12") show13 = input(title='Show', defval=true, group = "FibLevel13") fibLevel13 = input.float(title='Fib %', defval=-1.000, minval=0, group = "FibLevel13") bool withinRange = 0 withinRange := time >= startTime and time <= stopTime ? 1 : 0 bool pastRange = 0 pastRange := time >= stopTime ? 1 : 0 float highest = na float lowest = na highest := withinRange ? high > highest[1] ? high : nz(highest[1]) : pastRange ? highest[1] : na lowest := withinRange ? low < lowest[1] ? low : nz(lowest[1], 999999) : pastRange ? lowest[1] : na getFib(ratio) => highest - (highest - lowest) * ratio fibInputs = 13 fibs = array.from(fibLevel1, fibLevel2, fibLevel3, fibLevel4, fibLevel5, fibLevel6, fibLevel7, fibLevel8, fibLevel9, fibLevel10, fibLevel11, fibLevel12, fibLevel13) showFibs = array.from(show1, show2, show3, show4, show5, show6, show7, show8, show9, show10, show11, show12, show13) fibValues = array.new_float(13, na) buySignal = 0 sellSignal = 0 modeValue = close if (mode == "SMA") modeValue := ta.sma(modeValue, modePeriod) else if (mode == "EMA") modeValue := ta.ema(modeValue, modePeriod) else if (mode == "WMA") modeValue := ta.wma(modeValue, modePeriod) plot(plotModeValue ? modeValue : na) for int i = 0 to 12 showFib = array.get(showFibs, i) fibLevel = array.get(fibs, i) fibValue = (pastRange and showFib) ? getFib(fibLevel) : na array.set(fibValues, i, fibValue) if (mode == "OHLC") if (low < fibValue and open > fibValue and close > fibValue) buySignal := 1 if (high > fibValue and open < fibValue and close < fibValue) sellSignal := 1 if (open > fibValue and close < fibValue) sellSignal := 1 if (open < fibValue and close > fibValue) buySignal := 1 else if (modeValue > fibValue and modeValue[1] < fibValue) buySignal := 1 if (modeValue < fibValue and modeValue[1] > fibValue) sellSignal := 1 if (low < fibValue and modeValue > fibValue and close > fibValue and modeValue > modeValue[1]) buySignal := 1 if (high > fibValue and modeValue < fibValue and close < fibValue and modeValue < modeValue[1]) sellSignal := 1 plotshape(buySignal, title="Long", text="Long", textcolor=color.new(color.white, 0), style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), size=size.tiny) plotshape(sellSignal, title="Short", text="Short", textcolor=color.new(color.white, 0), style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), size=size.tiny) index = 0 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index)) index += 1 plot(array.get(fibValues, index))
nusta paisa gang
https://www.tradingview.com/script/NWqPNkvM-nusta-paisa-gang/
saai10
https://www.tradingview.com/u/saai10/
21
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/ // Β© CheckMateTrades //@version=4 study(title="CheckmateTrades", shorttitle="CheckmateTrade 30 cpr", overlay=true) pivottimeframe = input(title="Pivot Resolution", defval="15", options=["15","30","D","W","M"]) dp = input(true, title="Show Pivot Ranges") sp = input(true, title="Show Pivot Support Levels") rp = input(true, title="Show Pivot Resistance Levels") cp = input(true, title="Show Camarilla Pivots") dl = input(true, title="Show Daily Highs/Lows") wl = input(false, title="Show Weekly Highs/Lows") ml = input(false, title="Show Monthly Highs/Lows") showTomorrowCPR = input(title="Show tomorrow's CPR", type=input.bool, defval=false) showHistoricalCPR = input(title="Show historical CPR", type=input.bool, defval=false) showR3S3 = input(title="Show R3 & S3", 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=false) showTomorrowCamarilla = input(title="Show tomorrow's Camarilla", type=input.bool, defval=false) showTodaysCamarilla = input(title="Show Today's Camarilla", type=input.bool, defval=true) //dp in the prefix implies daily pivot calculation dpopen = security(syminfo.tickerid, pivottimeframe, open[1], barmerge.gaps_off, barmerge.lookahead_on) dphigh = security(syminfo.tickerid, pivottimeframe, high[1], barmerge.gaps_off, barmerge.lookahead_on) dplow = security(syminfo.tickerid, pivottimeframe, low[1], barmerge.gaps_off, barmerge.lookahead_on) dpclose = security(syminfo.tickerid, pivottimeframe, close[1], barmerge.gaps_off, barmerge.lookahead_on) dprange = dphigh - dplow //Pivot Boss Pivots Formula pivot = (dphigh + dplow + dpclose) / 3.0 bc = (dphigh + dplow) / 2.0 tc = pivot - bc + pivot r1 = (pivot*2)-dplow r2 = pivot + (dphigh - dplow) r3 = dphigh + 2*(pivot - dplow) s1 = (pivot*2) - dphigh s2 = pivot - (dphigh - dplow) s3 = dplow - 2*(dphigh - pivot) r4 = r3 + (r2 - r1) s4 = s3 - (s1 - s2) //Expanded Camarilla Pivots Formula h3 = dpclose + dprange * (1.1 / 4) h4 = dpclose + dprange * (1.1 / 2) l3 = dpclose - dprange * (1.1 / 4) l4 = dpclose - dprange * (1.1 / 2) //m,w,d in the prefix implies daily and hourly dhigh = security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_on) dlow = security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_on) dclose = security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_on) dopen = security(syminfo.tickerid, "D", open, lookahead=barmerge.lookahead_on) whigh = security(syminfo.tickerid, "W", high[1], lookahead=barmerge.lookahead_on) wlow = security(syminfo.tickerid, "W", low[1], lookahead=barmerge.lookahead_on) wclose = security(syminfo.tickerid, "W", close[1], lookahead=barmerge.lookahead_on) wopen = security(syminfo.tickerid, "W", open, lookahead=barmerge.lookahead_on) mhigh = security(syminfo.tickerid, "M", high[1], lookahead=barmerge.lookahead_on) mlow = security(syminfo.tickerid, "M", low[1], lookahead=barmerge.lookahead_on) mclose = security(syminfo.tickerid, "M", close[1], lookahead=barmerge.lookahead_on) mopen = security(syminfo.tickerid, "M", open, lookahead=barmerge.lookahead_on) //Plotting plot(dp and pivot ? pivot : na, title="Pivot", color=pivot != pivot[1] ? na : color.blue, transp=0) plot(dp and bc ? bc : na, title="BC", color=bc != bc[1] ? na : color.blue, transp=0) plot(dp and tc ? tc : na, title="TC", color=tc != tc[1] ? na : color.blue, transp=0) plot(rp and r1 ? r1 : na, title="R1", color=r1 != r1[1] ? na : color.red, transp=0) plot(rp and r2 ? r2 : na, title="R2", color=r2 != r2[1] ? na : color.red, transp=0) plot(rp and r3 ? r3 : na, title="R3", color=r3 != r3[1] ? na : color.red, transp=0) plot(rp and r4 ? r4 : na, title="R4", color=r4 != r4[1] ? na : color.red, transp=0) plot(sp and s1 ? s1 : na, title="S1", color=s1 != s1[1] ? na : color.green, transp=0) plot(sp and s2 ? s2 : na, title="S2", color=s2 != s2[1] ? na : color.green, transp=0) plot(sp and s3 ? s3 : na, title="S3", color=s3 != s3[1] ? na : color.green, transp=0) plot(sp and s4 ? s4 : na, title="S4", color=s4 != s4[1] ? na : color.green, transp=0) plot(cp and h4 ? h4 : na, title="H4", color=h4 != h4[1] ? na : color.black, transp=0, linewidth=2) plot(cp and h3 ? h3 : na, title="H3", color=h3 != h3[1] ? na : color.black, transp=0, linewidth=2) plot(cp and l3 ? l3 : na, title="L3", color=l3 != l3[1] ? na : color.black, transp=0, linewidth=2) plot(cp and l4 ? l4 : na, title="L4", color=l4 != l4[1] ? na : color.black, transp=0, linewidth=2) plot(dl and dhigh ? dhigh : na, title="Previous Day High", style=plot.style_line, color= dhigh != dhigh[1] ? na : color.gray, transp=0) plot(dl and dlow ? dlow : na, title="Previous Day Low", style=plot.style_line, color= dlow != dlow[1] ? na : color.gray, transp=0) plot(wl and whigh ? whigh : na, title="Previous Week High", style=plot.style_line, color= whigh != whigh[1] ? na : color.gray, transp=0) plot(wl and wlow ? wlow : na, title="Previous Week Low", style=plot.style_line, color= wlow != wlow[1] ? na : color.gray, transp=0) plot(ml and mhigh ? mhigh : na, title="Previous Month High", style=plot.style_line, color= mhigh != mhigh[1] ? na : color.gray, transp=0) plot(ml and mlow ? mlow : na, title="Previous Month Low", style=plot.style_line, color= mlow != mlow[1] ? na : color.gray, transp=0) //SMA PlotSMA1 = input(title = "Plot SMA1?", type=input.bool, defval=true) SMALength1 = input(title="SMA Length", type=input.integer, defval=20) SMASource1 = input(title="SMA Source", type=input.source, defval=close) SMAvg1 = sma (SMASource1, SMALength1) plot(PlotSMA1 ? SMAvg1 : na, color= color.green, title="SMA1") PlotSMA2 = input(title = "Plot SMA2?", type=input.bool, defval=true) SMALength2 = input(title="SMA Length", type=input.integer, defval=50) SMASource2 = input(title="SMA Source", type=input.source, defval=close) SMAvg2 = sma (SMASource2, SMALength2) plot(PlotSMA2 ? SMAvg2 : na, color= color.red, title="SMA2") PlotSMA3 = input(title = "Plot SMA3?", type=input.bool, defval=true) SMALength3 = input(title="SMA Length", type=input.integer, defval=200) SMASource3 = input(title="SMA Source", type=input.source, defval=close) SMAvg3 = sma (SMASource3, SMALength3) plot(PlotSMA3 ? SMAvg3 : na, color= color.black, title="SMA3") // User inputs // Defaults // CPR Colors cprColor = color.purple rColor = color.red sColor = color.green cColor = color.black camColor = color.black // Line style & Transparency lStyle = plot.style_line lTransp = 20 //Fill Transparency fTransp = 95 // Global Variables & Flags // TODO : Update the No of Holidays noOfHolidays = 13 // 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(2021, 02, 21, 09, 15), true, iff(_date == timestamp(2021, 01, 26, 09, 15), true, iff(_date == timestamp(2021, 03, 11, 09, 15), true, iff(_date == timestamp(2021, 03, 29, 09, 15), true, iff(_date == timestamp(2021, 04, 02, 09, 15), true, iff(_date == timestamp(2021, 04, 14, 09, 15), true, iff(_date == timestamp(2021, 04, 21, 09, 15), true, iff(_date == timestamp(2021, 05, 13, 09, 15), true, iff(_date == timestamp(2021, 07, 21, 09, 15), true, iff(_date == timestamp(2021, 08, 19, 09, 15), true, iff(_date == timestamp(2021, 09, 10, 09, 15), true, iff(_date == timestamp(2021, 10, 15, 09, 15), true, iff(_date == timestamp(2021, 11, 05, 09, 15), true, iff(_date == timestamp(2021, 11, 19, 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) // Camarilla Levels H3 = C + (H - L)*(1.1/4) H4 = C + (H - L)*(1.1/2) L3 = C - (H - L)*(1.1/4) L4 = C - (H - L)*(1.1/2) // 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]) if showTodaysCamarilla _h3 = line.new(start, H3, end, H3, xloc.bar_time, color=color.new(camColor, lTransp), width=2) line.delete(_h3[1]) _h4 = line.new(start, H4, end, H4, xloc.bar_time, color=color.new(camColor, lTransp), width=2) line.delete(_h4[1]) _l3 = line.new(start, L3, end, L3, xloc.bar_time, color=color.new(camColor, lTransp), width=2) line.delete(_l3[1]) _l4 = line.new(start, L4, end, L4, xloc.bar_time, color=color.new(camColor, lTransp), width=2) line.delete(_l4[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) // Camarilla Levels tH3 = tC + (tH - tL)*(1.1/4) tH4 = tC + (tH - tL)*(1.1/2) tL3 = tC - (tH - tL)*(1.1/4) tL4 = tC - (tH - tL)*(1.1/2) // 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]) if showTomorrowCamarilla _t_h3 = line.new(tom_start, tH3, tom_end, tH3, xloc.bar_time, color=color.new(camColor, lTransp), width=2) line.delete(_t_h3[1]) _t_h4 = line.new(tom_start, tH4, tom_end, tH4, xloc.bar_time, color=color.new(camColor, lTransp), width=2) line.delete(_t_h4[1]) _t_l3 = line.new(tom_start, tL3, tom_end, tL3, xloc.bar_time, color=color.new(camColor, lTransp), width=2) line.delete(_t_l3[1]) _t_l4 = line.new(tom_start, tL4, tom_end, tL4, xloc.bar_time, color=color.new(camColor, lTransp), width=2) line.delete(_t_l4[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]) if showTomorrowCamarilla l_t_h3 = label.new(tom_start, tH3, text="TH3", xloc=xloc.bar_time, textcolor=camColor, style=label.style_none) label.delete(l_t_h3[1]) l_t_h4 = label.new(tom_start, tH4, text="TH4", xloc=xloc.bar_time, textcolor=camColor, style=label.style_none) label.delete(l_t_h4[1]) l_t_l3 = label.new(tom_start, tL3, text="TL3", xloc=xloc.bar_time, textcolor=camColor, style=label.style_none) label.delete(l_t_l3[1]) l_t_l4 = label.new(tom_start, tL4, text="TL4", xloc=xloc.bar_time, textcolor=camColor, style=label.style_none) label.delete(l_t_l4[1]) //Plot Historical CPR p_r3 = plot(showHistoricalCPR ? showR3S3 ? R3 : na : na, title=' R3', color=rColor, transp=lTransp) p_r2 = plot(showHistoricalCPR ? R2 : na, title=' R2', color=rColor, transp=lTransp) p_r1 = plot(showHistoricalCPR ? R1 : na, title=' R1', color=rColor, transp=lTransp) p_cprTC = plot(showHistoricalCPR ? TC : na, title=' TC', color=cprColor, transp=lTransp) p_cprP = plot(showHistoricalCPR ? P : na, title=' P', color=cprColor, transp=lTransp) p_cprBC = plot(showHistoricalCPR ? BC : na, title=' BC', color=cprColor, transp=lTransp) s11 = plot(showHistoricalCPR ? S1 : na, title=' S1', color=sColor, transp=lTransp) s22 = plot(showHistoricalCPR ? S2 : na, title=' S2', color=sColor, transp=lTransp) s33 = plot(showHistoricalCPR ? showR3S3 ? S3 : na : na, title=' S3', color=sColor, transp=lTransp) fill(p_cprTC, p_cprBC, color=color.purple, transp=fTransp)
Didi index setup
https://www.tradingview.com/script/U33DoRHa-Didi-index-setup/
vitorleo
https://www.tradingview.com/u/vitorleo/
98
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/ // Β© vitorleo //@version=5 indicator('Didi Index Plus', shorttitle='Didi') // Inputs for Didi Index short = input.int(title="Fast average", defval=3, group="Didi index config") mid = input.int(title="Normal average", defval=8, group="Didi index config") long = input.int(title="Slow average", defval=20, group="Didi index config") // Didi index Average normalisation DidiLonga = (ta.sma(close, long) / ta.sma(close, mid) - 1) * 100 DidiCurta = (ta.sma(close, short) / ta.sma(close, mid) - 1) * 100 DidiPrice = (close / ta.sma(close, mid) - 1) * 100 DidiOpen = (open / ta.sma(close, mid) - 1) * 100 DidiHigh = (high / ta.sma(close, mid) - 1) * 100 DidiLow = (low / ta.sma(close, mid) - 1) * 100 // Plots the candles plotcandle(DidiOpen, DidiHigh, DidiLow, DidiPrice, title='Candle shadows', color=color.new(open < close ? color.black : color.white, 80), wickcolor=color.new(color.white, 80), editable=false, bordercolor=color.new(color.white, 80)) // Plots the lines plot(DidiCurta, color=color.new(color.blue, 0), linewidth=2, title='Fast average') plot(0, color=color.new(color.white, 0), title='Normal average') plot(DidiLonga, color=color.new(color.fuchsia, 0), linewidth=2, title='Slow average') // DMI // Inputs for DMI dmi_len = input.int(8, minval=1, title='DI length', group="DMI/ADX config") dmi_lensig = input.int(8, title='ADX smoothing', minval=1, maxval=50, group="DMI/ADX config") colorUpTrend = input.color(color.new(color.blue, 85), "Up trend", group="DMI/ADX config") colorDownTrend = input.color(color.new(#E040FB, 85), "Down trend", group="DMI/ADX config") [diplus, diminus, adx] = ta.dmi(dmi_len, dmi_lensig) // Logic to interpret DMI and define if there is trend or not and its strength/acceleration tendenciaAcelerante() => adx > adx[1] * 1.015 ? true : false temTendencia() => adx < 32 and tendenciaAcelerante() == false or adx < diplus and adx < diminus ? false : true tendenciaCompra() => temTendencia() and diplus > diminus tendenciaVenda() => temTendencia() and diplus < diminus // Plot DMI in background plotchar(math.round(adx), 'ADX', '', location.top, editable=false) bgcolor(tendenciaCompra() ? colorUpTrend : na, title='Up trend', editable=false) bgcolor(tendenciaAcelerante() and tendenciaCompra() ? colorUpTrend : na, title='Strong Up trend', editable=false) bgcolor(tendenciaVenda() ? colorDownTrend : na, title='Down trend', editable=false) bgcolor(tendenciaAcelerante() and tendenciaVenda() ? colorDownTrend : na, title='Strong Down trend', editable=false) //TRIX filtrarTrix = input(title='TRIX signal', defval=true, group="TRIX config") _length = input.int(9, title='TRIX', minval=1, group="TRIX config") _useEma = true _ma = input.int(4, title='TRIX average', minval=1, group="TRIX config") tema(a, b) => ta.ema(ta.ema(ta.ema(a, b), b), b) trix(a) => (a - a[1]) / a[1] * 10000 _trix = trix(tema(close, _length)) _trixs = _useEma ? ta.ema(_trix, _ma) : ta.sma(_trix, _ma) // Estocastico filtrarStoch = input(title='Stochastic signal', defval=true, group="Stochastic config") Length = input.int(8, minval=1, title='Stochastic length', group="Stochastic config") k = input.int(3, minval=1, title='Stochastic %K', group="Stochastic config") d = input.int(3, minval=1, title='Stochastic %D', group="Stochastic config") Sto = ta.sma(ta.stoch(close, high, low, Length), d) K = ta.sma(Sto, k) trixComprado() => filtrarTrix == false ? true : _trix > _trixs ? true : false stockComprado() => filtrarStoch == false ? true : Sto > K ? true : false exitShort() => trixComprado() and ta.crossover(Sto, K) or stockComprado() and ta.crossover(_trix, _trixs) exitLong() => trixComprado() == false and ta.crossunder(Sto, K) or stockComprado() == false and ta.crossunder(_trix, _trixs) plotshape(exitShort() and (tendenciaVenda() or temTendencia() == false), style=shape.triangleup, location=location.bottom, color=color.new(color.white, 20), size=size.auto, title='Exit short') plotshape(exitLong() and (tendenciaCompra() or temTendencia() == false), style=shape.triangledown, location=location.top, color=color.new(color.white, 20), size=size.auto, title='Exit long') //End
Moving Average Multitool
https://www.tradingview.com/script/Cv4JpLMR-Moving-Average-Multitool/
bjr117
https://www.tradingview.com/u/bjr117/
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/ // Β© bjr117 //@version=5 indicator("Moving Average Multitool", shorttitle = "[MAM]", overlay = true) //============================================================================== // Function: Calculate a given type of moving average //============================================================================== get_ma_out(type, src, len, alma_offset, alma_sigma, kama_fastLength, kama_slowLength, vama_vol_len, vama_do_smth, vama_smth, mf_beta, mf_feedback, mf_z, eit_alpha, ssma_pow, ssma_smooth, rsrma_pw, svama_method, svama_vol_or_volatility, wrma_smooth) => float baseline = 0.0 if type == "SMA | Simple MA" baseline := ta.sma(src, len) else if type == "EMA | Exponential MA" baseline := ta.ema(src, len) else if type == "DEMA | Double Exponential MA" e = ta.ema(src, len) baseline := 2 * e - ta.ema(e, len) else if type == "TEMA | Triple Exponential MA" e = ta.ema(src, len) baseline := 3 * (e - ta.ema(e, len)) + ta.ema(ta.ema(e, len), len) else if type == "TMA | Triangular MA" // by everget baseline := ta.sma(ta.sma(src, math.ceil(len / 2)), math.floor(len / 2) + 1) else if type == "WMA | Weighted MA" baseline := ta.wma(src, len) else if type == "VWMA | Volume-Weighted MA" baseline := ta.vwma(src, len) else if type == "SMMA | Smoothed MA" w = ta.wma(src, len) baseline := na(w[1]) ? ta.sma(src, len) : (w[1] * (len - 1) + src) / len else if type == "RMA | Rolling MA" baseline := ta.rma(src, len) else if type == "HMA | Hull MA" baseline := ta.wma(2 * ta.wma(src, len / 2) - ta.wma(src, len), math.round(math.sqrt(len))) else if type == "LSMA | Least Squares MA" baseline := ta.linreg(src, len, 0) else if type == "Kijun" //Kijun-sen kijun = math.avg(ta.lowest(len), ta.highest(len)) baseline := kijun else if type == "MD | McGinley Dynamic" mg = 0.0 mg := na(mg[1]) ? ta.ema(src, len) : mg[1] + (src - mg[1]) / (len * math.pow(src / mg[1], 4)) baseline := mg else if type == "JMA | Jurik MA" // by everget DEMAe1 = ta.ema(src, len) DEMAe2 = ta.ema(DEMAe1, len) baseline := 2 * DEMAe1 - DEMAe2 else if type == "ALMA | Arnaud Legoux MA" baseline := ta.alma(src, len, alma_offset, alma_sigma) else if type == "VAR | Vector Autoregression MA" valpha = 2 / (len+1) vud1 = (src > src[1]) ? (src - src[1]) : 0 vdd1 = (src < src[1]) ? (src[1] - src) : 0 vUD = math.sum(vud1, 9) vDD = math.sum(vdd1, 9) vCMO = nz( (vUD - vDD) / (vUD + vDD) ) baseline := nz(valpha * math.abs(vCMO) * src) + (1 - valpha * math.abs(vCMO)) * nz(baseline[1]) else if type == "ZLEMA | Zero-Lag Exponential MA" // by HPotter xLag = (len) / 2 xEMAData = (src + (src - src[xLag])) baseline := ta.ema(xEMAData, len) else if type == "AHMA | Ahrens Moving Average" // by everget baseline := nz(baseline[1]) + (src - (nz(baseline[1]) + nz(baseline[len])) / 2) / len else if type == "EVWMA | Elastic Volume Weighted MA" volumeSum = math.sum(volume, len) baseline := ( (volumeSum - volume) * nz(baseline[1]) + volume * src ) / volumeSum else if type == "SWMA | Sine Weighted MA" // by everget sum = 0.0 weightSum = 0.0 for i = 0 to len - 1 weight = math.sin(i * math.pi / (len + 1)) sum := sum + nz(src[i]) * weight weightSum := weightSum + weight baseline := sum / weightSum else if type == "LMA | Leo MA" baseline := 2 * ta.wma(src, len) - ta.sma(src, len) else if type == "VIDYA | Variable Index Dynamic Average" // by KivancOzbilgic mom = ta.change(src) upSum = math.sum(math.max(mom, 0), len) downSum = math.sum(-math.min(mom, 0), len) out = (upSum - downSum) / (upSum + downSum) cmo = math.abs(out) alpha = 2 / (len + 1) baseline := src * alpha * cmo + nz(baseline[1]) * (1 - alpha * cmo) else if type == "FRAMA | Fractal Adaptive MA" length2 = math.floor(len / 2) hh2 = ta.highest(length2) ll2 = ta.lowest(length2) N1 = (hh2 - ll2) / length2 N2 = (hh2[length2] - ll2[length2]) / length2 N3 = (ta.highest(len) - ta.lowest(len)) / len D = (math.log(N1 + N2) - math.log(N3)) / math.log(2) factor = math.exp(-4.6 * (D - 1)) baseline := factor * src + (1 - factor) * nz(baseline[1]) else if type == "VMA | Variable MA" // by LazyBear k = 1.0/len pdm = math.max((src - src[1]), 0) mdm = math.max((src[1] - src), 0) pdmS = float(0.0) mdmS = float(0.0) pdmS := ((1 - k)*nz(pdmS[1]) + k*pdm) mdmS := ((1 - k)*nz(mdmS[1]) + k*mdm) s = pdmS + mdmS pdi = pdmS/s mdi = mdmS/s pdiS = float(0.0) mdiS = float(0.0) pdiS := ((1 - k)*nz(pdiS[1]) + k*pdi) mdiS := ((1 - k)*nz(mdiS[1]) + k*mdi) d = math.abs(pdiS - mdiS) s1 = pdiS + mdiS iS = float(0.0) iS := ((1 - k)*nz(iS[1]) + k*d/s1) hhv = ta.highest(iS, len) llv = ta.lowest(iS, len) d1 = hhv - llv vI = (iS - llv)/d1 baseline := (1 - k*vI)*nz(baseline[1]) + k*vI*src else if type == "GMMA | Geometric Mean MA" lmean = math.log(src) smean = math.sum(lmean, len) baseline := math.exp(smean / len) else if type == "CMA | Corrective MA" // by everget sma = ta.sma(src, len) baseline := sma v1 = ta.variance(src, len) v2 = math.pow(nz(baseline[1], baseline) - baseline, 2) v3 = v1 == 0 or v2 == 0 ? 1 : v2 / (v1 + v2) var tolerance = math.pow(10, -5) float err = 1 // Gain Factor float kPrev = 1 float k = 1 for i = 0 to 5000 by 1 if err > tolerance k := v3 * kPrev * (2 - kPrev) err := kPrev - k kPrev := k kPrev baseline := nz(baseline[1], src) + k * (sma - nz(baseline[1], src)) else if type == "MM | Moving Median" // by everget baseline := ta.percentile_nearest_rank(src, len, 50) else if type == "QMA | Quick MA" // by everget peak = len / 3 num = 0.0 denom = 0.0 for i = 1 to len + 1 mult = 0.0 if i <= peak mult := i / peak else mult := (len + 1 - i) / (len + 1 - peak) num := num + src[i - 1] * mult denom := denom + mult baseline := (denom != 0.0) ? (num / denom) : src else if type == "KAMA | Kaufman Adaptive MA" // by everget mom = math.abs(ta.change(src, len)) volatility = math.sum(math.abs(ta.change(src)), len) // Efficiency Ratio er = volatility != 0 ? mom / volatility : 0 fastAlpha = 2 / (kama_fastLength + 1) slowAlpha = 2 / (kama_slowLength + 1) alpha = math.pow(er * (fastAlpha - slowAlpha) + slowAlpha, 2) baseline := alpha * src + (1 - alpha) * nz(baseline[1], src) else if type == "VAMA | Volatility Adjusted MA" // by Joris Duyck (JD) mid = ta.ema(src, len) dev = src - mid vol_up = ta.highest(dev, vama_vol_len) vol_down = ta.lowest(dev, vama_vol_len) vama = mid + math.avg(vol_up, vol_down) baseline := vama_do_smth ? ta.wma(vama, vama_smth) : vama else if type == "Modular Filter" // by alexgrover //---- b = 0.0, c = 0.0, os = 0.0, ts = 0.0 //---- alpha = 2/(len+1) a = mf_feedback ? mf_z*src + (1-mf_z)*nz(baseline[1],src) : src //---- b := a > alpha*a+(1-alpha)*nz(b[1],a) ? a : alpha*a+(1-alpha)*nz(b[1],a) c := a < alpha*a+(1-alpha)*nz(c[1],a) ? a : alpha*a+(1-alpha)*nz(c[1],a) os := a == b ? 1 : a == c ? 0 : os[1] //---- upper = mf_beta*b+(1-mf_beta)*c lower = mf_beta*c+(1-mf_beta)*b baseline := os*upper+(1-os)*lower else if type == "EIT | Ehlers Instantaneous Trendline" // by Franklin Moormann (cheatcountry) baseline := bar_index < 7 ? (src + (2 * nz(src[1])) + nz(src[2])) / 4 : ((eit_alpha - (math.pow(eit_alpha, 2) / 4)) * src) + (0.5 * math.pow(eit_alpha, 2) * nz(src[1])) - ((eit_alpha - (0.75 * math.pow(eit_alpha, 2))) * nz(src[2])) + (2 * (1 - eit_alpha) * nz(baseline[1])) - (math.pow(1 - eit_alpha, 2) * nz(baseline[2])) else if type == "ESD | Ehlers Simple Decycler" // by everget // High-pass Filter alphaArg = 2 * math.pi / (len * math.sqrt(2)) alpha = 0.0 alpha := math.cos(alphaArg) != 0 ? (math.cos(alphaArg) + math.sin(alphaArg) - 1) / math.cos(alphaArg) : nz(alpha[1]) hp = 0.0 hp := math.pow(1 - (alpha / 2), 2) * (src - 2 * nz(src[1]) + nz(src[2])) + 2 * (1 - alpha) * nz(hp[1]) - math.pow(1 - alpha, 2) * nz(hp[2]) baseline := src - hp else if type == "SSMA | Shapeshifting MA" // by alexgrover //---- ssma_sum = 0.0 ssma_sumw = 0.0 alpha = ssma_smooth ? 2 : 1 power = ssma_smooth ? ssma_pow - ssma_pow % 2 : ssma_pow //---- for i = 0 to len-1 x = i/(len-1) n = ssma_smooth ? -1 + x*2 : x w = 1 - 2*math.pow(n,alpha)/(math.pow(n,power) + 1) ssma_sumw := ssma_sumw + w ssma_sum := ssma_sum + src[i] * w baseline := ssma_sum/ssma_sumw //---- else if type == "RSRMA | Right Sided Ricker MA" // by alexgrover //---- rsrma_sum = 0.0 rsrma_sumw = 0.0 rsrma_width = rsrma_pw/100*len for i = 0 to len-1 w = (1 - math.pow(i/rsrma_width,2))*math.exp(-(i*i/(2*math.pow(rsrma_width,2)))) rsrma_sumw := rsrma_sumw + w rsrma_sum := rsrma_sum + src[i] * w baseline := rsrma_sum/rsrma_sumw //---- else if type == "DSWF | Damped Sine Wave Weighted Filter" // by alexgrover //---- dswf_sum = 0.0 dswf_sumw = 0.0 for i = 1 to len w = math.sin(2.0*math.pi*i/len)/i dswf_sumw := dswf_sumw + w dswf_sum := dswf_sum + w*src[i-1] //---- baseline := dswf_sum/dswf_sumw else if type == "BMF | Blackman Filter" // by alexgrover //---- bmf_sum = 0.0 bmf_sumw = 0.0 for i = 0 to len-1 k = i/len w = 0.42 - 0.5 * math.cos(2 * math.pi * k) + 0.08 * math.cos(4 * math.pi * k) bmf_sumw := bmf_sumw + w bmf_sum := bmf_sum + w*src[i] //---- baseline := bmf_sum/bmf_sumw else if type == "HCF | Hybrid Convolution Filter" // by alexgrover //---- sum = 0. for i = 1 to len sgn = .5*(1 - math.cos((i/len)*math.pi)) sum := sum + (sgn*(nz(baseline[1],src)) + (1 - sgn)*src[i-1]) * ( (.5*(1 - math.cos((i/len)*math.pi))) - (.5*(1 - math.cos(((i-1)/len)*math.pi))) ) baseline := sum //---- else if type == "FIR | Finite Response Filter" // by alexgrover //---- var b = array.new_float(0) if barstate.isfirst for i = 0 to len-1 w = len-i array.push(b,w) den = array.sum(b) //---- sum = 0.0 for i = 0 to len-1 sum := sum + src[i]*array.get(b,i) baseline := sum/den else if type == "FLSMA | Fisher Least Squares MA" // by alexgrover //---- b = 0.0 //---- e = ta.sma(math.abs(src - nz(b[1])),len) z = ta.sma(src - nz(b[1],src),len)/e r = (math.exp(2*z) - 1)/(math.exp(2*z) + 1) a = (bar_index - ta.sma(bar_index,len))/ta.stdev(bar_index,len) * r b := ta.sma(src,len) + a*ta.stdev(src,len) baseline := b else if type == "SVAMA | Non-Parametric Volume Adjusted MA" // by alexgrover and bjr117 //---- h = 0.0 l = 0.0 c = 0.0 //---- a = svama_vol_or_volatility == "Volume" ? volume : ta.tr h := a > nz(h[1], a) ? a : nz(h[1], a) l := a < nz(l[1], a) ? a : nz(l[1], a) //---- b = svama_method == "Max" ? a / h : l / a c := b * close + (1 - b) * nz(c[1], close) baseline := c else if type == "RPMA | Repulsion MA" // by alexgrover baseline := ta.sma(close, len*3) + ta.sma(close, len*2) - ta.sma(close, len) else if type == "WRMA | Well Rounded MA" // by alexgrover //---- alpha = 2/(len+1) p1 = wrma_smooth ? len/4 : 1 p2 = wrma_smooth ? len/4 : len/2 //---- a = float(0.0) b = float(0.0) y = ta.ema(a + b,p1) A = src - y B = src - ta.ema(y,p2) a := nz(a[1]) + alpha*nz(A[1]) b := nz(b[1]) + alpha*nz(B[1]) baseline := y else if type == "HLT | HiLo Trend" // Getting the highest highs / lowest lows in the user-inputted slowLength period and fastLength period hlt_high = ta.highest(src, len) hlt_low = ta.lowest(src, len) // Calculate the HLT Line // If the source (close, hl2, ...) value is greater than the previous HLT line, let the next HLT line value be the source value. baseline := (src > baseline[1]) ? hlt_low : hlt_high else if type == "T3 | Tillson T3" // by HPotter //////////////////////////////////////////////////////////// // Copyright by HPotter v1.0 21/05/2014 // This indicator plots the moving average described in the January, 1998 issue // of S&C, p.57, "Smoothing Techniques for More Accurate Signals", by Tim Tillson. // This indicator plots T3 moving average presented in Figure 4 in the article. // T3 indicator is a moving average which is calculated according to formula: // T3(n) = GD(GD(GD(n))), // where GD - generalized DEMA (Double EMA) and calculating according to this: // GD(n,v) = EMA(n) * (1+v)-EMA(EMA(n)) * v, // where "v" is volume factor, which determines how hot the moving average’s response // to linear trends will be. The author advises to use v=0.7. // When v = 0, GD = EMA, and when v = 1, GD = DEMA. In between, GD is a less aggressive // version of DEMA. By using a value for v less than1, trader cure the multiple DEMA // overshoot problem but at the cost of accepting some additional phase delay. // In filter theory terminology, T3 is a six-pole nonlinear Kalman filter. Kalman // filters are ones that use the error β€” in this case, (time series - EMA(n)) β€” // to correct themselves. In the realm of technical analysis, these are called adaptive // moving averages; they track the time series more aggres-sively when it is making large // moves. Tim Tillson is a software project manager at Hewlett-Packard, with degrees in // mathematics and computer science. He has privately traded options and equities for 15 years. //////////////////////////////////////////////////////////// xe1 = ta.ema(src, len) xe2 = ta.ema(xe1, len) xe3 = ta.ema(xe2, len) xe4 = ta.ema(xe3, len) xe5 = ta.ema(xe4, len) xe6 = ta.ema(xe5, len) b = 0.7 c1 = -b*b*b c2 = 3*b*b+3*b*b*b c3 = -6*b*b-3*b-3*b*b*b c4 = 1+3*b+b*b*b+3*b*b baseline := c1 * xe6 + c2 * xe5 + c3 * xe4 + c4 * xe3 baseline //============================================================================== //============================================================================== // Inputs //============================================================================== // Get inputs for deciding what type of moving average to use and what it's input price type (source) and lookback period should be ma_type = input.string("EMA | Exponential MA", "MA Type", options=[ "EMA | Exponential MA", "SMA | Simple MA", "WMA | Weighted MA", "DEMA | Double Exponential MA", "TEMA | Triple Exponential MA", "TMA | Triangular MA", "VWMA | Volume-Weighted MA", "SMMA | Smoothed MA", "HMA | Hull MA", "LSMA | Least Squares MA", "Kijun", "MD | McGinley Dynamic", "RMA | Rolling MA", "JMA | Jurik MA", "ALMA | Arnaud Legoux MA", "VAR | Vector Autoregression MA", "ZLEMA | Zero-Lag Exponential MA", "T3 | Tillson T3", "AHMA | Ahrens Moving Average", "EVWMA | Elastic Volume Weighted MA", "SWMA | Sine Weighted MA", "LMA | Leo MA", "VIDYA | Variable Index Dynamic Average", "FRAMA | Fractal Adaptive MA", "VMA | Variable MA", "GMMA | Geometric Mean MA", "CMA | Corrective MA", "MM | Moving Median", "QMA | Quick MA", "KAMA | Kaufman Adaptive MA", "VAMA | Volatility Adjusted MA", "Modular Filter", "EIT | Ehlers Instantaneous Trendline", "ESD | Ehlers Simple Decycler", "SSMA | Shapeshifting MA", "RSRMA | Right Sided Ricker MA", "DSWF | Damped Sine Wave Weighted Filter", "BMF | Blackman Filter", "HCF | Hybrid Convolution Filter", "FIR | Finite Response Filter", "FLSMA | Fisher Least Squares MA", "SVAMA | Non-Parametric Volume Adjusted MA", "RPMA | Repulsion MA", "WRMA | Well Rounded MA", "HLT | HiLo Trend" ], group = "General MA Settings") ma_len = input.int(title = "Length", defval = 100, minval = 1, group = "General MA Settings") ma_src = input.source(title = "Source", defval = close, group = "General MA Settings") // Inputs for showing ma-price cross and ma slope change signals ma_do_blc_signals = input.bool(title = "Show Price Crossover Signals?", defval = false, group = "General MA Settings") ma_do_bls_signals = input.bool(title = "Show MA Slope Change Signals?", defval = false, group = "General MA Settings") ma_bls_len = input.int(title = "Slope Calculation Smoothing", defval = 1, minval = 1, group = "General MA Settings") ma_blc_bls_color = input.bool(title = "Color the MA based on signals?", defval = true, group = "General MA Settings") // Inputs for showing ATR (keltner channel) and STDEV (bollinger) bands around the ma ma_do_atr_band = input.bool(title = "Show ATR Bands", defval = true, group = "General MA Settings") atr_band_len = input.int(title = "ATR Length", defval = 14, minval = 1, group = "General MA Settings") atr_band_mult = input.float(title = "ATR Band Multiple", defval = 1.0, minval = 0, step = 0.25, group = "General MA Settings") ma_do_stdev_band = input.bool(title = "Show Standard Deviation Bands?", defval = false, group = "General MA Settings") stdev_band_len = input.int(title = "Standard Deviation Calculation Length", defval = 14, minval = 1, group = "General MA Settings") stdev_band_src = input.source(title = "Standard Deviation Calculation Source", defval = close, group = "General MA Settings") stdev_band_stdev = input.float(title = "Standard Deviations", defval = 1.0, minval = 0.0, step = 0.25, group = "General MA Settings") // Specific nuanced settings for different types of moving averages alma_offset = input.float(title = "Offset", defval = 0.85, step = 0.05, group = "ALMA Settings") alma_sigma = input.int(title = "Sigma", defval = 6, group = "ALMA Settings") kama_fastLength = input(title = "Fast EMA Length", defval=2, group = "KAMA Settings") kama_slowLength = input(title = "Slow EMA Length", defval=30, group = "KAMA Settings") vama_vol_len = input.int(title = "Volatality Length", defval = 51, group = "VAMA Settings") vama_do_smth = input.bool(title = "Do Smoothing?", defval = false, group = "VAMA Settings") vama_smth = input.int(title = "Smoothing length", defval = 5, minval = 1, group = "VAMA Settings") mf_beta = input.float(title = "Beta", defval = 0.8, step = 0.1, minval = 0, maxval=1, group = "Modular Filter Settings") mf_feedback = input.bool(title = "Feedback?", defval = false, group = "Modular Filter Settings") mf_z = input.float(title = "Feedback Weighting", defval = 0.5, step = 0.1, minval = 0, maxval = 1, group = "Modular Filter Settings") eit_alpha = input.float(title = "Alpha", defval = 0.07, step = 0.01, minval = 0.0, group = "Ehlers Instantaneous Trendline Settings") ssma_pow = input.float(title = "Power", defval = 4.0, step = 0.5, minval = 0.0, group = "SSMA Settings") ssma_smooth = input.bool(title = "Smooth", defval = false, group = "SSMA Settings") rsrma_pw = input.float(title = "Percent Width", defval = 60.0, step = 10.0, minval = 0.0, maxval = 100.0, group = "RSRMA Settings") svama_method = input.string(title = "Max", options = ["Max", "Min"], defval = "Max", group = "SVAMA Settings") svama_vol_or_volatility = input.string(title = "Use Volume or Volatility?", options = ["Volume", "Volatility"], defval = "Volatility", group = "SVAMA Settings") wrma_smooth = input.bool(title = "Extra Smoothing?", defval = false, group = "WRMA Settings") // Inputs for calculating the average ATR between MA and closing price calculation d_close = input.bool(title = "Show Avg ATR Between MA and Close?", defval = false, group = "Average ATR Between MA and Close Settings") d_close_len = input.int(title = "Avg ATR Lookback Period", defval = 14, group = "Average ATR Between MA and Close Settings") //============================================================================== //============================================================================== // Calculate the moving average //============================================================================== ma = get_ma_out(ma_type, ma_src, ma_len, alma_offset, alma_sigma, kama_fastLength, kama_slowLength, vama_vol_len, vama_do_smth, vama_smth, mf_beta, mf_feedback, mf_z, eit_alpha, ssma_pow, ssma_smooth, rsrma_pw, svama_method, svama_vol_or_volatility, wrma_smooth) //============================================================================== //============================================================================== // Calculate and plot the ATR bands //============================================================================== ma_atr_band_upper = ma_do_atr_band ? ma + (ta.atr(atr_band_len) * atr_band_mult) : na ma_atr_band_lower = ma_do_atr_band ? ma - (ta.atr(atr_band_len) * atr_band_mult) : na plot(ma_atr_band_upper, title = "Moving Average Upper ATR Band", color = color.new(#000000, 75), linewidth = 1) plot(ma_atr_band_lower, title = "Moving Average Lower ATR Band", color = color.new(#000000, 75), linewidth = 1) //============================================================================== //============================================================================== // Calculate and plot the standard deviation bands //============================================================================== std_dev_bands_width = ta.stdev(stdev_band_src, stdev_band_len, true) * stdev_band_stdev ma_stdev_band_upper = ma_do_stdev_band ? ma + std_dev_bands_width : na ma_stdev_band_lower = ma_do_stdev_band ? ma - std_dev_bands_width : na plot(ma_stdev_band_upper, title = "Moving Average Upper Standard Deviation Band", color = color.new(#000000, 75), linewidth = 1) plot(ma_stdev_band_lower, title = "Moving Average Lower Standard Deviation Band", color = color.new(#000000, 75), linewidth = 1) //============================================================================== //============================================================================== // Calculate the average ATR between MA and close //============================================================================== // Calculates the distance between the moving average and the close ma_dist = float(0.0) ma_dist := math.abs(ma - close) // Calculates the 14 period average distance between the moving average and the close as a multiple of ATR. Used to compare the speed of moving averages with each other. ma_avg_dist_atr = math.round( ta.sma(ma_dist, d_close_len) / ta.atr(14), 2) //============================================================================== //============================================================================== // Create on-chart label showing the average ATR between MA and close //============================================================================== // Creates an on-chart label to show the average distance value calculated above. labelText = str.tostring(ma_avg_dist_atr) stratLabel = label.new(x=bar_index, y=na, text=(d_close ? labelText : na), yloc=yloc.abovebar, color=color.black, textcolor=color.rgb(227, 225, 214), style=label.style_label_down) // Delete previous candles" labels if labels are enabled, otherwise delete all labels if d_close label.delete(stratLabel[1]) else label.delete(stratLabel) //============================================================================== //============================================================================== // Plot price-MA cross signals and MA slope change signals //============================================================================== // Calculate when a ma cross signal occurs blc_L_trig = ma_do_blc_signals ? (ta.crossover(close, ma) ? true : false) : false blc_S_trig = ma_do_blc_signals ? (ta.crossunder(close, ma) ? true : false) : false // Calculate when the ma is below/above price blc_L_conf = ma_do_blc_signals ? (close > ma ? true : false) : false blc_S_conf = ma_do_blc_signals ? (close < ma ? true : false) : false // Calculate when a ma slope change signal occurs bls_L_trig = ma_do_bls_signals ? (ta.crossover(ta.roc(ma, ma_bls_len), 0) ? true : false) : false bls_S_trig = ma_do_bls_signals ? (ta.crossunder(ta.roc(ma, ma_bls_len), 0) ? true : false) : false // Calculate when the ma's slope is above/below 0 bls_L_conf = ma_do_bls_signals ? (ta.roc(ma, ma_bls_len) > 0 ? true : false) : false bls_S_conf = ma_do_bls_signals ? (ta.roc(ma, ma_bls_len) < 0 ? true : false) : false // Overall long/short entry signals ma_L_trig = blc_L_trig or bls_L_trig ma_S_trig = blc_S_trig or bls_S_trig // Overall long/short confirmation signals ma_L_conf = blc_L_conf or bls_L_conf ma_S_conf = blc_S_conf or bls_S_conf // Plot a "Buy" or "Sell" label if you get an ma cross signal (blc_L/S_trig) or an ma slope change signal (bls_L/S_trig), if enabled plotshape(ma_L_trig ? ma - ta.atr(14) : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.new(color.white, 0)) plotshape(ma_S_trig ? ma + ta.atr(14) : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.new(color.white, 0)) //============================================================================== //============================================================================== // Plot the moving average //============================================================================== // Calculate the moving average color based on signals ma_signal_color = ma_L_conf ? color.new(#66BB6A, 0) : ma_S_conf ? color.new(#B71C1C, 0) : color.gray // Plot the ma plot(ma, title = "Moving Average", color = ma_blc_bls_color and (ma_do_blc_signals or ma_do_bls_signals) ? ma_signal_color : color.new(#000000, 0), linewidth = 2) //==============================================================================
Sentiment Estimator [AstrideUnicorn]
https://www.tradingview.com/script/Wm7gvcrs-Sentiment-Estimator-AstrideUnicorn/
AstrideUnicorn
https://www.tradingview.com/u/AstrideUnicorn/
381
study
5
CC-BY-NC-SA-4.0
// This work is licensed under the Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // (c) AstrideUnicorn. All rights reserved. //@version=5 indicator('Sentiment Estimator', precision=2, timeframe='') length = input.int(defval=50, title='Look-back Window', minval=1) // Define extreme sentiment level above which reveral is expected extreme_sentiment = input.float( defval=61.5, title="Extreme Sentiment Level") // initialize red and green candles counters count_green = 0 count_red = 0 // Count green and red candles for i = 0 to length - 1 by 1 if open[i] < close[i] count_green := count_green + 1 count_green if open[i] > close[i] count_red := count_red + 1 count_red // Calcule percentages of green and rend candles within the lookback window green_perc = count_green / length * 100 red_perc = count_red / length * 100 // Define extreme sentiment conditions extreme_bullish = ta.crossover(green_perc, 61.8) extreme_bearish = ta.crossover(red_perc, 61.8) // Plot the neutral sentiment level and the extreme sentiment one neutral_line = hline(50, linestyle=hline.style_solid, linewidth=2, color=color.blue) extreme_line = hline(extreme_sentiment, linestyle=hline.style_solid, linewidth=2, color=color.red) // Plot bullish and bearish sentiment vaules plot(green_perc, title='% Bullish', color=color.new(color.green, 0), linewidth=5, style=plot.style_circles) plot(red_perc, title='% Bearish', color=color.new(color.red, 0), linewidth=5, style=plot.style_circles) //Plot labels with signal messages plotshape(extreme_bullish and ta.barssince(extreme_bullish[1]) > 20 ? green_perc : na, style=shape.labeldown, text='reversal expected', location=location.absolute, size=size.large, textcolor=color.new(color.white, 0)) plotshape(extreme_bearish and ta.barssince(extreme_bearish[1]) > 20 ? red_perc : na, style=shape.labeldown, text='reversal expected', location=location.absolute, size=size.large, textcolor=color.new(color.white, 0))
Supertrend - Ladder ATR
https://www.tradingview.com/script/8EZaD3CW-Supertrend-Ladder-ATR/
Trendoscope
https://www.tradingview.com/u/Trendoscope/
4,864
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/ // Β© HeWhoMustNotBeNamed // __ __ __ __ __ __ __ __ __ __ __ _______ __ __ __ // / | / | / | _ / |/ | / \ / | / | / \ / | / | / \ / \ / | / | // $$ | $$ | ______ $$ | / \ $$ |$$ |____ ______ $$ \ /$$ | __ __ _______ _$$ |_ $$ \ $$ | ______ _$$ |_ $$$$$$$ | ______ $$ \ $$ | ______ _____ ____ ______ ____$$ | // $$ |__$$ | / \ $$ |/$ \$$ |$$ \ / \ $$$ \ /$$$ |/ | / | / |/ $$ | $$$ \$$ | / \ / $$ | $$ |__$$ | / \ $$$ \$$ | / \ / \/ \ / \ / $$ | // $$ $$ |/$$$$$$ |$$ /$$$ $$ |$$$$$$$ |/$$$$$$ |$$$$ /$$$$ |$$ | $$ |/$$$$$$$/ $$$$$$/ $$$$ $$ |/$$$$$$ |$$$$$$/ $$ $$< /$$$$$$ |$$$$ $$ | $$$$$$ |$$$$$$ $$$$ |/$$$$$$ |/$$$$$$$ | // $$$$$$$$ |$$ $$ |$$ $$/$$ $$ |$$ | $$ |$$ | $$ |$$ $$ $$/$$ |$$ | $$ |$$ \ $$ | __ $$ $$ $$ |$$ | $$ | $$ | __ $$$$$$$ |$$ $$ |$$ $$ $$ | / $$ |$$ | $$ | $$ |$$ $$ |$$ | $$ | // $$ | $$ |$$$$$$$$/ $$$$/ $$$$ |$$ | $$ |$$ \__$$ |$$ |$$$/ $$ |$$ \__$$ | $$$$$$ | $$ |/ |$$ |$$$$ |$$ \__$$ | $$ |/ |$$ |__$$ |$$$$$$$$/ $$ |$$$$ |/$$$$$$$ |$$ | $$ | $$ |$$$$$$$$/ $$ \__$$ | // $$ | $$ |$$ |$$$/ $$$ |$$ | $$ |$$ $$/ $$ | $/ $$ |$$ $$/ / $$/ $$ $$/ $$ | $$$ |$$ $$/ $$ $$/ $$ $$/ $$ |$$ | $$$ |$$ $$ |$$ | $$ | $$ |$$ |$$ $$ | // $$/ $$/ $$$$$$$/ $$/ $$/ $$/ $$/ $$$$$$/ $$/ $$/ $$$$$$/ $$$$$$$/ $$$$/ $$/ $$/ $$$$$$/ $$$$/ $$$$$$$/ $$$$$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$/ $$$$$$$/ $$$$$$$/ // // // //@version=5 indicator("Supertrend - Ladder ATR", overlay=true) import HeWhoMustNotBeNamed/arrayutils/10 as pa matype = input.string("sma", title="Moving Average  ", group="Supertrend", options=["sma", "ema", "rma", "wma", "hma"], inline="ma") malength = input.int(20, title="", group="Supertrend", inline="ma") multiplier = input.int(4, "ATR Multiplier", step=1, group="Supertrend") waitForClose = input.bool(false, "Wait For Close", group="Supertrend") delayed = input.bool(false, "Delayed/Sticky", group="Supertrend") supertrend_atr(float positiveAtr, float negativeAtr, simple float multiplier, simple bool waitForClose = false, simple bool delayed = false) => var dir = 1 lowSource = low highSource = high source = close buyStopDiff = negativeAtr*multiplier sellStopDiff = positiveAtr*multiplier buyStopDiff := (dir == 1? math.min(buyStopDiff, nz(buyStopDiff[1], buyStopDiff)) : buyStopDiff) sellStopDiff := (dir == -1? math.min(sellStopDiff, nz(sellStopDiff[1], sellStopDiff)) : sellStopDiff) var buyStop = lowSource - buyStopDiff var sellStop = highSource + sellStopDiff buyStopCurrent = lowSource - buyStopDiff sellStopCurrent = highSource + sellStopDiff buyStopInverse = lowSource - buyStopDiff/2 sellStopInverse = highSource + sellStopDiff/2 highConfirmation = waitForClose ? source : highSource lowConfirmation = waitForClose? source : lowSource dir := dir == 1 and lowConfirmation[1] < buyStop[1]? -1 : dir == -1 and highConfirmation[1] > sellStop[1]? 1 : dir targetReached = (dir == 1 and nz(highConfirmation[1]) >= nz(sellStop[1])) or (dir == -1 and nz(lowConfirmation[1]) <= nz(buyStop[1])) or not delayed buyStop := dir == 1? (targetReached? math.max(nz(buyStop, buyStopCurrent), buyStopCurrent): buyStop): targetReached ? buyStopCurrent : math.max(nz(buyStop, buyStopInverse), buyStopInverse) sellStop := dir == -1? (targetReached? math.min(nz(sellStop, sellStopCurrent), sellStopCurrent): sellStop): targetReached? sellStopCurrent : math.min(nz(sellStop, sellStopInverse), sellStopInverse) [dir, dir > 0? buyStop : sellStop] var positiveTrArray = array.new_float() var negativeTrArray = array.new_float() if(open < close) pa.push(positiveTrArray, ta.tr, malength) else pa.push(negativeTrArray, ta.tr, malength) positiveAtr = pa.ma(positiveTrArray, matype, malength) negativeAtr = pa.ma(negativeTrArray, matype, malength) [dir, supertrend] = supertrend_atr(positiveAtr, negativeAtr, multiplier, waitForClose, delayed) plot(supertrend, color=dir>0? color.green : color.red, title="Supertrend Stop")
VixFix RVol + EMA
https://www.tradingview.com/script/WEfSBwpl-VixFix-RVol-EMA/
MooseLondon
https://www.tradingview.com/u/MooseLondon/
54
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/ // Β© MooseLondon //@version=5 indicator("VixFix RVol + EMA") lookBackBars = input(60, title="VixFix lookback period") emaLength = input(900, title="EMA length") RVol = ((ta.highest(close, lookBackBars)-low)/(ta.highest(close, lookBackBars)))*100 RVolEMA = ta.ema(RVol, emaLength) plot(RVol) plot(RVolEMA, color=color.red)
Time-of-Day Deviation
https://www.tradingview.com/script/gt0LOtWE-Time-of-Day-Deviation/
Electrified
https://www.tradingview.com/u/Electrified/
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/ // Β© Electrified // @version=5 // @description Creates a 'Time-of-Day' Deviation cone starting from the first bar of the session based upon data from previous days. indicator("Time-of-Day Deviation", "TOD Dev", overlay=true) import Electrified/SessionInfo/10 as Session import Electrified/DailyLevels/9 as Daily import Electrified/DataCleaner/3 as Data import Electrified/Time/3 maxBars = input.int(2000, "Bars to Measure Deviation", minval=2, maxval=5000) maxDeviation = input.float(3, 'Maximum Deviation', group='Data Cleaning', minval=0, tooltip='The maximum deviation before considered an outlier.\nA value of 0 will cause the results to not be filtered.') colorHi = color.yellow // warm colorLo = color.blue // cold colorHiClear = color.new(colorHi, 100) colorLoClear = color.new(colorLo, 100) float hi1 = na float lo1 = na float hi2 = na float lo2 = na float hi3 = na float lo3 = na if timeframe.isintraday var bar = -1 bar += 1 O = Daily.O() OH = high - O OL = O - low max_bars_back(OH, 5000) max_bars_back(OL, 5000) max_bars_back(time, 5000) hiValues = array.new_float() loValues = array.new_float() tod = Time.timeOfDay() if bar > 0 first = math.min(bar, maxBars) for i = 1 to first todi = Time.timeOfDay(time[i]) if todi == tod array.push(hiValues, OH[i]) array.push(loValues, OL[i]) hiValClean = maxDeviation == 0 ? hiValues : Data.cleanArray(hiValues, maxDeviation) loValClean = maxDeviation == 0 ? loValues : Data.cleanArray(loValues, maxDeviation) hiAvg = array.avg(hiValClean) loAvg = array.avg(loValClean) hiStd = array.stdev(hiValClean) loStd = array.stdev(loValClean) hi1 := O + hiAvg + hiStd lo1 := O - loAvg - loStd hi2 := hi1 + hiStd lo2 := lo1 - loStd hi3 := hi2 + hiStd lo3 := lo2 - loStd hi1_p = plot(hi1, "H1", colorHiClear) lo1_p = plot(lo1, "L1", colorLoClear) hi2_p = plot(hi2, "H2", colorHiClear) lo2_p = plot(lo2, "L2", colorLoClear) hi3_p = plot(hi3, "H3", colorHiClear) lo3_p = plot(lo3, "L3", colorLoClear) fill(hi1_p, hi2_p, color.new(colorHi, 90)) fill(hi2_p, hi3_p, color.new(colorHi, 75)) fill(lo1_p, lo2_p, color.new(colorLo, 90)) fill(lo2_p, lo3_p, color.new(colorLo, 75))
Pulu's Moving Averages
https://www.tradingview.com/script/HXA1XzUU-Pulu-s-Moving-Averages/
Pulu_
https://www.tradingview.com/u/Pulu_/
180
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/ // Β© Pulu_ //@version=5 // Pulu's Moving Averages // Release version 1.68, date 2021-12-05 indicator(title='Pulu\'s Moving Averages', shorttitle='PMA', overlay=true) strRoundValue(num) => strv = '' if num >= 100000 strv := str.tostring(num/1000, '#K') else if (num < 100000) and (num >= 100) strv := str.tostring(num, '#') else if (num < 100) and (num >= 1) strv := str.tostring(num, '#.##') else if (num < 1) and (num >= 0.01) strv := str.tostring(num, '#.####') else if (num < 0.01) and (num >= 0.0001) strv := str.tostring(num, '#.######') else if (num < 0.0001) and (num >= 0.000001) strv := str.tostring(num, '#.########') (strv) defaultFunction(func, src, len, alma_offst, alma_sigma) => has_len = false ma = ta.swma(close) if func == 'ALMA' ma := ta.alma(src, len, alma_offst, alma_sigma) has_len := true has_len else if func == 'EMA' ma := ta.ema(src, len) has_len := true has_len else if func == 'RMA' ma := ta.rma(src, len) has_len := true has_len else if func == 'SMA' ma := ta.sma(src, len) has_len := true has_len else if func == 'SWMA' ma := ta.swma(src) has_len := false has_len else if func == 'VWAP' ma := ta.vwap(src) has_len := false has_len else if func == 'VWMA' ma := ta.vwma(src, len) has_len := true has_len else if func == 'WMA' ma := ta.wma(src, len) has_len := true has_len [ma, has_len] def_fn = input.string(title='Default moving average', defval='EMA', options=['ALMA', 'EMA', 'RMA', 'SMA', 'SWMA', 'VWAP', 'VWMA', 'WMA']) ma1_on = input.bool(inline='MA1', title='Enable moving average 1', defval=true) ma2_on = input.bool(inline='MA2', title='Enable moving average 2', defval=true) ma3_on = input.bool(inline='MA3', title='Enable moving average 3', defval=true) ma4_on = input.bool(inline='MA4', title='Enable moving average 4', defval=true) ma5_on = input.bool(inline='MA5', title='Enable moving average 5', defval=true) ma6_on = input.bool(inline='MA6', title='Enable moving average 6', defval=true) ma7_on = input.bool(inline='MA7', title='Enable moving average 7', defval=true) ma1_fn = input.string(inline='MA1', title='', defval='default', options=['default', 'ALMA', 'EMA', 'RMA', 'SMA', 'SWMA', 'VWAP', 'VWMA', 'WMA']) ma2_fn = input.string(inline='MA2', title='', defval='default', options=['default', 'ALMA', 'EMA', 'RMA', 'SMA', 'SWMA', 'VWAP', 'VWMA', 'WMA']) ma3_fn = input.string(inline='MA3', title='', defval='default', options=['default', 'ALMA', 'EMA', 'RMA', 'SMA', 'SWMA', 'VWAP', 'VWMA', 'WMA']) ma4_fn = input.string(inline='MA4', title='', defval='default', options=['default', 'ALMA', 'EMA', 'RMA', 'SMA', 'SWMA', 'VWAP', 'VWMA', 'WMA']) ma5_fn = input.string(inline='MA5', title='', defval='default', options=['default', 'ALMA', 'EMA', 'RMA', 'SMA', 'SWMA', 'VWAP', 'VWMA', 'WMA']) ma6_fn = input.string(inline='MA6', title='', defval='default', options=['default', 'ALMA', 'EMA', 'RMA', 'SMA', 'SWMA', 'VWAP', 'VWMA', 'WMA']) ma7_fn = input.string(inline='MA7', title='', defval='default', options=['default', 'ALMA', 'EMA', 'RMA', 'SMA', 'SWMA', 'VWAP', 'VWMA', 'WMA']) ma1_len = input.int(inline='MA1', title='', defval=12, minval=1) ma2_len = input.int(inline='MA2', title='', defval=144, minval=1) ma3_len = input.int(inline='MA3', title='', defval=169, minval=1) ma4_len = input.int(inline='MA4', title='', defval=288, minval=1) ma5_len = input.int(inline='MA5', title='', defval=338, minval=1) ma6_len = input.int(inline='MA6', title='', defval=576, minval=1) ma7_len = input.int(inline='MA7', title='', defval=676, minval=1) ma1_clr = input.color(inline='MA1', title='', defval=color.fuchsia) ma2_clr = input.color(inline='MA2', title='', defval=color.aqua) ma3_clr = input.color(inline='MA3', title='', defval=color.yellow) ma4_clr = input.color(inline='MA4', title='', defval=color.blue) ma5_clr = input.color(inline='MA5', title='', defval=color.orange) ma6_clr = input.color(inline='MA6', title='', defval=color.green) ma7_clr = input.color(inline='MA7', title='', defval=color.red) ma1_len_indx = ma1_len - 1 ma2_len_indx = ma2_len - 1 ma3_len_indx = ma3_len - 1 ma4_len_indx = ma4_len - 1 ma5_len_indx = ma5_len - 1 ma6_len_indx = ma6_len - 1 ma7_len_indx = ma7_len - 1 // Moving average 1 other parameters alma1_offst = input.float(group='MA1 other settings', inline='MA11', title='ALMA offset', defval=0.85, minval=-1, maxval=1, step=0.01) alma1_sigma = input.float(group='MA1 other settings', inline='MA11', title=', sigma', defval=6, minval=0, maxval=100, step=0.01) ma1_src = input.source(group='MA1 other settings', inline='MA12', title='Source', defval=close) ma1_plt_offst = input.int(group='MA1 other settings', inline='MA12', title=', plot offset', defval=0, minval=-500, maxval=500) // Moving average 2 other parameters alma2_offst = input.float(group='MA2 other settings', inline='MA21', title='ALMA Offset', defval=0.85, minval=-1, maxval=1, step=0.01) alma2_sigma = input.float(group='MA2 other settings', inline='MA21', title='Sigma', defval=6, minval=0, maxval=100, step=0.01) ma2_src = input.source(group='MA2 other settings', inline='MA22', title='Source', defval=close) ma2_plt_offst = input.int(group='MA2 other settings', inline='MA22', title='Polt offset', defval=0, minval=-500, maxval=500) // Moving average 3 other parameters alma3_offst = input.float(group='MA3 other settings', inline='MA31', title='ALMA Offset', defval=0.85, minval=-1, maxval=1, step=0.01) alma3_sigma = input.float(group='MA3 other settings', inline='MA31', title='Sigma', defval=6, minval=0, maxval=100, step=0.01) ma3_src = input.source(group='MA3 other settings', inline='MA32', title='Source', defval=close) ma3_plt_offst = input.int(group='MA3 other settings', inline='MA32', title='Plot offset', defval=0, minval=-500, maxval=500) // Moving average 4 other parameters alma4_offst = input.float(group='MA4 other settings', inline='MA41', title='ALMA Offset', defval=0.85, minval=-1, maxval=1, step=0.01) alma4_sigma = input.float(group='MA4 other settings', inline='MA41', title='Sigma', defval=6, minval=0, maxval=100, step=0.01) ma4_src = input.source(group='MA4 other settings', inline='MA42', title='Source', defval=close) ma4_plt_offst = input.int(group='MA4 other settings', inline='MA42', title='Plot offset', defval=0, minval=-500, maxval=500) // Moving average 5 other parameters alma5_offst = input.float(group='MA5 other settings', inline='MA51', title='ALMA Offset', defval=0.85, minval=-1, maxval=1, step=0.01) alma5_sigma = input.float(group='MA5 other settings', inline='MA51', title='Sigma', defval=6, minval=0, maxval=100, step=0.01) ma5_src = input.source(group='MA5 other settings', inline='MA52', title='Source', defval=close) ma5_plt_offst = input.int(group='MA5 other settings', inline='MA52', title='Plot offset', defval=0, minval=-500, maxval=500) // Moving average 6 other parameters alma6_offst = input.float(group='MA6 other settings', inline='MA61', title='ALMA Offset', defval=0.85, minval=-1, maxval=1, step=0.01) alma6_sigma = input.float(group='MA6 other settings', inline='MA61', title='Sigma', defval=6, minval=0, maxval=100, step=0.01) ma6_src = input.source(group='MA6 other settings', inline='MA62', title='Source', defval=close) ma6_plt_offst = input.int(group='MA6 other settings', inline='MA62', title='Plot offset', defval=0, minval=-500, maxval=500) // Moving average 7 other parameters alma7_offst = input.float(group='MA7 other settings', inline='MA71', title='ALMA Offset', defval=0.85, minval=-1, maxval=1, step=0.01) alma7_sigma = input.float(group='MA7 other settings', inline='MA71', title='Sigma', defval=6, minval=0, maxval=100, step=0.01) ma7_src = input.source(group='MA7 other settings', inline='MA72', title='Source', defval=close) ma7_plt_offst = input.int(group='MA7 other settings', inline='MA72', title='Plot offset', defval=0, minval=-500, maxval=500) // Background fills between MAs fill_12_on = input.bool(group='Background fills between MAs', inline='FILL1', title='MA1-2', defval=false) fill_23_on = input.bool(group='Background fills between MAs', inline='FILL2', title='MA2-3', defval=true) fill_34_on = input.bool(group='Background fills between MAs', inline='FILL3', title='MA3-4', defval=false) fill_45_on = input.bool(group='Background fills between MAs', inline='FILL4', title='MA4-5', defval=true) fill_56_on = input.bool(group='Background fills between MAs', inline='FILL5', title='MA5-6', defval=false) fill_67_on = input.bool(group='Background fills between MAs', inline='FILL6', title='MA6-7', defval=true) fill_12_trans = input.int(group='Background fills between MAs', inline='FILL1', title=', transparency', defval=70, minval=0, maxval=100) fill_23_trans = input.int(group='Background fills between MAs', inline='FILL2', title=', transparency', defval=70, minval=0, maxval=100) fill_34_trans = input.int(group='Background fills between MAs', inline='FILL3', title=', transparency', defval=70, minval=0, maxval=100) fill_45_trans = input.int(group='Background fills between MAs', inline='FILL4', title=', transparency', defval=70, minval=0, maxval=100) fill_56_trans = input.int(group='Background fills between MAs', inline='FILL5', title=', transparency', defval=70, minval=0, maxval=100) fill_67_trans = input.int(group='Background fills between MAs', inline='FILL6', title=', transparency', defval=70, minval=0, maxval=100) // Labels ma1_tag_on = input.bool(group='Label', inline='LBL1', title='MA1,', defval=false) ma2_tag_on = input.bool(group='Label', inline='LBL1', title='MA2,', defval=false) ma3_tag_on = input.bool(group='Label', inline='LBL1', title='MA3,', defval=false) ma4_tag_on = input.bool(group='Label', inline='LBL1', title='MA4,', defval=false) ma5_tag_on = input.bool(group='Label', inline='LBL1', title='MA5,', defval=false) ma6_tag_on = input.bool(group='Label', inline='LBL1', title='MA6,', defval=false) ma7_tag_on = input.bool(group='Label', inline='LBL1', title='MA7', defval=false) tag_row_1 = input.string(group='Label', title='Row 1 text', defval='Price Bar', options=['Date', 'Peroid', 'Price Bar', 'Price MA', 'Type']) tag_row_2 = input.string(group='Label', title='Row 2 text', defval='Price MA', options=['none', 'Date', 'Peroid', 'Price Bar', 'Price MA', 'Type']) tag_row_3 = input.string(group='Label', title='Row 3 text', defval='Date', options=['none', 'Date', 'Peroid', 'Price Bar', 'Price MA', 'Type']) tag_row_4 = input.string(group='Label', title='Row 4 text', defval='Peroid', options=['none', 'Date', 'Peroid', 'Price Bar', 'Price MA', 'Type']) tag_row_5 = input.string(group='Label', title='Row 5 text', defval='Type', options=['none', 'Date', 'Peroid', 'Price Bar', 'Price MA', 'Type']) // Price lines ma1_price_line_on = input.bool(group='Price lines', inline='PRCL1', title='MA1,', defval=false) ma2_price_line_on = input.bool(group='Price lines', inline='PRCL1', title='MA2,', defval=false) ma3_price_line_on = input.bool(group='Price lines', inline='PRCL1', title='MA3,', defval=false) ma4_price_line_on = input.bool(group='Price lines', inline='PRCL1', title='MA4,', defval=false) ma5_price_line_on = input.bool(group='Price lines', inline='PRCL1', title='MA5,', defval=false) ma6_price_line_on = input.bool(group='Price lines', inline='PRCL1', title='MA6,', defval=false) ma7_price_line_on = input.bool(group='Price lines', inline='PRCL1', title='MA7', defval=false) // Initial moving averages [ma1, ma1_has_len] = defaultFunction(def_fn, ma1_src, ma1_len, alma1_offst, alma1_sigma) [ma2, ma2_has_len] = defaultFunction(def_fn, ma2_src, ma2_len, alma2_offst, alma2_sigma) [ma3, ma3_has_len] = defaultFunction(def_fn, ma3_src, ma3_len, alma3_offst, alma3_sigma) [ma4, ma4_has_len] = defaultFunction(def_fn, ma4_src, ma4_len, alma4_offst, alma4_sigma) [ma5, ma5_has_len] = defaultFunction(def_fn, ma5_src, ma5_len, alma5_offst, alma5_sigma) [ma6, ma6_has_len] = defaultFunction(def_fn, ma6_src, ma6_len, alma6_offst, alma6_sigma) [ma7, ma7_has_len] = defaultFunction(def_fn, ma7_src, ma7_len, alma7_offst, alma7_sigma) if ma1_fn != 'default' // if MA1 does not use default function if ma1_fn == 'ALMA' ma1 := ta.alma(ma1_src, ma1_len, alma1_offst, alma1_sigma) ma1_has_len := true else if ma1_fn == 'EMA' ma1 := ta.ema(ma1_src, ma1_len) ma1_has_len := true else if ma1_fn == 'RMA' ma1 := ta.rma(ma1_src, ma1_len) ma1_has_len := true else if ma1_fn == 'SMA' ma1 := ta.sma(ma1_src, ma1_len) ma1_has_len := true else if ma1_fn == 'SWMA' ma1 := ta.swma(ma1_src) ma1_has_len := false else if ma1_fn == 'VWAP' ma1 := ta.vwap(ma1_src) ma1_has_len := false else if ma1_fn == 'VWMA' ma1 := ta.vwma(ma1_src, ma1_len) ma1_has_len := true else if ma1_fn == 'WMA' ma1 := ta.wma(ma1_src, ma1_len) ma1_has_len := true if ma2_fn != 'default' // if MA2 does not use default function if ma2_fn == 'ALMA' ma2 := ta.alma(ma2_src, ma2_len, alma2_offst, alma2_sigma) ma2_has_len := true else if ma2_fn == 'EMA' ma2 := ta.ema(ma2_src, ma2_len) ma2_has_len := true else if ma2_fn == 'RMA' ma2 := ta.rma(ma2_src, ma2_len) ma2_has_len := true else if ma2_fn == 'SMA' ma2 := ta.sma(ma2_src, ma2_len) ma2_has_len := true else if ma2_fn == 'SWMA' ma2 := ta.swma(ma2_src) ma2_has_len := false else if ma2_fn == 'VWAP' ma2 := ta.vwap(ma2_src) ma2_has_len := false else if ma2_fn == 'VWMA' ma2 := ta.vwma(ma2_src, ma1_len) ma2_has_len := true else if ma2_fn == 'WMA' ma2 := ta.wma(ma2_src, ma2_len) ma2_has_len := true if ma3_fn != 'default' // if MA3 does not use default function if ma3_fn == 'ALMA' ma3 := ta.alma(ma3_src, ma3_len, alma3_offst, alma3_sigma) ma3_has_len := true else if ma3_fn == 'EMA' ma3 := ta.ema(ma3_src, ma3_len) ma3_has_len := true else if ma3_fn == 'RMA' ma3 := ta.rma(ma3_src, ma3_len) ma3_has_len := true else if ma3_fn == 'SMA' ma3 := ta.sma(ma3_src, ma3_len) ma3_has_len := true else if ma3_fn == 'SWMA' ma3 := ta.swma(ma3_src) ma3_has_len := false else if ma3_fn == 'VWAP' ma3 := ta.vwap(ma3_src) ma3_has_len := false else if ma3_fn == 'VWMA' ma3 := ta.vwma(ma3_src, ma3_len) ma3_has_len := true else if ma3_fn == 'WMA' ma3 := ta.wma(ma3_src, ma3_len) ma3_has_len := true if ma4_fn != 'default' // if MA4 does not use default function if ma4_fn == 'ALMA' ma4 := ta.alma(ma4_src, ma4_len, alma4_offst, alma4_sigma) ma4_has_len := true else if ma4_fn == 'EMA' ma4 := ta.ema(ma4_src, ma4_len) ma4_has_len := true else if ma4_fn == 'RMA' ma4 := ta.rma(ma4_src, ma4_len) ma4_has_len := true else if ma4_fn == 'SMA' ma4 := ta.sma(ma4_src, ma4_len) ma4_has_len := true else if ma4_fn == 'SWMA' ma4 := ta.swma(ma4_src) ma4_has_len := false else if ma4_fn == 'VWAP' ma4 := ta.vwap(ma4_src) ma4_has_len := false else if ma4_fn == 'VWMA' ma4 := ta.vwma(ma4_src, ma4_len) ma4_has_len := true else if ma4_fn == 'WMA' ma4 := ta.wma(ma4_src, ma4_len) ma4_has_len := true if ma5_fn != 'default' // if MA5 does not use default function if ma5_fn == 'ALMA' ma5 := ta.alma(ma5_src, ma5_len, alma5_offst, alma5_sigma) ma5_has_len := true else if ma5_fn == 'EMA' ma5 := ta.ema(ma5_src, ma5_len) ma5_has_len := true else if ma5_fn == 'RMA' ma5 := ta.rma(ma5_src, ma5_len) ma5_has_len := true else if ma5_fn == 'SMA' ma5 := ta.sma(ma5_src, ma5_len) ma5_has_len := true else if ma5_fn == 'SWMA' ma5 := ta.swma(ma5_src) ma5_has_len := false else if ma5_fn == 'VWAP' ma5 := ta.vwap(ma5_src) ma5_has_len := false else if ma5_fn == 'VWMA' ma5 := ta.vwma(ma5_src, ma5_len) ma5_has_len := true else if ma5_fn == 'WMA' ma5 := ta.wma(ma5_src, ma5_len) ma5_has_len := true if ma6_fn != 'default' // if MA6 does not use default function if ma6_fn == 'ALMA' ma6 := ta.alma(ma6_src, ma6_len, alma6_offst, alma6_sigma) ma6_has_len := true else if ma6_fn == 'EMA' ma6 := ta.ema(ma6_src, ma6_len) ma6_has_len := true else if ma6_fn == 'RMA' ma6 := ta.rma(ma6_src, ma6_len) ma6_has_len := true else if ma6_fn == 'SMA' ma6 := ta.sma(ma6_src, ma6_len) ma6_has_len := true else if ma6_fn == 'SWMA' ma6 := ta.swma(ma6_src) ma6_has_len := false else if ma6_fn == 'VWAP' ma6 := ta.vwap(ma6_src) ma6_has_len := false else if ma6_fn == 'VWMA' ma6 := ta.vwma(ma6_src, ma6_len) ma6_has_len := true else if ma6_fn == 'WMA' ma6 := ta.wma(ma6_src, ma6_len) ma6_has_len := true if ma7_fn != 'default' // if MA7 does not use default function if ma7_fn == 'ALMA' ma7 := ta.alma(ma6_src, ma7_len, alma7_offst, alma7_sigma) ma7_has_len := true else if ma7_fn == 'EMA' ma7 := ta.ema(ma7_src, ma7_len) ma7_has_len := true else if ma7_fn == 'RMA' ma7 := ta.rma(ma7_src, ma7_len) ma7_has_len := true else if ma7_fn == 'SMA' ma7 := ta.sma(ma7_src, ma7_len) ma7_has_len := true else if ma7_fn == 'SWMA' ma7 := ta.swma(ma7_src) ma7_has_len := false else if ma7_fn == 'VWAP' ma7 := ta.vwap(ma7_src) ma7_has_len := false else if ma7_fn == 'VWMA' ma7 := ta.vwma(ma7_src, ma7_len) ma7_has_len := true else if ma7_fn == 'WMA' ma7 := ta.wma(ma7_src, ma7_len) ma7_has_len := true // Plot MA curves p1 = plot(series=ma1_on ? ma1 : na, color=ma1_clr, trackprice=false, offset=ma1_plt_offst) p2 = plot(series=ma2_on ? ma2 : na, color=ma2_clr, trackprice=false, offset=ma2_plt_offst) p3 = plot(series=ma3_on ? ma3 : na, color=ma3_clr, trackprice=false, offset=ma3_plt_offst) p4 = plot(series=ma4_on ? ma4 : na, color=ma4_clr, trackprice=false, offset=ma4_plt_offst) p5 = plot(series=ma5_on ? ma5 : na, color=ma5_clr, trackprice=false, offset=ma5_plt_offst) p6 = plot(series=ma6_on ? ma6 : na, color=ma6_clr, trackprice=false, offset=ma6_plt_offst) p7 = plot(series=ma7_on ? ma7 : na, color=ma7_clr, trackprice=false, offset=ma7_plt_offst) // Background fills between MAs fill(p1, p2, color.new((ma1 > ma2 ? ma1_clr : ma2_clr), (ma1_on and ma2_on and fill_12_on ? fill_12_trans : 100))) fill(p2, p3, color.new((ma2 > ma3 ? ma2_clr : ma3_clr), (ma2_on and ma3_on and fill_23_on ? fill_23_trans : 100))) fill(p3, p4, color.new((ma3 > ma4 ? ma3_clr : ma4_clr), (ma3_on and ma4_on and fill_34_on ? fill_34_trans : 100))) fill(p4, p5, color.new((ma4 > ma5 ? ma4_clr : ma5_clr), (ma4_on and ma5_on and fill_45_on ? fill_45_trans : 100))) fill(p5, p6, color.new((ma5 > ma6 ? ma5_clr : ma6_clr), (ma5_on and ma6_on and fill_56_on ? fill_56_trans : 100))) fill(p6, p7, color.new((ma6 > ma7 ? ma6_clr : ma7_clr), (ma6_on and ma7_on and fill_67_on ? fill_67_trans : 100))) // MAs last price lines if ma1_on and ma1_price_line_on ma1_price = line.new(x1=bar_index + 4, y1=ma1, x2=bar_index + 5, y2=ma1, xloc=xloc.bar_index, extend=extend.right, color=ma1_clr, style=line.style_dotted, width=1) line.delete(ma1_price[1]) if ma2_on and ma2_price_line_on ma2_price = line.new(x1=bar_index + 4, y1=ma2, x2=bar_index + 5, y2=ma2, xloc=xloc.bar_index, extend=extend.right, color=ma2_clr, style=line.style_dotted, width=1) line.delete(ma2_price[1]) if ma3_on and ma3_price_line_on ma3_price = line.new(x1=bar_index + 4, y1=ma3, x2=bar_index + 5, y2=ma3, xloc=xloc.bar_index, extend=extend.right, color=ma3_clr, style=line.style_dotted, width=1) line.delete(ma3_price[1]) if ma4_on and ma4_price_line_on ma4_price = line.new(x1=bar_index + 4, y1=ma4, x2=bar_index + 5, y2=ma4, xloc=xloc.bar_index, extend=extend.right, color=ma4_clr, style=line.style_dotted, width=1) line.delete(ma4_price[1]) if ma5_on and ma5_price_line_on ma5_price = line.new(x1=bar_index + 4, y1=ma5, x2=bar_index + 5, y2=ma5, xloc=xloc.bar_index, extend=extend.right, color=ma5_clr, style=line.style_dotted, width=1) line.delete(ma5_price[1]) if ma6_on and ma6_price_line_on ma6_price = line.new(x1=bar_index + 4, y1=ma6, x2=bar_index + 5, y2=ma6, xloc=xloc.bar_index, extend=extend.right, color=ma6_clr, style=line.style_dotted, width=1) line.delete(ma6_price[1]) if ma7_on and ma7_price_line_on ma7_price = line.new(x1=bar_index + 4, y1=ma7, x2=bar_index + 5, y2=ma7, xloc=xloc.bar_index, extend=extend.right, color=ma7_clr, style=line.style_dotted, width=1) line.delete(ma7_price[1]) // Lables rowText(name, head, fn, len, indx, src, ma) => row_text = '' if name == 'Date' if head row_text += str.tostring(month(time[indx]))+'-'+str.tostring(dayofmonth(time[indx])) else row_text += '\n' + str.tostring(month(time[indx]))+'-'+str.tostring(dayofmonth(time[indx])) else if name == 'Peroid' if head row_text += str.tostring(len) else row_text += '\n' + str.tostring(len) else if name == 'Type' if head row_text += (fn == 'default' ? def_fn : fn) else row_text += '\n' + (fn == 'default' ? def_fn : fn) else if name == 'Price Bar' if head row_text += strRoundValue(src[indx]) else row_text += '\n' + strRoundValue(src[indx]) else if name == 'Price MA' if head row_text += strRoundValue(ma[indx]) else row_text += '\n' + strRoundValue(ma[indx]) (row_text) // Compose text for MA1 label _row1 = rowText(tag_row_1, true, ma1_fn, ma1_len, ma1_len_indx, ma1_src, ma1) _row2 = rowText(tag_row_2, false, ma1_fn, ma1_len, ma1_len_indx, ma1_src, ma1) _row3 = rowText(tag_row_3, false, ma1_fn, ma1_len, ma1_len_indx, ma1_src, ma1) _row4 = rowText(tag_row_4, false, ma1_fn, ma1_len, ma1_len_indx, ma1_src, ma1) _row5 = rowText(tag_row_5, false, ma1_fn, ma1_len, ma1_len_indx, ma1_src, ma1) ma1_tag_txt = _row1 + _row2 + _row3 + _row4 + _row5 // Compose text for MA2 label _row1 := rowText(tag_row_1, true, ma2_fn, ma2_len, ma2_len_indx, ma2_src, ma2) _row2 := rowText(tag_row_2, false, ma2_fn, ma2_len, ma2_len_indx, ma2_src, ma2) _row3 := rowText(tag_row_3, false, ma2_fn, ma2_len, ma2_len_indx, ma2_src, ma2) _row4 := rowText(tag_row_4, false, ma2_fn, ma2_len, ma2_len_indx, ma2_src, ma2) _row5 := rowText(tag_row_5, false, ma2_fn, ma2_len, ma2_len_indx, ma2_src, ma2) ma2_tag_txt = _row1 + _row2 + _row3 + _row4 + _row5 // Compose text for MA3 label _row1 := rowText(tag_row_1, true, ma3_fn, ma3_len, ma3_len_indx, ma3_src, ma3) _row2 := rowText(tag_row_2, false, ma3_fn, ma3_len, ma3_len_indx, ma3_src, ma3) _row3 := rowText(tag_row_3, false, ma3_fn, ma3_len, ma3_len_indx, ma3_src, ma3) _row4 := rowText(tag_row_4, false, ma3_fn, ma3_len, ma3_len_indx, ma3_src, ma3) _row5 := rowText(tag_row_5, false, ma3_fn, ma3_len, ma3_len_indx, ma3_src, ma3) ma3_tag_txt = _row1 + _row2 + _row3 + _row4 + _row5 // Compose text for MA4 label _row1 := rowText(tag_row_1, true, ma4_fn, ma4_len, ma4_len_indx, ma4_src, ma4) _row2 := rowText(tag_row_2, false, ma4_fn, ma4_len, ma4_len_indx, ma4_src, ma4) _row3 := rowText(tag_row_3, false, ma4_fn, ma4_len, ma4_len_indx, ma4_src, ma4) _row4 := rowText(tag_row_4, false, ma4_fn, ma4_len, ma4_len_indx, ma4_src, ma4) _row5 := rowText(tag_row_5, false, ma4_fn, ma4_len, ma4_len_indx, ma4_src, ma4) ma4_tag_txt = _row1 + _row2 + _row3 + _row4 + _row5 // Compose text for MA5 label _row1 := rowText(tag_row_1, true, ma5_fn, ma5_len, ma5_len_indx, ma5_src, ma5) _row2 := rowText(tag_row_2, false, ma5_fn, ma5_len, ma5_len_indx, ma5_src, ma5) _row3 := rowText(tag_row_3, false, ma5_fn, ma5_len, ma5_len_indx, ma5_src, ma5) _row4 := rowText(tag_row_4, false, ma5_fn, ma5_len, ma5_len_indx, ma5_src, ma5) _row5 := rowText(tag_row_5, false, ma5_fn, ma5_len, ma5_len_indx, ma5_src, ma5) ma5_tag_txt = _row1 + _row2 + _row3 + _row4 + _row5 // Compose text for MA6 label _row1 := rowText(tag_row_1, true, ma6_fn, ma6_len, ma6_len_indx, ma6_src, ma6) _row2 := rowText(tag_row_2, false, ma6_fn, ma6_len, ma6_len_indx, ma6_src, ma6) _row3 := rowText(tag_row_3, false, ma6_fn, ma6_len, ma6_len_indx, ma6_src, ma6) _row4 := rowText(tag_row_4, false, ma6_fn, ma6_len, ma6_len_indx, ma6_src, ma6) _row5 := rowText(tag_row_5, false, ma6_fn, ma6_len, ma6_len_indx, ma6_src, ma6) ma6_tag_txt = _row1 + _row2 + _row3 + _row4 + _row5 // Compose text for MA7 label _row1 := rowText(tag_row_1, true, ma7_fn, ma7_len, ma7_len_indx, ma7_src, ma7) _row2 := rowText(tag_row_2, false, ma7_fn, ma7_len, ma7_len_indx, ma7_src, ma7) _row3 := rowText(tag_row_3, false, ma7_fn, ma7_len, ma7_len_indx, ma7_src, ma7) _row4 := rowText(tag_row_4, false, ma7_fn, ma7_len, ma7_len_indx, ma7_src, ma7) _row5 := rowText(tag_row_5, false, ma7_fn, ma7_len, ma7_len_indx, ma7_src, ma7) ma7_tag_txt = _row1 + _row2 + _row3 + _row4 + _row5 // Iniatial global labels var label ma1_tag = label.new(bar_index, na) var label ma2_tag = label.new(bar_index, na) var label ma3_tag = label.new(bar_index, na) var label ma4_tag = label.new(bar_index, na) var label ma5_tag = label.new(bar_index, na) var label ma6_tag = label.new(bar_index, na) var label ma7_tag = label.new(bar_index, na) label.delete(ma1_tag) label.delete(ma2_tag) label.delete(ma3_tag) label.delete(ma4_tag) label.delete(ma5_tag) label.delete(ma6_tag) label.delete(ma7_tag) // Tags on the start dates for last MA sets if barstate.islast if ma1_on and ma1_tag_on and ma1_has_len ma1_tag := label.new(bar_index - ma1_len_indx, na, ma1_tag_txt, color=ma1_clr, textcolor=color.white, style=close[ma1_len_indx] > open[ma1_len_indx] ? label.style_label_down : label.style_label_up, yloc=close[ma1_len_indx] > open[ma1_len_indx] ? yloc.abovebar : yloc.belowbar) if ma2_on and ma2_tag_on and ma2_has_len ma2_tag := label.new(bar_index - ma2_len_indx, na, ma2_tag_txt, color=ma2_clr, textcolor=color.white, style=close[ma2_len_indx] > open[ma2_len_indx] ? label.style_label_down : label.style_label_up, yloc=close[ma2_len_indx] > open[ma2_len_indx] ? yloc.abovebar : yloc.belowbar) if ma3_on and ma3_tag_on and ma3_has_len ma3_tag := label.new(bar_index - ma3_len_indx, na, ma3_tag_txt, color=ma3_clr, textcolor=color.white, style=close[ma3_len_indx] > open[ma3_len_indx] ? label.style_label_down : label.style_label_up, yloc=close[ma3_len_indx] > open[ma3_len_indx] ? yloc.abovebar : yloc.belowbar) if ma4_on and ma4_tag_on and ma4_has_len ma4_tag := label.new(bar_index - ma4_len_indx, na, ma4_tag_txt, color=ma4_clr, textcolor=color.white, style=close[ma4_len_indx] > open[ma4_len_indx] ? label.style_label_down : label.style_label_up, yloc=close[ma4_len_indx] > open[ma4_len_indx] ? yloc.abovebar : yloc.belowbar) if ma5_on and ma5_tag_on and ma5_has_len ma5_tag := label.new(bar_index - ma5_len_indx, na, ma5_tag_txt, color=ma5_clr, textcolor=color.white, style=close[ma5_len_indx] > open[ma5_len_indx] ? label.style_label_down : label.style_label_up, yloc=close[ma5_len_indx] > open[ma5_len_indx] ? yloc.abovebar : yloc.belowbar) if ma6_on and ma6_tag_on and ma6_has_len ma6_tag := label.new(bar_index - ma6_len_indx, na, ma6_tag_txt, color=ma6_clr, textcolor=color.white, style=close[ma6_len_indx] > open[ma6_len_indx] ? label.style_label_down : label.style_label_up, yloc=close[ma6_len_indx] > open[ma6_len_indx] ? yloc.abovebar : yloc.belowbar) if ma7_on and ma7_tag_on and ma7_has_len ma7_tag := label.new(bar_index - ma7_len_indx, na, ma7_tag_txt, color=ma7_clr, textcolor=color.white, style=close[ma7_len_indx] > open[ma7_len_indx] ? label.style_label_down : label.style_label_up, yloc=close[ma7_len_indx] > open[ma7_len_indx] ? yloc.abovebar : yloc.belowbar)
Plot Real Open and Close - SamX
https://www.tradingview.com/script/aXdjMsNr-Plot-Real-Open-and-Close-SamX/
SamAccountX
https://www.tradingview.com/u/SamAccountX/
223
study
5
MPL-2.0
// This source code provided free and open-source as defined by the terms of the Mozilla Public License 2.0 (https://mozilla.org/MPL/2.0/) // with the following additional requirements: // // 1. Citations for sources and references must be maintained and updated when appropriate // 2. Links to strategy references included in indicator tooptips and/or alerts should be retained to give credit to the original source // while also providing a freely available source of information on proper use and interpretation // // Author: SamAccountX // // The intent of this indicator is to provide a way to plot actual-price open and close values when using non-standard chart types (e.g. Heiken Ashi or Renko). // The user will have 2 primary methods of displaying this information - either using a bar or hollow candle display method, or printing distinct shapes // on the candle for open and close prices (which can be independently enabled or disabled). // // References: // 1. Forked from my own Smoothed HA Candles indicator: https://www.tradingview.com/script/1qDfPom0-Smoothed-Heiken-Ashi-SamX/ // // @version=5 indicator(title='Plot Real Open and Close - SamX', shorttitle='O & C Overlay', overlay=true) // Inputs // Inputs group 1 - Timeframe Settings g_TimeframeSettings = 'Timeframe Settings' time_frame = input.timeframe(title='Timeframe for Open and Close data points', defval='', group=g_TimeframeSettings, tooltip='Select the timeframe to use for calculating the actual ' + 'price open and close values. The default value is to use the current chart timeframe, but altering this will allow you to have the indicator reflect a higher or lower timeframe. \n\n' + 'Note: Selecting a lower timeframe than the current chart timeframe may not result in more precise values as the display will still be limited to the current timeframe resolution.') // Inputs group 2 - Display Options g_CandleDisplayOpts = 'Candle/Bar Display Options' showAsBarCandle = input.bool(title='Show open/close as a Bar or Candle', defval=true, group=g_CandleDisplayOpts, tooltip='Select (default) to show actual price open and close as a Bar or ' + 'Hollow Candle instead of discrete plot symbols (e.g. dots or diamonds). \n\n' + 'If you wish to see both Open and Close, this is recommended as it makes the on-chart display far more intuitive by more closely matching normal bar/candle charts.') plotStyle = input.string(title='Plot Style', group=g_CandleDisplayOpts, options=['Hollow Candle','Bar'], defval='Bar', tooltip='Choose which type of plot to use for displaying open and close values.') // Inputs group 3 - Additional options for Bar/Candle display option colorBullish = input.color(title='Color for bullish candle (Close > Open)', defval=color.rgb(255, 255, 255, 0), tooltip='Select the color to use to denote a bullish candle (where price closed above the open). \n\n' + 'Note: Any changes to the "Style" tab will override this setting. Actual doji candles (Open == Close) inherit the color of the previous candle.') colorBearish = input.color(title='Color for bearish candle (Close < Open)', defval=color.rgb(255, 0, 255, 0), tooltip='Select the color to use to denote a bearish candle (where price closed below the open). \n\n' + 'Note: Any changes to the "Style" tab will override this setting. Actual doji candles (Open == Close) inherit the color of the previous candle.') // Inputs group 4 - Additional Options for Symbols display option g_SymbolDisplayOpts = 'Symbol Display Options' // For simplicity, we're going to use "ambiguous" symbol shapes like diamonds, circles, squares, etc. so that we don't have to mess around with directional bias with these (like triangle-up vs triangle-down) showOpen = input.bool(title='Show open price symbol', group=g_SymbolDisplayOpts, defval=true, inline='showSymForPriceType') showClose = input.bool(title='Show close price symbol', group=g_SymbolDisplayOpts, defval=true, inline='showSymForPriceType', tooltip='Select to show/hide symbols for open and close, respectively.') symbol = input.string(title='Symbol to use', group=g_SymbolDisplayOpts, defval='Cross', inline='Symbol', options=['X-Cross','Cross','Circle','Square','Diamond']) symbolSize = input.string(title='Symbol size', group=g_SymbolDisplayOpts, inline='Symbol', options=['Auto','Tiny','Small','Normal','Large','Huge'], defval='Auto', tooltip='Select the symbol type and size for displaying ' + 'discrete symbols for open and close. \n\n' + 'Note: Settings here only apply if "Show open/close as a Bar or Candle" is NOT checked! \n\n' + 'Note: Any changes to the "Style" tab will override this setting.') symColorOpen = input.color(title='Symbol open color', inline='symColor', defval=color.rgb(255, 255, 255, 0), group=g_SymbolDisplayOpts) symColorClose = input.color(title='Symbol close color', inline='symColor', defval=color.rgb(255, 0, 255, 0), group=g_SymbolDisplayOpts, tooltip='Select the colors to use for the symbol to denote the open and close values. \n\n' + 'Note: Settings here only apply if "Show open/close as a Bar or Candle" is NOT checked! \n\n' + 'Note: Any changes to the "Style" tab will override this setting.') // Inputs group 5 - Other showLivePrice = input.bool(title='Show line for current real price', group='Other Settings', defval=true, tooltip='If enabled, a horizontal line will be drawn on the chart corresponding to the live close price.') extendLivePriceLeft = input.bool(title='Extend live price line to the left indefinitely', defval=false, tooltip='If enabled, the live-price line will be extended to the left indefinitely ("forever")') // Begin active processing code... // Explicitly define our ticker to help ensure that we're always getting ACTUAL price instead of relying on the input // ticker info and input vars (as they tend to inherit the type from what's displayed on the current chart) realPriceTicker = ticker.new(prefix=syminfo.prefix, ticker=syminfo.ticker) // This MAY be unnecessary, but in testing I've found some oddities when trying to use this on varying chart types // like on the HA chart, where the source referece for the price skews to the values for the current chart type // instead of the expected pure-price values. For example, the 'source=close' reference - 'close' would be actual price // close on a normal candlestick chart, but would be the HA close on the HA chart. actualOpen = request.security(symbol=realPriceTicker, timeframe=time_frame, expression=open, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) actualClose = request.security(symbol=realPriceTicker, timeframe=time_frame, expression=close, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) // These 2 below aren't needed for this indicator, so we're commenting them out simply to reduce execution time. I'm not deleting them altogether just in case // there's some point in the future that I may want to add them back in // actualHigh = request.security(symbol=realPriceTicker, timeframe=time_frame, expression=high, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) // actualLow = request.security(symbol=realPriceTicker, timeframe=time_frame, expression=low, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) // Map our raw price values to the plot variables. Since we're not interested in high and low values in this case, // we'll shortcut the plotcandle function by setting the high = open and low = close. This prevents any potential for // printing wicks while still being able to properly coloring our candles based on open/close price movement direction. openToPlot = actualOpen closeToPlot = actualClose highToPlot = actualOpen lowToPlot = actualClose // Since we will want to color the candle to distinguish between open > close (red) and open < close (green), // we will pre-define our candle color before plotting the actual candle to simplify the 'plotcandle' function's color input. // To help simplify this a bit, we're going to default the candle wick colors to match the candle body's color. Users // should be able to override these defaults in the "Style" configuration tab to their own liking. // // We'll even get fancy and if the current candle is an EXACT doji (open == close), use the previous candle's color // The logical ordering of this conditional goes like this... // First check if the close is greater than the open. If so, return green. // If not, check if the close is less than the open. If so, return red. // If not (which will only occur if the open and close are exactly equal), return the // color used on the previous candle. // // Note: Since we need to take into account the possibility that there is no previous candle, we'll defensively-code // this so that we pre-assign a color (Black and transparent) to our color variable to use as a fail-safe. // // While this is an extreme edge-case, we also want to try and account for the possibility that a pure doji is the // first candle to print. Since it's not easy to check a previous candle's actual color value, we'll work around // this by adding another conditional check to see if the previous candle had a value for 'smoothedHAOpen' // // Like Arty, I prefer colors that really pop, so that's what we're going to use... // // Final note: The 'candleColor' below will only really apply if the "showAsBarCandle" input is true (checked). // Otherwise, this variable will be ignored and we will use the separate color configurations for the shape colors. candleColor = color.rgb(0, 0, 0, 100) candleColor := (closeToPlot > openToPlot) ? colorBullish : (closeToPlot < openToPlot) ? colorBearish : candleColor[1] // Now onto the plotting fun... // // Since TV has an odd quirk where plot functions can't be nested inside conditionals, we need to get a bit creative... // To handle this, we'll actually call ALL of the possible plot methods, and use conditionals INSIDE the function calls // so that we will use 'na' values for all plot functions EXCEPT the ONE that the user has selected via inputs... // // I'm not a fan of this approach, but at the moment I can't think of a better option... // // To help simplify the nesting a bit, we'll pre-define our conditional variables by initializing them as false // and then using 'if-then' statements and mutable assignment operators to flip the correct one to 'true'. This // will then allow us to easily inject an in-line conditional statement into the plot functions in an easily-readable format showBar = false showCandle = false showOpenSymbol = false showCloseSymbol = false if (showAsBarCandle) // User opted to display as a bar/candle, so identify which they selected and plot it if (plotStyle == 'Bar') showBar := true else if (plotStyle == 'Hollow Candle') showCandle := true else // Should be impossible to hit this as-is... Only way is if someone added another option to the input drop-down // but failed to add a corresponding plot in this block... na else // If this block is executed, the user has un-checked the 'Show open/close as a Bar or Candle' setting, // so we need to check BOTH the showOpenSymbol and showCloseSymbol in this block if (showClose) showCloseSymbol := true if (showOpen) showOpenSymbol := true // Now that that mess is out of the way, we will do all of our different plot function calls using our pre-estabilished control variables above... // // A note here is that if you pass 'na' to the arguments, it will result in not printing... Handy trick to remember... plotbar(open=showBar ? openToPlot : na, high=showBar ? highToPlot : na, low=showBar ? lowToPlot : na, close=showBar ? closeToPlot : na, title='Open/Close Bars', color=candleColor, editable=false) plotcandle(open=showCandle ? openToPlot : na, high=showCandle ? highToPlot : na, low=showCandle ? lowToPlot : na, close=showCandle ? closeToPlot : na, title="Open/Close Hollow Candles", color=na, wickcolor=na, bordercolor=candleColor, editable=false) // It is an unfortunate fact in TV that if you set a variable to a constant (enum in programming lingo), you cannot later update the value // to a different constant of the same type. Attempting to do so will instead result in the type changing from 'const string' to 'simple string', // which causes it to no longer properly work in functions where the value is expected to be a 'const string'. // // This means that we're going to have to get creative with pre-setting our control vars and doing several redundant plotshape calls with the only real // difference being the size param... Not a fan of this, but sometimes you just don't have a choice... // // We will do our best to use line continuation and indentation to help keep this readable, although it's going to get really long really fast... // Plots for Open symbol // // Size: Auto plotshape(series=showOpenSymbol and symbolSize == 'Auto' ? openToPlot : na, title="Open Price", location=location.absolute, color=symColorOpen, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.auto) // Size: Tiny plotshape(series=showOpenSymbol and symbolSize == 'Tiny' ? openToPlot : na, title="Open Price", location=location.absolute, color=symColorOpen, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.tiny) // Size: Small plotshape(series=showOpenSymbol and symbolSize == 'Small' ? openToPlot : na, title="Open Price", location=location.absolute, color=symColorOpen, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.small) // Size: Normal plotshape(series=showOpenSymbol and symbolSize == 'Normal' ? openToPlot : na, title="Open Price", location=location.absolute, color=symColorOpen, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.normal) // Size: Large plotshape(series=showOpenSymbol and symbolSize == 'Large' ? openToPlot : na, title="Open Price", location=location.absolute, color=symColorOpen, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.large) // Size: Huge plotshape(series=showOpenSymbol and symbolSize == 'Huge' ? openToPlot : na, title="Open Price", location=location.absolute, color=symColorOpen, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.huge) // Plots for Close symbol // // Size: Auto plotshape(series=showCloseSymbol and symbolSize == 'Auto' ? closeToPlot : na, title="Close Price", location=location.absolute, color=symColorClose, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.auto) // Size: Tiny plotshape(series=showCloseSymbol and symbolSize == 'Tiny' ? closeToPlot : na, title="Close Price", location=location.absolute, color=symColorClose, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.tiny) // Size: Small plotshape(series=showCloseSymbol and symbolSize == 'Small' ? closeToPlot : na, title="Close Price", location=location.absolute, color=symColorClose, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.small) // Size: Normal plotshape(series=showCloseSymbol and symbolSize == 'Normal' ? closeToPlot : na, title="Close Price", location=location.absolute, color=symColorClose, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.normal) // Size: Large plotshape(series=showCloseSymbol and symbolSize == 'Large' ? closeToPlot : na, title="Close Price", location=location.absolute, color=symColorClose, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.large) // Size: Huge plotshape(series=showCloseSymbol and symbolSize == 'Huge' ? closeToPlot : na, title="Close Price", location=location.absolute, color=symColorClose, editable=false, style=(symbol == 'X-Cross') ? shape.xcross : (symbol == 'Cross') ? shape.cross : (symbol == 'Circle') ? shape.circle : (symbol == 'Square') ? shape.square : (symbol == 'Diamond') ? shape.diamond : na, size=size.huge) // Adding one final potential plot for current real price if (showLivePrice) realPriceLine = line.new(bar_index[15], closeToPlot, bar_index, closeToPlot, xloc.bar_index, extendLivePriceLeft ? extend.both : extend.right, candleColor, line.style_dotted) line.delete(realPriceLine[1])
4 Anchored VWAP
https://www.tradingview.com/script/LxV5DNa4-4-Anchored-VWAP/
raviudal
https://www.tradingview.com/u/raviudal/
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/ // Β© raviudal //@version=5 indicator("4 Anchored VWAP", overlay=true) //==============================================================================================AVWAP1 src = input.source(hlc3, "Source") startCalculationDate1 = input.time(timestamp("17 Mar 2020"), "Drag to move date") vwap_calc1() => var srcVolArray = array.new_float(na) var volArray = array.new_float(na) if startCalculationDate1 <= time array.push(srcVolArray, src*volume) array.push(volArray, volume) else array.clear(srcVolArray), array.clear(volArray) array.sum(srcVolArray)/array.sum(volArray) anchoredVwap1 = vwap_calc1() plot(anchoredVwap1, "Green AVWAP line", linewidth=2, color=color.green) //==============================================================================================AVWAP2 startCalculationDate2 = input.time(timestamp("27 Oct 2008"), "Drag to move date" ) vwap_calc2() => var srcVolArray = array.new_float(na) var volArray = array.new_float(na) if startCalculationDate2 <= time array.push(srcVolArray, src*volume) array.push(volArray, volume) else array.clear(srcVolArray), array.clear(volArray) array.sum(srcVolArray)/array.sum(volArray) anchoredVwap2 = vwap_calc2() plot(anchoredVwap2, "Blue AVWAP line", linewidth=2, color=color.blue) //==============================================================================================AVWAP2 startCalculationDate3 = input.time(timestamp("22 Feb 2016"), "Drag to move date" ) vwap_calc3() => var srcVolArray = array.new_float(na) var volArray = array.new_float(na) if startCalculationDate3 <= time array.push(srcVolArray, src*volume) array.push(volArray, volume) else array.clear(srcVolArray), array.clear(volArray) array.sum(srcVolArray)/array.sum(volArray) anchoredVwap3 = vwap_calc3() plot(anchoredVwap3, "Red AVWAP line", linewidth=2, color=color.red) //==============================================================================================AVWAP2 startCalculationDate4 = input.time(timestamp("26 Oct 2020"), "Drag to move date" ) vwap_calc4() => var srcVolArray = array.new_float(na) var volArray = array.new_float(na) if startCalculationDate4 <= time array.push(srcVolArray, src*volume) array.push(volArray, volume) else array.clear(srcVolArray), array.clear(volArray) array.sum(srcVolArray)/array.sum(volArray) anchoredVwap4 = vwap_calc4() plot(anchoredVwap4, "Black AVWAP line", linewidth=2, color=color.black)
Time and Sales
https://www.tradingview.com/script/SofuBwAz-Time-and-Sales/
S_Codes
https://www.tradingview.com/u/S_Codes/
605
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/ // Β© S_Codes //@version=5 indicator("Time and Sales | Tape | Filters | Tick Speed | Visualization", shorttitle="TNS [S-Codes]", overlay = true) a_allLabels = label.all if array.size(a_allLabels) > 0 for i = 0 to array.size(a_allLabels)-1 label.delete(array.get(a_allLabels, i)) a_allLines = line.all if array.size(a_allLines) > 0 for i = 0 to array.size(a_allLines)-1 line.delete(array.get(a_allLines, i)) var t1 = input.string(defval="middle", options=["top", "middle", "bottom"], inline="tp", title="Table Position") var t2 = input.string(defval="right", options=["left", "center", "right"], inline="tp", title="") var r = input.int(defval=10, minval=1, maxval=100, title="Number of past ticks to show", inline="rr") var showTotalRowSpeed = input.bool(defval=true, title="Show speed", inline="rr", tooltip="This will show the speed at which the past selected ticks are appearing") var showSpeedViz = input.bool(defval=true, title="Visualize Speed", inline="r") var t1s = input.string(defval="top", options=["top", "middle", "bottom"], inline="r", title="") var t2s = input.string(defval="right", options=["left", "center", "right"], inline="r", title="") var showTickCount = input.bool(defval=true, title="Show total ticks") var showhv = input.bool(defval=true, title="Show Highest Volume", inline="hv") var showBarMark = input.bool(defval=true, title="highlight on bar with", inline="hv") var barMarkChar = input.string(defval="↑", inline="hv", title="") var barMarkCol = input.color(defval=color.gray, inline="hv", title="") var colAccTabHV = input.bool(defval=true, title="Color this highlight as it appears in the table", tooltip="This ignores the color chosen above") var showHvLineLabel = input.bool(defval=true, title="Show label and line on Highest Vol Price") var showPerTickSpeed = input.bool(defval=true, title="Show per tick speed") var showSpread = input.bool(defval=true, title="Show Spread Column") var tab = table.new(position=t1+"_"+t2, columns=5, rows=500, bgcolor=color.new(#2962ff,95), frame_color=#2962ff, frame_width=1) //, border_color=#0044ff, border_width=1 var tab_ = table.new(position=t1s+"_"+t2s, columns=120, rows=1, bgcolor=color.new(color.white,95), frame_color=#2962ff, frame_width=1) //, border_color=#0044ff, border_width=1 var r1s = input.bool(defval=true, title="Show Filters Seperately", group="Filters", inline="r1") var r1 = input.int(defval=8, minval=1, maxval=100, title="", group="Filters", inline="r1") var f1 = input.bool(defval=true, title="", group="Filters", inline="f1") var gT = input.float(defval=0.0, title="Volume greater than equal to", group="Filters", inline="f1") var f2 = input.bool(defval=false, title="", group="Filters", inline="f2") var lT = input.float(defval=0.0, title="Volume less than equal to", group="Filters", inline="f2") var showBarMarkF = input.bool(defval=true, title="highlight on bar with", inline="hvf") var barMarkCharF = input.string(defval="⇧", inline="hvf", title="") var barMarkColF = input.color(defval=color.gray, inline="hvf", title="") var colAccTabF = input.bool(defval=true, title="Color this highlight as it appears in the table", tooltip="This ignores the color chosen above") var showFilLineLabel = input.bool(defval=true, title="Show label and line on Filtered prices") if barstate.islast table.cell(tab, 1, 1, "LTP" , bgcolor=#2962ff, text_color=color.white) table.cell(tab, 2, 1, "Vol" , bgcolor=#2962ff, text_color=color.white) table.cell(tab, 0, 1, "Time", bgcolor=#2962ff, text_color=color.white) if showSpread table.cell(tab, 3, 1, "Spread" , bgcolor=#2962ff, text_color=color.white) //highest volume varip hv = 0.0 varip hc = 0.0 varip ht = timenow varip hs = 0.0 label hl = na varip tl = timenow line lihv = na label lahv = na //full data varip tnsdata_vol = array.new_float(r+2, 0) varip tnsdata_cls = array.new_float(r+2, 0) varip tnsdata_tmn = array.new_int(r+2, timenow) varip tnsdata_spr = array.new_float(r+2, 0.0) var tnsdata_col = array.new_color(r+2, color.gray) //for seperate varip tnsdata_vol1 = array.new_float(r1, 0) varip tnsdata_cls1 = array.new_float(r1, 0) varip tnsdata_tmn1 = array.new_int(r1, timenow) varip tnsdata_spr1 = array.new_float(r1, 0.0) varip hi = array.new_int(r1, 0) varip hvc = 0 //1 = red //2 = green //0 = gray line filline = na label fillabel = na var spl = array.new_label(r1, na) varip spv = array.new_float(r1, 0) varip spt = array.new_int(r1, timenow) //logic varip tickCount = 0 varip lastvol = volume var v = 0.0 varip lastclose = close var c = 0.0 var sign = "" varip total_time = 0 varip total_time_1 = 0 if lastvol != volume and barstate.isrealtime tickCount := tickCount + 1 v := (volume - lastvol) < 0 ? volume : (volume - lastvol) if v > hv and tickCount > 1 hv := v hc := close ht := timenow tl := time hs := math.abs(lastclose - close) if lastclose > close hvc := 1 else if lastclose < close hvc := 2 else hvc := 0 c := close total_time := array.get(tnsdata_tmn, array.size(tnsdata_tmn)-1) - array.get(tnsdata_tmn, 2) total_time_1 := array.get(tnsdata_tmn, array.size(tnsdata_tmn)-1) - array.get(tnsdata_tmn, array.size(tnsdata_tmn)-2) if tickCount > 1 if r1s if f1 and not f2 if v >= gT sign := sign + ">=" array.push(tnsdata_vol1, v) array.shift(tnsdata_vol1) array.push(tnsdata_cls1, c) array.shift(tnsdata_cls1) array.push(tnsdata_tmn1, timenow) array.shift(tnsdata_tmn1) array.push(spt, time) array.shift(spt) array.push(spv, v) array.shift(spv) array.push(tnsdata_spr1, math.abs(lastclose-close)) array.shift(tnsdata_spr1) if lastclose > close array.push(hi, 1) array.shift(hi) else if lastclose < close array.push(hi, 2) array.shift(hi) else array.push(hi, 0) array.shift(hi) else if f2 and not f1 if v <= lT sign := sign + "<=" array.push(tnsdata_vol1, v) array.shift(tnsdata_vol1) array.push(tnsdata_cls1, c) array.shift(tnsdata_cls1) array.push(tnsdata_tmn1, timenow) array.shift(tnsdata_tmn1) array.push(spt, time) array.shift(spt) array.push(spv, v) array.shift(spv) array.push(tnsdata_spr1, math.abs(lastclose-close)) array.shift(tnsdata_spr1) if lastclose > close array.push(hi, 1) array.shift(hi) else if lastclose < close array.push(hi, 2) array.shift(hi) else array.push(hi, 0) array.shift(hi) else if f1 and f2 if v <= lT and v >= gT sign := sign + "<=" array.push(tnsdata_vol1, v) array.shift(tnsdata_vol1) array.push(tnsdata_cls1, c) array.shift(tnsdata_cls1) array.push(tnsdata_tmn1, timenow) array.shift(tnsdata_tmn1) array.push(spt, time) array.shift(spt) array.push(spv, v) array.shift(spv) array.push(tnsdata_spr1, math.abs(lastclose-close)) array.shift(tnsdata_spr1) if lastclose > close array.push(hi, 1) array.shift(hi) else if lastclose < close array.push(hi, 2) array.shift(hi) else array.push(hi, 0) array.shift(hi) array.push(tnsdata_vol, v) array.shift(tnsdata_vol) array.push(tnsdata_cls, c) array.shift(tnsdata_cls) array.push(tnsdata_tmn, timenow) array.shift(tnsdata_tmn) else if f1 or f2 if f1 and not f2 if v >= gT array.push(tnsdata_vol, v) array.shift(tnsdata_vol) array.push(tnsdata_cls, c) array.shift(tnsdata_cls) array.push(tnsdata_tmn, timenow) array.shift(tnsdata_tmn) if f2 and not f1 if v <= lT array.push(tnsdata_vol, v) array.shift(tnsdata_vol) array.push(tnsdata_cls, c) array.shift(tnsdata_cls) array.push(tnsdata_tmn, timenow) array.shift(tnsdata_tmn) if f1 and f2 if v >= gT and v <= lT array.push(tnsdata_vol, v) array.shift(tnsdata_vol) array.push(tnsdata_cls, c) array.shift(tnsdata_cls) array.push(tnsdata_tmn, timenow) array.shift(tnsdata_tmn) else array.push(tnsdata_vol, v) array.shift(tnsdata_vol) array.push(tnsdata_cls, c) array.shift(tnsdata_cls) array.push(tnsdata_tmn, timenow) array.shift(tnsdata_tmn) lastvol := volume lastclose := close sprd = "Avg\n" sprd := sprd + str.tostring(math.round_to_mintick(array.avg(tnsdata_spr))) //plots if showTickCount table.cell(tab, 2, 0,"total\n" + str.tostring(tickCount) + "\nticks")//str.tostring(total_time) if showTotalRowSpeed table.cell(tab, 0, 0, str.tostring(r)+" ticks per\n" + str.tostring(math.floor(total_time/60000)) + "m " + str.tostring(math.round(total_time/1000)%60) + "s")//str.tostring(total_time) if showPerTickSpeed table.cell(tab, 1, 0, "1 tick per\n" + str.tostring(math.floor(total_time_1/60000)) + "m " + str.tostring(math.round(total_time_1/1000)>=60?math.round(total_time_1/1000)-60:math.round(total_time_1/1000)) + "s")//str.tostring(total_time) if showSpread table.cell(tab, 3, 0, sprd) if barstate.isrealtime and showSpeedViz s = math.round(total_time/1000)%60 if r < s s := r for i=r to s table.cell(tab_, i, 0, "", bgcolor=color.red, text_size=size.tiny) if s > 0 for i=0 to s table.cell(tab_, i, 0, "", bgcolor=color.white, text_size=size.tiny) one_candle = time-time[1] if barstate.isrealtime and showhv table.cell(tab, 1, 25, "Highest" , bgcolor=#2962ff, text_color=color.white) table.cell(tab, 2, 25, "Vol" , bgcolor=#2962ff, text_color=color.white) table.cell(tab, 0, 25, "", bgcolor=#2962ff, text_color=color.white) if showSpread table.cell(tab, 3, 25, "", bgcolor=#2962ff, text_color=color.white) if colAccTabHV barMarkCol := hvc == 0 ? color.gray : hvc == 1 ? color.new(#b71c1c, 0) : hvc == 2 ? color.new(#00796b, 0) : na table.cell(tab, 0, 26, str.tostring(hour(int(ht)), "##") + ":" + str.tostring(minute(int(ht)), "##") + ":" + str.tostring(second(int(ht)), "##"), text_color=barMarkCol) table.cell(tab, 1, 26, str.tostring(hc), text_color=barMarkCol) table.cell(tab, 2, 26, str.tostring(hv), text_color=barMarkCol) if showSpread table.cell(tab, 3, 26, str.tostring(hs), text_color=barMarkCol) if showBarMark hl := label.new(x=tl, y=0, text=barMarkChar, textcolor=barMarkCol, xloc=xloc.bar_time, yloc=yloc.abovebar, style=label.style_none, size=size.large, tooltip=str.tostring(hv)) label.delete(hl[1]) if showHvLineLabel and hc != 0.0 lihv := line.new(x1=ht-one_candle, y1=hc, x2=time+25*one_candle, y2=hc, xloc=xloc.bar_time, color=barMarkCol, style=line.style_dotted, width=2) lahv := label.new(x=time+25*one_candle, y=hc, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, textcolor=color.white, color=barMarkCol, text=str.tostring(hc)+"\n"+str.tostring(hv)) if array.size(tnsdata_vol) > 0 and barstate.isrealtime j = array.size(tnsdata_vol)-1 for i=2 to array.size(tnsdata_vol)-1 //array.size(tnsdata_vol) if j > 1 if array.get(tnsdata_cls, j) > array.get(tnsdata_cls, j-1) array.set(tnsdata_col, j, #00796b) array.set(tnsdata_spr, j, math.abs(array.get(tnsdata_cls, j)-array.get(tnsdata_cls, j-1))) else if array.get(tnsdata_cls, j) < array.get(tnsdata_cls, j-1) array.set(tnsdata_col, j, #b71c1c) array.set(tnsdata_spr, j, math.abs(array.get(tnsdata_cls, j)-array.get(tnsdata_cls, j-1))) else array.set(tnsdata_col, j, color.gray) array.set(tnsdata_spr, j, math.abs(array.get(tnsdata_cls, j)-array.get(tnsdata_cls, j-1))) col = array.get(tnsdata_col, j) table.cell(tab, 0, i, str.tostring(hour(int(array.get(tnsdata_tmn, j))), "##") + ":" + str.tostring(minute(int(array.get(tnsdata_tmn, j))), "##") + ":" + str.tostring(second(int(array.get(tnsdata_tmn, j))), "##") , text_color=col) table.cell(tab, 2, i, str.tostring(array.get(tnsdata_vol, j)), text_color=col) table.cell(tab, 1, i, str.tostring(array.get(tnsdata_cls, j)), text_color=col) if showSpread table.cell(tab, 3, i, str.tostring(array.get(tnsdata_spr, j)), text_color=col) j := j - 1 if barstate.isrealtime and r1s table.cell(tab, 0, 28, "Volume" , bgcolor=#2962ff, text_color=color.white) if showSpread table.cell(tab, 3, 28, "" , bgcolor=#2962ff, text_color=color.white) table.cell(tab, 1, 28, f1 and not f2?">=":f2 and not f1?"<=":f1 and f2?"b/w":"", bgcolor=#2962ff, text_color=color.white) table.cell(tab, 2, 28, f1 and not f2?(str.tostring(gT)): f2 and not f1?(str.tostring(lT)): f1 and f2?(str.tostring(gT) + " & \n" + str.tostring(lT)):"", bgcolor=#2962ff, text_color=color.white) j = 29 + array.size(tnsdata_vol1)-1 for i = 0 to array.size(tnsdata_vol1)-1 col = array.get(hi, i) == 0 ? color.gray : array.get(hi, i) == 1 ? color.new(#b71c1c, 0) : array.get(hi, i) == 2 ? color.new(#00796b, 0) : na table.cell(tab, 0, j, str.tostring(hour(int(array.get(tnsdata_tmn1, i))), "##") + ":" + str.tostring(minute(int(array.get(tnsdata_tmn1, i))), "##") + ":" + str.tostring(second(int(array.get(tnsdata_tmn1, i))), "##") , text_color=col) table.cell(tab, 2, j, str.tostring(array.get(tnsdata_vol1, i)), text_color=col) table.cell(tab, 1, j, str.tostring(array.get(tnsdata_cls1, i)), text_color=col) if showSpread table.cell(tab, 3, j, str.tostring(array.get(tnsdata_spr1, i)), text_color=col) if array.get(tnsdata_vol1, i) > 0 and showBarMarkF if colAccTabF barMarkColF := col label.new(x=array.get(spt, i), y=0, text=barMarkCharF, textcolor=barMarkColF, xloc=xloc.bar_time, yloc=yloc.belowbar, style=label.style_none, size=size.large, tooltip=str.tostring(array.get(spv, i))) if showFilLineLabel and array.get(tnsdata_cls1, i) != 0.0 filline := line.new(x1=array.get(tnsdata_tmn1, i)-one_candle, y1=array.get(tnsdata_cls1, i), x2=time+5*one_candle, y2=array.get(tnsdata_cls1, i), xloc=xloc.bar_time, color=barMarkColF, style=line.style_dashed, width=2) fillabel := label.new(x=time+5*one_candle, y=array.get(tnsdata_cls1, i), xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, textcolor=color.white, color=barMarkColF, size=size.small, text=str.tostring(array.get(tnsdata_cls1, i))+" ("+str.tostring(array.get(tnsdata_vol1, i))+")") j := j - 1
BULL RUNNERS MA 200-800
https://www.tradingview.com/script/n0nac1uQ-BULL-RUNNERS-MA-200-800/
BULLRUNNER_MILE_HIGH_CLUB
https://www.tradingview.com/u/BULLRUNNER_MILE_HIGH_CLUB/
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/ // Β© fedexan //@version=4 study(title="BULL RUNNERS MA", shorttitle="Double MA", overlay=true, resolution="") type = input(defval="Custom", options=["7-21", "11-22", "200-800", "Custom"], title="Preset:") M1 = input(200, minval=1, title="Custom M1") M2 = input(800, minval=1, title="Custom M2") src = input(close, title="Source") len1 = 0 len2 = 0 if type=="7-21" len1 := 7 len2 := 21 if type=="11-22" len1 := 11 len2 := 22 if type=="200-800" len1 := 200 len2 := 800 if type=="Custom" len1 := M1 len2 := M2 out1 = sma(src, len1) out2 = sma(src, len2) plot(out1, color=color.blue, title="M1") plot(out2, color=color.orange, title="M2")
Ichimoku w/Heikin-Ashi
https://www.tradingview.com/script/4IeSWGP7/
yasujiy
https://www.tradingview.com/u/yasujiy/
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/ // Β© yasujiy //@version=5 //HeikinAshi indicator(title="IchimokuHeikinAshi", shorttitle="Ichimoku2", overlay=true) h_close = (open + high + low + close) / 4 h_open = float(na) h_open := na(h_open[1]) ? (open + close) / 2 : (nz(h_open[1]) + nz(h_close[1])) / 2 h_high = math.max(high, math.max(h_open, h_close)) h_low = math.min(low, math.min(h_open, h_close)) plotcandle(h_open, h_high, h_low, h_close, title= "", color = h_open < h_close ? color.white : color.blue, wickcolor=color.black) //Ichimoku conversionPeriods = input.int(9, minval=1, title="Conversion Line Length") basePeriods = input.int(26, minval=1, title="Base Line Length") laggingSpan2Periods = input.int(52, minval=1, title="Leading Span B Length") displacement = input.int(26, minval=1, title="Displacement") donchian(len) => math.avg(ta.lowest(len), ta.highest(len)) conversionLine = donchian(conversionPeriods) baseLine = donchian(basePeriods) leadLine1 = math.avg(conversionLine, baseLine) leadLine2 = donchian(laggingSpan2Periods) plot(conversionLine, color=#0000FF, title="Conversion Line") plot(baseLine, color=#FF0000, title="Base Line") plot(close, offset = displacement - 1, color=#800080, title="Leading Lagging Span") p1 = plot(leadLine1, offset = displacement - 1, color=#00FF00, title="Leading Span A") p2 = plot(leadLine2, offset = displacement - 1, color=#008000, title="Leading Span B") fill(p1, p2, color = leadLine1 > leadLine2 ? color.rgb(67, 160, 71, 90) : color.rgb(67, 60, 71, 90))
Donchian SAR
https://www.tradingview.com/script/6ecJe49h-Donchian-SAR/
ganeshkrce
https://www.tradingview.com/u/ganeshkrce/
33
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/ // Β© ganeshkrce //@version=4 //@version=4 study(title="Donchian Channels", shorttitle="DC", overlay=true, resolution="") length = input(20, minval=1) lower = lowest(length) upper = highest(length) basis = avg(upper, lower) plot(basis, "Basis", color=#FF6A00) u = plot(upper, "Upper", color=#0094FF) l = plot(lower, "Lower", color=#0094FF) fill(u, l, color=#0094FF, transp=95, title="Background") //@version=4 //study(title="Parabolic SAR", shorttitle="SAR", overlay=true, resolution="") start = input(0.02) increment = input(0.02) maximum = input(0.2, "Max Value") out = sar(start, increment, maximum) plot(out, "ParabolicSAR", style=plot.style_cross, color=#3A6CA8)
isoPriceAction Breaker Zones
https://www.tradingview.com/script/pqE3kHNi-isoPriceAction-Breaker-Zones/
ismailbayramce
https://www.tradingview.com/u/ismailbayramce/
242
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/ // Β© ismailbayramce //@version=4 study("isoPriceAction", shorttitle="isoPriceAction", overlay=true) showBreakerZoneSup = input(title="Show Breaker Zone Support Areas", type=input.bool, defval=true) showBreakerZoneRes = input(title="Show Breaker Zone Resistance Areas", type=input.bool, defval=true) boxSize = input(20, minval=1, title="Breaker Zone Width") boxType = input(title="Breaker Zone Heigh", defval="OC", options=["OC", "HL"]) breakerZoneForLong = (close[0] > open[0]) and (close[1] > open[1]) and (close[0] > close[1]) and (close[2] < open[2]) and (close[2] > close[4]) and (close[3] > open[3]) and (close[4] > open[4]) and (close[3] > close[4]) if breakerZoneForLong and showBreakerZoneSup box.new(bar_index[2], boxType == "OC" ? close[2] : high[2], bar_index + boxSize, boxType == "OC" ? open[2] : low[2], bgcolor=color.new(color.blue, 70), border_color=color.blue) breakerZoneForShort = (close[0] < open[0]) and (close[1] < open[1]) and (close[0] < close[1]) and (close[2] > open[2]) and (close[2] < close[4]) and (close[3] < open[3]) and (close[4] < open[4] and (close[3] < close[4])) if breakerZoneForShort and showBreakerZoneRes box.new(bar_index[2], boxType == "OC" ? close[2] : high[2], bar_index + boxSize, boxType == "OC" ? open[2] : low[2], bgcolor=color.new(color.red, 70), border_color=color.red)
34 EMA Bands [v2]
https://www.tradingview.com/script/yI6tSeTw-34-EMA-Bands-v2/
VishvaP
https://www.tradingview.com/u/VishvaP/
136
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/ // Β© VishvaP //@version=5 indicator("34 EMA Bands", overlay = true) //Constants h_EMA = ta.ema(high, 34) l_EMA = ta.ema(low, 34) EMA = ta.ema(close, 34) //Multi Timeframe res = input.timeframe(defval='60', title="Timeframe") h_EMAres = request.security(syminfo.tickerid, res, h_EMA) l_EMAres = request.security(syminfo.tickerid, res, l_EMA) EMAres = request.security(syminfo.tickerid, res, EMA) //Lower reversion zone bands b_High = ((h_EMAres - EMAres) * math.phi) * math.pi + EMAres b_Low = (-(EMAres - l_EMAres) * math.phi) * math.pi + EMAres //Lower reversion zone bands smoothed b_High_S = ta.wma(b_High, 8) b_Low_S = ta.wma(b_Low, 8) //Higher reversion zone bands phi_High = ((h_EMAres - EMAres) * math.phi) * (math.phi + 4) + EMAres phi_Low = (-(EMAres - l_EMAres) * math.phi) * (math.phi + 4) + EMAres //Higher reversion zone bands smoothed phi_High_S = ta.wma(phi_High, 8) phi_Low_S = ta.wma(phi_Low, 8) //====================================================================================================// //Median zone bands [plot] highP1 = plot(h_EMAres, color = color.blue, title = "Top median zone", display=display.none) lowP1 = plot(l_EMAres, color = color.blue, title = "Bottom median zone", display=display.none) //Lower reversion zone bands [plot] highP3 = plot(b_High_S, color = color.yellow, title = "Lower sell zone", display=display.none) lowP3 = plot(b_Low_S, color = color.teal, title = "Higher buy zone", display=display.none) //Higher reversion zone bands [plot] phiPlotHigh = plot(phi_High_S, color = color.red, title = "Top sell zone") phiPlotLow = plot(phi_Low_S, color = color.green, title = "Bottom buy zone") //Sell zone region [fill] fill(phiPlotHigh, highP3, color.new(color.red, 95), title = "Sell zone") //Buy zone region [fill] fill(lowP3, phiPlotLow, color.new(color.green, 95), title = "Buy zone") //Median zone region [fill] fill(highP1, lowP1, color.new(color.black, 75), title = "Median zone")
Currency Strength Meter [HeWhoMustNotBeNamed]
https://www.tradingview.com/script/3NUNbMUD-Currency-Strength-Meter-HeWhoMustNotBeNamed/
Trendoscope
https://www.tradingview.com/u/Trendoscope/
279
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/ // Β© HeWhoMustNotBeNamed // __ __ __ __ __ __ __ __ __ __ __ _______ __ __ __ // / | / | / | _ / |/ | / \ / | / | / \ / | / | / \ / \ / | / | // $$ | $$ | ______ $$ | / \ $$ |$$ |____ ______ $$ \ /$$ | __ __ _______ _$$ |_ $$ \ $$ | ______ _$$ |_ $$$$$$$ | ______ $$ \ $$ | ______ _____ ____ ______ ____$$ | // $$ |__$$ | / \ $$ |/$ \$$ |$$ \ / \ $$$ \ /$$$ |/ | / | / |/ $$ | $$$ \$$ | / \ / $$ | $$ |__$$ | / \ $$$ \$$ | / \ / \/ \ / \ / $$ | // $$ $$ |/$$$$$$ |$$ /$$$ $$ |$$$$$$$ |/$$$$$$ |$$$$ /$$$$ |$$ | $$ |/$$$$$$$/ $$$$$$/ $$$$ $$ |/$$$$$$ |$$$$$$/ $$ $$< /$$$$$$ |$$$$ $$ | $$$$$$ |$$$$$$ $$$$ |/$$$$$$ |/$$$$$$$ | // $$$$$$$$ |$$ $$ |$$ $$/$$ $$ |$$ | $$ |$$ | $$ |$$ $$ $$/$$ |$$ | $$ |$$ \ $$ | __ $$ $$ $$ |$$ | $$ | $$ | __ $$$$$$$ |$$ $$ |$$ $$ $$ | / $$ |$$ | $$ | $$ |$$ $$ |$$ | $$ | // $$ | $$ |$$$$$$$$/ $$$$/ $$$$ |$$ | $$ |$$ \__$$ |$$ |$$$/ $$ |$$ \__$$ | $$$$$$ | $$ |/ |$$ |$$$$ |$$ \__$$ | $$ |/ |$$ |__$$ |$$$$$$$$/ $$ |$$$$ |/$$$$$$$ |$$ | $$ | $$ |$$$$$$$$/ $$ \__$$ | // $$ | $$ |$$ |$$$/ $$$ |$$ | $$ |$$ $$/ $$ | $/ $$ |$$ $$/ / $$/ $$ $$/ $$ | $$$ |$$ $$/ $$ $$/ $$ $$/ $$ |$$ | $$$ |$$ $$ |$$ | $$ | $$ |$$ |$$ $$ | // $$/ $$/ $$$$$$$/ $$/ $$/ $$/ $$/ $$$$$$/ $$/ $$/ $$$$$$/ $$$$$$$/ $$$$/ $$/ $$/ $$$$$$/ $$$$/ $$$$$$$/ $$$$$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$/ $$$$$$$/ $$$$$$$/ // // // //@version=5 indicator("Currency Strength Meter [HeWhoMustNotBeNamed]", overlay=true, max_bars_back=50) import HeWhoMustNotBeNamed/enhanced_ta/10 as eta reference = input.string("USD", "Reference   ", group="Main", inline="r") timeframe = input.timeframe("", "", group="Main", inline="r") statPosition = input.string(defval=position.middle_center, title='Table     ', options=[position.bottom_right, position.bottom_left, position.top_right, position.middle_left, position.middle_right, position.middle_center], group='Display', inline="t") textSize = input.string(size.normal, title='', options=[size.tiny, size.small, size.normal, size.large, size.huge], group='Display', inline="t") statType = input.string('Value', title="Stat Type", group="Display", options=['Value', 'Rank']) maType = input.string("ema", title="Moving Average", group="Technicals", options=["sma", "ema", "hma", "rma", "wma", "vwma", "swma", "linreg", "median"], inline="m") maLength = input.int(24, title="", group="Technicals", inline="m") oscType = input.string("rsi", title="Oscillator   ", group="Technicals", options=["cci", "cmo", "cog", "roc", "rsi", "stoch", "tsi"], inline="o") oscLength = input.int(12, title="", group="Technicals", inline="o") volumeType = input.string("obv", title="Volume Type ", group="Technicals", options=["volume", "obv", "pvt", "pvi", "vwap"]) ticker1 = input.string("AUDUSD", "", group="Tickers", inline="1") ticker2 = input.string("USDCAD", "", group="Tickers", inline="1") ticker3 = input.string("EURUSD", "", group="Tickers", inline="1") ticker4 = input.string("USDCHF", "", group="Tickers", inline="1") ticker5 = input.string("USDJPY", "", group="Tickers", inline="2") ticker6 = input.string("NZDUSD", "", group="Tickers", inline="2") ticker7 = input.string("GBPUSD", "", group="Tickers", inline="2") ticker8 = input.string("USDTRY", "", group="Tickers", inline="2") ticker9 = input.string("USDRUB", "", group="Tickers", inline="3") ticker10 = input.string("USDMXN", "", group="Tickers", inline="3") ticker11 = input.string("USDZAR", "", group="Tickers", inline="3") ticker12 = input.string("USDNOK", "", group="Tickers", inline="3") ticker13 = input.string("USDPLN", "", group="Tickers", inline="4") ticker14 = input.string("USDSEK", "", group="Tickers", inline="4") ticker15 = input.string("USDCNH", "", group="Tickers", inline="4") ticker16 = input.string("USDCZK", "", group="Tickers", inline="4") ticker17 = input.string("USDDKK", "", group="Tickers", inline="5") ticker18 = input.string("USDHKD", "", group="Tickers", inline="5") ticker19 = input.string("USDHUF", "", group="Tickers", inline="5") ticker20 = input.string("USDILS", "", group="Tickers", inline="5") ticker21 = input.string("USDRON", "", group="Tickers", inline="6") ticker22 = input.string("USDSGD", "", group="Tickers", inline="6") var tickers = array.new_string() isValidTicker(ticker)=> (str.length(ticker) == 6) pushValidTicker(arr, ticker)=> if(isValidTicker(ticker)) array.push(arr, ticker) if(barstate.isfirst and array.size(tickers) == 0) pushValidTicker(tickers, ticker1) pushValidTicker(tickers, ticker2) pushValidTicker(tickers, ticker3) pushValidTicker(tickers, ticker4) pushValidTicker(tickers, ticker5) pushValidTicker(tickers, ticker6) pushValidTicker(tickers, ticker7) pushValidTicker(tickers, ticker8) pushValidTicker(tickers, ticker9) pushValidTicker(tickers, ticker10) pushValidTicker(tickers, ticker11) pushValidTicker(tickers, ticker12) pushValidTicker(tickers, ticker13) pushValidTicker(tickers, ticker14) pushValidTicker(tickers, ticker15) pushValidTicker(tickers, ticker16) pushValidTicker(tickers, ticker17) pushValidTicker(tickers, ticker18) pushValidTicker(tickers, ticker19) pushValidTicker(tickers, ticker20) pushValidTicker(tickers, ticker21) pushValidTicker(tickers, ticker21) NUMBER_OF_ELEMENTS = array.size(tickers) var tickerArray = array.new_string(NUMBER_OF_ELEMENTS) var priceArray = array.new_float(NUMBER_OF_ELEMENTS) var oscillatorArray = array.new_float(NUMBER_OF_ELEMENTS) var voscillatorArray = array.new_float(NUMBER_OF_ELEMENTS) var momentumArray = array.new_float(NUMBER_OF_ELEMENTS) var vmomentumArray = array.new_float(NUMBER_OF_ELEMENTS) var volatilityArray = array.new_float(NUMBER_OF_ELEMENTS) var oscillatorRankArray = array.new_int(NUMBER_OF_ELEMENTS) var voscillatorRankArray = array.new_int(NUMBER_OF_ELEMENTS) var momentumRankArray = array.new_int(NUMBER_OF_ELEMENTS) var vmomentumRankArray = array.new_int(NUMBER_OF_ELEMENTS) var overallRankArray = array.new_int(NUMBER_OF_ELEMENTS) var volatilityRankArray = array.new_int(NUMBER_OF_ELEMENTS) var oscillatorRankMomentumArray = array.new_int(NUMBER_OF_ELEMENTS) var voscillatorRankMomentumArray = array.new_int(NUMBER_OF_ELEMENTS) var momentumRankMomentumArray = array.new_int(NUMBER_OF_ELEMENTS) var vmomentumRankMomentumArray = array.new_int(NUMBER_OF_ELEMENTS) var volatilityRankMomentumArray = array.new_int(NUMBER_OF_ELEMENTS) var overallRankMomentumArray = array.new_int(NUMBER_OF_ELEMENTS) var oscillatorColorArray = array.new_color(NUMBER_OF_ELEMENTS) var voscillatorColorArray = array.new_color(NUMBER_OF_ELEMENTS) var momentumColorArray = array.new_color(NUMBER_OF_ELEMENTS) var vmomentumColorArray = array.new_color(NUMBER_OF_ELEMENTS) var volatilityColorArray = array.new_color(NUMBER_OF_ELEMENTS) var overallColorArray = array.new_color(NUMBER_OF_ELEMENTS) var rankIndexArray = array.new_int(NUMBER_OF_ELEMENTS) var themeColors = array.from( color.rgb(251, 244, 109), color.rgb(141, 186, 81), color.rgb(74, 159, 245), color.rgb(255, 153, 140), color.rgb(255, 149, 0), color.rgb(0, 234, 211), color.rgb(167, 153, 183), color.rgb(255, 210, 113), color.rgb(119, 217, 112), color.rgb(95, 129, 228), color.rgb(235, 146, 190), color.rgb(198, 139, 89), color.rgb(200, 149, 149), color.rgb(196, 182, 182), color.rgb(255, 190, 15), color.rgb(192, 226, 24), color.rgb(153, 140, 235), color.rgb(206, 31, 107), color.rgb(251, 54, 64), color.rgb(194, 255, 217), color.rgb(255, 219, 197), color.rgb(121, 180, 183) ) f_get_pair(ticker)=> baseCurrency = str.length(ticker) >= 3 ? str.substring(ticker, 0, 3) : ticker quoteCurrency = str.length(ticker) >= 3 ? str.substring(ticker, 3, str.length(ticker)) : baseCurrency [baseCurrency, quoteCurrency] f_get_momentum(source, maType, maLength)=> ma = eta.ma(source, maType, maLength) diff = 100*(source - ma)/math.abs(source) math.round(ta.linreg(diff, maLength, 0), 2) f_get_oscillator(source, oscType, oscLength)=> [oscillator, _h, _l] = eta.oscillator(oscType, oscLength, oscLength, oscLength*2, source=source) math.round(oscillator, 2) f_get_volatility(maLength, baseCurrency)=> wvf = baseCurrency == reference? ((high-ta.lowest(low, maLength))/(ta.lowest(close, maLength)))*100 :((ta.highest(high, maLength)-low)/(ta.highest(close, maLength)))*100 math.round(ta.linreg(wvf, maLength, 0), 2) f_get_all_technicals(baseCurrency)=> vol = volumeType == "volume"? math.sum(volume, maLength) : volumeType == "obv"? ta.obv : volumeType == "pvt"? ta.pvt : volumeType == "pvi"? ta.pvi : ta.vwap osc_price = f_get_oscillator(close, oscType, oscLength) osc_price := baseCurrency == reference? 100-osc_price : osc_price osc_volume = f_get_oscillator(vol, oscType, oscLength) osc_volume := baseCurrency == reference? 100-osc_volume : osc_volume mom_price = f_get_momentum(close, maType, maLength) mom_price := baseCurrency == reference? -mom_price : mom_price mom_volume = f_get_momentum(vol, maType, maLength) mom_volume := baseCurrency == reference? -mom_volume : mom_volume volatility = f_get_volatility(maLength, baseCurrency) price = baseCurrency == reference? 1/close : close [price, osc_price, osc_volume, mom_price, mom_volume, volatility] f_get_technicals(ticker, i)=> returnCounter = i [baseCurrency, quoteCurrency] = f_get_pair(ticker) [price, osc_price, osc_volume, mom_price, mom_volume, volatility] = request.security(ticker.new(syminfo.prefix, ticker), timeframe, f_get_all_technicals(baseCurrency), ignore_invalid_symbol=true, lookahead=barmerge.lookahead_on) if(isValidTicker(ticker)) if(barstate.isfirst) errorPairs = array.new_string() if(baseCurrency != reference and quoteCurrency != reference and ticker != "") array.push(errorPairs, ticker) if(array.size(errorPairs) != 0) runtime.error("One or more currency pairs does not have reference currency "+reference+" as either base or quote currency :"+str.tostring(errorPairs)) display = baseCurrency == reference? quoteCurrency : baseCurrency array.set(tickerArray, i, display) array.set(priceArray, i, price) array.set(momentumArray, i, mom_price) array.set(vmomentumArray, i, mom_volume) array.set(oscillatorArray, i, osc_price) array.set(voscillatorArray, i, osc_volume) array.set(volatilityArray, i, volatility) returnCounter := i+1 returnCounter insert_stats_row(table_id, row, text_color, header_bg_color, header_text_color, text_size, header, osc, oosc, mom, omom, volataility, overall, price, bgOsc, bgOosc, bgMom, bgOmom, bgVol, bgOverall) => table.cell(table_id=table_id, column=0, row=row, text=str.tostring(header), bgcolor=header_bg_color, text_color=header_text_color, text_size=text_size) table.cell(table_id=table_id, column=1, row=row, text=str.tostring(osc), bgcolor=bgOsc, text_color=text_color, text_size=text_size) table.cell(table_id=table_id, column=2, row=row, text=str.tostring(oosc), bgcolor=bgOosc, text_color=text_color, text_size=text_size) table.cell(table_id=table_id, column=3, row=row, text=str.tostring(mom), bgcolor=bgMom, text_color=text_color, text_size=text_size) table.cell(table_id=table_id, column=4, row=row, text=str.tostring(omom), bgcolor=bgOmom, text_color=text_color, text_size=text_size) table.cell(table_id=table_id, column=5, row=row, text=str.tostring(volataility), bgcolor=bgVol, text_color=text_color, text_size=text_size) table.cell(table_id=table_id, column=6, row=row, text=str.tostring(overall), bgcolor=bgOverall, text_color=text_color, text_size=text_size) table.cell(table_id=table_id, column=7, row=row, text=str.tostring(price), bgcolor=bgOverall, text_color=text_color, text_size=text_size) row + 1 get_momentum_symbol(momentum)=> momentum > 0? "⬆": momentum < 0? "⬇" : "β–£" populate_stats(table_id, i, row)=> if(row == 1) headerTextSize = textSize == size.tiny? size.small : textSize == size.small? size.normal: textSize == size.normal? size.large: size.huge table.cell(table_id=table_id, column=0, row=0, text=timeframe==""?timeframe.period:timeframe, bgcolor=color.aqua, text_color=color.black, text_size=headerTextSize) insert_stats_row(table_id, row, color.white, color.aqua, color.black, textSize, syminfo.prefix + ":" + reference , "Oscillator-Price", "Oscillator-Volume", "Momentum-Price", "Momentum-Volume", "Volatility", "Rank", "Price", color.teal,color.teal,color.teal,color.teal, color.teal, color.teal) else //header_bg_color = color.maroon header_text_color = color.black text_color = array.get(themeColors, i) header_bg_color = text_color oscColor = array.get(oscillatorColorArray, i) osc = array.get(statType == "Value" ? oscillatorArray : oscillatorRankArray, i) oscValue = get_momentum_symbol(array.get(oscillatorRankMomentumArray, i))+ " " + str.tostring(osc) ooscColor = array.get(voscillatorColorArray, i) oosc = array.get(statType == "Value" ? voscillatorArray : voscillatorRankArray, i) ooscValue = get_momentum_symbol(array.get(voscillatorRankMomentumArray, i))+ " " + str.tostring(oosc) momColor = array.get(momentumColorArray, i) mom = array.get(statType == "Value" ? momentumArray : momentumRankArray, i) momValue = get_momentum_symbol(array.get(momentumRankMomentumArray, i))+ " " + str.tostring(mom) omomColor = array.get(vmomentumColorArray, i) omom = array.get(statType == "Value" ? vmomentumArray : vmomentumRankArray, i) omomValue = get_momentum_symbol(array.get(vmomentumRankMomentumArray, i))+ " " + str.tostring(omom) volatilityColor = array.get(volatilityColorArray, i) volataility = array.get(statType == "Value" ? volatilityArray : volatilityRankArray, i) volatilityValue = get_momentum_symbol(array.get(volatilityRankMomentumArray, i))+ " " + str.tostring(volataility) rank = array.get(overallRankArray, i) price = array.get(priceArray, i) overall = get_momentum_symbol(array.get(overallRankMomentumArray, i))+ " " + str.tostring(rank) overallColor = array.get(overallColorArray, i) ticker = array.get(tickerArray, i) insert_stats_row(table_id, row, text_color, header_bg_color, header_text_color, textSize, ticker, oscValue, ooscValue, momValue, omomValue, volatilityValue, overall, price, oscColor, ooscColor, momColor, omomColor, volatilityColor, overallColor) set_rank(mainArray, sortedArray, rankArray, colorArray, i)=> val = array.get(mainArray, i) rank = array.indexof(sortedArray, val)+1 array.set(rankArray, i, rank) array.set(colorArray, i, color.new(color.from_gradient(rank, 1, NUMBER_OF_ELEMENTS, color.green, color.red), 80)) calculate_ranks(mainArray, rankArray, colorArray, order=order.descending)=> sortedArray = array.copy(mainArray) array.sort(sortedArray, order) for i=0 to array.size(mainArray)-1 set_rank(mainArray, sortedArray, rankArray, colorArray, i) calculate_overall_rank()=> sumArray = array.new_int(NUMBER_OF_ELEMENTS) for i=0 to NUMBER_OF_ELEMENTS-1 sum = array.get(oscillatorRankArray, i) + array.get(voscillatorRankArray, i) + array.get(momentumRankArray, i) + array.get(vmomentumRankArray, i) + array.get(volatilityRankArray, i) array.set(sumArray, i, sum) for i=0 to NUMBER_OF_ELEMENTS-1 sum = array.get(oscillatorRankArray, i) + array.get(voscillatorRankArray, i) + array.get(momentumRankArray, i) + array.get(vmomentumRankArray, i) + array.get(volatilityRankArray, i) array.sort(sumArray, order.ascending) ticker = array.get(tickerArray, i) rank = array.indexof(sumArray, sum) + 1 array.set(overallRankArray, i, rank) array.set(overallColorArray, i, color.new(color.from_gradient(rank, 1, NUMBER_OF_ELEMENTS, color.green, color.red), 80)) calculate_rank_index()=> array.fill(rankIndexArray, na) for i=0 to NUMBER_OF_ELEMENTS-1 rank = array.get(overallRankArray, i)-1 while(not na(array.get(rankIndexArray, rank))) rank := rank+1 array.set(rankIndexArray, rank, i) calculate_rank_momentum(rankArray, previousRankArray, rankMomentumArray)=> for i=0 to array.size(rankArray)-1 rank = array.get(rankArray, i) previousRank = array.get(previousRankArray, i) rankMomentum = (rank > previousRank) ? -1 : (rank < previousRank ? 1 : 0) array.set(rankMomentumArray, i, rankMomentum) counter = 0 counter := f_get_technicals(ticker1, counter) counter := f_get_technicals(ticker2, counter) counter := f_get_technicals(ticker3, counter) counter := f_get_technicals(ticker4, counter) counter := f_get_technicals(ticker5, counter) counter := f_get_technicals(ticker6, counter) counter := f_get_technicals(ticker7, counter) counter := f_get_technicals(ticker8, counter) counter := f_get_technicals(ticker9, counter) counter := f_get_technicals(ticker10, counter) counter := f_get_technicals(ticker11, counter) counter := f_get_technicals(ticker12, counter) counter := f_get_technicals(ticker13, counter) counter := f_get_technicals(ticker14, counter) counter := f_get_technicals(ticker15, counter) counter := f_get_technicals(ticker16, counter) counter := f_get_technicals(ticker17, counter) counter := f_get_technicals(ticker18, counter) counter := f_get_technicals(ticker19, counter) counter := f_get_technicals(ticker20, counter) counter := f_get_technicals(ticker21, counter) counter := f_get_technicals(ticker22, counter) oscillatorRankArrayCopy = array.copy(oscillatorRankArray) voscillatorRankArrayCopy = array.copy(voscillatorRankArray) momentumRankArrayCopy = array.copy(momentumRankArray) vmomentumRankArrayCopy = array.copy(vmomentumRankArray) volatilityRankArrayCopy = array.copy(volatilityRankArray) overallRankArrayCopy = array.copy(overallRankArray) calculate_ranks(oscillatorArray, oscillatorRankArray, oscillatorColorArray) calculate_ranks(voscillatorArray, voscillatorRankArray, voscillatorColorArray) calculate_ranks(momentumArray, momentumRankArray, momentumColorArray) calculate_ranks(vmomentumArray, vmomentumRankArray, vmomentumColorArray) calculate_ranks(volatilityArray, volatilityRankArray, volatilityColorArray, order.ascending) calculate_rank_momentum(oscillatorRankArray, oscillatorRankArrayCopy, oscillatorRankMomentumArray) calculate_rank_momentum(voscillatorRankArray, voscillatorRankArrayCopy, voscillatorRankMomentumArray) calculate_rank_momentum(momentumRankArray, momentumRankArrayCopy, momentumRankMomentumArray) calculate_rank_momentum(vmomentumRankArray, vmomentumRankArrayCopy, vmomentumRankMomentumArray) calculate_rank_momentum(volatilityRankArray, volatilityRankArrayCopy, volatilityRankMomentumArray) calculate_overall_rank() calculate_rank_momentum(overallRankArray, overallRankArrayCopy, overallRankMomentumArray) calculate_rank_index() var table stats = table.new(position=statPosition, columns=8, rows=array.size(tickerArray)+2, border_width=1) populate_stats(stats, 0, 1) for i=0 to array.size(rankIndexArray)-1 index = array.get(rankIndexArray, i) populate_stats(stats, index, i+2)
Williams %R with multiple periods
https://www.tradingview.com/script/CYXo8Pko-Williams-R-with-multiple-periods/
insideandup
https://www.tradingview.com/u/insideandup/
27
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/ // © insideandup // @version=5 // // Description: Williams %R technical analysis oscillator by Larry Williams. // Calculation: %R = (period high - most recent period's close price)/(period high - period low) // Script feature: 9 customizable periods and fills. // Default periods: 10, 13, 21, 34, 55, 89, 144, 233, 377. // Default colors: "Solarized" color scheme created by Ethan Schoonover at ethanschoonover.com. // Created: Dec 2021 // Last Edited: 28 July 2023 indicator("Williams %R by 3iau", shorttitle="%R", format=format.price, precision=3, timeframe="", timeframe_gaps=true) // VARIABLES // Tillson's Moving Average (T3) variables a = 0.618033989 // Tillson applied a = 0.7, here applying the Golden ratio conjugate = |(1-√5)/2| = 0.618033989 a1 = -1*math.pow(a, 3) a2 = 3*math.pow(a, 2) + 3*math.pow(a, 3) a3 = -6*math.pow(a, 2) - 3*a - 3*math.pow(a, 3) a4 = 1 + 3*a + math.pow(a, 3) + 3*math.pow(a, 2) // Moving average type selection ma(source, length, type) => type == "SMA" ? ta.sma(source, length) : type == "EMA" ? ta.ema(source, length) : type == "DEMA" ? 2 * ta.ema(source, length) - ta.ema(ta.ema(source, length), length) : type == "TEMA" ? 3 * ta.ema(source, length) - 3 * ta.ema(ta.ema(source, length), length) + ta.ema(ta.ema(ta.ema(source, length), length), length) : type == "QEMA" ? 5 * ta.ema(source, length) - 10 * ta.ema(ta.ema(source, length), length) + 10 * ta.ema(ta.ema(ta.ema(source, length), length), length) - 5 * ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length) + ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length) : type == "PEMA" ? 8 * ta.ema(source, length) - 28 * ta.ema(ta.ema(source, length), length) + 56 * ta.ema(ta.ema(ta.ema(source, length), length), length) - 70 * ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length) + 56 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length) - 28 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length), length) + 8 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length), length), length) - ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length), length), length), length) : type == "ZLEMA" ? ta.ema(source + (source - source[math.round((length - 1) / 2)]), length) : type == "T3" ? a1 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length), length) + a2 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length) + a3 * ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length) + a4 * ta.ema(ta.ema(ta.ema(source, length), length), length) : type == "HMA" ? ta.hma(source, length) : type == "SMMA" ? ta.rma(source, length) : type == "WMA" ? ta.wma(source, length) : type == "VWMA" ? ta.vwma(source, length) : na // WILLIAMS PERCENT R 00 AND ITS MA CALCULATIONS // Source type selection source0 = input.string("Close", title = "Source", options = ["Open", "High", "Low", "Close", "Median HL/2", "Typical HLC/3", "OHLC/4", "Body Median OC/2", "Weighted Close HL2C/4", "Biased HC/2 if Close > Open, else LC/2", "Biased High if Close > HL/2, else Low", "Biased High if Close > Open, else Low"], inline = "WR0", group = "Display Williams %R and its Moving Average") src0 = 1.0 if (source0 == "Open") src0 := open else if (source0 == "High") src0 := high else if (source0 == "Low") src0 := low else if (source0 == "Close") src0 := close else if (source0 == "Median HL/2") src0 := hl2 else if (source0 == "Typical HLC/3") src0 := hlc3 else if (source0 == "OHLC/4") src0 := ohlc4 else if (source0 == "Body Median OC/2") src0 := (open + close)/2 else if (source0 == "Weighted Close HL2C/4") src0 := (high + low + 2 * close) / 4 else if (source0 == "Biased HC/2 if Close > Open, else LC/2") src0 := close > open ? (high + close) / 2 : (low + close) / 2 else if (source0 == "Biased High if Close > HL/2, else Low") src0 := close > hl2 ? high : low else if (source0 == "Biased High if Close > Open, else Low") src0 := close > open ? high : low show_wr0 = input(defval=true, title="", inline="wr0", group = "Display Williams %R and its Moving Average") length0 = input.int(defval=10, minval=1, maxval=2000, title="%R 00", inline="wr0", group="Display Williams %R and its Moving Average") price0(length0) => max0 = ta.highest(length0) min0 = ta.lowest(length0) 100 * (src0 - max0) / (max0 - min0) percentR0 = price0(length0) show_wr0_ma = input(defval=false, title="", inline="MA", group = "Display Williams %R and its Moving Average") wr0_ma_length = input.int(defval=50, title="MA 00", inline = "MA", group="Display Williams %R and its Moving Average") wr0_ma_type = input.string(defval="HMA", title="", options = ["SMA", "EMA", "DEMA", "TEMA", "QEMA", "PEMA", "ZLEMA", "T3", "HMA", "SMMA", "WMA", "VWMA"], inline = "MA", group = "Display Williams %R and its Moving Average") wr0_ma = ma(percentR0, wr0_ma_length, wr0_ma_type) // WILLIAMS PERCENT R 01-08 CALCULATIONS source = input.string("Close", title = "Source", options = ["Open", "High", "Low", "Close", "Median HL/2", "Typical HLC/3", "OHLC/4", "Body Median OC/2", "Weighted Close HL2C/4", "Biased HC/2 if Close > Open, else LC/2", "Biased High if Close > HL/2, else Low", "Biased High if Close > Open, else Low"], inline = "WR0", group = "Display Specified Williams %R") src = 1.0 if (source == "Open") src := open else if (source == "High") src := high else if (source == "Low") src := low else if (source == "Close") src := close else if (source == "Median HL/2") src := hl2 else if (source == "Typical HLC/3") src := hlc3 else if (source == "OHLC/4") src := ohlc4 else if (source == "Body Median OC/2") src := (open + close)/2 else if (source == "Weighted Close HL2C/4") src := (high + low + 2 * close) / 4 else if (source == "Biased HC/2 if Close > Open, else LC/2") src := close > open ? (high + close) / 2 : (low + close) / 2 else if (source == "Biased High if Close > HL/2, else Low") src := close > hl2 ? high : low else if (source == "Biased High if Close > Open, else Low") src := close > open ? high : low show_wr1 = input(defval=true, title="", inline="wr1", group = "Display Specified Williams %R") length1 = input.int(defval=13, minval=1, maxval=2000, title="%R 01", inline="wr1", group="Display Specified Williams %R") price1(length1) => max1 = ta.highest(length1) min1 = ta.lowest(length1) 100 * (src - max1) / (max1 - min1) percentR1 = price1(length1) show_wr2 = input(defval=true, title="", inline="wr2", group = "Display Specified Williams %R") length2 = input.int(defval=21, minval=1, maxval=2000, title="%R 02", inline="wr2", group="Display Specified Williams %R") price2(length2) => max2 = ta.highest(length2) min2 = ta.lowest(length2) 100 * (src - max2) / (max2 - min2) percentR2 = price2(length2) show_wr3 = input(defval=true, title="", inline="wr3", group = "Display Specified Williams %R") length3 = input.int(defval=34, minval=1, maxval=2000, title="%R 03", inline="wr3", group="Display Specified Williams %R") price3(length3) => max3 = ta.highest(length3) min3 = ta.lowest(length3) 100 * (src - max3) / (max3 - min3) percentR3 = price3(length3) show_wr4 = input(defval=true, title="", inline="wr4", group = "Display Specified Williams %R") length4 = input.int(defval=55, minval=1, maxval=2000, title="%R 04", inline="wr4", group="Display Specified Williams %R") price4(length4) => max4 = ta.highest(length4) min4 = ta.lowest(length4) 100 * (src - max4) / (max4 - min4) percentR4 = price4(length4) show_wr5 = input(defval=true, title="", inline="wr5", group = "Display Specified Williams %R") length5 = input.int(defval=89, minval=1, maxval=2000, title="%R 05", inline="wr5", group="Display Specified Williams %R") price5(length5) => max5 = ta.highest(length5) min5 = ta.lowest(length5) 100 * (src - max5) / (max5 - min5) percentR5 = price5(length5) show_wr6 = input(defval=true, title="", inline="wr6", group = "Display Specified Williams %R") length6 = input.int(defval=144, minval=1, maxval=2000, title="%R 06", inline="wr6", group="Display Specified Williams %R") price6(length6) => max6 = ta.highest(length6) min6 = ta.lowest(length6) 100 * (src - max6) / (max6 - min6) percentR6 = price6(length6) show_wr7 = input(defval=true, title="", inline="wr7", group = "Display Specified Williams %R") length7 = input.int(defval=233, minval=1, maxval=2000, title="%R 07", inline="wr7", group="Display Specified Williams %R") price7(length7) => max7 = ta.highest(length7) min7 = ta.lowest(length7) 100 * (src - max7) / (max7 - min7) percentR7 = price7(length7) show_wr8 = input(defval=true, title="", inline="wr8", group = "Display Specified Williams %R") length8 = input.int(defval=377, minval=1, maxval=2000, title="%R 08", inline="wr8", group="Display Specified Williams %R") price8(length8) => max8 = ta.highest(length8) min8 = ta.lowest(length8) 100 * (src - max8) / (max8 - min8) percentR8 = price8(length8) // PLOTS // Percent R p0=plot(show_wr0 ? percentR0 : na, title="%R0", color=color.rgb(42, 161, 152, 20), linewidth=1)//cyan p0_ma = plot(show_wr0_ma ? wr0_ma : na, title="%R0 MA", color=color.rgb(42, 161, 152, 50), linewidth=1) p1=plot(show_wr1 ? percentR1 : na, title="%R1", color=color.rgb(42, 161, 152, 0), linewidth=1)//cyan p2=plot(show_wr2 ? percentR2 : na, title="%R2", color=color.rgb(38, 139, 210, 5), linewidth=1)//blue p3=plot(show_wr3 ? percentR3 : na, title="%R3", color=color.rgb(108, 113, 196, 10), linewidth=1)//brmagenta p4=plot(show_wr4 ? percentR4 : na, title="%R4", color=color.rgb(220, 50, 47, 20), linewidth=1)//red p5=plot(show_wr5 ? percentR5 : na, title="%R5", color=color.rgb(203, 75, 22, 30), linewidth=1)//brred p6=plot(show_wr6 ? percentR6 : na, title="%R6", color=color.rgb(181, 137, 0, 40), linewidth=1)//yellow p7=plot(show_wr7 ? percentR7 : na, title="%R7", color=color.rgb(133, 153, 0, 50), linewidth=1)//green p8=plot(show_wr8 ? percentR8 : na, title="%R8", color=color.rgb(42, 161, 152, 60), linewidth=1)//cyan fill(p0, p0_ma, title="R0 R0MA Fill", color = show_wr0_ma ? percentR0 > wr0_ma ? color.rgb(238, 232, 213, 90) : color.rgb(220, 50, 47, 90) : na) // red fill(p0, p1, title="R0R1 Fill", color=color.rgb(42, 161, 152, 50))//cyan fill(p1, p2, title="R1R2 Fill", color=color.rgb(38, 139, 210, 50))//blue fill(p2, p3, title="R2R3 Fill", color=color.rgb(108, 113, 196, 55))//brmagenta fill(p3, p4, title="R3R4 Fill", color=color.rgb(220, 50, 47, 60))//red fill(p4, p5, title="R4R5 Fill", color=color.rgb(203, 75, 22, 65))//brred fill(p5, p6, title="R5R6 Fill", color=color.rgb(181, 137, 0, 70))//yellow fill(p6, p7, title="R6R7 Fill", color=color.rgb(133, 153, 0, 75))//green fill(p7, p8, title="R7R8 Fill", color=color.rgb(42, 161, 152, 80))//cyan // Indicator horizontal lines obPlot = hline(-20, title="Upper Band", linestyle=hline.style_solid, color=color.rgb(133, 153, 0, 90), linewidth=1)//green hline(-35, title="Middle Level", linestyle=hline.style_dotted, color=color.rgb(133, 153, 0, 60), linewidth=1)//green hline(-50, title="Center Level", linestyle=hline.style_dotted, color=color.rgb(133, 153, 0, 0), linewidth=1)//green hline(-65, title="Middle Level", linestyle=hline.style_dotted, color=color.rgb(133, 153, 0, 60), linewidth=1)//green osPlot = hline(-80, title="Lower Band", linestyle=hline.style_solid, color=color.rgb(133, 153, 0, 90), linewidth=1)//green fill(obPlot, osPlot, title="Background", color=color.rgb(181, 137, 0, 97))//yellow //NOTES // //Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584... // //COLOR SCHEMES // //SOLARIZED by Ethan Schoonover at ethanschoonover.com //NAME HEX RGB //brblack #002b36 0, 43, 54 //black #073642 7, 54, 66 //brgreen #586e75 88, 110, 117 //bryellow #657b83 101, 123, 131 //brblue #839496 131, 148, 150 //brcyan #93a1a1 147, 161, 161 //white #eee8d5 238, 232, 213 //brwhite #fdf6e3 253, 246, 227 //yellow #b58900 181, 137, 0 //brred #cb4b16 203, 75, 22 //red #dc322f 220, 50, 47 //magenta #d33682 211, 54, 130 //brmagenta #6c71c4 108, 113, 196 //blue #268bd2 38, 139, 210 //cyan #2aa198 42, 161, 152 //green #859900 133, 153, 0 // // ONE HALF DARK by Son A. Pham at github.com/sonph/onehalf // HEX RGB // black #282c34 40, 44, 52 // red #e06c75 224, 108, 117 // green #98c379 152, 195, 121 // yellow #e5c07b 229, 192, 123 // blue #61afef 97, 175, 239 // magenta #c678dd 198, 120, 221 // cyan #56b6c2 86, 182, 194 // white #dcdfe4 220, 223, 228 // foreground #dcdfe4 220, 223, 228 // background #282c34 40, 44, 52 // //END
MultipSMMA 5-9-13-21-35-50-100 @trueenight
https://www.tradingview.com/script/bIArBZt3/
By_VoLkaNNN
https://www.tradingview.com/u/By_VoLkaNNN/
9
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/ // Β© volkyyy06 //@version=4 study("MultipSMMA 5-9-13-21-35-50-100", overlay = true) getSma(src, len) => float smma = 0.0000000 // len = input(7, minval=1, title="Length") // src = input(close, title="Source") smma := na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len //plot(smma, color=color.red) smma plot(getSma(close, input(5, "Sma 5 ")),"sma5", color=#ff0000) plot(getSma(close, input(9, "Sma 9 ")),"sma9", color=#ff4d00) plot(getSma(close, input(13, "Sma 13 ")),"sma13", color=#ff9800) // plot(sma18,"sma18", color=color.green) plot(getSma(close, input(21, "Sma 21 ")),"sma21", color=#c27ba0, linewidth=3) plot(getSma(close, input(35, "Sma 35 ")),"sma35", color=#00ffff) plot(getSma(close, input(50, "Sma 50 ")),"sma50", color=#ff00ff, linewidth=3) plot(getSma(close, input(100, "Sma 100 ")),"sma100", color=color.yellow, linewidth=3)
Cloud Ribbon ++ by [JohnnySnow]
https://www.tradingview.com/script/9DI5Tz1X-Cloud-Ribbon-by-JohnnySnow/
jmgneves
https://www.tradingview.com/u/jmgneves/
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/ // © jmgneves // Yet Another Ribbon // Inspired by my favorite EMA ribbon - "EMA Ribbon [Krypt]" by fskrypt. // This Ribbon ADD the option to choose the avarage algorithm of the ribbon [ "EMA", "SMA", "VWMA", "WMA", "HMA" ]. // Created also to be more friendly to read along with trendlines and Fibonacci retracements. // For those like me that NOT use this ribbon to find exact price action but instead, to have a grasp of possible Support/Resistance straight ahead. // High transparency lines and a configurable color palette for filling the background give the ribbon a look of support/ Resistance cloud Strenght. // Each MA length, line, and background color can be easily configured. // Enjoy //@version=5 indicator(title = "Cloud Ribbon ++ by [JohnnySnow]" , shorttitle = "Cloud Ribbon ++", overlay = true) algorithm = input.string(defval = "EMA" , title = "Choose an avarage algorithm to apply", options = [ "EMA", "SMA", "VWMA", "WMA", "HMA" ], group = "🟠 Moving Avarage Type 🟠" ) length_0 = input.int(20, title="EMA 0 length", minval=1, group = "🟠 Ribbon's EMA Lengths 🟠") length_1 = input.int(25, title="EMA 1 length", minval=1, group = "🟠 Ribbon's EMA Lengths 🟠") length_2 = input.int(30, title="EMA 2 length", minval=1, group = "🟠 Ribbon's EMA Lengths 🟠") length_3 = input.int(35, title="EMA 3 length", minval=1, group = "🟠 Ribbon's EMA Lengths 🟠") length_4 = input.int(40, title="EMA 4 length", minval=1, group = "🟠 Ribbon's EMA Lengths 🟠") length_5 = input.int(45, title="EMA 5 length", minval=1, group = "🟠 Ribbon's EMA Lengths 🟠") length_6 = input.int(50, title="EMA 6 length", minval=1, group = "🟠 Ribbon's EMA Lengths 🟠") length_7 = input.int(55, title="EMA 7 length", minval=1, group = "🟠 Ribbon's EMA Lengths 🟠") color_0 = input.color(defval = #90caf9, title = "Color EMA 0", group = "🟠 Ribbon's Palette 🟠" ) color_1 = input.color(defval = #64b5f6, title = "Color EMA 1", group = "🟠 Ribbon's Palette 🟠" ) color_2 = input.color(defval = #42a5f5, title = "Color EMA 2", group = "🟠 Ribbon's Palette 🟠" ) color_3 = input.color(defval = #2196f3, title = "Color EMA 3", group = "🟠 Ribbon's Palette 🟠" ) color_4 = input.color(defval = #1e88e5, title = "Color EMA 4", group = "🟠 Ribbon's Palette 🟠" ) color_5 = input.color(defval = #1976d2, title = "Color EMA 5", group = "🟠 Ribbon's Palette 🟠" ) color_6 = input.color(defval = #1565c0, title = "Color EMA 6", group = "🟠 Ribbon's Palette 🟠" ) color_7 = input.color(defval = #0d47a1, title = "Color EMA 7", group = "🟠 Ribbon's Palette 🟠" ) lines_transparency= input.int(100, title="LenesTransparency", minval=0, maxval=100, group = "🟠 Ribbon's EMA color Transparency 🟠") fill_transparency_0 = input.int(85, title="background 0 Transparency", minval=0, maxval=100, group = "🟠 Ribbon's EMA color Transparency 🟠") fill_transparency_1 = input.int(85, title="background 1 Transparency", minval=0, maxval=100, group = "🟠 Ribbon's EMA color Transparency 🟠") fill_transparency_2 = input.int(85, title="background 2 Transparency", minval=0, maxval=100, group = "🟠 Ribbon's EMA color Transparency 🟠") fill_transparency_3 = input.int(85, title="background 3 Transparency", minval=0, maxval=100, group = "🟠 Ribbon's EMA color Transparency 🟠") fill_transparency_4 = input.int(85, title="background 4 Transparency", minval=0, maxval=100, group = "🟠 Ribbon's EMA color Transparency 🟠") fill_transparency_5 = input.int(85, title="background 5 Transparency", minval=0, maxval=100, group = "🟠 Ribbon's EMA color Transparency 🟠") fill_transparency_6 = input.int(85, title="background 6 Transparency", minval=0, maxval=100, group = "🟠 Ribbon's EMA color Transparency 🟠") lines_width = input.int(1, title="Line Width", minval=1, group = "🟠 Lines Width 🟠") last_line_width = input.int(1, title="Line Width", minval=1, group = "🟠 Lines Width 🟠") dropn(src, n) => na(src[n]) ? na : src src = input(close, "Source", group = "🟠 Source 🟠") dropCandles = input.int(1, minval=0, title="Drop first N candles") price = dropn(src, dropCandles) ta_exec(price, length, ma) => def = switch ma "EMA" => ta.ema(price, length ) "SMA" => ta.sma(price, length ) "VWMA" => ta.vwma(price, length ) "WMA" => ta.wma(price, length ) "HMA" => ta.hma(price, length ) => ta.ema(price, length ) line_plot_0 =plot(ta_exec(price, length_0, algorithm), title="Avarage Length 0", color=color_0, transp=lines_transparency, linewidth=lines_width) line_plot_1 =plot(ta_exec(price, length_1, algorithm), title="Avarage Length 1", color=color_1, transp=lines_transparency, linewidth=lines_width) line_plot_2 =plot(ta_exec(price, length_2, algorithm), title="Avarage Length 2", color=color_2, transp=lines_transparency, linewidth=lines_width) line_plot_3 =plot(ta_exec(price, length_3, algorithm), title="Avarage Length 3", color=color_3, transp=lines_transparency, linewidth=lines_width) line_plot_4 =plot(ta_exec(price, length_4, algorithm), title="Avarage Length 4", color=color_4, transp=lines_transparency, linewidth=lines_width) line_plot_5 =plot(ta_exec(price, length_5, algorithm), title="Avarage Length 5", color=color_5, transp=lines_transparency, linewidth=lines_width) line_plot_6 =plot(ta_exec(price, length_6, algorithm), title="Avarage Length 6", color=color_6, transp=lines_transparency, linewidth=lines_width) line_plot_7 =plot(ta_exec(price, length_7, algorithm), title="Avarage Length 7", color=color_7, transp=lines_transparency, linewidth=last_line_width) fill(line_plot_0, line_plot_1, color=color_0,transp=fill_transparency_0) fill(line_plot_1, line_plot_2, color=color_1,transp=fill_transparency_1) fill(line_plot_2, line_plot_3, color=color_2,transp=fill_transparency_2) fill(line_plot_3, line_plot_4, color=color_3,transp=fill_transparency_3) fill(line_plot_4, line_plot_5, color=color_4,transp=fill_transparency_4) fill(line_plot_5, line_plot_6, color=color_5,transp=fill_transparency_5) fill(line_plot_6, line_plot_7, color=color_6,transp=fill_transparency_6)
MMRI+MA
https://www.tradingview.com/script/7GLK0mXM-MMRI-MA/
Pogchamp99
https://www.tradingview.com/u/Pogchamp99/
123
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/ // Β© WingsFarm //@version=5 indicator('MMRI+MA') US10Y = nz(request.security('TVC:US10Y', timeframe.period, close)) DXY = nz(request.security('TVC:DXY', timeframe.period, close)) X = (US10Y * DXY)/1.61 len = input.int(21, minval=1, title="Length") out = ta.sma(X, len) plot(X) plot(out, color = color.new(color.red, 0))
Strength Momentum Indicator
https://www.tradingview.com/script/6h8WGEJM-Strength-Momentum-Indicator/
parrabram
https://www.tradingview.com/u/parrabram/
50
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/ // Β© parrabram - Inpired by LazyBear; JoshJaySalazar //@version=5 indicator("Strength Momentum Indicator", "STRMOM") // Input srt = input(13, "Short Period", "This is the number used to calculate the periods of both the RSI and the ADX") lng = input(21, "Long Period", "This is the number of periods used to calculate the linear regression curve") ovs = input(70, "Oversold", "Oversold RSI") ovb = input(30, "Overbought", "Overbought RSI") crs = input(25, "Crossover", "ADX Crossover") src = input(close, "Source") mat = input.string("EMA", "MA Type", ["SMA", "EMA"]) // Calculate RSI rsi = if ta.rsi(src, srt) > ovs or ta.rsi(src, srt) < ovb true else false // Calculate LRC mac = if mat == "EMA" true else false lrc = if mac ta.linreg(src - math.avg(math.avg(ta.highest(high, lng), ta.lowest(low, lng)), ta.ema(src, lng)), lng, 0) else ta.linreg(src - math.avg(math.avg(ta.highest(high, lng), ta.lowest(low, lng)), ta.sma(src, lng)), lng, 0) cga = if rsi #fbc02d else color.lime cgb = if rsi #fff176 else color.maroon cfa = if rsi #fff176 else color.green cfb = if rsi #fbc02d else color.red hst = lrc >= 0 ? lrc[1] < lrc ? cga : cfa : lrc[1] < lrc ? cgb : cfb // Calculate ADX [dlp, dlm, adx] = ta.dmi(srt, srt) clr = adx >= crs ? adx >= adx[1] ? color.orange : #ffcc80 : adx >= adx[1] ? color.blue : #90caf9 // Plot plot(lrc, "LRC", hst, 4, plot.style_histogram) plot(0, "ADX", clr, 2, plot.style_cross)
LoTek - Horizontal Multi Time-Frame EMAs
https://www.tradingview.com/script/eptyLWen-LoTek-Horizontal-Multi-Time-Frame-EMAs/
lotekjunky
https://www.tradingview.com/u/lotekjunky/
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/ // Β© LoTek // Original idea from @Cryptastico // Understanding and implementation of settings lifted from The_Caretaker // Use this script to make money //@version=5 indicator(shorttitle="LoTek - H. MTF EMAs", title="LoTek - Horizontal Multi Time-Frame EMAs - Draft", overlay=true) var color c_txt = color.new (color.white, 0 ) var color c_e1 = color.new (color.green, 0 ) var color c_e2 = color.new (color.blue, 0 ) var color c_e3 = color.new (color.red, 0 ) var color c_e4 = color.new (color.aqua, 0 ) var color c_e5 = color.new (color.fuchsia, 0 ) var color c_e6 = color.new (color.orange, 0 ) var color c_e7 = color.new (color.silver, 0 ) var color c_e8 = color.new (color.olive, 0 ) var float minBarTime = 999999999999 currentTime = time(timeframe.period) timeOfCurrentBar = ta.change(currentTime, 1) minBarTime := not na(minBarTime) ? math.min(timeOfCurrentBar, minBarTime) : timeOfCurrentBar // Begin settings show_lbl = input.bool ( true, ' Show Labels ', inline = '1', group = ' Labels') //show_sqz = input.bool ( true, ' Show Labels ', inline = '1', group = ' Labels') show_ema1 = input.bool ( true, ' MA 1 ', inline = 'MA 1', group = ' Moving Averages') i_col_e1 = input.color ( c_e1, ' : ', inline = 'MA 1', group = ' Moving Averages') i_len_e1 = input.int ( 10, ' RSI Length ', minval=1, inline = 'MA 1', group = ' Moving Averages') i_res_e1 = input.timeframe ( 'D', ' Resolution ', options=['D', '480', '360', '240', '120'], inline = 'MA 1', group = ' Moving Averages') show_ema2 = input.bool ( false, ' MA 2 ', inline = 'MA 2', group = ' Moving Averages') i_col_e2 = input.color ( c_e2, ' : ', inline = 'MA 2', group = ' Moving Averages') i_len_e2 = input.int ( 13, ' RSI Length ', minval=1, inline = 'MA 2', group = ' Moving Averages') i_res_e2 = input.timeframe ( 'D', ' Resolution ', options=['D', '480', '360', '240', '120'], inline = 'MA 2', group = ' Moving Averages') show_ema3 = input.bool ( true, ' MA 3 ', inline = 'MA 3', group = ' Moving Averages') i_col_e3 = input.color ( c_e3, ' : ', inline = 'MA 3', group = ' Moving Averages') i_len_e3 = input.int ( 21, ' RSI Length ', minval=1, inline = 'MA 3', group = ' Moving Averages') i_res_e3 = input.timeframe ( 'D', ' Resolution ', options=['D', '480', '360', '240', '120'], inline = 'MA 3', group = ' Moving Averages') show_ema4 = input.bool ( true, ' MA 4 ', inline = 'MA 4', group = ' Moving Averages') i_col_e4 = input.color ( c_e4, ' : ', inline = 'MA 4', group = ' Moving Averages') i_len_e4 = input.int ( 50, ' RSI Length ', minval=1, inline = 'MA 4', group = ' Moving Averages') i_res_e4 = input.timeframe ( 'D', ' Resolution ', options=['D', '480', '360', '240', '120'], inline = 'MA 4', group = ' Moving Averages') show_ema5 = input.bool ( false, ' MA 5 ', inline = 'MA 5', group = ' Moving Averages') i_col_e5 = input.color ( c_e5, ' : ', inline = 'MA 5', group = ' Moving Averages') i_len_e5 = input.int ( 89, ' RSI Length ', minval=1, inline = 'MA 5', group = ' Moving Averages') i_res_e5 = input.timeframe ( 'D', ' Resolution ', options=['D', '480', '360', '240', '120'], inline = 'MA 5', group = ' Moving Averages') show_ema6 = input.bool ( true, ' MA 6 ', inline = 'MA 6', group = ' Moving Averages') i_col_e6 = input.color ( c_e6, ' : ', inline = 'MA 6', group = ' Moving Averages') i_len_e6 = input.int ( 100, ' RSI Length ', minval=1, inline = 'MA 6', group = ' Moving Averages') i_res_e6 = input.timeframe ( 'D', ' Resolution ', options=['D', '480', '360', '240', '120'], inline = 'MA 6', group = ' Moving Averages') show_ema7 = input.bool ( true, ' MA 7 ', inline = 'MA 7', group = ' Moving Averages') i_col_e7 = input.color ( c_e7, ' : ', inline = 'MA 7', group = ' Moving Averages') i_len_e7 = input.int ( 200, ' RSI Length ', minval=1, inline = 'MA 7', group = ' Moving Averages') i_res_e7 = input.timeframe ( 'D', ' Resolution ', options=['D', '480', '360', '240', '120'], inline = 'MA 7', group = ' Moving Averages') show_ema8 = input.bool ( false, ' MA 8 ', inline = 'MA 8', group = ' Moving Averages') i_col_e8 = input.color ( c_e8, ' : ', inline = 'MA 8', group = ' Moving Averages') i_len_e8 = input.int ( 800, ' RSI Length ', minval=1, inline = 'MA 8', group = ' Moving Averages') i_res_e8 = input.timeframe ( 'D', ' Resolution ', options=['D', '480', '360', '240', '120'], inline = 'MA 8', group = ' Moving Averages') // Plot the horizontal lines //EMA1 10 ema1 = show_ema1 ? request.security(syminfo.tickerid, i_res_e1, ta.ema(close, i_len_e1), lookahead=barmerge.lookahead_on) : na plot(ema1[0], trackprice=true, offset=-9999, color=i_col_e1, linewidth=4, title='EMA 1') //EMA2 13 ema2 = show_ema2 ? request.security(syminfo.tickerid, i_res_e2, ta.ema(close, i_len_e2), lookahead=barmerge.lookahead_on) : na plot(ema2[0], trackprice=true, offset=-9999, color=i_col_e2, linewidth=4, title='EMA 2') //EMA3 21 ema3 = show_ema3 ? request.security(syminfo.tickerid, i_res_e3, ta.ema(close, i_len_e3), lookahead=barmerge.lookahead_on) : na plot(ema3[0], trackprice=true, offset=-9999, color=i_col_e3, linewidth=4, title='EMA 3') //EMA4 55 ema4 = show_ema4 ? request.security(syminfo.tickerid, i_res_e4, ta.ema(close, i_len_e4), lookahead=barmerge.lookahead_on) : na plot(ema4[0], trackprice=true, offset=-9999, color=i_col_e4, linewidth=4, title='EMA 4') //EMA5 89 ema5 = show_ema5 ? request.security(syminfo.tickerid, i_res_e5, ta.ema(close, i_len_e5), lookahead=barmerge.lookahead_on) : na plot(ema5[0], trackprice=true, offset=-9999, color=i_col_e5, linewidth=4, title='EMA 5') //EMA6 100 ema6 = show_ema6 ? request.security(syminfo.tickerid, i_res_e6, ta.ema(close, i_len_e6), lookahead=barmerge.lookahead_on) : na plot(ema6[0], trackprice=true, offset=-9999, color=i_col_e6, linewidth=4, title='EMA 6') //EMA7 200 ema7 = show_ema7 ? request.security(syminfo.tickerid, i_res_e7, ta.ema(close, i_len_e7), lookahead=barmerge.lookahead_on) : na plot(ema7[0], trackprice=true, offset=-9999, color=i_col_e7, linewidth=4, title='EMA 7') //EMA8 800 ema8 = show_ema8 ? request.security(syminfo.tickerid, i_res_e8, ta.ema(close, i_len_e8), lookahead=barmerge.lookahead_on) : na plot(ema8[0], trackprice=true, offset=-9999, color=i_col_e8, linewidth=4, title='EMA 8') // Apply labels if needed if show_lbl //EMA1 var label l_e1 = label.new(bar_index, close, str.tostring(i_res_e1) + ' ' + str.tostring(i_len_e1), xloc=xloc.bar_time, style=label.style_none, size=size.huge) label.set_textcolor(l_e1, i_col_e1) label.set_textalign(l_e1, text.align_center) label.set_x(l_e1, int(currentTime - 1000000000)) label.set_y(l_e1, ema1[0]) //EMA2 var label l_e2 = label.new(bar_index, close, str.tostring(i_res_e2) + ' ' + str.tostring(i_len_e2), xloc=xloc.bar_time, style=label.style_none, size=size.huge) label.set_textcolor(l_e2, i_col_e2) label.set_textalign(l_e2, text.align_center) label.set_x(l_e2, int(currentTime - 10000000)) label.set_y(l_e2, ema2[0]) //EMA3 var label l_e3 = label.new(bar_index, close, str.tostring(i_res_e3) + ' ' + str.tostring(i_len_e3), xloc=xloc.bar_time, style=label.style_none, size=size.huge) label.set_textcolor(l_e3, i_col_e3) label.set_textalign(l_e3, text.align_center) label.set_x(l_e3, int(currentTime - 1000000000)) label.set_y(l_e3, ema3[0]) //EMA4 var label l_e4 = label.new(bar_index, close, str.tostring(i_res_e4) + ' ' + str.tostring(i_len_e4), xloc=xloc.bar_time, style=label.style_none, size=size.huge) label.set_textcolor(l_e4, i_col_e4) label.set_textalign(l_e4, text.align_center) label.set_x(l_e4, int(currentTime - 1000000000)) label.set_y(l_e4, ema4[0]) //EMA5 var label l_e5 = label.new(bar_index, close, str.tostring(i_res_e6) + ' ' + str.tostring(i_len_e5), xloc=xloc.bar_time, style=label.style_none, size=size.huge) label.set_textcolor(l_e5, i_col_e5) label.set_textalign(l_e5, text.align_center) label.set_x(l_e5, int(currentTime - 1000000000)) label.set_y(l_e5, ema5[0]) //EMA2 var label l_e6 = label.new(bar_index, close, str.tostring(i_res_e6) + ' ' + str.tostring(i_len_e6), xloc=xloc.bar_time, style=label.style_none, size=size.huge) label.set_textcolor(l_e6, i_col_e6) label.set_textalign(l_e6, text.align_center) label.set_x(l_e6, int(currentTime - 10000000)) label.set_y(l_e6, ema6[0]) //EMA7 var label l_e7 = label.new(bar_index, close, str.tostring(i_res_e7) + ' ' + str.tostring(i_len_e7), xloc=xloc.bar_time, style=label.style_none, size=size.huge) label.set_textcolor(l_e7, i_col_e7) label.set_textalign(l_e7, text.align_center) label.set_x(l_e7, int(currentTime - 1000000000)) label.set_y(l_e7, ema7[0]) //EMA8 var label l_e8 = label.new(bar_index, close, str.tostring(i_res_e8) + ' ' + str.tostring(i_len_e8), xloc=xloc.bar_time, style=label.style_none, size=size.huge) label.set_textcolor(l_e8, i_col_e8) label.set_textalign(l_e8, text.align_center) label.set_x(l_e8, int(currentTime - 1000000000)) label.set_y(l_e8, ema8[0]) //if show_sqz //coming soon, draw symbols on chart to indicate a prime squeeze
EMA TrendSurfer - RamRapolu
https://www.tradingview.com/script/FQwzs2Ek-EMA-TrendSurfer-RamRapolu/
RamRapolu
https://www.tradingview.com/u/RamRapolu/
8
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/ // Β© RamRapolu //@version=5 indicator('EMA TrendSurfer', overlay=true) ema4 = ta.ema(close, 4) ema6 = ta.ema(close, 6) ema8 = ta.ema(close, 8) ema12 = ta.ema(close, 12) ema15 = ta.ema(close, 15) ema18 = ta.ema(close, 18) ema21_middle = ta.ema(close, 21) ema30 = ta.ema(close, 30) ema35 = ta.ema(close, 35) ema40 = ta.ema(close, 40) ema45 = ta.ema(close, 45) ema50 = ta.ema(close, 50) ema60 = ta.ema(close, 60) plot(series=ema4, color=color.new(color.blue, 0), linewidth=2) plot(series=ema6, color=color.new(color.blue, 0), linewidth=2) plot(series=ema8, color=color.new(color.blue, 0), linewidth=2) plot(series=ema12, color=color.new(color.blue, 0), linewidth=2) plot(series=ema15, color=color.new(color.blue, 0), linewidth=2) plot(series=ema21_middle, color=color.new(color.yellow, 0), linewidth=2) plot(series=ema30, color=color.new(color.red, 0), linewidth=2) plot(series=ema35, color=color.new(color.red, 0), linewidth=2) plot(series=ema40, color=color.new(color.red, 0), linewidth=2) plot(series=ema45, color=color.new(color.red, 0), linewidth=2) plot(series=ema50, color=color.new(color.red, 0), linewidth=2) plot(series=ema60, color=color.new(color.green, 0), linewidth=2)
Support Resistance Interactive
https://www.tradingview.com/script/irqbPJsI-Support-Resistance-Interactive/
LonesomeTheBlue
https://www.tradingview.com/u/LonesomeTheBlue/
9,278
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/ // Β© LonesomeTheBlue //@version=5 indicator("Support Resistance Interactive", overlay=true) srnum = input.int(defval = 5, title = "Number of Support/Resistance", minval = 1, maxval = 5, confirm=true, group = "Setup", tooltip = "you can set the number of S/R levels to be shown") threshold = input.float(defval = 1., title = "% Threshold", minval = 0, group = "Setup", tooltip = "it's calculated using % of the distance between highest/lowest in last 300 bars") float thold = (ta.highest(300) - ta.lowest(300)) * math.max(threshold, 0.1) / 100. // get SR levels interactively and assign it to the array var float [] srarray = array.from( srnum > 0 ? input.price(0.0, title="S/R level 1", confirm=true, group = "Setup") : na, srnum > 1 ? input.price(0.0, title="S/R level 2", confirm=true, group = "Setup") : na, srnum > 2 ? input.price(0.0, title="S/R level 3", confirm=true, group = "Setup") : na, srnum > 3 ? input.price(0.0, title="S/R level 4", confirm=true, group = "Setup") : na, srnum > 4 ? input.price(0.0, title="S/R level 5", confirm=true, group = "Setup") : na) // colors and labels supportcol = input.color(defval = color.rgb(0, 255, 0, 50), title = "Support/Resistance", inline ="srcol", group = "Colors") resistancecol = input.color(defval = color.rgb(255, 0, 0, 50), title = "", inline ="srcol", group = "Colors") notrcol = input.color(defval = color.rgb(100, 100, 100, 50), title = "", inline ="srcol", group = "Colors") showlabel = input.bool(defval = true, title = "Label", inline = "labs", group = "Colors") labelloc = input.int(defval = 40, title = "Location +-", inline = "labs", group = "Colors") supporttcol = input.color(defval = color.white, title = "Text Color", inline ="srtcol", group = "Colors") resistancetcol = input.color(defval = color.white, title = "", inline ="srtcol", group = "Colors") notrtcol = input.color(defval = color.white, title = "", inline ="srtcol", group = "Colors") // variables for the alert supportBroken = -1 resistanceBroken = -1 priceisSRzone = -1 //run on the last bar if barstate.islast var box [] srzones = array.new_box(5, na) var label [] plabels = array.new_label(5, na) for x = 0 to 4 // no more SR levels? if na(array.get(srarray, x)) break // draw SR zones box.delete(array.get(srzones, x)) label.delete(array.get(plabels, x)) col = close > array.get(srarray, x) + thold ? supportcol : close < array.get(srarray, x) - thold ? resistancecol : notrcol tcol = close > array.get(srarray, x) + thold ? supporttcol : close < array.get(srarray, x) - thold ? resistancetcol : notrtcol array.set(srzones, x, box.new( bar_index - 280, array.get(srarray, x) + thold, bar_index, array.get(srarray, x) - thold, bgcolor = col, border_width = 0, extend = extend.right)) //show labels if showlabel array.set(plabels, x, label.new(bar_index + labelloc, array.get(srarray, x), text = "SR: " + str.tostring(x+1) + " Upper: " + str.tostring(math.round_to_mintick(array.get(srarray, x) + thold)) + " Lower: " + str.tostring(math.round_to_mintick(array.get(srarray, x) - thold)), color = col, textcolor = tcol)) // check for the alerts if close[1] <= array.get(srarray, x) + thold and close > array.get(srarray, x) + thold resistanceBroken := x if close[1] >= array.get(srarray, x) - thold and close < array.get(srarray, x) - thold supportBroken := x if close >= array.get(srarray, x) - thold and close <= array.get(srarray, x) + thold priceisSRzone := x // alerts enablesrbroken = input.bool(defval = true, title = "SR Broken Alert", inline = "srb", group = "Alerts") supporsrbrknfreq = input.string(defval = alert.freq_once_per_bar, title = "", options = [alert.freq_once_per_bar, alert.freq_once_per_bar_close], inline = "srb", group = "Alerts") enablepiz = input.bool(defval = true, title = "Price in SR Zone Alert", inline = "piz", group = "Alerts") pizfreq = input.string(defval = alert.freq_once_per_bar_close, title = "", options = [alert.freq_once_per_bar, alert.freq_once_per_bar_close], inline = "piz", group = "Alerts") if enablesrbroken if supportBroken >= 0 alert("Support Broken, Close :" + str.tostring(close) + " Support :" + str.tostring(math.round_to_mintick(array.get(srarray, supportBroken) - thold)), supporsrbrknfreq) if resistanceBroken >= 0 alert("Resistance Broken, Close :" + str.tostring(close) + " Resistance :" + str.tostring(math.round_to_mintick(array.get(srarray, resistanceBroken) + thold)), supporsrbrknfreq) if enablepiz and priceisSRzone >= 0 alert("Price in SR Zone, Close :" + str.tostring(close) + " Upper Band :" + str.tostring(math.round_to_mintick(array.get(srarray, priceisSRzone)) + thold) + " Lower Band :" + str.tostring(math.round_to_mintick(array.get(srarray, priceisSRzone)) - thold), pizfreq)
Pluto Star - Bollinger Band Trap
https://www.tradingview.com/script/7AWjKRHP-Pluto-Star-Bollinger-Band-Trap/
MotiRakam
https://www.tradingview.com/u/MotiRakam/
174
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/ //@version=4 //DESCRIPTION //Pluto star appears on a chart when price goes in the in the extreme price range territory, i.e. beyond 2 standard deviation from the mean (or mid Bollinger Band). //What makes a Pluto Star appear on a chart: //1. Check if the candle[1]'s' high and low, both are completely outside of the Bollinger Bands (close, 20, 2) - Lets call it Pluto Star Candle //2. Pluto Star Candle must not be a result of sudden price movement. Hence the previous candle[2] must give a BB Blast. // In other words, the candle[2] must have it's either open or close outside of Bollinger Bands, to confirm a BB Blast before the Pluto Star //3. Candle, following the Pluto Star must not break the high (in case of upper BB i.e. short call) or low (in case of lower BB, i.e. long call), to confirm the reversal to the mean // This implies that Pluto Star appears on chart, above/below the next candle of actual Pluto Star Candle //----- The above 3 conditions make a Pluto Star appear on a chart. But one must wait for a trade signal. Read the following conditions //4. There is a signal line, which is nothing but ema(close,5) //5. The red dotted line is the signal range (and also acts as Stop Loss). The price must close above/below the signal line within the signal range //6. For a red Pluto Star (short call), the price must close below the signal line, within next 6 candles (signal range). Else there is no trigger for a trade //7. For a green Pluto Star (long call), the price must close above the signal line, within next 6 candles (signal range). Else there is no trigger for a trade //8. If any of the candle crosses the Stop Loss line within signal range, there is no trigger for a trade //9. In a normal scenario, the price must return to the mean, i.e. mid Bollinger Band. In best case scenario, it must go to the opposite side Bollinger Band. //Recommendation: Test it with Nifty and Bank Nifty charts on 30 mins and 1 hour timeframes study(title="Pluto", overlay=true) var bool isPlutoS = false var bool isPlutoL = false //Read BB data [mBB, uBB, lBB] = bb(close, 20, 2) //Check if there previous candle was a Pluto Star Candle for Long call if (high < high[1]) and (high[1] > uBB[1]) and (low[1] > uBB[1]) and ((open[2] > uBB[2]) or (close[2] > uBB[2])) isPlutoS := true else isPlutoS := false //Check if there previous candle was a Pluto Star Candle for Long call if (low > low[1]) and (high[1] < lBB[1]) and (low[1] < lBB[1]) and ((open[2] < lBB[2]) or (close[2] < lBB[2])) isPlutoL := true else isPlutoL := false //Plot signal line ema5 = ema(close, 5) plot(ema5, color=color.gray, style=plot.style_line, linewidth=1,title="Signal Line") //Plot the star above/below the current candle plotchar(isPlutoS, title="SELL", char='β˜…', location=location.abovebar, color=color.red, size=size.small) plotchar(isPlutoL, title="BUY", char='β˜…', location=location.belowbar, color=color.green, size=size.small) //Plot the signal range and stop loss dotted line if isPlutoS and (high[2] > high[1]) line.new(bar_index[1], high[2], bar_index+5, high[2], style=line.style_dotted, color=color.red, width=2) if isPlutoS and (high[2] < high[1]) line.new(bar_index[1], high[1], bar_index+5, high[1], style=line.style_dotted, color=color.red, width=2) if isPlutoL and (low[2] < low[1]) line.new(bar_index[1], low[2], bar_index+5, low[2], style=line.style_dotted, color=color.red, width=2) if isPlutoL and (low[2] > low[1]) line.new(bar_index[1], low[1], bar_index+5, low[1], style=line.style_dotted, color=color.red, width=2) isPlutoS := false isPlutoL := false
Half-Pi Cycle CKB top indicator (insanely experimental)
https://www.tradingview.com/script/3JcnerbP-Half-Pi-Cycle-CKB-top-indicator-insanely-experimental/
UselessSoftware
https://www.tradingview.com/u/UselessSoftware/
27
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/ // Β© BilzerianCandle //@version=4 study("Half-Pi Cycle CKB top indicator", shorttitle="Half-Pi Cycle", overlay=true) len_ma_long = input(175, minval=1, title="Long Moving Average") len_ma_short = input(56, minval=1, title="Short Moving Average") resolution = input('D', type=input.string, title="Time interval") is_show_ma = input(false, type=input.bool, title="Show Moving Averages ?") is_alert = input(true, type=input.bool, title="Send an alert on Half-Pi Cycle Top?") ma_long = security(syminfo.tickerid, resolution, sma(close, len_ma_long)*2) ma_short = security(syminfo.tickerid, resolution, sma(close, len_ma_short)) src = security(syminfo.tickerid, resolution, close) plot(is_show_ma?ma_long:na, color=color.green) plot(is_show_ma?ma_short:na, color=color.red) PiCycleTop = crossunder(ma_long, ma_short) ? src + (src/100 * 10) : na plotshape(PiCycleTop, style=shape.labeldown,size=size.normal, text="Half-Pi Cycle top", color=color.red, textcolor=color.white, location=location.absolute) alertcondition(condition=PiCycleTop, title="Half-Pi Cycle", message="The Half-Pi Cycle Top has been reached, historically CKB tops within 3 days of reaching this ratio")
Advanced Comparison Tool
https://www.tradingview.com/script/qDlaQeK1-Advanced-Comparison-Tool/
QuantNomad
https://www.tradingview.com/u/QuantNomad/
608
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/ // Β© QuantNomad //@version=5 indicator("Advanced Comparison Tool", shorttitle = "Comp", overlay = true) t = input.time(timestamp("01 Jan 2022 00:00 +0000"), "Bar", confirm = true) ///////////// // SYMBOLS // u01 = input.bool(true, title = "", group = 'Symbols', inline = 's01') u02 = input.bool(true, title = "", group = 'Symbols', inline = 's02') u03 = input.bool(true, title = "", group = 'Symbols', inline = 's03') u04 = input.bool(true, title = "", group = 'Symbols', inline = 's04') u05 = input.bool(true, title = "", group = 'Symbols', inline = 's05') u06 = input.bool(true, title = "", group = 'Symbols', inline = 's06') u07 = input.bool(true, title = "", group = 'Symbols', inline = 's07') u08 = input.bool(true, title = "", group = 'Symbols', inline = 's08') u09 = input.bool(true, title = "", group = 'Symbols', inline = 's09') u10 = input.bool(true, title = "", group = 'Symbols', inline = 's10') u11 = input.bool(true, title = "", group = 'Symbols', inline = 's11') u12 = input.bool(true, title = "", group = 'Symbols', inline = 's12') u13 = input.bool(true, title = "", group = 'Symbols', inline = 's13') u14 = input.bool(true, title = "", group = 'Symbols', inline = 's14') u15 = input.bool(true, title = "", group = 'Symbols', inline = 's15') u16 = input.bool(true, title = "", group = 'Symbols', inline = 's16') u17 = input.bool(true, title = "", group = 'Symbols', inline = 's17') u18 = input.bool(true, title = "", group = 'Symbols', inline = 's18') u19 = input.bool(true, title = "", group = 'Symbols', inline = 's19') u20 = input.bool(true, title = "", group = 'Symbols', inline = 's20') u21 = input.bool(true, title = "", group = 'Symbols', inline = 's21') u22 = input.bool(true, title = "", group = 'Symbols', inline = 's22') u23 = input.bool(true, title = "", group = 'Symbols', inline = 's23') u24 = input.bool(true, title = "", group = 'Symbols', inline = 's24') u25 = input.bool(true, title = "", group = 'Symbols', inline = 's25') u26 = input.bool(true, title = "", group = 'Symbols', inline = 's26') u27 = input.bool(true, title = "", group = 'Symbols', inline = 's27') u28 = input.bool(true, title = "", group = 'Symbols', inline = 's28') u29 = input.bool(true, title = "", group = 'Symbols', inline = 's29') u30 = input.bool(true, title = "", group = 'Symbols', inline = 's30') u31 = input.bool(false, title = "", group = 'Symbols', inline = 's31') u32 = input.bool(false, title = "", group = 'Symbols', inline = 's32') s01 = input.symbol('XRPUSDT', group = 'Symbols', inline = 's01') s02 = input.symbol('BTCUSDT', group = 'Symbols', inline = 's02') s03 = input.symbol('DOGEUSDT', group = 'Symbols', inline = 's03') s04 = input.symbol('BNBUSDT', group = 'Symbols', inline = 's04') s05 = input.symbol('ETHUSDT', group = 'Symbols', inline = 's05') s06 = input.symbol('ADAUSDT', group = 'Symbols', inline = 's06') s07 = input.symbol('XRPBTC', group = 'Symbols', inline = 's07') s08 = input.symbol('DOGEBTC', group = 'Symbols', inline = 's08') s09 = input.symbol('TRXUSDT', group = 'Symbols', inline = 's09') s10 = input.symbol('BTCBUSD', group = 'Symbols', inline = 's10') s11 = input.symbol('ETHBUSD', group = 'Symbols', inline = 's11') s12 = input.symbol('BNBBUSD', group = 'Symbols', inline = 's12') s13 = input.symbol('VETUSDT', group = 'Symbols', inline = 's13') s14 = input.symbol('ETHBTC', group = 'Symbols', inline = 's14') s15 = input.symbol('BNBBTC', group = 'Symbols', inline = 's15') s16 = input.symbol('EOSUSDT', group = 'Symbols', inline = 's16') s17 = input.symbol('XLMUSDT', group = 'Symbols', inline = 's17') s18 = input.symbol('LTCUSDT', group = 'Symbols', inline = 's18') s19 = input.symbol('XRPBUSD', group = 'Symbols', inline = 's19') s20 = input.symbol('WINUSDT', group = 'Symbols', inline = 's20') s21 = input.symbol('DOTUSDT', group = 'Symbols', inline = 's21') s22 = input.symbol('BTTUSDT', group = 'Symbols', inline = 's22') s23 = input.symbol('BCHUSDT', group = 'Symbols', inline = 's23') s24 = input.symbol('ADABTC', group = 'Symbols', inline = 's24') s25 = input.symbol('IOSTUSDT', group = 'Symbols', inline = 's25') s26 = input.symbol('CHZUSDT', group = 'Symbols', inline = 's26') s27 = input.symbol('LINKUSDT', group = 'Symbols', inline = 's27') s28 = input.symbol('TRXBTC', group = 'Symbols', inline = 's28') s29 = input.symbol('DOGEBUSD', group = 'Symbols', inline = 's29') s30 = input.symbol('BTCEUR', group = 'Symbols', inline = 's30') s31 = input.symbol('FILUSDT', group = 'Symbols', inline = 's31') s32 = input.symbol('HOTUSDT', group = 'Symbols', inline = 's32') c01 = input.color(#CF3476, title = '', group = 'Symbols', inline = 's01') c02 = input.color(#57A639, title = '', group = 'Symbols', inline = 's02') c03 = input.color(#F44611, title = '', group = 'Symbols', inline = 's03') c04 = input.color(#DE4C8A, title = '', group = 'Symbols', inline = 's04') c05 = input.color(#6C6960, title = '', group = 'Symbols', inline = 's05') c06 = input.color(#20214F, title = '', group = 'Symbols', inline = 's06') c07 = input.color(#C1876B, title = '', group = 'Symbols', inline = 's07') c08 = input.color(#6D3F5B, title = '', group = 'Symbols', inline = 's08') c09 = input.color(#4E3B31, title = '', group = 'Symbols', inline = 's09') c10 = input.color(#B8B799, title = '', group = 'Symbols', inline = 's10') c11 = input.color(#2D572C, title = '', group = 'Symbols', inline = 's11') c12 = input.color(#2F4538, title = '', group = 'Symbols', inline = 's12') c13 = input.color(#686C5E, title = '', group = 'Symbols', inline = 's13') c14 = input.color(#8F8B66, title = '', group = 'Symbols', inline = 's14') c15 = input.color(#3E3B32, title = '', group = 'Symbols', inline = 's15') c16 = input.color(#1E213D, title = '', group = 'Symbols', inline = 's16') c17 = input.color(#26252D, title = '', group = 'Symbols', inline = 's17') c18 = input.color(#CF3476, title = '', group = 'Symbols', inline = 's18') c19 = input.color(#B44C43, title = '', group = 'Symbols', inline = 's19') c20 = input.color(#35682D, title = '', group = 'Symbols', inline = 's20') c21 = input.color(#CF3476, title = '', group = 'Symbols', inline = 's21') c22 = input.color(#57A639, title = '', group = 'Symbols', inline = 's22') c23 = input.color(#F44611, title = '', group = 'Symbols', inline = 's23') c24 = input.color(#DE4C8A, title = '', group = 'Symbols', inline = 's24') c25 = input.color(#6C6960, title = '', group = 'Symbols', inline = 's25') c26 = input.color(#20214F, title = '', group = 'Symbols', inline = 's26') c27 = input.color(#C1876B, title = '', group = 'Symbols', inline = 's27') c28 = input.color(#6D3F5B, title = '', group = 'Symbols', inline = 's28') c29 = input.color(#4E3B31, title = '', group = 'Symbols', inline = 's29') c30 = input.color(#B8B799, title = '', group = 'Symbols', inline = 's30') c31 = input.color(#2D572C, title = '', group = 'Symbols', inline = 's31') c32 = input.color(#2F4538, title = '', group = 'Symbols', inline = 's32') /////////////// // FUNCTIONS // // Get only symbol only_symbol(s) => array.get(str.split(s, ":"), 1) ////////////////// // CALCULATIONS // pnl01 = request.security(s01, timeframe.period, close / close[1] - 1) pnl02 = request.security(s02, timeframe.period, close / close[1] - 1) pnl03 = request.security(s03, timeframe.period, close / close[1] - 1) pnl04 = request.security(s04, timeframe.period, close / close[1] - 1) pnl05 = request.security(s05, timeframe.period, close / close[1] - 1) pnl06 = request.security(s06, timeframe.period, close / close[1] - 1) pnl07 = request.security(s07, timeframe.period, close / close[1] - 1) pnl08 = request.security(s08, timeframe.period, close / close[1] - 1) pnl09 = request.security(s09, timeframe.period, close / close[1] - 1) pnl10 = request.security(s10, timeframe.period, close / close[1] - 1) pnl11 = request.security(s11, timeframe.period, close / close[1] - 1) pnl12 = request.security(s12, timeframe.period, close / close[1] - 1) pnl13 = request.security(s13, timeframe.period, close / close[1] - 1) pnl14 = request.security(s14, timeframe.period, close / close[1] - 1) pnl15 = request.security(s15, timeframe.period, close / close[1] - 1) pnl16 = request.security(s16, timeframe.period, close / close[1] - 1) pnl17 = request.security(s17, timeframe.period, close / close[1] - 1) pnl18 = request.security(s18, timeframe.period, close / close[1] - 1) pnl19 = request.security(s19, timeframe.period, close / close[1] - 1) pnl20 = request.security(s20, timeframe.period, close / close[1] - 1) pnl21 = request.security(s21, timeframe.period, close / close[1] - 1) pnl22 = request.security(s22, timeframe.period, close / close[1] - 1) pnl23 = request.security(s23, timeframe.period, close / close[1] - 1) pnl24 = request.security(s24, timeframe.period, close / close[1] - 1) pnl25 = request.security(s25, timeframe.period, close / close[1] - 1) pnl26 = request.security(s26, timeframe.period, close / close[1] - 1) pnl27 = request.security(s27, timeframe.period, close / close[1] - 1) pnl28 = request.security(s28, timeframe.period, close / close[1] - 1) pnl29 = request.security(s29, timeframe.period, close / close[1] - 1) pnl30 = request.security(s30, timeframe.period, close / close[1] - 1) pnl31 = request.security(s31, timeframe.period, close / close[1] - 1) pnl32 = request.security(s32, timeframe.period, close / close[1] - 1) // Define initial vars float pnl_cum01 = na float pnl_cum02 = na float pnl_cum03 = na float pnl_cum04 = na float pnl_cum05 = na float pnl_cum06 = na float pnl_cum07 = na float pnl_cum08 = na float pnl_cum09 = na float pnl_cum10 = na float pnl_cum11 = na float pnl_cum12 = na float pnl_cum13 = na float pnl_cum14 = na float pnl_cum15 = na float pnl_cum16 = na float pnl_cum17 = na float pnl_cum18 = na float pnl_cum19 = na float pnl_cum20 = na float pnl_cum21 = na float pnl_cum22 = na float pnl_cum23 = na float pnl_cum24 = na float pnl_cum25 = na float pnl_cum26 = na float pnl_cum27 = na float pnl_cum28 = na float pnl_cum29 = na float pnl_cum30 = na float pnl_cum31 = na float pnl_cum32 = na float first_close = na first_close := time == t ? close : nz(first_close[1]) pnl_cum_cur = close / first_close - 1 pnl_cum01 := time == t ? 0 : time > t ? (1 + pnl_cum01[1]) * (1 + pnl01) - 1 : pnl_cum01 pnl_cum02 := time == t ? 0 : time > t ? (1 + pnl_cum02[1]) * (1 + pnl02) - 1 : pnl_cum02 pnl_cum03 := time == t ? 0 : time > t ? (1 + pnl_cum03[1]) * (1 + pnl03) - 1 : pnl_cum03 pnl_cum04 := time == t ? 0 : time > t ? (1 + pnl_cum04[1]) * (1 + pnl04) - 1 : pnl_cum04 pnl_cum05 := time == t ? 0 : time > t ? (1 + pnl_cum05[1]) * (1 + pnl05) - 1 : pnl_cum05 pnl_cum06 := time == t ? 0 : time > t ? (1 + pnl_cum06[1]) * (1 + pnl06) - 1 : pnl_cum06 pnl_cum07 := time == t ? 0 : time > t ? (1 + pnl_cum07[1]) * (1 + pnl07) - 1 : pnl_cum07 pnl_cum08 := time == t ? 0 : time > t ? (1 + pnl_cum08[1]) * (1 + pnl08) - 1 : pnl_cum08 pnl_cum09 := time == t ? 0 : time > t ? (1 + pnl_cum09[1]) * (1 + pnl09) - 1 : pnl_cum09 pnl_cum10 := time == t ? 0 : time > t ? (1 + pnl_cum10[1]) * (1 + pnl10) - 1 : pnl_cum10 pnl_cum11 := time == t ? 0 : time > t ? (1 + pnl_cum11[1]) * (1 + pnl11) - 1 : pnl_cum11 pnl_cum12 := time == t ? 0 : time > t ? (1 + pnl_cum12[1]) * (1 + pnl12) - 1 : pnl_cum12 pnl_cum13 := time == t ? 0 : time > t ? (1 + pnl_cum13[1]) * (1 + pnl13) - 1 : pnl_cum13 pnl_cum14 := time == t ? 0 : time > t ? (1 + pnl_cum14[1]) * (1 + pnl14) - 1 : pnl_cum14 pnl_cum15 := time == t ? 0 : time > t ? (1 + pnl_cum15[1]) * (1 + pnl15) - 1 : pnl_cum15 pnl_cum16 := time == t ? 0 : time > t ? (1 + pnl_cum16[1]) * (1 + pnl16) - 1 : pnl_cum16 pnl_cum17 := time == t ? 0 : time > t ? (1 + pnl_cum17[1]) * (1 + pnl17) - 1 : pnl_cum17 pnl_cum18 := time == t ? 0 : time > t ? (1 + pnl_cum18[1]) * (1 + pnl18) - 1 : pnl_cum18 pnl_cum19 := time == t ? 0 : time > t ? (1 + pnl_cum19[1]) * (1 + pnl19) - 1 : pnl_cum19 pnl_cum20 := time == t ? 0 : time > t ? (1 + pnl_cum20[1]) * (1 + pnl20) - 1 : pnl_cum20 pnl_cum21 := time == t ? 0 : time > t ? (1 + pnl_cum21[1]) * (1 + pnl21) - 1 : pnl_cum21 pnl_cum22 := time == t ? 0 : time > t ? (1 + pnl_cum22[1]) * (1 + pnl22) - 1 : pnl_cum22 pnl_cum23 := time == t ? 0 : time > t ? (1 + pnl_cum23[1]) * (1 + pnl23) - 1 : pnl_cum23 pnl_cum24 := time == t ? 0 : time > t ? (1 + pnl_cum24[1]) * (1 + pnl24) - 1 : pnl_cum24 pnl_cum25 := time == t ? 0 : time > t ? (1 + pnl_cum25[1]) * (1 + pnl25) - 1 : pnl_cum25 pnl_cum26 := time == t ? 0 : time > t ? (1 + pnl_cum26[1]) * (1 + pnl26) - 1 : pnl_cum26 pnl_cum27 := time == t ? 0 : time > t ? (1 + pnl_cum27[1]) * (1 + pnl27) - 1 : pnl_cum27 pnl_cum28 := time == t ? 0 : time > t ? (1 + pnl_cum28[1]) * (1 + pnl28) - 1 : pnl_cum28 pnl_cum29 := time == t ? 0 : time > t ? (1 + pnl_cum29[1]) * (1 + pnl29) - 1 : pnl_cum29 pnl_cum30 := time == t ? 0 : time > t ? (1 + pnl_cum30[1]) * (1 + pnl30) - 1 : pnl_cum30 pnl_cum31 := time == t ? 0 : time > t ? (1 + pnl_cum31[1]) * (1 + pnl31) - 1 : pnl_cum31 pnl_cum32 := time == t ? 0 : time > t ? (1 + pnl_cum32[1]) * (1 + pnl32) - 1 : pnl_cum32 plot(first_close * (pnl_cum01 + 1), title = 'S01', color = u01 ? c01 : color.new(color.white, 100)) plot(first_close * (pnl_cum02 + 1), title = 'S02', color = u02 ? c02 : color.new(color.white, 100)) plot(first_close * (pnl_cum03 + 1), title = 'S03', color = u03 ? c03 : color.new(color.white, 100)) plot(first_close * (pnl_cum04 + 1), title = 'S04', color = u04 ? c04 : color.new(color.white, 100)) plot(first_close * (pnl_cum05 + 1), title = 'S05', color = u05 ? c05 : color.new(color.white, 100)) plot(first_close * (pnl_cum06 + 1), title = 'S06', color = u06 ? c06 : color.new(color.white, 100)) plot(first_close * (pnl_cum07 + 1), title = 'S07', color = u07 ? c07 : color.new(color.white, 100)) plot(first_close * (pnl_cum08 + 1), title = 'S08', color = u08 ? c08 : color.new(color.white, 100)) plot(first_close * (pnl_cum09 + 1), title = 'S09', color = u09 ? c09 : color.new(color.white, 100)) plot(first_close * (pnl_cum10 + 1), title = 'S10', color = u10 ? c10 : color.new(color.white, 100)) plot(first_close * (pnl_cum11 + 1), title = 'S11', color = u11 ? c11 : color.new(color.white, 100)) plot(first_close * (pnl_cum12 + 1), title = 'S12', color = u12 ? c12 : color.new(color.white, 100)) plot(first_close * (pnl_cum13 + 1), title = 'S13', color = u13 ? c13 : color.new(color.white, 100)) plot(first_close * (pnl_cum14 + 1), title = 'S14', color = u14 ? c14 : color.new(color.white, 100)) plot(first_close * (pnl_cum15 + 1), title = 'S15', color = u15 ? c15 : color.new(color.white, 100)) plot(first_close * (pnl_cum16 + 1), title = 'S16', color = u16 ? c16 : color.new(color.white, 100)) plot(first_close * (pnl_cum17 + 1), title = 'S17', color = u17 ? c17 : color.new(color.white, 100)) plot(first_close * (pnl_cum18 + 1), title = 'S18', color = u18 ? c18 : color.new(color.white, 100)) plot(first_close * (pnl_cum19 + 1), title = 'S19', color = u19 ? c19 : color.new(color.white, 100)) plot(first_close * (pnl_cum20 + 1), title = 'S20', color = u20 ? c20 : color.new(color.white, 100)) plot(first_close * (pnl_cum21 + 1), title = 'S21', color = u21 ? c21 : color.new(color.white, 100)) plot(first_close * (pnl_cum22 + 1), title = 'S22', color = u22 ? c22 : color.new(color.white, 100)) plot(first_close * (pnl_cum23 + 1), title = 'S23', color = u23 ? c23 : color.new(color.white, 100)) plot(first_close * (pnl_cum24 + 1), title = 'S24', color = u24 ? c24 : color.new(color.white, 100)) plot(first_close * (pnl_cum25 + 1), title = 'S25', color = u25 ? c25 : color.new(color.white, 100)) plot(first_close * (pnl_cum26 + 1), title = 'S26', color = u26 ? c26 : color.new(color.white, 100)) plot(first_close * (pnl_cum27 + 1), title = 'S27', color = u27 ? c27 : color.new(color.white, 100)) plot(first_close * (pnl_cum28 + 1), title = 'S28', color = u28 ? c28 : color.new(color.white, 100)) plot(first_close * (pnl_cum29 + 1), title = 'S29', color = u29 ? c29 : color.new(color.white, 100)) plot(first_close * (pnl_cum30 + 1), title = 'S30', color = u30 ? c30 : color.new(color.white, 100)) plot(first_close * (pnl_cum31 + 1), title = 'S31', color = u31 ? c31 : color.new(color.white, 100)) plot(first_close * (pnl_cum32 + 1), title = 'S32', color = u32 ? c32 : color.new(color.white, 100)) //////////////// // PLOT TABLE // var tbl = table.new(position.bottom_left, 3, 42, frame_color=#151715, frame_width=1, border_width=2, border_color=color.new(color.white, 100)) if barstate.islast table.cell(tbl, 0, 0, 'Symbol', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 0, 'P&L', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 0, 'Color', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 0, 1, "Current", text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 1, str.tostring(pnl_cum_cur * 100, '.##') + '%', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 1, '', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.auto) if (u01) table.cell(tbl, 0, 2, only_symbol(s01), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 2, str.tostring(pnl_cum01 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 2, '', text_halign = text.align_center, bgcolor = c01, text_color = color.white, text_size = size.auto) if (u02) table.cell(tbl, 0, 3, only_symbol(s02), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 3, str.tostring(pnl_cum02 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 3, '', text_halign = text.align_center, bgcolor = c02, text_color = color.white, text_size = size.auto) if (u03) table.cell(tbl, 0, 4, only_symbol(s03), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 4, str.tostring(pnl_cum03 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 4, '', text_halign = text.align_center, bgcolor = c03, text_color = color.white, text_size = size.auto) if (u04) table.cell(tbl, 0, 5, only_symbol(s04), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 5, str.tostring(pnl_cum04 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 5, '', text_halign = text.align_center, bgcolor = c04, text_color = color.white, text_size = size.auto) if (u05) table.cell(tbl, 0, 6, only_symbol(s05), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 6, str.tostring(pnl_cum05 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 6, '', text_halign = text.align_center, bgcolor = c05, text_color = color.white, text_size = size.auto) if (u06) table.cell(tbl, 0, 7, only_symbol(s06), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 7, str.tostring(pnl_cum06 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 7, '', text_halign = text.align_center, bgcolor = c06, text_color = color.white, text_size = size.auto) if (u07) table.cell(tbl, 0, 8, only_symbol(s07), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 8, str.tostring(pnl_cum07 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 8, '', text_halign = text.align_center, bgcolor = c07, text_color = color.white, text_size = size.auto) if (u08) table.cell(tbl, 0, 9, only_symbol(s08), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 9, str.tostring(pnl_cum08 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 9, '', text_halign = text.align_center, bgcolor = c08, text_color = color.white, text_size = size.auto) if (u09) table.cell(tbl, 0, 10, only_symbol(s09), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 10, str.tostring(pnl_cum09 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 10, '', text_halign = text.align_center, bgcolor = c09, text_color = color.white, text_size = size.auto) if (u10) table.cell(tbl, 0, 11, only_symbol(s10), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 11, str.tostring(pnl_cum10 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 11, '', text_halign = text.align_center, bgcolor = c10, text_color = color.white, text_size = size.auto) if (u11) table.cell(tbl, 0, 12, only_symbol(s11), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 12, str.tostring(pnl_cum11 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 12, '', text_halign = text.align_center, bgcolor = c11, text_color = color.white, text_size = size.auto) if (u12) table.cell(tbl, 0, 13, only_symbol(s12), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 13, str.tostring(pnl_cum12 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 13, '', text_halign = text.align_center, bgcolor = c12, text_color = color.white, text_size = size.auto) if (u13) table.cell(tbl, 0, 14, only_symbol(s13), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 14, str.tostring(pnl_cum13 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 14, '', text_halign = text.align_center, bgcolor = c13, text_color = color.white, text_size = size.auto) if (u14) table.cell(tbl, 0, 15, only_symbol(s14), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 15, str.tostring(pnl_cum14 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 15, '', text_halign = text.align_center, bgcolor = c14, text_color = color.white, text_size = size.auto) if (u15) table.cell(tbl, 0, 16, only_symbol(s15), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 16, str.tostring(pnl_cum15 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 16, '', text_halign = text.align_center, bgcolor = c15, text_color = color.white, text_size = size.auto) if (u16) table.cell(tbl, 0, 17, only_symbol(s16), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 17, str.tostring(pnl_cum16 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 17, '', text_halign = text.align_center, bgcolor = c16, text_color = color.white, text_size = size.auto) if (u17) table.cell(tbl, 0, 18, only_symbol(s17), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 18, str.tostring(pnl_cum17 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 18, '', text_halign = text.align_center, bgcolor = c17, text_color = color.white, text_size = size.auto) if (u18) table.cell(tbl, 0, 19, only_symbol(s18), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 19, str.tostring(pnl_cum18 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 19, '', text_halign = text.align_center, bgcolor = c18, text_color = color.white, text_size = size.auto) if (u19) table.cell(tbl, 0, 20, only_symbol(s19), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 20, str.tostring(pnl_cum19 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 20, '', text_halign = text.align_center, bgcolor = c19, text_color = color.white, text_size = size.auto) if (u20) table.cell(tbl, 0, 21, only_symbol(s20), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 21, str.tostring(pnl_cum20 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 21, '', text_halign = text.align_center, bgcolor = c20, text_color = color.white, text_size = size.auto) if (u21) table.cell(tbl, 0, 22, only_symbol(s21), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 22, str.tostring(pnl_cum21 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 22, '', text_halign = text.align_center, bgcolor = c21, text_color = color.white, text_size = size.auto) if (u22) table.cell(tbl, 0, 23, only_symbol(s22), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 23, str.tostring(pnl_cum22 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 23, '', text_halign = text.align_center, bgcolor = c22, text_color = color.white, text_size = size.auto) if (u23) table.cell(tbl, 0, 24, only_symbol(s23), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 24, str.tostring(pnl_cum23 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 24, '', text_halign = text.align_center, bgcolor = c23, text_color = color.white, text_size = size.auto) if (u24) table.cell(tbl, 0, 25, only_symbol(s24), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 25, str.tostring(pnl_cum24 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 25, '', text_halign = text.align_center, bgcolor = c24, text_color = color.white, text_size = size.auto) if (u25) table.cell(tbl, 0, 26, only_symbol(s25), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 26, str.tostring(pnl_cum25 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 26, '', text_halign = text.align_center, bgcolor = c25, text_color = color.white, text_size = size.auto) if (u26) table.cell(tbl, 0, 27, only_symbol(s26), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 27, str.tostring(pnl_cum26 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 27, '', text_halign = text.align_center, bgcolor = c26, text_color = color.white, text_size = size.auto) if (u27) table.cell(tbl, 0, 28, only_symbol(s27), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 28, str.tostring(pnl_cum27 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 28, '', text_halign = text.align_center, bgcolor = c27, text_color = color.white, text_size = size.auto) if (u28) table.cell(tbl, 0, 29, only_symbol(s28), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 29, str.tostring(pnl_cum28 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 29, '', text_halign = text.align_center, bgcolor = c28, text_color = color.white, text_size = size.auto) if (u29) table.cell(tbl, 0, 30, only_symbol(s29), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 30, str.tostring(pnl_cum29 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 30, '', text_halign = text.align_center, bgcolor = c29, text_color = color.white, text_size = size.auto) if (u30) table.cell(tbl, 0, 31, only_symbol(s30), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 31, str.tostring(pnl_cum30 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 31, '', text_halign = text.align_center, bgcolor = c30, text_color = color.white, text_size = size.auto) if (u31) table.cell(tbl, 0, 32, only_symbol(s31), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 32, str.tostring(pnl_cum31 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 32, '', text_halign = text.align_center, bgcolor = c31, text_color = color.white, text_size = size.auto) if (u32) table.cell(tbl, 0, 33, only_symbol(s32), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.auto) table.cell(tbl, 1, 33, str.tostring(pnl_cum32 * 100, '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.auto) table.cell(tbl, 2, 33, '', text_halign = text.align_center, bgcolor = c32, text_color = color.white, text_size = size.auto)
Rebalance as a Bear/Bull indicator
https://www.tradingview.com/script/Y0omflqx-Rebalance-as-a-Bear-Bull-indicator/
hugodanielcom
https://www.tradingview.com/u/hugodanielcom/
34
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/ // Β© hugodanielcom //@version=5 // // Welcome, this is an indicator of a simple idea to check if the market has a Bear or Bull tendency: // // 1. Start with a virtual portfolio of 60/40 tokens per fiat. // 2. Rebalance it when its ratio oscillates by a given % (first input) // 3. Count the number of times the rebalancer buys, and sells // 4. When the number of buys is greater than the number of sells => the market is going down // 5. When the number of sells is greater than the number of buys => the market is going up // // This is shown as the "Bear/Bull Strength" columns (red when bear, green when bull) // // An extra rebalancer is also kept that works at each bar (regardless of the input %). // This is used to calculate an amount of tokens beying sold/bought and used as a "market force" coefficient. // // Another extra: based on both the bear/bull strengh and market force an attempt is made to // provide good buying/selling windows of analysis. // The blue background is a buying opportunity, the red background is a sell opportunity. // In a bear market sales are delayed, and in a bull market buys are delayed. // // This code uses the following public libraries: import hugodanielcom/TradingPortfolio/1 as portfolio import hugodanielcom/PureRebalance/3 as rebalancer // These are available here: https://www.tradingview.com/u/hugodanielcom/#published-scripts indicator("Rebalance as a Bear/Bull indicator") rebull_rebear_precision = input.float(defval = 3, title = "Rebalance when portfolio differs by %", tooltip="Bigger values make the rebalance hold more and become less sensitive to peaks/bottoms and act less often.", minval = 0.1, maxval = 99.9) rebull_rebear_from_month = input.int(defval = 11, title = "Start At Month", minval = 1, maxval = 12) rebull_rebear_from_day = input.int(defval = 1, title = "Start At Day", minval = 1, maxval = 31) rebull_rebear_from_year = input.int(defval = 2021, title = "Start At Year", minval = 2020) rebull_rebear_capital = input.float(defval = 10000, title = "Initial capital", minval = 1, tooltip="The total portfolio value to start with. A higher value makes the rebalancer more sensitive to peaks/bottoms and act more often") rebull_rebear_percentage = input.float(defval = 60, title = "Rebalance Token %", minval = 0.01, maxval = 100.0, tooltip="Percentage of Token / Money.\n60 means the targeted balance is 60% token and 40% money") rebull_rebear_show_force = input.bool(defval = false, title = "Show force") rebull_rebear_show_opos = input.bool(defval = true, title = "Show buy/sell windows of opportunities") // Backtest start window rebull_rebear_start = timestamp(rebull_rebear_from_year, rebull_rebear_from_month, rebull_rebear_from_day) // Function returns true when the current bar time is // "within the window of time" for this indicator rebull_rebear_window() => time >= rebull_rebear_start var float[] percentage_portfolio = portfolio.init() var float[] signal_portfolio = portfolio.init() // Initialization starts by doing a rebalance at the first bar within // the window var bool rebull_rebear_init1 = true if rebull_rebear_window() and rebull_rebear_init1 // Only do this once, for the first bar, set init1 to false to disallow // this block from running again rebull_rebear_init1 := false first_rebalance_amount = rebalancer.rebalance(close, 0.0, rebull_rebear_capital, rebull_rebear_percentage / 100) portfolio.set_balance(percentage_portfolio, first_rebalance_amount, rebull_rebear_capital - (first_rebalance_amount * close)) float signal_capital = close*100.0 signal_first_rebalance_amount = rebalancer.rebalance(close, 0.0, signal_capital, rebull_rebear_percentage / 100) portfolio.set_balance(signal_portfolio, signal_first_rebalance_amount, signal_capital - (signal_first_rebalance_amount * close)) var float signal = 0.0 float signal_rebalance_amount = rebalancer.rebalance(close, portfolio.crypto(signal_portfolio), portfolio.fiat(signal_portfolio), rebull_rebear_percentage / 100.0) float signal_percentage_change = math.abs(signal_rebalance_amount) / portfolio.crypto(signal_portfolio) bool signal_is_rebalance_needed = signal_percentage_change >= ((rebull_rebear_precision / 4.0) / 100.0) bool signal_is_rebalance_buying = signal_is_rebalance_needed and signal_rebalance_amount > 0 bool signal_is_rebalance_selling = signal_is_rebalance_needed and signal_rebalance_amount < 0 // This is where the rebalance gets done float percentage_rebalance_amount = rebalancer.rebalance(close, portfolio.crypto(percentage_portfolio), portfolio.fiat(percentage_portfolio), rebull_rebear_percentage / 100.0) // Check if the amount to rebalance is bigger than the percentage float percentage_change = math.abs(percentage_rebalance_amount) / portfolio.crypto(percentage_portfolio) bool percentage_is_rebalance_needed = percentage_change >= (rebull_rebear_precision / 100.0) bool percentage_is_rebalance_buying = percentage_is_rebalance_needed and percentage_rebalance_amount > 0 bool percentage_is_rebalance_selling = percentage_is_rebalance_needed and percentage_rebalance_amount < 0 var int bear_bull_balance = 0 var int bear_balance = 0 var int bull_balance = 0 var int signal_bear_balance = 0 var int signal_bull_balance = 0 var float percentage_signal = 0.0 // Update the percentage portfolio and the signal portfolio number of operations // and bear/bull market balance. The values calculated here will then be used // to set the "market_value" and "signal_market_value" below, which are the // main indicators of the bear/bull market strength. if rebull_rebear_window() if percentage_is_rebalance_buying portfolio.buy(percentage_portfolio, percentage_rebalance_amount, close) bear_balance += 1 if percentage_is_rebalance_selling portfolio.sell(percentage_portfolio, math.abs(percentage_rebalance_amount), close) bull_balance += 1 if signal_is_rebalance_buying if portfolio.buy(signal_portfolio, signal_rebalance_amount, close) signal += signal_rebalance_amount signal_bear_balance += 1 if signal_is_rebalance_selling if portfolio.sell(signal_portfolio, math.abs(signal_rebalance_amount), close) signal += signal_rebalance_amount signal_bull_balance += 1 market_value = bull_balance - bear_balance signal_market_value = signal_bull_balance - signal_bear_balance // Store the signal_market_value at the entry point of a new market_value, this // is used to subtract to the current signal value, useful as an indicator of // the market force within the current market_value quantity. var market_value_start = signal_market_value if market_value[0] != market_value[1] market_value_start := signal_market_value // The colors to be used when the market is considered bear or bull bear_down_color = color.new(color.red, 15) bear_up_color = color.new(color.red, 15) bull_down_color = color.new(color.green, 15) bull_up_color = color.new(color.green, 15) // A special color to be used when it is neither. nothing_color = color.new(color.gray, 0) // By default it is neither: color market_color = nothing_color // Look at the market_value and decide which color to use market_color := nothing_color bool is_signal_going_up = signal > 0 bool is_signal_going_down = not is_signal_going_up if market_value > 0 and is_signal_going_up market_color := bull_up_color if market_value > 0 and is_signal_going_down market_color := bull_down_color if market_value < 0 and is_signal_going_up market_color := bear_up_color if market_value < 0 and is_signal_going_down market_color := bear_down_color // The market force is the second indicator that this code outputs, it represents // the tendency of the market to go up or down within a "market_value" block. force=signal_market_value - market_value_start // It can be used to find buying and selling windows bool is_selling_opportunity = force > 0 and ((market_value < 0 and force >= 3) or (market_value > 0 and force >= 2)) bool is_buying_opportunity = force < 0 and ((market_value < 0 and force <= -2) or (market_value > 0 and force <= -3)) is_buying_opportunity := is_buying_opportunity or (is_buying_opportunity[1] and close[1] > close[0]) is_selling_opportunity := is_selling_opportunity or (is_selling_opportunity[1] and close[1] <= close[0]) // Paint these extra values if they are being drawn: color force_color = na if is_selling_opportunity force_color := color.new(color.red, 80) if is_buying_opportunity force_color := color.new(color.blue, 80) // The final output bgcolor(rebull_rebear_show_opos ? force_color : na, title="Buy/Sell opportunities") plot(market_value, "Bear/Bull Strength", color=market_color, style=plot.style_area) plot(force, "Force", color=rebull_rebear_show_force ? color.orange : na) hline(0, "Middle Band", color=color.new(#787B86, 50))
Two Moving Average Cross
https://www.tradingview.com/script/3WBzrLy7-Two-Moving-Average-Cross/
darkbrewery
https://www.tradingview.com/u/darkbrewery/
62
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/ // Β© darkbrewery // @version=5 // Huge Thank-you to SGJoe and DTKing for their help! // Ehlers / Kaufman Code borrowed from Franklin Moormann (cheatcountry) indicator(title="Two Moving Average Cross", shorttitle="2MAX", overlay=true) // ---- User Settings ---- Timeframe = input.timeframe ('','TimeFrame', inline='top') Repaint = input(false,'Allow Repainting?', inline='top') MA_T1 = input.string( "Exponential", "Fast", ["Simple","Exponential","Double Exponential","Triple Exponential","Quadruple Exponential","Weighted","Volume-weighted","Hull","Symmetrical","Arnaud Legoux","Welles Wilder","Triangular","Least Squares","Relative Strength","Ehlers Kaufman"], inline="MA", group="Moving Averages") MA_S1_Input = input.source( close, "Src", inline="MA", group="Moving Averages") MA_L1 = input.int( 20, "Len", 1, 200, inline="MA", group="Moving Averages") MA_T2 = input.string( "Exponential", "Slow", ["Simple","Exponential","Double Exponential","Triple Exponential","Quadruple Exponential","Weighted","Volume-weighted","Hull","Symmetrical","Arnaud Legoux","Welles Wilder","Triangular","Least Squares","Relative Strength","Ehlers Kaufman"], inline="MA2", group="Moving Averages") MA_S2_Input = input.source( close, "Src", inline="MA2", group="Moving Averages") MA_L2 = input.int( 50,"Len", 1, 200, inline="MA2", group="Moving Averages") MA_S1 = request.security(syminfo.tickerid, Timeframe, MA_S1_Input[Repaint ? 0 : barstate.isrealtime ? 1 : 0])[Repaint ? 0 : barstate.isrealtime ? 0 : 1] MA_S2 = request.security(syminfo.tickerid, Timeframe, MA_S2_Input[Repaint ? 0 : barstate.isrealtime ? 1 : 0])[Repaint ? 0 : barstate.isrealtime ? 0 : 1] // ---- Moving Averages ---- MA_1 = switch MA_T1 "Simple" => ta.sma(MA_S1,MA_L1) "Exponential" => ta.ema(MA_S1,MA_L1) "Double Exponential" => 2 * ta.ema(MA_S1, MA_L1) - ta.ema(ta.ema(MA_S1, MA_L1), MA_L1) "Triple Exponential" => 3 * (ta.ema(MA_S1, MA_L1) - ta.ema(ta.ema(MA_S1, MA_L1), MA_L1)) + ta.ema(ta.ema(ta.ema(MA_S1, MA_L1), MA_L1), MA_L1) "Quadruple Exponential" => 5 * ta.ema(MA_S1,MA_L1) - 10 * ta.ema(ta.ema(MA_S1, MA_L1), MA_L1) + 10 * ta.ema(ta.ema(ta.ema(MA_S1, MA_L1), MA_L1), MA_L1) - 5 * ta.ema(ta.ema(ta.ema(ta.ema(MA_S1, MA_L1), MA_L1), MA_L1), MA_L1) + ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(MA_S1, MA_L1), MA_L1), MA_L1), MA_L1), MA_L1) "Weighted" => ta.wma(MA_S1,MA_L1) "Volume-weighted" => ta.vwma(MA_S1,MA_L1) "Hull" => ta.hma(MA_S1,MA_L1) "Symmetrical" => ta.swma(MA_S1) "Arnaud Legoux" => ta.alma(MA_S1, MA_L1, 0.85, 6) "Least Squares" => ta.linreg(MA_S1, MA_L1, 0) "Relative Strength" => ta.rma(MA_S1,MA_L1) "Welles Wilder" => Wilder_MA1 = .0 Wilder_MA1 := 1 / MA_L1 * MA_S1 + (1 - 1 / MA_L1) * nz(Wilder_MA1[1]) "Triangular" => ta.sma(ta.sma(MA_S1,MA_L1),MA_L1) "Ehlers Kaufman" => KA_D1 = .0 for int i = 0 to MA_L1 - 1 by 1 KA_D1 += math.abs(nz(MA_S1[i]) - nz(MA_S1[i + 1])) KA_EF1 = KA_D1 != 0 ? math.min(math.abs(MA_S1 - nz(MA_S1[MA_L1 - 1])) / KA_D1, 1) : 0 KAMA1 = .0 KAMA1 := (math.pow((0.6667 * KA_EF1) + 0.0645, 2) * MA_S1) + ((1 - math.pow((0.6667 * KA_EF1) + 0.0645, 2)) * nz(KAMA1[1])) MA_2 = switch MA_T2 "Simple" => ta.sma(MA_S2,MA_L2) "Exponential" => ta.ema(MA_S2,MA_L2) "Double Exponential" => 2 * ta.ema(MA_S2, MA_L2) - ta.ema(ta.ema(MA_S2, MA_L2), MA_L2) "Triple Exponential" => 3 * (ta.ema(MA_S2, MA_L2) - ta.ema(ta.ema(MA_S2, MA_L2), MA_L2)) + ta.ema(ta.ema(ta.ema(MA_S2, MA_L2), MA_L2), MA_L2) "Quadruple Exponential" => 5 * ta.ema(MA_S2,MA_L2) - 10 * ta.ema(ta.ema(MA_S2, MA_L2), MA_L2) + 10 * ta.ema(ta.ema(ta.ema(MA_S2, MA_L2), MA_L2), MA_L2) - 5 * ta.ema(ta.ema(ta.ema(ta.ema(MA_S2, MA_L2), MA_L2), MA_L2), MA_L2) + ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(MA_S2, MA_L2), MA_L2), MA_L2), MA_L2), MA_L2) "Weighted" => ta.wma(MA_S2,MA_L2) "Volume-weighted" => ta.vwma(MA_S2,MA_L2) "Hull" => ta.hma(MA_S2,MA_L2) "Symmetrical" => ta.swma(MA_S2) "Arnaud Legoux" => ta.alma(MA_S2, MA_L2, 0.85, 6) "Least Squares" => ta.linreg(MA_S2, MA_L2, 0) "Relative Strength" => ta.rma(MA_S2,MA_L2) "Welles Wilder" => Wilder_MA2 = .0 Wilder_MA2 := 1 / MA_L2 * MA_S2 + (1 - 1 / MA_L2) * nz(Wilder_MA2[1]) "Triangular" => ta.sma(ta.sma(MA_S2,MA_L2),MA_L2) "Ehlers Kaufman" => KA_D2 = .0 for int i = 0 to MA_L2 - 1 by 1 KA_D2 += math.abs(nz(MA_S2[i]) - nz(MA_S2[i + 1])) KA_EF2 = KA_D2 != 0 ? math.min(math.abs(MA_S2 - nz(MA_S2[MA_L2 - 1])) / KA_D2, 1) : 0 KAMA2 = .0 KAMA2 := (math.pow((0.6667 * KA_EF2) + 0.0645, 2) * MA_S2) + ((1 - math.pow((0.6667 * KA_EF2) + 0.0645, 2)) * nz(KAMA2[1])) plot(MA_1, title="Fast MA", color=color.yellow) plot(MA_2, title="Slow MA", color=color.blue) // ---- Moving Average Crossovers ---- Show_MA_Cross = input.bool(false, "Show Crossings") Bull_MA_Cross = ta.crossover(MA_1,MA_2) Bear_MA_Cross = ta.crossover(MA_2,MA_1) plotshape(Bull_MA_Cross and Show_MA_Cross, "Bullish Cross", shape.triangleup, location.belowbar, color.green, size="small") plotshape(Bear_MA_Cross and Show_MA_Cross, "Bearish Cross", shape.triangledown, location.abovebar, color.red, size="small")
RM Moving average
https://www.tradingview.com/script/Ri0kcZk4-RM-Moving-average/
ManikandanRajamani
https://www.tradingview.com/u/ManikandanRajamani/
11
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/ // Β© ManikandanRajamani //@version=5 indicator("RM Moving average tester", overlay = true) ma1 = ta.sma(close, 13) plot(ma1,"MA1",color.blue) ma2 = ta.sma(close, 34) plot(ma2,"MA2",color.red) if (ta.crossover(ma1 , ma2)) var label1 = label.new(bar_index, low, text="LONG", style=label.style_arrowup) label.set_x(label1, 0) label.set_xloc(label1, time, xloc.bar_time) label.set_yloc(label1,yloc.belowbar) label.set_color(label1, color.green) label.set_size(label1, size.normal)
Γ‡Δ°Δ°Δ°
https://www.tradingview.com/script/gn63iGJZ/
drsakok
https://www.tradingview.com/u/drsakok/
25
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/ // Β© JayTradingCharts //@version=4 //@version=4 //---- thank to mohanee for the base code. we modified this to not give entries but instead alert on the just the divs study(title="Γ‡Δ°Δ°Δ°", format=format.price, resolution="") len = input(title="RSI Period", minval=1, defval=14) src = input(title="RSI Source", defval=close) lbR = input(title="Pivot Lookback Right", defval=5) lbL = input(title="Pivot Lookback Left", defval=5) rangeUpper = input(title="Max of Lookback Range", defval=60) rangeLower = input(title="Min of Lookback Range", defval=5) plotBull = input(title="Plot Bullish", defval=true) plotHiddenBull = input(title="Plot Hidden Bullish", defval=false) plotBear = input(title="Plot Bearish", defval=true) plotHiddenBear = input(title="Plot Hidden Bearish", defval=false) 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) plot(osc, title="RSI", linewidth=2, color=#8D1699) hline(50, title="Middle Line", linestyle=hline.style_dotted) 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 ) alertcondition(bullCond, title="Bull", message="Regular Bull Div {{ticker}} XXmin") alertcondition(bearCond, title="Bear", message="Regular Bear Div {{ticker}} XXmin") alertcondition(hiddenBullCond, title="H Bull", message="Hidden Bull Div {{ticker}} XXmin") alertcondition(hiddenBearCond, title="H Bear", message="Hidden Bear Div {{ticker}} XXmin") alertcondition(bullCond or bearCond or hiddenBullCond or hiddenBullCond, title="Hepsi", message="RSI UYUMSUZLUGU")
Volatility Screener
https://www.tradingview.com/script/j2SJwoE6-Volatility-Screener/
hajixde
https://www.tradingview.com/u/hajixde/
282
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/ // Β© hajixde //@version=5 indicator("Volatility Screener", overlay = false) coin1 = input.string("WINUSDT", group = "Coins" , inline = "coins_") coin2 = input.string("DODOUSDT", group = "Coins" , inline = "coins_") coin3 = input.string("AUCTIONUSDT", group = "Coins" , inline = "coins_") coin4 = input.string("MBOXUSDT", group = "Coins" , inline = "coins_") coin5 = input.string("ETHUSDT", group = "Coins" , inline = "coins_") coin6 = input.string("BTCUSDT", group = "Coins" , inline = "coins_") coin7 = input.string("IMXUSDT", group = "Coins" , inline = "coins_") coin8 = input.string("VIDYUSDT", group = "Coins" , inline = "coins_") coin9 = input.string("ALICEUSDT", group = "Coins" , inline = "coins_") coin10 = input.string("VGXUSDT", group = "Coins" , inline = "coins_") coin11 = input.string("CTKUSDT", group = "Coins" , inline = "coins_") coin12 = input.string("BORINGUSDT", group = "Coins" , inline = "coins_") coin13 = input.string("DOGEUSDT", group = "Coins" , inline = "coins_") coin14 = input.string("SHIBUSDT", group = "Coins" , inline = "coins_") coin15 = input.string("LAMBUSDT", group = "Coins" , inline = "coins_") length = input.int(100, minval=1) minVolatility = input.float(10, title = "Minimum Volatility Percentage") volatility(src, len) => dev = ta.stdev(src, len) s = ta.sma(src, len) v = 100*dev / s v vol2price(src, volume_, len) => close24 = ta.sma(src, len) vol = ta.sma(volume_, len) x = vol*close24/1000000 x priceChange(src, len) => close24 = ta.sma(src, len) x = 100*(src - close24)/close24 x var table statTable = table.new(position.middle_center, 4, 36, bgcolor = color.black, frame_width = 1, frame_color = color.black, border_color = color.black, border_width = 1) table.cell(statTable, 0, 0, " Ticker ", text_color = color.white, bgcolor = #336688) table.cell(statTable, 1, 0, " Volatility Index", text_color = color.white, bgcolor = #336688) table.cell(statTable, 2, 0, " Volume*Price/1M", text_color = color.white, bgcolor = #336688) table.cell(statTable, 3, 0, " Price Change", text_color = color.white, bgcolor = #336688) table.cell(statTable, 0, 1, coin1, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 2, coin2, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 3, coin3, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 4, coin4, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 5, coin5, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 6, coin6, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 7, coin7, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 8, coin8, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 9, coin9, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 10, coin10, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 11, coin11, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 12, coin12, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 13, coin13, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 14, coin14, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 0, 15, coin15, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 1, 1, str.tostring(volatility(request.security(coin1, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin1, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 2, str.tostring(volatility(request.security(coin2, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin2, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 3, str.tostring(volatility(request.security(coin3, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin3, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 4, str.tostring(volatility(request.security(coin4, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin4, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 5, str.tostring(volatility(request.security(coin5, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin5, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 6, str.tostring(volatility(request.security(coin6, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin6, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 7, str.tostring(volatility(request.security(coin7, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin7, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 8, str.tostring(volatility(request.security(coin8, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin8, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 9, str.tostring(volatility(request.security(coin9, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin9, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 10, str.tostring(volatility(request.security(coin10, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin10, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 11, str.tostring(volatility(request.security(coin11, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin11, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 12, str.tostring(volatility(request.security(coin12, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin12, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 13, str.tostring(volatility(request.security(coin13, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin13, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 14, str.tostring(volatility(request.security(coin14, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin14, timeframe.period, close), length) > minVolatility ? #992266 : #998833) table.cell(statTable, 1, 15, str.tostring(volatility(request.security(coin15, timeframe.period, close), length), "#.##") + " %", text_color = color.white, bgcolor = volatility(request.security(coin15, timeframe.period, close), length) > minVolatility ? #992266 : #998833) v1 = vol2price(request.security(coin1, timeframe.period, close), request.security(coin1, timeframe.period, volume), length) table.cell(statTable, 2, 1, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin2, timeframe.period, close), request.security(coin2, timeframe.period, volume), length) table.cell(statTable, 2, 2, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin3, timeframe.period, close), request.security(coin3, timeframe.period, volume), length) table.cell(statTable, 2, 3, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin4, timeframe.period, close), request.security(coin4, timeframe.period, volume), length) table.cell(statTable, 2, 4, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin5, timeframe.period, close), request.security(coin5, timeframe.period, volume), length) table.cell(statTable, 2, 5, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin6, timeframe.period, close), request.security(coin6, timeframe.period, volume), length) table.cell(statTable, 2, 6, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin7, timeframe.period, close), request.security(coin7, timeframe.period, volume), length) table.cell(statTable, 2, 7, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin8, timeframe.period, close), request.security(coin8, timeframe.period, volume), length) table.cell(statTable, 2, 8, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin9, timeframe.period, close), request.security(coin9, timeframe.period, volume), length) table.cell(statTable, 2, 9, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin10, timeframe.period, close), request.security(coin10, timeframe.period, volume), length) table.cell(statTable, 2, 10, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin11, timeframe.period, close), request.security(coin11, timeframe.period, volume), length) table.cell(statTable, 2, 11, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin12, timeframe.period, close), request.security(coin12, timeframe.period, volume), length) table.cell(statTable, 2, 12, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin13, timeframe.period, close), request.security(coin13, timeframe.period, volume), length) table.cell(statTable, 2, 13, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin14, timeframe.period, close), request.security(coin14, timeframe.period, volume), length) table.cell(statTable, 2, 14, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := vol2price(request.security(coin15, timeframe.period, close), request.security(coin15, timeframe.period, volume), length) table.cell(statTable, 2, 15, str.tostring(v1, "#.##"), text_color = color.white, bgcolor = v1 > 1 ? #992266 : #998833) v1 := priceChange(request.security(coin1, timeframe.period, close), length) table.cell(statTable, 3, 1, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin2, timeframe.period, close), length) table.cell(statTable, 3, 2, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin3, timeframe.period, close), length) table.cell(statTable, 3, 3, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin4, timeframe.period, close), length) table.cell(statTable, 3, 4, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin5, timeframe.period, close), length) table.cell(statTable, 3, 5, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin6, timeframe.period, close), length) table.cell(statTable, 3, 6, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin7, timeframe.period, close), length) table.cell(statTable, 3, 7, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin8, timeframe.period, close), length) table.cell(statTable, 3, 8, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin9, timeframe.period, close), length) table.cell(statTable, 3, 9, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin10, timeframe.period, close), length) table.cell(statTable, 3, 10, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin11, timeframe.period, close), length) table.cell(statTable, 3, 11, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin12, timeframe.period, close), length) table.cell(statTable, 3, 12, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin13, timeframe.period, close), length) table.cell(statTable, 3, 13, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin14, timeframe.period, close), length) table.cell(statTable, 3, 14, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022) v1 := priceChange(request.security(coin15, timeframe.period, close), length) table.cell(statTable, 3, 15, str.tostring(v1, "#.##") + " %", text_color = color.white, bgcolor = v1 > 0 ? #008822 : #880022)
Moving_average-10/5
https://www.tradingview.com/script/rLc0mf3p-Moving-average-10-5/
Anurag_Gupta
https://www.tradingview.com/u/Anurag_Gupta/
81
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/ // Β© guptaanurag549 //@version=5 indicator("MovingAvg 10,5",overlay = true) fast = input.int(5, minval= 4 , maxval= 50, title="fast sma") slow = input.int(10, minval= 10 , maxval= 200, title="slow sma") slow1 = input.int(44, minval= 10 , maxval= 200, title="slow sma2") fastsma = ta.sma(close, fast) slowsma = ta.sma(close, slow) slowsma2 = ta.sma(close, slow1) candle_filter= open >= close[1] or open <= close[1] and close > open[1] candle_filter1= high >= slowsma and open <= slowsma entry_long = ta.crossover(close, slowsma) or ta.crossover(close, fastsma) and (fastsma >= slowsma) exit = ta.crossunder(close, fastsma) //not use in ranging market and take a buy trade when moving average 5 is closer and cross above moving average 10 //for exit candle close below MA5 plotshape(entry_long, title = "buy",style= shape.arrowup,text= "Buy", color=color.green,location= location.belowbar) //plotchar(exit,char="E", color=color.red,location= location.abovebar) //not use in ranging market and take a short trade when moving average 5 is closer and cross below moving average 10 //for exit candle close above MA5 entry_long2 = ta.crossunder(close, slowsma) or ta.crossunder(close, fastsma) and (fastsma <= slowsma) exit2 = ta.crossover(close, fastsma) //alert if entry_long alert("price ("+ str.tostring(close) + ") crossed over MA (" + str.tostring(entry_long) + ").", alert.freq_once_per_bar_close) if entry_long2 alert("price ("+ str.tostring(close) + ") crossed under MA (" + str.tostring(entry_long2) + ").", alert.freq_once_per_bar_close) plotshape(entry_long2,title = "Short",style= shape.arrowdown,text= "Short", color=color.green,location= location.abovebar) //plotchar(exit2,char="C", color=color.red,location= location.belowbar) buy_44 = ta.crossover(close, slowsma2) plotshape(buy_44, title = "44-crossover",style= shape.arrowup,text= "44", color=color.teal,location= location.belowbar) short_44 = ta.crossunder(close, slowsma2) plotshape(short_44,title = "44-crossunder",style= shape.arrowdown,text= "44", color=color.teal,location= location.abovebar) //plot(slowsma, title = "MA10",color= color.green, linewidth = 2) //plot(fastsma, title = "MA5",color= color.red, linewidth = 1) plot(slowsma2, title = "MA44",color= color.teal, linewidth = 2) plot1 = plot(slowsma, title = "MA10",color= color.green, linewidth = 2) plot2 = plot(fastsma, title = "MA5",color= color.red, linewidth = 1) fill(plot1, plot2, color=color.new(color.green, 90)) alertcondition(entry_long or entry_long2, title="alert condition", message= "price crossed over MA")
Dual Commodity Channel Index
https://www.tradingview.com/script/0M1x6UeM-Dual-Commodity-Channel-Index/
Morogan
https://www.tradingview.com/u/Morogan/
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/ //@version=5 //@author = Morogan //Β© Morogan //DUAL COMMODITY CHANNEL INDEX //This script plots two CCI indicators with independent lengths. It also provides a Zero line and a MACD-like histogram for reference. //Using two CCI indicators with independent lengths instead of just one provides de-noising functionality similarly to MACD. //When both CCIs cross the Zero line, it can serve as confirmation of position entry/exit. indicator(title="Dual Commodity Channel Index", shorttitle="DCCI", format=format.price, precision=2, timeframe="", timeframe_gaps=true) 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") length1 = input.int(25, minval=1) length2 = input.int(50, minval=1) src = input(hlc3, title="Source") ma1 = ta.sma(src, length1) ma2 = ta.sma(src, length2) cci1 = (src - ma1) / (0.015 * ta.dev(src, length1)) cci2 = (src - ma2) / (0.015 * ta.dev(src, length2)) hist = cci1 - cci2 plot(cci1, "CCI1", color=color.red) plot(cci2, "CCI2", color=color.blue, linewidth=2) plot(hist, "Histogram", style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : (hist[1] < hist ? col_grow_below : col_fall_below))) hline(0, title="Zero", color=color.gray, linestyle=hline.style_dotted) band1 = hline(100, "Upper Band", color=#787B86, linestyle=hline.style_dashed) band0 = hline(-100, "Lower Band", color=#787B86, linestyle=hline.style_dashed) fill(band1, band0, color=color.rgb(33, 150, 243, 90), title="Background")
Average True Range Normalized
https://www.tradingview.com/script/mjALGP0c-Average-True-Range-Normalized/
pascorp
https://www.tradingview.com/u/pascorp/
40
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/ // Based on ATR build-in indicator //@version=5 indicator(title='Average True Range Normalized', shorttitle='ATR Norm', overlay=false) // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>>>>> Input <<<<<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” length = input.int (title='ATR Period ', defval=14, minval=1, group="Core", inline="ATR") smoothing = input.string (title='Smoothing True Range', defval='Classic ATR', group="Core", inline="ATR", options=['Classic ATR', 'SMA', 'EMA', 'WMA'], tooltip="Type of moving average to smooth out the True Range: \n"+"Classic ATR: in based on rma") perNorma = input.int (title='Normalization Period      ', defval=20, minval=1, tooltip="Number of candles on which ATR normalization is based", group="Core") perMA = input.int (title='MA Period', defval=50, minval=1, group="Core", inline="MA") typeMA = input.string (title='  Type', defval='SMA', group="Core", options=[ 'SMA', 'EMA', 'WMA'], group="Core", inline="MA") hl = input.int (title="Horizontal Lines Value      ", defval=40, minval=0, group="Core") alerthl = input (title="Alert on crossing Horizonal lines", defval=false, group="Alert") alertMA = input (title="Alert on crossing MA", defval=false, group="Alert") // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>>>>> Core <<<<<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” ma_function(source, length, s) => switch s "Classic ATR" => ta.rma(source, length) "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) => ta.wma(source, length) atr = ma_function(ta.tr(true), length, smoothing) atrN = ((atr - ta.lowest(atr, perNorma)) / (ta.highest(atr, perNorma) - ta.lowest(atr, perNorma)) - 0.5) * 100 ma = ma_function(atrN, perMA, typeMA) // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>>>>> Plotting <<<<<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” plot(atrN, title='ATR', color=color.new(#B71C1C, 0)) plot(ma, title='ATR MA', color=color.new(color.yellow, 0), offset=0) hline(hl, title="Upper Level", color=color.gray, linestyle=hline.style_dotted) hline(-hl, title="Lower Level", color=color.gray, linestyle=hline.style_dotted) // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>>>>> Alert <<<<<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” if alerthl and ta.crossover(atrN,hl) alert("ATR is crossing up "+str.tostring(hl)+" level", alert.freq_once_per_bar_close) if alerthl and ta.crossunder(atrN,-hl) alert("ATR is crossing down -"+str.tostring(hl)+" level", alert.freq_once_per_bar_close) if alertMA and ta.crossover(atrN,ma) alert("ATR is crossing up Moving Average", alert.freq_once_per_bar_close) if alertMA and ta.crossunder(atrN,ma) alert("ATR is crossing down Moving Average", alert.freq_once_per_bar_close)
Order Blocks with signals
https://www.tradingview.com/script/x1krAh2y-Order-Blocks-with-signals/
Sonarlab
https://www.tradingview.com/u/Sonarlab/
7,163
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/ // Β© ClayeWeight //@version=5 indicator(title='Sonarlab - Order Blocks', shorttitle='Sonarlab - OB', overlay=true, max_boxes_count=20) _v = input.string("1.0.2", title="Version", options=["1.0.2"], group="Version") sens = input.int(28, minval=1, title='Sensitivity', group='Order Block', tooltip='Lower the sensitivity to show more order blocks. A higher sensitivity will show less order blocks.') sens /= 100 // OB OBMitigationType = input.string("Close", title="OB Mitigation Type", options=["Close", "Wick"], group="Order Block", tooltip="Choose how Order Blocks are mitigated") OBBullMitigation = OBMitigationType=="Close" ? close[1] : low OBBearMitigation = OBMitigationType=="Close" ? close[1] : high //OB Colors col_bullish = input.color(#5db49e, title="Bullish OB Border", inline="a", group="Order Block") col_bullish_ob = input.color(color.new(#64C4AC, 85), title="Background", inline="a", group="Order Block") col_bearish = input.color(#4760bb, title="Bearish OB Border", inline="b", group="Order Block") col_bearish_ob = input.color(color.new(#506CD3, 85), title="Background", inline="b", group="Order Block") // Alerts buy_alert = input.bool(title='Buy Signal', defval=true, group='Alerts', tooltip='An alert will be sent when price goes below the top of a bullish order block.') sell_alert = input.bool(title='Sell Signal', defval=true, group='Alerts', tooltip='An alert will be sent when price goes above the bottom of a bearish order block.') // Delacring Variables bool ob_created = false bool ob_created_bull = false var int cross_index = na // Declaring Box Arrays var box drawlongBox = na var longBoxes = array.new_box() var box drawShortBox = na var shortBoxes = array.new_box() // Custom Rate of Change (ROC) calculation. This is to calculate high momentum moves in the market. pc = (open - open[4]) / open[4] * 100 // If the ROC crossover our Sensitivty input - Then create an Order Block // Sensitivty is negative as this is a Bearish OB if ta.crossunder(pc, -sens) ob_created := true cross_index := bar_index cross_index // If the ROC crossover our Sensitivty input - Then create an Order Block if ta.crossover(pc, sens) ob_created_bull := true cross_index := bar_index cross_index // ------------------------------- // Bearish OB Creation // ------------------------------- // Check if we should create a OB, Also check if we haven't created an OB in the last 5 candles. if ob_created and cross_index - cross_index[1] > 5 float last_green = 0 float highest = 0 // Loop through the most recent candles and find the first GREEN (Bullish) candle. We will place our OB here. for i = 4 to 15 by 1 if close[i] > open[i] last_green := i break // Draw our OB on that candle - then push the box into our box arrays. drawShortBox := box.new(left=bar_index[last_green], top=high[last_green], bottom=low[last_green], right=bar_index[last_green], bgcolor=col_bearish_ob, border_color=col_bearish, extend=extend.right) array.push(shortBoxes, drawShortBox) // ------------------------------- // Bullish OB Creation // ------------------------------- // Check if we should create a OB, Also check if we haven't created an OB in the last 5 candles. if ob_created_bull and cross_index - cross_index[1] > 5 float last_red = 0 float highest = 0 // Loop through the most recent candles and find the first RED (Bearish) candle. We will place our OB here. for i = 4 to 15 by 1 if close[i] < open[i] last_red := i break // Draw our OB on that candle - then push the box into our box arrays. drawlongBox := box.new(left=bar_index[last_red], top=high[last_red], bottom=low[last_red], right=bar_index[last_red], bgcolor=col_bullish_ob, border_color=col_bullish, extend=extend.right) array.push(longBoxes, drawlongBox) // ----------------- Bearish Order Block ------------------- // Clean up OB boxes and place alerts if array.size(shortBoxes) > 0 for i = array.size(shortBoxes) - 1 to 0 by 1 sbox = array.get(shortBoxes, i) top = box.get_top(sbox) bot = box.get_bottom(sbox) // If the two last closes are above the high of the bearish OB - Remove the OB if OBBearMitigation > top array.remove(shortBoxes, i) box.delete(sbox) // Alerts if high > bot and sell_alert alert('Price inside Bearish OB', alert.freq_once_per_bar) // ----------------- Bullish Clean Up ------------------- // Clean up OB boxes and place alerts if array.size(longBoxes) > 0 for i = array.size(longBoxes) - 1 to 0 by 1 sbox = array.get(longBoxes, i) bot = box.get_bottom(sbox) top = box.get_top(sbox) // If the two last closes are below the low of the bullish OB - Remove the OB if OBBullMitigation < bot array.remove(longBoxes, i) box.delete(sbox) // Alerts if low < top and buy_alert alert('Price inside Bullish OB', alert.freq_once_per_bar)
TrendStrength Turbo Bars - Directional Trends
https://www.tradingview.com/script/fkcq2JFu-TrendStrength-Turbo-Bars-Directional-Trends/
Beardy_Fred
https://www.tradingview.com/u/Beardy_Fred/
349
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/ // Β© Beardy_Fred //@version=5 indicator(title="TrendStrength Turbo", shorttitle= "Trend", overlay = true) //INPUTS SourceInput = input(close, "Source") MA_L1 = input(5, "EMA Length #1") MA_L2 = input(8, "EMA Length #2") MA_L3 = input(13, "EMA Length #3") MA_L4 = input(21, "EMA Length #4") MA_L5 = input(34, "EMA Length #5") Vol_L = input(20, "Volume Length") Vol_T = input(50, "Volume Spike Trigger %") //STACKED EMAs MA1 = ta.ema(SourceInput, MA_L1) MA2 = ta.ema(SourceInput, MA_L2) MA3 = ta.ema(SourceInput, MA_L3) MA4 = ta.ema(SourceInput, MA_L4) MA5 = ta.ema(SourceInput, MA_L5) MA_Stack_Up = (MA1 > MA2) and (MA2 > MA3) and (MA3 > MA4) and (MA4 > MA5) //CONDITIONS Uptrend = MA_Stack_Up Reversal = ((MA1 < MA2) and (MA2 > MA3)) or ((MA1 > MA2) and (MA2 < MA3)) //COLOR CODING EMA_Color = Uptrend ? color.new(color.green, 0) : Reversal ? color.new(color.yellow, 0) : color.new(color.red, 0) barcolor(color=EMA_Color) //VOLUME SPIKE Vol_Spike = ta.sma(volume, Vol_L) Vol_Trigger = (1 + (Vol_T/100)) * Vol_Spike plotchar(volume > Vol_Trigger, "Volume Spike", char = 'β—‰', location = location.bottom, color = color.aqua, size = size.tiny)
Fib RSI++ by [JohnnySnow]
https://www.tradingview.com/script/65AuFthj-Fib-RSI-by-JohnnySnow/
jmgneves
https://www.tradingview.com/u/jmgneves/
80
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/ // © jmgneves // @description // RSI++ is an RSI Inspired by my absolutely favorite RSI on tradingview: RSI & EMA with Reverse Calculator Panel [pig] by balipour. // From it, I reuse balipour implementation for reversing RSI formula in order to calculate price estimation based on Given RSI level (price_by_rsi function lines [43,44,45]). // Inspired by it, I also combine RSI with a MA but tuned to reads better the support/resistance levels (my opinion). // This Indicator was built for much quickly identify prices at current RSI and possibly reversals or stops of RSI direction. // For that, gridlines based on Fib levels, standard overbought/oversold levels and other levels I personally use were added. All of the grid lines can be configured according to user preferences. // Display of 2 information tables // First with a collection of 'close' numbers and Fib RSI levels price estimations at given RSI // The second table allows the user to add up to 3 custom RSI levels to further target the price estimation. // Author UI Preferences to be used with this indicator: dark theme, hidden vertical and horizontal chart gridlines. //@version=5 indicator(title="Fib RSI++ by [JohnnySnow]", shorttitle="RSI ++", overlay=false) // # =================== Input Settings ===================== # rsi_for_price1 = input(100.0, "RSI to Price 1", group = "🟠 Custom RSI Values for price estimation 🟠") rsi_for_price2 = input(100.0, "RSI To Price 2", group = "🟠 Custom RSI Values for price estimation 🟠") rsi_for_price3 = input(100.0, "RSI To Price 3", group = "🟠 Custom RSI Values for price estimation 🟠") src = input(close, "Source", group = "🟠 Input Settings 🟠") len_rsi = input.int(14, "RSI Length", minval=2, group = "🟠 Input Settings 🟠") len_ema = input.int(48, "EMA Length", minval=2, group = "🟠 Input Settings 🟠") show_reference_table = input.bool(defval = true, title = "show RSI to Price reference table" ,group = "🟠 RSI to Price Tables 🟠" ) show_reference_custom_table = input.bool(defval = true, title = "show custom RSI to Price table", group = "🟠 RSI to Price Tables 🟠" ) tables_text_size = input.string(defval = "S" , title = "Table text size", options = [ "XS", "S" , "M" ], group = "🟠 RSI to Price Tables 🟠" ) tables_price_trailing_zeros = input.int(defval = 2 , title = "Price trailing zeros", options = [ 1 ,2,3,4,5,6,7,8,9,10 ], group = "🟠 RSI to Price Tables 🟠" ) tables_transparecy = input.int(defval = 50, title = "Set transparency level for RSI to price tables", group = "🟠 RSI to Price Tables 🟠" ) tables_standard_color = input.color(defval = #9e9e9e, title = "base color for table text", group = "🟠 RSI to Price Tables 🟠" ) tables_fib_color = input.color(defval = #ff9800, title = "base color for table text", group = "🟠 RSI to Price Tables 🟠" ) tables_custom_color = input.color(defval = #4caf50, title = "base color for table text", group = "🟠 RSI to Price Tables 🟠" ) rsi = ta.rsi(src, len_rsi) ma = ta.ema(rsi, len_ema) // # =================== Input Settings ===================== # // # ================== TA Plotting ==================== # rsi_plot = plot(rsi, "RSI", color=color.new(#ff9800, 0), linewidth=2) ma_plot = plot(ma, "EMA", color=color.new(#dddddd, 0), style=plot.style_line, linewidth=2) // # ================== TA Plotting ==================== # // # ================== RSI Price Tables ==================== # price_by_rsi(level) => x1 = (len_rsi - 1) * (ta.rma(math.max(nz(src[1], src) - src, 0), len_rsi) * level / (100 - level) - ta.rma(math.max(src - nz(src[1], src), 0), len_rsi)) x1 >= 0 ? src + x1 : src + x1 * (100 - level) / level truncate(number, precision) => factor = math.pow(10, precision) int(number * factor) / factor formatedValue(number) => format = switch tables_price_trailing_zeros 1 =>str.format("{00,number,#.0}", number) 2 =>str.format("{00,number,#.00}", number) 3 =>str.format("{00,number,#.000}", number) 4 =>str.format("{00,number,#.0000}", number) 5 =>str.format("{00,number,#.00000}", number) 6 =>str.format("{00,number,#.000000}", number) 7 =>str.format("{00,number,#.0000000}", number) 8 =>str.format("{00,number,#.00000000}", number) 9 =>str.format("{00,number,#.000000000}", number) 10 =>str.format("{00,number,#.0000000000}", number) =>str.format("{00,number,#.00}", number) txt_size = switch tables_text_size "S" => size.small "M" => size.normal => size.tiny if(show_reference_table) tbl = table.new(position.bottom_left, 23, 2) table.set_border_width(tbl, 1) table.set_border_color(tbl, tables_standard_color) table.set_frame_width(tbl, 1) table.set_frame_color(tbl, tables_standard_color) table.cell(tbl, 0, 0, "RSI", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 0, 1, "PRICE", text_color = tables_standard_color, text_size = txt_size) fixed_pe10 = formatedValue(number = price_by_rsi(10)) table.cell(tbl, 1, 0, "10", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 1, 1, fixed_pe10, text_color = tables_standard_color, text_size = txt_size) fixed_pe15 = formatedValue(number = price_by_rsi(15)) table.cell(tbl, 2, 0, "15", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 2, 1, fixed_pe15, text_color = tables_standard_color, text_size = txt_size) fixed_pe20 = formatedValue(number = price_by_rsi(12)) table.cell(tbl, 3, 0, "20", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 3, 1, fixed_pe20, text_color = tables_standard_color, text_size = txt_size) fixed_pe236 = formatedValue(number = price_by_rsi(23.6)) table.cell(tbl, 4, 0, "23.6", text_color = tables_fib_color, text_size = txt_size) table.cell(tbl, 4, 1, fixed_pe236, text_color = tables_fib_color, text_size = txt_size) fixed_pe25 = formatedValue(number = price_by_rsi(25)) table.cell(tbl, 5, 0, "25", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 5, 1, fixed_pe25, text_color = tables_standard_color, text_size = txt_size) fixed_pe30 = formatedValue(number = price_by_rsi(30)) table.cell(tbl, 6, 0, "30", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 6, 1, fixed_pe30, text_color = tables_standard_color, text_size = txt_size) fixed_pe35 = formatedValue(number = price_by_rsi(35)) table.cell(tbl, 7, 0, "35", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 7, 1, fixed_pe35, text_color = tables_standard_color, text_size = txt_size) fixed_pe382 = formatedValue(number = price_by_rsi(38.2)) table.cell(tbl, 8, 0, "38.2", text_color = tables_fib_color, text_size = txt_size) table.cell(tbl, 8, 1, fixed_pe382, text_color = tables_fib_color, text_size = txt_size) fixed_pe40 = formatedValue(number = price_by_rsi(40)) table.cell(tbl, 9, 0, "40", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 9, 1, fixed_pe40, text_color = tables_standard_color, text_size = txt_size) fixed_pe45 = formatedValue(number = price_by_rsi(45)) table.cell(tbl, 10, 0, "45", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 10, 1, fixed_pe45, text_color = tables_standard_color, text_size = txt_size) fixed_pe50 = formatedValue(number = price_by_rsi(50)) table.cell(tbl, 11, 0, "50", text_color = tables_fib_color, text_size = txt_size) table.cell(tbl, 11, 1, fixed_pe50, text_color = tables_fib_color, text_size = txt_size) fixed_pe55 = formatedValue(number = price_by_rsi(55)) table.cell(tbl, 12, 0, "55", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 12, 1, fixed_pe55, text_color = tables_standard_color, text_size = txt_size) fixed_pe60 = formatedValue(number = price_by_rsi(60)) table.cell(tbl, 13, 0, "60", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 13, 1, fixed_pe60, text_color = tables_standard_color, text_size = txt_size) fixed_pe618 = formatedValue(number = price_by_rsi(61.8)) table.cell(tbl, 14, 0, "61.8", text_color = tables_fib_color, text_size = txt_size) table.cell(tbl, 14, 1, fixed_pe618, text_color = tables_fib_color, text_size = txt_size) fixed_pe65 = formatedValue(number = price_by_rsi(65)) table.cell(tbl, 15, 0, "65", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 15, 1, fixed_pe65, text_color = tables_standard_color, text_size = txt_size) fixed_pe70 = formatedValue(number = price_by_rsi(70)) table.cell(tbl, 16, 0, "70", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 16, 1, fixed_pe70, text_color = tables_standard_color, text_size = txt_size) fixed_pe75 = formatedValue(number = price_by_rsi(75)) table.cell(tbl, 17, 0, "75", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 17, 1, fixed_pe75, text_color = tables_standard_color, text_size = txt_size) fixed_pe786 = formatedValue(number = price_by_rsi(78.6)) table.cell(tbl, 18, 0, "78.6", text_color = tables_fib_color, text_size = txt_size) table.cell(tbl, 18, 1, fixed_pe786, text_color = tables_fib_color, text_size = txt_size) fixed_pe80 = formatedValue(number = price_by_rsi(80)) table.cell(tbl, 19, 0, "80", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 19, 1, fixed_pe80, text_color = tables_standard_color, text_size = txt_size) fixed_pe85 = formatedValue(number = price_by_rsi(85)) table.cell(tbl, 20, 0, "85", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 20, 1, fixed_pe85, text_color = tables_standard_color, text_size = txt_size) fixed_pe90 = formatedValue(number = price_by_rsi(90)) table.cell(tbl, 21, 0, "90", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 21, 1, fixed_pe90, text_color = tables_standard_color, text_size = txt_size) fixed_pe95 = formatedValue(number = price_by_rsi(95)) table.cell(tbl, 22, 0, "95", text_color = tables_standard_color, text_size = txt_size) table.cell(tbl, 22, 1, fixed_pe95, text_color = tables_standard_color, text_size = txt_size) if(show_reference_custom_table) custom_tbl = table.new(position.bottom_right, 3, 2) table.set_border_width(custom_tbl, 1) table.set_border_color(custom_tbl, tables_standard_color) table.set_frame_width(custom_tbl, 1) table.set_frame_color(custom_tbl, tables_standard_color) fixed_pe1 = formatedValue(number = price_by_rsi(rsi_for_price1)) table.cell(custom_tbl, 0, 0, formatedValue(number = rsi_for_price1), text_color = tables_custom_color, text_size = txt_size) table.cell(custom_tbl, 0, 1, fixed_pe1, text_color = tables_custom_color, text_size = txt_size) fixed_pe2 = formatedValue(number = price_by_rsi(rsi_for_price2)) table.cell(custom_tbl, 1, 0, formatedValue(number = rsi_for_price2), text_color = tables_custom_color, text_size = txt_size) table.cell(custom_tbl, 1, 1, fixed_pe2, text_color = tables_custom_color, text_size = txt_size) fixed_pe3 = formatedValue(number = price_by_rsi(rsi_for_price3)) table.cell(custom_tbl, 2, 0, formatedValue(number = rsi_for_price3), text_color = tables_custom_color, text_size = txt_size) table.cell(custom_tbl, 2, 1, fixed_pe3, text_color = tables_custom_color, text_size = txt_size) // # ================== RSI Price Tables ==================== # // # ================== Referencial Zones display ==================== # fib_lines_transparency = 100 fib_background_transparency = 80 fib_line_color = color.new(#9e9e9e, transp=fib_lines_transparency) band_line_color = color.new(#9e9e9e, transp=80) down = hline(23.6,title = "Bottom cloud line (bottom)", linestyle=hline.style_solid, color=fib_line_color) downGoldenB = hline(35, title = "Bottom cloud line (middle)",linestyle=hline.style_solid, color=fib_line_color) downGoldenT = hline(38.2, title = "Bottom cloud line (top)",linestyle=hline.style_solid, color=fib_line_color) upGoldenB = hline(61.8, title = "Upper cloud line (bottom)", linestyle=hline.style_solid, color=fib_line_color) upGoldenT = hline(65, title = "Upper cloud line (middle)",linestyle=hline.style_solid, color=fib_line_color) up = hline(78.6, title = "Upper cloud line (top)", linestyle=hline.style_solid, color=fib_line_color) fill(upGoldenB, upGoldenT, color=#ff9800, transp=fib_background_transparency, title = "Golden overbought background") fill(downGoldenB, downGoldenT, color=#ff9800, transp=fib_background_transparency, title = "Golden oversold background" ) fill(upGoldenT, up, color=#f44336, transp=fib_background_transparency, title = "Overbought background") fill(down, downGoldenB, color=#4caf50, transp=fib_background_transparency,title = "Oversold background") hline(50, title = "Reference line (middle)", linestyle=hline.style_dashed, color=band_line_color) hline(70, title = "Reference line (overbought)", linestyle=hline.style_dashed, color=band_line_color) hline(30, title = "Reference line (oversold)", linestyle=hline.style_dashed, color=band_line_color) hline(85, title = "Reference line (Extreme overbought)", linestyle=hline.style_dashed, color=band_line_color) hline(20, title = "Reference line (Extreme oversold)", linestyle=hline.style_dashed, color=band_line_color) upExtremeB = hline(90, title = "Extreme upper cloud line (bottom)", linestyle=hline.style_solid, color=fib_line_color) upExtremeT = hline(95, title = "Extreme upper cloud line (top)",linestyle=hline.style_solid, color=fib_line_color) fill(upExtremeT, upExtremeB, color=#b71c1c, transp=fib_background_transparency, title = "Extreme overbought background") downExtremeB = hline(10, title = " Extreme bottom cloud line (bottom)", linestyle=hline.style_solid, color=fib_line_color) downExtremeT = hline(15, title = "Extreme bottom cloud line (top)",linestyle=hline.style_solid, color=fib_line_color) fill(downExtremeB, downExtremeT, color=#1b5e20, transp=fib_background_transparency, title = "Extreme oversold background" ) // # ================== Referencial Zones display ==================== #
LankouVsBTC
https://www.tradingview.com/script/6rVqBArA-LankouVsBTC/
lankou
https://www.tradingview.com/u/lankou/
420
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/ // Β© lankou //@version=5 indicator('LankouVsBTC', overlay=false) the_string = str.replace_all(syminfo.ticker, "USDT", "BTC") symOpen = request.security(the_string, timeframe.period, open) col = color.rgb(255, 255, 255) //plot(ta.ema(symOpen - open, 13), color=col, style=plot.style_area) plot(symOpen, color=col, style=plot.style_line)
Indicator Functions with Factor and HeikinAshi
https://www.tradingview.com/script/M6X6wEYd-Indicator-Functions-with-Factor-and-HeikinAshi/
dturkuler
https://www.tradingview.com/u/dturkuler/
85
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/ // Β© dturkuler //Indicator Version 1.02 //ADD: 23 new indicators added. Most of them are TR builtin indicators (see description in TV builtin Indicators). Newly added indicators are listed below //ADD: pvth = 'pivothigh(src,BarsLeft,BarsRight=2)' //Previous pivot high. src=src, BarsLeft=len, BarsRight=p1=2 //ADD: pvtl = 'pivotlow(src,BarsLeft,BarsRight=2)' //Previous pivot low. src=src, BarsLeft=len, BarsRight=p1=2 //ADD: rangs = 'ranges(src,upper=len, lower=-5)', //ranges of the source. return -1 source<lower, return 1 source>upper otherwise return 0 //ADD: aroon = 'aroon(len,dir=0)', //aroon indicator. Aroon's major function is to identify new trends as they happen.p1 = dir: 0=mid (default), 1=upper, 2=lower //ADD: adx = 'adx(dilen=len, adxlen=14)' //adx. The Average Directional Index (ADX) is a used to determine the strength of a trend. len=>dilen, p1=adxlen (default=14), p2=adxtype 0:ADX, 1:+DI, 2:-DI (def:0) //ADD: awsom = 'awesome(fast=len=5,slow=34,type=0)' //Awesome Oscilator (AO) is an indicator used to measure market momentum. defaults : fast=len= 5, p1=slow=34, p2=type: 0=Awesome, 1=difference //ADD: cmf = 'cmf(len=20)' //Chaikin Money Flow Indicator used to measure Money Flow Volume over a set period of time. Default use is len=20 //ADD: eom = 'eom(len=14,div=10000)', //Ease of Movement.It is designed to measure the relationship between price and volume.p1 = div: 10000= (default) //ADD: efi = 'efi(len)' //Elder's Force Index (EFI) measures the power behind a price movement using price and volume. //ADD: fit = 'fn_fisher(len)' //Fisher Transform is a technical indicator that converts price to Gaussian normal distribution and signals when prices move significantly by referencing recent price data //ADD: hvo = 'fn_histvol(len)', //Historical volatility is a statistical measure used to analyze the general dispersion of security or market index returns for a specified period of time. //ADD: dpo = 'dpo(len)', //Detrended Price Oscilator is used to remove trend from price. //ADD: kli = 'klinger(type=len)', //Klinger oscillator aims to identify money flow’s long-term trend. type=len: 0:Oscilator 1:signal //ADD: msi = 'msi(len=10)', //Mass Index (def=10) is used to examine the differences between high and low stock prices over a specific period of time //ADD: mgi = 'mcginley(src, len)' //McGinley Dynamic adjusts for market speed shifts, which sets it apart from other moving averages, in addition to providing clear moving average lines //ADD: sar = 'sar(start=len, inc=0.02, max=0.02)' //Parabolic SAR (parabolic stop and reverse) is a method to find potential reversals in the market price direction of traded goods.start=len, inc=p1, max=p2. ex: sar(0.02, 0.02, 0.02) //ADD: rvi = 'rvi(src,len)', //The Relative Volatility Index (RVI) is calculated much like the RSI, although it uses high and low price standard deviation instead of the RSI’s method of absolute change in price. //ADD: ulos = 'ultimateOsc(len)' //Ultimate Oscillator indicator (UO) indicator is a technical analysis tool used to measure momentum across three varying timeframes //ADD: vstop = 'volstop(src,len,atrfactor=2)' //Volatility Stop is a technical indicator that is used by traders to help place effective stop-losses. atrfactor=p1 //ADD: vwap = 'vwap(src_)', //Volume Weighted Average Price (VWAP) is used to measure the average price weighted by volume //ADD: cti = 'cti(src,len)', //Ehler s Correlation Trend Indicator by @midtownsk8rguy. //ADD: stc = 'stc(src,len,fast=23,slow=50)', //Schaff Trend Cycle (STC) detects up and down trends long before the MACD. Code imported from @lazybear's (thanks) Schaff Trend Cycle script. //ADD: org = 'Original Value', //Return input source value as output //UPD: Indicator factor inputs displays with factor descriptions //UPD: Indicator Parameter inputs displays with parameter descriptions //UPD: Indicator source inputs displays indicators descriptions //UPD: volume added on IND2 source input //UPD: IND1 is added IND2's source list (IND1, open, close...). Now it is possible to use IND1 as source and modify it with any indicator in IND2. ex: IND1=ema(close,14) and IND2=dema(IND1,50) means IND2=dema(ema(close,14), 50) //UPD: indicators descriptions updated //UPD: contants and inputs (ind_src) updated with new indicators //@version=5 indicator("Indicators w HeikinAshi and Factor [DTU]") import dturkuler/lib_Indicators_v2_DTU/2 as dtu // library includes indicators, snippets from tradingview library and some other open sources scripts //_______________INDICATORS CONSTANTS // Indicator constants are defined with descriptions to better display in inputs dropdowns // To use them to call library function, It should be splitted with ".-" separator by using fn_split(indicator_constant,".-"). splitted first part will be used on library function part // ex: "cma(src,len)" ovrly = 'β–Όβ–Όβ–Ό OVERLAY β–Όβ–Όβ–Ό.-------------------------(Not used as indicator, info Only)Just used to separate input options of overlayable indicators ', org = 'Original Value.--------------------------Return input source value as output', hide = 'DONT DISPLAY.----------------------------Dont display/calculate the indicator. (For my framework usage)', alma = 'alma(src,len,offset=0.85,sigma=6).-------Arnaud Legoux Moving Average ', ama = 'ama(src,len,fast=14,slow=100).-----------Adjusted Moving Average', acdst = 'accdist().-------------------------------Accumulation/distribution index. ', cma = 'cma(src,len).----------------------------Corrective Moving average ', dema = 'dema(src,len).---------------------------Double EMA (Same as EMA with 2 factor)', ema = 'ema(src,len).----------------------------Exponential Moving Average ', gmma = 'gmma(src,len).---------------------------Geometric Mean Moving Average', hghst = 'highest(src,len).------------------------Highest value for a given number of bars back. ', hl2ma = 'hl2ma(src,len).--------------------------higest lowest moving average', hma = 'hma(src,len).----------------------------Hull Moving Average.', lgAdt = 'lagAdapt(src,len,perclen=5,fperc=50).----Ehlers Adaptive Laguerre filter', lgAdV = 'lagAdaptV(src,len,perclen=5,fperc=50).---Ehlers Adaptive Laguerre filter variation', lguer = 'laguerre(src,len).-----------------------Ehlers Laguerre filter', lsrcp = 'lesrcp(src,len).-------------------------lowest exponential esrcpanding moving line', lexp = 'lexp(src,len).---------------------------lowest exponential expanding moving line ', linrg = 'linreg(src,len,loffset=1).---------------Linear regression', lowst = 'lowest(src,len).-------------------------Lovest value for a given number of bars back.', mgi = 'mcginley(src, len).-----------------------McGinley Dynamic adjusts for market speed shifts, which sets it apart from other moving averages, in addition to providing clear moving average lines', pcnl = 'percntl(src,len).------------------------percentile nearest rank. Calculates percentile using method of Nearest Rank.', pcnli = 'percntli(src,len).-----------------------percentile linear interpolation. Calculates percentile using method of linear interpolation between the two nearest ranks.', prev = 'previous(src,len).-----------------------Previous n (len) value of the source ', pvth = 'pivothigh(src,BarsLeft=len,BarsRight=2).-Previous pivot high. src=src, BarsLeft=len, BarsRight=p1=2', pvtl = 'pivotlow(src,BarsLeft=len,BarsRight=2).--Previous pivot low. src=src, BarsLeft=len, BarsRight=p1=2', rema = 'rema(src,len).---------------------------Range EMA (REMA) ', rma = 'rma(src,len).----------------------------Moving average used in RSI. It is the exponentially weighted moving average with alpha = 1 / length.', sar = 'sar(start=len, inc=0.02, max=0.02).------Parabolic SAR (parabolic stop and reverse) is a method to find potential reversals in the market price direction of traded goods.start=len, inc=p1, max=p2. ex: sar(0.02, 0.02, 0.02) ', sma = 'sma(src,len).----------------------------Smoothed Moving Average', smma = 'smma(src,len).---------------------------Smoothed Moving Average', supr2 = 'super2(src,len).-------------------------Ehlers super smoother, 2 pole ', supr3 = 'super3(src,len).-------------------------Ehlers super smoother, 3 pole', strnd = 'supertrend(src,len,period=3).------------Supertrend indicator', swma = 'swma(src,len).---------------------------Sine-Weighted Moving Average', tema = 'tema(src,len).---------------------------Triple EMA (Same as EMA with 3 factor)', tma = 'tma(src,len).----------------------------Triangular Moving Average', vida = 'vida(src,len).---------------------------Variable Index Dynamic Average ', vwma = 'vwma(src,len).---------------------------Volume Weigted Moving Average', vstop = 'volstop(src,len,atrfactor=2).------------Volatility Stop is a technical indicator that is used by traders to help place effective stop-losses. atrfactor=p1', wma = 'wma(src,len).----------------------------Weigted Moving Average ', vwap = 'vwap(src_).------------------------------Volume Weighted Average Price (VWAP) is used to measure the average price weighted by volume ', nvrly = 'β–Όβ–Όβ–Ό NON OVERLAY β–Όβ–Ό.----------------------(Not used as indicator, info Only)Just used to separate input options of non overlayable indicators ', adx = 'adx(dilen=len, adxlen=14, adxtype=0).----adx. The Average Directional Index (ADX) is a used to determine the strength of a trend. len=>dilen, p1=adxlen (default=14), p2=adxtype 0:ADX, 1:+DI, 2:-DI (def:0)', angle = 'angle(src,len).--------------------------angle of the series (Use its Input as another indicator output)', aroon = 'aroon(len,dir=0).------------------------aroon indicator. Aroons major function is to identify new trends as they happen.p1 = dir: 0=mid (default), 1=upper, 2=lower', atr = 'atr(src,len).----------------------------average true range. RMA of true range. ', awsom = 'awesome(fast=len=5,slow=34,type=0).------Awesome Oscilator is an indicator used to measure market momentum. defaults : fast=len= 5, p1=slow=34, p2=type: 0=Awesome, 1=difference', bbr = 'bbr(src,len,mult=1).---------------------bollinger %%', bbw = 'bbw(src,len,mult=2).---------------------Bollinger Bands Width. The Bollinger Band Width is the difference between the upper and the lower Bollinger Bands divided by the middle band.', cci = 'cci(src,len).----------------------------commodity channel index', cctbb = 'cctbbo(src,len).-------------------------CCT Bollinger Band Oscilator', chng = 'change(src,len).-------------------------A.K.A. Momentum. Difference between current value and previous, source - source[length]. is most commonly referred to as a rate and measures the acceleration of the price and/or volume of a security', cmf = 'cmf(len=20).-----------------------------Chaikin Money Flow Indicator used to measure Money Flow Volume over a set period of time. Default use is len=20', cmo = 'cmo(src,len).----------------------------Chande Momentum Oscillator. Calculates the difference between the sum of recent gains and the sum of recent losses and then divides the result by the sum of all price movement over the same period.', cog = 'cog(src,len).----------------------------The cog (center of gravity) is an indicator based on statistics and the Fibonacci golden ratio.', cpcrv = 'copcurve(src,len).-----------------------Coppock Curve. was originally developed by Edwin Sedge Coppock (Barrons Magazine, October 1962).', corrl = 'correl(src,len).-------------------------Correlation coefficient. Describes the degree to which two series tend to deviate from their ta.sma values.', count = 'count(src,len).--------------------------green avg - red avg', cti = 'cti(src,len).----------------------------Ehler s Correlation Trend Indicator by ', dev = 'dev(src,len).----------------------------ta.dev() Measure of difference between the series and its ta.sma', dpo = 'dpo(len).--------------------------------Detrended Price OScilator is used to remove trend from price. ', efi = 'efi(len).--------------------------------Elders Force Index (EFI) measures the power behind a price movement using price and volume.', eom = 'eom(len=14,div=10000).-------------------Ease of Movement.It is designed to measure the relationship between price and volume.p1 = div: 10000= (default)', fall = 'falling(src,len).------------------------ta.falling() Test if the `source` series is now falling for `length` bars long. (Use its Input as another indicator output)', fit = 'fisher(len).-----------------------------Fisher Transform is a technical indicator that converts price to Gaussian normal distribution and signals when prices move significantly by referencing recent price data', hvo = 'histvol(len).----------------------------Historical volatility is a statistical measure used to analyze the general dispersion of security or market index returns for a specified period of time.', kcr = 'kcr(src,len,mult=2).---------------------Keltner Channels Range ', kcw = 'kcw(src,len,mult=2).---------------------ta.kcw(). Keltner Channels Width. The Keltner Channels Width is the difference between the upper and the lower Keltner Channels divided by the middle channel.', kli = 'klinger(type=len).-----------------------Klinger oscillator aims to identify money flow’s long-term trend. type=len: 0:Oscilator 1:signal', macd = 'macd(src,len).---------------------------MACD (Moving Average Convergence/Divergence)', mfi = 'mfi(src,len).----------------------------Money Flow Index s a tool used for measuring buying and selling pressure', msi = 'msi(len=10).-----------------------------Mass Index (def=10) is used to examine the differences between high and low stock prices over a specific period of time', nvi = 'nvi().-----------------------------------Negative Volume Index', obv = 'obv().-----------------------------------On Balance Volume', pvi = 'pvi().-----------------------------------Positive Volume Index ', pvt = 'pvt().-----------------------------------Price Volume Trend', rangs = 'ranges(src,upper=len, lower=-5).---------ranges of the source. src=src, upper=len, v1:lower=upper . returns: -1 source<lower, 1 source>=upper otherwise 0', rise = 'rising(src,len).-------------------------ta.rising() Test if the `source` series is now rising for `length` bars long. (Use its Input as another indicator output)', roc = 'roc(src,len).----------------------------Rate of Change', rsi = 'rsi(src,len).----------------------------Relative strength Index', rvi = 'rvi(src,len).----------------------------The Relative Volatility Index (RVI) is calculated much like the RSI, although it uses high and low price standard deviation instead of the RSI’s method of absolute change in price.', smosc = 'smi_osc(src,len,fast=5, slow=34).--------smi Oscillator', smsig = 'smi_sig(src,len,fast=5, slow=34).--------smi Signal', stc = 'stc(src,len,fast=23,slow=50).------------Schaff Trend Cycle (STC) detects up and down trends long before the MACD. Code imported from ', stdev = 'stdev(src,len).--------------------------Standart deviation', trix = 'trix(src,len) .--------------------------the rate of change of a triple exponentially smoothed moving average.', tsi = 'tsi(src,len).----------------------------The True Strength Index indicator is a momentum oscillator designed to detect, confirm or visualize the strength of a trend.', ulos = 'ultimateOsc(len.-------------------------Ultimate Oscillator indicator (UO) indicator is a technical analysis tool used to measure momentum across three varying timeframes', vari = 'variance(src,len).-----------------------ta.variance(). Variance is the expectation of the squared deviation of a series from its mean (ta.sma), and it informally measures how far a set of numbers are spread out from their mean.', wilpc = 'willprc(src,len).------------------------Williams %R', wad = 'wad().-----------------------------------Williams Accumulation/Distribution.', wvad = 'wvad().----------------------------------Williams Variable Accumulation/Distribution.', //_______________PARAMETER VERSION CONSTANTS v01="Use Defaults", v02="Use Extra Parameters P1, P2" //_______________FACTOR VERSION CONSTANTS f01="None", f02 = "Double", f03 = "Triple", f04 = "Quadruple" //--------------------------} //-------------------------- //--------FUNCTIONS--------- //--------------------------{ fn_split(simple string s_data,sep_=".-")=> a=str.pos(s_data,sep_) result=str.substring(s_data,0,a) fn_paramVer(simple string pver_)=> int ver_=switch pver_ v01 => 1 v02 => 2 ver_ fn_factorVer(simple string fver_)=> int ver_=switch fver_ f01 => 1 f02 => 2 f03 => 3 f04 => 4 ver_ //--------------------------} //-------------------------- //--------TEST-------------- //--------------------------{ //Indicators that returned plot function values float f_indicator1=0 float f_indicator2=0 float ext_data = input.source( defval=close, title='External Indicator') //Function returns source values from given input //Ex: ind_data =input.string(defval="close", title='',options=["close", "open", "high", "low","hl2", "hlc3", "ohlc4","IND1"]) fn_get_source(string source_) => result = switch source_ "close" => close "open" => open "high" => high "low" => low "hl2" => hl2 "hlc3" => hlc3 "ohlc4" => ohlc4 "volume" => volume "EXT" => ext_data "IND1" => f_indicator1 //ex:return calculated indicator or another source entry for using in new calculation "IND2" => f_indicator2 //ex:return calculated indicator or another source entry for using in new calculation =>na result //--------------------------} //---------------------------------------------------------------------------------------------------------------------------------------- //INDICATOR 1----------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------- s_grp_indicator1="════════════ INDICATOR 1 ════════════" s_ind1_src= input.string( defval=ema, title='IND1:', options=[hide, org, ovrly, alma, ama , acdst, cma, dema, ema, gmma, hghst, hl2ma, hma, lgAdt, lgAdV, lguer, lsrcp, lexp, linrg, lowst, mgi,pcnl, pcnli, prev , pvth, pvtl, rema, rma, sar, sma, smma, supr2, supr3, strnd, swma, tema, tma, vida, vwma, vstop, wma, vwap, nvrly, adx, angle, aroon, atr, awsom, bbr, bbw, cci, cctbb, chng, cmf, cmo, cog, cpcrv, corrl, count, cti, dev, dpo, efi, eom, fall, fit, hvo, kcr, kcw, kli, macd, mfi, msi, nvi, obv, pvi, pvt, rangs, rise, roc, rsi, rvi, smosc, smsig, stc, stdev, trix, tsi, vari, wilpc, wad, wvad] , group=s_grp_indicator1, inline="ind1") s_ind1_data = input.string( defval="close", title='', options=["close", "open", "high", "low","hl2", "hlc3", "ohlc4", "volume", "EXT"] , group= s_grp_indicator1, inline="ind1") f_ind1_len = input.float( defval=14, title='Len', group=s_grp_indicator1, inline="ind1") s_ind1_ver = input.string( defval=v01, title="Par", group=s_grp_indicator1, inline="ind2", options=[v01,v02]) f_ind1_p1 = input.float( defval=0, title='P1', group=s_grp_indicator1, inline="ind2") f_ind1_p2 = input.float( defval=0, title='P2', group=s_grp_indicator1, inline="ind2") s_ind1_fact = input.string( defval=f01, title='factor', group=s_grp_indicator1, inline="ind4", options=[f01,f02,f03,f04]) s_ind1_log = input.string( defval="None", title='Log', group=s_grp_indicator1, inline="ind4", options=['None', 'Simple', 'Log10']) s_ind1_pType = input.string( defval="Original", title="PType", group=s_grp_indicator1, inline="ind3", options=['Original', 'Stochastic', 'PercentRank','Org. Range (-1,1)']) i_ind1_stlen = input.int( defval=50, title='St/% val', group=s_grp_indicator1, inline="ind3") b_ind1_pSWMA= input.bool( defval=false, title="Smooth", group=s_grp_indicator1, inline="ind3") c_ind1_color = input( defval=color.green, title="", group=s_grp_indicator1, inline="ind3") b_plt1_candle = input.bool( defval=true, title='Plot Candle',group=s_grp_indicator1, inline="plt") b_plt1_ind = input.bool( defval=true, title='Plot Ind', group=s_grp_indicator1, inline="plt") b_plt1_heikin = input.bool( defval=false, title='HeikinAshi', group=s_grp_indicator1, inline="plt") //f_ind1_p3 = input.float( defval=0, title='P3', group=s_grp_indicator1, inline="ind2") //to be activated in the future oOut1=0.0, hOut1=0.0, lOut1=0.0, cOut1=0.0 palette1=color.green //PLOT INDICATOR 1 if s_ind1_src!=hide and b_plt1_ind!=false s_ind1_data_=fn_get_source(s_ind1_data) f_indicator1:=dtu.fn_factor(FuncType_=fn_split(s_ind1_src), src_data_=s_ind1_data_, length_=f_ind1_len, p1=f_ind1_p1, p2=f_ind1_p2, version_=fn_paramVer(s_ind1_ver), fact_=fn_factorVer(s_ind1_fact), plotingType_=s_ind1_pType, stochlen_=i_ind1_stlen, plotSWMA_=b_ind1_pSWMA, log_=s_ind1_log) plot(s_ind1_src==hide or b_plt1_ind==false ?na:f_indicator1, color=c_ind1_color, title='indicator1', linewidth=2) //PLOT FUNCTION CANDLES 1 if s_ind1_src!=hide and b_plt1_candle!=false [oOut_, hOut_, lOut_, cOut_, palette_] = dtu.fn_plotCandles(FuncType_=fn_split(s_ind1_src),len_=f_ind1_len, p1=f_ind1_p1, p2=f_ind1_p2, version_=fn_paramVer(s_ind1_ver),fact_=fn_factorVer(s_ind1_fact), plotingType_=s_ind1_pType, stochlen_=i_ind1_stlen, plotSWMA_=b_ind1_pSWMA, log_=s_ind1_log, plotheikin_=b_plt1_heikin ) oOut1:=oOut_, hOut1:=hOut_, lOut1:=lOut_, cOut1:=cOut_ palette1 := palette_ ? color.green : color.red pc1_=s_ind1_src==hide or b_plt1_candle==false plotcandle(pc1_?na:oOut1, pc1_?na:hOut1, pc1_?na:lOut1, pc1_?na:cOut1, color=palette1, title='Filter Candles 1') //---------------------------------------------------------------------------------------------------------------------------------------- //INDICATOR 2----------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------- s_grp_indicator2="════════════ INDICATOR 2 ════════════" s_ind2_src= input.string( defval=ema, title='IND2:', options=[hide, org, ovrly, alma, ama , acdst, cma, dema, ema, gmma, hghst, hl2ma, hma, lgAdt, lgAdV, lguer, lsrcp, lexp, linrg, lowst, mgi,pcnl, pcnli, prev , pvth, pvtl, rema, rma, sar, sma, smma, supr2, supr3, strnd, swma, tema, tma, vida, vwma, vstop, wma, vwap, nvrly, adx, angle, aroon, atr, awsom, bbr, bbw, cci, cctbb, chng, cmf, cmo, cog, cpcrv, corrl, count, cti, dev, dpo, efi, eom, fall, fit, hvo, kcr, kcw, kli, macd, mfi, msi, nvi, obv, pvi, pvt, rangs, rise, roc, rsi, rvi, smosc, smsig, stc, stdev, trix, tsi, vari, wilpc, wad, wvad] , group=s_grp_indicator2, inline="ind1") //ind2_data = input.source( defval=close, title='', group=s_grp_indicator2, inline="ind1") s_ind2_data = input.string( defval="close", title='', options=["close", "open", "high", "low","hl2", "hlc3", "ohlc4", "vol", "EXT", "IND1"] , group= s_grp_indicator2, inline="ind1") f_ind2_len = input.float( defval=48, title='Len', group=s_grp_indicator2, inline="ind1") s_ind2_ver = input.string( defval=v01, title="Par", group=s_grp_indicator2, inline="ind2", options=[v01,v02]) f_ind2_p1 = input.float( defval=0, title='P1', group=s_grp_indicator2, inline="ind2") f_ind2_p2 = input.float( defval=0, title='P2', group=s_grp_indicator2, inline="ind2") s_ind2_fact = input.string( defval=f01, title='factor', group=s_grp_indicator2, inline="ind4", options=[f01,f02,f03,f04]) s_ind2_log = input.string( defval="None", title='Log', group=s_grp_indicator2, inline="ind4", options=['None', 'Simple', 'Log10']) s_ind2_pType = input.string( defval="Original", title="PType", group=s_grp_indicator2, inline="ind3", options=['Original', 'Stochastic', 'PercentRank','Org. Range (-1,1)']) i_ind2_stlen = input.int( defval=50, title='St/% val', group=s_grp_indicator2, inline="ind3") b_ind2_pSWMA= input.bool( defval=false, title="Smooth", group=s_grp_indicator2, inline="ind3") c_ind2_color = input( defval=color.red, title="", group=s_grp_indicator2, inline="ind3") b_plt2_candle = input.bool( defval=true, title='Plot Candle',group=s_grp_indicator2, inline="plt") b_plt2_ind = input.bool( defval=true, title='Plot Ind', group=s_grp_indicator2, inline="plt") b_plt2_heikin = input.bool( defval=false, title='HeikinAshi', group=s_grp_indicator2, inline="plt") //ind2_p3 = input.float( defval=0, title='P3', group=s_grp_indicator2, inline="ind2") //to be activated in the future oOut2=0.0, hOut2=0.0, lOut2=0.0, cOut2=0.0 palette2=color.green //PLOT INDICATOR 2 if s_ind2_src!=hide and b_plt2_ind!=false s_ind2_data_=fn_get_source(s_ind2_data) f_indicator2:=dtu.fn_factor(FuncType_=fn_split(s_ind2_src), src_data_=s_ind2_data_, length_=f_ind2_len, p1=f_ind2_p1, p2=f_ind2_p2, version_=fn_paramVer(s_ind2_ver), fact_=fn_factorVer(s_ind2_fact), plotingType_=s_ind2_pType, stochlen_=i_ind2_stlen, plotSWMA_=b_ind2_pSWMA, log_=s_ind2_log) plot(s_ind2_src==hide or b_plt2_ind==false ?na:f_indicator2, color=c_ind2_color, title='indicator2', linewidth=2) //PLOT FUNCTION CANDLES 2 if s_ind2_src!=hide and b_plt2_candle!=false [oOut_, hOut_, lOut_, cOut_, palette_] = dtu.fn_plotCandles(FuncType_=fn_split(s_ind2_src),len_=f_ind2_len, p1=f_ind2_p1, p2=f_ind2_p2, version_=fn_paramVer(s_ind2_ver),fact_=fn_factorVer(s_ind2_fact), plotingType_=s_ind2_pType, stochlen_=i_ind2_stlen, plotSWMA_=b_ind2_pSWMA, log_=s_ind2_log, plotheikin_=b_plt2_heikin ) oOut2:=oOut_, hOut2:=hOut_, lOut2:=lOut_, cOut2:=cOut_ palette2 := palette_ ? color.green : color.red pc2_=s_ind2_src==hide or b_plt2_candle==false plotcandle(pc2_?na:oOut2, pc2_?na:hOut2, pc2_?na:lOut2, pc2_?na:cOut2, color=palette2, title='Filter Candles 2')
Double_based_ema
https://www.tradingview.com/script/R93X9WIo-Double-based-ema/
jacobfabris
https://www.tradingview.com/u/jacobfabris/
10
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("Double_based",overlay=true) P = input.int(defval=21,minval = 4,maxval=999) a = ta.highest(high,P) b = ta.lowest(low,P) c = ta.atr(P) ls = a-c/2 li = b+c/2 lm = (a+b)/2 ps = close > ls ? ls : close < lm ? lm : close pi = close > lm ? lm : close < li ? li : close ms = ta.ema(ps,P) mi = ta.ema(pi,P) cors = close > lm ? color.green : #FF000000 cori = close < lm ? color.orange : #FF000000 plot(ms,color=cors) plot(mi,color=cori)
TAPLOT SlingShot
https://www.tradingview.com/script/JJtDhJFF-TAPLOT-SlingShot/
TaPlot
https://www.tradingview.com/u/TaPlot/
574
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/ // Β© TaPlot //@version=5 //Code written by @TaPlot //Written on 11/28/2021 indicator(title="TAPLOT SlingShot", shorttitle="Sling Shot", overlay=true) C_Paintbar = input.color(title="Bar Color", defval=color.new(color.orange,0)) ShowEMA=input(true,'Show EMA Line?') Paintbar=input(true,'Paint Bar?') ShowShape=input(true,'Show SlingShot?') EMAlen = input.int(4, minval=1, title="EMA-Length") //MA line calculation EMALine = ta.ema(high, EMAlen) plot(ShowEMA?EMALine:na, title="EMA") slingshot = close > EMALine and close[1] < EMALine[1] and close[2] < EMALine[2] and close[3] < EMALine[3] alertcondition(slingshot == 1, title='Slingshot', message='Slingshot Triggered!') plotshape(slingshot and ShowShape?1:na,style=shape.labelup, location=location.belowbar, size=size.tiny) barcolor(Paintbar and slingshot? C_Paintbar : na)
Candlestick Trailing Allocation
https://www.tradingview.com/script/iYUbfGqd-Candlestick-Trailing-Allocation/
maksumit
https://www.tradingview.com/u/maksumit/
24
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/ // Β© sumitmak //@version=5 indicator("Candlestick Trailing Allocation") l = input.int(20, minval=1, title='Length') size = input.float(0.1, minval=0.01, title='Doji Size') d = math.abs(open - close) <= ((high - low) * size) ? 1:0 u = (close>open) ? 1:0 dn = (open>close) ? 1:0 dsum = math.sum(d, l) usum = math.sum(u, l)-dsum/2 dnsum = math.sum(dn, l)-dsum/2 ua = usum/l*100 dna = dnsum/l*100 da = dsum/l*100 plot(ua, color=color.green, title="Up") plot(dna, color=color.red, title="Down") plot(da, color=color.blue, title="Doji")
Gradiente
https://www.tradingview.com/script/MklbzG27-Gradiente/
jacobfabris
https://www.tradingview.com/u/jacobfabris/
30
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/ // Β© jacobfabris //@version=4 study("Gradiente",overlay=false) //--- setting periods 1 and 2 P1 = input(defval = 9, minval = 4,maxval=2000) P2 = input(defval = 21,minval = 4,maxval=2000) //--- calculating EMA a = ema(close,P1) b = ema(close,P2) //--- strating counter + and - c = 1.0 d = -1.0 c:= a>b ? nz(c[1])+(a-b) : 1.0 d:= a<b ? nz(d[1])+(a-b) : -1.0 cp = 0.0 cn = 0.0 //--- calculating area bwtween EMA when + and - cp:= a>b ? nz(cp[1])+1 : 1 cn:= a<b ? nz(cn[1])+1 : 1 //--- calculating the gradient of increase of area gp= c/cp gn= d/cn //--- filtering spikes sp = ema(gp,3) sn = ema(gn,3) //--- stablishing the colors corp = gp == 1 ? #FF000000 : gp>1 and gp>gp[1] ? color.green : gp>1 and gp<gp[1] and gp>sp ? color.white : color.gray corn = gn == -1 ? #FF000000 : gn<-1 and gn<gn[1] ? color.red : gn<-11 and gn>gn[1] and gn<sn ? color.white : color.gray //--- ploting plot(gp,color=corp,linewidth =2) plot(gn,color=corn,linewidth =2)
Volume Based Ichimoku Cloud
https://www.tradingview.com/script/xakrbDTX-Volume-Based-Ichimoku-Cloud/
pascorp
https://www.tradingview.com/u/pascorp/
175
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 coded is based on Ichimoku indicator, the volume weighded donchian is selfmade production // Β© pascorp //@version=5 indicator(title='Volume Based Ichimoku Cloud', shorttitle='Ichi VW', overlay=true) // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>>>> Inputs <<<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” conversionPeriods = input.int(defval=7, minval=1, title='Tenkan Sen Periods', group="Ichimoku") basePeriods = input.int(defval=22, minval=1, title='Kijun Sen Periods', group="Ichimoku") laggingSpan2Periods = input.int(defval=44, minval=1, title='Senkou Span B Periods', group="Ichimoku") displacement = input.int(defval=22, minval=1, title='Displacement', group="Ichimoku") typeDon = input.string(defval="Volume Based", title="Donchian type", options=["Classic", "Volume Based"]) shwCond = input(true, title="Show Ichimoku Condition") shwRev = input(true, title="Show Aggressive Reversal") // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>> Functions <<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” donchian(len) => math.avg(ta.lowest(len), ta.highest(len)) donchianVW(len) => num1 = math.sum(low*volume, len) den1 = math.sum(volume, len) lo = num1/den1 num2 = math.sum(high*volume, len) den2 = math.sum(volume, len) hi = num2/den2 math.avg(ta.lowest(lo,len), ta.highest(hi,len)) DONCHIAN(t, l) => switch t "Classic" => donchian(l) "Volume Based" => donchianVW(l) // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>>>> Core <<<<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” conversionLine = DONCHIAN(typeDon, conversionPeriods) baseLine = DONCHIAN(typeDon, basePeriods) leadLine1 = math.avg(conversionLine, baseLine) leadLine2 = DONCHIAN(typeDon, laggingSpan2Periods) SenkouSpanH = math.max(leadLine1[displacement - 1], leadLine2[displacement - 1]) SenkouSpanL = math.min(leadLine1[displacement - 1], leadLine2[displacement - 1]) // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>>>> Plots <<<<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” SpA = plot(leadLine1, offset=displacement - 1, color=color.new(#A5D6A7, 100), title='Leading Span A') SpB = plot(leadLine2, offset=displacement - 1, color=color.new(#EF9A9A, 100), title='Leading Span B') plot(conversionLine, color=color.new(color.blue, 0), title='Tenkan Sen', linewidth=2) plot(baseLine, color=color.new(color.red, 0), title='Kijun Sen', linewidth=2) plot(close, offset=-displacement + 1, color=color.new(color.green, 80), title='Chikou Span', linewidth=1) fill(SpA, SpB, color=leadLine1 > leadLine2 ? color.rgb(127, 255, 212, 70) : color.rgb(229, 43, 80, 70)) // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>> Conditions <<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” condSell = shwCond and close < conversionLine and close < close[displacement - 1] and conversionLine < baseLine and close < leadLine2[displacement - 1] and open < leadLine2[displacement - 1] and open < conversionLine and conversionLine < leadLine2[displacement - 1] and baseLine < leadLine2[displacement - 1] and conversionLine < leadLine1[displacement - 1] and baseLine < leadLine1[displacement - 1] and close < leadLine2[displacement * 2 - 1] plotshape(condSell, style=shape.square, location=location.bottom, color=color.new(color.red, 0), size=size.tiny, title='Dots Sell') condBuy = shwCond and close > conversionLine and close > close[displacement - 1] and conversionLine > baseLine and close > leadLine2[displacement - 1] and open > leadLine2[displacement - 1] and open > conversionLine and conversionLine > leadLine2[displacement - 1] and baseLine > leadLine2[displacement - 1] and conversionLine > leadLine1[displacement - 1] and baseLine > leadLine1[displacement - 1] and close > leadLine2[displacement * 2 - 1] plotshape(condBuy, style=shape.square, location=location.bottom, color=color.new(color.green, 0), size=size.tiny, title='Dots Sell') condRevBuy = shwRev and close > conversionLine and conversionLine > baseLine and baseLine > close[displacement - 1] and close < leadLine2[displacement - 1] plotshape(condRevBuy, style=shape.triangleup, location=location.bottom, color=color.new(color.aqua, 0), size=size.tiny, title='reversal Buy') condRevSell = shwRev and close < conversionLine and conversionLine < baseLine and baseLine < close[displacement - 1] and close > leadLine2[displacement - 1] plotshape(condRevSell, style=shape.triangledown, location=location.bottom, color=color.new(color.purple, 0), size=size.tiny, title='reversal Sell') // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>>>> Alerts <<<<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” tup = condBuy and not condBuy[1] and shwCond tdown = condSell and not condSell[1] and shwCond tRup = condRevBuy and not condRevBuy[1] and shwRev tRdown = condRevSell and not condRevSell[1] and shwRev if tdown alert("Regular SELL Ichimoku", alert.freq_once_per_bar_close) if tup alert("Regular BUY Ichimoku", alert.freq_once_per_bar_close) if tRup alert("Reversal BUY Ichimoku", alert.freq_once_per_bar_close) if tRdown alert("Reversal SELL Ichimoku", alert.freq_once_per_bar_close) // ══════════════════════════════════════════════════════════════════════════════════════════════════ // //# * ══════════════════════════════════════════════════════════════════════════════════════════════ //# * //# * Study : Trades Framework //# * Author : Β© pascorp //# * Purpose : Ability to optimize a study and observe trade simulation statistics accordingly //# * //# * Revision History //# * Release : Nov 30, 2021 : Initial Release //# * //# * //# * ══════════════════════════════════════════════════════════════════════════════════════════════ // ══════════════════════════════════════════════════════════════════════════════════════════════════ // // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>>>>>>> Inputs <<<<<<<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” shwLines = input(true, title="Show trade lines", group="Trades", inline="Lines") shwXbars = input(5, title="    per n bars", group="Trades", inline="Lines") gap = input.float(defval=0.1, step=0.05,title="Enter Gap", group="Trades") TP = input.float(defval=0.35, step=0.05,title="TakeProfit 1", group="Trades") TP2 = input.float(defval=0.7, step=0.05,title="TakeProfit 2", group="Trades") //BreakEven = input.float(defval=0.2, step=0.05,title="Break Even", group="Trades") SL = input.float(defval=0.35, step=0.05,title="StopLoss", group="Trades") // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // >>>>>>>>>>>>>>>>>>>> State Definition <<<<<<<<<<<<<<<<<<<<<< // β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” // trend trendUp = conversionLine > baseLine trendDown = conversionLine < baseLine // Trigger exit fascia trigger = tup or tdown or tRup or tRdown shwUp = false shwDown = false var enterUp = 0.0 var enterDown = 0.0 if trigger if trendDown enterDown := low*(1.0-gap/100) shwDown:=true if trendUp enterUp := high*(1.0+gap/100) shwUp:=true plotshape(shwUp?enterUp:na, location=location.absolute, style=shape.diamond, color = color.green) plotshape(shwDown?enterDown:na, location=location.absolute, style=shape.diamond, color = color.red) shwTotalUp=false for i = 1 to shwXbars shwTotalUp:= (shwTotalUp or shwUp[i]) and trendUp shwTotalDown = false for i = 1 to shwXbars shwTotalDown := (shwTotalDown or shwDown[i]) and trendDown plot(enterUp, color =shwTotalUp and shwLines ? color.gray : color.rgb(100,100,100,100)) plot(enterUp*(1.0+TP/100), color =shwTotalUp and shwLines ? color.green : color.rgb(100,100,100,100)) plot(enterUp*(1.0+TP2/100), color =shwTotalUp and shwLines ? color.yellow : color.rgb(100,100,100,100)) plot(enterUp*(1.0-SL/100), color =shwTotalUp and shwLines ? color.purple : color.rgb(100,100,100,100)) plot(enterDown, color =shwTotalDown and shwLines ? color.gray : color.rgb(100,100,100,100)) plot(enterDown*(1.0-TP/100), color =shwTotalDown and shwLines ? color.green : color.rgb(100,100,100,100)) plot(enterDown*(1.0-TP2/100), color =shwTotalDown and shwLines ? color.yellow : color.rgb(100,100,100,100)) plot(enterDown*(1.0+SL/100), color =shwTotalDown and shwLines ? color.purple : color.rgb(100,100,100,100))
TTM Squeeze Pro Bars
https://www.tradingview.com/script/9oGIxnJa-TTM-Squeeze-Pro-Bars/
Beardy_Fred
https://www.tradingview.com/u/Beardy_Fred/
524
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/ // Β© Beardy_Fred //@version=5 indicator('Beardy Squeeze Pro Bars', shorttitle='TTM Squeeze Pro Bars', overlay=true) length = input.int(20, "TTM Squeeze Length") //BOLLINGER BANDS BB_mult = input.float(2.0, "Bollinger Band STD Multiplier") BB_basis = ta.sma(close, length) dev = BB_mult * ta.stdev(close, length) BB_upper = BB_basis + dev BB_lower = BB_basis - dev //KELTNER CHANNELS KC_mult_high = input.float(1.0, "Keltner Channel #1") KC_mult_mid = input.float(1.5, "Keltner Channel #2") KC_mult_low = input.float(2.0, "Keltner Channel #3") KC_basis = ta.sma(close, length) devKC = ta.sma(ta.tr, length) KC_upper_high = KC_basis + devKC * KC_mult_high KC_lower_high = KC_basis - devKC * KC_mult_high KC_upper_mid = KC_basis + devKC * KC_mult_mid KC_lower_mid = KC_basis - devKC * KC_mult_mid KC_upper_low = KC_basis + devKC * KC_mult_low KC_lower_low = KC_basis - devKC * KC_mult_low //SQUEEZE CONDITIONS NoSqz = BB_lower < KC_lower_low or BB_upper > KC_upper_low //NO SQUEEZE: GREEN LowSqz = BB_lower >= KC_lower_low or BB_upper <= KC_upper_low //LOW COMPRESSION: BLACK MidSqz = BB_lower >= KC_lower_mid or BB_upper <= KC_upper_mid //MID COMPRESSION: RED HighSqz = BB_lower >= KC_lower_high or BB_upper <= KC_upper_high //HIGH COMPRESSION: ORANGE //MOMENTUM OSCILLATOR mom = ta.linreg(close - math.avg(math.avg(ta.highest(high, length), ta.lowest(low, length)), ta.sma(close, length)), length, 0) //MOMENTUM HISTOGRAM COLOR iff_1 = mom > nz(mom[1]) ? color.new(color.aqua, 0) : color.new(#2962ff, 0) iff_2 = mom < nz(mom[1]) ? color.new(color.red, 0) : color.new(color.yellow, 0) mom_color = mom > 0 ? iff_1 : iff_2 barcolor(mom_color)