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
Glassnode BTC SOPR Toolkit
https://www.tradingview.com/script/xfBQUF2i-Glassnode-BTC-SOPR-Toolkit/
JBroadway
https://www.tradingview.com/u/JBroadway/
160
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/ // © JBroadway // NOTE: Due to data source, data can only be displayed on a 1 day chart. // SOPR stand for Spent Output Profit Ratio. It’s a Bitcoin on-chain metric that // shows whether Bitcoin spent outputs (UTXO’s) are being realized in profit or // loss. It’s calculated by dividing realized value by the value at creation // (price sold / price paid). // SOPR servers as a great short/mid-term indicator. //@version=5 indicator("Glassnode BTC SOPR Toolkit", shorttitle="BTC SOPR Toolkit", timeframe="D") //////////////////////////////////////////////////////////////////////////////// //FUNCTIONS //////////////////////////////////////////////////////////////////////////////// //On-chain volume metric btc_vol = request.security("GLASSNODE:BTC_TOTALVOLUME", "D", close) vwma(src, length, vol_src) => out = ta.sma(src * vol_src, length) / ta.sma(vol_src, length) out vw_ema(src, length, vol_src) => out = ta.ema(src * vol_src, length) / ta.ema(vol_src, length) out //////////////////////////////////////////////////////////////////////////////// //INIT VARS //////////////////////////////////////////////////////////////////////////////// //SOPR //------------------------------------------------------------------------------ sopr = request.security("GLASSNODE:BTC_SOPR", timeframe="D", expression=close) sopr_adjusted = (sopr - 1) * 60 show_sopr = input.bool(false, title="SOPR", group="Tools") //SOPR Smoothing Vars //------------------------------------------------------------------------------ show_sopr_smoothing = input.bool(true, title="SOPR Smoothed", group="Tools") ma_length = input(10, "MA Length", tooltip="Moving Average Length", group="SOPR Smoothing") ma_type = input.string("EMA", title="MA Type", tooltip="Moving Average Type", options=["SMA", "EMA", "VW-SMA", "VW-EMA"], group="SOPR Smoothing") //SOPR Spikes Vars //------------------------------------------------------------------------------ show_sopr_spikes = input.bool(false, title="SOPR Spikes", group="Tools") bb_length = input(20, title="Length", group="SOPR Spikes") bb_std_dev = input(2 , "StdDev", tooltip="Standard Deviation", group="SOPR Spikes") //MISC Settings //------------------------------------------------------------------------------ show_range = input.bool(false, title="Show Bollinger Bands", group="MISC Settings") //////////////////////////////////////////////////////////////////////////////// //SOPR SMOOTHING //////////////////////////////////////////////////////////////////////////////// //Arrays //------------------------------------------------------------------------------ var pos_array = array.new_float(2) var neg_array = array.new_float(2) array.shift(pos_array) array.shift(neg_array) //Separate SOPR into distinced array based on if SOPR is > or < 1 //Value of 1 will be added to opposing array if SOPR positive/negative //For example if SOPR is 1.10, 1.10 will be added to pos_array, 1 is added to neg_array //IF SOPR is 0.8, 0.8 is added to neg_array, 1 is added to pos_array if sopr > 1 array.push(pos_array, sopr) array.push(neg_array, 1) else array.push(pos_array, 1) array.push(neg_array, sopr) //Convert data into relative values (easier to manage) positive = (array.get(pos_array, 1) - 1) * 100 negative = (1 - array.get(neg_array, 1)) * 100 //Moving average for positive array sopr_pos_ma = switch ma_type "SMA" => ta.sma(positive, ma_length) "EMA" => ta.ema(positive, ma_length) "VW-SMA" => vwma(positive, ma_length, btc_vol) "VW-EMA" => vw_ema(positive, ma_length, btc_vol) //Moving average for negative array sopr_neg_ma = switch ma_type "SMA" => ta.sma(negative, ma_length) "EMA" => ta.ema(negative, ma_length) "VW-SMA" => vwma(negative, ma_length, btc_vol) "VW-EMA" => vw_ema(negative, ma_length, btc_vol) //SOPR Smoothing Calculation sopr_smoothing = sopr_pos_ma - sopr_neg_ma //////////////////////////////////////////////////////////////////////////////// //SOPR SPIKES //////////////////////////////////////////////////////////////////////////////// //Bollinger Bands [middle, upper, lower] = ta.bb(sopr_adjusted, bb_length, bb_std_dev) //SOPR spikes Calculation sopr_spikes = if sopr_adjusted > upper or sopr_adjusted < lower sopr_adjusted // plot(lower) // plot(upper, color=color.red) //////////////////////////////////////////////////////////////////////////////// //PLOTTING //////////////////////////////////////////////////////////////////////////////// //SOPR //------------------------------------------------------------------------------ plot(sopr_adjusted, color=show_sopr ? color.white : na, title="SOPR") //SOPR Smoothing //------------------------------------------------------------------------------ //Colors sm_c = if show_sopr_smoothing == true sopr_smoothing > 0 ? color.new(color.green, 0) : color.red else na //Fill Colors sm_f = if show_sopr_smoothing == true sopr_smoothing > 0 ? color.new(color.green, 90) : color.new(color.red, 90) else na //Smoothing Plot sopr_p = plot(sopr_smoothing, title="SOPR Smoothing", color=sm_c) //SOPR Spikes //------------------------------------------------------------------------------ //Colors spikes_c = if sopr_adjusted > 0 color.green else color.red //Spikes Plot plot(sopr_spikes, title="SOPR Spikes", color=show_sopr_spikes ? spikes_c : na, style=plot.style_histogram, linewidth=5) //SOPR Range //------------------------------------------------------------------------------ plot(upper, title="Upper Bollinger Band", color=show_range ? color.yellow : na, style=plot.style_cross) plot(lower, title="Lower Bollinger Band", color=show_range ? color.yellow : na, style=plot.style_cross) //Misc Plotting //------------------------------------------------------------------------------ hline(0, editable=false) zero = plot(0, color=na, display=display.none) //Fill Colors //------------------------------------------------------------------------------ fill(sopr_p, zero, color=sm_f) //////////////////////////////////////////////////////////////////////////////// //DEBUG //////////////////////////////////////////////////////////////////////////////// // plot(positive, color=color.green) // plot(sopr_pos_ma, color=color.green) // plot(neagtive, color=color.green) // plot(sopr_neg_ma, color=color.red)
[TTI] ATR channels
https://www.tradingview.com/script/kUiAg989-TTI-ATR-channels/
TintinTrading
https://www.tradingview.com/u/TintinTrading/
173
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/ // © TintinTrading //@version=5 indicator(title='[TTI] ATR channels', overlay=true, shorttitle='ATRch') //USER INPUTS length = input.int(20, minval=0, title='Average length', tooltip = 'Moving average length') inst_length = input.int(200, minval = 0, maxval=500, title = 'Institutional Length', tooltip = 'Define the length for the Institutional averages') //TURN ON/OFF CONDITIONS FOR ATRS ATR1_on = input.bool (defval = true, tooltip = 'Show First ATR', inline = '1x', group='Short Term ATRs') ATR2_on = input.bool (defval = true, tooltip = 'Show Second ATR', inline = '2x', group='Short Term ATRs') ATR3_on = input.bool (defval = true, tooltip = 'Show Third ATR', inline = '3x', group='Short Term ATRs') ATR5_on = input.bool (defval = false, tooltip = 'Show Mid Term Institutional ATR', inline = '5x', group='Institutional ATRs') ATR10_on = input.bool (defval = false, tooltip = 'Show Long Term Institutional ATR', inline = '10x', group='Institutional ATRs') ATR_LAST = input.bool (defval = true, inline = 'll', group='Show Last ATRs') ATR_LASTD = input.int (defval = 10, title = 'Show Last X bars', inline = 'll', group='Show Last ATRs') //KELTNER CHANNEL MULTIPLIERS multiplier1 = input.int(1, minval=0, title='ATR Multiplier 1', tooltip = 'Customise how long you want the first multiplier', inline = '1x', group='Short Term ATRs') multiplier2 = input.int(2, minval=0, title='ATR Multiplier 2', tooltip = 'Customise how long you want the second multiplier', inline = '2x', group='Short Term ATRs') multiplier3 = input.int(3, minval=0, title='ATR Multiplier 3', tooltip = 'Customise how long you want the third multiplier', inline = '3x', group='Short Term ATRs') multiplier5 = input.int(5, minval=0, title='Mid Term ATR Multiplier 1', tooltip = 'Customise how long you want the third multiplier', inline = '5x', group='Institutional ATRs') multiplier10 = input.int(10, minval=0, title='Long Term ATR Multiplier 2', tooltip = 'Customise how long you want the third multiplier', inline = '10x', group='Institutional ATRs') //CALCULATIONS //{ exponential1 = input(true, title='Exponential MA?') ema_1 = ta.ema(close, length) sma_1 = ta.sma(close, length) mean = exponential1 ? ema_1 : sma_1 exponential2 = input(true, title='Exponential ATR?') ema_2 = ta.ema(ta.tr, length) sma_2 = ta.sma(ta.tr, length) ATR = exponential2 ? ema_2 : sma_2 //} //SHORT TERM ATRS //{{ ATR3 = mean + multiplier3 * ATR ATR2 = mean + multiplier2 * ATR ATR1 = mean + multiplier1 * ATR ATR_1 = mean - multiplier1 * ATR ATR_2 = mean - multiplier2 * ATR ATR_3 = mean - multiplier3 * ATR //}} //LONG TERM ATRS //{{ ATR5 = ta.ema(close,inst_length) + multiplier5 * ta.ema(ta.tr, inst_length) ATR10 = ta.ema(close,inst_length) + multiplier10 * ta.ema(ta.tr, inst_length) ATR_5 = ta.ema(close,inst_length) - multiplier5 * ta.ema(ta.tr, inst_length) ATR_10 = ta.ema(close,inst_length) - multiplier10 * ta.ema(ta.tr, inst_length) //}} //PLOTTING //{{ ATRR10 = plot(ATR10_on and not ATR_LAST ? ATR10 : na, title = "LT Institutional ATR", color = color.new(color.blue,0), style = plot.style_circles) ATRR5 = plot(ATR5_on and not ATR_LAST ? ATR5 : na, title = "MT Institutional ATR", color = color.new(color.purple,0), style = plot.style_circles) ATRR3 = plot(ATR3_on and not ATR_LAST ? ATR3 : na, title="3x Plus", color=color.new(color.white, 0)) ATRR2 = plot(ATR2_on and not ATR_LAST ? ATR2 : na, title="2x Plus", color=color.new(color.green, 0)) ATRR1 = plot(ATR1_on and not ATR_LAST ? ATR1 : na, title="1x Plus", color=color.new(color.white, 50)) ATRRm = plot(mean, title="Mid line", color=color.new(color.aqua, 0), linewidth=3) ATRR1_ = plot(ATR1_on and not ATR_LAST ? ATR_1 : na, title="1x Minus", color=color.new(color.white, 50)) ATRR2_ = plot(ATR2_on and not ATR_LAST ? ATR_2 : na, title="2x Minus", color=color.new(color.red, 0)) ATRR3_ = plot(ATR3_on and not ATR_LAST ? ATR_3 : na, title="3x Minus", color=color.new(color.white, 0)) ATRR5_ =plot(ATR5_on and not ATR_LAST ? ATR_5 : na, title = "MT Institutional ATR", color = color.new(color.purple ,0), style = plot.style_circles) ATRR10_ =plot(ATR10_on and not ATR_LAST ? ATR_10 : na, title = "LT Institutional ATR", color = color.new(color.blue,0), style = plot.style_circles) //Show LAST 10 ATRR10L = plot(ATR10_on and ATR_LAST ? ATR10 : na, title = "LT Institutional ATR", color = color.new(color.blue,0), style = plot.style_circles, show_last = ATR_LASTD) ATRR5L = plot(ATR5_on and ATR_LAST ? ATR5 : na, title = "MT Institutional ATR", color = color.new(color.purple,0), style = plot.style_circles, show_last = ATR_LASTD) ATRR3L = plot(ATR3_on and ATR_LAST ? ATR3 : na, title="3x Plus", color=color.new(color.white, 0), show_last = ATR_LASTD) ATRR2L = plot(ATR2_on and ATR_LAST ? ATR2 : na, title="2x Plus", color=color.new(color.green, 0), show_last = ATR_LASTD) ATRR1L = plot(ATR1_on and ATR_LAST ? ATR1 : na, title="1x Plus", color=color.new(color.white, 50), show_last = ATR_LASTD) //ATRRm = plot(mean, title="Mid line", color=color.new(color.aqua, 0), linewidth=3) ATRR1_L = plot(ATR1_on and ATR_LAST ? ATR_1 : na, title="1x Minus", color=color.new(color.white, 50), show_last = ATR_LASTD) ATRR2_L = plot(ATR2_on and ATR_LAST ? ATR_2 : na, title="2x Minus", color=color.new(color.red, 0), show_last = ATR_LASTD) ATRR3_L = plot(ATR3_on and ATR_LAST ? ATR_3 : na, title="3x Minus", color=color.new(color.white, 0), show_last = ATR_LASTD) ATRR5_L =plot(ATR5_on and ATR_LAST ? ATR_5 : na, title = "MT Institutional ATR", color = color.new(color.purple ,0), style = plot.style_circles, show_last = ATR_LASTD) ATRR10_L =plot(ATR10_on and ATR_LAST ? ATR_10 : na, title = "LT Institutional ATR", color = color.new(color.blue,0), style = plot.style_circles, show_last = ATR_LASTD) //FILL between insitutional ATRS fill(ATRR5,ATRR5_ , color = color.new(color.purple,80), title = 'MT Insitutional ATR fill') fill(ATRR10,ATRR5, color = color.new(color.blue,80), title = 'LT Insitutional ATR+ fill') fill(ATRR10_,ATRR5_, color = color.new(color.blue,80), title = 'LT Insitutional ATR– fill') //}}
ROC vs BTC
https://www.tradingview.com/script/VaLL18J2-ROC-vs-BTC/
HayeTrading
https://www.tradingview.com/u/HayeTrading/
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/ // © HayeTrading //@version=5 indicator("ROC vs BTC") roclen = input.int(10, "ROC Length") roc = ta.roc(close, roclen) btcroc = request.security("BINANCE:BTCUSDT", "", roc) length = input(500, "Percent Order Lookback") col = roc > 0 ? color.rgb(50,255,0,transp=20) : color.rgb(255,0,0,transp=20) // Current ticker, create arrays and pos/neg counts pos = array.new_float(0) neg = array.new_float(0) poscount = 0 negcount = 0 // Create BTC Arrays and pos/neg counts btcpos = array.new_float(0) btcneg = array.new_float(0) btc_poscount = 0 btc_negcount = 0 for i=0 to length - 1 if roc[i] > 0 array.push(pos, roc[i]) poscount += 1 else if roc[i] < 0 array.push(neg, roc[i]) negcount += 1 if btcroc[i] > 0 array.push(btcpos, btcroc[i]) btc_poscount += 1 else if btcroc[i] < 0 array.push(btcneg, btcroc[i]) btc_negcount += 1 // Sort arrays, positive ascending, negative descending array.sort(pos, order.ascending) array.sort(neg, order.descending) array.sort(btcpos, order.ascending) array.sort(btcneg, order.descending) // Calculate index of current ROC values within newly ordered arrays posindex = array.indexof(pos, roc) negindex = array.indexof(neg, roc) btc_posindex = array.indexof(btcpos, btcroc) btc_negindex = array.indexof(btcneg, btcroc) // Calculate index values as percentage of array length, end values will be -100 to 100. pospercent = ((posindex + 1) / poscount) * 100 negpercent = ((negindex + 1) / negcount) * 100 btc_pospercent = ((btc_posindex + 1) / btc_poscount) * 100 btc_negpercent = -(((btc_negindex + 1) / btc_negcount) * 100) btc = btc_pospercent == 0 ? btc_negpercent : btc_pospercent // Plot values. Negative ROC plotted as negative values. // The highest ROC move down will be -100. Highest ROC move up will be 100. plot(pospercent, style=plot.style_columns, color=col) plot(-negpercent, style=plot.style_columns, color=col) plot(btc, linewidth=2) plot(50, style=plot.style_cross) plot(-50, style=plot.style_cross)
[VIP] Composite BTC Funding Rate APR
https://www.tradingview.com/script/EvIdkuJM-VIP-Composite-BTC-Funding-Rate-APR/
authorofthesurf
https://www.tradingview.com/u/authorofthesurf/
745
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/ // © authorofthesurf & jacuotta // Adopted from "Funding Rate FTX-Binance" by @CarlosGV // https://www.tradingview.com/script/3XLrvgck/ // References used: // https://help.ftx.com/hc/en-us/articles/360027946571-Funding // Summary: The funding rate is the interest charged / credited to a // perpetual futures trader for taking a long or short position. The // direction of the funding rate is used as an indicator of trader sentiment // (+ve = bullish; -ve = bearish), and therefore useful to plot in real time. // // The FTX exchange has published the calculation of their funding rate as // follows: TWAP((future - index) / index) / 24 // // The formula here is the same, but expresses it in the more common % per 8hr duration: // funding = TWAP((future / index) - 1) * (8 / 24) * 100 // // For reference: future refers to the FTX bitcoin futures contract price (FTX:BTCPERP) and index // is the spot price of bitcoin on the exchange (FTX:BTCUSD) //@version=5 indicator("[VIP] Composite BTC Funding Rate APR v3.2.2", format=format.percent) //// BTC Funding Module { // Match current chart funding_interval = '' twap_interval = '' PERP_BITMEX = 'BITMEX:XBTUSD.P' PERP_BINANCE_USDT = 'BINANCE:BTCUSDTPERP' PERP_BINANCE_USD = 'BINANCE:BTCPERP' PERP_BYBIT_USDT = 'BYBIT:BTCUSDT.P' PERP_BYBIT_USD = 'BYBIT:BTCUSD.P' PERP_BINANCE_BUSD = 'BINANCE:BTCBUSDPERP' SPOT_BITSTAMP = 'BITSTAMP:BTCUSD' SPOT_BINANCE = 'BINANCE:BTCUSDT' SPOT_COINBASE = 'COINBASE:BTCUSD' SPOT_KRAKEN = 'KRAKEN:BTCUSD' // Prevent repainting with security function f_secureSecurity(_symbol, _res, _src) => request.security(_symbol, _res, _src[1], lookahead=barmerge.lookahead_on) // Get pricing data across exchanges p1 = f_secureSecurity(PERP_BITMEX, funding_interval, ohlc4) p2 = f_secureSecurity(PERP_BINANCE_USDT, funding_interval, ohlc4) p3 = f_secureSecurity(PERP_BINANCE_USD, funding_interval, ohlc4) p4 = f_secureSecurity(PERP_BYBIT_USDT, funding_interval, ohlc4) p5 = f_secureSecurity(PERP_BYBIT_USD, funding_interval, ohlc4) p6 = f_secureSecurity(PERP_BINANCE_BUSD, funding_interval, ohlc4) [s1, h1, l1, c1] = request.security(SPOT_BITSTAMP, funding_interval, [ohlc4[1], high[1], low[1], close[1]], lookahead=barmerge.lookahead_on) [s2, h2, l2, c2] = request.security(SPOT_BINANCE, funding_interval, [ohlc4[1], high[1], low[1], close[1]], lookahead=barmerge.lookahead_on) [s3, h3, l3, c3] = request.security(SPOT_COINBASE, funding_interval, [ohlc4[1], high[1], low[1], close[1]], lookahead=barmerge.lookahead_on) [s4, h4, l4, c4] = request.security(SPOT_KRAKEN, funding_interval, [ohlc4[1], high[1], low[1], close[1]], lookahead=barmerge.lookahead_on) perp_twap_price = 0.0 spot_twap_price = 0.0 spot_twap_high = 0.0 spot_twap_low = 0.0 spot_twap_close = 0.0 i = 0 j = 0 if not na(p1) perp_twap_price += p1 i += 1 if not na(p2) perp_twap_price += p2 i += 1 if not na(p3) perp_twap_price += p3 i += 1 if not na(p4) perp_twap_price += p4 i += 1 if not na(p5) perp_twap_price += p5 i += 1 if not na(p6) perp_twap_price += p6 i += 1 if not na(s1) spot_twap_price += s1 spot_twap_high += h1 spot_twap_low += l1 spot_twap_close += c1 j += 1 if not na(s2) spot_twap_price += s2 spot_twap_high += h2 spot_twap_low += l2 spot_twap_close += c2 j += 1 if not na(s3) spot_twap_price += s3 spot_twap_high += h3 spot_twap_low += l3 spot_twap_close += c3 j += 1 if not na(s4) spot_twap_price += s4 spot_twap_high += h4 spot_twap_low += l4 spot_twap_close += c4 j += 1 // Calculate internal prices and make available for other parts of the script perp_twap_price /= i spot_twap_price /= j spot_twap_high /= j spot_twap_low /= j spot_twap_close /= j // Calculates number of bars, e.g. 24 hourly bars in the past 1 day bars_elapsed = ta.barssince(ta.change(f_secureSecurity(syminfo.tickerid, twap_interval, time))) // >0 = Perp is higher price = positive funding // <0 = Perp is lower price = negative funding ratio = perp_twap_price / spot_twap_price - 1 smoothed_average_price = 0.0 smoothed_average_price := bars_elapsed > 0 ? ratio + nz(smoothed_average_price[1]) : ratio // Raw funding value twap_ratio = smoothed_average_price / (bars_elapsed + 1) AS_PERCENTAGE = 100 AS_APY = 365 funding = twap_ratio * AS_PERCENTAGE * AS_APY //} END BTC Funding Module //// Display limit_values = input.bool(true, title="Limit Extreme Values", group="Bars", tooltip="Limits funding values between -100% and 100%") if funding > 100 and limit_values funding := 100 if funding < -100 and limit_values funding := -100 funding_color = funding > 0 ? color.green : color.red if funding == 0.0 funding_color := color.rgb(0, 0, 0, 100) plot(funding, title="funding", color=funding_color, linewidth=2, style=plot.style_histogram)
Prime Distance Frame Quant Model for Risk Reward & Pivot Points
https://www.tradingview.com/script/wv8x3FFn-Prime-Distance-Frame-Quant-Model-for-Risk-Reward-Pivot-Points/
Eliza123123
https://www.tradingview.com/u/Eliza123123/
84
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/ // © Eliza123123 //@version=4 study("Prime Frame", overlay = true) scale = 0.0 if close > 10000 scale := 1000 if close > 999.999999 and close <= 10000 scale := 100 if close >= 100 and close <= 999.999999 scale := 10 if close >= 10 and close <= 99.999999 scale := 1 if close >= 1 and close <= 9.999999 scale := 0.1 if close >= 0.1 and close <= 0.999999 scale := 0.01 if close >= 0.01 and close <= 0.0999999 scale := 0.001 if close >= 0.001 and close <= 0.00999999 scale := 0.0001 prime2 = 2 * scale, prime3 = 3 * scale, prime5 = 5 * scale, prime7 = 7 * scale, prime11 = 11 * scale, prime13 = 13 * scale, prime17 = 17 * scale prime19 = 19 * scale, prime23 = 23 * scale, prime29 = 29 * scale, prime31 = 31 * scale, prime37 = 37 * scale, prime41 = 41 * scale, prime43 = 43 * scale prime47 = 47 * scale, prime53 = 53 * scale, prime59 = 59 * scale, prime61 = 61 * scale, prime67 = 67 * scale, prime71 = 71 * scale, prime73 = 73 * scale prime79 = 79 * scale, prime83 = 83 * scale, prime89 = 89 * scale, prime97 = 97 * scale plot2 = plot(prime2, color = color.olive, linewidth = 2) plot3 = plot(prime3, color = color.olive, linewidth = 2) plot5 = plot(prime5, color = color.olive, linewidth = 2) plot7 = plot(prime7, color = color.olive, linewidth = 2) plot11 = plot(prime11, color = color.olive, linewidth = 2) plot13 = plot(prime13, color = color.olive, linewidth = 2) plot17 = plot(prime17, color = color.olive, linewidth = 2) plot19 = plot(prime19, color = color.olive, linewidth = 2) plot23 = plot(prime23, color = color.olive, linewidth = 2) plot29 = plot(prime29, color = color.olive, linewidth = 2) plot31 = plot(prime31, color = color.olive, linewidth = 2) plot37 = plot(prime37, color = color.olive, linewidth = 2) plot41 = plot(prime41, color = color.olive, linewidth = 2) plot43 = plot(prime43, color = color.olive, linewidth = 2) plot47 = plot(prime47, color = color.olive, linewidth = 2) plot53 = plot(prime53, color = color.olive, linewidth = 2) plot59 = plot(prime59, color = color.olive, linewidth = 2) plot61 = plot(prime61, color = color.olive, linewidth = 2) plot67 = plot(prime67, color = color.olive, linewidth = 2) plot71 = plot(prime71, color = color.olive, linewidth = 2) plot73 = plot(prime73, color = color.olive, linewidth = 2) plot79 = plot(prime79, color = color.olive, linewidth = 2) plot83 = plot(prime83, color = color.olive, linewidth = 2) plot89 = plot(prime89, color = color.olive, linewidth = 2) plot97 = plot(prime97, color = color.olive, linewidth = 2) indicator_roof = 100 * scale indicator_roofplot = plot(indicator_roof, color = color.white) //Prime Gap of 1 fill(plot2, plot3, color = color.red, transp = 80) //Prime Gap of 2 fill(plot3, plot5, color = color.aqua, transp = 80) fill(plot5, plot7, color = color.aqua, transp = 80) fill(plot11, plot13, color = color.aqua, transp = 80) fill(plot17, plot19, color = color.aqua, transp = 80) fill(plot29, plot31, color = color.aqua, transp = 80) fill(plot41, plot43, color = color.aqua, transp = 80) fill(plot59, plot61, color = color.aqua, transp = 80) fill(plot71, plot73, color = color.aqua, transp = 80) //Prime Gap of 4 fill(plot7, plot11, color = color.yellow, transp = 80) fill(plot13, plot17, color = color.yellow, transp = 80) fill(plot19, plot23, color = color.yellow, transp = 80) fill(plot37, plot41, color = color.yellow, transp = 80) fill(plot43, plot47, color = color.yellow, transp = 80) fill(plot67, plot71, color = color.yellow, transp = 80) fill(plot79, plot83, color = color.yellow, transp = 80) //Prime Gap of 6 fill(plot23, plot29, color = color.purple, transp = 80) fill(plot31, plot37, color = color.purple, transp = 80) fill(plot47, plot53, color = color.purple, transp = 80) fill(plot53, plot59, color = color.purple, transp = 80) fill(plot61, plot67, color = color.purple, transp = 80) fill(plot73, plot79, color = color.purple, transp = 80) fill(plot83, plot89, color = color.purple, transp = 80) //Prime Gap of 8 fill(plot89, plot97, color = color.lime, transp = 80) //Indicator Roof fill(plot97, indicator_roofplot, color = color.white, transp = 0)
MA Visualizer
https://www.tradingview.com/script/y9QNtCeG-MA-Visualizer/
Satosaur
https://www.tradingview.com/u/Satosaur/
73
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/ // © Satosaur //@version=5 //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>// //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<// //>_________________________________________________________________________________>>>>>// //<|\ ____\|\ __ \|\___ ___\\ __ \|\ ____\|\ __ \|\ \|\ \|\ __ \<<<<<// //>\ \ \___|\ \ \|\ \|___ \ \_\ \ \|\ \ \ \___|\ \ \|\ \ \ \\\ \ \ \|\ \>>>>// //<<\ \_____ \ \ __ \<<<\ \ \<\ \ \\\ \ \_____ \ \ __ \ \ \\\ \ \ _ _\<<<// //>>>\|____|\ \ \ \ \ \>>>\ \ \>\ \ \\\ \|____|\ \ \ \ \ \ \ \\\ \ \ \\ \|>>// //<<<<<____\_\ \ \__\ \__\<<<\ \__\<\ \_______\____\_\ \ \__\ \__\ \_______\ \__\\ _\<<// //>>>>|\_________\|__|\|__|>>>>\|__|>>\|_______|\_________\|__|\|__|\|_______|\|__|\|__|>// //<<<<\|_________|<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\|_________|<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<// //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[@satosaur]>>>>// //>>>>>>>>>>>>[Donate Bitcoin = bc1qq8r40efa7cqv2w6d0dkn8at3qcgc5gng3mxcda]>>>>>>>>>>>>>>// //If you like my indicators or use any part of my code, please give credit and consider dontating bitcoin - bc1qq8r40efa7cqv2w6d0dkn8at3qcgc5gng3mxcda //follow me on twitter @satosaur indicator(title='MA Visualizer 🌈', overlay=true) //--- MA Type Calculations --- MA_Type(source, length, type) => type == 'SMA' ? ta.sma(source, length) : type == 'EMA' ? ta.ema(source, length) : type == 'RMA' ? ta.rma(source, length) : type == 'HMA' ? ta.hma(source, length) : type == 'WMA' ? ta.wma(source, length) : type == 'VWMA' ? ta.vwma(source, length) : type == 'LSMA' ? ta.linreg(source, length, 0) : type == 'ALMA' ? ta.alma(source, length, 0.85, 6) : type == 'MEDIAN' ? ta.median(source, length) : na //--- Inputs --- MA_Info = "SMA = Simple Moving Average \nEMA = Exponential Moving Average \nRMA = Relative Moving Average \nHMA = Hull Moving Average \nWMA = Weighted Moving Average \nVWMA = Volume-Weighted Moving Average \nLSMA = Least Square Moving Average \nALMA = Arnaud Legoux Moving Average \nMEDIAN = Median Moving Average" ShowLines = input.bool(false, 'Show MA Lines', inline='options') ShowVisualizer = input.bool(true, 'Show Visualizer', inline='options') ShowMA_Labels = input.bool(true, 'Show MA Labels', inline='options') AltCol = input.string('Green/Red', 'Color Selection', inline='options2', options=['Green/Red', 'Blue/Purple', 'Yellow/Pink', 'Pastel','Rainbow', 'Blue', 'Grey'], tooltip=MA_Info) //MA 1 showMA1 = input.bool(true, 'MA 1', inline='MA 1') MA1_type = input.string('EMA', '', inline='MA 1', options=['SMA', 'EMA', 'RMA', 'HMA', 'WMA', 'VWMA', 'LSMA', 'ALMA', 'MEDIAN']) len_MA1 = input.int(14, '', minval=1, inline='MA 1') src_MA1 = input.source(close, '', inline='MA 1') MA1 = MA_Type(src_MA1, len_MA1, MA1_type) //MA 2 showMA2 = input.bool(true, 'MA 2', inline='MA 2') MA2_type = input.string('EMA', '', inline='MA 2', options=['SMA', 'EMA', 'RMA', 'HMA', 'WMA', 'VWMA', 'LSMA', 'ALMA', 'MEDIAN']) len_MA2 = input.int(21, '', minval=1, inline='MA 2') src_MA2 = input.source(close, '', inline='MA 2') MA2 = MA_Type(src_MA2, len_MA2, MA2_type) //MA 3 showMA3 = input.bool(true, 'MA 3', inline='MA 3') MA3_type = input.string('EMA', '', inline='MA 3', options=['SMA', 'EMA', 'RMA', 'HMA', 'WMA', 'VWMA', 'LSMA', 'ALMA', 'MEDIAN']) len_MA3 = input.int(50, '', minval=1, inline='MA 3') src_MA3 = input.source(close, '', inline='MA 3') MA3 = MA_Type(src_MA3, len_MA3, MA3_type) //MA 4 showMA4 = input.bool(true, 'MA 4', inline='MA 4') MA4_type = input.string('EMA', '', inline='MA 4', options=['SMA', 'EMA', 'RMA', 'HMA', 'WMA', 'VWMA', 'LSMA', 'ALMA', 'MEDIAN']) len_MA4 = input.int(100, '', minval=1, inline='MA 4') src_MA4 = input.source(close, '', inline='MA 4') MA4 = MA_Type(src_MA4, len_MA4, MA4_type) //MA 5 showMA5 = input.bool(true, 'MA 5', inline='MA 5') MA5_type = input.string('EMA', '', inline='MA 5', options=['SMA', 'EMA', 'RMA', 'HMA', 'WMA', 'VWMA', 'LSMA', 'ALMA', 'MEDIAN']) len_MA5 = input.int(200, '', minval=1, inline='MA 5') src_MA5 = input.source(close, '', inline='MA 5') MA5 = MA_Type(src_MA5, len_MA5, MA5_type) //--- Crosses //MA Cross CrossLabel = input.bool(true, title='Show MA Cross Labels', group="MA Cross Settings", inline='MAC1') MAC1_type = input.string('EMA', 'MA Cross 1', group="MA Cross Settings", inline='MAC2', options=['SMA', 'EMA', 'RMA', 'HMA', 'WMA', 'VWMA', 'LSMA', 'ALMA', 'MEDIAN']) len_MAC1 = input.int(50, '', group="MA Cross Settings", inline='MAC2') src_MAC1 = input.source(close, '', group="MA Cross Settings", inline='MAC2') MAC1 = MA_Type(src_MAC1, len_MAC1, MAC1_type) MAC2_type = input.string('EMA', 'MA Cross 2', group="MA Cross Settings", inline='MAC3', options=['SMA', 'EMA', 'RMA', 'HMA', 'WMA', 'VWMA', 'LSMA', 'ALMA', 'MEDIAN']) len_MAC2 = input.int(200, '', group="MA Cross Settings", inline='MAC3') src_MAC2 = input.source(close, '', group="MA Cross Settings", inline='MAC3') MAC2 = MA_Type(src_MAC2, len_MAC2, MAC2_type) //Visualizer MA MAV_type = 'EMA' src_MAV = input(close, 'Visualizer Source', inline='Visualizer', tooltip="If you like this indicator follow me on twitter \n@satosaur \n\nConsider donating bitcoin bc1qq8r40efa7cqv2w6d0dkn8at3qcgc5gng3mxcda") len_MAV = 1 MAV = MA_Type(src_MAV, len_MAV, MAV_type) //--- Cross Settings --- CrossO = ta.crossover(MAC1, MAC2) CrossU = ta.crossunder(MAC1, MAC2) //--- Color Palette --- WHITE = color.rgb(255,255,255,0) DarkPigmentGREEN = color.rgb(0,153,77,0) MediumBLUE = color.rgb(0,119,179,0) AwesomeRED = color.rgb(248,32,96,0) ElectricPURPLE = color.rgb(191,0,230,0) TurquoiseBLUE = color.rgb(38,198,218,0) DarkPastelBLUE = color.rgb(119,158,203,0) DarkPastelPURPLE = color.rgb(150,111,214,0) PastelGREY = color.rgb(207,207,196,0) DarkGREY = color.rgb(85,85,85,0) SapphireBLUE = color.rgb(18,97,128,0) FluroPINK = color.rgb(255,20,147,0) ElectricYELLOW = color.rgb(255,255,0) PaleMAGENTA = color.rgb(249,132,229,0) CaribbeanGREEN = color.rgb(0,216,160,0) DimPastelRED = color.rgb(194,59,34,0) //--- Color Calculations --- //Line Colors Color1 = AltCol == 'Green/Red' ? color.new(DarkPigmentGREEN,60) : AltCol == 'Blue/Purple' ? color.new(MediumBLUE,60) : AltCol == 'Yellow/Pink' ? color.new(ElectricYELLOW,60) : AltCol == 'Pastel' ? color.new(DarkPastelBLUE,60) : AltCol == 'Blue' ? color.new(TurquoiseBLUE,60) : AltCol == 'Grey' ? color.new(PastelGREY,60) : color.new(DarkPigmentGREEN,60) // Green Line Color2 = AltCol == 'Green/Red' ? color.new(AwesomeRED,60) : AltCol == 'Blue/Purple' ? color.new(ElectricPURPLE,60) : AltCol == 'Yellow/Pink' ? color.new(FluroPINK,60) : AltCol == 'Pastel' ? color.new(DarkPastelPURPLE,60) : AltCol == 'Blue' ? color.new(SapphireBLUE,60) : AltCol == 'Grey' ? color.new(DarkGREY,60) : color.new(AwesomeRED,60) // Red Line //Visualizer Colors VColor1 = AltCol == 'Green/Red' ? color.new(DarkPigmentGREEN,87) : AltCol == 'Blue/Purple' ? color.new(MediumBLUE,87) : AltCol == 'Yellow/Pink' ? color.new(ElectricYELLOW,87) : AltCol == 'Pastel' ? color.new(DarkPastelBLUE,87) : AltCol == 'Blue' ? color.new(TurquoiseBLUE,87) : AltCol == 'Grey' ? color.new(PastelGREY,85) : na // Green Visualizer VColor2 = AltCol == 'Green/Red' ? color.new(AwesomeRED,87) : AltCol == 'Blue/Purple' ? color.new(ElectricPURPLE,87) : AltCol == 'Yellow/Pink' ? color.new(FluroPINK,87) : AltCol == 'Pastel' ? color.new(DarkPastelPURPLE,87) : AltCol == 'Blue' ? color.new(SapphireBLUE,87) : AltCol == 'Grey' ? color.new(DarkGREY,85) : na // Red Visualizer //Cross Colors CrossColO = AltCol == 'Green/Red' ? color.new(DarkPigmentGREEN,20) : AltCol == 'Blue/Purple' ? color.new(MediumBLUE,20) : AltCol == 'Yellow/Pink' ? color.new(ElectricYELLOW,20) : AltCol == 'Pastel' ? color.new(DarkPastelBLUE,20) : AltCol == 'Blue' ? color.new(TurquoiseBLUE,20) : AltCol == 'Grey' ? color.new(PastelGREY,20) : color.new(DarkPigmentGREEN,20) // CrossOver CrossColU = AltCol == 'Green/Red' ? color.new(AwesomeRED,20) : AltCol == 'Blue/Purple' ? color.new(ElectricPURPLE,20) : AltCol == 'Yellow/Pink' ? color.new(FluroPINK,20) : AltCol == 'Pastel' ? color.new(DarkPastelPURPLE,20) : AltCol == 'Blue' ? color.new(SapphireBLUE,20) : AltCol == 'Grey' ? color.new(DarkGREY,20) : color.new(AwesomeRED,20) // CrossUnder //--- MA Color Calculations --- //MA 1 colMA1 = MAV >= MA1 ? AltCol == 'Rainbow' ? color.new(DarkPastelBLUE,60) : Color1 : AltCol == 'Rainbow' ? color.new(DarkPastelPURPLE,60) : Color2 col_MAV1 = MAV >= MA1 ? AltCol == 'Rainbow' ? color.new(DarkPastelBLUE,87) : VColor1 : AltCol == 'Rainbow' ? color.new(DarkPastelPURPLE,87) : VColor2 //MA 2 colMA2 = MAV >= MA2 ? AltCol == 'Rainbow' ? color.new(CaribbeanGREEN,60) : Color1 : AltCol == 'Rainbow' ? color.new(ElectricPURPLE,60) : Color2 col_MAV2 = MAV >= MA2 ? AltCol == 'Rainbow' ? color.new(CaribbeanGREEN,87) : VColor1 : AltCol == 'Rainbow' ? color.new(ElectricPURPLE,87) : VColor2 //MA 3 colMA3 = MAV >= MA3 ? AltCol == 'Rainbow' ? color.new(DarkPigmentGREEN,60) : Color1 : AltCol == 'Rainbow' ? color.new(DimPastelRED,60) : Color2 col_MAV3 = MAV >= MA3 ? AltCol == 'Rainbow' ? color.new(DarkPigmentGREEN,87) : VColor1 : AltCol == 'Rainbow' ? color.new(DimPastelRED,87) : VColor2 //MA 4 colMA4 = MAV >= MA4 ? AltCol == 'Rainbow' ? color.new(SapphireBLUE,60) : Color1 : AltCol == 'Rainbow' ? color.new(AwesomeRED,60) : Color2 col_MAV4 = MAV >= MA4 ? AltCol == 'Rainbow' ? color.new(SapphireBLUE,87) : VColor1 : AltCol == 'Rainbow' ? color.new(AwesomeRED,87) : VColor2 //MA 5 colMA5 = MAV >= MA5 ? AltCol == 'Rainbow' ? color.new(TurquoiseBLUE,60) : Color1 : AltCol == 'Rainbow' ? color.new(PaleMAGENTA,60) : Color2 col_MAV5 = MAV >= MA5 ? AltCol == 'Rainbow' ? color.new(TurquoiseBLUE,87) : VColor1 : AltCol == 'Rainbow' ? color.new(PaleMAGENTA,87) : VColor2 //--- Plots --- //MA Lines fill_MAV = plot(ShowVisualizer ? MAV : na, title='Visualizer Line', color=color.new(color.yellow,100), style=plot.style_line, linewidth=1) fill_MA1 = plot(showMA1 ? MA1 : na, title='MA 1 Line', color=ShowLines ? colMA1 : na, style=plot.style_line, linewidth=1) fill_MA2 = plot(showMA2 ? MA2 : na, title='MA 2 Line', color=ShowLines ? colMA2 : na, style=plot.style_line, linewidth=1) fill_MA3 = plot(showMA3 ? MA3 : na, title='MA 3 Line', color=ShowLines ? colMA3 : na, style=plot.style_line, linewidth=2) fill_MA4 = plot(showMA4 ? MA4 : na, title='MA 4 Line', color=ShowLines ? colMA4 : na, style=plot.style_line, linewidth=3) fill_MA5 = plot(showMA5 ? MA5 : na, title='MA 5 Line', color=ShowLines ? colMA5 : na, style=plot.style_line, linewidth=4) //MA Visualizer fill(fill_MAV, fill_MA1, title='MA 1 Visualizer', color=col_MAV1) fill(fill_MAV, fill_MA2, title='MA 2 Visualizer', color=col_MAV2) fill(fill_MAV, fill_MA3, title='MA 3 Visualizer', color=col_MAV3) fill(fill_MAV, fill_MA4, title='MA 4 Visualizer', color=col_MAV4) fill(fill_MAV, fill_MA5, title='MA 5 Visualizer', color=col_MAV5) //MA Cross plotshape(CrossLabel ? CrossO : na, text="MA\nCrossover", color=CrossColO, textcolor=WHITE, style=shape.labelup, size=size.tiny, location=location.belowbar,editable=false) plotshape(CrossLabel ? CrossU : na, text="MA\nCrossunder", color=CrossColU, textcolor=WHITE, style=shape.labeldown, size=size.tiny, location=location.abovebar,editable=false) //MA Labels MA1Label = label.new(showMA1 and ShowMA_Labels ? bar_index : na, text=str.tostring(len_MA1, '###,### ') + str.tostring(MA1_type), color= close > MA1 ? Color1 : Color2, textcolor=WHITE, style=label.style_text_outline, size=size.small, y=MA1) label.delete(MA1Label[1]) MA2Label = label.new(showMA2 and ShowMA_Labels ? bar_index : na, text=str.tostring(len_MA2, '###,### ') + str.tostring(MA2_type), color= close > MA2 ? Color1 : Color2, textcolor=WHITE, style=label.style_text_outline, size=size.small, y=MA2) label.delete(MA2Label[1]) MA3Label = label.new(showMA3 and ShowMA_Labels ? bar_index : na, text=str.tostring(len_MA3, '###,### ') + str.tostring(MA3_type), color= close > MA3 ? Color1 : Color2, textcolor=WHITE, style=label.style_text_outline, size=size.small, y=MA3) label.delete(MA3Label[1]) MA4Label = label.new(showMA4 and ShowMA_Labels ? bar_index : na, text=str.tostring(len_MA4, '###,### ') + str.tostring(MA4_type), color= close > MA4 ? Color1 : Color2, textcolor=WHITE, style=label.style_text_outline, size=size.small, y=MA4) label.delete(MA4Label[1]) MA5Label = label.new(showMA5 and ShowMA_Labels ? bar_index : na, text=str.tostring(len_MA5, '###,### ') + str.tostring(MA5_type), color= close > MA5 ? Color1 : Color2, textcolor=WHITE, style=label.style_text_outline, size=size.small, y=MA5) label.delete(MA5Label[1])
Chimpanzee V2.5 part A by joylay83
https://www.tradingview.com/script/szWvXR9f-Chimpanzee-V2-5-part-A-by-joylay83/
joylay83
https://www.tradingview.com/u/joylay83/
45
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 // Chimpanzee V2.9 © joylay83 Part A: overlay scale RIGHT, Part B: overlay scale LEFT or overlay=FALSE // The aim of this code is to generate signals and hook it to 3commas // Credits : Thank you for doing an awesome job. I learnt a lot from your codes and tutorials. // Credits not listed in any order. If your code is used here and did not receive due credit, kindly drop me a note. tq. // Blessing 3 by JTA Today, ZenAndTheArtOfTrading, Galactus-B, TheTradingParrot, Zendog123, ydeniz2000 // TradingView built-in scripts // ChangeLog // 03/01/21 Added Timezone input.int // 20/01/21 V2.6 BB now Upper and Lower band Std Deviation are separately configurable. BB can be enabled/disabled. added smoothing. Fixed bug indicators lag 1 bar behind. // 20/01/21 V2.7 TEMA and IFTRSI now can be enabled/disabled. Code clean up. High Timeframe (HTF) indys are now labeled with '2' instead of 'HTF' // 06/02/21 V2.8 plotting mode. plotting mode can be main (overlay) or companion (overlay=false or scale.left). // 06/02/21 V2.9 HTF or '2' Indis now can be enabled/disabled as a whole, or individually. BB now can have a different upper and lower standard deviation (adapted from Nick Radge's strategy) // 06/02/21 V2.9 Stil having issues with smoothing. suggest to leave it disabled for now. indicator('Chimpanzee V2.9 by joylay83', shorttitle='Chimp2.9', precision=4, overlay=true) var gGlobal = "Global settings" source = input(close, title="Source", group=gGlobal) var gMain = "Main (Overlay)" var gComp = "Companion (Non-Overlay)" PlotMode = input.string(title='Plot Mode', options=[gMain, gComp], defval=gMain, group=gGlobal) EnableHTF = input.bool(true, title="Enable HTF", group=gGlobal) Smoothing = input.bool(false, title="Smoothing", group=gGlobal) f_secureSecurity(sym, tf, src) => request.security(sym, tf, src[barstate.isconfirmed ? 0 : 1], barmerge.gaps_off, barmerge.lookahead_off) f_smoothSecurity(sym, tf, src) => request.security(sym, tf, src[barstate.isconfirmed ? 0 : 1], barmerge.gaps_on, barmerge.lookahead_off) //%B //%B User Input var gBB = "BB / %B" EnableBB = input.bool(true, title="Enable BB / %B", group=gBB) BBtf = input.timeframe(title="%B Timeframe", defval="240", group=gBB) BBlength = input.int(20, minval=1, title="BB Length", group=gBB) BBMA = input.string(defval='SMA', options=['SMA', 'EMA'], title="%B MA Type", group=gBB) Uppermult = input.float(2.0, minval=0.001, maxval=50, title="BB Upper StdDev", group=gBB) Lowermult = input.float(2.0, minval=0.001, maxval=50, title="BB Lower StdDev", group=gBB) basis = BBMA=='EMA' ? ta.ema(source, BBlength) : BBMA=='SMA' ? ta.sma(source, BBlength) : na Upperdev = Uppermult * ta.stdev(source, BBlength) Lowerdev = Lowermult * ta.stdev(source, BBlength) BBbasis = EnableBB ? (Smoothing ? f_smoothSecurity(syminfo.tickerid, BBtf, basis) : f_secureSecurity(syminfo.tickerid, BBtf, basis)) : na BBUpperdev = f_secureSecurity(syminfo.tickerid, BBtf, Upperdev) BBLowerdev = f_secureSecurity(syminfo.tickerid, BBtf, Lowerdev) UpperBand = BBbasis + BBUpperdev LowerBand = BBbasis - BBLowerdev bbr = (source - LowerBand)/(UpperBand - LowerBand) BBob = input.float(1, "BB Overbought", group=gBB) BBos = input.float(0, "BB Oversold", group=gBB) BBOverbought= bbr >= BBob BBOversold = bbr <= BBos //************************************************************************************************************************************************************** //%B 2 //%B 2 User Input var gBB2 = "BB / %B 2" EnableBB2 = input.bool(true, title="Enable BB / %B 2", group=gBB2) BBtf2 = input.timeframe(title="%B 2 Timeframe", defval="D", group=gBB2) BBlength2 = input.int(20, minval=1, title="BB 2 Length", group=gBB2) BBMA2 = input.string(defval='SMA', options=['SMA', 'EMA'], title="%B 2 MA Type", group=gBB2) Uppermult2 = input.float(2.0, minval=0.001, maxval=50, title="BB 2 Upper StdDev", group=gBB2) Lowermult2 = input.float(2.0, minval=0.001, maxval=50, title="BB 2 Lower StdDev", group=gBB2) basis2 = BBMA2=='EMA' ? ta.ema(source, BBlength2) : BBMA2=='SMA' ? ta.sma(source, BBlength2) : na Upperdev2 = Uppermult2 * ta.stdev(source, BBlength2) Lowerdev2 = Lowermult2 * ta.stdev(source, BBlength2) BBbasis2 = EnableHTF ==true and EnableBB2 ==true ? (Smoothing ? f_smoothSecurity(syminfo.tickerid, BBtf2, basis2) : f_secureSecurity(syminfo.tickerid, BBtf2, basis2)) : na BBUpperdev2 = f_secureSecurity(syminfo.tickerid, BBtf2, Upperdev2) BBLowerdev2 = f_secureSecurity(syminfo.tickerid, BBtf2, Lowerdev2) UpperBand2 = BBbasis2 + BBUpperdev2 LowerBand2 = BBbasis2 - BBLowerdev2 bbr2 = (source - LowerBand2)/(UpperBand2 - LowerBand2) BBob2 = input.float(1, "BB 2 Overbought", group=gBB2) BBos2 = input.float(0, "BB 2 Oversold", group=gBB2) BBOverbought2= bbr2 >= BBob2 BBOversold2 = bbr2 <= BBos2 //************************************************************************************************************************************************************** //TEMA ORI var gTEMA = "TEMA" EnableTEMA = input.bool(false, title="Enable TEMA", group=gTEMA) TEMAtf = input.timeframe(title="TEMA Timeframe", defval="", group=gTEMA) TEMAlength = input.int(21, minval=1, title="TEMA Length", group=gTEMA) //ema1 = ta.ema(source, TEMAlength) //ema2 = ta.ema(ema1, TEMAlength) //ema3 = ta.ema(ema2, TEMAlength) //out = 3 * (ema1 - ema2) + ema3 //TEMA MTF TEMAema1 = EnableTEMA ? (Smoothing ? f_smoothSecurity(syminfo.tickerid, TEMAtf, ta.ema(source, TEMAlength)) : f_secureSecurity(syminfo.tickerid, TEMAtf, ta.ema(source, TEMAlength))) : na TEMAema2 = f_secureSecurity(syminfo.tickerid, TEMAtf, ta.ema(TEMAema1,TEMAlength)) TEMAema3 = f_secureSecurity(syminfo.tickerid, TEMAtf, ta.ema(TEMAema2, TEMAlength)) TEMAout = 3 * (TEMAema1 - TEMAema2) + TEMAema3 TEMAup = ta.crossover(TEMAout,UpperBand) TEMAup_End = ta.crossunder(TEMAout,UpperBand) TEMAdown = ta.crossunder(TEMAout,LowerBand) TEMAdown_End = ta.crossover(TEMAout,LowerBand) //************************************************************************************************************************************************************** //TEMA MTF 2 var gTEMA2 = "TEMA 2" EnableTEMA2 = input.bool(true, title="Enable TEMA 2", group=gTEMA2) TEMAtf2 = input.timeframe(title="TEMA 2 Timeframe", defval="D", group=gTEMA2) TEMAlength2 = input.int(21, minval=1, title="TEMA 2 Length", group=gTEMA2) TEMAema1_2 = EnableHTF ==true and EnableTEMA2 ==true ? (Smoothing ? f_smoothSecurity(syminfo.tickerid, TEMAtf2, ta.ema(source, TEMAlength2)) : f_secureSecurity(syminfo.tickerid, TEMAtf2, ta.ema(source, TEMAlength2))) : na TEMAema2_2 = f_secureSecurity(syminfo.tickerid, TEMAtf2, ta.ema(TEMAema1_2,TEMAlength2)) TEMAema3_2 = f_secureSecurity(syminfo.tickerid, TEMAtf2, ta.ema(TEMAema2_2, TEMAlength2)) TEMAout_2 = 3 * (TEMAema1_2 - TEMAema2_2) + TEMAema3_2 TEMAup_2 = ta.crossover(TEMAout_2,UpperBand2) TEMAup_End_2 = ta.crossunder(TEMAout_2,UpperBand2) TEMAdown_2 = ta.crossunder(TEMAout_2,LowerBand2) TEMAdown_End_2 = ta.crossover(TEMAout_2,LowerBand2) //************************************************************************************************************************************************************** //IFTRSI var gIFTRSI = "IFTRSI" EnableIFish = input.bool(true, group=gIFTRSI, title="Enable IFTRSI") length = input(5, 'RSI length', group=gIFTRSI) lengthwma = input(9, title='Smoothing length', group=gIFTRSI) TH_Buy = input(-0.9, title='IFTRSI Buy Threshold', group=gIFTRSI) TH_Sell = input(0.996, title='IFTRSI Sell Threshold', group=gIFTRSI) calc_ifish(series, lengthwma) => v1 = 0.1 * (series - 50) v2 = ta.wma(v1, lengthwma) ifish = (math.exp(2 * v2) - 1) / (math.exp(2 * v2) + 1) ifish //IFTRSI Determine colour IFTRSI = EnableIFish ? calc_ifish(ta.rsi(source, length), lengthwma): na lineColour = IFTRSI <= TH_Buy ? color.green : IFTRSI >= TH_Sell ? color.blue : color.orange //IFTRSI Signal IFTRSI_Signal_Mode = input.string(title='Signal Mode', options=['Threshold', 'Cross'], defval='Cross', group=gIFTRSI) IFTRSI_Crossover = ta.crossover(IFTRSI, TH_Buy) IFTRSI_Crossunder = ta.crossunder(IFTRSI, TH_Sell) IFTRSI_signal = if IFTRSI_Signal_Mode == 'Threshold' IFTRSI < TH_Buy ? -1 : IFTRSI > TH_Sell ? 1 : 0 else if IFTRSI_Signal_Mode == 'Cross' IFTRSI_Crossover ? -1 : IFTRSI_Crossunder ? 1 : 0 else na //************************************************************************************************************************************************************** //IFTRSI 2 var gIFTRSI2 = "IFTRSI 2" EnableIFish2 = input.bool(true, group=gIFTRSI2, title="Enable IFTRSI 2") IH_tf = input.timeframe(title="IFTRSI 2 Timeframe", defval="240", group=gIFTRSI2) IH_length = input(5, 'IFTRSI 2 length', group=gIFTRSI2) IH_lengthwma = input(9, title='IFTRSI 2 Smoothing length', group=gIFTRSI2) IH_TH_Buy = input(-0.9, title='IFTRSI 2 Buy Threshold', group=gIFTRSI2) IH_TH_Sell = input(0.996, title='IFTRSI 2 Sell Threshold', group=gIFTRSI2) IH_calc_ifish(series, IH_lengthwma) => IH_v1 = 0.1 * (series - 50) IH_v2 = ta.wma(IH_v1, IH_lengthwma) IH_ifish = (math.exp(2 * IH_v2) - 1) / (math.exp(2 * IH_v2) + 1) IH_ifish // IFTRSI HTF Determine colour IFTRSI2 = EnableHTF ==true and EnableIFish2 ==true ? IH_calc_ifish(ta.rsi(source, length), IH_lengthwma) : na IH_IFTRSI = f_secureSecurity(syminfo.tickerid, IH_tf, IFTRSI2) IH_lineColour = IH_IFTRSI <= IH_TH_Buy ? color.new(color.green,0) : IH_IFTRSI >= IH_TH_Sell ? color.new(color.blue,0) : color.new(color.orange,0) //IFTRSI HTF Signal IH_IFTRSI_Signal_Mode = input.string(title='IFTRSI 2 Signal Mode', options=['Threshold', 'Cross'], defval='Cross', group=gIFTRSI2) IH_IFTRSI_Crossover = ta.crossover(IH_IFTRSI, IH_TH_Buy) IH_IFTRSI_Crossunder = ta.crossunder(IH_IFTRSI, IH_TH_Sell) IH_IFTRSI_signal = if IH_IFTRSI_Signal_Mode == 'Threshold' IH_IFTRSI < IH_TH_Buy ? -1 : IH_IFTRSI > IH_TH_Sell ? 1 : 0 else if IH_IFTRSI_Signal_Mode == 'Cross' IH_IFTRSI_Crossover ? -1 : IH_IFTRSI_Crossunder ? 1 : 0 else na //************************************************************************************************************************************************************** //StochRSI var gStochRSI = "StochRSI" EnableStochRSI = input.bool(true, title="Enable StochRSI", group=gStochRSI) SRtf = input.timeframe(title="StochRSI Timeframe", defval="D", group=gStochRSI) smoothK = input.int(3, "K", minval=1, group=gStochRSI) smoothD = input.int(3, "D", minval=1, group=gStochRSI) lengthRSI = input.int(14, "RSI Length", minval=1, group=gStochRSI) lengthStoch = input.int(14, "Stochastic Length", minval=1, group=gStochRSI) rsi1 = ta.rsi(source, lengthRSI) Srupper = input.int(80, "StochRSI OverBought", minval=1, group=gStochRSI) Srlower = input.int(20, "StochRSI OverSold", minval=1, group=gStochRSI) k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK) d = ta.sma(k, smoothD) SRk = EnableStochRSI ? (Smoothing ? f_smoothSecurity(syminfo.tickerid, SRtf, k) : f_secureSecurity(syminfo.tickerid, SRtf, k)) : na SRd = EnableStochRSI ? (Smoothing ? f_smoothSecurity(syminfo.tickerid, SRtf, d) : f_secureSecurity(syminfo.tickerid, SRtf, d)) : na Fast_K_OS = ta.crossunder(SRk, Srlower) Fast_K_OB = ta.crossover(SRk, Srupper) Slow_D_OS = ta.crossunder(SRd, Srlower) Slow_D_OB = ta.crossover(SRd, Srupper) KD_OS = ta.crossover(SRk, SRd) and SRd <= Srlower KD_OB = ta.crossunder(SRk, SRd) and SRd >= Srupper //************************************************************************************************************************************************************** //BG COLOR - DONE var gBGcolor = "BG color" EnableBGcolor = input.bool(true, title="Enable BG color", group=gBGcolor) BGcolorOption = input.string(title='BG Color Option', options=['BB OB/OS', 'StochRSI OB/OS'], defval='StochRSI OB/OS', group=gBGcolor) BBObOs = BBOverbought ? color.new(color.red,50) : BBOversold ? color.new(color.green,50) : na StochRSIObOs = SRk >= Srupper ? color.new(color.red,50) : SRk <= Srlower ? color.new(color.green,50) : na bgcolor(EnableBGcolor == true and BGcolorOption == "BB OB/OS" ? BBObOs : EnableBGcolor == true and BGcolorOption == "StochRSI OB/OS" ? StochRSIObOs : na) //************************************************************************************************************************************************************** //Buy/Sell Signal BuySignal = BBOversold and IFTRSI_signal == -1 SellSignal = BBOverbought and IFTRSI_signal == 1 //HTF Buy/Sell Signal BuySignalHTF = BBOversold2 and IH_IFTRSI_signal == -1 SellSignalHTF = BBOverbought2 and IH_IFTRSI_signal == 1 //************************************************************************************************************************************************************** //PLOTTING OVERLAY //PLOT BB - OVERLAY - DONE BBbasis_gMain = PlotMode == gMain? BBbasis : na UpperBand_gMain = PlotMode == gMain? UpperBand : na LowerBand_gMain = PlotMode == gMain? LowerBand : na plot(BBbasis_gMain, "BB SMA", color=color.new(color.blue, 0)) plot(UpperBand_gMain, "BB upper", color=color.new(color.blue, 0)) plot(LowerBand_gMain, "BB lower", color=color.new(color.blue, 0)) //PLOT BB 2 - OVERLAY - DONE BBbasis2_gMain = PlotMode == gMain? BBbasis2 : na UpperBand2_gMain = PlotMode == gMain? UpperBand2 : na LowerBand2_gMain = PlotMode == gMain? LowerBand2 : na plot(BBbasis2_gMain, "BB 2 MA", color.new(color.purple,60), linewidth=2) plot(UpperBand2_gMain, "BB 2 Upper Band", color.new(color.purple,60), linewidth=2) plot(LowerBand2_gMain, "BB 2 Lower Band", color.new(color.purple,60), linewidth=2) //PLOT TEMA - OVERLAY TEMAout_gMain = PlotMode == gMain ? TEMAout : na TEMAup_gMain = PlotMode == gMain ? TEMAup : na TEMAdown_gMain = PlotMode == gMain ? TEMAdown : na TEMAup_End_gMain = PlotMode == gMain ? TEMAup_End : na TEMAdown_End_gMain = PlotMode == gMain ? TEMAdown_End : na plot(TEMAout_gMain, color=color.navy, title="TEMA") plotshape(TEMAup_gMain, 'TEMA Up', style=shape.flag, location=location.abovebar, color=color.green, size=size.tiny) plotshape(TEMAdown_gMain, 'TEMA Down', style=shape.flag, location=location.belowbar, color=color.red, size=size.tiny) plotshape(TEMAup_End_gMain, 'TEMA Up End', style=shape.xcross, location=location.abovebar, color=color.green, size=size.tiny) plotshape(TEMAdown_End_gMain, 'TEMA Down End', style=shape.xcross, location=location.belowbar, color=color.red, size=size.tiny) //PLOT TEMA 2 - OVERLAY bullflagcolor=color.new(color.green, 70) bearflagcolor=color.new(color.red, 70) TEMAout_2_gMain = PlotMode == gMain ? TEMAout_2 : na TEMAup_2_gMain = PlotMode == gMain ? TEMAup_2 : na TEMAdown_2_gMain = PlotMode == gMain ? TEMAdown_2 : na TEMAup_End_2_gMain = PlotMode == gMain ? TEMAup_End_2 : na TEMAdown_End_2_gMain = PlotMode == gMain ? TEMAdown_End_2 : na plot(TEMAout_2_gMain, 'TEMA 2', color.new(color.fuchsia, 0)) plotshape(TEMAup_2_gMain, 'TEMA 2 UP', style=shape.flag, location=location.abovebar, size=size.small, color=bullflagcolor) plotshape(TEMAdown_2_gMain, 'TEMA 2 Down', style=shape.flag, location=location.belowbar, size=size.small, color=bearflagcolor) plotshape(TEMAup_End_2_gMain, 'TEMA 2 Up End', style=shape.xcross, location=location.abovebar, size=size.small, color=bullflagcolor) plotshape(TEMAdown_End_2_gMain, 'TEMA 2 Down End', style=shape.xcross, location=location.belowbar, size=size.small, color=bearflagcolor) //PLOT StochRSI OB/OS - OVERLAY Fast_K_OS_gMain = PlotMode == gMain ? Fast_K_OS : na Fast_K_OB_gMain = PlotMode == gMain ? Fast_K_OB : na KD_OS_gMain = PlotMode == gMain ? KD_OS : na KD_OB_gMain = PlotMode == gMain ? KD_OB : na plotshape(Fast_K_OS_gMain, "Fast K OVERSOLD", style=shape.labelup , text="K OS", location=location.belowbar, color=color.navy, textcolor=color.white, size=size.small) plotshape(Fast_K_OB_gMain, "Fast K OVERBOUGHT", style=shape.labeldown , text="K OB", location=location.abovebar, color=color.navy, textcolor=color.white, size=size.small) plotshape(KD_OS_gMain, "KD Cross OVERSOLD", style=shape.labelup , text="KD Cross OS", location=location.belowbar, color=color.navy, textcolor=color.white, size=size.small) plotshape(KD_OB_gMain, "KD Cross OVERBOUGHT", style=shape.labeldown , text="KD Cross OB", location=location.abovebar, color=color.navy, textcolor=color.white, size=size.small) //PLOT BUY SELL SIGNAL - OVERLAY BuySignal_gMain = PlotMode == gMain ? BuySignal : na SellSignal_gMain = PlotMode == gMain ? SellSignal : na plotshape(BuySignal_gMain, "Buy", style=shape.arrowup, text="Buy", location=location.belowbar, color=color.green, size=size.small) plotshape(SellSignal_gMain, "Sell", style=shape.arrowdown , text="Sell", location=location.abovebar, color=color.red, size=size.small) //PLOT BUY SELL HTF SIGNAL - OVERLAY BuySignalHTF_gMain = PlotMode == gMain ? BuySignalHTF : na SellSignalHTF_gMain = PlotMode == gMain ? SellSignalHTF : na plotshape(BuySignalHTF_gMain, "HTF Buy", style=shape.arrowup, text="HTF Buy", location=location.belowbar, color=color.green, textcolor=color.white, size=size.small) plotshape(SellSignalHTF_gMain, "HTF Sell", style=shape.arrowdown , text="HTF Sell", location=location.abovebar, color=color.red, textcolor=color.white, size=size.small) //************************************************************************************************************************************************************** //PLOTTING NON-OVERLAY //SEPARATORS SepColor = color.new(color.navy,30) BuySell_gComp = PlotMode == gComp? 1.5 : na plot (BuySell_gComp, color=SepColor, linewidth =3) Set1_gComp = PlotMode == gComp? -1.5 : na plot (Set1_gComp, color=SepColor, linewidth =3) Set2_gComp = PlotMode == gComp? -4.5 : na plot (Set2_gComp, color=SepColor, linewidth =3) Set3_gComp = PlotMode == gComp? -7.5 : na plot (Set3_gComp, color=SepColor, linewidth =3) //PLOT BUY SELL SIGNAL NON-OVERLAY ( -1 to 1) ChimpSignal = BuySignal ? -0.5 : SellSignal ? 0.5 : 0 plot(PlotMode == gComp? ChimpSignal : na, 'ChimpSignal', linewidth=2, color=color.blue) //PLOT BUY SELL HTF SIGNAL NON-OVERLAY (-1 to 1) ChimpHTFSignal = BuySignalHTF ? -1 : SellSignalHTF ? 1 : 0 plot(PlotMode == gComp? ChimpHTFSignal: na, 'ChimpHTFSignal', linewidth=2, color=color.red) //PLOT %B NON-OVERLAY - DONE () BBob_gComp = PlotMode == gComp? 2*BBob -4: na BBos_gComp = PlotMode == gComp? 2*BBos -4: na bbr_gComp = PlotMode == gComp? 2*bbr -4: na plot(BBob_gComp, "BB Overbought", color=color.new(color.blue, 30)) plot(BBos_gComp, "BB Oversold", color=color.new(color.blue, 30)) plot(bbr_gComp, "%B", color=color.new(color.blue, 0)) //PLOT IFTRSI NON-OVERLAY - DONE IFTRSI_gComp = PlotMode == gComp ? IFTRSI -3: na TH_Buy_gComp = PlotMode == gComp ? TH_Buy -3: na TH_Sell_gComp = PlotMode == gComp ? TH_Sell -3: na IFTRSI_signal_gComp = PlotMode == gComp ? IFTRSI_signal -3: na ChimpSignal_gComp = PlotMode == gComp ? 2*ChimpSignal -3: na plot(IFTRSI_gComp, color=lineColour) plot(TH_Buy_gComp, title='IFTRSI Buy Threshold', color=color.new(color.silver, 0)) plot(TH_Sell_gComp, title='IFTRSI Sell Threshold', color=color.new(color.silver, 0)) plot(IFTRSI_signal_gComp, title=' IFTRSI Signal', color=color.new(color.gray, 0)) plot(ChimpSignal_gComp, linewidth=3, color=color.blue) //PLOT %B 2 NON-OVERLAY - DONE BBob2_gComp = PlotMode == gComp? 2*BBob2 -7: na BBos2_gComp = PlotMode == gComp? 2*BBos2 -7: na bbr2_gComp = PlotMode == gComp? 2*bbr2 -7: na plot(BBob2_gComp, "BB 2 Overbought", color=color.new(color.purple, 30)) plot(BBos2_gComp, "BB 2 Oversold", color=color.new(color.purple, 30)) plot(bbr2_gComp, "%B 2", color=color.new(color.purple, 0), linewidth=2) //PLOT IFTRSI 2 NON-OVERLAY - DONE IH_IFTRSI_gComp = PlotMode == gComp ? IH_IFTRSI -6: na IH_TH_Buy_gComp = PlotMode == gComp ? IH_TH_Buy -6: na IH_TH_Sell_gComp = PlotMode == gComp ? IH_TH_Sell -6: na IH_IFTRSI_signal_gComp = PlotMode == gComp ? IH_IFTRSI_signal -6: na ChimpHTFSignal_gComp = PlotMode == gComp ? ChimpHTFSignal -6: na plot(IH_IFTRSI_gComp, "IFTRSI 2", color=IH_lineColour, linewidth=2) plot(IH_TH_Buy_gComp, title='IFTRSI 2 Buy Threshold', color=color.new(color.silver, 0)) plot(IH_TH_Sell_gComp, title='IFTRSI 2 Sell Threshold', color=color.new(color.silver, 0)) plot(IH_IFTRSI_signal_gComp, title=' IFTRSI 2 Signal', color=color.new(color.gray, 0)) plot(ChimpHTFSignal_gComp, linewidth=3, color=color.red) //PLOT STOCHRSI NON-OVERLAY - DONE SRk_gComp = PlotMode == gComp ? SRk/50 -9.5: na SRd_gComp = PlotMode == gComp ? SRd/50 -9.5: na Srupper_gComp = PlotMode == gComp ? Srupper/50 -9.5: na Srlower_gComp = PlotMode == gComp ? Srlower/50 -9.5: na plot(SRk_gComp, "K", color=#2962FF, linewidth=2) plot(SRd_gComp, "D", color=#FF6D00, linewidth=2) plot(Srupper_gComp, "Upper Band", color=#787B86) plot(Srlower_gComp, "Lower Band", color=#787B86) //************************************************************************************************************************************************************** //Alerts TimeZone = input.int(8, title="Time Zone", group="Alerts") timehr = hour(time_close) + TimeZone Ticker = 'TF: ' + str.tostring(timeframe.period) + '. BBtf: ' + str.tostring(BBtf) + '. ' + syminfo.tickerid + ' is ' + str.tostring(close) + '. ' + str.tostring(timehr >=24 ? timehr -24 : timehr) + ':' + str.tostring(minute(time_close)) Ticker2 = 'TF: ' + str.tostring(timeframe.period) + '. BBtf2: ' + str.tostring(BBtf2) + '. ' + syminfo.tickerid + ' is ' + str.tostring(close) + '. ' + str.tostring(timehr >=24 ? timehr -24 : timehr) + ':' + str.tostring(minute(time_close)) TickerStoch = 'TF: ' + str.tostring(timeframe.period) + '. SRtf: ' + str.tostring(SRtf) + '. ' + syminfo.tickerid + ' is ' + str.tostring(close) + '. ' + str.tostring(timehr >=24 ? timehr -24 : timehr) + ':' + str.tostring(minute(time_close)) //Enable/Disable Alerts - signals are still generated eventhough alerts are disabled //Buy Sell Commands Buy2 = input('Buy Signal', title='BuyCommand', group="Alerts") Sell2 = input('Sell Signal', title='SellCommand', group="Alerts") Buy_HTF = input('HTF Buy Signal', title='HTF BuyCommand', group="Alerts") Sell_HTF = input('HTF Sell Signal', title='HTF SellCommand', group="Alerts") //Alerts Buy Sell Enable_BuySell_Alerts = input.bool(true, title='Enable Buy Sell Alerts', group="Alerts") if BuySignal and Enable_BuySell_Alerts == true alert('BUY SIG. '+ Ticker, alert.freq_once_per_bar_close) alert(Buy2, alert.freq_once_per_bar_close) else if SellSignal and Enable_BuySell_Alerts == true alert('SELL SIG. ' + Ticker, alert.freq_once_per_bar_close) alert(Sell2, alert.freq_once_per_bar_close) Enable_BuySell_HTF_Alerts = input.bool(true, title='Enable HTF Buy Sell Alerts', group="Alerts") if BuySignalHTF and Enable_BuySell_HTF_Alerts == true alert('HTF BUY SIG. '+ Ticker2, alert.freq_once_per_bar_close) alert(Buy_HTF, alert.freq_once_per_bar_close) else if SellSignalHTF and Enable_BuySell_HTF_Alerts == true alert('HTF SELL SIG. ' + Ticker2, alert.freq_once_per_bar_close) alert(Sell_HTF, alert.freq_once_per_bar_close) //Alerts BB Enable_BB_Alerts = input.bool(true, title='Enable BB Alerts', group="Alerts") if BBOverbought and Enable_BB_Alerts == true alert('BB Up. '+ Ticker, alert.freq_once_per_bar_close) else if BBOversold and Enable_BB_Alerts == true alert('BB Down. '+ Ticker, alert.freq_once_per_bar_close) Enable_BB_2_Alerts = input.bool(true, title='Enable BB 2 Alerts', group="Alerts") if BBOverbought2 and Enable_BB_2_Alerts == true alert('BB 2 Up. '+ Ticker2, alert.freq_once_per_bar_close) else if BBOversold2 and Enable_BB_2_Alerts == true alert('BB 2 Down. '+ Ticker2, alert.freq_once_per_bar_close) //Alert for TEMA Enable_TEMA_Alerts = input.bool(true, title='Enable TEMA Alerts', group="Alerts") if TEMAup and Enable_TEMA_Alerts == true alert('TEMA Up. '+ Ticker, alert.freq_once_per_bar_close) if TEMAdown and Enable_TEMA_Alerts == true alert('TEMA Down. '+ Ticker, alert.freq_once_per_bar_close) if TEMAup_End and Enable_TEMA_Alerts == true alert('TEMA Up End. '+ Ticker, alert.freq_once_per_bar_close) if TEMAdown_End and Enable_TEMA_Alerts == true alert('TEMA Down End. '+ Ticker, alert.freq_once_per_bar_close) Enable_TEMA_2_Alerts = input.bool(true, title='Enable TEMA 2 Alerts', group="Alerts") if TEMAup_2 and Enable_TEMA_2_Alerts == true alert('TEMA 2 Up. '+ Ticker2, alert.freq_once_per_bar_close) if TEMAdown_2 and Enable_TEMA_2_Alerts == true alert('TEMA 2 Down. '+ Ticker2, alert.freq_once_per_bar_close) if TEMAup_End_2 and Enable_TEMA_2_Alerts == true alert('TEMA 2 Up End. '+ Ticker2, alert.freq_once_per_bar_close) if TEMAdown_End_2 and Enable_TEMA_2_Alerts == true alert('TEMA 2 Down End. '+ Ticker2, alert.freq_once_per_bar_close) //Alert for StochRSI Enable_StochRSI_Alerts = input.bool(true, title='Enable StochRSI Alerts', group="Alerts") if Fast_K_OS and Enable_StochRSI_Alerts == true alert('Fast K OVERSOLD. '+ TickerStoch, alert.freq_once_per_bar_close) if Fast_K_OB and Enable_StochRSI_Alerts == true alert('Fast K OVERBOUGHT. '+ TickerStoch, alert.freq_once_per_bar_close) if KD_OS and Enable_StochRSI_Alerts == true alert('KD Cross OVERSOLD. '+ TickerStoch, alert.freq_once_per_bar_close) if KD_OB and Enable_StochRSI_Alerts == true alert('KD Cross OVERBOUGHT. '+ TickerStoch, alert.freq_once_per_bar_close)
Detailed Volume (DV)
https://www.tradingview.com/script/AG40mn99-Detailed-Volume-DV/
KhashayarJan
https://www.tradingview.com/u/KhashayarJan/
147
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/ // © KhashayarJan //@version=5 indicator("DV", format = format.volume, overlay = false) bColor = color.rgb(146,223,139) sColor = color.rgb(254,150,149) b2Color = color.rgb(146,223,139,50) s2Color = color.rgb(254,150,149,50) ShowDifference = input (defval = false, title = "Show Difference", tooltip = "If true, the filler column would just show the difference in volume, else it would show the whole volume traded for the stronger side") BuyMA = input(defval = color.green, title = "Buy Moving Averate") SellMA = input(defval = color.red, title = "Sell Moving Averate") MAPeriod = input(defval = 14, title = "Moving Average Period") vol = volume shadow = (close > open) ? (high - close) + (open - low) : (high - open) + (close - low) shadow := shadow * volume / (high - low) buyVolume = (close > open) ? (close - open) * volume / (high - low) : 0 sellVolume = (open > close) ? (open - close) * volume / (high - low) : 0 plot(ta.sma(buyVolume + shadow / 2,MAPeriod), color = BuyMA) plot(ta.sma(sellVolume + shadow / 2 ,MAPeriod), color = SellMA) plot(volume, color = (close > open) ? b2Color : s2Color, style = plot.style_columns) plot((close > open) ? ((close - open) * volume / (high - low)) + ((ShowDifference) ? 0 : shadow / 2) : ((open - close) * volume / (high - low)) + ((ShowDifference) ? 0 : shadow / 2), color = (close > open) ? bColor : sColor, style = plot.style_columns)
Intraday MAs for Regular/Extended Session
https://www.tradingview.com/script/BJxRfcS9-Intraday-MAs-for-Regular-Extended-Session/
schroederjoa
https://www.tradingview.com/u/schroederjoa/
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/ // © schroederjoa //@version=5 indicator("Intraday MAs for Regular/Extended Session", "",overlay=true) tooltip_01 = "Name to distinguish in case you have multiples of this indicator" descr = input.string("", title="Name of MA Set", tooltip=tooltip_01) var GRP2 = "Line Style Definitions" ls_ema_ext = input.string("LINE", title="Show EMA / EXT as", options=["LINE","STEPLINE","CROSS","CIRCLES"], group=GRP2, tooltip="Use this type for EMA on Day, Week, Month") ls_ema_reg = input.string("LINE", title="Show EMA / REG as", options=["LINE","STEPLINE","CROSS","CIRCLES"], group=GRP2) ls_sma_ext = input.string("LINE", title="Show SMA / EXT as", options=["LINE","STEPLINE","CROSS","CIRCLES"], group=GRP2, tooltip="Use this type for SMA on Day, Week, Month") ls_sma_reg = input.string("LINE", title="Show SMA / REG as", options=["LINE","STEPLINE","CROSS","CIRCLES"], group=GRP2) var GRP1 = "Moving Averages" tooltip_02 = "MA Color\nMA Line Style\nMA Line Width" itv_01 = input.int(9, title="MA 01     Interval ", tooltip="", minval = 0, inline = "01_1", group=GRP1) ema_01 = input.bool(true,title="EMA", inline = "01_1", group=GRP1) sma_01 = input.bool(true,title="SMA", inline = "01_1", group=GRP1) reg_01 = input.bool(true,title="REG", inline = "01_1", group=GRP1) ext_01 = input.bool(true,title="EXT", inline = "01_1", group=GRP1) tfr_01 = input.timeframe("5", title="         Timeframe", inline = "01_2", group=GRP1, options=["1","3","5","10","15","30","60","120","240","1D","1W","1M"]) lwi_01 = input.int(1, title="Linewidth", minval=1, maxval=10, inline = "01_2", group=GRP1) col_01 = input.color(color.blue, title="", inline = "01_2", group=GRP1) tfr_01_daily = tfr_01 == "1D" or tfr_01 == "1W" or tfr_01 == "1M" itv_02 = input.int(20, title="MA 02     Interval ", tooltip="", minval = 0, inline = "02_1", group=GRP1) ema_02 = input.bool(true,title="EMA", inline = "02_1", group=GRP1) sma_02 = input.bool(true,title="SMA", inline = "02_1", group=GRP1) reg_02 = input.bool(true,title="REG", inline = "02_1", group=GRP1) ext_02 = input.bool(true,title="EXT", inline = "02_1", group=GRP1) tfr_02 = input.timeframe("5", title="         Timeframe", inline = "02_2", group=GRP1, options=["1","3","5","10","15","30","60","120","240","1D","1W","1M"]) lwi_02 = input.int(1, title="Linewidth", minval=1, maxval=10, inline = "02_2", group=GRP1) col_02 = input.color(color.green, title="", inline = "02_2", group=GRP1) tfr_02_daily = tfr_02 == "1D" or tfr_02 == "1W" or tfr_02 == "1M" itv_03 = input.int(50, title="MA 03     Interval ", tooltip="", minval = 0, inline = "03_1", group=GRP1) ema_03 = input.bool(true,title="EMA", inline = "03_1", group=GRP1) sma_03 = input.bool(true,title="SMA", inline = "03_1", group=GRP1) reg_03 = input.bool(true,title="REG", inline = "03_1", group=GRP1) ext_03 = input.bool(true,title="EXT", inline = "03_1", group=GRP1) tfr_03 = input.timeframe("5", title="         Timeframe", inline = "03_2", group=GRP1, options=["1","3","5","10","15","30","60","120","240","1D","1W","1M"]) lwi_03 = input.int(1, title="Linewidth", minval=1, maxval=10, inline = "03_2", group=GRP1) col_03 = input.color(color.gray, title="", inline = "03_2", group=GRP1) tfr_03_daily = tfr_03 == "1D" or tfr_03 == "1W" or tfr_03 == "1M" itv_04 = input.int(100, title="MA 04     Interval ", tooltip="", minval = 0, inline = "04_1", group=GRP1) ema_04 = input.bool(true,title="EMA", inline = "04_1", group=GRP1) sma_04 = input.bool(true,title="SMA", inline = "04_1", group=GRP1) reg_04 = input.bool(true,title="REG", inline = "04_1", group=GRP1) ext_04 = input.bool(true,title="EXT", inline = "04_1", group=GRP1) tfr_04 = input.timeframe("5", title="         Timeframe", inline = "04_2", group=GRP1, options=["1","3","5","10","15","30","60","120","240","1D","1W","1M"]) lwi_04 = input.int(1, title="Linewidth", minval=1, maxval=10, inline = "04_2", group=GRP1) col_04 = input.color(color.red, title="", inline = "04_2", group=GRP1) tfr_04_daily = tfr_04 == "1D" or tfr_04 == "1W" or tfr_04 == "1M" itv_05 = input.int(200, title="MA 05     Interval ", tooltip="", minval = 0, inline = "05_1", group=GRP1) ema_05 = input.bool(true,title="EMA", inline = "05_1", group=GRP1) sma_05 = input.bool(true,title="SMA", inline = "05_1", group=GRP1) reg_05 = input.bool(true,title="REG", inline = "05_1", group=GRP1) ext_05 = input.bool(true,title="EXT", inline = "05_1", group=GRP1) tfr_05 = input.timeframe("5", title="         Timeframe", inline = "05_2", group=GRP1, options=["1","3","5","10","15","30","60","120","240","1D","1W","1M"]) lwi_05 = input.int(1, title="Linewidth", minval=1, maxval=10, inline = "05_2", group=GRP1) col_05 = input.color(color.yellow, title="", inline = "05_2", group=GRP1) tfr_05_daily = tfr_05 == "1D" or tfr_05 == "1W" or tfr_05 == "1M" lineStyleChooser(s)=> (s == "CIRCLES") ? plot.style_circles : (s == "CROSS") ? plot.style_cross : (s == "STEPLINE") ? plot.style_stepline : plot.style_line s01_1 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_01 , ta.ema(close, itv_01)) s01_2 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_01 , ta.ema(close, itv_01)) s01_3 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_01 , ta.sma(close, itv_01)) s01_4 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_01 , ta.sma(close, itv_01)) plot(itv_01 == 0 ? na : ema_01 and (ext_01 or tfr_01_daily) ? s01_1 : na, title="MA01 - EMA/EXT", color=col_01, style=lineStyleChooser(ls_ema_ext), linewidth=lwi_01) plot(itv_01 == 0 ? na : ema_01 and reg_01 and not tfr_01_daily ? s01_2 : na, title="MA01 - EMA/REG", color=col_01, style=lineStyleChooser(ls_ema_reg), linewidth=lwi_01) plot(itv_01 == 0 ? na : sma_01 and (ext_01 or tfr_01_daily) ? s01_3 : na, title="MA01 - SMA/EXT", color=col_01, style=lineStyleChooser(ls_sma_ext), linewidth=lwi_01) plot(itv_01 == 0 ? na : sma_01 and reg_01 and not tfr_01_daily ? s01_4 : na, title="MA01 - SMA/REG", color=col_01, style=lineStyleChooser(ls_sma_reg), linewidth=lwi_01) s02_1 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_02 , ta.ema(close, itv_02)) s02_2 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_02 , ta.ema(close, itv_02)) s02_3 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_02 , ta.sma(close, itv_02)) s02_4 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_02 , ta.sma(close, itv_02)) plot(itv_02 == 0 ? na : ema_02 and (ext_02 or tfr_02_daily) ? s02_1 : na, title="MA02 - EMA/EXT", color=col_02, style=lineStyleChooser(ls_ema_ext), linewidth=lwi_02) plot(itv_02 == 0 ? na : ema_02 and reg_02 and not tfr_02_daily ? s02_2 : na, title="MA02 - EMA/REG", color=col_02, style=lineStyleChooser(ls_ema_reg), linewidth=lwi_02) plot(itv_02 == 0 ? na : sma_02 and (ext_02 or tfr_02_daily) ? s02_3 : na, title="MA02 - SMA/EXT", color=col_02, style=lineStyleChooser(ls_sma_ext), linewidth=lwi_02) plot(itv_02 == 0 ? na : sma_02 and reg_02 and not tfr_02_daily ? s02_4 : na, title="MA02 - SMA/REG", color=col_02, style=lineStyleChooser(ls_sma_reg), linewidth=lwi_02) s03_1 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_03 , ta.ema(close, itv_03)) s03_2 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_03 , ta.ema(close, itv_03)) s03_3 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_03 , ta.sma(close, itv_03)) s03_4 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_03 , ta.sma(close, itv_03)) plot(itv_03 == 0 ? na : ema_03 and (ext_03 or tfr_03_daily) ? s03_1 : na, title="MA03 - EMA/EXT", color=col_03, style=lineStyleChooser(ls_ema_ext), linewidth=lwi_03) plot(itv_03 == 0 ? na : ema_03 and reg_03 and not tfr_03_daily ? s03_2 : na, title="MA03 - EMA/REG", color=col_03, style=lineStyleChooser(ls_ema_reg), linewidth=lwi_03) plot(itv_03 == 0 ? na : sma_03 and (ext_03 or tfr_03_daily) ? s03_3 : na, title="MA03 - SMA/EXT", color=col_03, style=lineStyleChooser(ls_sma_ext), linewidth=lwi_03) plot(itv_03 == 0 ? na : sma_03 and reg_03 and not tfr_03_daily ? s03_4 : na, title="MA03 - SMA/REG", color=col_03, style=lineStyleChooser(ls_sma_reg), linewidth=lwi_03) s04_1 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_04 , ta.ema(close, itv_04)) s04_2 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_04 , ta.ema(close, itv_04)) s04_3 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_04 , ta.sma(close, itv_04)) s04_4 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_04 , ta.sma(close, itv_04)) plot(itv_04 == 0 ? na : ema_04 and (ext_04 or tfr_04_daily) ? s04_1 : na, title="MA04 - EMA/EXT", color=col_04, style=lineStyleChooser(ls_ema_ext), linewidth=lwi_04) plot(itv_04 == 0 ? na : ema_04 and reg_04 and not tfr_04_daily ? s04_2 : na, title="MA04 - EMA/REG", color=col_04, style=lineStyleChooser(ls_ema_reg), linewidth=lwi_04) plot(itv_04 == 0 ? na : sma_04 and (ext_04 or tfr_04_daily) ? s04_3 : na, title="MA04 - SMA/EXT", color=col_04, style=lineStyleChooser(ls_sma_ext), linewidth=lwi_04) plot(itv_04 == 0 ? na : sma_04 and reg_04 and not tfr_04_daily ? s04_4 : na, title="MA04 - SMA/REG", color=col_04, style=lineStyleChooser(ls_sma_reg), linewidth=lwi_04) s05_1 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_05 , ta.ema(close, itv_05)) s05_2 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_05 , ta.ema(close, itv_05)) s05_3 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.extended), tfr_05 , ta.sma(close, itv_05)) s05_4 = request.security( ticker.new(syminfo.prefix, syminfo.ticker, session.regular), tfr_05 , ta.sma(close, itv_05)) plot(itv_05 == 0 ? na : ema_05 and (ext_05 or tfr_05_daily) ? s05_1 : na, title="MA05 - EMA/EXT", color=col_05, style=lineStyleChooser(ls_ema_ext), linewidth=lwi_05) plot(itv_05 == 0 ? na : ema_05 and reg_05 and not tfr_05_daily ? s05_2 : na, title="MA05 - EMA/REG", color=col_05, style=lineStyleChooser(ls_ema_reg), linewidth=lwi_05) plot(itv_05 == 0 ? na : sma_05 and (ext_05 or tfr_05_daily) ? s05_3 : na, title="MA05 - SMA/EXT", color=col_05, style=lineStyleChooser(ls_sma_ext), linewidth=lwi_05) plot(itv_05 == 0 ? na : sma_05 and reg_05 and not tfr_05_daily ? s05_4 : na, title="MA05 - SMA/REG", color=col_05, style=lineStyleChooser(ls_sma_reg), linewidth=lwi_05)
ATR Table (SMA)
https://www.tradingview.com/script/S5QOLheR-ATR-Table-SMA/
KhashayarJan
https://www.tradingview.com/u/KhashayarJan/
135
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/ // © KhashayarJan //@version=5 indicator("SMA ATR Table", overlay = true) color i_TriggerBGColor = input(defval = color.green, title = "Trigger Time Background Color") color i_TriggerTxtColor = input(defval = color.black,title = "Trigger Time Text Color") color i_TradingBGColor = input(defval = color.blue,title = "Trading Time Background Color") color i_TradingTxtColor = input(defval = color.white,title = "Trading Time Text Color") color i_OtherBGColor = input(defval = color.gray,title = "Other Time Background Color") color i_OtherTxtColor = input(defval = color.white,title = "Other Time Text Color") i_decimal = input(defval = 2, title = "Decimal points") var table atrDisplay = table.new(position.top_right, 3, 4, bgcolor = color.gray, frame_width = 2, frame_color = color.black) // We call `ta.atr()` outside the `if` block so it executes on each bar. atr5 = request.security(syminfo.tickerid, '5', ta.sma(ta.tr(true),12)) atr15 = request.security(syminfo.tickerid, '15', ta.sma(ta.tr(true),16)) atr1h = request.security(syminfo.tickerid, '60', ta.sma(ta.tr(true),24)) atr4h = request.security(syminfo.tickerid, '240', ta.sma(ta.tr(true),42)) atrD = request.security(syminfo.tickerid, '1D',ta.sma(ta.tr(true),30)) atrW = request.security(syminfo.tickerid, '1W', ta.sma(ta.tr(true),52)) rsi5 = request.security(syminfo.tickerid, '5', ta.rsi(close,12)) rsi15 = request.security(syminfo.tickerid, '15', ta.rsi(close,16)) rsi1h = request.security(syminfo.tickerid, '60', ta.rsi(close,24)) rsi4h = request.security(syminfo.tickerid, '240', ta.rsi(close,42)) rsi1D = request.security(syminfo.tickerid, '1D',ta.rsi(close,30)) rsi1W = request.security(syminfo.tickerid, '1W', ta.rsi(close,52)) if barstate.islast ATRformatStructure = '#.' for i = 1 to i_decimal ATRformatStructure += '0' color BGColor5 = i_OtherBGColor color BGColor15 = i_OtherBGColor color BGColor1h = i_OtherBGColor color BGColor4h = i_OtherBGColor color BGColor1D = i_OtherBGColor color BGColor1W = i_OtherBGColor color TxtColor5 = i_OtherTxtColor color TxtColor15 = i_OtherTxtColor color TxtColor1h = i_OtherTxtColor color TxtColor4h = i_OtherTxtColor color TxtColor1D = i_OtherTxtColor color TxtColor1W = i_OtherTxtColor switch timeframe.period "5" => BGColor5 := i_TriggerBGColor TxtColor5 := i_TriggerTxtColor BGColor1h := i_TradingBGColor TxtColor1h := i_TradingTxtColor "15" => BGColor15 := i_TriggerBGColor TxtColor15 := i_TriggerTxtColor BGColor4h := i_TradingBGColor TxtColor4h := i_TradingTxtColor "60" => BGColor1h := i_TriggerBGColor TxtColor1h := i_TriggerTxtColor BGColor1D := i_TradingBGColor TxtColor1D := i_TradingTxtColor "240" => BGColor4h := i_TriggerBGColor TxtColor4h := i_TriggerTxtColor BGColor1W := i_TradingBGColor TxtColor1W := i_TradingTxtColor "D" => BGColor1D := i_TriggerBGColor TxtColor1D := i_TriggerTxtColor BGColor1W := i_TradingBGColor TxtColor1W := i_TradingTxtColor "W" => BGColor1W := i_TriggerBGColor TxtColor1W := i_TriggerTxtColor // We only populate the table on the last bar. table.cell(atrDisplay, 0, 0, "ATR 5m: " + str.tostring(atr5, ATRformatStructure), bgcolor = BGColor5, text_color = TxtColor5) table.cell(atrDisplay, 1, 0, "ATR 15m: " + str.tostring(atr15, ATRformatStructure), bgcolor = BGColor15, text_color = TxtColor15) table.cell(atrDisplay, 2, 0, "ATR 1H: " + str.tostring(atr1h, ATRformatStructure), bgcolor = BGColor1h, text_color = TxtColor1h) table.cell(atrDisplay, 0, 1, "RSI 5m: " + str.tostring(rsi5, ATRformatStructure), bgcolor = BGColor5, text_color = TxtColor5) table.cell(atrDisplay, 1, 1, "RSI 15m: " + str.tostring(rsi15, ATRformatStructure), bgcolor = BGColor15, text_color = TxtColor15) table.cell(atrDisplay, 2, 1, "RSI 1H: " + str.tostring(rsi1h, ATRformatStructure), bgcolor = BGColor1h, text_color = TxtColor1h) table.cell(atrDisplay, 0, 2, "ATR 4H: " + str.tostring(atr4h, ATRformatStructure), bgcolor = BGColor4h, text_color = TxtColor4h) table.cell(atrDisplay, 1, 2, "ATR 1D: " + str.tostring(atrD, ATRformatStructure), bgcolor = BGColor1D, text_color = TxtColor1D) table.cell(atrDisplay, 2, 2, "ATR 1W: " + str.tostring(atrW, ATRformatStructure), bgcolor = BGColor1W, text_color = TxtColor1W) table.cell(atrDisplay, 0, 3, "RSI 4H: " + str.tostring(rsi4h, ATRformatStructure), bgcolor = BGColor4h, text_color = TxtColor4h) table.cell(atrDisplay, 1, 3, "RSI 1D: " + str.tostring(rsi1D, ATRformatStructure), bgcolor = BGColor1D, text_color = TxtColor1D) table.cell(atrDisplay, 2, 3, "RSI 1W: " + str.tostring(rsi1W, ATRformatStructure), bgcolor = BGColor1W, text_color = TxtColor1W)
Binary Signals - Mnetf
https://www.tradingview.com/script/PwfpniM0-Binary-Signals-Mnetf/
mhlangasimile
https://www.tradingview.com/u/mhlangasimile/
42
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/ // © mhlangasimile //@version=4 study("Binary Signals", overlay=true, scale=scale.left) vixClose= security("TVC:VIX", "1", close[1]) vixOpen= security("TVC:VIX", "1", open[1]) if(vixOpen < vixClose) //strategy.entry(id="Entry Long", long=true) x = bar_index y = close txt = 'S' sellLabel = label.new(x, y, txt) label.set_color(id=sellLabel, color=color.red) alert("NASDAQ Put Option") if(vixOpen > vixClose) //strategy.entry(id="Entry Short", long=false) x = bar_index y = close txt = 'B' buyLabel = label.new(x, y, txt) label.set_color(id=buyLabel, color=color.blue) alert("NASDAQ Call Option")
Bogdan Ciocoiu - Looking Glass
https://www.tradingview.com/script/axtlVRY2-Bogdan-Ciocoiu-Looking-Glass/
BogdanCiocoiu
https://www.tradingview.com/u/BogdanCiocoiu/
73
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/ // © BogdanCiocoiu //@version=5 // Original Description // The script shows a multi-timeline suite of information for the current ticker. This information refers to configurable moving averages, RSI, Stochastic RSI, VWAP and TSI data. The timeframes reflected in the script vary from 1m to 1h. I recommend the tool for 3m scalping as it provides good visibility upwards. // This is the updated version of the original script. Special thanks to SamAccountX for the support. // Major updates compared to the v1 version include: // - Being able to change the style of the lines, including width and colour // - Being able to show/hide the table or specific columns/rows from within // - Improvements in terms of naming the plots and shapes to ease traceability and managing settings // - Optimised the previous revision by reducing the number of "request.security" calls, improving load and allowing room for more feature functionalities. // - Allows repositioning the table subject to screen size and shape to suit the diverse type of terminals out there // Originality and usefulness // This tool is helpful because it helps users read a chart much quicker than if they were to navigate between timeframes. The colour coding indicates an accident/descendant trend between any two values (i.e. close vs MA1, MA1-MA2, RSI K vs RSI D, etc.). // Open-source reuse // https://www.tradingview.com/support/solutions/43000502589-moving-average/ // https://www.tradingview.com/support/solutions/43000502338-relative-strength-index-rsi/ // https://www.tradingview.com/support/solutions/43000502333-stochastic-rsi-stoch-rsi/ // https://www.tradingview.com/support/solutions/43000502018-volume-weighted-average-price-vwap/ // https://www.tradingview.com/support/solutions/43000592290-true-strength-indicator/ // ---------------------------------------------------------------------------------------- // Start // ---------------------------------------------------------------------------------------- indicator("Bogdan Ciocoiu - Looking Glass", shorttitle="BC - Looking Glass", overlay=true) _tf_1 = input(true, "Show TF 1m", inline="Timeframe") _tf_3 = input(true, "3m", inline="Timeframe") _tf_5 = input(true, "5m", inline="Timeframe") _tf_15 = input(true, "15m", inline="Timeframe") _tf_60 = input(true, "1h", inline="Timeframe") _positive = input(color.green, "Positive", inline="Colour scheme") _negative = input(color.red, "Negative", inline="Colour scheme") _neutral = input(color.orange, "Neutral", inline="Colour scheme") // ---------------------------------------------------------------------------------------- // Common library // ---------------------------------------------------------------------------------------- _dec = str.length(str.tostring(syminfo.mintick[1]))-2 _trunc(_no, _dec) => int(_no * math.pow(10, _dec)) / math.pow (10, _dec) _color_1(_no1, _no2)=>(_no1>_no2) ? color.new(_positive, 90) : color.new(_negative, 90) _color_2(_no1, _no2)=>(_no1>_no2) ? color.new(_positive, 50) : color.new(_negative, 50) _color_3(_no1, _no2, _no3)=>(_no1>_no2)?color.new(_negative, 90):(_no1 < _no3)?color.new(_positive, 90):color.new(_neutral, 90) _color_4(_no1, _no2, _no3)=>(_no1>_no2)?color.new(_negative, 50):(_no1 < _no3)?color.new(_positive, 50):color.new(_neutral, 50) _ma (_src, _len, _type) => switch _type "SMA" => ta.sma(_src, _len) "EMA" => ta.ema(_src, _len) "WMA" => ta.wma(_src, _len) "VWMA" => ta.vwma(_src, _len) "SMMA" => _ma = ta.sma ( _src, _len ) _ma_final = 0.0 _ma_final := na ( _ma_final[1] ) ? _ma : ( _ma_final[1] * ( _len - 1 ) + _src ) / _len _vwap_compute(_vwap_src, _vwap_is_new_period) => var float _vwap_sum_src_vol = na var float _vwap_sum_vol = na var float _vwap_sum_src_src_vol = na _vwap_sum_src_vol := _vwap_is_new_period ? _vwap_src * volume : _vwap_src * volume + _vwap_sum_src_vol[1] _vwap_sum_vol := _vwap_is_new_period ? volume : volume + _vwap_sum_vol[1] _vwap_sum_src_src_vol := _vwap_is_new_period ? volume * math.pow(_vwap_src, 2) : volume * math.pow(_vwap_src, 2) + _vwap_sum_src_vol[1] _vwap = _vwap_sum_src_vol / _vwap_sum_vol // ---------------------------------------------------------------------------------------- // Dashboard // ---------------------------------------------------------------------------------------- _dash_pos = input.string("bottom_right", title="Table position", options=["bottom_center", "bottom_left", "bottom_right", "middle_center", "middle_left", "middle_right", "top_center", "top_left", "top_right"], inline="Table setting") table _dash = table.new(_dash_pos, 25, 15, border_width=5) // ---------------------------------------------------------------------------------------- // Three MA // ---------------------------------------------------------------------------------------- _ma_style = input.string("SMMA", title="MA type", options=["SMA", "EMA", "WMA", "VWMA", "SMMA"], inline="MA engine") _ma_src = input(close, title="", inline="MA engine") _ma_src_1 = request.security(syminfo.tickerid, "1", _ma_src) _ma_src_3 = request.security(syminfo.tickerid, "3", _ma_src) _ma_src_5 = request.security(syminfo.tickerid, "5", _ma_src) _ma_src_15 = request.security(syminfo.tickerid, "15", _ma_src) _ma_src_60 = request.security(syminfo.tickerid, "60", _ma_src) _ma1_show = input(true, "MA 1 length", inline="MA 1") _ma1_len = input(21, "", inline="MA 1") _ma1_col = input(color.green, title="", inline="MA 1") _ma1_final = _ma(_ma_src, _ma1_len, _ma_style) _ma1_final_1 = _ma(_ma_src_1, _ma1_len, _ma_style) _ma1_final_3 = _ma(_ma_src_3, _ma1_len, _ma_style) _ma1_final_5 = _ma(_ma_src_5, _ma1_len, _ma_style) _ma1_final_15 = _ma(_ma_src_15, _ma1_len, _ma_style) _ma1_final_60 = _ma(_ma_src_60, _ma1_len, _ma_style) _ma2_show = input(true, "MA 2 length", inline="MA 2") _ma2_len = input(50, "", inline="MA 2") _ma2_col = input(color.orange, title="", inline="MA 2") _ma2_final = _ma(_ma_src, _ma2_len, _ma_style) _ma2_final_1 = _ma(_ma_src_1, _ma2_len, _ma_style) _ma2_final_3 = _ma(_ma_src_3, _ma2_len, _ma_style) _ma2_final_5 = _ma(_ma_src_5, _ma2_len, _ma_style) _ma2_final_15 = _ma(_ma_src_15, _ma2_len, _ma_style) _ma2_final_60 = _ma(_ma_src_60, _ma2_len, _ma_style) _ma3_show = input(true, "MA 3 length", inline="MA 3") _ma3_len = input(200, "", inline="MA 3") _ma3_col = input(color.red, title="", inline="MA 3") _ma3_final = _ma(_ma_src, _ma3_len, _ma_style) _ma3_final_1 = _ma(_ma_src_1, _ma3_len, _ma_style) _ma3_final_3 = _ma(_ma_src_3, _ma3_len, _ma_style) _ma3_final_5 = _ma(_ma_src_5, _ma3_len, _ma_style) _ma3_final_15 = _ma(_ma_src_15, _ma3_len, _ma_style) _ma3_final_60 = _ma(_ma_src_60, _ma3_len, _ma_style) // ---------------------------------------------------------------------------------------- // VWAP // ---------------------------------------------------------------------------------------- _vwap_show = input(true, "Show VWAP", inline="VWAP engine") _vwap_source = input(hlc3, title="", inline="VWAP engine") _vwap_col = input(color.gray, title="", inline="VWAP engine") _vwap_final = _vwap_compute(_vwap_source, ta.change(time("D"))) _vwap_final_1 = request.security(syminfo.tickerid, "1", _vwap_compute(_vwap_source, ta.change(time("D")))) _vwap_final_3 = request.security(syminfo.tickerid, "3", _vwap_compute(_vwap_source, ta.change(time("D")))) _vwap_final_5 = request.security(syminfo.tickerid, "5", _vwap_compute(_vwap_source, ta.change(time("D")))) _vwap_final_15 = request.security(syminfo.tickerid, "15", _vwap_compute(_vwap_source, ta.change(time("D")))) _vwap_final_60 = request.security(syminfo.tickerid, "60", _vwap_compute(_vwap_source, ta.change(time("D")))) // ---------------------------------------------------------------------------------------- // TSI // ---------------------------------------------------------------------------------------- _tsi_show = input(true, "Show TSI", inline="TSI engine") _tsi_long = input(25, "", inline="TSI engine") _tsi_short = input(13, "Short", inline="TSI engine") _tsi_signal = input(13, "Signal", inline="TSI engine") _tsi_price = close _tsi_double_smooth(_tsi_src, _tsi_long, _tsi_short) => _tsi_fist_smooth = ta.ema(_tsi_src, _tsi_long) ta.ema(_tsi_fist_smooth, _tsi_short) _tsi_pc = ta.change(_tsi_price) _tsi_double_smoothed_pc = _tsi_double_smooth(_tsi_pc, _tsi_long, _tsi_short) _tsi_double_smoothed_abs_pc = _tsi_double_smooth(math.abs(_tsi_pc), _tsi_long, _tsi_short) _tsi_val = 100 * (_tsi_double_smoothed_pc / _tsi_double_smoothed_abs_pc) _tsi_val_signal = ta.ema(_tsi_val, _tsi_signal) _tsi_val_signal_delta = _tsi_val - _tsi_val_signal _tsi_val_1 = request.security(syminfo.tickerid, "1", 100 * (_tsi_double_smoothed_pc / _tsi_double_smoothed_abs_pc)) _tsi_val_1_signal = ta.ema(_tsi_val_1, _tsi_signal) _tsi_val_1_signal_delta = _tsi_val_1 - _tsi_val_1_signal _tsi_val_3 = request.security(syminfo.tickerid, "3", 100 * (_tsi_double_smoothed_pc / _tsi_double_smoothed_abs_pc)) _tsi_val_3_signal = ta.ema(_tsi_val_3, _tsi_signal) _tsi_val_3_signal_delta = _tsi_val_3 - _tsi_val_3_signal _tsi_val_5 = request.security(syminfo.tickerid, "5", 100 * (_tsi_double_smoothed_pc / _tsi_double_smoothed_abs_pc)) _tsi_val_5_signal = ta.ema(_tsi_val_5, _tsi_signal) _tsi_val_5_signal_delta = _tsi_val_5 - _tsi_val_5_signal _tsi_val_15 = request.security(syminfo.tickerid, "15", 100 * (_tsi_double_smoothed_pc / _tsi_double_smoothed_abs_pc)) _tsi_val_15_signal = ta.ema(_tsi_val_15, _tsi_signal) _tsi_val_15_signal_delta = _tsi_val_15 - _tsi_val_15_signal _tsi_val_60 = request.security(syminfo.tickerid, "60", 100 * (_tsi_double_smoothed_pc / _tsi_double_smoothed_abs_pc)) _tsi_val_60_signal = ta.ema(_tsi_val_60, _tsi_signal) _tsi_val_60_signal_delta = _tsi_val_60 - _tsi_val_60_signal // ---------------------------------------------------------------------------------------- // RSI // ---------------------------------------------------------------------------------------- _rsi_show = input(true, "RSI", inline="RSI engine") _rsi_len = input(14, "", inline="RSI engine") _rsi_src = input(close, title="", inline="RSI engine") _rsi_type = input.string("SMA", title="", options=["SMA", "EMA", "WMA", "VWMA", "SMMA"], inline="RSI engine") _rsi_final = ta.rsi(_rsi_src, _rsi_len) _rsi_final_1 = request.security(syminfo.tickerid, "1", ta.rsi(_rsi_src, _rsi_len)) _rsi_final_3 = request.security(syminfo.tickerid, "3", ta.rsi(_rsi_src, _rsi_len)) _rsi_final_5 = request.security(syminfo.tickerid, "5", ta.rsi(_rsi_src, _rsi_len)) _rsi_final_15 = request.security(syminfo.tickerid, "15", ta.rsi(_rsi_src, _rsi_len)) _rsi_final_60 = request.security(syminfo.tickerid, "60", ta.rsi(_rsi_src, _rsi_len)) // ---------------------------------------------------------------------------------------- // Stoch RSI // ---------------------------------------------------------------------------------------- _s_rsi_show = input(true, "Show Stoch RSI", inline="Stoch RSI") _s_rsi_smooth_k_d = input.int(3, "K/D", minval=1, inline="Stoch RSI") _s_rsi_length = input.int(14, "Len", minval=1, inline="Stoch RSI") _sto_RSI_src = input(close, title="", inline="Stoch RSI") _sto_RSI_rsi = ta.rsi(_sto_RSI_src, _s_rsi_length) _sto_RSI_k = ta.sma(ta.stoch(_sto_RSI_rsi, _sto_RSI_rsi, _sto_RSI_rsi, _s_rsi_length), _s_rsi_smooth_k_d) _sto_RSI_d = ta.sma(_sto_RSI_k, _s_rsi_smooth_k_d) _sto_RSI_k_1 = request.security(syminfo.tickerid, "1", ta.sma(ta.stoch(_sto_RSI_rsi, _sto_RSI_rsi, _sto_RSI_rsi, _s_rsi_length), _s_rsi_smooth_k_d)) _sto_RSI_d_1 = ta.sma(_sto_RSI_k_1, _s_rsi_smooth_k_d) _sto_RSI_k_3 = request.security(syminfo.tickerid, "3", ta.sma(ta.stoch(_sto_RSI_rsi, _sto_RSI_rsi, _sto_RSI_rsi, _s_rsi_length), _s_rsi_smooth_k_d)) _sto_RSI_d_3 = ta.sma(_sto_RSI_k_3, _s_rsi_smooth_k_d) _sto_RSI_k_5 = request.security(syminfo.tickerid, "5", ta.sma(ta.stoch(_sto_RSI_rsi, _sto_RSI_rsi, _sto_RSI_rsi, _s_rsi_length), _s_rsi_smooth_k_d)) _sto_RSI_d_5 = ta.sma(_sto_RSI_k_5, _s_rsi_smooth_k_d) _sto_RSI_k_15 = request.security(syminfo.tickerid, "15", ta.sma(ta.stoch(_sto_RSI_rsi, _sto_RSI_rsi, _sto_RSI_rsi, _s_rsi_length), _s_rsi_smooth_k_d)) _sto_RSI_d_15 = ta.sma(_sto_RSI_k_15, _s_rsi_smooth_k_d) _sto_RSI_k_60 = request.security(syminfo.tickerid, "60", ta.sma(ta.stoch(_sto_RSI_rsi, _sto_RSI_rsi, _sto_RSI_rsi, _s_rsi_length), _s_rsi_smooth_k_d)) _sto_RSI_d_60 = ta.sma(_sto_RSI_k_60, _s_rsi_smooth_k_d) // ---------------------------------------------------------------------------------------- // Fractals // ---------------------------------------------------------------------------------------- _fractals_show = input(true, "Show and enable Fractals periods", inline="Fractals engine") _fractals_len = input(2, title="", inline="Fractals engine") bool _fractals_above_down = true bool _fractals_above_up0 = true bool _fractals_above_up1 = true bool _fractals_above_up2 = true bool _fractals_above_up3 = true bool _fractals_above_up4 = true for i = 1 to _fractals_len _fractals_above_down := _fractals_above_down and (high[_fractals_len-i] < high[_fractals_len]) _fractals_above_up0 := _fractals_above_up0 and (high[_fractals_len+i] < high[_fractals_len]) _fractals_above_up1 := _fractals_above_up1 and (high[_fractals_len+1] <= high[_fractals_len] and high[_fractals_len+i + 1] < high[_fractals_len]) _fractals_above_up2 := _fractals_above_up2 and (high[_fractals_len+1] <= high[_fractals_len] and high[_fractals_len+2] <= high[_fractals_len] and high[_fractals_len+i + 2] < high[_fractals_len]) _fractals_above_up3 := _fractals_above_up3 and (high[_fractals_len+1] <= high[_fractals_len] and high[_fractals_len+2] <= high[_fractals_len] and high[_fractals_len+3] <= high[_fractals_len] and high[_fractals_len+i + 3] < high[_fractals_len]) _fractals_above_up4 := _fractals_above_up4 and (high[_fractals_len+1] <= high[_fractals_len] and high[_fractals_len+2] <= high[_fractals_len] and high[_fractals_len+3] <= high[_fractals_len] and high[_fractals_len+4] <= high[_fractals_len] and high[_fractals_len+i + 4] < high[_fractals_len]) _fractals_above_trigger = _fractals_above_up0 or _fractals_above_up1 or _fractals_above_up2 or _fractals_above_up3 or _fractals_above_up4 _fractals_above = (_fractals_above_down and _fractals_above_trigger) bool _fractals_below_down = true bool _fractals_below_up0 = true bool _fractals_below_up1 = true bool _fractals_below_up2 = true bool _fractals_below_up3 = true bool _fractals_below_up4 = true for i = 1 to _fractals_len _fractals_below_down := _fractals_below_down and (low[_fractals_len-i] > low[_fractals_len]) _fractals_below_up0 := _fractals_below_up0 and (low[_fractals_len+i] > low[_fractals_len]) _fractals_below_up1 := _fractals_below_up1 and (low[_fractals_len+1] >= low[_fractals_len] and low[_fractals_len+i + 1] > low[_fractals_len]) _fractals_below_up2 := _fractals_below_up2 and (low[_fractals_len+1] >= low[_fractals_len] and low[_fractals_len+2] >= low[_fractals_len] and low[_fractals_len+i + 2] > low[_fractals_len]) _fractals_below_up3 := _fractals_below_up3 and (low[_fractals_len+1] >= low[_fractals_len] and low[_fractals_len+2] >= low[_fractals_len] and low[_fractals_len+3] >= low[_fractals_len] and low[_fractals_len+i + 3] > low[_fractals_len]) _fractals_below_up4 := _fractals_below_up4 and (low[_fractals_len+1] >= low[_fractals_len] and low[_fractals_len+2] >= low[_fractals_len] and low[_fractals_len+3] >= low[_fractals_len] and low[_fractals_len+4] >= low[_fractals_len] and low[_fractals_len+i + 4] > low[_fractals_len]) _fractals_below_trigger = _fractals_below_up0 or _fractals_below_up1 or _fractals_below_up2 or _fractals_below_up3 or _fractals_below_up4 _fractals_below = (_fractals_below_down and _fractals_below_trigger) // ---------------------------------------------------------------------------------------- // Trend fill // ---------------------------------------------------------------------------------------- _trend_fill_show = input(true, "Show trend fill", inline="Trend fill") _trend_fill_pos = (close >= _ma1_final and _ma1_final >= _ma2_final and _ma2_final >= _ma3_final) ? true : false _trend_fill_neg = (close <= _ma1_final and _ma1_final <= _ma2_final and _ma2_final <= _ma3_final) ? true : false _trend_fill_pos_high_level = (close >= _ma3_final) ? true : false _trend_fill_neg_high_level = (close <= _ma3_final) ? true : false _trend_fill_color = _trend_fill_pos ? color.new(color.green, 90) : _trend_fill_neg ? color.new(color.red, 90) : na _trend_fill_value = _trend_fill_pos ? _ma1_final : _trend_fill_neg ? _ma1_final : na _trend_fill_plot_1 = plot(_trend_fill_show ? _trend_fill_value : na, "Fill 1", color=color.new(color.blue, 100), style=plot.style_line, linewidth=0) _trend_fill_plot_2 = plot(_trend_fill_show ? _ma3_final : na, "Fill 2", color=color.new(color.blue, 100), style=plot.style_line, linewidth=0) // ---------------------------------------------------------------------------------------- // Render // ---------------------------------------------------------------------------------------- plot(_ma1_show ? _ma1_final : na, "MA 1", linewidth=1, style=plot.style_line, color=_ma1_col) plot(_ma2_show ? _ma2_final : na, "MA 2", linewidth=1, style=plot.style_line, color=_ma2_col) plot(_ma3_show ? _ma3_final : na, "MA 3", linewidth=3, style=plot.style_line, color=_ma3_col) fill(_trend_fill_plot_1, _trend_fill_plot_2, color=_trend_fill_color, fillgaps=false) plotshape(_fractals_show and _trend_fill_pos ? _fractals_below : na, "Fractals B1", style=shape.triangleup, location=location.belowbar, offset=-_fractals_len, color=color.new(color.green, 0), size=size.auto) plotshape(_fractals_show and _trend_fill_neg ? _fractals_above : na, "Fractals A1", style=shape.triangledown, location=location.abovebar, offset=-_fractals_len, color=color.new(color.red, 0), size=size.auto) plotshape(_fractals_show and _trend_fill_pos==false and _trend_fill_pos_high_level ? _fractals_below : na, "Fractals B2", style=shape.triangleup, location=location.belowbar, offset=-_fractals_len, color=color.new(color.gray, 0), size=size.auto) plotshape(_fractals_show and _trend_fill_neg==false and _trend_fill_neg_high_level ? _fractals_above : na, "Fractals A2", style=shape.triangledown, location=location.abovebar, offset=-_fractals_len, color=color.new(color.gray, 0), size=size.auto) plot(_vwap_show ? _vwap_final : na, "VWAP", linewidth=3, style=plot.style_line, color=color.new(_vwap_col, 50)) // ---------------------------------------------------------------------------------------- // Render table // ---------------------------------------------------------------------------------------- if _tf_1 == true table.cell(_dash, 1, 2, "1", text_color=(timeframe.period == "1") ? color.black : color.white, bgcolor=(timeframe.period == "1") ? color.new(color.green, 30) : color.black, width=1.5) if _tf_3 == true table.cell(_dash, 1, 3, "3", text_color=(timeframe.period == "3") ? color.black : color.white, bgcolor=(timeframe.period == "3") ? color.new(color.green, 30) : color.black) if _tf_5 == true table.cell(_dash, 1, 4, "5", text_color=(timeframe.period == "5") ? color.black : color.white, bgcolor=(timeframe.period == "5") ? color.new(color.green, 30) : color.black) if _tf_15 == true table.cell(_dash, 1, 5, "15", text_color=(timeframe.period == "15") ? color.black : color.white, bgcolor=(timeframe.period == "15") ? color.new(color.green, 30) : color.black) if _tf_60 == true table.cell(_dash, 1, 6, "60", text_color=(timeframe.period == "60") ? color.black : color.white, bgcolor=(timeframe.period == "60") ? color.new(color.green, 30) : color.black) if _ma1_show == true and _ma2_show == true and _ma3_show == true table.cell(_dash, 2, 1, "C-MA1", text_color=color.white, bgcolor=color.new(_ma1_col, 30), width=2) table.cell(_dash, 3, 1, "C-MA2", text_color=color.white, bgcolor=color.new(_ma2_col, 30), width=2) table.cell(_dash, 4, 1, "C-MA3", text_color=color.white, bgcolor=color.new(_ma3_col, 30), width=2) table.cell(_dash, 5, 1, "MA1-2", text_color=color.white, bgcolor=color.black, width=2) table.cell(_dash, 6, 1, "MA2-3", text_color=color.white, bgcolor=color.black, width=2) if _rsi_show == true table.cell(_dash, 7, 1, "RSI", text_color=color.white, bgcolor=color.black, width=2) if _s_rsi_show == true table.cell(_dash, 8, 1, "SRSI K", text_color=color.white, bgcolor=color.black, width=2) table.cell(_dash, 9, 1, "D", text_color=color.white, bgcolor=color.black, width=2) if _vwap_show == true table.cell(_dash, 10, 1, "VWAP", text_color=color.white, bgcolor=color.new(_vwap_col, 30), width=2) if _tsi_show == true table.cell(_dash, 11, 1, "TSI", text_color=color.white, bgcolor=color.black, width=2) table.cell(_dash, 12, 1, "Signal", text_color=color.white, bgcolor=color.black, width=2) table.cell(_dash, 13, 1, "Δ", text_color=color.white, bgcolor=color.black, width=1.5) if _ma1_show == true and _ma2_show == true and _ma3_show == true and _tf_1 == true table.cell(_dash, 2, 2, str.tostring(_trunc(close - _ma1_final_1, _dec)), text_color=_color_2(close, _ma1_final_1), bgcolor=_color_1(close, _ma1_final_1)) table.cell(_dash, 3, 2, str.tostring(_trunc(close - _ma2_final_1, _dec)), text_color=_color_2(close, _ma2_final_1), bgcolor=_color_1(close, _ma2_final_1)) table.cell(_dash, 4, 2, str.tostring(_trunc(close - _ma3_final_1, _dec)), text_color=_color_2(close, _ma3_final_1), bgcolor=_color_1(close, _ma3_final_1)) table.cell(_dash, 5, 2, str.tostring(_trunc(_ma1_final_1 - _ma2_final_1, _dec)), text_color=_color_2(_ma1_final_1, _ma2_final_1), bgcolor=_color_1(_ma1_final_1, _ma2_final_1)) table.cell(_dash, 6, 2, str.tostring(_trunc(_ma2_final_1 - _ma3_final_1, _dec)), text_color=_color_2(_ma2_final_1, _ma3_final_1), bgcolor=_color_1(_ma2_final_1, _ma3_final_1)) if _ma1_show == true and _ma2_show == true and _ma3_show == true and _tf_3 == true table.cell(_dash, 2, 3, str.tostring(_trunc(close - _ma1_final_3, _dec)), text_color=_color_2(close, _ma1_final_3), bgcolor=_color_1(close, _ma1_final_3)) table.cell(_dash, 3, 3, str.tostring(_trunc(close - _ma2_final_3, _dec)), text_color=_color_2(close, _ma2_final_3), bgcolor=_color_1(close, _ma2_final_3)) table.cell(_dash, 4, 3, str.tostring(_trunc(close - _ma3_final_3, _dec)), text_color=_color_2(close, _ma3_final_3), bgcolor=_color_1(close, _ma3_final_3)) table.cell(_dash, 5, 3, str.tostring(_trunc(_ma1_final_3 - _ma2_final_3, _dec)), text_color=_color_2(_ma1_final_3, _ma2_final_3), bgcolor=_color_1(_ma1_final_3, _ma2_final_3)) table.cell(_dash, 6, 3, str.tostring(_trunc(_ma2_final_3 - _ma3_final_3, _dec)), text_color=_color_2(_ma2_final_3, _ma3_final_3), bgcolor=_color_1(_ma2_final_3, _ma3_final_3)) if _ma1_show == true and _ma2_show == true and _ma3_show == true and _tf_5 == true table.cell(_dash, 2, 4, str.tostring(_trunc(close - _ma1_final_5, _dec)), text_color=_color_2(close, _ma1_final_5), bgcolor=_color_1(close, _ma1_final_5)) table.cell(_dash, 3, 4, str.tostring(_trunc(close - _ma2_final_5, _dec)), text_color=_color_2(close, _ma2_final_5), bgcolor=_color_1(close, _ma2_final_5)) table.cell(_dash, 4, 4, str.tostring(_trunc(close - _ma3_final_5, _dec)), text_color=_color_2(close, _ma3_final_5), bgcolor=_color_1(close, _ma3_final_5)) table.cell(_dash, 5, 4, str.tostring(_trunc(_ma1_final_5 - _ma2_final_5, _dec)), text_color=_color_2(_ma1_final_5, _ma2_final_5), bgcolor=_color_1(_ma1_final_5, _ma2_final_5)) table.cell(_dash, 6, 4, str.tostring(_trunc(_ma2_final_5 - _ma3_final_5, _dec)), text_color=_color_2(_ma2_final_5, _ma3_final_5), bgcolor=_color_1(_ma2_final_5, _ma3_final_5)) if _ma1_show == true and _ma2_show == true and _ma3_show == true and _tf_15 == true table.cell(_dash, 2, 5, str.tostring(_trunc(close - _ma1_final_15, _dec)), text_color=_color_2(close, _ma1_final_15), bgcolor=_color_1(close, _ma1_final_15)) table.cell(_dash, 3, 5, str.tostring(_trunc(close - _ma2_final_15, _dec)), text_color=_color_2(close, _ma2_final_15), bgcolor=_color_1(close, _ma2_final_15)) table.cell(_dash, 4, 5, str.tostring(_trunc(close - _ma3_final_15, _dec)), text_color=_color_2(close, _ma3_final_15), bgcolor=_color_1(close, _ma3_final_15)) table.cell(_dash, 5, 5, str.tostring(_trunc(_ma1_final_15 - _ma2_final_15, _dec)), text_color=_color_2(_ma1_final_15, _ma2_final_15), bgcolor=_color_1(_ma1_final_15, _ma2_final_15)) table.cell(_dash, 6, 5, str.tostring(_trunc(_ma2_final_15 - _ma3_final_15, _dec)), text_color=_color_2(_ma2_final_15, _ma3_final_15), bgcolor=_color_1(_ma2_final_15, _ma3_final_15)) if _ma1_show == true and _ma2_show == true and _ma3_show == true and _tf_60 == true table.cell(_dash, 2, 6, str.tostring(_trunc(close - _ma1_final_60, _dec)), text_color=_color_2(close, _ma1_final_60), bgcolor=_color_1(close, _ma1_final_60)) table.cell(_dash, 3, 6, str.tostring(_trunc(close - _ma2_final_60, _dec)), text_color=_color_2(close, _ma2_final_60), bgcolor=_color_1(close, _ma2_final_60)) table.cell(_dash, 4, 6, str.tostring(_trunc(close - _ma3_final_60, _dec)), text_color=_color_2(close, _ma3_final_60), bgcolor=_color_1(close, _ma3_final_60)) table.cell(_dash, 5, 6, str.tostring(_trunc(_ma1_final_60 - _ma2_final_60, _dec)), text_color=_color_2(_ma1_final_60, _ma2_final_60), bgcolor=_color_1(_ma1_final_60, _ma2_final_60)) table.cell(_dash, 6, 6, str.tostring(_trunc(_ma2_final_60 - _ma3_final_60, _dec)), text_color=_color_2(_ma2_final_60, _ma3_final_60), bgcolor=_color_1(_ma2_final_60, _ma3_final_60)) if _rsi_show == true and _tf_1 == true table.cell(_dash, 7, 2, str.tostring(math.round(_rsi_final_1)), text_color=_color_2(_rsi_final_1, 50), bgcolor=_color_1(_rsi_final_1, 50)) if _rsi_show == true and _tf_3 == true table.cell(_dash, 7, 3, str.tostring(math.round(_rsi_final_3)), text_color=_color_2(_rsi_final_3, 50), bgcolor=_color_1(_rsi_final_3, 50)) if _rsi_show == true and _tf_5 == true table.cell(_dash, 7, 4, str.tostring(math.round(_rsi_final_5)), text_color=_color_2(_rsi_final_5, 50), bgcolor=_color_1(_rsi_final_5, 50)) if _rsi_show == true and _tf_15 == true table.cell(_dash, 7, 5, str.tostring(math.round(_rsi_final_15)), text_color=_color_2(_rsi_final_15, 50), bgcolor=_color_1(_rsi_final_15, 50)) if _rsi_show == true and _tf_60 == true table.cell(_dash, 7, 6, str.tostring(math.round(_rsi_final_60)), text_color=_color_2(_rsi_final_60, 50), bgcolor=_color_1(_rsi_final_60, 50)) if _s_rsi_show == true and _tf_1 == true table.cell(_dash, 8, 2, str.tostring(math.round(_sto_RSI_k_1)), text_color=_color_4(_sto_RSI_k_1, 80, 20), bgcolor=_color_3(_sto_RSI_k_1, 80, 20)) if _s_rsi_show == true and _tf_3 == true table.cell(_dash, 8, 3, str.tostring(math.round(_sto_RSI_k_3)), text_color=_color_4(_sto_RSI_k_3, 80, 20), bgcolor=_color_3(_sto_RSI_k_3, 80, 20)) if _s_rsi_show == true and _tf_5 == true table.cell(_dash, 8, 4, str.tostring(math.round(_sto_RSI_k_5)), text_color=_color_4(_sto_RSI_k_5, 80, 20), bgcolor=_color_3(_sto_RSI_k_5, 80, 20)) if _s_rsi_show == true and _tf_15 == true table.cell(_dash, 8, 5, str.tostring(math.round(_sto_RSI_k_15)), text_color=_color_4(_sto_RSI_k_15, 80, 20), bgcolor=_color_3(_sto_RSI_k_15, 80, 20)) if _s_rsi_show == true and _tf_60 == true table.cell(_dash, 8, 6, str.tostring(math.round(_sto_RSI_k_60)), text_color=_color_4(_sto_RSI_k_60, 80, 20), bgcolor=_color_3(_sto_RSI_k_60, 80, 20)) if _s_rsi_show == true and _tf_1 == true table.cell(_dash, 9, 2, str.tostring(math.round(_sto_RSI_d_1)), text_color=_color_4(_sto_RSI_d_1, 80, 20), bgcolor=_color_3(_sto_RSI_d_1, 80, 20)) if _s_rsi_show == true and _tf_3 == true table.cell(_dash, 9, 3, str.tostring(math.round(_sto_RSI_d_3)), text_color=_color_4(_sto_RSI_d_3, 80, 20), bgcolor=_color_3(_sto_RSI_d_3, 80, 20)) if _s_rsi_show == true and _tf_5 == true table.cell(_dash, 9, 4, str.tostring(math.round(_sto_RSI_d_5)), text_color=_color_4(_sto_RSI_d_5, 80, 20), bgcolor=_color_3(_sto_RSI_d_5, 80, 20)) if _s_rsi_show == true and _tf_15 == true table.cell(_dash, 9, 5, str.tostring(math.round(_sto_RSI_d_15)), text_color=_color_4(_sto_RSI_d_15, 80, 20), bgcolor=_color_3(_sto_RSI_d_15, 80, 20)) if _s_rsi_show == true and _tf_60 == true table.cell(_dash, 9, 6, str.tostring(math.round(_sto_RSI_d_60)), text_color=_color_4(_sto_RSI_d_60, 80, 20), bgcolor=_color_3(_sto_RSI_d_60, 80, 20)) if _vwap_show == true and _tf_1 == true table.cell(_dash, 10, 2, str.tostring(_trunc(close-_vwap_final_1, _dec)), text_color=_color_2(close, _vwap_final_1), bgcolor=_color_1(close, _vwap_final_1)) if _vwap_show == true and _tf_3 == true table.cell(_dash, 10, 3, str.tostring(_trunc(close-_vwap_final_3, _dec)), text_color=_color_2(close, _vwap_final_3), bgcolor=_color_1(close, _vwap_final_3)) if _vwap_show == true and _tf_5 == true table.cell(_dash, 10, 4, str.tostring(_trunc(close-_vwap_final_5, _dec)), text_color=_color_2(close, _vwap_final_5), bgcolor=_color_1(close, _vwap_final_5)) if _vwap_show == true and _tf_15 == true table.cell(_dash, 10, 5, str.tostring(_trunc(close-_vwap_final_15, _dec)), text_color=_color_2(close, _vwap_final_15), bgcolor=_color_1(close, _vwap_final_15)) if _vwap_show == true and _tf_60 == true table.cell(_dash, 10, 6, str.tostring(_trunc(close-_vwap_final_60, _dec)), text_color=_color_2(close, _vwap_final_60), bgcolor=_color_1(close, _vwap_final_60)) if _tsi_show == true and _tf_1 == true table.cell(_dash, 11, 2, str.tostring(_trunc(_tsi_val_1, 2)), text_color=_color_2(_tsi_val_1, _tsi_val_1_signal), bgcolor=_color_1(_tsi_val_1, _tsi_val_1_signal)) table.cell(_dash, 12, 2, str.tostring(_trunc(_tsi_val_1_signal, 2)), text_color=_color_2(_tsi_val_1, _tsi_val_1_signal), bgcolor=_color_1(_tsi_val_1, _tsi_val_1_signal)) table.cell(_dash, 13, 2, str.tostring(math.round(_tsi_val_1_signal_delta)), text_color=_color_2(_tsi_val_1_signal_delta, 0), bgcolor=_color_1(_tsi_val_1_signal_delta, 0)) if _tsi_show == true and _tf_3 == true table.cell(_dash, 11, 3, str.tostring(_trunc(_tsi_val_3, 2)), text_color=_color_2(_tsi_val_3, _tsi_val_3_signal), bgcolor=_color_1(_tsi_val_3, _tsi_val_3_signal)) table.cell(_dash, 12, 3, str.tostring(_trunc(_tsi_val_3_signal, 2)), text_color=_color_2(_tsi_val_3, _tsi_val_3_signal), bgcolor=_color_1(_tsi_val_3, _tsi_val_3_signal)) table.cell(_dash, 13, 3, str.tostring(math.round(_tsi_val_3_signal_delta)), text_color=_color_2(_tsi_val_3_signal_delta, 0), bgcolor=_color_1(_tsi_val_3_signal_delta, 0)) if _tsi_show == true and _tf_5 == true table.cell(_dash, 11, 4, str.tostring(_trunc(_tsi_val_5, 2)), text_color=_color_2(_tsi_val_5, _tsi_val_5_signal), bgcolor=_color_1(_tsi_val_5, _tsi_val_5_signal)) table.cell(_dash, 12, 4, str.tostring(_trunc(_tsi_val_5_signal, 2)), text_color=_color_2(_tsi_val_5, _tsi_val_5_signal), bgcolor=_color_1(_tsi_val_5, _tsi_val_5_signal)) table.cell(_dash, 13, 4, str.tostring(math.round(_tsi_val_5_signal_delta)), text_color=_color_2(_tsi_val_5_signal_delta, 0), bgcolor=_color_1(_tsi_val_5_signal_delta, 0)) if _tsi_show == true and _tf_15 == true table.cell(_dash, 11, 5, str.tostring(_trunc(_tsi_val_15, 2)), text_color=_color_2(_tsi_val_15, _tsi_val_15_signal), bgcolor=_color_1(_tsi_val_15, _tsi_val_15_signal)) table.cell(_dash, 12, 5, str.tostring(_trunc(_tsi_val_15_signal, 2)), text_color=_color_2(_tsi_val_15, _tsi_val_15_signal), bgcolor=_color_1(_tsi_val_15, _tsi_val_15_signal)) table.cell(_dash, 13, 5, str.tostring(math.round(_tsi_val_15_signal_delta)), text_color=_color_2(_tsi_val_15_signal_delta, 0), bgcolor=_color_1(_tsi_val_15_signal_delta, 0)) if _tsi_show == true and _tf_60 == true table.cell(_dash, 11, 6, str.tostring(_trunc(_tsi_val_60, 2)), text_color=_color_2(_tsi_val_60, _tsi_val_60_signal), bgcolor=_color_1(_tsi_val_60, _tsi_val_60_signal)) table.cell(_dash, 12, 6, str.tostring(_trunc(_tsi_val_60_signal, 2)), text_color=_color_2(_tsi_val_60, _tsi_val_60_signal), bgcolor=_color_1(_tsi_val_60, _tsi_val_60_signal)) table.cell(_dash, 13, 6, str.tostring(math.round(_tsi_val_60_signal_delta)), text_color=_color_2(_tsi_val_60_signal_delta, 0), bgcolor=_color_1(_tsi_val_60_signal_delta, 0))
Bogdan Ciocoiu - Pager
https://www.tradingview.com/script/DF0utVC1-Bogdan-Ciocoiu-Pager/
BogdanCiocoiu
https://www.tradingview.com/u/BogdanCiocoiu/
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/ // © BogdanCiocoiu //@version=5 // Update of 09/01/2022 // This revision includes small optimisations // ► Description // This script creates the possibility for users to set up alerts on different timeframes when close prices crossover or cross under certain essential exponential moving averages such as 20, 50 or 200. The script shows the fundamental levels where one can set notifications. // // The current levels are: // 15min timeframe: when close < EMA 200 // 15min timeframe: when close > EMA 200 // 5min timeframe: when close < EMA 200 // 5min timeframe: when close > EMA 200 // 60min timeframe: when close < EMA 200 // 60min timeframe: when close > EMA 200 // // ► Originality and usefulness // This tool is helpful because it enables users to use the notification system when specific trends form without actively monitoring price action. // // ► Open-source reuse // The script only leverages TradingView native functionality. indicator("Bogdan Ciocoiu - Pager", shorttitle="BC - Pager", overlay=true) _5m_input_on = input(true, "TF1", inline="TF1") _5m_input_type = input(close, "", inline="TF1") _15m_input_on = input(true, "TF2", inline="TF2") _15m_input_type = input(close, "", inline="TF2") _60m_input_on = input(true, "TF3", inline="TF3") _60m_input_type = input(close, "", inline="TF3") _5m_close = request.security(syminfo.tickerid, "5", _5m_input_type) _5m_ema200 = request.security(syminfo.tickerid, "5", ta.ema(_5m_input_type, 200)) _15m_close = request.security(syminfo.tickerid, "15", _15m_input_type) _15m_ema200 = request.security(syminfo.tickerid, "15", ta.ema(_15m_input_type, 200)) _60m_close = request.security(syminfo.tickerid, "60", _60m_input_type) _60m_ema200 = request.security(syminfo.tickerid, "60", ta.ema(_60m_input_type, 200)) alertcondition(condition=ta.crossover(_5m_close, _5m_ema200), title="5min close > EMA 200", message="5min close > EMA 200") alertcondition(condition=ta.crossunder(_5m_close, _5m_ema200), title="5min close < EMA 200", message="5min close < EMA 200") alertcondition(condition=ta.crossover(_15m_close, _15m_ema200), title="15min close > EMA 200", message="15min close > EMA 200") alertcondition(condition=ta.crossunder(_15m_close, _15m_ema200), title="15min close < EMA 200", message="15min close < EMA 200") alertcondition(condition=ta.crossover(_60m_close, _60m_ema200), title="60min close > EMA 200", message="60min close > EMA 200") alertcondition(condition=ta.crossunder(_60m_close, _60m_ema200), title="60min close < EMA 200", message="60min close < EMA 200") plot(_5m_input_on ? _5m_close : na, "M5 close", color.red, linewidth=1) plot(_5m_input_on ? _5m_ema200 : na, "M5 EMA 200", color.blue, linewidth=1, style=plot.style_cross) plot(_15m_input_on ? _15m_close : na, "M15 close", color.yellow, linewidth=1) plot(_15m_input_on ? _15m_ema200 : na, "M15 EMA 200", color.green, linewidth=1, style=plot.style_cross) plot(_60m_input_on ? _60m_close : na, "1H close", color.white, linewidth=1) plot(_60m_input_on ? _60m_ema200 : na, "1H EMA 200", color.purple, linewidth=1, style=plot.style_cross)
Head & Shoulders S/R Regular
https://www.tradingview.com/script/VAkdJwDk-Head-Shoulders-S-R-Regular/
fikira
https://www.tradingview.com/u/fikira/
1,371
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © fikira //@version=5 indicator('Head & Shoulders S/R Regular', shorttitle='H&S S/R Reg.', max_lines_count=500, max_labels_count=500, max_boxes_count=500, overlay=true) i_dateFilter = input (true , title="═════ Date Range Filtering ═════") i_fromYear = input.int (2010 , title="From Year" , minval = 1900) i_fromMonth = input.int (1 , title="From Month" , minval = 1, maxval = 12) i_fromDay = input.int (1 , title="From Day" , minval = 1, maxval = 31) i_toYear = input.int (2999 , title="To Year" , minval = 1900) i_toMonth = input.int (1 , title="To Month" , minval = 1, maxval = 12) i_toDay = input.int (1 , title="To Day" , minval = 1, maxval = 31) fromDate = timestamp (i_fromYear, i_fromMonth, i_fromDay, 00, 00) toDate = timestamp (i_toYear , i_toMonth , i_toDay , 23, 59) f_tradeDateIsAllowed() => not i_dateFilter or (time >= fromDate and time <= toDate) left = input.int (10 , title='' , group='Pivot Points -> Leftbars - Rightbars' , inline='LR' ) right = input.int ( 5 , title='' , group='Pivot Points -> Leftbars - Rightbars' , inline='LR' ) retraceEmin = input.float( 0.618, title='' , group='min/max retrace AD -> E', step=0.1 , inline='RE' ) retraceEmax = input.float( 1.618, title='' , group='min/max retrace AD -> E', step=0.1 , inline='RE' ) percTol = input.float( 5.0 , title='' , group='% tolerance [L ~ R shoulder height]' , inline='LS' ) minPercLSh = input.float(30 , title='' , group='min/max % [Left Shoulder ~ Head]' , inline='LSH') / 100 maxPercLSh = input.float(60 , title='' , group='min/max % [Left Shoulder ~ Head]' , inline='LSH') / 100 extLines = input.int ( 0 , title='' , group='width R shoulder = L shoulder + x%' , inline='LRS') / 100 maxVisablePat = input.int (50 , title='' , group='maximum visible patterns' , inline='MVP') c_bl = input.color(color.new(color.lime , 93), title='color bullish') c_br = input.color(color.new(color.red , 93), title='color bearish') c_nt = input.color(color.new(color.blue , 93), title='color neutral') var float [] a_phP = array.new_float () var int [] a_phB = array.new_int () var float [] a_plP = array.new_float () var int [] a_plB = array.new_int () var line [] a_ln_bl = array.new_line () var linefill[] a_lnF_bl = array.new_linefill() var line [] a_EGmax = array.new_line () var line [] a_EGmin = array.new_line () max = 10 if array.size(a_phP) > max array.pop(a_phB) array.pop(a_phP) if array.size(a_plP) > max array.pop(a_plB) array.pop(a_plP) if array.size(a_EGmax ) > maxVisablePat if array.size(a_ln_bl ) > maxVisablePat * 4 line.delete (array.pop(a_ln_bl )) if array.size(a_lnF_bl) > maxVisablePat * 3 linefill.delete(array.pop(a_lnF_bl)) if array.size(a_EGmax ) > maxVisablePat * 1 line.delete (array.pop(a_EGmax )) line.delete (array.pop(a_EGmin )) a_diff = array.new_float() a_diffP = array.new_float() a_diffB = array.new_int () f_runtime_error(x1, x2, bars) => if x2 - x1 > bars runtime.error(str.tostring(x2 - x1)) f_Head_Shoulders_Bull(left, right, a_plB, a_plP) => // { ph = ta.pivothigh(left, right) pl = ta.pivotlow (left, right) line testline = na label testlabel = na line[] a_testline = array.new_line() // Ab = 0 , Bb = 0 , Cb = 0 , Db = 0 , Eb = 0 , Fb = 0 , Gb = 0 Ap = 0., Bp = 0., Cp = 0., Dp = 0., Ep = 0., Fp = 0., Gp = 0. highestP = 0. highestB = 0 if f_tradeDateIsAllowed() and pl // // { if array.size(a_plB) > 1 for i = 0 to array.size(a_plB) -1 // --------[ find basis ]------- // -------[ draw line from pl to previous pl's (array, i) ]------- Cb := array.get(a_plB, i) Cp := array.get(a_plP, i) Eb := bar_index - right Ep := pl // highMax = 0. index = 0 stop = 0 array.unshift(a_testline, line.new(Cb, Cp, Eb, Ep)) // // -------[ find head ]------- for j = right + 1 to (bar_index - Cb - 1) // all bars between Cb - Eb // -------[ fill array with possible head's ]------- highestP := high [j] highestB := bar_index - j array.unshift(a_diff , high[j] - line.get_price(array.get(a_testline, 0), bar_index - j)) array.unshift(a_diffP, highestP) array.unshift(a_diffB, highestB) // // -------[ check every low for breakthrough testline ]------- if stop == 0 and low[j] < line.get_price(array.get(a_testline, 0), bar_index - j) stop := 1 // // -------[ if no breakthrough ]------- if stop == 0 // -------[ head found ]------- highMax := array.max (a_diff ) index := array.indexof(a_diff, highMax) // // --------[ width basis ]------- basis_Cb_Eb = Eb - Cb basis_Cp_Ep = (Ep - Cp) / basis_Cb_Eb // // --------[ go to max 3/4 of basis to the left ]------- for k = 0 to math.round(basis_Cb_Eb * 0.75) line.set_xy1(array.get(a_testline, 0), Cb - k, Cp - (basis_Cp_Ep * k)) // // --------[ if at the end -> stop ]------- if k == math.round(basis_Cb_Eb * 0.75) stop := 1 // // --------[ if L shoulder is higher then desired Shoulder/Head ratio -> stop ]------- if high[bar_index - Cb + k] - line.get_price(array.get(a_testline, 0), Cb - k) > highMax * maxPercLSh stop := 1 break // // --------[ if close is found that goes under the base line -> break ]------- // --------[ break further at the end of the block ]------- if stop == 0 and close[bar_index - Cb + k] < line.get_price(array.get(a_testline, 0), Cb - k) Db := array.get(a_diffB, index) Dp := array.get(a_diffP, index) // // --------[ A ]------- Ab := Cb - k // --------[ get line price k further than x1 -> then substract from y1 => line price k back ]------- priceDifference = line.get_price(array.get(a_testline, 0), Cb + k) - Cp Ap := Cp - priceDifference // close[bar_index - x1 + k] // // --------[ clear array's -> is used further ]------- // array.clear(a_diff ) array.clear(a_diffP) array.clear(a_diffB) // break if Ep < Dp - ((Dp - Ap) * retraceEmax) or Ep > Dp - ((Dp - Ap) * retraceEmin) stop := 1 // if stop == 0 // for l = (bar_index - Cb + 1) to (bar_index - Ab - 1) // all bars between Ab - Cb // -------[ fill array with possible L shoulders ]------- highestP := high [l] highestB := bar_index - l array.unshift(a_diff , high[l] - line.get_price(array.get(a_testline, 0), bar_index - l)) array.unshift(a_diffP, highestP) array.unshift(a_diffB, highestB) // // -------[ L shoulder found ]------- highMax := array.max (a_diff ) index := array.indexof(a_diff , highMax) Bb := array.get (a_diffB, index ) Bp := array.get (a_diffP, index ) // if Bp - line.get_price(array.get(a_testline, 0), Bb) < (Dp - (line.get_price(array.get(a_testline, 0), Db))) * minPercLSh stop := 1 // if stop == 0 // -------[ find R shoulder ]------- distAC = math.round((Cb - Ab) * (1 + extLines)) Gb := Eb + distAC Ep_Gp = Ep - Cp Eb_Gb = Eb - Cb PdBar = Ep_Gp / Eb_Gb Gp := Ep + (PdBar * distAC) // // -------[ ABC ]------- lineAB = line.new(Ab, Ap, Bb, Bp, color=color.new(color.blue, 90)) lineBC = line.new(Cb, Cp, Bb, Bp, color=color.new(color.blue, 90)) // -------[ CDE ]------- lineCD = line.new(Cb, Cp, Db, Dp, color=color.new(color.blue, 90)) lineDE = line.new(Eb, Ep, Db, Dp, color=color.new(color.blue, 90)) // array.unshift(a_ln_bl , lineAB) array.unshift(a_ln_bl , lineBC) array.unshift(a_lnF_bl, linefill.new(lineAB, lineBC, color=c_nt)) array.unshift(a_ln_bl , lineCD) array.unshift(a_ln_bl , lineDE) array.unshift(a_lnF_bl, linefill.new(lineCD, lineDE, color=c_nt)) // // -------[ EG - EG+ ]------- plus = highMax * (1 + (percTol / 100)) lineEGmax = line.new(Eb, Ep + plus, Gb, Gp + plus, style=line.style_dotted, color=color.new(color.blue, 50)) lineEGmin = line.new(Eb, Ep , Gb, Gp , style=line.style_dotted, color=color.new(color.blue, 50)) // array.unshift(a_EGmax, lineEGmax) array.unshift(a_EGmin, lineEGmin) array.unshift(a_lnF_bl, linefill.new(lineEGmin, lineEGmax, color=c_nt)) // array.unshift(a_plB, bar_index - right) array.unshift(a_plP, pl ) // } // // -------[ delete testlines ]------- // for lines in a_testline line.delete(lines) // if array.size(a_EGmax) > 0 for m = 0 to array.size(a_EGmax) -1 if bar_index - line.get_x2(array.get(a_EGmax , m)) < 1000 if bar_index >= line.get_x1(array.get(a_EGmax , m)) and bar_index <= line.get_x2(array.get(a_EGmax , m)) and close > line.get_price(array.get(a_EGmax , m), bar_index) //label.new(bar_index, close) -------[ testlb ]------- linefill.set_color (array.get(a_lnF_bl, m * 3 ), c_bl ) linefill.set_color (array.get(a_lnF_bl, (m * 3) + 1 ), c_bl ) linefill.set_color (array.get(a_lnF_bl, (m * 3) + 2 ), c_bl ) line.set_color (array.get(a_EGmax , (m * 1) ), color.new(color.lime, 50)) line.set_color (array.get(a_EGmin , (m * 1) ), color.new(color.lime, 50)) // for n = 0 to array.size(a_EGmin) -1 if bar_index - line.get_x2(array.get(a_EGmin , n)) < 1000 if bar_index >= line.get_x1(array.get(a_EGmin , n)) and bar_index <= line.get_x2(array.get(a_EGmin , n)) and close < line.get_price(array.get(a_EGmin , n), bar_index) //label.new(bar_index, close) -------[ testlb ]------- linefill.set_color (array.get(a_lnF_bl, n * 3 ), c_br ) linefill.set_color (array.get(a_lnF_bl, (n * 3) + 1 ), c_br ) linefill.set_color (array.get(a_lnF_bl, (n * 3) + 2 ), c_br ) line.set_color (array.get(a_EGmax , (n * 1) ), color.new(color.red , 50)) line.set_color (array.get(a_EGmin , (n * 1) ), color.new(color.red , 50)) // } f_Head_Shoulders_Bull(left, right, a_plB, a_plP)
ZigZag Waves
https://www.tradingview.com/script/BvWy0Xwx-ZigZag-Waves/
LonesomeTheBlue
https://www.tradingview.com/u/LonesomeTheBlue/
1,092
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("ZigZag Waves", max_bars_back = 500, max_lines_count = 300) prd1 = input.int(defval = 11, title="Period 1", minval = 2, maxval = 55) prd2 = input.int(defval = 21, title="Period 2", minval = 2, maxval = 55) prd3 = input.int(defval = 34, title="Period 3", minval = 2, maxval = 55) emalength = input.int(defval = 3, title = "EMA length", minval = 1) resetonnewhl = input.bool(defval = false, title = "Reset wave on new Highest/Lowest") showplot = input.bool(defval = true, title = "Show EMA line", inline = "ema") emacolor = input.color(defval = color.blue, title = "", inline = "ema") lwidth = input.int(defval = 2, title = "", minval = 1, maxval = 4, inline = "ema") // get highest/lowestest for each period phs = array.from( ta.highestbars(high, prd1) == 0 ? high : na, ta.highestbars(high, prd2) == 0 ? high : na, ta.highestbars(high, prd3) == 0 ? high : na) pls = array.from( ta.lowestbars(low, prd1) == 0 ? low : na, ta.lowestbars(low, prd2) == 0 ? low : na, ta.lowestbars(low, prd3) == 0 ? low : na) // calculate zigzag direction var dirs = array.new_int(3, 0) olddirs = array.copy(dirs) for x = 0 to 2 array.set(dirs, x, (array.get(phs, x) and na(array.get(pls, x))) ? 1 : (array.get(pls, x) and na(array.get(phs, x))) ? -1 : array.get(dirs, x)) var max_array_size = 6 var zigzag1 = array.new_float(0) var zigzag2 = array.new_float(0) var zigzag3 = array.new_float(0) // add new point to zigzag add_to_zigzag(zigzag, value)=> array.unshift(zigzag, bar_index) array.unshift(zigzag, value) if array.size(zigzag) > max_array_size array.pop(zigzag) array.pop(zigzag) // there is a move on same direction, update the zigzag level update_zigzag(zigzag, dir, value)=> if array.size(zigzag) == 0 add_to_zigzag(zigzag, value) else if (dir == 1 and value > array.get(zigzag, 0)) or (dir == -1 and value < array.get(zigzag, 0)) array.set(zigzag, 0, value) array.set(zigzag, 1, bar_index) 0. // calculate zigzag CalculateZigzag(zigzag, dir, ph, pl, dirchanged)=> if ph or pl if dirchanged add_to_zigzag(zigzag, dir == 1 ? ph : pl) else update_zigzag(zigzag, dir, dir == 1 ? ph : pl) // Calculate zigzags with different periods CalculateZigzag(zigzag1, array.get(dirs, 0), array.get(phs, 0), array.get(pls, 0), array.get(dirs, 0) != array.get(olddirs, 0)) CalculateZigzag(zigzag2, array.get(dirs, 1), array.get(phs, 1), array.get(pls, 1), array.get(dirs, 1) != array.get(olddirs, 1)) CalculateZigzag(zigzag3, array.get(dirs, 2), array.get(phs, 2), array.get(pls, 2), array.get(dirs, 2) != array.get(olddirs, 2)) // keep total wave length var int [] totallength = array.from(0, 0, 0) var int [] totalchange = array.from(0, 0, 0) int [] cyclelen = array.from(0, 0, 0) var cycleAnddir = array.from(-1000, 1, -1000, 1, -1000, 1) for x = 0 to 2 float [] zigzag = x == 0 ? zigzag1 : x == 1 ? zigzag2 : zigzag3 if array.get(dirs, x) != array.get(olddirs, x) and array.size(zigzag) >= max_array_size array.set(totallength, x, array.get(totallength, x) + math.round(array.get(zigzag, 3) - array.get(zigzag, 5)) + 1) array.set(totalchange, x, array.get(totalchange, x) + 1) array.set(cyclelen, x, math.round(array.get(totallength, x) / (array.get(totalchange, x) * 2))) if (resetonnewhl or array.get(cycleAnddir, x * 2) == -1000) and array.get(totalchange, x) > 10 and array.get(dirs, x) != array.get(olddirs, x) array.set(cycleAnddir, x * 2, array.get(dirs, x) * math.round(bar_index - array.get(zigzag, 3))) array.set(cycleAnddir, x * 2 + 1, array.get(dirs, x)) else if array.get(cycleAnddir, x * 2) > -1000 array.set(cycleAnddir, x * 2, array.get(cycleAnddir, x * 2) + array.get(cycleAnddir, x * 2 + 1)) if array.get(cycleAnddir, x * 2) < -array.get(cyclelen, x) or array.get(cycleAnddir, x * 2) > array.get(cyclelen, x) array.set(cycleAnddir, x * 2 + 1, -1 * array.get(cycleAnddir, x * 2 + 1)) array.set(cycleAnddir, x * 2, array.get(cycleAnddir, x * 2) + 2 * array.get(cycleAnddir, x * 2 + 1)) if array.get(cycleAnddir, x * 2) > array.get(cyclelen, x) array.set(cycleAnddir, x * 2, array.get(cyclelen, x) - 1) else if array.get(cycleAnddir, x * 2) < -array.get(cyclelen, x) array.set(cycleAnddir, x * 2, -array.get(cyclelen, x) + 1) float wave1 = math.sign(array.get(cycleAnddir, 0)) * math.sqrt(math.pow( array.get(cyclelen, 0), 2) - math.pow( array.get(cyclelen, 0) - math.abs(array.get(cycleAnddir, 0)), 2)) float wave2 = math.sign(array.get(cycleAnddir, 2)) * math.sqrt(math.pow( array.get(cyclelen, 1), 2) - math.pow( array.get(cyclelen, 1) - math.abs(array.get(cycleAnddir, 2)), 2)) float wave3 = math.sign(array.get(cycleAnddir, 4)) * math.sqrt(math.pow( array.get(cyclelen, 2), 2) - math.pow( array.get(cyclelen, 2) - math.abs(array.get(cycleAnddir, 4)), 2)) wavecolor(wave, cons_)=> cons = math.max(0, math.min(255, cons_)) wave > 0 ? (wave >= wave[1] ? color.rgb(0, cons, 0, 0) : color.rgb(0, cons - 20, 0, 0)) : (wave <= wave[1] ? color.rgb(cons, 0, 0, 0) : color.rgb(cons - 20, 0, 0, 0)) plot(wave3, color = wavecolor(wave3, 190 + math.pow(wave3, 2) / 3), style = plot.style_area) plot(wave2, color = wavecolor(wave2, 170 + math.pow(wave2, 2) / 3), style = plot.style_area) plot(wave1, color = wavecolor(wave1, 150 + math.pow(wave1, 2) / 3), style = plot.style_area) waveema = ta.ema(wave1 + wave2 + wave3, emalength) plot(showplot ? waveema : na, color = emacolor, linewidth = lwidth)
Critical Levels Mixing Price Action, Volatility and Volume
https://www.tradingview.com/script/x2jnApOt-Critical-Levels-Mixing-Price-Action-Volatility-and-Volume/
pascorp
https://www.tradingview.com/u/pascorp/
204
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/ // © pascorp //@version=5 indicator('Critical Levels Mixing Price Action, Volatility and Volume', shorttitle='CLM', overlay=true) // ———————————————————————————————————————————————————————————— // >>>>>>>>>>>>>>>>>>>>>>> Inputs <<<<<<<<<<<<<<<<<<<<<<<<<<< // ———————————————————————————————————————————————————————————— cutLen = input(true, title='Analize all', group='Time & Alerts', inline='time') lenBckTst = input.int(2880,title='/minutes', minval=1, group='Time & Alerts', group='Time & Alerts', inline='time') alNew = input(true, title='Alert for new', group='Time & Alerts', inline='time') coreMax = input.float(defval=50, title='max Core size %', inline='1', group='Price Action') coreMin = input.float(defval=25, title='min Core size %', inline='1', group='Price Action') maxLenMinorTail = input.float(defval=12, title='Maximum length for shorter tail %', group='Price Action') lenVol = input(defval=120, title='Period MA Volume', inline='2', group='Volume') multVol = input.float(defval=1, title='Multiplier MA Volume', inline='2', group='Volume') atrLen = input.int(defval=21, title='ATR Period', group='Volatility', inline='1') atrPerc = input.int(defval=100, title='ATR Percentage %', group='Volatility', inline='1') // ———————————————————————————————————————————————————————————— // >>>>>>>>>>>>>>>>>>>>>>>> Core <<<<<<<<<<<<<<<<<<<<<<<<<<<< // ———————————————————————————————————————————————————————————— startBckTst = time > timenow - lenBckTst * 60000 shw = false if startBckTst or cutLen core = math.abs(close-open) total = high-low upperTail = close>open? high-close : high-open lowerTail = close>open? open-low : close-low maVol = ta.ema(volume, lenVol)*multVol // ------ Conditions ------- condPA = core<((total/100)*coreMax) and core>((total/100)*coreMin) and(lowerTail<((total/100)*maxLenMinorTail) or upperTail<((total/100)*maxLenMinorTail)) condVolatility = ta.tr(true)>((ta.atr(atrLen)/100)*atrPerc) condVolume = volume>maVol // ------ Box & Alert ------ if condPA and condVolatility and condVolume shw := true if alNew alert('New Levels', alert.freq_once_per_bar) if close>open if upperTail > lowerTail box.new(time, close, time + 1, high, xloc = xloc.bar_time, extend = extend.right,border_color=color(na), bgcolor =color.new(color.red,80)) else box.new(time, open, time + 1, low, xloc = xloc.bar_time, extend = extend.right,border_color=color(na), bgcolor =color.new(color.red,80)) else if upperTail > lowerTail box.new(time, open, time + 1, high, xloc = xloc.bar_time, extend = extend.right,border_color=color(na), bgcolor =color.new(color.red,80)) else box.new(time, close, time + 1, low, xloc = xloc.bar_time, extend = extend.right,border_color=color(na), bgcolor =color.new(color.red,80)) plotshape(shw, location=location.bottom)
LankouMultiSpreadsV2 All
https://www.tradingview.com/script/u7RPWXt3-LankouMultiSpreadsV2-All/
lankou
https://www.tradingview.com/u/lankou/
441
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('LankouMultiSpreadsV2', overlay=false) // https://kodify.net/tradingview/indicator-settings/indicator-name/ limit = input(8, "limit (color)") ema_period = input(13, "ema") //input.string("On", "Plot Display", options = ["On", "Off"]) spreadName = input.string(defval = "DEFI", title = "choose spread", options = ["DEFI", "META", "STORAGE", "SHIT", "EXCHANGE(ftx)"]) //, group = "Paramètres d'Entrée en Trade") f_print_source(source, _text) => // Create label on the first bar. var _label = label.new(bar_index, na, _text, xloc.bar_index, yloc.price, color(na), label.style_none, color.white, size.large, text.align_left) // On next bars, update the label's x and y position, and the text it displays. label.set_xy(_label, bar_index, ta.highest(source, 10)[1]) label.set_text(_label, _text) f_print(_text) => // Create label on the first bar. var _label = label.new(bar_index, na, _text, xloc.bar_index, yloc.price, color(na), label.style_none, color.white, size.large, text.align_left) // On next bars, update the label's x and y position, and the text it displays. label.set_xy(_label, bar_index, ta.highest(10)[1]) label.set_text(_label, _text) get_shib() => sym2 = request.security("(1000*BINANCE:SHIBUSDT-BINANCE:1000SHIBUSDTPERP)/1000*BINANCE:SHIBUSDT", timeframe.period, close) sym2 // get symbol and PERP version of it FTX version gen_sym2_ftx(symbol) => local_sym = 'FTX:' + symbol + 'USD' the_string_perp = 'FTX:' + symbol + 'PERP' sec = request.security('(' + local_sym + '-' + the_string_perp + ')/' + local_sym, timeframe.period, close) // get symbol and PERP version of it gen_sym2(symbol) => local_sym = 'BINANCE:' + symbol + 'USDT' the_string_perp = local_sym + 'PERP' sec = request.security('(' + local_sym + '-' + the_string_perp + ')/' + local_sym, timeframe.period, close) // TODO essayer dans la diviosn // sec = security(local_sym + "-" + the_string_perp, timeframe.period, close) // sym2 = c-BINANCE:MATICUSDTPERP", timeframe.period, close) ALT_LINE = close if (spreadName == "EXCHANGE(ftx)") sym1 = gen_sym2_ftx("BNB") sym2 = gen_sym2_ftx("CRO") sym3 = gen_sym2_ftx("OKB") sym4 = gen_sym2_ftx("FTT") sym5 = gen_sym2_ftx("LEO") //sym6 = gen_sym2_ftx("KCS") sym7 = gen_sym2_ftx("HT") // ALT_LINE = -(sym1 + sym2 + sym3 + sym4 + sym5 + sym6 + sym7) / 7 ALT_LINE := -(sym1 + sym2 + sym3 + sym4 + sym5 + sym7) / 6 if (spreadName == "STORAGE") sym1 = gen_sym2('STORJ') sym2 = gen_sym2('AR') sym3 = gen_sym2('SC') sym4 = gen_sym2('FIL') //sym5 = gen_sym2('BTT') sym6 = gen_sym2('HOT') ALT_LINE := -(sym1 + sym2 + sym3 + sym4 + sym6) / 5 if (spreadName == "DEFI") sym1 = gen_sym2("AAVE") sym2 = gen_sym2("YFI") sym3 = gen_sym2("UNI") sym4 = gen_sym2("SUSHI") sym5 = gen_sym2("COMP") sym6 = gen_sym2("SNX") sym7 = gen_sym2("MKR") sym8 = gen_sym2("CRV") sym9 = gen_sym2("RUNE") ALT_LINE := -( sym1 + sym2 + sym3 + sym4 + sym5 + sym6 + sym7 + sym8 + sym9) / 9 if (spreadName == "META") sym1 = gen_sym2("AXS") sym2 = gen_sym2("SAND") sym3 = gen_sym2("MANA") sym4 = gen_sym2("ENJ") ALT_LINE := -(sym1 + sym2 + sym3 + sym4) / 4 if (spreadName == "SHIT") sym2 = get_shib() sym1 = gen_sym2("DOGE") ALT_LINE := -(sym1 + sym2) / 2 ema = ta.ema(ALT_LINE, ema_period) * 10000 col = color.rgb(255, 255, 255) if (ema > 0) col := color.from_gradient(ema, 0, limit, color.white, color.green) else col := color.from_gradient(ema, -limit, 0, color.red, color.white) f_print_source(ema, spreadName) plot(ema, color=col, linewidth=2, style=plot.style_area) hline(limit, title="10", color=color.rgb(100, 100, 100, 50), linestyle=hline.style_dashed) hline(-limit, title="10", color=color.rgb(100, 100, 100, 50), linestyle=hline.style_dashed)
ROC Percentile
https://www.tradingview.com/script/sedd4PTB-ROC-Percentile/
HayeTrading
https://www.tradingview.com/u/HayeTrading/
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/ // © HayeTrading //@version=5 indicator("ROC Percentile") roclen = input.int(10, "ROC Length") roc = ta.roc(close, roclen) length = input(500, "Lookback Period") col = roc >= 0 ? color.green : color.red // Create arrays for positive and negative values pos = array.new_float(0) neg = array.new_float(0) // Count of pos and neg, to calculate percentage values poscount = 0 negcount = 0 // Loop through length, adding pos/neg roc values to arrays for i=0 to length - 1 if roc[i] > 0 array.push(pos, roc[i]) poscount += 1 else if roc[i] < 0 array.push(neg, roc[i]) negcount += 1 // Sort arrays by ROC value array.sort(pos, order.ascending) array.sort(neg, order.descending) // Find current ROC value ranking position within the neg/pos arrays. posindex = array.indexof(pos, roc) negindex = array.indexof(neg, roc) // Turn the ranking position into percentile value pospercent = ((posindex + 1) / poscount) * 100 negpercent = ((negindex + 1) / negcount) * 100 plot(pospercent, style=plot.style_columns, color=col) plot(-negpercent, style=plot.style_columns, color=col) plot(50, style=plot.style_circles, color=color.green) plot(-50, style=plot.style_circles, color=color.red)
probability_of_touch
https://www.tradingview.com/script/IgAKPrYh-probability-of-touch/
voided
https://www.tradingview.com/u/voided/
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/ // © voided //@version=5 indicator("probability_of_touch", overlay = true) // background coloring start = input.time(timestamp("1 Jan 1950"), "start") end = input.time(timestamp("1 Jan 2300"), "end") in_clr = color.new(color.gray, 95) out_clr = color.new(color.white, 100) in_range = time >= start and time < end bgcolor(in_range ? in_clr : out_clr) // main level = input.float(0, "level") type = input.string("price", "type", options = [ "price", "percentage", "stdev" ]) mark = input.string("close", "mark", options = [ "open", "high", "low", "close" ]) length = input.int(1, "length") window = input.int(20, "window") debug = input.bool(false, "debug") hv20 = math.sqrt(ta.ema(math.pow(math.log(close / close[1]), 2), window) * 252) var up = array.new_float() var dn = array.new_float() mark_ = mark == "open" ? open : mark == "high" ? high : mark == "low" ? low : mark == "close" ? close : na pos = level >= 0 touched = 0 y = mark_[length] for i = 0 to length - 1 by 1 y_ = type == "price" ? y + level : type == "percentage" ? y * (1 + level / 100) : y * (1 + level * hv20[length] * math.sqrt((length - i) / 252)) if pos and high[i] >= y_ touched := 1 if in_range and debug label.new(bar_index, na, "x", yloc = yloc.abovebar, style = label.style_none, textcolor = color.fuchsia) break else if not pos and low[i] <= y_ touched := 1 if in_range and debug label.new(bar_index, na, "x", yloc = yloc.abovebar, style = label.style_none, textcolor = color.fuchsia) break if in_range array.push(level >= 0 ? up : dn, touched) // display if barstate.islast lbl_clr = pos ? color.new(color.green, 70) : color.new(color.red, 70) data_clr = color.new(color.gray, 95) fmt = "#.##" y_ = type == "price" ? mark_ + level : type == "percentage" ? mark_ * (1 + level / 100) : mark_ * (1 + level * hv20 * math.sqrt(length / 252)) one_day = 24 * 60 * 60 * 1000 line.new(time, y_, time + one_day * length, y_, color = color.fuchsia, xloc = xloc.bar_time) pct = pos ? array.avg(up) : array.avg(dn) count = pos ? array.sum(up) : array.sum(dn) total = pos ? array.size(up) : array.size(dn) t = table.new(position.top_right, 3, 3, bgcolor = data_clr) table.cell(t, 0, 0, "level type", bgcolor = lbl_clr) table.cell(t, 1, 0, type) table.cell(t, 0, 1, "current level (price)", bgcolor = lbl_clr) table.cell(t, 1, 1, str.tostring(y_, fmt)) table.cell(t, 0, 2, "probability of touch", bgcolor = lbl_clr) table.cell(t, 1, 2, str.tostring(pct, fmt) + " (" + str.tostring(count) + "/" + str.tostring(total) + ")")
EMA MTF Plus
https://www.tradingview.com/script/2eELWFK4-EMA-MTF-Plus/
Troptrap
https://www.tradingview.com/u/Troptrap/
133
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 // Part of this code is copied from Lazy Bear-Range Identifier indicator, Schaff Trend Cycle from everget and OverAtr Bar highlight by // Jim8080. // I made this indicator for my use initially, but it could be useful to others as well. This being said, I want to thank the original authors // for their work and if there are any issues with this, please let me know. //@version=5 indicator("EMA MTF Plus",overlay=true) Length=input(12,group="Wicks") src = input.source(close,group="Wicks") volf = input.bool(title="Volume filter",defval=true,group="Wicks") lenvolma = input.int(title="Volume MA",defval=20,group="Wicks") atrlen = input.int(title="ATR length" , defval=14,group="Strong bars") atrmult = input.float(title="Body ratio",defval=0.8,group="Strong bars") macdopt = input.bool(title="Macd filter for triangles",defval=true,group="MACD") fastLength = input(title='MACD Fast Length', defval=23,group="MACD") slowLength = input(title='MACD Slow Length', defval=50,group="MACD") cycleLength = input(title='Cycle Length', defval=10,group="MACD") d1Length = input(title='1st %D Length', defval=3,group="MACD") d2Length = input(title='2nd %D Length', defval=3,group="MACD") macd = ta.ema(src, fastLength) - ta.ema(src, slowLength) k = nz(fixnan(ta.stoch(macd, macd, macd, cycleLength))) d = ta.ema(k, d1Length) kd = nz(fixnan(ta.stoch(d, d, d, cycleLength))) stc = ta.ema(kd, d2Length) stc := math.max(math.min(stc, 100), 0) bullmacd = stc[0]>99.6?true:false bearmacd = stc[0]<0.4?true:false bullm = macdopt?bullmacd:true bearm = macdopt?bearmacd:true atrvover= atrmult*ta.atr(atrlen)+open atrvunder= open-ta.atr(atrlen)*atrmult isover() => close > atrvover isunder() => close < atrvunder barcolor(isover() ? color.yellow: isunder() ? color.fuchsia : na) volma = ta.ema(volume,lenvolma) 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.ema(wicks,Length) hh = high==ta.highest(Length) and ta.highest(high-src,Length) and wickup>wicksma and volfilter and bullm ll = low==ta.lowest(Length) and ta.highest(src-low,Length) and wickdown>wicksma and volfilter and bearm plotshape(hh, style=shape.triangledown, size=size.small,color=color.red) plotshape(ll,style=shape.triangleup, size=size.small , color=color.green, location=location.belowbar) connectRanges=input(false, title="Connect Ranges",group="Ranges") showMidLine=input(true, title="Show MidLine",group="Ranges") hc=input(true, title="Highlight Consolidation",group="Ranges") showEMA=input(true, title="Signal EMA",group="EMAs") lengthEMA=input(20, title="EMA Length",group="EMAs") showEMAm=input(true, title="Mid EMA",group="EMAs") lengthEMAm=input(120, title="EMA Length",group="EMAs") showEMAb=input(true, title="Base EMA",group="EMAs") lengthEMAb=input(200, title="EMA Length",group="EMAs") e=ta.ema(close,lengthEMA) em=ta.ema(close,lengthEMAm) eb=ta.ema(close,lengthEMAb) var up = close var down = close down := close<nz(up[1]) and close>down[1] ? nz(down[1]) : low up := close<nz(up[1]) and close>down[1] ? nz(up[1]) : high mid = math.avg(up,down) ul=plot(connectRanges?up:up==nz(up[1])?up:na, color=color.gray, linewidth=2, style=plot.style_linebr, title="Up") llz=plot(connectRanges?down:down==nz(down[1])?down:na, color=color.gray, linewidth=2, style=plot.style_linebr, title="Down") dummy=plot(hc?close>e?down:up:na, color=color.gray, style=plot.style_circles, linewidth=0, title="Dummy") fill(ul,dummy, color=#acfa8745) fill(dummy,llz, color=#faac8745) plot(showMidLine?mid:na, color=color.gray, linewidth=1, title="Mid") plot(showEMA?e:na, title="EMA", color=color.black, linewidth=2) ebcol = ta.rising(eb,1)?color.green:color.red emcol = ta.rising(em,1)?color.blue:color.orange plot(showEMAm?em:na, title="EMA", color=emcol, linewidth=3) plot(showEMAb?eb:na, title="EMA", color=ebcol, linewidth=4) fast = input(20,inline="period",group="HTF EMA tracker") slow = input(200,inline="period",group="HTF EMA tracker") tf1sw = input.bool(title="5min fast",defval=true,inline="tf1",group="HTF EMA tracker") tf2sw = input.bool(title="15min fast",defval=true,inline="tf2",group="HTF EMA tracker") tf3sw = input.bool(title="1hr fast",defval=true,inline="tf3",group="HTF EMA tracker") tf4sw = input.bool(title="4hr fast",defval=true,inline="tf4",group="HTF EMA tracker") tf5sw = input.bool(title="D fast",defval=true,inline="tf5",group="HTF EMA tracker") tf6sw = input.bool(title="W fast",defval=true,inline="tf6",group="HTF EMA tracker") tf1sws = input.bool(title="5min slow",defval=true,inline="tf1",group="HTF EMA tracker") tf2sws = input.bool(title="15min slow",defval=true,inline="tf2",group="HTF EMA tracker") tf3sws = input.bool(title="1hr slow",defval=true,inline="tf3",group="HTF EMA tracker") tf4sws = input.bool(title="4hr slow",defval=true,inline="tf4",group="HTF EMA tracker") tf5sws = input.bool(title="D slow",defval=true,inline="tf5",group="HTF EMA tracker") tf6sws = input.bool(title="W slow",defval=true,inline="tf6",group="HTF EMA tracker") tf1src = input.source(title="",defval=close,inline="tf1",group="HTF EMA tracker") tf2src = input.source(title="",defval=close,inline="tf2",group="HTF EMA tracker") tf3src = input.source(title="",defval=close,inline="tf3",group="HTF EMA tracker") tf4src = input.source(title="",defval=close,inline="tf4",group="HTF EMA tracker") tf5src = input.source(title="",defval=close,inline="tf5",group="HTF EMA tracker") tf6src = input.source(title="",defval=close,inline="tf6",group="HTF EMA tracker") e1f= request.security(syminfo.tickerid,"5",ta.ema(tf1src,fast)) e1s= request.security(syminfo.tickerid,"5",ta.ema(tf1src,slow)) e2f= request.security(syminfo.tickerid,"15",ta.ema(tf2src,fast)) e2s= request.security(syminfo.tickerid,"15",ta.ema(tf2src,slow)) e3f= request.security(syminfo.tickerid,"60",ta.ema(tf3src,fast)) e3s= request.security(syminfo.tickerid,"60",ta.ema(tf3src,slow)) e4f= request.security(syminfo.tickerid,"240",ta.ema(tf4src,fast)) e4s= request.security(syminfo.tickerid,"240",ta.ema(tf4src,slow)) e5f= request.security(syminfo.tickerid,"D",ta.ema(tf5src,fast)) e5s= request.security(syminfo.tickerid,"D",ta.ema(tf5src,slow)) e6f= request.security(syminfo.tickerid,"W",ta.ema(tf6src,fast)) e6s= request.security(syminfo.tickerid,"W",ta.ema(tf6src,slow)) supcol = input.color(title="Support",defval=color.green,inline="col",group="HTF EMA tracker") rescol = input.color(title="Resistance",defval=color.red,inline="col",group="HTF EMA tracker") e1fcol = close>e1f?supcol:rescol e1scol = close>e1s?supcol:rescol e2fcol = close>e2f?supcol:rescol e2scol = close>e2s?supcol:rescol e3fcol = close>e3f?supcol:rescol e3scol = close>e3s?supcol:rescol e4fcol = close>e4f?supcol:rescol e4scol = close>e4s?supcol:rescol e5fcol = close>e5f?supcol:rescol e5scol = close>e5s?supcol:rescol e6fcol = close>e6f?supcol:rescol e6scol = close>e6s?supcol:rescol plot(tf1sw?e1f:na,color=e1fcol,show_last=1,trackprice=true,linewidth=2,title="5m F") plot(tf1sws?e1s:na,color=e1scol,show_last=1,trackprice=true,linewidth=3,title="5m S") plot(tf2sw?e2f:na,color=e2fcol,show_last=1,trackprice=true,linewidth=2,title="15m F") plot(tf2sws?e2s:na,color=e2scol,show_last=1,trackprice=true,linewidth=3,title="15m S") plot(tf3sw?e3f:na,color=e3fcol,show_last=1,trackprice=true,linewidth=2,title="1h F") plot(tf3sws?e3s:na,color=e3scol,show_last=1,trackprice=true,linewidth=3,title="1h S") plot(tf4sw?e4f:na,color=e4fcol,show_last=1,trackprice=true,linewidth=2,title="4h F") plot(tf4sws?e4s:na,color=e4scol,show_last=1,trackprice=true,linewidth=3,title="4h S") plot(tf5sw?e5f:na,color=e5fcol,show_last=1,trackprice=true,linewidth=2,title="Daily F") plot(tf5sws?e5s:na,color=e5scol,show_last=1,trackprice=true,linewidth=3,title="Daily S") plot(tf6sw?e6f:na,color=e6fcol,show_last=1,trackprice=true,linewidth=2,title="Weekly F") plot(tf6sws?e6s:na,color=e6scol,show_last=1,trackprice=true,linewidth=3,title="Weekly S") Offset = input(3,group="HTF EMA tracker") plotshape(tf1sw?e1f:na,style=shape.cross,color=e1fcol,show_last=1,text="5m F",location=location.absolute, offset=Offset) plotshape(tf1sws?e1s:na,style=shape.cross,color=e1scol,show_last=1,text="5m S",location=location.absolute, offset=Offset) plotshape(tf2sw?e2f:na,style=shape.cross,color=e2fcol,show_last=1,text="15m F",location=location.absolute, offset=Offset) plotshape(tf2sws?e2s:na,style=shape.cross,color=e2scol,show_last=1,text="15m S",location=location.absolute, offset=Offset) plotshape(tf3sw?e3f:na,style=shape.cross,color=e3fcol,show_last=1,text="1h F",location=location.absolute, offset=Offset) plotshape(tf3sws?e3s:na,style=shape.cross,color=e3scol,show_last=1,text="1h S",location=location.absolute, offset=Offset) plotshape(tf4sw?e4f:na,style=shape.cross,color=e4fcol,show_last=1,text="4h F",location=location.absolute, offset=Offset) plotshape(tf4sws?e4s:na,style=shape.cross,color=e4scol,show_last=1,text="4h S",location=location.absolute, offset=Offset) plotshape(tf5sw?e5f:na,style=shape.cross,color=e5fcol,show_last=1,text="D F",location=location.absolute, offset=Offset) plotshape(tf5sws?e5s:na,style=shape.cross,color=e5scol,show_last=1,text="D S",location=location.absolute, offset=Offset) plotshape(tf6sw?e6f:na,style=shape.cross,color=e6fcol,show_last=1,text="W F",location=location.absolute, offset=Offset) plotshape(tf6sws?e6s:na,style=shape.cross,color=e6scol,show_last=1,text="W S",location=location.absolute, offset=Offset)
Riles' Rotation
https://www.tradingview.com/script/IOi6VwdO-Riles-Rotation/
Boppsy
https://www.tradingview.com/u/Boppsy/
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/ // © Boppsy //@version=5 indicator(title="Riles' Rotation", shorttitle="BTC 1H", overlay=true, timeframe="", timeframe_gaps=true) length = input.int(250, minval=1) mult_upper1 = input(2.5, "Upper Multiplier 1") mult_upper2 = input(4, "Upper Multiplier 2") mult_upper3 = input(6, "Upper Multiplier 3") mult_upper4 = input(8.5, "Upper Multiplier 4") mult_upper5 = input(10, "Upper Multiplier 5") mult_upper6 = input(16, "Upper Multiplier 6") mult_lower1 = input(2.5, "Lower Multiplie 1") mult_lower2 = input(4, "Lower Multiplier 2") mult_lower3 = input(6, "Lower Multiplier 3") mult_lower4 = input(8.5, "Lower Multiplier 4") mult_lower5 = input(10, "lower Multiplier 5") mult_lower6 = input(23, "Lower Multiplier 6") src = input(close, title="Source") exp = input(true, "Use Exponential MA") BandsStyle = input.string("Range", options = ["Average True Range", "True Range", "Range"], title="Bands Style") atrlength = input(10, "ATR Length") esma(source, length)=> s = ta.sma(source, length) e = ta.ema(source, length) exp ? e : s ma = esma(src, length) rangema = BandsStyle == "True Range" ? ta.tr(true) : BandsStyle == "Average True Range" ? ta.atr(atrlength) : ta.rma(high - low, length) upper1 = ma + rangema * mult_upper1 upper2 = ma + rangema * mult_upper2 upper3 = ma + rangema * mult_upper3 upper4 = ma + rangema * mult_upper4 upper5 = ma + rangema * mult_upper5 upper6 = ma + rangema * mult_upper6 lower1 = ma - rangema * mult_lower1 lower2 = ma - rangema * mult_lower2 lower3 = ma - rangema * mult_lower3 lower4 = ma - rangema * mult_lower4 lower5 = ma - rangema * mult_lower5 lower6 = ma - rangema * mult_lower6 u1 = plot(upper1, color=#000000, title="Upper1") u2 = plot(upper2, color=#000000, title="Upper2") u3 = plot(upper3, color=#000000, title="Upper3") u4 = plot(upper4, color=#000000, title="Upper4") u5 = plot(upper5, color=#000000, title="Upper5") u6 = plot(upper6, color=#000000, title="Upper6") plot(ma, color=#7B1818, title="Basis") l1 = plot(lower1, color=#000000, title="Lower1") l2 = plot(lower2, color=#000000, title="Lower2") l3 = plot(lower3, color=#000000, title="Lower3") l4 = plot(lower4, color=#000000, title="Lower4") l5 = plot(lower5, color=#000000, title="Lower5") l6 = plot(lower6, color=#000000, title="Lower6") fill(u1, l1, color=color.rgb(123, 24, 24, 95), title="Background") fill(u4, u5, color=color.rgb (0, 0, 100, 95), title="Upper background") fill(l4, l5, color=color.rgb (0, 0, 100, 95), title= "lower background")
Pretax EPS 10X
https://www.tradingview.com/script/V2aBXDKV-Pretax-EPS-10X/
xloexs
https://www.tradingview.com/u/xloexs/
12
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © xloexs //@version=5 indicator("Pretax EPS 10X") pi = request.financial(syminfo.tickerid,"PRETAX_INCOME","FY") //plot(pi) so = request.financial(syminfo.tickerid,"TOTAL_SHARES_OUTSTANDING","FY") //plot(so) pteps = (pi/so) //plot(pteps) pteps10 = (pteps*10) plot(pteps10)
Custom Session highlighter
https://www.tradingview.com/script/j2HvNj5X-Custom-Session-highlighter/
eSaniello
https://www.tradingview.com/u/eSaniello/
35
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/ // © eSaniello //@version=5 indicator("Custom Session highlighter", overlay=true) // highlight trading session background session_title = input.bool(title = "===========Trading session settings===========", defval = true) // calc time range to trade in sessionHours = input.session(defval="1000-1301:1234567", title="Session") inTradingSession = not na(time(timeframe.period, sessionHours)) bgcolor(color=inTradingSession ? color.new(color.white, 90) : na, title="Trading Hours")
Position Size By Risk For Bar Size
https://www.tradingview.com/script/0QOOS63q-Position-Size-By-Risk-For-Bar-Size/
trader-ap2
https://www.tradingview.com/u/trader-ap2/
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/ // © trader-ap2 //@version=5 indicator("Position Size By Risk For Bar Size", max_labels_count = 500) // Constant YES = "Yes" YES_COMPACT = "Yes Compact" NO = "No" TOOLTIP1 = "First input box - Enter normal risk amount per trade.\n\nSecond input box - Configure output:\n\tYes - Shows position size and risk amount\n\tYes Compact - Shows only position size\n\tNo - Does not show position size or risk amount" TOOLTIP2 = "First input box - Enter an alternative risk amount per trade. For example 2x normal risk amount or 1/2 normal risk amount.\n\nSecond input box - Configure output:\n\tYes - Shows position size and risk amount\n\tYes Compact - Shows only position size\n\tNo - Does not show position size or risk amount" TOOLTIP3 = "Show the High and Low of the bar in the output?" TOOLTIP4 = "Show volume for each bar?" // User input riskAmountInput1 = input.int(defval=100, title="   Risk Amount Normal", minval = 1, tooltip = TOOLTIP1, inline = "RA1", group = "Risk Amount Normal") showPositionSizeInput1 = input.string(defval=YES_COMPACT, title="", options = [YES, YES_COMPACT, NO], tooltip = TOOLTIP1, inline = "RA1", group = "Risk Amount Normal") riskAmountInput2 = input.int(defval=200, title="   Risk Amount Alternative", minval = 1, tooltip = TOOLTIP2, inline = "RA2", group = "Risk Amount Alternative") showPositionSizeInput2 = input.string(defval=YES_COMPACT, title="", options = [YES, YES_COMPACT, NO], tooltip = TOOLTIP2, inline = "RA2", group = "Risk Amount Alternative") showHighLowInput = input.string(defval=YES, title="   Show High/Low", options = [YES, NO], tooltip = TOOLTIP3, group = "Show High/Low") == YES showVolumeInput = input.string(defval=NO, title="   Show Volume", options = [YES, NO], tooltip = TOOLTIP4, group = "Volume") == YES stopSize = high-low showPositionSize1 = showPositionSizeInput1 == YES or showPositionSizeInput1 == YES_COMPACT positionSizeStr1 = showPositionSize1 ? "Position Size 1: " + str.tostring(math.floor(riskAmountInput1 / stopSize)) : "" riskAmountStr1 = showPositionSizeInput1 == YES ? "\nRisk Amount 1: " + str.tostring(riskAmountInput1) : "" carriageReturnStr1 = showPositionSize1 ? "\n\n" : "" showPositionSize2 = showPositionSizeInput2 == YES or showPositionSizeInput2 == YES_COMPACT positionSizeStr2 = showPositionSize2 ? "Position Size 2: " + str.tostring(math.floor(riskAmountInput2 / stopSize)) : "" riskAmountStr2 = showPositionSizeInput2 == YES ? "\nRisk Amount 2: " + str.tostring(riskAmountInput2) : "" carriageReturnStr2 = showPositionSize2 ? "\n\n" : "" stopSizeStr = "Stop Size: " + str.tostring(stopSize, format.mintick) highLowStr = showHighLowInput ? "\n\nHigh: " + str.tostring(high, format.mintick) + "\nLow: " + str.tostring(low, format.mintick) : "" label.new(bar_index, 0, ".", style=label.style_none, size=size.huge, tooltip= positionSizeStr1 + riskAmountStr1 + carriageReturnStr1 + positionSizeStr2 + riskAmountStr2 + carriageReturnStr2 + stopSizeStr + highLowStr ) plot(showVolumeInput ? volume : na, color = close >= open ? color.rgb(38, 166, 154, 50) : color.rgb(239, 83, 80, 50), style=plot.style_columns)
MILK (My Intraday Lazy Kit)
https://www.tradingview.com/script/G4PfUkKS-MILK-My-Intraday-Lazy-Kit/
noop-noop
https://www.tradingview.com/u/noop-noop/
722
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("My Intraday Lazy Kit", shorttitle="MILK", overlay=true) // Options hide_daily_levels = input.bool(true, "Hide daily levels above daily timeframe", group="Options") show_clock = input.bool(true, "Show clock", group="Options") // Levels show_labels = input.bool(true, "Show labels", group="Options") show_wk = input.bool(true, "Show weekly levels", group="Price Levels") show_dl = input.bool(true, "Show daily levels", group="Price Levels") daily_width = input.int(1, "Daily price level width", group="Price Levels") weekly_width = input.int(3, "Weekly price level width", group="Price Levels") open_col = input.color(color.aqua, "Previous open color", group="Price Levels") close_col = input.color(color.blue, "Previous close color", group="Price Levels") high_col = input.color(color.green, "Previous high color", group="Price Levels") low_col = input.color(color.red, "Previous low color", group="Price Levels") // Clock settings inSession(sess) => na(time(timeframe.period, sess)) == false in_session_color = input.color(#2da3f7, "Session Open", group="Clock") out_of_session_color = input.color(#000540, "Session Open", group="Clock") morning_color = input.color(#0046ad, "Morning color", group="Clock") noon_color = input.color(#ad8d00, "Afternoon color", group="Clock") evening_color = input.color(#9c4f03, "Evening color", group="Clock") night_color = input.color(#00255c, "Night color", group="Clock") city1_name = input.string("NY", title="City", group="City #1", group="Clock") city1_delay = input.int(0, "Time delay", group="City #1", group="Clock") city1_session = input.session("0800-1700", title="Session", group="City #1", group="Clock") city2_name = input.string("London", title="City", group="City #2", group="Clock") city2_delay = input.int(5, "Time delay", group="City #2", group="Clock") city2_session = input.session("0300-1200", title="Session", group="City #2", group="Clock") city3_name = input.string("Paris/Frankfurt", title="City", group="City #3", group="Clock") city3_delay = input.int(6, "Time delay", group="City #3", group="Clock") city3_session = input.session("0200-1100", title="Session", group="City #3", group="Clock") city4_name = input.string("Tokyo", title="City", group="City #4", group="Clock") city4_delay = input.int(14, "Time delay", group="City #4", group="Clock") city4_session = input.session("1900-0400", title="Session", group="City #4", group="Clock") city5_name = input.string("Sydney", title="City", group="City #5", group="Clock") city5_delay = input.int(16, "Time delay", group="City #5", group="Clock") city5_session = input.session("1700-0200", title="Session", group="City #5", group="Clock") // Functions get_time_color(h) => h >= 0 and h < 6 ? night_color : h >= 6 and h < 12 ? morning_color : h >= 12 and h < 18 ? noon_color : evening_color get_time_str(delay_h=0) => h = (hour(timenow) + delay_h) % 24 m = minute(timenow) [get_time_color(h), str.tostring(h, "00:")+str.tostring(m, "00")] color_value(value, transp=0) => step = (255/100.0) d = value * step x = 0.0 y = 0.0 z = 0.0 x := value < 50 ? d : 127 y := value < 50 ? 127: 255 - d color.rgb(math.round(x), math.round(y), math.round(z), transp) ct1_sess_col = inSession(city1_session) ? in_session_color : out_of_session_color ct2_sess_col = inSession(city2_session) ? in_session_color : out_of_session_color ct3_sess_col = inSession(city3_session) ? in_session_color : out_of_session_color ct4_sess_col = inSession(city4_session) ? in_session_color : out_of_session_color ct5_sess_col = inSession(city5_session) ? in_session_color : out_of_session_color [ct1_col, ct1_time] = get_time_str(city1_delay) [ct2_col, ct2_time] = get_time_str(city2_delay) [ct3_col, ct3_time] = get_time_str(city3_delay) [ct4_col, ct4_time] = get_time_str(city4_delay) [ct5_col, ct5_time] = get_time_str(city5_delay) var tbl = table.new(position.top_right, 3, 10) default_bg = #b8b8b8 dark_bg = #1f1f1f invisible=#00000000 vix = request.security("CBOE:VIX", timeframe.period, close) if show_clock table.cell(tbl, 0, 0, "🌍", bgcolor = dark_bg, text_color=color.white) table.cell(tbl, 1, 0, "🕑", bgcolor = dark_bg, text_color=color.white) table.cell(tbl, 2, 0, "🏛️", bgcolor = dark_bg, text_color=color.white) table.cell(tbl, 0, 1, city1_name, bgcolor = dark_bg, text_color=color.white) table.cell(tbl, 1, 1, ct1_time, bgcolor=ct1_col, text_color=color.white) table.cell(tbl, 2, 1, "", bgcolor=ct1_sess_col, text_color=color.white) table.cell(tbl, 0, 2, city2_name, bgcolor = dark_bg, text_color=color.white) table.cell(tbl, 1, 2, ct2_time, bgcolor=ct2_col, text_color=color.white) table.cell(tbl, 2, 2, "", bgcolor=ct2_sess_col, text_color=color.white) table.cell(tbl, 0, 3, city3_name, bgcolor = dark_bg, text_color=color.white) table.cell(tbl, 1, 3, ct3_time, bgcolor=ct3_col, text_color=color.white) table.cell(tbl, 2, 3, "", bgcolor=ct3_sess_col, text_color=color.white) table.cell(tbl, 0, 4, city4_name, bgcolor = dark_bg, text_color=color.white) table.cell(tbl, 1, 4, ct4_time, bgcolor=ct4_col, text_color=color.white) table.cell(tbl, 2, 4, "", bgcolor=ct4_sess_col, text_color=color.white) table.cell(tbl, 0, 5, city5_name, bgcolor = dark_bg, text_color=color.white) table.cell(tbl, 1, 5, ct5_time, bgcolor=ct5_col, text_color=color.white) table.cell(tbl, 2, 5, "", bgcolor=ct5_sess_col, text_color=color.white) table.cell(tbl, 0, 6, "", bgcolor = invisible, text_color=color.white) table.cell(tbl, 1, 6, "", bgcolor=invisible, text_color=color.white) table.cell(tbl, 2, 6, "", bgcolor=invisible, text_color=color.white) table.cell(tbl, 0, 7, "VIX", bgcolor = dark_bg, text_color=color.white) table.cell(tbl, 1, 7, str.tostring(vix), bgcolor=color_value(vix, 30), text_color=color.white) // levels var line w_high = na var line w_low = na var line w_close = na var line w_open = na var line ytd_open = na var line ytd_close = na var line ytd_high = na var line ytd_low = na new_day = ta.change(time("D")) new_week = ta.change(time("W")) [y_o, y_h, y_l, y_c] = request.security(syminfo.tickerid, "D", [open, high, low, close]) [w_o, w_h, w_l, w_c] = request.security(syminfo.tickerid, "W", [open, high, low, close]) if show_wk if new_week w_high := line.new(bar_index[1], w_h, bar_index, w_h, color=high_col, width=weekly_width, style=line.style_dotted) w_low := line.new(bar_index[1], w_l, bar_index, w_l, color=low_col, width=weekly_width, style=line.style_dotted) w_close := line.new(bar_index[1], w_c, bar_index, w_c, color=close_col, width=weekly_width, style=line.style_dotted) w_open := line.new(bar_index[1], w_o, bar_index, w_o, color=open_col, width=weekly_width, style=line.style_dotted) if show_labels label.new(bar_index, w_h, text="PWH - "+str.tostring(w_h), style=label.style_none, textcolor=high_col, size=size.small) label.new(bar_index, w_l, text="PWL - "+str.tostring(w_l), style=label.style_none, textcolor=low_col, size=size.small) label.new(bar_index, w_c, text="PWC - "+str.tostring(w_c), style=label.style_none, textcolor=close_col, size=size.small) label.new(bar_index, w_o, text="PWO - "+str.tostring(w_o), style=label.style_none, textcolor=open_col, size=size.small) else line.set_x2(w_high, bar_index) line.set_x2(w_low, bar_index) line.set_x2(w_close, bar_index) line.set_x2(w_open, bar_index) if show_dl and timeframe.isintraday if new_day ytd_high := line.new(bar_index[1], y_h, bar_index, y_h, color=high_col, width=daily_width) ytd_low := line.new(bar_index[1], y_l, bar_index, y_l, color=low_col, width=daily_width) ytd_open := line.new(bar_index[1], y_o, bar_index, y_o, color=open_col, width=daily_width) ytd_close := line.new(bar_index[1], y_c, bar_index, y_c, color=close_col, width=daily_width) if show_labels label.new(bar_index, y_h, text="YTD-H - "+str.tostring(y_h), style=label.style_none, textcolor=high_col, size=size.small) label.new(bar_index, y_l, text="YTD-L - "+str.tostring(y_l), style=label.style_none, textcolor=low_col, size=size.small) label.new(bar_index, y_o, text="YTD-O - "+str.tostring(y_o), style=label.style_none, textcolor=open_col, size=size.small) else line.set_x2(ytd_high, bar_index) line.set_x2(ytd_low, bar_index) line.set_x2(ytd_open, bar_index) line.set_x2(ytd_close, bar_index)
Consensio V2 - Relativity Indicator
https://www.tradingview.com/script/ipTZlZob-Consensio-V2-Relativity-Indicator/
Ben_Neumann
https://www.tradingview.com/u/Ben_Neumann/
42
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/ // © bneumann //@version=5 indicator("Consensio Relativity Indicator", overlay=true, max_bars_back=500, max_labels_count=500) //Inputs p = input(2, "Price") s = input(7, "STMA") l = input(30, "LTMA") //Creates SMA's price = ta.sma(close, p) stma = ta.sma(close, s) ltma = ta.sma(close, l) //Plot SMA's plot(price, "Price", color.lime, linewidth=1) plot(stma, "STMA", color.orange, linewidth=1) plot(ltma, "LTMA", color.blue, linewidth=1) //Label function relativity_label(txt, label_color, y_location) => _label = label.new(bar_index, na) label.set_textcolor(_label, label_color) label.set_yloc(_label, y_location) label.set_text(_label, txt) label.set_style(_label, label.style_none) //Relativity conditions relativity(price, stma, ltma) => if price > stma and price > ltma and stma > ltma relativity_label("A", color.green, yloc.abovebar) if price == stma and price > ltma and stma > ltma relativity_label("B", color.gray, yloc.abovebar) if price < stma and price > ltma and stma > ltma relativity_label("C", color.yellow, yloc.abovebar) if price < stma and price == ltma and stma > ltma relativity_label("D", color.gray, yloc.abovebar) if price < stma and price < ltma and stma > ltma relativity_label("E", color.orange, yloc.abovebar) if price < stma and price < ltma and stma == ltma relativity_label("F", color.gray, yloc.abovebar) if price < stma and price < ltma and stma < ltma relativity_label("G", color.red, yloc.abovebar) if price == stma and price < ltma and stma < ltma relativity_label("H", color.gray, yloc.belowbar) if price > stma and price < ltma and stma < ltma relativity_label("I", color.yellow, yloc.belowbar) if price > stma and price == ltma and stma < ltma relativity_label("J", color.gray, yloc.belowbar) if price > stma and price > ltma and stma < ltma relativity_label("K", color.orange, yloc.belowbar) if price > stma and price > ltma and stma == ltma relativity_label("L", color.gray, yloc.belowbar) if price == stma and price == ltma and stma == ltma relativity_label("M", color.gray, yloc.belowbar) //Detect when SMA's price are crossing if ta.crossover(price, stma) or ta.crossunder(price, stma) relativity(price, stma, ltma) if ta.crossover(ltma,stma) or ta.crossunder(ltma, stma) relativity(price, stma, ltma) if ta.crossover(price, ltma) or ta.crossunder(price, ltma) relativity(price, stma, ltma) if price==ltma or price==stma or stma==ltma relativity(price, stma, ltma)
Volume Based Donchian
https://www.tradingview.com/script/KKYuwpap-Volume-Based-Donchian/
pascorp
https://www.tradingview.com/u/pascorp/
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/ // // This coded is based on Ichimoku indicator, the volume weighded donchian is selfmade production // © pascorp //@version=5 indicator(title='Volume Based Donchian', shorttitle='VBD', overlay=true) // —————————————————————————————————————————————————————————————— // >>>>>>>>>>>>>>>>>>>>>>>>> Inputs <<<<<<<<<<<<<<<<<<<<<<<<<<< // —————————————————————————————————————————————————————————————— dPeriod = input.int(defval=30, minval=1, title='Donchian Periods') // —————————————————————————————————————————————————————————————— // >>>>>>>>>>>>>>>>>>>>>>> Functions <<<<<<<<<<<<<<<<<<<<<<<<<< // —————————————————————————————————————————————————————————————— 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)) donchianVWv2(len) => lo = ta.vwma(low, len) hi = ta.vwma(high, len) math.avg(ta.lowest(lo,len), ta.highest(hi,len)) // —————————————————————————————————————————————————————————————— // >>>>>>>>>>>>>>>>>>>>>>>>>> Core <<<<<<<<<<<<<<<<<<<<<<<<<<<< // —————————————————————————————————————————————————————————————— d = donchianVW(dPeriod) d2 = donchianVWv2(dPeriod) // —————————————————————————————————————————————————————————————— // >>>>>>>>>>>>>>>>>>>>>>>>>> Plots <<<<<<<<<<<<<<<<<<<<<<<<<<<< // —————————————————————————————————————————————————————————————— plot(d, title="Volume Based Donchian") plot(d2, title="Volume Based Donchian")
Universal logarithmic growth curves, with support and resistance
https://www.tradingview.com/script/uBQVS2is-Universal-logarithmic-growth-curves-with-support-and-resistance/
BillionaireLau
https://www.tradingview.com/u/BillionaireLau/
685
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © BillionaireLau //@version=5 indicator("Universal logarithmic growth curves, with support and resistance", overlay = true, max_lines_count = 500) //Script description: //This script is intended to provide a better version of the logarithmic curve, to fix the current issues of bitcoins traders. //In the public library there is a hardcoded logarithmic growth curve by @quantadelic. //That curve was hardcoded by his manual inputs. Which makes the curve stop updating its value since 2019 the date he publish that code. //Many users of that script out there based on @quantadelic version of "bitcoin logarithmic growth curves" and they tried their best to update the coordinates of it because his manual data is outdated. //A lot of "Bitcoin growth curve scripts that are available in the public library. Thus it generates a lot of redundant scripts in the public libraries. //This script is designed to solve this issue. Instead of a hardcoded bitcoin no-update script. This script is universal and designed to be usable in all tickers. //It is automatic, linear adjustable, levels and zones are customizable, support and resistance levels are highlighted. //Inputs: //Steps of drawing: By default, it is 10. Normally you won't change it unless there are display problems //For those who want to forcefully adjust the shape of these lines (which is not suggested), this script also opened the options for you. //Linear lift up: vertically lift up the whole set of lines. By linear multiplication. //Curvature constant: It is the base value of the exponential transform before converting it back to the chart and plotting it. A bigger base value will make a more upward curvy line. // //Errors: // 1) Bar Index value of the 'x2' argument (-121.000000) in 'line.set_x***()' is too far from the current bar index. // Fixes: // Option 1: Turn to manual method and input a smaller range. // Option 2: Use "Weekly" timeframe, which has less bars in the chart. import BillionaireLau/GenericTA/3 as gta src = input(close, title = "Source") //Methods input string method = input.string("Automatic", options=["Automatic","Manual"],group="Methods") cover_period = input(5000,title="(Optional) Range under manual method",group="Methods") block_no = method=="Automatic"?last_bar_index - 1:cover_period steps_cal = input(10, title="steps of drawings (won't change it unless there is display problems)") //Colors input line_colorRes = input.color(color.red,title="resistance level color",group="Colors") line_colorSup = input.color(color.green,title="support level color",group="Colors") line_colorOth = input.color(color.yellow,title="other line color",group="Colors") var line[] reg_line_array = array.new_line() var line[] line1array = array.new_line() var line[] line2array = array.new_line() var line[] line3array = array.new_line() var line[] line4array = array.new_line() var line[] line5array = array.new_line() var line[] line6array = array.new_line() var line[] line7array = array.new_line() var line[] line8array = array.new_line() var line[] line9array = array.new_line() var line[] line10array = array.new_line() var line[] line11array = array.new_line() var line[] line12array = array.new_line() var line[] line13array = array.new_line() var line[] line14array = array.new_line() var label r1_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r2_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r3_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r4_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r5_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r6_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r7_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r8_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r9_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r10_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r11_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r12_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r13_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) var label r14_label = label.new(x = na, y = na, style = label.style_none, color = #00000000, textcolor = color.blue, size=size.normal, textalign = text.align_center) float[] a1array = array.new_float() float[] a2array = array.new_float() float[] a3array = array.new_float() float[] a4array = array.new_float() float[] a5array = array.new_float() float[] a6array = array.new_float() float[] a7array = array.new_float() float[] a8array = array.new_float() float[] a9array = array.new_float() float[] a10array = array.new_float() float[] a11array = array.new_float() float[] a12array = array.new_float() float[] a13array = array.new_float() float[] a14array = array.new_float() var int step = na var int line_n = na line_color = color.red if barstate.isfirst line_n := math.min(block_no, 250) for i = 0 to line_n - 1 array.unshift(reg_line_array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) if block_no > 5000 step := math.ceil(block_no / 750) else step := math.ceil(block_no / 250) for i = 0 to math.floor(line_n / 2) - 1 array.unshift(line1array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line2array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line3array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line4array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line5array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line6array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line7array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line8array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line9array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line10array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line11array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line12array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line13array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) array.unshift(line14array, line.new(x1=na, y1=na, x2=na, y2=na, color=line_color)) mul1 = input.float(1.5,title="stdev multipliers of top line (line 1)",group="Regression boundaries") mul14 = input.float(-1.5,title="stdev multipliers of bottom line (line 14)",group="Regression boundaries") fib1= mul1 fib2= input.float(0.8541,title="fib level 2",group="Fib levels ") fib3= input.float(0.7639,title="fib level 3",group="Fib levels ") fib4= input.float(0.618,title="fib level 4",group="Fib levels ") fib5= input.float(0.5,title="fib level 5",group="Fib levels ") fib6= input.float(0.382,title="fib level 6",group="Fib levels ") fib7= input.float(0.382,title="fib level 7",group="Fib levels ") fib8= input.float(0.382,title="fib level 8",group="Fib levels ") fib9= input.float(0.2361,title="fib level 9",group="Fib levels ") fib10= input.float(0.1459,title="fib level 10",group="Fib levels ") fib11= input.float(0.0902,title="fib level 11",group="Fib levels ") fib12= input.float(0.0902,title="fib level 12",group="Fib levels ") fib13= input.float(0.0902,title="fib level 13",group="Fib levels ") fib14 = mul14 mul2 = (mul1 - mul14)*fib2 - mul1 mul3 = (mul1 - mul14)*fib3 - mul1 mul4 = (mul1 - mul14)*fib4 - mul1 mul5 = (mul1 - mul14)*fib5 - mul1 mul6 = (mul1 - mul14)*fib6 - mul1 mul7 = (mul1 - mul14)*fib7 - mul1 mul8 = (mul1 - mul14)*fib8 - mul1 mul9 = (mul1 - mul14)*fib9 - mul1 mul10 = (mul1 - mul14)*fib10 - mul1 mul11 = (mul1 - mul14)*fib11 - mul1 mul12 = (mul1 - mul14)*fib12 - mul1 mul13 = (mul1 - mul14)*fib13 - mul1 lift_fact = input (1,title="linear lift up factor for the set of lines",group="Linear adjustments") incline = 1 base = input (2.718,title="curvature constant for the set of lines, default: 2.718",group="Linear adjustments") var float[] price_array = array.new_float(block_no) var int[] x_array = array.new_int(block_no) array.unshift(price_array, src) array.pop(price_array) array.unshift(x_array, bar_index) array.pop(x_array) if barstate.islastconfirmedhistory [x_coor, slope, r_sq, dev] = gta.log_regress(x_array, price_array,2) for i = 0 to array.size(x_coor) - 1 array.push(a1array, math.pow(base,array.get(x_coor, i) + mul1 * dev)*incline) array.push(a2array, math.pow(base,array.get(x_coor, i) + mul2 * dev)*incline) array.push(a3array, math.pow(base,array.get(x_coor, i) + mul3 *dev)*incline) // array.push(a4array, math.pow(base,array.get(x_coor, i)+ mul4 *dev)*incline) array.push(a5array, math.pow(base,array.get(x_coor, i) + mul5 *dev)*incline) // array.push(a6array, math.pow(base,array.get(x_coor, i)+ mul6 *dev)*incline) array.push(a7array, math.pow(base,array.get(x_coor, i)+ mul7 *dev)*incline) array.push(a8array, math.pow(base,array.get(x_coor, i)+ mul8 *dev)*incline) array.push(a9array, math.pow(base,array.get(x_coor, i)+ mul9 *dev)*incline) array.push(a10array, math.pow(base,array.get(x_coor, i)+ mul10 *dev)*incline) array.push(a11array, math.pow(base,array.get(x_coor, i)+ mul11 *dev)*incline) array.push(a12array, math.pow(base,array.get(x_coor, i)+ mul12 *dev)*incline) array.push(a13array, math.pow(base,array.get(x_coor, i)+ mul13 *dev)*incline) array.push(a14array, math.pow(base,array.get(x_coor, i)+ mul14 *dev)*incline) if barstate.islastconfirmedhistory for i = 0 to array.size(a1array) - 2 - step by step * steps_cal //1 line.set_xy1(array.get(line1array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a1array, i),lift_fact)) line.set_xy2(array.get(line1array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a1array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //2 line.set_xy1(array.get(line2array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a2array, i),lift_fact)) line.set_xy2(array.get(line2array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a2array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //3 line.set_xy1(array.get(line3array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a3array, i),lift_fact)) line.set_xy2(array.get(line3array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a3array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //steps_cal line.set_xy1(array.get(line4array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a4array, i),lift_fact)) line.set_xy2(array.get(line4array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a4array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //5 line.set_xy1(array.get(line5array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a5array, i),lift_fact)) line.set_xy2(array.get(line5array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a5array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //6 line.set_xy1(array.get(line6array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a6array, i),lift_fact)) line.set_xy2(array.get(line6array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a6array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //7 line.set_xy1(array.get(line7array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a7array, i),lift_fact)) line.set_xy2(array.get(line7array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a7array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //8 line.set_xy1(array.get(line8array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a8array, i),lift_fact)) line.set_xy2(array.get(line8array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a8array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //9 line.set_xy1(array.get(line9array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a9array, i),lift_fact)) line.set_xy2(array.get(line9array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a9array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //10 line.set_xy1(array.get(line10array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a10array, i),lift_fact)) line.set_xy2(array.get(line10array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a10array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //11 line.set_xy1(array.get(line11array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a11array, i),lift_fact)) line.set_xy2(array.get(line11array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a11array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //12 line.set_xy1(array.get(line12array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a12array, i),lift_fact)) line.set_xy2(array.get(line12array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a12array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //13 line.set_xy1(array.get(line13array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a13array, i),lift_fact)) line.set_xy2(array.get(line13array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a13array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) //14 line.set_xy1(array.get(line14array, i / (step * steps_cal)), x=bar_index - i, y=math.pow(array.get(a14array, i),lift_fact)) line.set_xy2(array.get(line14array, i / (step * steps_cal)), x=bar_index - i - step*steps_cal, y=math.pow(array.get(a14array, math.min(array.size(a1array)-2,i + step*steps_cal)),lift_fact)) if barstate.islastconfirmedhistory sup1 = close - math.pow(array.get(a1array, 0),lift_fact)>0?close - math.pow(array.get(a1array, 0),lift_fact):9999999 sup2 = close - math.pow(array.get(a2array, 0),lift_fact)>0?close - math.pow(array.get(a2array, 0),lift_fact):9999999 sup3 = close - math.pow(array.get(a3array, 0),lift_fact)>0?close - math.pow(array.get(a3array, 0),lift_fact):9999999 sup4 = close - math.pow(array.get(a4array, 0),lift_fact)>0?close - math.pow(array.get(a4array, 0),lift_fact):9999999 sup5 = close - math.pow(array.get(a5array, 0),lift_fact)>0?close - math.pow(array.get(a5array, 0),lift_fact):9999999 sup6 = close - math.pow(array.get(a6array, 0),lift_fact)>0?close - math.pow(array.get(a6array, 0),lift_fact):9999999 sup7 = close - math.pow(array.get(a7array, 0),lift_fact)>0?close - math.pow(array.get(a7array, 0),lift_fact):9999999 sup8 = close - math.pow(array.get(a8array, 0),lift_fact)>0?close - math.pow(array.get(a8array, 0),lift_fact):9999999 sup9 = close - math.pow(array.get(a9array, 0),lift_fact)>0?close - math.pow(array.get(a9array, 0),lift_fact):9999999 sup10 = close - math.pow(array.get(a10array, 0),lift_fact)>0?close - math.pow(array.get(a10array, 0),lift_fact):9999999 sup11 = close - math.pow(array.get(a11array, 0),lift_fact)>0?close - math.pow(array.get(a11array, 0),lift_fact):9999999 sup12 = close - math.pow(array.get(a12array, 0),lift_fact)>0?close - math.pow(array.get(a12array, 0),lift_fact):9999999 sup13 = close - math.pow(array.get(a13array, 0),lift_fact)>0?close - math.pow(array.get(a13array, 0),lift_fact):9999999 sup14 = close - math.pow(array.get(a14array, 0),lift_fact)>0?close - math.pow(array.get(a14array, 0),lift_fact):9999999 support_level = math.min(sup1,sup2,sup3,sup4,sup5,sup6,sup7,sup8,sup9,sup10,sup11,sup12,sup13,sup14) //for resistance level diff1 = close - math.pow(array.get(a1array, 0),lift_fact)<0?close - math.pow(array.get(a1array, 0),lift_fact):-9999999 diff2 = close - math.pow(array.get(a2array, 0),lift_fact)<0?close - math.pow(array.get(a2array, 0),lift_fact):-9999999 diff3 = close - math.pow(array.get(a3array, 0),lift_fact)<0?close - math.pow(array.get(a3array, 0),lift_fact):-9999999 diff4 = close - math.pow(array.get(a4array, 0),lift_fact)<0?close - math.pow(array.get(a4array, 0),lift_fact):-9999999 diff5 = close - math.pow(array.get(a5array, 0),lift_fact)<0?close - math.pow(array.get(a5array, 0),lift_fact):-9999999 diff6 = close - math.pow(array.get(a6array, 0),lift_fact)<0?close - math.pow(array.get(a6array, 0),lift_fact):-9999999 diff7 = close - math.pow(array.get(a7array, 0),lift_fact)<0?close - math.pow(array.get(a7array, 0),lift_fact):-9999999 diff8 = close - math.pow(array.get(a8array, 0),lift_fact)<0?close - math.pow(array.get(a8array, 0),lift_fact):-9999999 diff9 = close - math.pow(array.get(a9array, 0),lift_fact)<0?close - math.pow(array.get(a9array, 0),lift_fact):-9999999 diff10 = close - math.pow(array.get(a10array, 0),lift_fact)<0?close - math.pow(array.get(a10array, 0),lift_fact):-9999999 diff11 = close - math.pow(array.get(a11array, 0),lift_fact)<0?close - math.pow(array.get(a11array, 0),lift_fact):-9999999 diff12 = close - math.pow(array.get(a12array, 0),lift_fact)<0?close - math.pow(array.get(a12array, 0),lift_fact):-9999999 diff13 = close - math.pow(array.get(a13array, 0),lift_fact)<0?close - math.pow(array.get(a13array, 0),lift_fact):-9999999 diff14 = close - math.pow(array.get(a14array, 0),lift_fact)<0?close - math.pow(array.get(a14array, 0),lift_fact):-9999999 resistance_level = math.max(diff1,diff2,diff3,diff4,diff5,diff6,diff7,diff8,diff9,diff10,diff11,diff12,diff13,diff14) line_color1 = diff1==resistance_level?line_colorRes:sup1==support_level?line_colorSup:line_colorOth line_color2 = diff2==resistance_level?line_colorRes:sup2==support_level?line_colorSup:line_colorOth line_color3 = diff3==resistance_level?line_colorRes:sup3==support_level?line_colorSup:line_colorOth line_color4 = diff4==resistance_level?line_colorRes:sup4==support_level?line_colorSup:line_colorOth line_color5 = diff5==resistance_level?line_colorRes:sup5==support_level?line_colorSup:line_colorOth line_color6 = diff6==resistance_level?line_colorRes:sup6==support_level?line_colorSup:line_colorOth line_color7 = diff7==resistance_level?line_colorRes:sup7==support_level?line_colorSup:line_colorOth line_color8 = diff8==resistance_level?line_colorRes:sup8==support_level?line_colorSup:line_colorOth line_color9 = diff9==resistance_level?line_colorRes:sup9==support_level?line_colorSup:line_colorOth line_color10 = diff10==resistance_level?line_colorRes:sup10==support_level?line_colorSup:line_colorOth line_color11 = diff11==resistance_level?line_colorRes:sup11==support_level?line_colorSup:line_colorOth line_color12 = diff12==resistance_level?line_colorRes:sup12==support_level?line_colorSup:line_colorOth line_color13 = diff13==resistance_level?line_colorRes:sup13==support_level?line_colorSup:line_colorOth line_color14 = diff14==resistance_level?line_colorRes:sup14==support_level?line_colorSup:line_colorOth for i = 0 to array.size(a1array) - 2 - step by step * steps_cal line.set_color(array.get(line1array, i / (step * steps_cal)), color=line_color1) line.set_color(array.get(line2array, i / (step * steps_cal)), color=line_color2) line.set_color(array.get(line3array, i / (step * steps_cal)), color=line_color3) line.set_color(array.get(line4array, i / (step * steps_cal)), color=line_color4) line.set_color(array.get(line5array, i / (step * steps_cal)), color=line_color5) line.set_color(array.get(line6array, i / (step * steps_cal)), color=line_color6) line.set_color(array.get(line7array, i / (step * steps_cal)), color=line_color7) line.set_color(array.get(line8array, i / (step * steps_cal)), color=line_color8) line.set_color(array.get(line9array, i / (step * steps_cal)), color=line_color9) line.set_color(array.get(line10array, i / (step * steps_cal)), color=line_color10) line.set_color(array.get(line11array, i / (step * steps_cal)), color=line_color11) line.set_color(array.get(line12array, i / (step * steps_cal)), color=line_color12) line.set_color(array.get(line13array, i / (step * steps_cal)), color=line_color13) line.set_color(array.get(line14array, i / (step * steps_cal)), color=line_color14) if barstate.islastconfirmedhistory label.set_xy(r1_label, x = bar_index + 1,y=math.pow(array.get(a1array, 0),lift_fact)) label.set_text(r1_label, text = "Top line") label.set_xy(r2_label, x = bar_index + 1,y=math.pow(array.get(a2array, 0),lift_fact)) label.set_text(r2_label, text = "Fib: " + str.tostring(fib2)) label.set_xy(r3_label, x = bar_index + 1,y=math.pow(array.get(a3array, 0),lift_fact)) label.set_text(r3_label, text = "Fib: " + str.tostring(fib3)) label.set_xy(r4_label, x = bar_index + 1,y=math.pow(array.get(a4array, 0),lift_fact)) label.set_text(r4_label, text = "Fib: " + str.tostring(fib4)) label.set_xy(r5_label, x = bar_index + 1,y=math.pow(array.get(a5array, 0),lift_fact)) label.set_text(r5_label, text = "Fib: " + str.tostring(fib5)) label.set_xy(r6_label, x = bar_index + 1,y=math.pow(array.get(a6array, 0),lift_fact)) label.set_text(r6_label, text = "Fib: " + str.tostring(fib6)) label.set_xy(r7_label, x = bar_index + 1,y=math.pow(array.get(a7array, 0),lift_fact)) label.set_text(r7_label, text = "Fib: " + str.tostring(fib7)) label.set_xy(r8_label, x = bar_index + 1,y=math.pow(array.get(a8array, 0),lift_fact)) label.set_text(r8_label, text = "Fib: " + str.tostring(fib8)) label.set_xy(r9_label, x = bar_index + 1,y=math.pow(array.get(a9array, 0),lift_fact)) label.set_text(r9_label, text = "Fib: " + str.tostring(fib9)) label.set_xy(r10_label, x = bar_index + 1,y=math.pow(array.get(a10array, 0),lift_fact)) label.set_text(r10_label, text = "Fib: " + str.tostring(fib10)) label.set_xy(r11_label, x = bar_index + 1,y=math.pow(array.get(a11array, 0),lift_fact)) label.set_text(r11_label, text = "Fib: " + str.tostring(fib11)) label.set_xy(r12_label, x = bar_index + 1,y=math.pow(array.get(a12array, 0),lift_fact)) label.set_text(r12_label, text = "Fib: " + str.tostring(fib12)) label.set_xy(r13_label, x = bar_index + 1,y=math.pow(array.get(a13array, 0),lift_fact)) label.set_text(r13_label, text = "Fib: " + str.tostring(fib13)) label.set_xy(r14_label, x = bar_index + 1,y=math.pow(array.get(a14array, 0),lift_fact)) label.set_text(r14_label, text = "Bottom line") var line mark1 = line.new(na,na,na,na, width = 1,style = line.style_arrow_both, color=color.red, extend=extend.right) var label txt1 = label.new(x = na, y = na, style = label.style_none, textcolor = color.yellow, size=size.normal, textalign = text.align_center) if barstate.islastconfirmedhistory cur_lvl = (close - math.pow(array.get(a1array, 0),lift_fact))/(math.pow(array.get(a14array, 0),lift_fact) - math.pow(array.get(a1array, 0),lift_fact)) line.set_xy1(mark1, x=bar_index[1]+15, y=cur_lvl) line.set_xy2(mark1, x=bar_index[1]+17, y=cur_lvl) label.set_xy(txt1, x = bar_index[0]+15,y=cur_lvl) label.set_text(txt1,text=str.tostring(cur_lvl,"#.##"))
Dynamic Volume Adaptive Moving Average (MZ DVAMA)
https://www.tradingview.com/script/t1vuzEX2-Dynamic-Volume-Adaptive-Moving-Average-MZ-DVAMA/
MightyZinger
https://www.tradingview.com/u/MightyZinger/
429
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/ // © MightyZinger //@version=5 indicator(title='Dynamic Volume Adaptive Moving Average (MZ DVAMA)', shorttitle='MZ DVAMA', overlay=true) uha =input(true, title="Use Heikin Ashi Candles for Volume Oscillator Calculations") haclose = uha ? ohlc4 : close f_ha_open() => haopen = float(na) haopen := na(haopen[1]) ? (open + close) / 2 : (nz(haopen[1]) + nz(haclose[1])) / 2 haopen haopen = uha ? f_ha_open() : open hahigh = high halow = low vol = volume ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// Source Options ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // ─── Different Sources Options List ───► [ string SRC_Tv = 'Use traditional TradingView Sources ' string SRC_Wc = '(high + low + (2 * close)) / 4' string SRC_Wo = 'close+high+low-2*open' string SRC_Wi = '(close+high+low) / 3' string SRC_Ex = 'close>open ? high : low' string SRC_Hc = 'Heikin Ashi Close' string src_grp = 'Source Parameters' // ●───────── Inputs ─────────● { diff_src = input.string(SRC_Wi, '→ Different Sources Options', options=[SRC_Tv, SRC_Wc, SRC_Wo, SRC_Wi, SRC_Ex, SRC_Hc], group=src_grp) i_sourceSetup = input.source(close, '  ‍↳ Source Setup', group=src_grp) uha_src = input.bool(true, title='‍↳ Use Heikin Ashi Candles for Different Source Calculations', group=src_grp) i_Symmetrical = input.bool(true, '‍↳ Apply Symmetrically Weighted Moving Average at the price source (May Result Repainting)', group=src_grp) // Heikinashi Candles for calculations h_close = uha_src ? ohlc4 : close h_open = uha_src ? f_ha_open() : open h_high = high h_low = low // Get Source src_o = diff_src == SRC_Wc ? (h_high + h_low + 2 * h_close) / 4 : diff_src == SRC_Wo ? h_close + h_high + h_low - 2 * h_open : diff_src == SRC_Wi ? (h_close + h_high + h_low) / 3 : diff_src == SRC_Ex ? h_close > h_open ? h_high : h_low : diff_src == SRC_Hc ? ohlc4 : i_sourceSetup src_f = i_Symmetrical ? ta.swma(src_o) : src_o // Symmetrically Weighted Moving Average? ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Length = input.int(365, title='Length:', group='DVAMA Parameters') fastLength = input.int(6, title='Fast Length:', group='DVAMA Parameters') slowMinLength = input.int(7, title='Slow Min Length:', group='DVAMA Parameters') slowMaxLength = input.int(14, title='Slow Max Length:', group='DVAMA Parameters') AadaptPerc = input.float(3.141, minval=0, maxval=100, title='Adapting Percentage:', group='DVAMA Parameters') / 100.0 ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// Dynamic Inputs ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Volume and other Inputs // Oscillator Types Input osc1 = 'TFS Volume Oscillator' osc2 = 'On Balance Volume' osc3 = 'Klinger Volume Oscillator' osc4 = 'Cumulative Volume Oscillator' osc5 = 'Volume Zone Oscillator' osctype = input.string(title='Volume Oscillator Type', group='Indicator Parameters', defval=osc1, options=[osc1, osc2, osc3, osc4, osc5]) volLen = input.int(30, minval=1, title='Volume Length', group='MZ RVSI Indicator Parameters') rvsiLen = input.int(14, minval=1, title='RVSI Period', group='MZ RVSI Indicator Parameters') vBrk = input.int(50, minval=1, title='RVSI Break point', group='MZ RVSI Indicator Parameters') slopePeriod = input.int(34, title='Slope Period', group='Slope Dynamic Optimization Parameters') slopeInRange = input.int(25, title='Slope Initial Range', group='Slope Dynamic Optimization Parameters') flat = input.int(17, title='Consolidation area is when slope below:', group='Slope Dynamic Optimization Parameters') showEnv = input.bool(true, title='Show Adaptive MA Envelope', group='ENVELOPE DISTANCE ZONE') mult = input.float(2.5, title='Distance (Envelope) Multiplier', step=.1, group='ENVELOPE DISTANCE ZONE') // Original = 2.7 env_atr = input.int(40, title='Envelope ATR Length', group='ENVELOPE DISTANCE ZONE') showSignals = input.bool(true, title='Show Possible Signals', group='OTHER') ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// Dynamic Length Function ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// //Dynamic Length Function dynLen(para, adapt_Pct, minLength, maxLength) => var float result = math.avg(minLength, maxLength) result := para ? math.max(minLength, result * (1 - adapt_Pct)) : math.min(maxLength, result * (1 + adapt_Pct)) result //Slope calculation to determine whether market is in trend, or in consolidation or choppy, or might about to change current trend calcslope(_ma, src, slope_period, range_1) => pi = math.atan(1) * 4 highestHigh = ta.highest(slope_period) lowestLow = ta.lowest(slope_period) slope_range = range_1 / (highestHigh - lowestLow) * lowestLow dt = (_ma[2] - _ma) / src * slope_range c = math.sqrt(1 + dt * dt) xAngle = math.round(180 * math.acos(1 / c) / pi) maAngle = dt > 0 ? -xAngle : xAngle maAngle //MA coloring function to mark market dynamics dynColor(_flat, upPara, dnPara, slp, col_1, col_2, col_3, col_4, col_r) => col = color.green if slp > _flat and upPara col := col_1 col if slp > _flat and not upPara col := col_2 col if slp <= _flat and slp > -flat col := col_r col if slp <= -_flat and dnPara col := col_3 col if slp <= -_flat and not dnPara col := col_4 col col ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// Volume Oscillator Functions ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Volume Zone Oscillator zone(_src, _type, _len) => vp = _src > _src[1] ? _type : _src < _src[1] ? -_type : _src == _src[1] ? 0 : 0 z = 100 * (ta.ema(vp, _len) / ta.ema(_type, _len)) z vzo(vol_src, _close) => float result = 0 zLen = input.int(21, 'VZO Length', minval=1, group='Volume Zone Oscillator Parameters') result := zone(_close, vol_src, zLen) result // Cumulative Volume Oscillator _rate(cond, tw, bw, body) => ret = 0.5 * (tw + bw + (cond ? 2 * body : 0)) / (tw + bw + body) ret := nz(ret) == 0 ? 0.5 : ret ret cvo(vol_src, _open, _high, _low, _close) => float result = 0 ema1len = input.int(defval=8, title='EMA 1 Length', minval=1, group='Cumulative Volume Oscillator Parameters') ema2len = input.int(defval=21, title='EMA 1 Length', minval=1, group='Cumulative Volume Oscillator Parameters') obvl = 'On Balance Volume' cvdo = 'Cumulative Volume Delta' pvlt = 'Price Volume Trend' cvtype = input.string(defval=pvlt, options=[obvl, cvdo, pvlt], group='Cumulative Volume Oscillator Parameters') tw = _high - math.max(_open, _close) bw = math.min(_open, _close) - _low body = math.abs(_close - _open) deltaup = vol_src * _rate(_open <= _close, tw, bw, body) deltadown = vol_src * _rate(_open > _close, tw, bw, body) delta = _close >= _open ? deltaup : -deltadown cumdelta = ta.cum(delta) float ctl = na ctl := cumdelta cv = cvtype == obvl ? ta.obv : cvtype == cvdo ? ctl : ta.pvt ema1 = ta.ema(cv, ema1len) ema2 = ta.ema(cv, ema2len) result := ema1 - ema2 result // Volume Oscillator function vol_osc(type, vol_src, vol_Len, _open, _high, _low, _close) => float result = 0 if type == 'TFS Volume Oscillator' iff_1 = _close < _open ? -vol_src : 0 nVolAccum = math.sum(_close > _open ? vol_src : iff_1, vol_Len) result := nVolAccum / vol_Len result if type == 'On Balance Volume' result := ta.cum(math.sign(ta.change(_close)) * vol_src) result if type == 'Klinger Volume Oscillator' FastX = input.int(34, minval=1, title='Volume Fast Length', group='KVO Parameters') SlowX = input.int(55, minval=1, title='Volume Slow Length', group='KVO Parameters') xTrend = _close > _close[1] ? vol * 100 : -vol * 100 xFast = ta.ema(xTrend, FastX) xSlow = ta.ema(xTrend, SlowX) result := xFast - xSlow result if type == 'Cumulative Volume Oscillator' result := cvo(vol_src, _open, _high, _low, _close) result if type == 'Volume Zone Oscillator' result := vzo(vol_src, _close) result result ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // MA of Volume Oscillator Source volMA = ta.sma(vol_osc(osctype, vol, volLen, haopen, hahigh, halow, haclose), rvsiLen) // RSI of Volume Oscillator Data rsivol = ta.rsi(volMA, rvsiLen) rvsi = ta.hma(rsivol, rvsiLen) rvsiSlp = calcslope(rvsi, rsivol, slopePeriod, slopeInRange) // Slope of RVSI // Volume Breakout Condition volBrkUp = rvsi > vBrk // and rvsiSlp >= flat volBrkDn = rvsi < vBrk //or rvsiSlp <= -flat // plotchar(rvsi, 'RVSI', '', location.top, color.new(color.red, 0)) ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// UPpara = volBrkUp // Volume breaking up above given value Dnpara = volBrkDn // Volume breaking down below given value dyn_len = dynLen(UPpara, AadaptPerc, slowMinLength, slowMaxLength) // AMA Funtion ama(src,length,minLength,majLength)=> minAlpha = 2 / (minLength + 1) majAlpha = 2 / (majLength + 1) hh = ta.highest(length + 1) ll = ta.lowest(length + 1) _mult = hh - ll != 0 ? math.abs(2 * src - ll - hh) / (hh - ll) : 0 final = _mult * (minAlpha - majAlpha) + majAlpha ma = 0.0 ma := nz(ma[1]) + math.pow(final, 2) * (src - nz(ma[1])) ma // DVAMA Calculations Slowend = int(dyn_len) dvama = ama(src_f,Length,fastLength,Slowend) slope = calcslope(dvama, src_f, slopePeriod, slopeInRange) up_col = color.green dn_col = color.red dy_col = dynColor(flat, UPpara, Dnpara, slope, up_col, color.lime, dn_col, color.gray, color.yellow) plot(dvama, 'DVAMA', dy_col, 4) plotchar(dyn_len, 'Dynamic Length', '', location.top, color.new(color.green, 0)) //{ SIGNALS _upSig = dy_col == up_col _dnSig = dy_col == dn_col buy = _upSig and not _upSig[1] sell = _dnSig and not _dnSig[1] var swing = 0 if buy and swing <= 0 swing := 1 swing if sell and swing >= 0 swing := -1 swing longsignal = swing == 1 and (swing != 1)[1] shortsignal = swing == -1 and (swing != -1)[1] // Enveloping AEDSMA with ATR bands f_warn_col(_close , _low, _high, lower, upper, b_col, t_col, b_warn, t_warn) => var col = color.rgb(170,219,30,60) if _low > lower and _high < upper col := color.from_gradient(_close, lower, upper, b_col, t_col) if _low < lower col := b_warn if _high > upper col := t_warn col // 1/2 distance zone env_MA = dvama utl = env_MA + mult * ta.atr(env_atr) ltl = env_MA - mult * ta.atr(env_atr) // One distance zone ttl = env_MA + (mult*1.7) * ta.atr(env_atr) btl = env_MA - (mult*1.7) * ta.atr(env_atr) ttl2 = env_MA + (mult*2) * ta.atr(env_atr) btl2 = env_MA - (mult*2) * ta.atr(env_atr) // 1/2 of the 1/2. for tighter SL or trailing stp_utl = env_MA + (mult/2) * ta.atr(env_atr) stp_ltl = env_MA - (mult/2) * ta.atr(env_atr) // Plotting AEDSMA Envelope Distance Zone env_col_s = dy_col warn_col = f_warn_col(close , low, high, btl, ttl, color.green, color.red, color.rgb(8,255,8), color.rgb(255,198,0)) plot(showEnv ? utl : na, color=color.new(color.green, 50)) plot(showEnv ? ltl : na, color=color.new(color.red, 50)) t1 = plot(showEnv ? ttl : na, color=color.new(warn_col,50)) b1 = plot(showEnv ? btl : na, color=color.new(warn_col,50)) t2 = plot(showEnv ? ttl2 : na, color=color.new(warn_col,50)) b2 = plot(showEnv ? btl2 : na, color=color.new(warn_col,50)) s_utl = plot(showEnv ? stp_utl : na, color=na) s_ltl = plot(showEnv ? stp_ltl : na, color=na) colEnv = showEnv ? env_col_s : na fill(s_utl, s_ltl, color=color.new(colEnv, 80)) fill(t1, t2, color=color.new(warn_col,80)) fill(b1, b2, color=color.new(warn_col,80)) // Caution for price crossing outer distance zone of envelop. can act as TP top_out = high > ttl bot_out = low < btl upWarn = top_out and not top_out[1] dnWarn = bot_out and not bot_out[1] // Plot 'em up atrPos = 0.72 * ta.atr(5) plotshape(showSignals and buy ? dvama-atrPos: na, style=shape.circle, color= #AADB1E, location=location.absolute, size = size.tiny) plotshape(showSignals and sell ? dvama+atrPos: na, style=shape.circle, color= #E10600, location=location.absolute, size = size.tiny) plotshape(showSignals and longsignal ? ltl - atrPos : na, style=shape.triangleup, color=color.new(color.green, 0), location=location.absolute, text = 'Long', size=size.small) plotshape(showSignals and shortsignal ? utl + atrPos : na, style=shape.triangledown, color=color.new(color.red, 0), location=location.absolute, text = 'Short', size=size.small) plotchar(showSignals and upWarn ? high+atrPos: dnWarn? low-atrPos: na, color = upWarn ? #E10600 : dnWarn ? #AADB1E : na, location=location.absolute, char = "⚑", size = size.tiny)
Average Lines
https://www.tradingview.com/script/De2slurk-Average-Lines/
fikira
https://www.tradingview.com/u/fikira/
481
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © fikira //@version=5 indicator("Average Lines", max_lines_count=500, overlay=true) // -----------[ inputs ]----------- var int left = input.int (10 , 'leftbars' , group='settings') var int right = input.int ( 1 , 'rightbars' , group='settings') var bool fill = input.bool (true, 'fill lines?', group='settings') var string choice= input.string ('ph', 'choice' , group='settings', options=['ph', 'pl', 'both', 'none']) var int max = input.int (500 , 'max pivot points for calculations' ) var int maxX = input.int (1000, 'max bars between concerning bar and last bar') var color c_pih = input.color (color.new(color.red , 85), 'connecting line between (pivots)', group='colours pivot high') var color c_lh = input.color (color.new(color.red , 99), 'lines' , group='colours pivot high') var color c_avh = input.color (color.new(#00bcd4 , 0), 'average' , group='colours pivot high') var color c_fh = input.color (color.new(color.red , 93), 'linefill' , group='colours pivot high') var color c_pil = input.color (color.new(color.lime, 85), 'connecting line between (pivots)', group='colours pivot low' ) var color c_ll = input.color (color.new(color.blue, 99), 'lines' , group='colours pivot low' ) var color c_avl = input.color (color.new(#388e3c , 0), 'average' , group='colours pivot low' ) var color c_fl = input.color (color.new(color.lime, 93), 'linefill' , group='colours pivot low' ) // -----------[ variables ]----------- var float avh = 0. var float avl = 0. // no var float ph = ta.pivothigh (left, right) float pl = ta.pivotlow (left, right) float[] a_avh = array.new_float() float[] a_avl = array.new_float() // -----------[ array's ]----------- var float [] a_php = array.new_float () var float [] a_plp = array.new_float () var int [] a_plb = array.new_int () var int [] a_phb = array.new_int () var line [] a_lh = array.new_line () var linefill[] a_lhF = array.new_linefill() var line [] a_ll = array.new_line () var linefill[] a_llF = array.new_linefill() switch choice == 'both' => if array.size(a_lh ) > 0 and array.size(a_ll ) > 0 if (array.size(a_lh ) + array.size(a_ll )) > 500 if array.size(a_lh ) > array.size(a_ll ) line.delete(array.pop(a_lh )) else line.delete(array.pop(a_ll )) if array.size(a_lhF) > 0 and array.size(a_llF) > 0 if (array.size(a_lhF) + array.size(a_llF)) > 500 if array.size(a_lhF) > array.size(a_llF) lineF = array.pop(a_lhF) line.delete(linefill.get_line1(lineF)) line.delete(linefill.get_line2(lineF)) linefill.delete(lineF) else lineF = array.pop(a_llF) line.delete(linefill.get_line1(lineF)) line.delete(linefill.get_line2(lineF)) linefill.delete(lineF) choice == 'ph' => if array.size(a_lh) > 500 line.delete(array.pop(a_lh)) if array.size(a_lhF) > 500 lineF = array.pop(a_lhF) line.delete(linefill.get_line1(lineF)) line.delete(linefill.get_line2(lineF)) linefill.delete(lineF) choice == 'pl' => if array.size(a_ll) > 500 line.delete(array.pop(a_ll)) if array.size(a_llF) > 500 lineF = array.pop(a_llF) line.delete(linefill.get_line1(lineF)) line.delete(linefill.get_line2(lineF)) linefill.delete(lineF) // -----------[ functions ]----------- calc_avg(array_lines, array_average) => var average = 0. if array.size(array_lines) > 0 for i = 0 to array.size(array_lines) -1 array.unshift(array_average, line.get_price(array.get(array_lines, i), bar_index)) average := array.avg(array_average) [average] draw_lines(piv, array_piv_price, array_piv_index, array_lines, array_fill, col_lines, col_fill) => // //var linefill ln_fill = na max_bars_back(piv, 5000) if piv and last_bar_index - bar_index < maxX array.unshift(array_piv_price, piv ) array.unshift(array_piv_index, bar_index - right) // if array.size(array_piv_price) > 0 for i = 0 to array.size(array_piv_price) -1 x1 = array.get(array_piv_index, i) y1 = array.get(array_piv_price, i) x2 = array.get(array_piv_index, 0) y2 = array.get(array_piv_price, 0) // array.unshift (array_lines , line.new(x1, y1, x2, y2, color=col_lines, extend=extend.right)) if array.size(array_lines) > 500 line.delete(array.pop(array_lines)) line.delete(array.pop(array_lines)) if fill and array.size(array_lines) > 1 array.unshift(array_fill, linefill.new(array.get(array_lines, i + 1), array.get(array_lines, i), col_fill)) // if choice == 'ph' or choice == 'both' draw_lines(ph, a_php, a_phb, a_lh, a_lhF, c_lh, c_fh) [_avh] = calc_avg(a_lh, a_avh), avh := _avh if choice == 'pl' or choice == 'both' draw_lines(pl, a_plp, a_plb, a_ll, a_llF, c_ll, c_fl) [_avl] = calc_avg(a_ll, a_avl), avl := _avl if array.size(a_php) > max array.pop(a_php) array.pop(a_phb) if array.size(a_plp) > max array.pop(a_plp) array.pop(a_plb) plot((choice == 'ph' or choice == 'both') and avh > 0 ? avh : na, color=c_avh) plot((choice == 'pl' or choice == 'both') and avl > 0 ? avl : na, color=c_avl) plot((choice == 'ph' or choice == 'both') ? ph : na, color=c_pih, offset=-right) plot((choice == 'pl' or choice == 'both') ? pl : na, color=c_pil, offset=-right)
Add Volume of Multiple Securities
https://www.tradingview.com/script/GEz1EPA7-Add-Volume-of-Multiple-Securities/
joe.dodaro
https://www.tradingview.com/u/joe.dodaro/
102
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/ // © joe.dodaro //@version=5 indicator("Add Volume of Multiple Symbols") // ratio multiplies volume by any number you'd like, for any reason you'd like ratio = input(1.000000000) // these are the inputs for symbols symbolInput1 = input.symbol("", "Symbol1", inline = "sym1") symbolInput2 = input.symbol("", "Symbol2", inline = "sym2") symbolInput3 = input.symbol("", "Symbol3", inline = "sym3") symbolInput4 = input.symbol("", "Symbol4", inline = "sym4") symbolInput5 = input.symbol("", "Symbol5", inline = "sym5") symbolInput6 = input.symbol("", "Symbol6", inline = "sym6") symbolInput7 = input.symbol("", "Symbol7", inline = "sym7") symbolInput8 = input.symbol("", "Symbol8", inline = "sym8") symbolInput9 = input.symbol("", "Symbol9", inline = "sym9") symbolInput10 = input.symbol("", "Symbol10", inline = "sym10") symbolInput11 = input.symbol("", "Symbol11", inline = "sym11") symbolInput12 = input.symbol("", "Symbol12", inline = "sym12") symbolInput13 = input.symbol("", "Symbol13", inline = "sym13") symbolInput14 = input.symbol("", "Symbol14", inline = "sym14") symbolInput15 = input.symbol("", "Symbol15", inline = "sym15") symbolInput16 = input.symbol("", "Symbol16", inline = "sym16") symbolInput17 = input.symbol("", "Symbol17", inline = "sym17") symbolInput18 = input.symbol("", "Symbol18", inline = "sym18") symbolInput19 = input.symbol("", "Symbol19", inline = "sym19") symbolInput20 = input.symbol("", "Symbol20", inline = "sym20") symbolInput21 = input.symbol("", "Symbol21", inline = "sym21") symbolInput22 = input.symbol("", "Symbol22", inline = "sym22") symbolInput23 = input.symbol("", "Symbol23", inline = "sym23") symbolInput24 = input.symbol("", "Symbol24", inline = "sym24") symbolInput25 = input.symbol("", "Symbol25", inline = "sym25") symbolInput26 = input.symbol("", "Symbol26", inline = "sym26") symbolInput27 = input.symbol("", "Symbol27", inline = "sym27") symbolInput28 = input.symbol("", "Symbol28", inline = "sym28") symbolInput29 = input.symbol("", "Symbol29", inline = "sym29") symbolInput30 = input.symbol("", "Symbol30", inline = "sym30") symbolInput31 = input.symbol("", "Symbol31", inline = "sym31") symbolInput32 = input.symbol("", "Symbol32", inline = "sym32") symbolInput33 = input.symbol("", "Symbol33", inline = "sym33") symbolInput34 = input.symbol("", "Symbol34", inline = "sym34") symbolInput35 = input.symbol("", "Symbol35", inline = "sym35") symbolInput36 = input.symbol("", "Symbol36", inline = "sym36") symbolInput37 = input.symbol("", "Symbol37", inline = "sym37") symbolInput38 = input.symbol("", "Symbol38", inline = "sym38") symbolInput39 = input.symbol("", "Symbol39", inline = "sym39") //these are the options for choosing a symbol ... including in the calc or not symbol1= input(false, inline = "sym1") sym1= request.security(symbolInput1, timeframe.period, volume) symbol2= input(false, inline = "sym2") sym2= request.security(symbolInput2, timeframe.period, volume) symbol3= input(false, inline = "sym3") sym3= request.security(symbolInput3, timeframe.period, volume) symbol4= input(false, inline = "sym4") sym4= request.security(symbolInput4, timeframe.period, volume) symbol5= input(false, inline = "sym5") sym5= request.security(symbolInput5, timeframe.period, volume) symbol6= input(false, inline = "sym6") sym6= request.security(symbolInput6, timeframe.period, volume) symbol7= input(false, inline = "sym7") sym7= request.security(symbolInput7, timeframe.period, volume) symbol8= input(false, inline = "sym8") sym8= request.security(symbolInput8, timeframe.period, volume) symbol9= input(false, inline = "sym9") sym9= request.security(symbolInput9, timeframe.period, volume) symbol10= input(false, inline = "sym10") sym10= request.security(symbolInput10, timeframe.period, volume) symbol11= input(false, inline = "sym11") sym11= request.security(symbolInput11, timeframe.period, volume) symbol12= input(false, inline = "sym12") sym12= request.security(symbolInput12, timeframe.period, volume) symbol13= input(false, inline = "sym13") sym13= request.security(symbolInput13, timeframe.period, volume) symbol14= input(false, inline = "sym14") sym14= request.security(symbolInput14, timeframe.period, volume) symbol15= input(false, inline = "sym15") sym15= request.security(symbolInput15, timeframe.period, volume) symbol16= input(false, inline = "sym16") sym16= request.security(symbolInput16, timeframe.period, volume) symbol17= input(false, inline = "sym17") sym17= request.security(symbolInput17, timeframe.period, volume) symbol18= input(false, inline = "sym18") sym18= request.security(symbolInput18, timeframe.period, volume) symbol19= input(false, inline = "sym19") sym19= request.security(symbolInput19, timeframe.period, volume) symbol20= input(false, inline = "sym20") sym20= request.security(symbolInput20, timeframe.period, volume) symbol21= input(false, inline = "sym21") sym21= request.security(symbolInput21, timeframe.period, volume) symbol22= input(false, inline = "sym22") sym22= request.security(symbolInput22, timeframe.period, volume) symbol23= input(false, inline = "sym23") sym23= request.security(symbolInput23, timeframe.period, volume) symbol24= input(false, inline = "sym24") sym24= request.security(symbolInput24, timeframe.period, volume) symbol25= input(false, inline = "sym25") sym25= request.security(symbolInput25, timeframe.period, volume) symbol26= input(false, inline = "sym26") sym26= request.security(symbolInput26, timeframe.period, volume) symbol27= input(false, inline = "sym27") sym27= request.security(symbolInput27, timeframe.period, volume) symbol28= input(false, inline = "sym28") sym28= request.security(symbolInput28, timeframe.period, volume) symbol29= input(false, inline = "sym29") sym29= request.security(symbolInput29, timeframe.period, volume) symbol30= input(false, inline = "sym30") sym30= request.security(symbolInput30, timeframe.period, volume) symbol31= input(false, inline = "sym31") sym31= request.security(symbolInput31, timeframe.period, volume) symbol32= input(false, inline = "sym32") sym32= request.security(symbolInput32, timeframe.period, volume) symbol33= input(false, inline = "sym33") sym33= request.security(symbolInput33, timeframe.period, volume) symbol34= input(false, inline = "sym34") sym34= request.security(symbolInput34, timeframe.period, volume) symbol35= input(false, inline = "sym35") sym35= request.security(symbolInput35, timeframe.period, volume) symbol36= input(false, inline = "sym36") sym36= request.security(symbolInput36, timeframe.period, volume) symbol37= input(false, inline = "sym37") sym37= request.security(symbolInput37, timeframe.period, volume) symbol38= input(false, inline = "sym38") sym38= request.security(symbolInput38, timeframe.period, volume) symbol39= input(false, inline = "sym39") sym39= request.security(symbolInput39, timeframe.period, volume) // total combined volume amount defined vall = 0.0000000000 // ability to divide the individual inputs by the closing price of the candle // for crypto mainly - some volume is calculated in USD (a good example is the FTX BTCUSD pair) // allows you to convert the volume into "shares" (in this case amount of BTC instead of USD) sym1_divbyclose= input(false, inline = "sym1") sym1_ratio = 1.0000000000 if sym1_divbyclose sym1_ratio := close if symbol1 vall := vall + (sym1 / sym1_ratio) sym2_divbyclose= input(false, inline = "sym2") sym2_ratio = 1.0000000000 if sym2_divbyclose sym2_ratio := close if symbol2 vall := vall + (sym2 / sym2_ratio) sym3_divbyclose= input(false, inline = "sym3") sym3_ratio = 1.0000000000 if sym3_divbyclose sym3_ratio := close if symbol3 vall := vall + (sym3 / sym3_ratio) sym4_divbyclose= input(false, inline = "sym4") sym4_ratio = 1.0000000000 if sym4_divbyclose sym4_ratio := close if symbol4 vall := vall + (sym4 / sym4_ratio) sym5_divbyclose= input(false, inline = "sym5") sym5_ratio = 1.0000000000 if sym5_divbyclose sym5_ratio := close if symbol5 vall := vall + (sym5 / sym5_ratio) sym6_divbyclose= input(false, inline = "sym6") sym6_ratio = 1.0000000000 if sym6_divbyclose sym6_ratio := close if symbol6 vall := vall + (sym6 / sym6_ratio) sym7_divbyclose= input(false, inline = "sym7") sym7_ratio = 1.0000000000 if sym7_divbyclose sym7_ratio := close if symbol7 vall := vall + (sym7 / sym7_ratio) sym8_divbyclose= input(false, inline = "sym8") sym8_ratio = 1.0000000000 if sym8_divbyclose sym8_ratio := close if symbol8 vall := vall + (sym8 / sym8_ratio) sym9_divbyclose= input(false, inline = "sym9") sym9_ratio = 1.0000000000 if sym9_divbyclose sym9_ratio := close if symbol9 vall := vall + (sym9 / sym9_ratio) sym10_divbyclose= input(false, inline = "sym10") sym10_ratio = 1.0000000000 if sym10_divbyclose sym10_ratio := close if symbol10 vall := vall + (sym10 / sym10_ratio) sym11_divbyclose= input(false, inline = "sym11") sym11_ratio = 1.0000000000 if sym11_divbyclose sym11_ratio := close if symbol11 vall := vall + (sym11 / sym11_ratio) sym12_divbyclose= input(false, inline = "sym12") sym12_ratio = 1.0000000000 if sym12_divbyclose sym12_ratio := close if symbol12 vall := vall + (sym12 / sym12_ratio) sym13_divbyclose= input(false, inline = "sym13") sym13_ratio = 1.0000000000 if sym13_divbyclose sym13_ratio := close if symbol13 vall := vall + (sym13 / sym13_ratio) sym14_divbyclose= input(false, inline = "sym14") sym14_ratio = 1.0000000000 if sym14_divbyclose sym14_ratio := close if symbol14 vall := vall + (sym14 / sym14_ratio) sym15_divbyclose= input(false, inline = "sym15") sym15_ratio = 1.0000000000 if sym15_divbyclose sym15_ratio := close if symbol15 vall := vall + (sym15 / sym15_ratio) sym16_divbyclose= input(false, inline = "sym16") sym16_ratio = 1.0000000000 if sym16_divbyclose sym16_ratio := close if symbol16 vall := vall + (sym16 / sym16_ratio) sym17_divbyclose= input(false, inline = "sym17") sym17_ratio = 1.0000000000 if sym17_divbyclose sym17_ratio := close if symbol17 vall := vall + (sym17 / sym17_ratio) sym18_divbyclose= input(false, inline = "sym18") sym18_ratio = 1.0000000000 if sym18_divbyclose sym18_ratio := close if symbol18 vall := vall + (sym18 / sym18_ratio) sym19_divbyclose= input(false, inline = "sym19") sym19_ratio = 1.0000000000 if sym19_divbyclose sym19_ratio := close if symbol19 vall := vall + (sym19 / sym19_ratio) sym20_divbyclose= input(false, inline = "sym20") sym20_ratio = 1.0000000000 if sym20_divbyclose sym20_ratio := close if symbol20 vall := vall + (sym20 / sym20_ratio) sym21_divbyclose= input(false, inline = "sym21") sym21_ratio = 1.0000000000 if sym21_divbyclose sym21_ratio := close if symbol21 vall := vall + (sym21 / sym21_ratio) sym22_divbyclose= input(false, inline = "sym22") sym22_ratio = 1.0000000000 if sym22_divbyclose sym22_ratio := close if symbol22 vall := vall + (sym22 / sym22_ratio) sym23_divbyclose= input(false, inline = "sym23") sym23_ratio = 1.0000000000 if sym23_divbyclose sym23_ratio := close if symbol23 vall := vall + (sym23 / sym23_ratio) sym24_divbyclose= input(false, inline = "sym24") sym24_ratio = 1.0000000000 if sym24_divbyclose sym24_ratio := close if symbol24 vall := vall + (sym24 / sym24_ratio) sym25_divbyclose= input(false, inline = "sym25") sym25_ratio = 1.0000000000 if sym25_divbyclose sym25_ratio := close if symbol25 vall := vall + (sym25 / sym25_ratio) sym26_divbyclose= input(false, inline = "sym26") sym26_ratio = 1.0000000000 if sym26_divbyclose sym26_ratio := close if symbol26 vall := vall + (sym26 / sym26_ratio) sym27_divbyclose= input(false, inline = "sym27") sym27_ratio = 1.0000000000 if sym27_divbyclose sym27_ratio := close if symbol27 vall := vall + (sym27 / sym27_ratio) sym28_divbyclose= input(false, inline = "sym28") sym28_ratio = 1.0000000000 if sym28_divbyclose sym28_ratio := close if symbol28 vall := vall + (sym28 / sym28_ratio) sym29_divbyclose= input(false, inline = "sym29") sym29_ratio = 1.0000000000 if sym29_divbyclose sym29_ratio := close if symbol29 vall := vall + (sym29 / sym29_ratio) sym30_divbyclose= input(false, inline = "sym30") sym30_ratio = 1.0000000000 if sym30_divbyclose sym30_ratio := close if symbol30 vall := vall + (sym30 / sym30_ratio) sym31_divbyclose= input(false, inline = "sym31") sym31_ratio = 1.0000000000 if sym31_divbyclose sym31_ratio := close if symbol31 vall := vall + (sym31 / sym31_ratio) sym32_divbyclose= input(false, inline = "sym32") sym32_ratio = 1.0000000000 if sym32_divbyclose sym32_ratio := close if symbol32 vall := vall + (sym32 / sym32_ratio) sym33_divbyclose= input(false, inline = "sym33") sym33_ratio = 1.0000000000 if sym33_divbyclose sym33_ratio := close if symbol33 vall := vall + (sym33 / sym33_ratio) sym34_divbyclose= input(false, inline = "sym34") sym34_ratio = 1.0000000000 if sym34_divbyclose sym34_ratio := close if symbol34 vall := vall + (sym34 / sym34_ratio) sym35_divbyclose= input(false, inline = "sym35") sym35_ratio = 1.0000000000 if sym35_divbyclose sym35_ratio := close if symbol35 vall := vall + (sym35 / sym35_ratio) sym36_divbyclose= input(false, inline = "sym36") sym36_ratio = 1.0000000000 if sym36_divbyclose sym36_ratio := close if symbol36 vall := vall + (sym36 / sym36_ratio) sym37_divbyclose= input(false, inline = "sym37") sym37_ratio = 1.0000000000 if sym37_divbyclose sym37_ratio := close if symbol37 vall := vall + (sym37 / sym37_ratio) sym38_divbyclose= input(false, inline = "sym38") sym38_ratio = 1.0000000000 if sym38_divbyclose sym38_ratio := close if symbol38 vall := vall + (sym38 / sym38_ratio) sym39_divbyclose= input(false, inline = "sym39") sym39_ratio = 1.0000000000 if sym39_divbyclose sym39_ratio := close if symbol39 vall := vall + (sym38 / sym39_ratio) // Plot for volume & for volume 20ma plot(vall*ratio, style=plot.style_histogram) plot(ta.sma(vall*ratio,20),style=plot.style_line)
Kijun Trend Indicator
https://www.tradingview.com/script/T1thPUYt-Kijun-Trend-Indicator/
TheSocialCryptoClub
https://www.tradingview.com/u/TheSocialCryptoClub/
228
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/ // © TheSocialCryptoClub [email protected] //@version=5 indicator("Kijun Trend Indicator", overlay=true) // input myline_periods = input.int(defval=26, title="Lenght") myline_type = input.string(defval="Kijun", options=["Kijun", "SMA", "EMA"], title="Type") // default myline color var myline_color = color.black // default line is Kijun myline = math.avg(ta.lowest(low, myline_periods),ta.highest(high, myline_periods)) // or SMA myline := myline_type == "SMA" ? ta.sma(close,myline_periods) : myline // or EMA myline := myline_type == "EMA" ? ta.ema(close,myline_periods) : myline // filter conditions long = low[1]>myline[1] and low[2]>myline[2] and low[3] <= myline[3] short = high[1]<myline[1] and high[2]<myline[2] and high[3]>= myline[3] // color the line myline_color := long ? color.blue : myline_color myline_color := short ? color.red : myline_color // plot plot(myline, color=myline_color, linewidth=2, title="Kijun Trend Indicator")
Consensio
https://www.tradingview.com/script/bW5ipLjD-Consensio/
Ben_Neumann
https://www.tradingview.com/u/Ben_Neumann/
37
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © bneumann //@version=5 indicator("consensio", overlay=true) // MA inputs short = input(2, "Short MA") mid = input(7, "Mid MA") long = input(30, "Long MA") // MA s = ta.sma(close, short) m = ta.sma(close, mid) l = ta.sma(close, long) // Plot MA plot(s, "SHORT", color.lime, linewidth=1) plot(m, "MID", color.orange, linewidth=1) plot(l, "LONG", color.blue, linewidth=1) // Label direction function direction(txt, label_color) => _label = label.new(bar_index, na) label.set_text(_label, txt) label.set_textcolor(_label, label_color) label.set_yloc(_label, yloc.abovebar) label.set_style(_label, label.style_none) // Bullish candle conditions if (l > l[1] and m > m[1] and s > s[1]) direction("4", color.green) if (l > l[1] and m < m[1] and s > s[1]) direction("3", color.green) if (l > l[1] and m > m[1] and s < s[1]) direction("2", color.green) if (l > l[1] and m < m[1] and s < s[1]) direction("1", color.green) // Bearish candle conditions if (l < l[1] and m > m[1] and s > s[1]) direction("1", color.red) if (l < l[1] and m < m[1] and s > s[1]) txt = label.new(bar_index, na) direction("2", color.red) if (l < l[1] and m > m[1] and s < s[1]) direction("3", color.red) if (l < l[1] and m < m[1] and s < s[1]) direction("4", color.red) //add signal function signal(label_color) => _label = label.new(bar_index, na) label.set_color(_label, label_color) label.set_yloc(_label, yloc.belowbar) label.set_style(_label, label.style_diamond) // signal conditions if l > m and l[1] < m[1] signal(color.red) if s > l and s[1] < l [1] and m < l signal(color.orange) if s < l and s[1] > l[1] and m > l signal(color.orange) if s < m and s[1] > m[1] and m > l signal(color.yellow) if s > m and s[1] < m[1] and m > l signal(color.green) if l < m and l[1] > m[1] and s > m signal(color.green)
Harmonic Pattern Detection [LuxAlgo]
https://www.tradingview.com/script/IfTGj063-Harmonic-Pattern-Detection-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
4,675
study
5
CC-BY-NC-SA-4.0
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // © LuxAlgo //@version=5 indicator("Harmonic Pattern Detection [LuxAlgo]",overlay=true) precision = input.float(.01,'XA Precision',step=0.01,group='Precision') bullish = input(#0cb51a,'Bullish',group='style') bearish = input(#ff1100,'Bullish',group='style') x = input.time(0,'X',confirm=true,group='Anchor Points') a = input.time(0,'A',confirm=true,group='Anchor Points') b = input.time(0,'B',confirm=true,group='Anchor Points') c = input.time(0,'C',confirm=true,group='Anchor Points') d = input.time(0,'D',confirm=true,group='Anchor Points') //---- x_y = ta.valuewhen(time==x,close,0) a_y = ta.valuewhen(time==a,close,0) b_y = ta.valuewhen(time==b,close,0) c_y = ta.valuewhen(time==c,close,0) //---- dist(fib)=> d_y = a_y + fib*(x_y - a_y) cd = math.abs(d_y-c_y)/math.abs(c_y-b_y) ab = math.abs(a_y-b_y)/math.abs(a_y-x_y) bc = math.abs(c_y-b_y)/math.abs(a_y-b_y) //---- var tb = table.new(position.top_right,2,4,bgcolor=color.gray) var float upper_prz = na var float lower_prz = na var float d_y = na if time == math.max(x,a,b,c) css = x_y > a_y ? bearish : bullish line.new(x,x_y,a,a_y,xloc=xloc.bar_time,color=css,width=2) line.new(a,a_y,b,b_y,xloc=xloc.bar_time,color=css,width=2) line.new(b,b_y,c,c_y,xloc=xloc.bar_time,color=css,width=2) line.new(x,x_y,b,b_y,xloc=xloc.bar_time,color=css,style=line.style_dotted) line.new(x,x_y,b,b_y,xloc=xloc.bar_time,color=css,style=line.style_dotted) line.new(a,a_y,c,c_y,xloc=xloc.bar_time,color=css,style=line.style_dotted) //---- label.new(x,x_y,'X',xloc=xloc.bar_time,color=css,style=x_y > a_y ? label.style_label_down : label.style_label_up ,textcolor=color.white,size=size.small) label.new(a,a_y,'A',xloc=xloc.bar_time,color=css,style=x_y > a_y ? label.style_label_up : label.style_label_down ,textcolor=color.white,size=size.small) label.new(b,b_y,'B',xloc=xloc.bar_time,color=css,style=x_y > a_y ? label.style_label_down : label.style_label_up ,textcolor=color.white,size=size.small) label.new(c,c_y,'C',xloc=xloc.bar_time,color=css,style=x_y > a_y ? label.style_label_up : label.style_label_down ,textcolor=color.white,size=size.small) AB_tooltip = '🦇 0.382-0.5 \n📏 ≈ 0.618 \n🦋 ≈ 0.786 \n🦀 0.382-0.618' BC_tooltip = '🦇 0.382-0.886 \n📏 0.382-0.886 \n🦋 0.382-0.886 \n🦀 0.382-0.886' CD_tooltip = '🦇 1.618-2.618 \n📏 1.130-1.618 \n🦋 1.618-2.240 \n🦀 2.618-3.618' label.new(int(math.avg(x,b)),math.avg(x_y,b_y),str.tostring(ab,'#.###'),xloc=xloc.bar_time,color=css,style=label.style_label_center ,textcolor=color.white,size=size.small,tooltip=AB_tooltip) label.new(int(math.avg(a,c)),math.avg(a_y,c_y),str.tostring(bc,'#.###'),xloc=xloc.bar_time,color=css,style=label.style_label_center ,textcolor=color.white,size=size.small,tooltip=BC_tooltip) //---- table.cell(tb,0,0,'🦇 Bat',text_color=color.white,text_halign=text.align_left) table.cell(tb,0,1,'📏 Gartley',text_color=color.white,text_halign=text.align_left) table.cell(tb,0,2,'🦋 Butterfly',text_color=color.white,text_halign=text.align_left) table.cell(tb,0,3,'🦀 Crab',text_color=color.white,text_halign=text.align_left) //Bat if ab > 0.382 and ab < .5 and bc > 0.382 and bc < 0.886 and dist(0.886) > 1.618 and dist(0.886) < 2.618 table.cell(tb,1,0,'✔️') table.cell(tb,1,1,'❌') table.cell(tb,1,2,'❌') table.cell(tb,1,3,'❌') d_y := a_y + 0.886*(x_y - a_y) cd = math.abs(d_y-c_y)/math.abs(c_y-b_y) line.new(c,c_y,d,d_y,xloc=xloc.bar_time,color=css,width=2) line.new(b,b_y,d,d_y,xloc=xloc.bar_time,color=css,style=line.style_dotted) label.new(d,d_y,'D',xloc=xloc.bar_time,color=css,style=x_y > a_y ? label.style_label_down : label.style_label_up ,textcolor=color.white,size=size.small) label.new(int(math.avg(d,b)),math.avg(d_y,b_y),str.tostring(cd,'#.###'),xloc=xloc.bar_time,color=css,style=label.style_label_center ,textcolor=color.white,size=size.small,tooltip=CD_tooltip) //Gartley else if ab > 0.618-precision and ab < 0.618+precision and bc > 0.382 and bc < 0.886 and dist(0.786) > 1.13 and dist(0.786) < 1.618 table.cell(tb,1,0,'❌') table.cell(tb,1,1,'✔️') table.cell(tb,1,2,'❌') table.cell(tb,1,3,'❌') d_y := a_y + 0.786*(x_y - a_y) cd = math.abs(d_y-c_y)/math.abs(c_y-b_y) line.new(c,c_y,d,d_y,xloc=xloc.bar_time,color=css,width=2) line.new(b,b_y,d,d_y,xloc=xloc.bar_time,color=css,style=line.style_dotted) label.new(d,d_y,'D',xloc=xloc.bar_time,color=css,style=x_y > a_y ? label.style_label_down : label.style_label_up ,textcolor=color.white,size=size.small) label.new(int(math.avg(d,b)),math.avg(d_y,b_y),str.tostring(cd,'#.###'),xloc=xloc.bar_time,color=css,style=label.style_label_center ,textcolor=color.white,size=size.small,tooltip=CD_tooltip) //Butterfly else if ab > 0.786-precision and ab < 0.786+precision and bc > 0.382 and bc < 0.886 and dist(1.27) > 1.618 and dist(1.27) < 2.24 table.cell(tb,1,0,'❌') table.cell(tb,1,1,'❌') table.cell(tb,1,2,'✔️') table.cell(tb,1,3,'❌') d_y := a_y + 1.27*(x_y - a_y) cd = math.abs(d_y-c_y)/math.abs(c_y-b_y) line.new(c,c_y,d,d_y,xloc=xloc.bar_time,color=css,width=2) line.new(b,b_y,d,d_y,xloc=xloc.bar_time,color=css,style=line.style_dotted) label.new(d,d_y,'D',xloc=xloc.bar_time,color=css,style=x_y > a_y ? label.style_label_down : label.style_label_up ,textcolor=color.white,size=size.small) label.new(int(math.avg(d,b)),math.avg(d_y,b_y),str.tostring(cd,'#.###'),xloc=xloc.bar_time,color=css,style=label.style_label_center ,textcolor=color.white,size=size.small,tooltip=CD_tooltip) //Crab else if ab > 0.382 and ab < .618 and bc > 0.382 and bc < 0.886 and dist(1.618) > 2.224 and dist(1.618) < 3.618 table.cell(tb,1,0,'❌') table.cell(tb,1,1,'❌') table.cell(tb,1,2,'❌') table.cell(tb,1,3,'✔️') d_y := a_y + 1.618*(x_y - a_y) cd = math.abs(d_y-c_y)/math.abs(c_y-b_y) line.new(c,c_y,d,d_y,xloc=xloc.bar_time,color=css,width=2) line.new(b,b_y,d,d_y,xloc=xloc.bar_time,color=css,style=line.style_dotted) label.new(d,d_y,'D',xloc=xloc.bar_time,color=css,style=x_y > a_y ? label.style_label_down : label.style_label_up ,textcolor=color.white,size=size.small) label.new(int(math.avg(d,b)),math.avg(d_y,b_y),str.tostring(cd,'#.###'),xloc=xloc.bar_time,color=css,style=label.style_label_center ,textcolor=color.white,size=size.small,tooltip=CD_tooltip) else table.cell(tb,1,0,'❌') table.cell(tb,1,1,'❌') table.cell(tb,1,2,'❌') table.cell(tb,1,3,'❌') d_y := a_y + 0.886*(x_y - a_y) cd = math.abs(d_y-c_y)/math.abs(c_y-b_y) line.new(c,c_y,d,d_y,xloc=xloc.bar_time,color=css,width=2) line.new(b,b_y,d,d_y,xloc=xloc.bar_time,color=css,style=line.style_dotted) label.new(d,d_y,'D',xloc=xloc.bar_time,color=css,style=x_y > a_y ? label.style_label_down : label.style_label_up ,textcolor=color.white,size=size.small) label.new(int(math.avg(d,b)),math.avg(d_y,b_y),str.tostring(cd,'#.###'),xloc=xloc.bar_time,color=css,style=label.style_label_center ,textcolor=color.white,size=size.small,tooltip=CD_tooltip) upper_prz := d_y + 0.382*math.abs(d_y - x_y) lower_prz := d_y - 0.382*math.abs(d_y - x_y) box.new(x,upper_prz,d,lower_prz,border_color=na,xloc=xloc.bar_time,bgcolor=color.new(css,80),extend=extend.both) line.new(x,x_y,d,d_y,xloc=xloc.bar_time,color=css,style=line.style_dotted) //Alerts alertcondition(ta.crossover(close,lower_prz) or ta.crossunder(close,upper_prz),'Price Enter PRZ','Price entered the PRZ') alertcondition(ta.cross(close,d_y),'Price Cross D','Price crossed point D') //PRZ Plots plot(upper_prz,'Upper PRZ',na) plot(lower_prz,'Lower PRZ',na)
Higher Timeframe EMAs - 21/50/100/200
https://www.tradingview.com/script/9FQXN482-Higher-Timeframe-EMAs-21-50-100-200/
degharbi
https://www.tradingview.com/u/degharbi/
38
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/ // modifed from © ZenAndTheArtOfTrading //@version=4 study(title="Higher Timeframe EMA (HTF EMA)", shorttitle="EMA+", overlay=true) // Get user input res = input(title="EMA Timeframe", type=input.resolution, defval="D") len1 = input(title="EMA Length", type=input.integer, defval=21) len2 = input(title="EMA Length", type=input.integer, defval=50) len3 = input(title="EMA Length", type=input.integer, defval=100) len4 = input(title="EMA Length", type=input.integer, defval=200) col = input(title="Color EMA", type=input.bool, defval=true) smooth = input(title="Smooth", type=input.bool, defval=false) // Calculate EMA ema1 = ema(close, len1) ema2 = ema(close, len2) ema3 = ema(close, len3) ema4 = ema(close, len4) emaStep1 = security(syminfo.tickerid, res, ema1[barstate.isrealtime ? 1 : 0]) emaSmooth1 = security(syminfo.tickerid, res, ema1[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_on) plot(smooth ? emaSmooth1 : emaStep1, color=col ? (close > emaStep1 ? color.green : color.red) : color.black, linewidth=2, title="HTF EMA21") emaStep2 = security(syminfo.tickerid, res, ema2[barstate.isrealtime ? 1 : 0]) emaSmooth2 = security(syminfo.tickerid, res, ema2[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_on) plot(smooth ? emaSmooth2 : emaStep2, color=col ? (close > emaStep2 ? color.green : color.red) : color.black, linewidth=2, title="HTF EMA50") emaStep3 = security(syminfo.tickerid, res, ema3[barstate.isrealtime ? 1 : 0]) emaSmooth3 = security(syminfo.tickerid, res, ema3[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_on) plot(smooth ? emaSmooth3 : emaStep3, color=col ? (close > emaStep3 ? color.green : color.red) : color.black, linewidth=2, title="HTF EMA100") emaStep4 = security(syminfo.tickerid, res, ema4[barstate.isrealtime ? 1 : 0]) emaSmooth4 = security(syminfo.tickerid, res, ema4[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_on) plot(smooth ? emaSmooth4 : emaStep4, color=col ? (close > emaStep4 ? color.green : color.red) : color.black, linewidth=2, title="HTF EMA200")
Tarot : Major Arcana
https://www.tradingview.com/script/KqteFqSG-Tarot-Major-Arcana/
ByzantineSC
https://www.tradingview.com/u/ByzantineSC/
23
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ByzantineSC //@version=5 indicator("Tarot Major Arcana", overlay=true) ///Candle Division candleup = high-low ///division slice = candleup/22 ///Major Arcana UP fool_up = (close <= low+(slice)) and (close >= low) magi_up = (close <= low+(slice*2)) and (close >= (low+slice)) high_up = (close <= low+(slice*3)) and (close >= (low+slice*2)) emps_up = (close <= low+(slice*4)) and (close >= (low+slice*3)) empr_up = (close <= low+(slice*5)) and (close >= (low+slice*4)) hier_up = (close <= low+(slice*6)) and (close >= (low+slice*5)) love_up = (close <= low+(slice*7)) and (close >= (low+slice*6)) char_up = (close <= low+(slice*8)) and (close >= (low+slice*7)) stre_up = (close <= low+(slice*9)) and (close >= (low+slice*8)) herm_up = (close <= low+(slice*10)) and (close >= (low+slice*9)) whee_up = (close <= low+(slice*11)) and (close >= (low+slice*10)) just_up = (close <= low+(slice*12)) and (close >= (low+slice*11)) hang_up = (close <= low+(slice*13)) and (close >= (low+slice*12)) deat_up = (close <= low+(slice*14)) and (close >= (low+slice*13)) temp_up = (close <= low+(slice*15)) and (close >= (low+slice*14)) devi_up = (close <= low+(slice*16)) and (close >= (low+slice*15)) towe_up = (close <= low+(slice*17)) and (close >= (low+slice*16)) star_up = (close <= low+(slice*18)) and (close >= (low+slice*17)) moon_up = (close <= low+(slice*19)) and (close >= (low+slice*18)) sun_up = (close <= low+(slice*20)) and (close >= (low+slice*19)) judg_up = (close <= low+(slice*21)) and (close >= (low+slice*20)) worl_up = (close <= high) and (close >= (low+slice*21)) //plotcard fool_u = fool_up plotchar(fool_u, char='😀', text='Fool', location=location.abovebar) magi_u = magi_up plotchar(magi_u, char='🔮', text='Magi', location=location.abovebar) high_u = high_up plotchar(high_u, char='🧿', text='High', location=location.abovebar) emps_u = emps_up plotchar(emps_u, char='♀️', text='Emps', location=location.abovebar) empr_u = empr_up plotchar(empr_u, char='♂️', text='Empr', location=location.abovebar) hier_u = hier_up plotchar(hier_u, char='🕍', text='Hier', location=location.abovebar) love_u = love_up plotchar(love_u, char='💑', text='Love', location=location.abovebar) char_u = char_up plotchar(char_u, char='🚚', text='Char', location=location.abovebar) stre_u = stre_up plotchar(stre_u, char='💪', text='Stre', location=location.abovebar) herm_u = herm_up plotchar(herm_u, char='🧙', text='Herm', location=location.abovebar) whee_u = whee_up plotchar(whee_u, char='🎡', text='Whee', location=location.abovebar) just_u = just_up plotchar(just_u, char='⚖️', text='Just', location=location.abovebar) hang_u = hang_up plotchar(hang_u, char='🙃', text='Hang', location=location.abovebar) deat_u = deat_up plotchar(deat_u, char='💀', text='Deat', location=location.abovebar) temp_u = temp_up plotchar(temp_u, char='👼', text='Temp', location=location.abovebar) devi_u = devi_up plotchar(devi_u, char='😈', text='Devi', location=location.abovebar) towe_u = towe_up plotchar(towe_u, char="⚡" ,text='Towe', location=location.abovebar) star_u = star_up plotchar(star_u, char='🌟', text='Star', location=location.abovebar) moon_u = moon_up plotchar(moon_u, char='🌜', text='Moon', location=location.abovebar) sun_u = sun_up plotchar(sun_u, char='🌞', text='Sun', location=location.abovebar) judg_u = judg_up plotchar(judg_u, char='👥', text='Judg', location=location.abovebar) worl_u = worl_up plotchar(worl_u, char='🌎', text='Worl', location=location.abovebar)
Delta Agnostic Correlation Coefficient
https://www.tradingview.com/script/HsnopNsy-Delta-Agnostic-Correlation-Coefficient/
alexjvale
https://www.tradingview.com/u/alexjvale/
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/ // © alexjvale //@version=5 indicator("Delta-Agnostic Correlation Coefficient") index = input.symbol("INDEX:BTCUSD", "Index") sma_length = input.int(20, "SMA Length", minval=5, maxval=52, step=1) index_current = request.security(index, "", close) index_previous = request.security(index, "", close[1]) target_current = close target_previous = close[1] index_delta = index_current - index_previous target_delta = target_current - target_previous dcc = 0 if (math.sign(index_delta) == math.sign(target_delta)) dcc := 1 else dcc := -1 dcc_sma = ta.sma(dcc, sma_length) plot(dcc_sma, "DCC", color.blue, 1, plot.style_areabr) hline(1) hline(0) hline(-1)
Gann Fan
https://www.tradingview.com/script/Bara2GrN-Gann-Fan/
LonesomeTheBlue
https://www.tradingview.com/u/LonesomeTheBlue/
2,722
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("Gann Fan", overlay = true, max_bars_back = 400) // get colors into the array var color [] colors = array.from( input(defval = color.red, title = "1/2", inline = "c1", group = "colors"), input(defval = color.green, title = "1/3", inline = "c1", group = "colors"), input(defval = #0097a7, title = "1/", inline = "c1", group = "colors"), input(defval = color.olive, title = "1/8", inline = "c1", group = "colors"), input(defval = color.teal, title = "2/1", inline = "c2", group = "colors"), input(defval = #9598a1, title = "3/1", inline = "c2", group = "colors"), input(defval = color.yellow, title = "4/1", inline = "c2", group = "colors"), input(defval = #a5d6a7, title = "8/1", inline = "c2", group = "colors"), input(defval = color.blue, title = "1/1", inline = "c3", group = "colors")) //Transparency or the bg colors transp = input.int(defval = 80, title = "Transparency", minval = 0, maxval = 100, tooltip = "Possible values are from 0 (not transparent) to 100 (invisible)") // labels showlabels = input.bool(defval = true, title = "Labels", inline = "labels") labelloc = input.int(defval = 50, title = "| Label location", minval = 1, maxval = 300, inline = "labels") lstyle1i = input.string(defval = 'Solid', title = "Line Style", options = ['Solid', 'Dashed', 'Dotted'], inline = "lstyle") lstyle2i = input.string(defval = 'Dashed', title = "", options = ['Solid', 'Dashed', 'Dotted'], inline = "lstyle") loopbackprd = input.int(defval = 280, title = "Loopback Period", tooltip = "Loopback period to search Highest/Lowest Pivot Points") pperiod = input.int(defval = 5, title = "Pivot Period") // calculate middle line, using this line we will calculate other lines float l_ = ta.lowest(292) float h_ = ta.highest(292) float perc = (h_ - l_) /82 float hh = h_ + perc * 10 float ll = l_ - perc * 8 float middle = (hh - ll) / 131.0 var lstyle1 = lstyle1i == 'Solid' ? line.style_solid : lstyle1i == 'Dashed' ? line.style_dashed : line.style_dotted var lstyle2 = lstyle2i == 'Solid' ? line.style_solid : lstyle2i == 'Dashed' ? line.style_dashed : line.style_dotted // levels var divs = array.from(2.0, 3.0, 4.0, 8.0) // remove old pivot points remove_old_pivots(pval, ploc)=> for x = array.size(ploc) - 1 to 0 if bar_index - array.get(ploc, x) > loopbackprd array.pop(ploc) array.pop(pval) // get highest/lowest locations var pivothighs = array.new_float(0, na) var pivothighsloc = array.new_int(0, na) var pivotlows = array.new_float(0, na) var pivotlowsloc = array.new_int(0, na) ph = ta.pivothigh(pperiod, pperiod) pl = ta.pivotlow(pperiod, pperiod) if ph array.unshift(pivothighsloc, bar_index - pperiod) array.unshift(pivothighs, ph) remove_old_pivots(pivothighs, pivothighsloc) if pl array.unshift(pivotlowsloc, bar_index - pperiod) array.unshift(pivotlows, pl) remove_old_pivots(pivotlows, pivotlowsloc) l_bar_index = array.size(pivotlowsloc) > 0 ? array.get(pivotlowsloc, array.lastindexof(pivotlows, array.min(pivotlows))) : na h_bar_index = array.size(pivothighsloc) > 0 ? array.get(pivothighsloc, array.lastindexof(pivothighs, array.max(pivothighs))) : na lwest = low[bar_index - l_bar_index] hghest = high[bar_index - h_bar_index] // get line style get_style(x)=> x == 1 ? l_bar_index <= h_bar_index ? lstyle1 : lstyle2 : l_bar_index > h_bar_index ? lstyle1 : lstyle2 // remove old lines/labels/linefills remove_old_lll(lines, labels, linefills)=> for x = 0 to array.size(lines) - 1 line.delete(array.get(lines, x)) for x = 0 to array.size(labels) - 1 label.delete(array.get(labels, x)) for x = 0 to array.size(linefills) - 1 linefill.delete(array.get(linefills, x)) // get bar_index using y location and start point line_get_bar_index(gline, x_bar_index, yloc, mult)=> ystart = line.get_price(gline, x_bar_index) slope = math.abs(ystart - line.get_price(gline, x_bar_index + 1)) int ret = x_bar_index + math.floor((yloc - ystart) / slope) * mult // draw fan lines from lowest if l_bar_index > 0 and l_bar_index < bar_index var uplines = array.new_line(9, na) var ulinefill = array.new_linefill(8, na) var labels = array.new_label(9, na) remove_old_lll(uplines, labels, ulinefill) // draw 1/1 line, show its label and keep its y level array.set(uplines, 0, line.new(x1 = l_bar_index, y1 = lwest, x2 = l_bar_index + 1, y2 = lwest + middle, extend = extend.right, color = array.get(colors, 8), style = get_style(1))) xloc = l_bar_index + labelloc yloc11 = line.get_price(array.get(uplines, 0), xloc) if showlabels array.set(labels, 0, label.new(x = xloc, y = yloc11, text = "1/1", textcolor = array.get(colors, 8), style = label.style_none)) // draw other fan lines, labels, linefills for x = 0 to 3 array.set(uplines, x + 1, line.new(x1 = l_bar_index, y1 = lwest, x2 = bar_index, y2 = lwest + (line.get_price(array.get(uplines, 0), bar_index) - lwest) / array.get(divs,x), extend = extend.right, color = array.get(colors, x), style = get_style(1))) array.set(ulinefill, x, linefill.new(array.get(uplines, x + 1), array.get(uplines, x), color.new(array.get(colors, x), transp))) if showlabels yloc = line.get_price(array.get(uplines, x + 1), xloc) array.set(labels, x + 1, label.new(x = xloc, y = yloc, text = "1/" + str.tostring(array.get(divs, x)), textcolor = array.get(colors, x), style = label.style_none)) array.set(uplines, x + 5, line.new(x1 = l_bar_index, y1 = lwest, x2 = l_bar_index + 1, y2 = lwest + middle * array.get(divs,x), extend = extend.right, color = array.get(colors, x + 4), style = get_style(1))) array.set(ulinefill, x + 4, linefill.new(array.get(uplines, x + 5), array.get(uplines, x == 0 ? 0 : x + 4), color.new(array.get(colors, x + 4), transp))) if showlabels xlocc = line_get_bar_index(array.get(uplines, x + 5), l_bar_index, yloc11, 1) array.set(labels, x + 5, label.new(x = xlocc, y = yloc11, text = str.tostring(array.get(divs, x)) + "/1", textcolor = array.get(colors, x + 4), style = label.style_none)) // draw fan lines from highest if h_bar_index > 0 and h_bar_index < bar_index var downlines = array.new_line(9, na) var labels = array.new_label(9, na) var dlinefill = array.new_linefill(8, na) remove_old_lll(downlines, labels, dlinefill) // draw 1/1 line, show its label and keep its y level array.set(downlines, 0, line.new(x1 = h_bar_index, y1 = hghest, x2 = h_bar_index + 1, y2 = hghest - middle, extend = extend.right, color = array.get(colors, 8), style = get_style(2))) xloc = h_bar_index + labelloc yloc11 = line.get_price(array.get(downlines, 0), xloc) if showlabels array.set(labels, 0, label.new(x = xloc, y = yloc11, text = "1/1", textcolor = array.get(colors, 8), style = label.style_none)) // draw other fan lines, labels, linefills for x = 0 to 3 array.set(downlines, x + 1, line.new(x1 = h_bar_index, y1 = hghest, x2 = bar_index, y2 = hghest - (hghest - line.get_price(array.get(downlines, 0), bar_index)) / array.get(divs,x), extend = extend.right, color = array.get(colors, x + 4), style = get_style(2))) array.set(dlinefill, x, linefill.new(array.get(downlines, x + 1), array.get(downlines, x), color.new(array.get(colors, x + 4), transp))) if showlabels yloc = line.get_price(array.get(downlines, x + 1), xloc) array.set(labels, x + 1, label.new(x = xloc, y = yloc, text = str.tostring(array.get(divs, x)) + "/1", textcolor = array.get(colors, x + 4), style = label.style_none)) array.set(downlines, x + 5, line.new(x1 = h_bar_index, y1 = hghest, x2 = h_bar_index + 1, y2 = hghest - middle * array.get(divs,x), extend = extend.right, color = array.get(colors, x), style = get_style(2))) array.set(dlinefill, x + 4, linefill.new(array.get(downlines, x + 5), array.get(downlines, x == 0 ? 0 : x + 4), color.new(array.get(colors, x), transp))) if showlabels xlocc = line_get_bar_index(array.get(downlines, x + 5), h_bar_index, yloc11, -1) array.set(labels, x + 5, label.new(x = xlocc, y = yloc11, text = "1/" + str.tostring(array.get(divs, x)), textcolor = array.get(colors, x), style = label.style_none))
Relative Strength with S&P500
https://www.tradingview.com/script/nTyysz1J-Relative-Strength-with-S-P500/
Jignesh_Charlotte
https://www.tradingview.com/u/Jignesh_Charlotte/
80
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/ // © jignesh Mend //@version=4 study("Relative Strength_SPX", shorttitle="Relative Strength_SPX") //Input source = input(title="Source", type=input.source, defval=close) comparativeTickerId = input("SP:SPX", type=input.symbol, title="Comparative Symbol") length = input(123, type=input.integer, minval=1, title="Period") showZeroLine = input(defval=true, type=input.bool, title="Show Zero Line") showRefDateLbl = input(defval=true, type=input.bool, title="Show Reference Label") toggleRSColor = input(defval=true, type=input.bool, title="Toggle RS color on crossovers") showRSTrend = input(defval=false, type=input.bool, title="RS Trend,", group="RS Trend", inline="RS Trend") base = input(title="Range", minval=1, defval=5, group="RS Trend", inline="RS Trend") showMA = input(defval=false, type=input.bool, title="Show Moving Average,", group="RS Mean", inline="RS Mean") lengthMA = input(61, type=input.integer, minval=1, title="Period", group="RS Mean", inline="RS Mean") //Set up baseSymbol = security(syminfo.tickerid, timeframe.period, source) comparativeSymbol = security(comparativeTickerId, timeframe.period, source) //Calculations res = ((baseSymbol/baseSymbol[length])/(comparativeSymbol/comparativeSymbol[length]) - 1) resColor = toggleRSColor ? res > 0 ? color.green : color.red : color.blue refDay = showRefDateLbl and barstate.islast ? dayofmonth(time[length]) : na refMonth = showRefDateLbl and barstate.islast ? month(time[length]) : na refYear = showRefDateLbl and barstate.islast ? year(time[length]) : na refLabelStyle = res[length] > 0 ? label.style_label_up : label.style_label_down refDateLabel = showRefDateLbl and barstate.islast ? label.new(bar_index - length, 0, text="RS-" + tostring(length) + " reference, " + tostring(refDay) + "-" + tostring(refMonth) + "-" + tostring(refYear), color=color.blue, style=refLabelStyle, yloc=yloc.price) : na y0 = res - res[base] angle0 = atan(y0/base) // radians zeroLineColor = iff(showRSTrend, angle0 > 0.0 ? color.green : color.maroon, color.maroon) //Plot plot(showZeroLine ? 0 : na, linewidth=2, color=zeroLineColor, title="Zero Line / RS Trend") plot(res, title="RS", linewidth=2, color= resColor) plot(showMA ? sma(res, lengthMA) : na, color=color.gray, title="MA")
9/26/52 EMA
https://www.tradingview.com/script/kUq2QP30-9-26-52-EMA/
theforlornson
https://www.tradingview.com/u/theforlornson/
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/ // © theforlornson //@version=5 indicator("9/26/52 EMA", overlay=true) // EMA variables assignment ema1 = ta.ema(close, 9) ema2 = ta.ema(close, 21) ema3 = ta.ema(close, 55) emaTrend = ta.ema(close, 200) // 12/26 EMA crossover emaC1 = ta.ema(close, 12) emaC2 = ta.ema(close, 26) //Defining crossovers bool cUp = ta.crossover(ema2, emaTrend) //and ema1 > ema2 bool cDown = ta.crossunder(ema2,emaTrend) //and ema1 < ema2 //Defining macd Crossovers macdCU = ta.crossover(emaC1,emaC2) macdCD = ta.crossunder(emaC1,emaC2) // Drawing the lines plot(ema1, color=color.green, linewidth=1) plot(ema2, color=color.orange, linewidth=1) plot(ema3, color=color.purple, linewidth=1) plot(emaTrend, color=color.black, linewidth=2) // Drawing Crossovers plotshape(cUp ? 1 : na, style=shape.triangleup, color=color.green, location=location.belowbar, size=size.normal) plotshape(cDown ? 1 : na, style=shape.triangledown, color=color.red, location=location.abovebar, size=size.normal) plotshape(macdCU ? 1 : na, style=shape.cross, color=color.green, location=location.belowbar, size=size.small) plotshape(macdCD ? 1 : na, style=shape.cross, color=color.red, location=location.abovebar, size=size.small)
Swing EMA
https://www.tradingview.com/script/puvcJHrG-Swing-EMA/
DevikSoni
https://www.tradingview.com/u/DevikSoni/
74
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/ // © DevikSoni //@version=4 study("Swing EMA",overlay=true) // Input sema50 = input(50,title="50 EMA") sema20 = input(20,title="20 EMA") srema100 = input(100,title="100 EMA") srema200 = input(200,title="200 EMA") // EMA Used EMA20 = ema(close, sema20) EMA50 = ema(close, sema50) SREMA100 = ema(close, srema100) SREMA200 = ema(close, srema200) // Color condition's col52 = iff(EMA20>=EMA50,color.lime,color.red) col3 = iff(SREMA100>=SREMA200, color.lime,color.red) // Main MA Polting MA52 = plot(series=EMA20,color=col52, linewidth=2) MA21 = plot(series=SREMA100,color=col3, linewidth=2) MA12 = plot(series=SREMA200,color=col3, linewidth=3) // giving fill to plot fill(MA21,MA12,color = SREMA100>=SREMA200 ? color.green : color.red)
StableF-Main
https://www.tradingview.com/script/vVnXzJti-StableF-Main/
E-Nifty
https://www.tradingview.com/u/E-Nifty/
224
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/ // © E-Nifty //@version=5 indicator("StableF-Main", overlay=true, timeframe="", timeframe_gaps=true) atrPeriod = input(23, "ATR Length") factor = input.float(2.7, "Factor", step = 0.01) lensig = input.int(7, title="ADX Smoothing", minval=1, maxval=50) len = input.int(14, minval=1, title="DI Length") use_tp = input(true, "Take Profit?") tp_trigger = input.float(0.8, "Take profit %", minval=0, step=0.5) * 0.01 ttp_trigger = input.float(0.2, "Trailing Take Profit %", minval=0, step=0.5) * 0.01 [supertrend, direction] = ta.supertrend(factor, atrPeriod) upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style=plot.style_circles) downTrend = plot(direction < 0? na : supertrend, "Down Trend", color = color.red, style=plot.style_circles) plotshape(ta.crossover(close,supertrend) ,text="BUY",style=shape.labelup,color=color.green,textcolor=color.black,location=location.belowbar) plotshape(ta.crossunder(close, supertrend),text="SELL",style=shape.labeldown,color=color.red,textcolor=color.black) 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) trur = ta.rma(ta.tr, len) plus = fixnan(100 * ta.rma(plusDM, len) / trur) minus = fixnan(100 * ta.rma(minusDM, len) / trur) sum = plus + minus adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lensig) plotshape(ta.crossover(plus,minus)?plus:na,color=color.green,location=location.belowbar,style=shape.triangleup,size=size.auto) plotshape(ta.crossunder(plus,minus)?minus:na,color=color.red,location=location.abovebar,style=shape.triangledown,size=size.auto) buy=ta.crossover(close,supertrend) sell=ta.crossunder(close,supertrend) since_buy = ta.barssince(buy) since_sell = ta.barssince(sell) buy_trend = since_sell > since_buy sell_trend = since_sell < since_buy change_trend = (buy_trend and sell_trend[1]) or (sell_trend and buy_trend[1]) entry_price = ta.valuewhen(buy or sell, close, 0) var tp_price_trigger = -1.0 var is_tp_trigger_hit = false var tp_trail = 0.0 tp_close_long = false tp_close_short = false if use_tp if change_trend tp_price_trigger := entry_price * (1.0 + (buy_trend ? 1.0 : sell_trend ? -1.0 : na) * tp_trigger) is_tp_trigger_hit := false if buy_trend is_tp_trigger_hit := (high >= tp_price_trigger) or (not change_trend and is_tp_trigger_hit[1]) tp_trail := math.max(high, change_trend ? tp_price_trigger : tp_trail[1]) tp_close_long := (is_tp_trigger_hit and (high <= tp_trail * (1.0 - ttp_trigger))) or (not change_trend and tp_close_long[1]) else if sell_trend is_tp_trigger_hit := (low <= tp_price_trigger) or (not change_trend and is_tp_trigger_hit[1]) tp_trail := math.min(low, change_trend ? tp_price_trigger : tp_trail[1]) tp_close_short := (is_tp_trigger_hit and (low >= tp_trail * (1.0 + ttp_trigger))) or (not change_trend and tp_close_short[1]) plot(use_tp and tp_price_trigger != -1.0 ? tp_price_trigger : na,title='Take Profit Price Trigger', color=color.blue,style=plot.style_cross, linewidth=2)
StableF-Adx
https://www.tradingview.com/script/sDlPQVG3-StableF-Adx/
E-Nifty
https://www.tradingview.com/u/E-Nifty/
112
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/ // © E-Nifty // it is just adx with extra drawline and plotshape of crossover //@version=5 indicator(title="stableF-Adx", format=format.price, precision=4) lensig = input.int(7, title="ADX Smoothing", minval=1, maxval=50) len = input.int(14, minval=1, title="DI Length") 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) trur = ta.rma(ta.tr, len) plus = fixnan(100 * ta.rma(plusDM, len) / trur) minus = fixnan(100 * ta.rma(minusDM, len) / trur) sum = plus + minus adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lensig) //l1=label.new(x=bar_index, y=adx>=25?adx:na, yloc=yloc.price,color=color.green,text="Strong Trend") plotshape(adx>=25?adx:na,text="Strong Trend",show_last=1,location=location.absolute,textcolor=color.black,offset=4,color=color.green,style=shape.labeldown,size=size.large) plotshape(adx<25?adx:na,text="Weak Trend",show_last=1,location=location.absolute,textcolor=color.black,offset=4,color=color.red,style=shape.labelup,size=size.large) plot(plus, color=#2962FF, title="+DI") plot(minus, color=#FF6D00, title="-DI") plotshape(ta.crossover(plus,minus)?plus:na,color=color.green,text="Up",location=location.absolute) plotshape(ta.crossunder(plus,minus)?minus:na,color=color.red,text="Dn",location=location.absolute) hline(25,color=#050505,linewidth=2,linestyle=hline.style_solid)
Abz Bond returns
https://www.tradingview.com/script/vyBVIcB9-Abz-Bond-returns/
Abzorba
https://www.tradingview.com/u/Abzorba/
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/ // © Abzorba // It is inspired by the technical analysis of @GameOfTrades on Twitter //@version=5 indicator("Abz US10y bond returns", shorttitle="Abz Bond returns", overlay=false, timeframe="", timeframe_gaps=false, explicit_plot_zorder=true) bonds = request.security("US10Y","D",close) col1 = bonds > bonds[1] col2 = bonds < bonds[1] color1 = col1 ? #21AA00 : col2 ? #960012 : color.gray bondline = plot(bonds, color = color1,linewidth=2, title = "Bond returns") malen = input.int(50, "Longest MA Length", minval=1) maTA = ta.ema(bonds, malen) col3 = bonds > maTA col4 = bonds < maTA color3 = col1 ? #21AA00 : col2 ? #960012 : color.gray maplot = plot(maTA, color = #611000) fill(bondline,maplot, color=color.new(color3, 90))
Options Theoritcal Price
https://www.tradingview.com/script/uR7SHzx6-Options-Theoritcal-Price/
Mohit_Kakkar08
https://www.tradingview.com/u/Mohit_Kakkar08/
310
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/ // © Mohit_Kakkar08 //@version=5 indicator('Options Theoritcal Price', precision=2, overlay=true) tableposition=input.string("top_right",title="Table position", options=["top_left", "top_center", "top_right", "middle_left", "middle_center", "middle_right", "bottom_left", "bottom_center", "bottom_right"]) 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 s = input.int(1000, 'Spot Price') k = input(1000.0, 'Strike Price-1') k9 = input(1000.0, 'Strike Price-2') r0 = input(6.0, 'Risk Free Rate %') t0 = input(60.0, 'Days to maturity') a0 = input(22.0, 'Strike-1 Implied Volatility %') a_9 = input(22.0, 'Strike-2 Implied Volatility %') r = r0 / 100 t = t0 / 365 a = a0 / 100 a__9 = a_9 / 100 ln = math.log(s / k) d1 = (ln + (r + math.pow(a, 2) / 2) * t) / (a * math.sqrt(t)) d2 = d1 - a * math.sqrt(t) e = 2.71828182846 a1 = 1.26551223 a2 = 1.00002368 a3 = 0.37409196 a4 = 0.09678418 a5 = 0.18628806 a6 = 0.27886807 a7 = 1.13520398 a8 = 1.48851587 a9 = 0.82215223 a10 = 0.17087277 x1 = d1 / math.sqrt(2) t1 = 1 / (1 + 0.5 * math.abs(x1)) n1 = -math.pow(x1, 2) - a1 + a2 * t1 + a3 * math.pow(t1, 2) + a4 * math.pow(t1, 3) - a5 * math.pow(t1, 4) + a6 * math.pow(t1, 5) - a7 * math.pow(t1, 6) + a8 * math.pow(t1, 7) - a9 * math.pow(t1, 8) + a10 * math.pow(t1, 9) T1 = t1 * math.pow(e, n1) erf1 = x1 < 0 ? T1 - 1 : 1 - T1 Nd1 = 0.5 + 0.5 * erf1 x2 = d2 / math.sqrt(2) t2 = 1 / (1 + 0.5 * math.abs(x2)) n2 = -math.pow(x2, 2) - a1 + a2 * t2 + a3 * math.pow(t2, 2) + a4 * math.pow(t2, 3) - a5 * math.pow(t2, 4) + a6 * math.pow(t2, 5) - a7 * math.pow(t2, 6) + a8 * math.pow(t2, 7) - a9 * math.pow(t2, 8) + a10 * math.pow(t2, 9) T2 = t2 * math.pow(e, n2) erf2 = x2 < 0 ? T2 - 1 : 1 - T2 Nd2 = 0.5 + 0.5 * erf2 C = Nd1 * s - Nd2 * k * math.pow(e, -r * t) P = k * math.pow(e, -r * t) * (1 - Nd2) - s * (1 - Nd1) ln_9 = math.log(s / k9) d1_9 = (ln_9 + (r + math.pow(a__9, 2) / 2) * t) / (a__9 * math.sqrt(t)) d2_9 = d1_9 - a * math.sqrt(t) x1_9 = d1_9 / math.sqrt(2) t1_9 = 1 / (1 + 0.5 * math.abs(x1_9)) n1_9 = -math.pow(x1_9, 2) - a1 + a2 * t1_9 + a3 * math.pow(t1_9, 2) + a4 * math.pow(t1_9, 3) - a5 * math.pow(t1_9, 4) + a6 * math.pow(t1_9, 5) - a7 * math.pow(t1_9, 6) + a8 * math.pow(t1_9, 7) - a9 * math.pow(t1_9, 8) + a10 * math.pow(t1_9, 9) T1_9 = t1_9 * math.pow(e, n1_9) erf1_9 = x1_9 < 0 ? T1_9 - 1 : 1 - T1_9 Nd1_9 = 0.5 + 0.5 * erf1_9 x2_9 = d2_9 / math.sqrt(2) t2_9 = 1 / (1 + 0.5 * math.abs(x2_9)) n2_9 = -math.pow(x2_9, 2) - a1 + a2 * t2_9 + a3 * math.pow(t2_9, 2) + a4 * math.pow(t2_9, 3) - a5 * math.pow(t2_9, 4) + a6 * math.pow(t2_9, 5) - a7 * math.pow(t2_9, 6) + a8 * math.pow(t2_9, 7) - a9 * math.pow(t2_9, 8) + a10 * math.pow(t2_9, 9) T2_9 = t2_9 * math.pow(e, n2_9) erf2_9 = x2_9 < 0 ? T2_9 - 1 : 1 - T2_9 Nd2_9 = 0.5 + 0.5 * erf2_9 C_9 = Nd1_9 * s - Nd2_9 * k9 * math.pow(e, -r * t) P_9 = k * math.pow(e, -r * t) * (1 - Nd2_9) - s * (1 - Nd1_9) x0= timeframe.period var table indicatorTable = table.new(tabpos, 20, 20, frame_color=color.black, frame_width=1,border_color=color.black, border_width=2) if barstate.islast // symbols table.cell(indicatorTable, 0, 0, syminfo.ticker, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 1, text="CALL-1", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 2, text="PUT-1", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 3, text="CALL-2", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 4, text="PUT-2", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 7, text="Straddle-1", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 8, text="Straddle-2", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 5, text="Call Spread", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 6, text="PUT Spread", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 9, text="PE-1 & CE-2 Strangle", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 0, 10, text="CE-1 & PE-2 Strangle", text_halign=text.align_center, bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 1, 0, text='Strike Price', bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 1, 1, str.tostring(k), text_halign=text.align_center, bgcolor=color.red, text_color=color.white) table.cell(indicatorTable, 1, 2, str.tostring(k), text_halign=text.align_center, bgcolor=color.green, text_color=color.white) table.cell(indicatorTable, 1, 3, str.tostring(k9), text_halign=text.align_center, bgcolor=color.red, text_color=color.white) table.cell(indicatorTable, 1, 4, str.tostring(k9), text_halign=text.align_center, bgcolor=color.green, text_color=color.white) table.cell(indicatorTable, 2, 0, text='Premium', bgcolor=color.black, text_color=color.white) table.cell(indicatorTable, 2, 1, str.tostring(math.round(C,2)), text_halign=text.align_center, bgcolor=color.red, text_color=color.white) table.cell(indicatorTable, 2, 2, str.tostring(math.round(P,2)), text_halign=text.align_center, bgcolor=color.green, text_color=color.white) table.cell(indicatorTable, 2, 3, str.tostring(math.round(C_9,2)), text_halign=text.align_center, bgcolor=color.red, text_color=color.white) table.cell(indicatorTable, 2, 4, str.tostring(math.round(P_9,2)), text_halign=text.align_center, bgcolor=color.green, text_color=color.white) table.cell(indicatorTable, 1, 7, str.tostring(math.round(C,2) + math.round(P,2)), text_halign=text.align_center, bgcolor=color.blue, text_color=color.white) table.cell(indicatorTable, 1, 8, str.tostring(math.round(C_9,2) + math.round(P_9,2)), text_halign=text.align_center, bgcolor=color.blue, text_color=color.white) table.merge_cells(indicatorTable, 1, 7, 2, 7) table.merge_cells(indicatorTable, 1, 8, 2, 8) table.cell(indicatorTable, 1, 5, str.tostring(math.round(C,2) - math.round(C_9,2)), text_halign=text.align_center, bgcolor=color.orange, text_color=color.white) table.cell(indicatorTable, 1, 6, str.tostring(math.round(P,2) - math.round(P_9,2)), text_halign=text.align_center, bgcolor=color.orange, text_color=color.white) table.merge_cells(indicatorTable, 1, 5, 2, 5) table.merge_cells(indicatorTable, 1, 6, 2, 6) table.cell(indicatorTable, 1, 9, str.tostring(math.round(P,2) + math.round(C_9,2)), text_halign=text.align_center, bgcolor=color.fuchsia, text_color=color.white) table.cell(indicatorTable, 1, 10, str.tostring(math.round(C,2) + math.round(P_9,2)), text_halign=text.align_center, bgcolor=color.fuchsia, text_color=color.white) table.merge_cells(indicatorTable, 1, 9, 2, 9) table.merge_cells(indicatorTable, 1, 10, 2, 10)
Abz Bonds/BTC divergence
https://www.tradingview.com/script/QiCGyQLE-Abz-Bonds-BTC-divergence/
Abzorba
https://www.tradingview.com/u/Abzorba/
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/ // © Abzorba // It is inspired by the technical analysis of @GameOfTrades on Twitter //@version=5 indicator("Abz US10y bond returns", shorttitle="Abz Bond returns", overlay=false, timeframe="", timeframe_gaps=false, explicit_plot_zorder=true) bonds = request.security("US10Y","D",close) col1 = bonds > bonds[1] col2 = bonds < bonds[1] color1 = col1 ? #21AA00 : col2 ? #960012 : color.gray bondline = plot(bonds, color = color1,linewidth=2, title = "Bond returns") malen = input.int(50, "Longest MA Length", minval=1) maTA = ta.ema(bonds, malen) col3 = bonds > maTA col4 = bonds < maTA color3 = col1 ? #21AA00 : col2 ? #960012 : color.gray maplot = plot(maTA, color = #611000) fill(bondline,maplot, color=color.new(color3, 90))
Comparative Strength [FT]
https://www.tradingview.com/script/sDUG4sBf-Comparative-Strength-FT/
faliqzul
https://www.tradingview.com/u/faliqzul/
13
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/ // © faliqzul //@version=5 indicator(title="Comparative Strength [FT]", shorttitle="CS [FT]") comparativeTickerId = input.symbol("AMEX:SPY", title="Comparative Symbol") fastLen = input.int(5, title="Fast Length", tooltip="Calculates on X number of candles") slowLen = input.int(13, title="Slow Length", tooltip="Calculates on X number of candles") smoothing = input.int(3, title="Smoothing", tooltip="Smoothing by applying moving average") comparativeSymbol = request.security(comparativeTickerId, "", hl2) maDiff = math.log(ta.ema(hl2, fastLen)) - math.log(ta.ema(hl2, slowLen)) csDiff = math.log(ta.ema(comparativeSymbol, fastLen)) - math.log(ta.ema(comparativeSymbol, slowLen)) csDiv = ta.sma((maDiff - csDiff) * 100, smoothing) plot(csDiv, title="C", color=color.orange) h0 = hline(0, title="Zero Line", linestyle=hline.style_dashed, linewidth=1, color=#ababab)
Nav Premium/Discount
https://www.tradingview.com/script/pGGqcEUy-Nav-Premium-Discount/
calebsandfort
https://www.tradingview.com/u/calebsandfort/
165
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/ // © calebsandfort //@version=5 indicator("Nav Premium/Discount", format = format.percent, precision = 2) underlying_symbol = input.symbol("COINBASE:ETHUSD", "Underlying") underlying = request.security(underlying_symbol, 'D', close) divisor = input.float(100.0, "Divisor", minval=0.0) premium_cap = input.float(20.0, "Premium Cap") discount_cap = input.float(-20.0, "Discount Cap") premium_gradient_cap = input.float(15.0, "Premium Gradient Cap") discount_gradient_cap = input.float(-15.0, "Discount Gradient Cap") text_color = input.color(color.white, "Text Color") premium_color = input.color(color.green, "Premium Color") mid_color = input.color(color.yellow, "Mid Color") discount_color = input.color(color.red, "Discount Color") nav = underlying / divisor delta = (close - nav) / nav * 100.0 capped_delta = delta > premium_cap ? premium_cap : delta < discount_cap ? discount_cap : delta color_pos = color.from_gradient(capped_delta, 0.0, premium_gradient_cap, mid_color, premium_color) color_neg = color.from_gradient(capped_delta, discount_gradient_cap, 0.0, discount_color, mid_color) the_color = delta > 0.0 ? color_pos : color_neg dod_delta = delta[1] - delta[0] dod_delta_pct = (delta[0] - delta[1]) / delta[1] * 100.0 plotchar(delta, "Premium/Discount", "", location.top) plot(capped_delta, style = plot.style_histogram, linewidth = 4, color = the_color, title = "Premium/Discount Capped") plotchar(dod_delta, "Premium/Discount DoD Δ", "", location.top) plotchar(dod_delta_pct, "Premium/Discount DoD Δ %", "", location.top) var table infoTable = table.new(position.middle_right, 2, 4, frame_color=text_color, frame_width = 1, border_color=text_color, border_width = 1) if barstate.islast table.cell(infoTable, 0, 0, "Underlying", bgcolor= delta > 0 ? premium_color : discount_color, text_color = text_color, text_halign = text.align_left) table.cell(infoTable, 1, 0, str.format("${0,number,#.##}", underlying[0]), bgcolor= delta > 0 ? premium_color : discount_color, text_color = text_color, text_halign = text.align_left) table.cell(infoTable, 0, 1, delta > 0 ? "Premium" : "Discount", bgcolor= delta > 0 ? premium_color : discount_color, text_color = text_color, text_halign = text.align_left) table.cell(infoTable, 1, 1, str.format("{0,number,#.##}%", delta), bgcolor= delta > 0 ? premium_color : discount_color, text_color = text_color, text_halign = text.align_left) table.cell(infoTable, 0, 2, "DoD Δ", bgcolor= delta > 0 ? premium_color : discount_color, text_color = text_color, text_halign = text.align_left) table.cell(infoTable, 1, 2, str.format("{0,number,#.##}", dod_delta), bgcolor= delta > 0 ? premium_color : discount_color, text_color = text_color, text_halign = text.align_left) table.cell(infoTable, 0, 3, "DoD Δ %", bgcolor= delta > 0 ? premium_color : discount_color, text_color = text_color, text_halign = text.align_left) table.cell(infoTable, 1, 3, str.format("{0,number,#.##}%", dod_delta_pct), bgcolor= delta > 0 ? premium_color : discount_color, text_color = text_color, text_halign = text.align_left)
Diluted Earnings Per Share Signal [AstrideUnicorn]
https://www.tradingview.com/script/ToaTQAbG-Diluted-Earnings-Per-Share-Signal-AstrideUnicorn/
AstrideUnicorn
https://www.tradingview.com/u/AstrideUnicorn/
1,881
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/ // © AstrideUnicorn //@version=5 indicator('Diluted EPS Signal', shorttitle='DEPSS' ,overlay=true) // Input earnings surprise thershold threshold1 = input.float(defval=20, title='Earnings Surprise Threshold (%)', step=0.01) // Get Eanings Per Share Estimate and Earnings Per Share Diluted EPS_estimate = request.earnings(syminfo.tickerid, earnings.estimate) EPS_diluted = request.financial(syminfo.tickerid, 'EARNINGS_PER_SHARE_DILUTED', 'FQ') // Convert percentafe value of the treshold to a decimal one threshold = threshold1/100 // Calcuate the absolute value of eranings suprise absolute_earnings_surprise = math.abs((EPS_diluted - EPS_estimate) / EPS_estimate) // Condition that determines if the current earnings signal is significant significant = absolute_earnings_surprise >= threshold // Define BUY and SELL signals buy_signal = EPS_diluted - EPS_estimate >= 0 and significant sell_signal = EPS_diluted - EPS_estimate < 0 and significant // Calculate eranings date Earnings_date = ta.barssince(EPS_estimate - EPS_estimate[1] != 0) == 0 // plot signal arrows plotshape(Earnings_date and buy_signal, style=shape.triangleup, color=color.new(color.green, 0), location=location.belowbar, size=size.normal) plotshape(Earnings_date and sell_signal, style=shape.triangledown, color=color.new(color.red, 0), location=location.abovebar, size=size.normal)
Stochastic and RSI in one indicator with customized alert.
https://www.tradingview.com/script/DEVMS62I-Stochastic-and-RSI-in-one-indicator-with-customized-alert/
HerschelleGirnari
https://www.tradingview.com/u/HerschelleGirnari/
139
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/ // © HerschelleGirnari //@version=5 indicator(title="Stochastic Oscillator and Relative Strength Index", shorttitle="HerG Stoch & RSI", format=format.price, precision=0, timeframe="", timeframe_gaps=true, scale = scale.left) // ------ >>>>>> Inputs LenB = input.int(14, title="Length", minval=1, step =1, tooltip = "No. of bars to calculate.") StochFast = input.int(9, title="Fast Stochastic", minval=1, step = 1) StochSlow = input.int(21, title="Slow Stochastic", minval=1, step = 1) RSIsource = input.source(close, title = "RSI Source", tooltip = "Preferred source data.") RSIBT1 = input.int(25, title = "Min", minval = 1, maxval = 99, step = 1, tooltip = "Set RSI level for Buy trigger.", inline = "buy level", group = "RSI for Buy") RSIBT2 = input.int(45, title = "Max", minval = 1, maxval = 99, step = 1, tooltip = "Set RSI level for Buy trigger.", inline = "buy level", group = "RSI for Buy") RSIST1 = input.int(75, title = "Max", minval = 1, maxval = 99, step = 1, tooltip = "Set RSI level for Sell trigger.", inline = "Sell level", group = "RSI for Sell") RSIST2 = input.int(55, title = "Min", minval = 1, maxval = 99, step = 1, tooltip = "Set RSI level for Sell trigger.", inline = "Sell level", group = "RSI for Sell") // >>>>> Calculations stochFull = ta.stoch(close, high, low, LenB) Fast = ta.sma(stochFull, StochFast) Slow = ta.sma(stochFull, StochSlow) RSI = ta.rsi(close, LenB) UnderLap = ta.crossunder(Slow, Fast) OverLap = ta.crossover(Slow, Fast) // >>>> Plot and Display plot(Fast, title="Stochastic Fast", color=color.blue, style=plot.style_line) plot(Slow, title="Stochastic Slow", color=color.red, style=plot.style_line) plot(RSI, title="RSI", color = color.purple, linewidth = 2) h1 = hline(75, "Upper Band", color=color.silver) h2 = hline(25, "Lower Band", color=color.silver) h0 = hline(50, "Center Line", color=color.silver, linestyle= hline.style_solid) // >>>> Reasoning ULSignal = RSI > RSIBT1 and RSI < RSIBT2 OLSignal = RSI > RSIST2 and RSI < RSIST1 plotshape(ULSignal ? UnderLap : na, title="Under-lap Signal", style = shape.triangleup, location = location.bottom, size=size.tiny, color= color.lime) plotshape(OLSignal ? OverLap : na, title="Over-lap Signal", style = shape.triangledown, location = location.top, size=size.tiny, color= color.red) // Alert Signal when user defined RSI level along with stochastic crossover will send confirmation of trend-setup. flag = false if ULSignal and UnderLap flag := true else if OLSignal and OverLap flag := true else flag := false alertcondition(flag, title = "Buy/Sell Signal", message = "Possible trend setup for {{ticker}}. Price = {{close}}, Time: {{timenow}}") alertcondition(ULSignal ? UnderLap: na, title = "Buy Signal", message = "Buy alarm for {{ticker}}. Price = {{close}}, Time: {{timenow}}") alertcondition(OLSignal ? OverLap: na, title = "Sell Signal", message = "Sell alarm for {{ticker}}. Price = {{close}}, Time: {{timenow}}")
Trend intensity 65 TI65
https://www.tradingview.com/script/7yFw18cR-Trend-intensity-65-TI65/
TintinTrading
https://www.tradingview.com/u/TintinTrading/
317
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/ // © TintinTrading //@version=5 indicator(title="[TTI] TI65",shorttitle="TI65") snes = input(defval=5, title="Sensitivity", tooltip = "Decrease this value to increase the sensitivity of the indicator and get more signals. Default value is 5") //INPUTS–––––––––––––––––––––––––––––––––––––––––– TIH_show = input(defval=true, title='Show Higher TI65', group = 'Add Indicator', tooltip = "Check to add additional TI65 signal from higher timeframe") TIH_res = input.timeframe(defval='', title='Higher Timeframe', group ='Add Indicator', tooltip = "Choose higher timeframe for additional TI65signal") trnsp = input(defval=95, title="Transparency",group ='Add Indicator', tooltip = "Change the setting for the transparency of the higher timeframe") mdtsh = input.bool(true, title = "Show MDT up", group = 'Add Indicator', inline = "3") mdtshd = input.bool(true, title = "Show MDT down", group = 'Add Indicator', inline = "4") movepar = input(defval=7.0, title="Offset", group = 'Label') //CALCULATIONS–––––––––––––––––––––––––––––––––––––––––– calc_ma(src, len) => v1 = ta.sma(src, len) HMA0 = calc_ma(close, 7) HMA1 = calc_ma(close, 65) HMA_res_final = TIH_res == '' ? timeframe.period : TIH_res HMA0_final = request.security(syminfo.tickerid, HMA_res_final, HMA0) HMA1_final = request.security(syminfo.tickerid, HMA_res_final, HMA1) TIH65 = HMA0_final/HMA1_final MDTup = mdtsh==1 and math.round(close/ta.sma(close,126),2)>(1+snes/100) ? 0.8 : 0 MDTdown = mdtshd==1 and math.round(close/ta.sma(close,126),2)<(1-snes/100) ? 0.8 : 0 TI65 = ta.sma(close,7)/ta.sma(close,65) Line0 = plot(0) TIIH = if TIH65>(1+snes/100) 1.1 else 0 TIIDH = if TIH65<(1-snes/100) 1.1 else 0 TII = if TI65>(1+snes/100) 1 else 0 TIID = if TI65<(1-snes/100) 1 else 0 loctext=int(bar_index+movepar) loctext2=int(bar_index+2*movepar) //PLOTS–––––––––––––––––––––––––––––––––––––––––– TIIIH = plot(TIH_show ? TIIH : 0, color=color.orange, title = "Higher Timeframe UP Line Color") fill(TIIIH,Line0,color=color.green, transp=trnsp, title = "Higher Timeframe UP color") TIIIDH = plot(TIH_show ? TIIDH : 0, color=color.orange, title = "Higher Timeframe DOWN Line Color") fill(TIIIDH,Line0,color=color.red, transp=trnsp, title = "Higher Timeframe DOWN color") TIII = plot(TII, title = "UP Line Color") fill(TIII,Line0,color=color.green, transp=80, title = "Up Color") TIIID = plot(TIID, title = "DOWN Line Color") fill(TIIID,Line0,color=color.red, transp=80, title = "Down Color") MDTu = plot(MDTup, title = "MDT up", color=color.aqua) fill(MDTu,Line0,color=color.aqua, transp=80, title = "MDT Up color") MDTd = plot(MDTdown, title = "MDT down", color=color.purple) fill(MDTu,Line0,color=color.purple, transp=80, title = "MDT Up color") l1 = label.new(loctext,1.20, text = "H TI65", style = label.style_label_center, color=color.orange,textcolor=color.white, size = size.small, textalign=text.align_left) label.delete(l1[1]) l2 = label.new(loctext,1.00, text = "TI65", style = label.style_label_center, color=color.blue,textcolor=color.white, size = size.small, textalign=text.align_left) label.delete(l2[1]) l3 = label.new(loctext,0.80, text = "MDT", style = label.style_label_center, color=color.purple,textcolor=color.white, size = size.small, textalign=text.align_left) label.delete(l3[1])
Market Screener for Momentum indicators
https://www.tradingview.com/script/Y11czjmD-Market-Screener-for-Momentum-indicators/
TintinTrading
https://www.tradingview.com/u/TintinTrading/
353
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/ // © TintinTrading //@version=5 //@version=5 indicator('Multiple Indicators Screener', overlay=true) //////////// // INPUTS // // { // SQN indi0 = input(defval = true, title = "SQN interval", inline = "sqn", group = "SQN") indi0l = input(defval = 100, title = "", inline = "sqn", group = "SQN") sqn_superbull = input.float(1.4, title = "SuperBullish", group = "SQN") sqn_bull = input.float(0.7, title = "Bullish", group = "SQN") sqn_neutral = input.float(0, title = "Neutral", group = "SQN") sqn_bear = input.float(-0.7, title = "Bearish", group = "SQN") _pos = input.string("Top Right", title="Label Position", options=["Top Left", "Top Center", "Top Right", "Middle Left", "Middle Center", "Middle Right", "Bottom Left", "Bottom Center", "Bottom Right"], group="Layout") // TSI // tsi_long_len = input.int( 25, title = "TSI Long Length", group = "Indicators") // tsi_shrt_len = input.int( 13, title = "TSI Short Length", group = "Indicators") // tsi_ob = input.float( 0.75, title = "TSI Overbought", group = 'Indicators') // tsi_os = input.float( 0, title = "TSI Oversold", group = 'Indicators') //SQUEEZE sqz_len = input.int(20, title = "Squeeze Lenght", group = "Squeeze") // ADX Params adx_smooth = input.int( 14, title = "ADX Smoothing", group = 'ADX') adx_dilen = input.int( 14, title = "ADX DI Length", group = 'ADX') adx_level = input.float(20, title = "ADX Level", group = 'ADX') // UDV //sup_atr_len = input.int( 10, "Supertrend ATR Length", group = 'Trend') //sup_factor = input.float(3.0, "Supertrend Factor", group = 'Trend') indi5 = input(defval = true, title = "Up/Down vol days", inline = "uvd", group = "Up Down Volume") indi5l = input(defval = 50, title = "", inline = "uvd", group = "Up Down Volume") input5t = input(defval = 1.1, title = "Treshold" ,group = "Up Down Volume") // } ///////////// // 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(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(false, title = "", group = 'Symbols', inline = 's36') u37 = input.bool(false, title = "", group = 'Symbols', inline = 's37') u38 = input.bool(false, title = "", group = 'Symbols', inline = 's38') u39 = input.bool(false, title = "", group = 'Symbols', inline = 's39') u40 = input.bool(false, title = "", group = 'Symbols', inline = 's40') s01 = input.symbol('SPY', group = 'Symbols', inline = 's01') s02 = input.symbol('RSP', group = 'Symbols', inline = 's02') s03 = input.symbol('NDQ', group = 'Symbols', inline = 's03') s04 = input.symbol('NDXE', group = 'Symbols', inline = 's04') s05 = input.symbol('QQQ', group = 'Symbols', inline = 's05') s06 = input.symbol('QQQE', group = 'Symbols', inline = 's06') s07 = input.symbol('XLK', group = 'Symbols', inline = 's07') s08 = input.symbol('RYT', group = 'Symbols', inline = 's08') s09 = input.symbol('XLRE', group = 'Symbols', inline = 's09') s10 = input.symbol('RYE', group = 'Symbols', inline = 's10') s11 = input.symbol('XLF', group = 'Symbols', inline = 's11') s12 = input.symbol('RYF', group = 'Symbols', inline = 's12') s13 = input.symbol('XLI', group = 'Symbols', inline = 's13') s14 = input.symbol('RGI', group = 'Symbols', inline = 's14') s15 = input.symbol('XLU', group = 'Symbols', inline = 's15') s16 = input.symbol('RYU', group = 'Symbols', inline = 's16') s17 = input.symbol('XLP', group = 'Symbols', inline = 's17') s18 = input.symbol('RHS', group = 'Symbols', inline = 's18') s19 = input.symbol('XLV', group = 'Symbols', inline = 's19') s20 = input.symbol('RYH', group = 'Symbols', inline = 's20') s21 = input.symbol('XLY', group = 'Symbols', inline = 's21') s22 = input.symbol('RCD', group = 'Symbols', inline = 's22') s23 = input.symbol('XLRE', group = 'Symbols', inline = 's23') s24 = input.symbol('EWRE', group = 'Symbols', inline = 's24') s25 = input.symbol('XLC', group = 'Symbols', inline = 's25') s26 = input.symbol('EWCO', group = 'Symbols', inline = 's26') s27 = input.symbol('TLT', group = 'Symbols', inline = 's27') s28 = input.symbol('US05', group = 'Symbols', inline = 's28') s29 = input.symbol('US10', group = 'Symbols', inline = 's29') s30 = input.symbol('US30', group = 'Symbols', inline = 's30') s31 = input.symbol('BTCUSDT', group = 'Symbols', inline = 's31') s32 = input.symbol('ETHUSDT', group = 'Symbols', inline = 's32') s33 = input.symbol('DXY', group = 'Symbols', inline = 's33') s34 = input.symbol('AUDJPY', group = 'Symbols', inline = 's34') s35 = input.symbol('USOIL', group = 'Symbols', inline = 's35') s36 = input.symbol('BOIL', group = 'Symbols', inline = 's36') s37 = input.symbol('GLC', group = 'Symbols', inline = 's37') s38 = input.symbol('SLV', group = 'Symbols', inline = 's38') s39 = input.symbol('IOSTBTC', group = 'Symbols', inline = 's39') s40 = input.symbol('GRTUSDT', group = 'Symbols', inline = 's40') // } ////////////////// // CALCULATIONS // // { // Get only symbol f_getPosition(_pos) => ret = position.top_left if _pos == "Top Center" ret := position.top_center if _pos == "Top Right" ret := position.top_right if _pos == "Middle Left" ret := position.middle_left if _pos == "Middle Center" ret := position.middle_center if _pos == "Middle Right" ret := position.middle_right if _pos == "Bottom Left" ret := position.bottom_left if _pos == "Bottom Center" ret := position.bottom_center if _pos == "Bottom Right" ret := position.bottom_right ret only_symbol(s) => array.get(str.split(s, ":"), 1) // CHANGE change_func()=> change = ((close - close[1])/close[1])*100 chage_=math.round(change,2) // for TSI double_smooth(src, long, short) => fist_smooth = ta.ema(src, long) ta.ema(fist_smooth, short) squeeze_func () => ma = ta.sma(close, sqz_len) devBB = ta.stdev(close, sqz_len) devKC = ta.sma(ta.tr, sqz_len) upBB = ma + devBB * 2 lowBB = ma - devBB * 2 upKCWide = ma + devKC * 2 lowKCWide = ma - devKC * 2 upKCNormal = ma + devKC * 1.5 lowKCNormal = ma - devKC * 1.5 upKCNarrow = ma + devKC lowKCNarrow = ma - devKC //sqzOnNormal = lowBB >= lowKCNormal and upBB <= upKCNormal ? 1 : 0 //NORMAL SQUEEZE: RED sqzOnNormal = lowBB >= lowKCNormal and upBB <= upKCNormal //NORMAL SQUEEZE: RED sqzOnNarrow = lowBB >= lowKCNarrow and upBB <= upKCNarrow //NARROW SQUEEZE: YELLOW sqzOnWide = lowBB >= lowKCWide and upBB <= upKCWide //WIDE SQUEEZE: ORANGE //noSqz = sqzOnWide == false and sqzOffWide == false //NO SQUEEZE: BLUE sqzOffWide = lowBB < lowKCWide and upBB > upKCWide //FIRED WIDE SQUEEZE: GREEN tsi = sqzOnNarrow ? 4 : sqzOnNormal ? 3 : sqzOnWide ? 2 : sqzOffWide ? 1 : 0 [tsi] // 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_func(dilen, adxlen) => [plus, minus] = dirmov(dilen) sum = plus + minus adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) // SQN sqn_func() => close_difference = close/close[1]-1 Stdev = ta.stdev(close_difference,indi0l) _sma= ta.sma(close_difference,indi0l) rsi=((_sma*math.sqrt(indi0l))/Stdev) [rsi] //UDV udv() => upvol = math.sum(ta.change(close) > 0 ? volume : 0, indi5l) downvol = math.sum(ta.change(close) < 0 ? volume : 0, indi5l) udv = math.round(upvol/downvol,2) sup_dir =udv screener_func() => cl = change_func() // RSI [rsi] = sqn_func() // TSI // pc = ta.change(close) // double_smoothed_pc = double_smooth(pc, tsi_long_len, tsi_shrt_len) // double_smoothed_abs_pc = double_smooth(math.abs(pc), tsi_long_len, tsi_shrt_len) // tsi = 100 * (double_smoothed_pc / double_smoothed_abs_pc) [tsi] = squeeze_func() // ADX adx = adx_func(adx_dilen, adx_smooth) // Supertrend // [sup_value, sup_dir] = ta.supertrend(sup_factor, sup_atr_len) sup_dir = udv() [cl, rsi, tsi, adx, sup_dir] // Security call [cl01, rsi01, tsi01, adx01, sup01] = request.security(s01, timeframe.period, screener_func()) [cl02, rsi02, tsi02, adx02, sup02] = request.security(s02, timeframe.period, screener_func()) [cl03, rsi03, tsi03, adx03, sup03] = request.security(s03, timeframe.period, screener_func()) [cl04, rsi04, tsi04, adx04, sup04] = request.security(s04, timeframe.period, screener_func()) [cl05, rsi05, tsi05, adx05, sup05] = request.security(s05, timeframe.period, screener_func()) [cl06, rsi06, tsi06, adx06, sup06] = request.security(s06, timeframe.period, screener_func()) [cl07, rsi07, tsi07, adx07, sup07] = request.security(s07, timeframe.period, screener_func()) [cl08, rsi08, tsi08, adx08, sup08] = request.security(s08, timeframe.period, screener_func()) [cl09, rsi09, tsi09, adx09, sup09] = request.security(s09, timeframe.period, screener_func()) [cl10, rsi10, tsi10, adx10, sup10] = request.security(s10, timeframe.period, screener_func()) [cl11, rsi11, tsi11, adx11, sup11] = request.security(s11, timeframe.period, screener_func()) [cl12, rsi12, tsi12, adx12, sup12] = request.security(s12, timeframe.period, screener_func()) [cl13, rsi13, tsi13, adx13, sup13] = request.security(s13, timeframe.period, screener_func()) [cl14, rsi14, tsi14, adx14, sup14] = request.security(s14, timeframe.period, screener_func()) [cl15, rsi15, tsi15, adx15, sup15] = request.security(s15, timeframe.period, screener_func()) [cl16, rsi16, tsi16, adx16, sup16] = request.security(s16, timeframe.period, screener_func()) [cl17, rsi17, tsi17, adx17, sup17] = request.security(s17, timeframe.period, screener_func()) [cl18, rsi18, tsi18, adx18, sup18] = request.security(s18, timeframe.period, screener_func()) [cl19, rsi19, tsi19, adx19, sup19] = request.security(s19, timeframe.period, screener_func()) [cl20, rsi20, tsi20, adx20, sup20] = request.security(s20, timeframe.period, screener_func()) [cl21, rsi21, tsi21, adx21, sup21] = request.security(s21, timeframe.period, screener_func()) [cl22, rsi22, tsi22, adx22, sup22] = request.security(s22, timeframe.period, screener_func()) [cl23, rsi23, tsi23, adx23, sup23] = request.security(s23, timeframe.period, screener_func()) [cl24, rsi24, tsi24, adx24, sup24] = request.security(s24, timeframe.period, screener_func()) [cl25, rsi25, tsi25, adx25, sup25] = request.security(s25, timeframe.period, screener_func()) [cl26, rsi26, tsi26, adx26, sup26] = request.security(s26, timeframe.period, screener_func()) [cl27, rsi27, tsi27, adx27, sup27] = request.security(s27, timeframe.period, screener_func()) [cl28, rsi28, tsi28, adx28, sup28] = request.security(s28, timeframe.period, screener_func()) [cl29, rsi29, tsi29, adx29, sup29] = request.security(s29, timeframe.period, screener_func()) [cl30, rsi30, tsi30, adx30, sup30] = request.security(s30, timeframe.period, screener_func()) [cl31, rsi31, tsi31, adx31, sup31] = request.security(s31, timeframe.period, screener_func()) [cl32, rsi32, tsi32, adx32, sup32] = request.security(s32, timeframe.period, screener_func()) [cl33, rsi33, tsi33, adx33, sup33] = request.security(s33, timeframe.period, screener_func()) [cl34, rsi34, tsi34, adx34, sup34] = request.security(s34, timeframe.period, screener_func()) [cl35, rsi35, tsi35, adx35, sup35] = request.security(s35, timeframe.period, screener_func()) [cl36, rsi36, tsi36, adx36, sup36] = request.security(s36, timeframe.period, screener_func()) [cl37, rsi37, tsi37, adx37, sup37] = request.security(s37, timeframe.period, screener_func()) [cl38, rsi38, tsi38, adx38, sup38] = request.security(s38, timeframe.period, screener_func()) [cl39, rsi39, tsi39, adx39, sup39] = request.security(s39, timeframe.period, screener_func()) [cl40, rsi40, tsi40, adx40, sup40] = request.security(s40, timeframe.period, screener_func()) // } //////////// // ARRAYS // // { s_arr = array.new_string(0) u_arr = array.new_bool(0) cl_arr = array.new_float(0) rsi_arr = array.new_float(0) tsi_arr = array.new_float(0) adx_arr = array.new_float(0) sup_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)) array.push(s_arr, only_symbol(s40)) // } /////////// // 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) array.push(u_arr, u40) // } /////////// // 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) array.push(cl_arr, cl40) // } ///////// // RSI // // { array.push(rsi_arr, rsi01) array.push(rsi_arr, rsi02) array.push(rsi_arr, rsi03) array.push(rsi_arr, rsi04) array.push(rsi_arr, rsi05) array.push(rsi_arr, rsi06) array.push(rsi_arr, rsi07) array.push(rsi_arr, rsi08) array.push(rsi_arr, rsi09) array.push(rsi_arr, rsi10) array.push(rsi_arr, rsi11) array.push(rsi_arr, rsi12) array.push(rsi_arr, rsi13) array.push(rsi_arr, rsi14) array.push(rsi_arr, rsi15) array.push(rsi_arr, rsi16) array.push(rsi_arr, rsi17) array.push(rsi_arr, rsi18) array.push(rsi_arr, rsi19) array.push(rsi_arr, rsi20) array.push(rsi_arr, rsi21) array.push(rsi_arr, rsi22) array.push(rsi_arr, rsi23) array.push(rsi_arr, rsi24) array.push(rsi_arr, rsi25) array.push(rsi_arr, rsi26) array.push(rsi_arr, rsi27) array.push(rsi_arr, rsi28) array.push(rsi_arr, rsi29) array.push(rsi_arr, rsi30) array.push(rsi_arr, rsi31) array.push(rsi_arr, rsi32) array.push(rsi_arr, rsi33) array.push(rsi_arr, rsi34) array.push(rsi_arr, rsi35) array.push(rsi_arr, rsi36) array.push(rsi_arr, rsi37) array.push(rsi_arr, rsi38) array.push(rsi_arr, rsi39) array.push(rsi_arr, rsi40) // } ///////// // TSI // // { array.push(tsi_arr, tsi01) array.push(tsi_arr, tsi02) array.push(tsi_arr, tsi03) array.push(tsi_arr, tsi04) array.push(tsi_arr, tsi05) array.push(tsi_arr, tsi06) array.push(tsi_arr, tsi07) array.push(tsi_arr, tsi08) array.push(tsi_arr, tsi09) array.push(tsi_arr, tsi10) array.push(tsi_arr, tsi11) array.push(tsi_arr, tsi12) array.push(tsi_arr, tsi13) array.push(tsi_arr, tsi14) array.push(tsi_arr, tsi15) array.push(tsi_arr, tsi16) array.push(tsi_arr, tsi17) array.push(tsi_arr, tsi18) array.push(tsi_arr, tsi19) array.push(tsi_arr, tsi20) array.push(tsi_arr, tsi21) array.push(tsi_arr, tsi22) array.push(tsi_arr, tsi23) array.push(tsi_arr, tsi24) array.push(tsi_arr, tsi25) array.push(tsi_arr, tsi26) array.push(tsi_arr, tsi27) array.push(tsi_arr, tsi28) array.push(tsi_arr, tsi29) array.push(tsi_arr, tsi30) array.push(tsi_arr, tsi31) array.push(tsi_arr, tsi32) array.push(tsi_arr, tsi33) array.push(tsi_arr, tsi34) array.push(tsi_arr, tsi35) array.push(tsi_arr, tsi36) array.push(tsi_arr, tsi37) array.push(tsi_arr, tsi38) array.push(tsi_arr, tsi39) array.push(tsi_arr, tsi40) // } ///////// // ADX // // { array.push(adx_arr, adx01) array.push(adx_arr, adx02) array.push(adx_arr, adx03) array.push(adx_arr, adx04) array.push(adx_arr, adx05) array.push(adx_arr, adx06) array.push(adx_arr, adx07) array.push(adx_arr, adx08) array.push(adx_arr, adx09) array.push(adx_arr, adx10) array.push(adx_arr, adx11) array.push(adx_arr, adx12) array.push(adx_arr, adx13) array.push(adx_arr, adx14) array.push(adx_arr, adx15) array.push(adx_arr, adx16) array.push(adx_arr, adx17) array.push(adx_arr, adx18) array.push(adx_arr, adx19) array.push(adx_arr, adx20) array.push(adx_arr, adx21) array.push(adx_arr, adx22) array.push(adx_arr, adx23) array.push(adx_arr, adx24) array.push(adx_arr, adx25) array.push(adx_arr, adx26) array.push(adx_arr, adx27) array.push(adx_arr, adx28) array.push(adx_arr, adx29) array.push(adx_arr, adx30) array.push(adx_arr, adx31) array.push(adx_arr, adx32) array.push(adx_arr, adx33) array.push(adx_arr, adx34) array.push(adx_arr, adx35) array.push(adx_arr, adx36) array.push(adx_arr, adx37) array.push(adx_arr, adx38) array.push(adx_arr, adx39) array.push(adx_arr, adx40) // } //////////////// // SUPERTREND // // { array.push(sup_arr, sup01) array.push(sup_arr, sup02) array.push(sup_arr, sup03) array.push(sup_arr, sup04) array.push(sup_arr, sup05) array.push(sup_arr, sup06) array.push(sup_arr, sup07) array.push(sup_arr, sup08) array.push(sup_arr, sup09) array.push(sup_arr, sup10) array.push(sup_arr, sup11) array.push(sup_arr, sup12) array.push(sup_arr, sup13) array.push(sup_arr, sup14) array.push(sup_arr, sup15) array.push(sup_arr, sup16) array.push(sup_arr, sup17) array.push(sup_arr, sup18) array.push(sup_arr, sup19) array.push(sup_arr, sup20) array.push(sup_arr, sup21) array.push(sup_arr, sup22) array.push(sup_arr, sup23) array.push(sup_arr, sup24) array.push(sup_arr, sup25) array.push(sup_arr, sup26) array.push(sup_arr, sup27) array.push(sup_arr, sup28) array.push(sup_arr, sup29) array.push(sup_arr, sup30) array.push(sup_arr, sup31) array.push(sup_arr, sup32) array.push(sup_arr, sup33) array.push(sup_arr, sup34) array.push(sup_arr, sup35) array.push(sup_arr, sup36) array.push(sup_arr, sup37) array.push(sup_arr, sup38) array.push(sup_arr, sup39) array.push(sup_arr, sup40) // } /////////// // PLOTS // // { var tbl = table.new(f_getPosition(_pos), 6, 41, 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.black, text_color = color.white, text_size = size.small) table.cell(tbl, 1, 0, 'Change', text_halign = text.align_center, bgcolor = color.black, text_color = color.white, text_size = size.small) table.cell(tbl, 2, 0, 'SQN'+"\n"+"100", text_halign = text.align_center, bgcolor = color.black, text_color = color.white, text_size = size.small) table.cell(tbl, 3, 0, 'SQZ'+"\n"+"Pro", text_halign = text.align_center, bgcolor = color.black, text_color = color.white, text_size = size.small) table.cell(tbl, 4, 0, 'ADX', text_halign = text.align_center, bgcolor = color.black, text_color = color.white, text_size = size.small) table.cell(tbl, 5, 0, 'UDV', text_halign = text.align_center, bgcolor = color.black, text_color = color.white, text_size = size.small) for i = 0 to 39 if array.get(u_arr, i) cl_col = array.get(cl_arr, i) > 0 ? #04D204 : #FF0000 rsi_col = array.get(rsi_arr, i) > sqn_superbull ? #04D204 : array.get(rsi_arr, i) > sqn_bull and array.get(rsi_arr, i) < sqn_superbull ? #006400 : array.get(rsi_arr, i) > sqn_neutral and array.get(rsi_arr, i) < sqn_bull ? #1EBAB5 : array.get(rsi_arr, i) > sqn_bear and array.get(rsi_arr, i) < sqn_neutral ? #800000 : array.get(rsi_arr, i) < sqn_bear ? #FF0000 : #aaaaaa tsi_col = array.get(tsi_arr, i) == 4 ? color.gray : array.get(tsi_arr, i) == 3 ? color.gray : array.get(tsi_arr, i) == 2 ? color.gray : array.get(tsi_arr, i) == 1 ? color.gray : #aaaaaa adx_col = array.get(adx_arr, i) > adx_level and array.get(rsi_arr, i) > sqn_bull ? #04D204 : array.get(adx_arr, i) > adx_level and array.get(rsi_arr, i) < sqn_neutral ? #FF0000 : #aaaaaa tsi_text = array.get(tsi_arr, i) == 4 ? "🟠" : array.get(tsi_arr, i) == 3 ? "🔴" : array.get(tsi_arr, i) == 2 ? "⚪" : array.get(tsi_arr, i) == 1 ? " " : "N/A" sqn_text = array.get(rsi_arr, i) > sqn_superbull ? "SB" : array.get(rsi_arr, i) > sqn_bull and array.get(rsi_arr, i) < sqn_superbull ? "B" : array.get(rsi_arr, i) > sqn_neutral and array.get(rsi_arr, i) < sqn_bull ? "N" : array.get(rsi_arr, i) > sqn_bear and array.get(rsi_arr, i) < sqn_neutral ? "Br" : array.get(rsi_arr, i) < sqn_bear ? "SBr" : "NA" //sup_text = array.get(sup_arr, i) > 0 ? "Down" : "Up" sup_col = array.get(sup_arr, i) > input5t ? #04D204 : array.get(sup_arr, i) < input5t ? #FF0000 : color.gray table.cell(tbl, 0, i + 1, array.get(s_arr, i), text_halign = text.align_left, bgcolor = color.black, 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 = cl_col, text_color = color.white, text_size = size.small) table.cell(tbl, 2, i + 1, sqn_text, text_halign = text.align_center, bgcolor = rsi_col, text_color = color.white, text_size = size.small) table.cell(tbl, 3, i + 1, tsi_text, text_halign = text.align_center, bgcolor = tsi_col, text_color = color.white, text_size = size.small) table.cell(tbl, 4, i + 1, str.tostring(array.get(adx_arr, i), "#.##"), text_halign = text.align_center, bgcolor = adx_col , text_color = color.white, text_size = size.small) table.cell(tbl, 5, i + 1, str.tostring(array.get(sup_arr, i), "#.##"), text_halign = text.align_center, bgcolor = sup_col, text_color = color.white, text_size = size.small) // }
Laguerre Filter
https://www.tradingview.com/script/sb1yuQme-Laguerre-Filter/
samsmilesam
https://www.tradingview.com/u/samsmilesam/
43
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/ // © samsmilesam //@version=4 study("Laguerre Filter", shorttitle="L filter", overlay=true) // This is the Laguerre Filter by John F. Ehlers. He published the paper : Time Warp - without space travel. // This study open gamma and weight of each filter for user to customize the filter design. // Each filter can be plotted for evaluation too. // Data of the first filter allows to input any bar, eg. 0 for current bar, 1 for one previous, // for the purpose to evulate forecasting idea. // Follows Ehlers' paper, this study allows to plot the weighted average line with all filter off. src = input(title="Source", defval=hl2) g0 = input(title="Gamma 0",defval = 0.2, minval=0, maxval=1) g1 = input(title="Gamma 1",defval = 0.8, minval=0, maxval=1) g2 = input(title="Gamma 2",defval = 0.8, minval=0, maxval=1) g3 = input(title="Gamma 3",defval = 0.9, minval=0, maxval=1) W0 = input(title="weight 0", defval=1) W1 = input(title="weight 1", defval=2) W2 = input(title="weight 2", defval=2) W3 = input(title="weight 3", defval=1) WW = W0+W1+W2+W3 s0 = input(title="Show filter L0 ?", defval =false) s1 = input(title="Show filter L1 ?", defval =false) s2 = input(title="Show filter L2 ?", defval =false) s3 = input(title="Show filter L3 ?", defval =false) ss = input(title="Show no filter MA line?", defval =false) dd = input(title="Filter 0 data delay?", defval = 0) L0 = 0.0 L1 = 0.0 L2 = 0.0 L3 = 0.0 L0 := (1 - g0) * src[dd] + g0 * nz(L0[1]) L1 := -g1 * L0 + nz(L0[1]) + g1 * nz(L1[1]) L2 := -g2 * L1 + nz(L1[1]) + g2 * nz(L2[1]) L3 := -g3 * L2 + nz(L2[1]) + g3 * nz(L3[1]) filter = (W0*L0 + W1*L1 + W2*L2 + W3*L3 )/WW // the price line when filter is on fixline = (W0*src + W1* src[1] + W2* src[2] + W3*src[3])/WW // ie When filter is off colorL = filter>filter[1]? color.olive:color.fuchsia plot(s0? L0:na, color=color.red, title="filter L0") plot(s1? L1:na, color=color.lime, title="filter L1") plot(s2? L2:na, color=color.aqua, title="filter L2") plot(s3? L3:na, color=color.gray, title="filter L3") plot(filter, color=colorL, title="L filtered", linewidth=2) plot(ss? fixline: na, color=color.blue, title="No filter")
LUNA - Hold The Line Or Die
https://www.tradingview.com/script/I1Rk3alY-LUNA-Hold-The-Line-Or-Die/
MrCryptoholic
https://www.tradingview.com/u/MrCryptoholic/
104
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/ // © MrCryptoholic //@version=5 indicator("LUNA - Hold The Line Or Die", overlay=true) ust_cap = request.security('CRYPTOCAP:UST', timeframe='', expression=close, ignore_invalid_symbol=true) luna_price = request.security('LUNAUSDT', timeframe='', expression=close, ignore_invalid_symbol=true) luna_cap = request.security('CRYPTOCAP:LUNA', timeframe='', expression=close, ignore_invalid_symbol=true) floor_coef = ust_cap / luna_cap floor_price = luna_price * floor_coef plot(floor_price, linewidth=2, editable=true)
Mazuuma Churn Indicator
https://www.tradingview.com/script/7qKGry5o-Mazuuma-Churn-Indicator/
klausbach
https://www.tradingview.com/u/klausbach/
20
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Mazuuma //@version=5 indicator("Mazuuma Churn Indicator", overlay=true, timeframe="") priceEmaInput = input.int(title="Price EMA", minval = 1, maxval = 1000, defval = 200) rsiEmaInput = input.int(title="RSI EMA", minval = 1, maxval = 1000, defval = 12) atrMaInput = input.int(title="ATR MA", minval = 1, maxval = 1000, defval = 20) adxThresholdInput = input.int(title="ADX Threshold", minval = 1, maxval = 1000, defval = 25) priceEma = ta.ema(close, priceEmaInput) rsi = ta.rsi(close, 14) rsiEma = ta.ema(rsi, rsiEmaInput) atr = ta.atr(14) atrMa = ta.sma(atr, atrMaInput) // ADX code is copied directly from ADX indicator adxlen = 14 dilen = 14 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) sig = adx(dilen, adxlen) // -------------- // Define background colors unconfirmedColor = color.new(#FFFF00, 75) // Yellow partiallyConfirmedColor = color.new(#FF8000, 75) // Orange confirmedColor = color.new(#ff0000, 75) // Red priceEmaPercentage = math.abs((1 - close / priceEma) * 100) weight = 0 if priceEmaPercentage < 16 weight := weight + 1 if rsiEma > 40 and rsiEma < 60 weight := weight + 1 if sig < adxThresholdInput weight := weight + 1 plotchar(weight, "Weight", "", location = location.top) unconfirmed = atr < atrMa and weight == 1 partiallyConfirmed = atr < atrMa and weight == 2 confirmed = atr < atrMa and weight == 3 sessioncolor = unconfirmed ? unconfirmedColor : partiallyConfirmed ? partiallyConfirmedColor : confirmed ? confirmedColor : na bgcolor(sessioncolor)
RSI & CCi SIGNAl
https://www.tradingview.com/script/C0Wzn9LT-RSI-CCi-SIGNAl/
ah_hoseyni_m
https://www.tradingview.com/u/ah_hoseyni_m/
297
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/ // © ah_hoseyni_m //@version=5 indicator(title="RSI & CCi SIGNAl" , shorttitle="RSI&CCI", overlay=true, timeframe="", timeframe_gaps=true) isShowSignalRsi = input.bool(title='Show RSI SIGNAl', defval=true, group="Signal") isShowSignalCCI = input.bool(title='Show CCI SIGNAl', defval=true, group="Signal") RavandType_ = input.string(title='RAVAND', defval='Both', options=['Ascending', 'Descending', 'Both'] , group="Signal") ss = input.int(title='Sell Value RSI', defval=30, minval=1 , group="RSI") bb = input.int(title='Buy Value RSI', defval=70, minval=2 , group="RSI") srcRsi = input(close, title="Source CCI" , group="RSI") LengthRsi = input.int(title="Length of the RSI", defval=14, minval=1 , group="RSI") lengthCCi = input.int(title="Length of the CCI", defval=20, minval=1, group="CCI") srcCCi = input(hlc3, title="Source CCI", group="CCI") maCCI = ta.sma(srcCCi, lengthCCi) ccivar = (srcCCi - maCCI) / (0.015 * ta.dev(srcCCi, lengthCCi)) rsiVar = ta.rsi(srcRsi,LengthRsi) //rsiVar = ta.rsi(close,14) longConditionRsi = ta.crossover(rsiVar , ss) shortConditionRsi = ta.crossunder(rsiVar , bb) longConditionCCI = ta.crossover(ccivar , -100) shortConditionCCI = ta.crossunder(ccivar , 100) plotshape(isShowSignalCCI and longConditionCCI and (RavandType_ == "Ascending" or RavandType_ == "Both"), style=shape.labelup, location=location.belowbar, color=color.new(color.blue, 0), size=size.tiny, title='buy label CCI', text='B', textcolor=color.new(color.white, 0)) plotshape(isShowSignalCCI and shortConditionCCI and (RavandType_ == "Descending" or RavandType_ == "Both") , style=shape.labeldown , location=location.abovebar, color=color.new(color.red, 0), size=size.tiny, title='sell label CCI', text='S', textcolor=color.new(color.white, 0)) alertcondition(isShowSignalCCI and longConditionCCI and (RavandType_ == "Ascending" or RavandType_ == "Both"), title='buy alarm CCI', message='buy signal CCi') alertcondition(isShowSignalCCI and shortConditionCCI and (RavandType_ == "Descending" or RavandType_ == "Both"), title='sell alarm CCI', message='sell signal CCI') plotshape(isShowSignalRsi and longConditionRsi and (RavandType_ == "Ascending" or RavandType_ == "Both"), style=shape.labelup, location=location.belowbar, color=color.new(color.blue, 0), size=size.tiny, title='buy label RSI', text='BUY', textcolor=color.new(color.white, 0)) plotshape(isShowSignalRsi and shortConditionRsi and (RavandType_ == "Descending" or RavandType_ == "Both") , style=shape.labeldown , location=location.abovebar, color=color.new(color.red, 0), size=size.tiny, title='sell label RSI', text='SELL', textcolor=color.new(color.white, 0)) alertcondition(isShowSignalRsi and longConditionRsi and (RavandType_ == "Ascending" or RavandType_ == "Both"), title='buy alarm RSI', message='buy signal RSI') alertcondition(isShowSignalRsi and shortConditionRsi and (RavandType_ == "Descending" or RavandType_ == "Both"), title='sell alarm RSI', message='sell signal RSI')
Rolling CAGR
https://www.tradingview.com/script/fM2Ft4XN-Rolling-CAGR/
jamiedubauskas
https://www.tradingview.com/u/jamiedubauskas/
20
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © jamiedubauskas //@version=5 indicator(title = "Rolling CAGR", shorttitle = "Rolling CAGR", overlay = false, format = format.percent) // input for the selected source src = input.source(title = "Data Source", defval = close, tooltip = "Selected data source to find the rolling CAGR on") varip first_value = barstate.isfirst ? src[0] : src // input for the number of trading days in a year for the specified ticker trading_days_in_a_year = input.int(title = "Trading Days in a Year", defval = 365, minval = 0, tooltip = "Use to input how many trading days are in a year for the specified ticker that this indicator is on. Use 365 for crypto & use 252 for stocks") // finding the number of bars (a.k.a "N" in the CAGR formula) n = ta.cum(src == src ? 1 : 0) - 1 // finding the number of bars equal a year n_years = n / trading_days_in_a_year // finding the start value and end value startValue = first_value endValue = src[0] // calculating the CAGR CAGR_(v1, v2) => (math.pow((v1 / v2), (1 / n_years)) - 1) * 100 cagr = timeframe.isdaily ? CAGR_(endValue, startValue) : na plot(cagr)
Market Direction
https://www.tradingview.com/script/0KbgdsNl-Market-Direction/
wellthere
https://www.tradingview.com/u/wellthere/
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/ // © wellthere // This script tracks the market looking for 2 consecutive 5 day periods that are lower or higher. It shows the trend of the overall market // I am using the ETF VTI to represent the overall market // This can help to determine the direction of the market when entering a position // I am also using %B BB to determine over bought and over sold conditions in VTI. I am using > 1 and < 0 but you can easily change in the script //@version=5 indicator('Market Direction', shorttitle=' Market Trend +++ OverBought=yellow and OverSold=white', overlay=false) //get current value for VTTI market = request.security('VTI', timeframe.period, low) //set the color based on the direction of the market dtrend = if market < market[5] and market[5] < market[10] color.new(color.red,50) else na utrend = if market > market[5] and market[5] > market[10] color.new(color.green,50) else na // these next 2 plots report the numbers only for the value 10 days ago and 5 days ago. plot(market[10], color=color.new(color.white,100)) plot(market[5], color=color.new(color.white,100)) plot(market, 'Trends', color=dtrend, linewidth=2, style=plot.style_area) plot(market, 'Trends', color=utrend, linewidth=2, style=plot.style_area) [middle, upper, lower] = ta.bb(market, 20, 2) price = market // price of VTI based on line 11 ( note that I am using the low and that could be changed to high or close) bper = (price - lower) / (upper - lower) plot(bper, color=color.new(color.yellow,100)) overbought = bper > 1 // using > 1 for over bought oversold = bper < 0 // using < 0 for over sold bgcolor(overbought ? color.new(color.yellow,40) : oversold ? color.new(color.white,40) : color.new(color.black,40))
BTC Golden Bottom with Adaptive Moving Average
https://www.tradingview.com/script/XRTrXB9E-BTC-Golden-Bottom-with-Adaptive-Moving-Average/
MightyZinger
https://www.tradingview.com/u/MightyZinger/
181
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/ // © MightyZinger //@version=4 study("BTC Golden Bottom", shorttitle="MZ BTC Bottom", overlay=true) src = security('INDEX:BTCUSD', timeframe.period, close) length = input(title="Adaptive MA Length", defval=365) majLength = input(title="Major Length", defval=100) minLength = input(title="Minor Length", defval=50) // Envelop Parameters showEnv = input(true, title="Show AMA Envelope", group="ENVELOPE DISTANCE ZONE") atr_mult = input(20, title="Distance (Envelope) Multiplier", step=.1, group="ENVELOPE DISTANCE ZONE") env_atr = input(40, title="Envelope ATR Length", group="ENVELOPE DISTANCE ZONE") i_Symmetrical = input(true, "Apply Symmetrically Weighted Moving Average at Envelope", group="ENVELOPE DISTANCE ZONE") minAlpha = 2 / (minLength + 1) majAlpha = 2 / (majLength + 1) hh = highest(length + 1) ll = lowest(length + 1) mult = hh - ll != 0 ? abs(2 * src - ll - hh) / (hh - ll) : 0 final = mult * (minAlpha - majAlpha) + majAlpha ma = 0.0 ma := nz(ma[1]) + pow(final, 2) * (src - nz(ma[1])) ama_plot = plot(ma, title="MZ BTC Golden Bottom Line", linewidth=4, color=color.green, transp=0) // Enveloping AMA with ATR bands env_MA = ma dev = atr_mult * atr(env_atr) // Bands m1 = input(0.236, minval=0, step=0.01, title="Fib 1", inline = "fibs1") m2 = input(0.382, minval=0, step=0.01, title="Fib 2", inline = "fibs1") m3 = input(0.5, minval=0, step=0.01, title="Fib 3", inline = "fibs1") m4 = input(0.618, minval=0, step=0.01, title="Fib 4", inline = "fibs1") m5 = input(0.764, minval=0, step=0.01, title="Fib 5", inline = "fibs1") m6 = input(1, minval=0, step=0.01, title="Fib 6", inline = "fibs1") upper_1= i_Symmetrical ? swma(env_MA + (m1*dev)) : env_MA + (m1*dev) upper_2= i_Symmetrical ? swma(env_MA + (m2*dev)) : env_MA + (m2*dev) upper_3= i_Symmetrical ? swma(env_MA + (m3*dev)) : env_MA + (m3*dev) upper_4= i_Symmetrical ? swma(env_MA + (m4*dev)) : env_MA + (m4*dev) upper_5= i_Symmetrical ? swma(env_MA + (m5*dev)) : env_MA + (m5*dev) upper_6= i_Symmetrical ? swma(env_MA + (m6*dev)) : env_MA + (m6*dev) // Plotting AMA Envelope Distance Zone p1 = plot(showEnv ? upper_1 : na, color=color.new(color.red, 50), linewidth=1, title="0.236") p2 = plot(showEnv ? upper_2 : na, color=color.new(color.red, 50), linewidth=1, title="0.382") p3 = plot(showEnv ? upper_3 : na, color=color.new(color.green, 50), linewidth=3, title="0.5") p4 = plot(showEnv ? upper_4 : na, color=color.new(color.blue, 50), linewidth=1, title="0.618") p5 = plot(showEnv ? upper_5 : na, color=color.new(color.blue, 50), linewidth=1, title="0.764") p6 = plot(showEnv ? upper_6 : na, color=color.new(color.blue, 50), linewidth=2, title="1") fill(p1, ama_plot, color=color.new(color.red, 90)) fill(p5, p6, color=color.new(color.blue, 80))
Pip Value Calculator(Original by ashkanpower)
https://www.tradingview.com/script/kpDYIrC7/
FX365_Thailand
https://www.tradingview.com/u/FX365_Thailand/
197
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/ // The original indicator is created by ashkanpower and modified by FX365_Thailand // Original : Pip Value // https://www.tradingview.com/script/OdV2qkiW-Pip-Value/ // Revision history // v60.0 First release // v61.0 Added logic for gold and silver // v63.0 Added logic for BTC and ETH //@version=5 indicator("Pip Value Calculator", overlay=true) // compact = input.bool(title="compact mode",defval=false) acc_currency = input.string(defval="USD", options=["USD","JPY", "EUR", "GBP", "AUD", "THB"], title="Account Currency") pips = input.int(title="Pips",defval=10, minval=1, tooltip="[Gold]1USD=10pips,[Silver]1USD=100Pips,[BTC/ETH]1USD=10pips") lots = input.float(title="Lots",defval=1, minval=0.01, tooltip="[Forex]1 lot is 100,000 unit of currency,[Gold]1lot=100ounce,[Silver]1lot=5000ounce,[BTC]1lot=1BTC,[ETH]1lot=1ETH") // loss = input.float(title="Loss Amount in Account Currency", defval=10000, minval=1) // ratio = input.float(title="R&R(1:N), N = ? ", defval=2, minval=1, maxval=100) fontcolor = input.color(defval=color.black, title="Font Color", inline="color" ) bgcolor = input.color(defval=color.white, title="Background Color", inline="color" ) cur = syminfo.currency base = syminfo.basecurrency usdjpy_rate = request.security("USDJPY", timeframe.period, close) usdeur_rate = request.security("USDEUR", timeframe.period, close) usdgbp_rate = request.security("USDGBP", timeframe.period, close) usdaud_rate = request.security("USDAUD", timeframe.period, close) usdthb_rate = request.security("USDTHB", timeframe.period, close) // baseusd = (syminfo.ticker == 'XAGUSD' or syminfo.ticker == 'SILVER') ? 1 : nz(request.security(base + "USD", timeframe.period, close, ignore_invalid_symbol=true), 1) baseusd = nz(request.security(base + "USD", timeframe.period, close, ignore_invalid_symbol=true), 1) jpyFixer = base == "JPY" or cur == "JPY" ? 100 : 1 profit_forex = acc_currency == "USD" ? math.round(pips * (10 * lots) / close * baseusd * jpyFixer , 2) : acc_currency == "JPY" ? math.round(pips * (10 * lots) / close * baseusd * jpyFixer * usdjpy_rate, 2) : acc_currency == "EUR" ? math.round(pips * (10 * lots) / close * baseusd * jpyFixer * usdeur_rate, 2) : acc_currency == "GBP" ? math.round(pips * (10 * lots) / close * baseusd * jpyFixer * usdgbp_rate, 2) : acc_currency == "AUD" ? math.round(pips * (10 * lots) / close * baseusd * jpyFixer * usdaud_rate, 2) : acc_currency == "THB" ? math.round(pips * (10 * lots) / close * baseusd * jpyFixer * usdthb_rate, 2) : na gold_silver_profit = (syminfo.ticker == 'XAGUSD' or syminfo.ticker == 'SILVER') ? pips * 50 * lots : (syminfo.ticker == 'XAUUSD' or syminfo.ticker == 'GOLD') ? pips * 10 * lots : na profit_commo = acc_currency == "USD" ? math.round(gold_silver_profit,2) : acc_currency == "JPY" ? math.round(gold_silver_profit * usdjpy_rate,2) : acc_currency == "EUR" ? math.round(gold_silver_profit * usdeur_rate,2) : acc_currency == "GBP" ? math.round(gold_silver_profit * usdgbp_rate,2) : acc_currency == "AUD" ? math.round(gold_silver_profit * usdaud_rate,2) : acc_currency == "THB" ? math.round(gold_silver_profit * usdthb_rate,2) : na crypto_profit = (syminfo.ticker == 'BTCUSD' ) ? pips * 10 * lots /100 : (syminfo.ticker == 'ETHUSD') ? pips * lots /10 : na profit_crypto = acc_currency == "USD" ? math.round(crypto_profit,2) : acc_currency == "JPY" ? math.round(crypto_profit * usdjpy_rate,2) : acc_currency == "EUR" ? math.round(crypto_profit * usdeur_rate,2) : acc_currency == "GBP" ? math.round(crypto_profit * usdgbp_rate,2) : acc_currency == "AUD" ? math.round(crypto_profit * usdaud_rate,2) : acc_currency == "THB" ? math.round(crypto_profit * usdthb_rate,2) : na //Get profit for plotting profit = (syminfo.ticker == 'XAGUSD' or syminfo.ticker == 'SILVER' or syminfo.ticker == 'XAUUSD' or syminfo.ticker == 'GOLD') ? profit_commo : (syminfo.ticker == 'BTCUSD' or syminfo.ticker == 'ETHUSD') ? profit_crypto : profit_forex theLoss = 0.0 foundPips = 0 // for p = 1 to 1000 // prof = acc_currency == "USD" ? p * (10 * lots) / close * baseusd * jpyFixer // : acc_currency == "JPY" ? p * (10 * lots) / close * baseusd * jpyFixer / usdjpy_rate // : na // if prof > theLoss and prof <= loss // theLoss := prof // foundPips := p var lab = label.new(0 ,0, "") var table riskTable = table.new(position.bottom_right , 1, 3, bgcolor = bgcolor, frame_width = 4, border_width = 0) if barstate.islast str1 = "" str2 = "" str1 := acc_currency == "USD" ? str.tostring(profit) + "$ per " + str.tostring(pips) + " pips" : acc_currency == "JPY" ? str.tostring(profit) + "JPY per " + str.tostring(pips) + " pips" : acc_currency == "EUR" ? str.tostring(profit) + "EUR per " + str.tostring(pips) + " pips" : acc_currency == "GBP" ? str.tostring(profit) + "GBP per " + str.tostring(pips) + " pips" : acc_currency == "AUD" ? str.tostring(profit) + "AUD per " + str.tostring(pips) + " pips" : acc_currency == "THB" ? str.tostring(profit) + "THB per " + str.tostring(pips) + " pips" : na // str2 := "Use " + str.tostring(foundPips) + ":" + str.tostring(foundPips * ratio) + " pips for " + str.tostring(math.round(theLoss, 2)) + "$" table.cell(riskTable, 0, 0, str.tostring(lots) + " lot(s)", text_color = fontcolor, text_halign = text.align_left,bgcolor = bgcolor) table.cell(riskTable, 0, 1, str1, text_color = fontcolor, text_halign = text.align_left,bgcolor = bgcolor) // table.cell(riskTable, 0, 2, str2, text_color = color.black, text_halign = text.align_left) // if barstate.islast // label.delete(lab) // if compact == false // lab := label.new(bar_index + 30, low, , textcolor=color.black, style=label.style_label_center) // else // lab := label.new(bar_index + 30, low, str.tostring(profit) + "$ " + str.tostring(pips) + "p " + str.tostring(lots / 100) + " l\n\n " + str.tostring(foundPips) + ":" + str.tostring(foundPips * ratio) + " " + str.tostring(math.round(theLoss, 2)) + "$ R:R", textcolor=color.black, style=label.style_label_center) // label.set_color(lab, color.white)
Trading Made Easy ATR Bands
https://www.tradingview.com/script/NgIPWTDG-Trading-Made-Easy-ATR-Bands/
christoefert
https://www.tradingview.com/u/christoefert/
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/ // © christoefert //@version=5 //Keltner ATR Bands indicator(title="Trading Made Easy ATR Bands", shorttitle="TME ATR Bands", overlay=true, timeframe="", timeframe_gaps=true) length = input.int(21, minval=1) mult = input(1.0, "Multiplier") src = input(ohlc4, title="Source") exp = input(true, "Use Exponential MA") BandsStyle = input.string("Average True Range", options = ["Average True Range", "True Range", "Range"], title="Bands Style") atrlength = input(10, "ATR Length") esma(source, length)=> s = ta.sma(source, length) e = ta.ema(source, length) exp ? e : s ma = esma(src, length) rangema = BandsStyle == "True Range" ? ta.tr(true) : BandsStyle == "Average True Range" ? ta.atr(atrlength) : ta.rma(high - low, length) upper = ma + rangema * mult lower = ma - rangema * mult upper2 = ma + rangema * (mult * 2) lower2 = ma - rangema * (mult * 2) upper3 = ma + rangema * (mult * 3) lower3 = ma - rangema * (mult * 3) upper4 = ma + rangema * (mult * 4) lower4 = ma - rangema * (mult * 4) u = plot(upper, color=color.green, title="1 ATR Up") plot(ma, color=color.white, title="ATR Band Basis") l = plot(lower, color=color.green, title="1 ATR Down") fill(u, l, color=color.green, title="1 ATR Zone") u2 = plot(upper2, color=color.blue, title="2 ATR Up") l2 = plot(lower2, color=color.blue, title="2 ATR Down") fill(u, u2, color=color.blue, title="2 ATR Zone Up Zone") fill(l, l2, color=color.blue, title="2 ATR Zone Down Zone") u3 = plot(upper3, color=color.orange, title="3 ATR Up") l3 = plot(lower3, color=color.orange, title="3 ATR Down") fill(u2, u3, color=color.orange, title="3 ATR Up Zone") fill(l2, l3, color=color.orange, title="3 ATR Down Zone") u4 = plot(upper4, color=color.red, title="4 ATR Up") l4 = plot(lower4, color=color.red, title="4 ATR Down") fill(u3, u4, color=color.red, title="4 ATR Up Zone") fill(l3, l4, color=color.red, title="4 ATR Down Zone") //Stack'Em Fibonacci EMAs First = ta.ema(ohlc4, 8) plot(First, title="8 EMA", color=color.green) Second = ta.ema(ohlc4, 13) plot(Second, title="13 EMA", color=color.blue) Third = ta.ema(ohlc4, 34) plot(Third, title="34 EMA", color=color.yellow) Fourth = ta.ema(ohlc4, 55) plot(Fourth, title="55 EMA", color=color.purple) Fifth = ta.ema(ohlc4, 89) plot(Fifth, title="89 EMA", color=color.white) Sixth = ta.ema(ohlc4, 144) plot(Sixth, title="144 EMA", color=color.red) // Directional Movement Trend Bars len = input.int(14, minval=1, title="DI Length") 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) trur = ta.rma(ta.tr, len) plus = fixnan(100 * ta.rma(plusDM, len) / trur) minus = fixnan(100 * ta.rma(minusDM, len) / trur) sum = plus + minus Strong_Up = plus >= 20 and plus > minus and ma[0] > ma[1] Strong_Down = minus >= 20 and minus > plus and ma[0] < ma[1] WeakUp = (plus > minus and plus < 20 and ma[0] <= ma[1]) or (plus > minus and plus < 20 and ma[0] > ma[1]) or (minus > plus and ma[0] > ma[1]) WeakDown = (minus > plus and minus < 20 and ma[0] >= ma[1]) or (minus > plus and minus < 20 and ma[0] < ma[1]) or (plus > minus and ma[0] < ma[1]) barcolor(Strong_Up ? color.lime : WeakUp ? color.blue : Strong_Down ? color.red : WeakDown ? color.orange : na)
Day Clue
https://www.tradingview.com/script/v2b7WwgR-Day-Clue/
Vignesh_vish
https://www.tradingview.com/u/Vignesh_vish/
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/ // © Vignesh_vish //@version=5 indicator('Day Clue', 'Day Clue', overlay=true,max_labels_count=500) //input var startTime = time("D") timeDiff= (time("D")-startTime)/86400000 noofDaysback=input.int(15,"No. of Days Back:",minval=0,maxval=50,tooltip="How many Number of Days From the Past You Want to Plot Day Clue Indicator, if is Set to Zero'0' then Day Clue Indicator plot for current Day Only") ema20check=input.bool(true,"Show/ Hide EMA-20",group="EMA") ema20color=input.color(color.new(color.gray,50),"Color of EMA-20",group="EMA") ema200check=input.bool(true,"Show/ Hide EMA-200",group="EMA") ema200color=input.color(color.new(color.gray,50),"Color of EMA-200",group="EMA") PDHandPDLcheck= input.bool(true,"Show/ Hide PDH & PDL",group="PDR") PDHandPDLcolor= input.color(color.new(#b71c1c,0),"Color of PDH & PDL",group="PDR") CPRcheck=input.bool(true,"Show/ Hide CPR",group="CPR") CCPRColor=input.color(color.new(#e84dc6,60),"Color of Central Pivot",group="CPR") TBCPRColor=input.color(color.new(#4d83e8,60),"Color of Top & Bottom CPR",group="CPR") S1color=input.color(color.new(#FFA500,60),"Color of S1",group="CPR") R1color=input.color(color.new(#FFA500,60),"Color of R1",group="CPR") barCursorCheck=input.bool(true,"Show/ Hide Bar-Cursor",group="Bar Coursor") barCursorcolor=input.color(color.black,"Bar-Cursor Color",group="Bar Coursor") IBRcheck=input.bool(true,"Show/ Hide IBR",group="IBR") IBlabelColor=input.color(color.black,"IB Label Color",group="IBR") IBlineColor=input.color(color.new(color.black,70),"IB Line Color",group="IBR") dataLabelCheck=input.bool(true,"Show/ Hide Data-Label",group="Data Label") dataLabelColor=input.color(color.black,"Data Label Color",group="Data Label") //dayNameCheck=input.bool(false,"Show/ Hide Day-Name",group="Day Name") secu(tikr, res, source) => request.security(tikr, res, source, lookahead=barmerge.lookahead_on) startPoltDate=timestamp(year(timenow),month(timenow),dayofmonth(timenow)-timeDiff,09, 15, 00) var string Ibtimes= na var ibRange = 0.0 var ibhigh =0.0 var iblow =0.0 var sessionBarCount = 0 var pdayhigh=0.0 var pdaylow=0.0 var pdayclose=0.0 var px1=0 var px2=0 var cprx1=0 var nexttradingday =1 tomorrow=0 var holydayfor = '◉' mkt_start_hh=09 mkt_start_mm=15 mkt_end_hh=15 mkt_end_mm=25 ib_session="" if (syminfo.prefix=="NSE" or syminfo.prefix=="BSE_DLY") mkt_start_hh:=09 mkt_start_mm:=15 mkt_end_hh:=15 mkt_end_mm:=25 ib_session:="0915-1015" else if syminfo.prefix=="MCX" mkt_start_mm:=00 mkt_end_hh:=23 ib_session:="0900-1000" ib = na(time('D', ib_session + ':23456')) == false drange() => math.round(secu(syminfo.ticker, 'D', high) - secu(syminfo.ticker, 'D', low),0) if ib ibRange := math.round(secu(syminfo.ticker, '60', high) - secu(syminfo.ticker, '60', low),0) ibhigh := secu(syminfo.ticker, '60', high) iblow :=secu(syminfo.ticker, '60', low) nl = '\n' Ibtimes:=math.round((drange()/ibRange),1)>=2?" ("+str.tostring(int((drange()/ibRange)))+"-IB)":na //1000->1K 100000->1L Convertor numberShort(number) => len = str.length(str.tostring(number)) if len >= 1 //and len <= 5 str.tostring(math.round(number / 1000, 0)) + 'K' vix() => str.tostring(math.round(secu("INDIAVIX","D",close),2))+" ("+str.tostring(math.round(((secu("INDIAVIX","D",close)-secu("INDIAVIX","D",close[1]))/secu("INDIAVIX","D",close[1]))*100,2))+"%)" TrRMA(pre=14)=> tRange=na(secu(syminfo.ticker,"D",high[1]))? secu(syminfo.ticker,"D",high)-secu(syminfo.ticker,"D",low): math.max(secu(syminfo.ticker,"D",high)-secu(syminfo.ticker,"D",low),math.abs(secu(syminfo.ticker,"D",high)-secu(syminfo.ticker,"D",close[1])),math.abs(secu(syminfo.ticker,"D",low)-secu(syminfo.ticker,"D",close[1]))) ta.rma(tRange,pre) _atr() => math.round(ta.atr(20), 0) _atravg() => math.round(ta.atr(20) / 6, 0) dayVolume(tf) => dayVol = if syminfo.ticker == 'NIFTY' secu('NIFTY1!', tf, volume) else if syminfo.ticker == 'BANKNIFTY' secu('BANKNIFTY1!', tf, volume) else secu(syminfo.ticker, tf, volume) numberShort(dayVol) futspotpricediff = if syminfo.ticker == 'NIFTY' or syminfo.ticker == 'NIFTY1!' secu('NIFTY1!', timeframe.period, close) - secu('NIFTY', timeframe.period, close) else if syminfo.ticker == 'BANKNIFTY' or syminfo.ticker == 'BANKNIFTY1!' secu('BANKNIFTY1!', timeframe.period, close) - secu('BANKNIFTY', timeframe.period, close) //combaine Text and and formatting strHelper(prefix, stat) => res = str.tostring(stat) nl + prefix + ': ' + res dynamicText() => strHelper('IBR', str.tostring(ibRange)+Ibtimes) + strHelper('Day Range', drange()) + strHelper('Day Volume', dayVolume('D')) + strHelper('ATR', _atr())+", "+str.tostring(int(TrRMA())) + strHelper('VIX', vix()) + strHelper('Fut Delta', futspotpricediff) holiday() => // disc= switch timestamp(year(time), month(time), dayofmonth(time)+nexttradingday) timestamp(2022,01,26) => "Republic Day" timestamp(2022,03,01) => "Mahashivratri" timestamp(2022,03,18) => "Holi" timestamp(2022,04,14) => "Dr. Baba Saheb Ambedkar Jayanti/ Mahavir Jayanti" timestamp(2022,04,15) => "Good Friday" timestamp(2022,05,03) => "Id-Ul-Fitr (Ramzan ID)" timestamp(2022,08,09) => "Moharram" timestamp(2022,08,15) => "Independence Day" timestamp(2022,08,31) => "Ganesh Chaturthi" timestamp(2022,10,05) => "Dussehra" timestamp(2022,10,24) => "Diwali-Laxmi Pujan*" timestamp(2022,10,26) => "Diwali-Balipratipada" timestamp(2022,11,08) => "Gurunanak Jayanti" =>'◉' disc _label(barInx) => x1=timestamp(year(time), month(time), dayofmonth(time), mkt_start_hh, mkt_start_mm, 00) x2=timestamp(year(time), month(time), dayofmonth(time), mkt_end_hh, mkt_end_mm, 00) if dataLabelCheck lbl = label.new(x1, secu(syminfo.ticker, 'D', low) - (syminfo.mintick * 5), dynamicText(),xloc=xloc.bar_time, style=label.style_label_upper_left, textalign=text.align_left, color=color.new(#d0cec2,100), textcolor=dataLabelColor) if ta.barssince(ta.change(time("D")))>=1 or dayofmonth(time)==dayofmonth(startPoltDate) label.delete(lbl[1]) if IBRcheck ibh=label.new(bar_index-(barInx-1),ibhigh,text="IBH ▶",style=label.style_label_right,textalign=text.align_right,color=color.new(#d0cec2,100),textcolor=IBlabelColor) ibl=label.new(bar_index-(barInx-1),iblow,text="IBL ▶",style=label.style_label_right,textalign=text.align_right,color=color.new(#d0cec2,100),textcolor=IBlabelColor) linibh=line.new(x1,ibhigh,x2,ibhigh,xloc.bar_time,color=IBlineColor,style= line.style_solid) linibl=line.new(x1,iblow,x2,iblow,xloc.bar_time,color=IBlineColor,style= line.style_solid) if ta.barssince(ta.change(time("D")))>=1 or dayofmonth(time)==dayofmonth(startPoltDate) label.delete(ibh[1]) label.delete(ibl[1]) line.delete(linibh[1]) line.delete(linibl[1]) day= switch dayofweek(timenow) 1 => "Sunday" 2 => "Monday" 3 => "Tuesday" 4 => "Wednesday" 5 => "Thursday" 6 => "Friday" 7 => "Saturday" holydaycolor= dayofweek(timenow) == 1 or dayofweek(timenow) == 7 or holydayfor!="◉"?color.new(color.red,50):color.new(color.teal,50) holydaysymcolor=holydayfor!="◉"?color.new(color.red,0):color.new(color.teal,0) //if dayNameCheck // daytable=table.new(position.bottom_right,columns=2,rows=1,border_width=0) // if barstate.islast // table.cell(table_id=daytable,column=0,row=0,text=day,bgcolor=color.new(color.teal,50)) // table.cell(table_id=daytable,column=1,row=0,text=holydayfor,bgcolor=holydaycolor) // table.cell_set_text_color(table_id=daytable, column=1, row=0, text_color=holydaysymcolor) loopno=1 if ta.change(time("D")) sessionBarCount:=1 nexttradingday:=1 if dayofweek == 6 nexttradingday:= nexttradingday+2 while holiday()!="◉" or dayofweek(timestamp(year(time), month(time), dayofmonth(time)+nexttradingday))== 7 or dayofweek(timestamp(year(time), month(time), dayofmonth(time)+nexttradingday))== 1 holy=holiday() if holy != "◉" and loopno == 1 holydayfor:= holy loopno:=loopno+1 nexttradingday:=nexttradingday+1 else if holy != "◉" and loopno > 1 holydayfor:=holydayfor+", "+holy loopno:=loopno+1 nexttradingday:=nexttradingday+1 else loopno:=loopno+1 nexttradingday:=nexttradingday+1 if (ta.barssince(ta.change(time("D")))>=1 or ta.change(time("D"))) and (timeframe.period== "30" or timeframe.period == "5" or timeframe.period=="15" or timeframe.period=="1") and (syminfo.prefix=="NSE" or syminfo.prefix=="BSE_DLY" or syminfo.prefix=="MCX" ) and time >= startPoltDate sessionBarCount += 1 _label(sessionBarCount - 2) //plot line for next day PDH, PDL and daily CPR with R1 and S1 mins=timeframe.period=="15"?15:timeframe.period=="1"?29:25 if time>=timestamp(year(time), month(time), dayofmonth(time), mkt_end_hh,mins, 00) and (timeframe.period == "5" or timeframe.period=="15" or timeframe.period=="1") and (syminfo.prefix=="NSE" or syminfo.prefix=="BSE_DLY" or syminfo.prefix=="MCX") px1:=timestamp(year(time), month(time), dayofmonth(time), mkt_start_hh, mkt_start_mm, 00)//x1 position for PDH and PDL cprx1:=timestamp(year(time), month(time), dayofmonth(time)+nexttradingday, mkt_start_hh, mkt_start_mm, 00)//x1 position for CPR px2:=timestamp(year(time), month(time), dayofmonth(time)+nexttradingday, mkt_end_hh, mins, 00)//x2 position for CPR,PDH and PDL pdayhigh:=secu(syminfo.ticker, 'D', high) pdaylow:=secu(syminfo.ticker, 'D', low) pdayclose:=secu(syminfo.ticker, 'D', close) Ccpr=(pdayhigh+pdaylow+pdayclose)/3 Bcpr=(pdayhigh+pdaylow)/2 Tcpr=(Ccpr-Bcpr)+Ccpr r1=(2*Ccpr)-pdaylow s1=(2*Ccpr)-pdayhigh if PDHandPDLcheck pdh=line.new(px1,pdayhigh,px2,pdayhigh,xloc.bar_time,color=PDHandPDLcolor,style= line.style_dotted,width=2) line.delete(pdh[1]) pdl=line.new(px1,pdaylow,px2,pdaylow,xloc.bar_time,color=PDHandPDLcolor,style= line.style_dotted,width=2) line.delete(pdl[1]) if CPRcheck CcprLine=line.new(cprx1,Ccpr,px2,Ccpr,xloc.bar_time,color=CCPRColor,style= line.style_dotted,width=3) line.delete(CcprLine[1]) BcprLine=line.new(cprx1,Bcpr,px2,Bcpr,xloc.bar_time,color=TBCPRColor,style= line.style_dotted,width=3) line.delete(BcprLine[1]) TcprLine=line.new(cprx1,Tcpr,px2,Tcpr,xloc.bar_time,color=TBCPRColor,style= line.style_dotted,width=3) line.delete(TcprLine[1]) s1Line=line.new(cprx1,s1,px2,s1,xloc.bar_time,color=S1color,style= line.style_dotted,width=3) line.delete(s1Line[1]) r1Line=line.new(cprx1,r1,px2,r1,xloc.bar_time,color=R1color,style= line.style_dotted,width=3) line.delete(r1Line[1]) //current bar price and volume label if barCursorCheck sidelbl = label.new(time + 5, close,xloc=xloc.bar_time, text=str.tostring(close) + nl + str.tostring(dayVolume(timeframe.period)), style=label.style_label_left, textalign=text.align_left, color=color.new(#d0cec2,100), textcolor=barCursorcolor) label.delete(sidelbl[1]) intradaytrendindicator=if na(volume)==false and timeframe.isintraday ta.vwap(hlc3) else ta.ema(close,20) plot(ema20check?intradaytrendindicator:na,"EMA-20", na(volume)==false?color.orange:ema20color) plot(ema200check?ta.ema(close,200):na,"EMA-200",color=ema200color,linewidth=2)
Trailing Stop Alerts
https://www.tradingview.com/script/GRTKTHdW-Trailing-Stop-Alerts/
ZenAndTheArtOfTrading
https://www.tradingview.com/u/ZenAndTheArtOfTrading/
1,124
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ZenAndTheArtOfTrading // @version=5 indicator("Trailing Stop Alerts", overlay=true) // Get user input trailType = input.string(title="Trail Type", defval="Long", options=["Long", "Short"], confirm=true) structureLookback = input.int(title="Lookback", defval=7, confirm=true) atrLength = input.int(title="ATR Length", defval=14) multiplier = input.float(title="ATR Multiplier", defval=1.0, confirm=true) barTime = input.time(title="Bar Time", defval=timestamp("01 Jan 2021 13:30 +0000"), confirm=true) // Get the current ATR atr = ta.atr(atrLength) * multiplier // Declare trailing variables var trailPrice = 0.0 t_trailPrice = trailType == "Long" ? ta.lowest(low, structureLookback) - atr : ta.highest(high, structureLookback) + atr alertType = -1 // Check for trailing stop update if time >= barTime and barstate.isconfirmed // Trail long stop if (t_trailPrice > trailPrice or trailPrice == 0.0) and trailType == "Long" trailPrice := t_trailPrice // Trigger alert alertType := 1 alert(message="Trailing Stop updated for " + syminfo.tickerid + ": " + str.tostring(trailPrice, "#.#####"), freq=alert.freq_once_per_bar_close) // Trail short stop if (t_trailPrice < trailPrice or trailPrice == 0.0) and trailType == "Short" trailPrice := t_trailPrice // Trigger alert alertType := 1 alert(message="Trailing Stop updated for " + syminfo.tickerid + ": " + str.tostring(trailPrice, "#.#####"), freq=alert.freq_once_per_bar_close) // If long stop is hit, reset trail stop if trailPrice != 0.0 and low <= trailPrice and trailType == "Long" trailPrice := na // Trigger alert alertType := 2 alert(message="Trailing Stop hit for " + syminfo.tickerid, freq=alert.freq_once_per_bar_close) // If short stop is hit, reset trail stop if trailPrice != 0.0 and high >= trailPrice and trailType == "Short" trailPrice := na // Trigger alert alertType := 2 alert(message="Trailing Stop hit for " + syminfo.tickerid, freq=alert.freq_once_per_bar_close) // Draw data to chart plot(trailPrice != 0 ? trailPrice : na, color=color.red, title="Trailing Stop") // Trigger alert conditions alertcondition(alertType == 1, "Trailing Stop Update", "Trailing Stop updated for {{ticker}}: {{plot_0}}") alertcondition(alertType == 2, "Trailing Stop Hit", "Trailing Stop hit for {{ticker}}")
MFI Divergence Indicator
https://www.tradingview.com/script/f7bHx0VT-MFI-Divergence-Indicator/
sparkandhale
https://www.tradingview.com/u/sparkandhale/
191
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/ // © thekarasystem //@version=5 indicator(title="TKS::INDI:MFI Divergence", format=format.price, overlay=false, timeframe="", timeframe_gaps=true) //Get User Inputs len = input.int(title="MFI Period", minval=1, defval=14) src = input(title="MFI Source", defval=close) plotBull = input(title="Plot Bullish", defval=true) plotHiddenBull = input(title="Plot Hidden Bullish", defval=true) plotBear = input(title="Plot Bearish", defval=true) plotHiddenBear = input(title="Plot Hidden Bearish", defval=true) Lookback_Right = input(title="Pivot Lookback Right", defval=5) Lookback_Left = input(title="Pivot Lookback Left", defval=20) rangeUpper = input(title="Max of Lookback Range", defval=100) rangeLower = input(title="Min of Lookback Range", defval=5) ON_RSI = input.bool(title="Show RSI", tooltip="Will display the RSI in light blue. The parameters of the MFI apply", defval=true) //Get MFI MFI = ta.mfi(src, len) RSI = ta.rsi(src, len) //Plotting MFI bearColor = color.red hbearColor = color.orange bullColor = color.green hbullColor = #73BF16 textColor = color.white noneColor = color.new(color.white, 100) // Calculate the differences between MFI and RSI. dif = math.abs(RSI-MFI) plot(MFI, title="MFI", linewidth=1, color=(dif < 20 ? #D30895 : color.yellow )) plot(RSI, title="RSI", linewidth=1, color=(ON_RSI ? color.new(color.blue, 60) : na)) hline(50, title="Middle Line", color=#787B86) obLevel = hline(80, title="Overbought", color=#787B86, linestyle=hline.style_dotted) osLevel = hline(20, title="Oversold", color=#787B86, linestyle=hline.style_dotted) fill(obLevel, osLevel, title="Background", color=color.rgb(33, 150, 243, 90)) //Regular Bullish Pivot Point Pivot_Low_Found_Regular_Bullish = na(ta.pivotlow(MFI, Lookback_Left, Lookback_Right)) ? false : true _in_Range_Regular_Bullish(cond) => bars = ta.barssince(cond == true) rangeLower <= bars and bars <= rangeUpper //Detect Regular Bullish Divergence MFI_Higher_Low_Regular_Bullish = MFI[Lookback_Right] > ta.valuewhen(Pivot_Low_Found_Regular_Bullish, MFI[Lookback_Right], 1) and _in_Range_Regular_Bullish(Pivot_Low_Found_Regular_Bullish[1]) Price_Lower_Low_Regular_Bullish = low[Lookback_Right] < ta.valuewhen(Pivot_Low_Found_Regular_Bullish, low[Lookback_Right], 1) condition_Regular_Bullish = plotBull and MFI_Higher_Low_Regular_Bullish and Price_Lower_Low_Regular_Bullish and Pivot_Low_Found_Regular_Bullish //Plotting Regular Bullish Divergence plot(Pivot_Low_Found_Regular_Bullish ? MFI[Lookback_Right] : na, offset=-Lookback_Right, title="Bull", linewidth=1, color=(condition_Regular_Bullish ? bullColor : noneColor)) plotshape(condition_Regular_Bullish ? MFI[Lookback_Right] : na, offset=-Lookback_Right, title="Regular Bullish Label", text=" Bull ", style=shape.labeldown, location=location.absolute, color=bullColor, textcolor=textColor) //Hidden Bullish Pivot Point Pivot_Low_Found_Hidden_Bullish = na(ta.pivotlow(MFI, Lookback_Left, Lookback_Right)) ? false : true _in_Range_Hidden_Bullish(cond) => bars = ta.barssince(cond == true) rangeLower <= bars and bars <= rangeUpper //Detect Hidden Bullish Divergence MFI_Lower_Low_Hidden_Bullish = MFI[Lookback_Right] < ta.valuewhen(Pivot_Low_Found_Hidden_Bullish, MFI[Lookback_Right], 1) and _in_Range_Hidden_Bullish(Pivot_Low_Found_Hidden_Bullish[1]) Price_Higher_Low_Hidden_Bullish = low[Lookback_Right] > ta.valuewhen(Pivot_Low_Found_Hidden_Bullish, low[Lookback_Right], 1) condition_Hidden_Bullish = plotHiddenBull and MFI_Lower_Low_Hidden_Bullish and Price_Higher_Low_Hidden_Bullish and Pivot_Low_Found_Hidden_Bullish //Plotting Hidden Bullish Divergence plot(Pivot_Low_Found_Hidden_Bullish ? MFI[Lookback_Right] : na, offset=-Lookback_Right, title="HBull", linewidth=1, color=(condition_Hidden_Bullish ? hbullColor : noneColor)) plotshape(condition_Hidden_Bullish ? MFI[Lookback_Right] : na, offset=-Lookback_Right, title="Hidden Bullish Label", text=" HBull ", style=shape.labeldown, location=location.absolute, color=hbullColor, textcolor=textColor) //Regular Bearish Pivot Point Pivot_High_Found_Regular_Bearish = na(ta.pivothigh(MFI, Lookback_Left, Lookback_Right)) ? false : true _in_Range_Regular_Bearish(cond) => bars = ta.barssince(cond == true) rangeLower <= bars and bars <= rangeUpper //Detect Regular Bearish Divergence MFI_Lower_High_Regular_Bearish = MFI[Lookback_Right] < ta.valuewhen(Pivot_High_Found_Regular_Bearish, MFI[Lookback_Right], 1) and _in_Range_Regular_Bearish(Pivot_High_Found_Regular_Bearish[1]) Price_Higher_High_Regular_Bearish = high[Lookback_Right] > ta.valuewhen(Pivot_High_Found_Regular_Bearish, high[Lookback_Right], 1) condition_Regular_Bearish = plotBear and MFI_Lower_High_Regular_Bearish and Price_Higher_High_Regular_Bearish and Pivot_High_Found_Regular_Bearish //Plotting Regular Bearish Divergence plot(Pivot_High_Found_Regular_Bearish ? MFI[Lookback_Right] : na, offset=-Lookback_Right, title="Bear", linewidth=1, color=(condition_Regular_Bearish ? bearColor : noneColor)) plotshape(condition_Regular_Bearish ? MFI[Lookback_Right] : na, offset=-Lookback_Right, title="Regular Bearish Label", text=" Bear ", style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor) //Hidden Bearish Pivot Point Pivot_High_Found_Hidden_Bearish = na(ta.pivothigh(MFI, Lookback_Left, Lookback_Right)) ? false : true _in_Range_Hidden_Bearish(cond) => bars = ta.barssince(cond == true) rangeLower <= bars and bars <= rangeUpper //Detect Hidden Bearish Divergence MFI_Higher_High_Hidden_Bearish = MFI[Lookback_Right] > ta.valuewhen(Pivot_High_Found_Hidden_Bearish, MFI[Lookback_Right], 1) and _in_Range_Hidden_Bearish(Pivot_High_Found_Hidden_Bearish[1]) Price_Lower_High_Hidden_Bear = high[Lookback_Right] < ta.valuewhen(Pivot_High_Found_Hidden_Bearish, high[Lookback_Right], 1) condition_Hidden_Bearish = plotHiddenBear and MFI_Higher_High_Hidden_Bearish and Price_Lower_High_Hidden_Bear and Pivot_High_Found_Hidden_Bearish //Plotting Hidden Bearish Divergence plot(Pivot_High_Found_Hidden_Bearish ? MFI[Lookback_Right] : na, offset=-Lookback_Right, title="HBear", linewidth=1, color=(condition_Hidden_Bearish ? hbearColor : noneColor)) plotshape(condition_Hidden_Bearish ? MFI[Lookback_Right] : na, offset=-Lookback_Right, title="Hidden Bearish Label", text=" HBear ", style=shape.labeldown, location=location.absolute, color=hbearColor, textcolor=textColor)
Choppiness Index Tile
https://www.tradingview.com/script/D2HDbWeH-Choppiness-Index-Tile/
vtrader321
https://www.tradingview.com/u/vtrader321/
69
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © vtrader321 //@version=5 indicator(title='Choppiness Index Tile', shorttitle='CHOP Tile', format=format.price, precision=2, overlay=true) i_lowerBandColor = input.color(color.rgb(38, 166, 154), title='Lower Band Color (< 38.2)') i_upperBandColor = input.color(color.rgb(240, 83, 80), title='Upper Band Color (> 61.8)') i_midBandColor = input.color(color.rgb(33, 150, 243), title='Mid Band Color(Between 38.2 and 61.8)') i_tableYpos = input.string('top', 'Panel position', inline='11', options=['top', 'middle', 'bottom']) i_tableXpos = input.string('right', '', inline='11', options=['left', 'center', 'right']) i_length = input.int(14, minval=1,title="Length") _ci = 100 * math.log10(math.sum(ta.atr(1), i_length) / (ta.highest(i_length) - ta.lowest(i_length))) / math.log10(i_length) var table _table = table.new(i_tableYpos + '_' + i_tableXpos, 1, 1, border_width=3) color _cell_color = na if _ci > 61.8 _cell_color := i_upperBandColor _cell_color else if _ci < 38.2 _cell_color := i_lowerBandColor _cell_color else _cell_color := i_midBandColor _cell_color _cellText = 'CHOP' + '\n' + str.tostring(_ci, '0.00') table.cell(_table, 0, 0, _cellText, bgcolor=color.new(_cell_color, 80), text_color=_cell_color, text_size=size.normal) plotchar(_ci, title="CHOP Tile", char="", location=location.top)
Percent Change Alert
https://www.tradingview.com/script/QBzCWvvg-Percent-Change-Alert/
ekthunrongSR
https://www.tradingview.com/u/ekthunrongSR/
48
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ekthunrongSR //@version=5 indicator("Percent Change Alert", overlay = true) // volume pct_chg_vol = input.int(30, "Percent Change Volume") price_threshold = input.float(3.0, "Percent Change Price") pct_chg_price = ((close - close[1])/close[1]) volume_signal = volume > volume[1]*(pct_chg_vol/100) ema_len = input.int(50, "EMA Length") ema = ta.ema(close, ema_len) bull = close > ema signal = pct_chg_price > (price_threshold/100) and volume_signal and bull plot(ema, "EMA", color = color.blue) plotshape(signal, "Signal", color = color.black, style = shape.arrowup, location = location.belowbar) alertcondition(signal, "Long Signal", "{{ticker}}, Long Signal")
VolatilityDivergenceRedGreen by STTA
https://www.tradingview.com/script/aah1OLDq-VolatilityDivergenceRedGreen-by-STTA/
Trading-Software-Consulting
https://www.tradingview.com/u/Trading-Software-Consulting/
39
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Trading-Software-Consulting // Name: VolaDivergenceRedGreen by STTA // - Undelying and implied volatiliy normally show negative correlated behavior (price rises, vola falls and vice versa) // - This study shows symbols in on candles in chart where Undelying and corresponding vola index show same bahvior for 1,2 or 3 consecutive bars. (price rises and vola rises and vice versa) // - This situation is called Vola Divergence. Red when prices and vola fall; green when price and vola rise // - This information can be used to detect end of up / Down swings. // - User can configure if rising or falling or both price movements shall be displayed. // - This study can be used with root symbols, which provide corresponding volatility indices. // - in all other symbols, no symbols are displayed. // // Inputs // - underlying displayed in chart // // Settings/Parameter // - each Divergence can be switched off/on separately // - each displayed symbol can be configured // // Outputs // - RedDiv1: first bar with rising price and rising volatility index // - GreenDiv1: first bar with falling price and falling volatility index // - RedDiv2: second bar in a row with rising price and rising volatility index // - GreenDiv2: second bar with falling price and falling volatility index // - RedDiv3: third bar in a row with rising price and rising volatility index // - GreenDiv3: third bar in a row with falling price and falling volatility index //@version=5 indicator(title="VolaDivergenceRedGreen by STTA", shorttitle="VDRG", precision=0, overlay=true) // load symbol cSymbol = close // load Vola Index iVolaIndex = if syminfo.root == "SPX" or syminfo.root == "SPY" or syminfo.root == "ES" or syminfo.root == "MES" iVolaIndex = "VIX" else if syminfo.root == "NDQ" or syminfo.root == "QQQ" or syminfo.root == "NQ" iVolaIndex = "VXN" else if syminfo.root == "DJI" or syminfo.root == "DJIA" or syminfo.root == "DIA" or syminfo.root == "US30" iVolaIndex = "VXD" else if syminfo.root == "RUT" or syminfo.root == "RTY" or syminfo.root == "IWM" or syminfo.root == "US2000" iVolaIndex = "RVX" else if syminfo.root == "CL" or syminfo.root == "OIL" iVolaIndex = "OVX" else if syminfo.ticker == "XLE" iVolaIndex = "VXXLE" else if syminfo.root == "GC" or syminfo.root == "GOLD" or syminfo.root == "XAU" iVolaIndex = "GVZ" else if syminfo.root == "SI" or syminfo.root == "SILVER" or syminfo.root == "XAG" or syminfo.root == "SLV" iVolaIndex = "VXSLV" else if syminfo.root == "EUR" iVolaIndex = "EVZ" else if syminfo.root == "HSI" iVolaIndex = "VHSI" else if syminfo.ticker == "FXI" iVolaIndex = "VXFXI" else if syminfo.ticker== "EWZ" iVolaIndex = "VXEWZ" else if syminfo.ticker == "AMZN" iVolaIndex = "VXAZN" else if syminfo.ticker == "AAPL" iVolaIndex = "VXAPL" else if syminfo.ticker == "GS" iVolaIndex = "VXGS" else if syminfo.root == "GOOG" iVolaIndex = "VXGOG" else if syminfo.root == "IBM" iVolaIndex = "VXIBM" else if syminfo.root == "DEU40" or syminfo.root == "DAX" or syminfo.root == "DE40" iVolaIndex = "DV1X" else iVolaIndex = "" cVolaIndex = not(iVolaIndex == "") ? request.security(iVolaIndex, '', close) : na // Calculate Conditions //Symbol bSymbolDown = cSymbol[0] < cSymbol[1] ? 1 : 0 bSymbolUp = cSymbol[0] > cSymbol[1] ? 1 : 0 bSymbolDown2 = cSymbol[0] < cSymbol[1] and cSymbol[1] < cSymbol[2] ? 1 : 0 bSymbolUp2 = cSymbol[0] > cSymbol[1] and cSymbol[1]> cSymbol[2] ? 1 : 0 bSymbolDown3 = cSymbol[0] < cSymbol[1] and cSymbol[1] < cSymbol[2] and cSymbol[2] < cSymbol[3] ? 1 : 0 bSymbolUp3 = cSymbol[0] > cSymbol[1] and cSymbol[1]> cSymbol[2] and cSymbol[2]> cSymbol[3] ? 1 : 0 //Vola bVolaDown = cVolaIndex[0] < cVolaIndex[1] ? 1 : 0 bVolaUp = cVolaIndex[0] > cVolaIndex[1] ? 1 : 0 bVolaDown2 = cVolaIndex[0] < cVolaIndex[1] and cVolaIndex[1] < cVolaIndex[2] ? 1 : 0 bVolaUp2 = cVolaIndex[0] > cVolaIndex[1] and cVolaIndex[1] > cVolaIndex[2] ? 1 : 0 bVolaDown3 = cVolaIndex[0] < cVolaIndex[1] and cVolaIndex[1] < cVolaIndex[2] and cVolaIndex[2] < cVolaIndex[3] ? 1 : 0 bVolaUp3 = cVolaIndex[0] > cVolaIndex[1] and cVolaIndex[1] > cVolaIndex[2] and cVolaIndex[2] > cVolaIndex[3] ? 1 : 0 // calculate Divergencies bRedDiv = bSymbolDown and bVolaDown ? 1 : 0 bGreenDiv = bSymbolUp and bVolaUp ? 1 : 0 bRedDiv2 = bSymbolDown2 and bVolaDown2 ? 1 : 0 bGreenDiv2 = bSymbolUp2 and bVolaUp2 ? 1 : 0 bRedDiv3 = bSymbolDown3 and bVolaDown3 ? 1 : 0 bGreenDiv3 = bSymbolUp3 and bVolaUp3 ? 1 : 0 plotshape(bRedDiv and not bRedDiv2 and not bRedDiv3 ? bar_index : na, style=shape.triangleup, location=location.belowbar, color= color.red, text='1', size=size.tiny, title='RedDiv1') plotshape(bGreenDiv and not bGreenDiv2 and not bGreenDiv3 ? bar_index : na, style=shape.triangledown, location=location.abovebar, color= color.green, text='1', size=size.tiny, title='GreenDiv1') plotshape(bRedDiv2 and not bRedDiv3 ? bar_index : na, style=shape.triangleup, location=location.belowbar, color= color.red, text='2', size=size.small, title='RedDiv2') plotshape(bGreenDiv2 and not bGreenDiv3 ? bar_index : na, style=shape.triangledown, location=location.abovebar, color= color.green, text='2', size=size.small, title='GreenDiv2') plotshape(bRedDiv3 ? bar_index : na, style=shape.triangleup, location=location.belowbar, color= color.red, text='3', size=size.normal, title='RedDiv3') plotshape(bGreenDiv3 ? bar_index : na, style=shape.triangledown, location=location.abovebar, color= color.green, text='3', size=size.normal, title='GreenDiv3')
Bybit perp discount vs Coinbase BTC
https://www.tradingview.com/script/pcsnqUPf-Bybit-perp-discount-vs-Coinbase-BTC/
Digi20
https://www.tradingview.com/u/Digi20/
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/ // © Digi20 //@version=4 study("Bybit Discount", shorttitle='Bybit Discount', overlay=false, precision=3) coinbase = input(title="coinbase", defval = "COINBASE:BTCUSD") bybit = input(title="bybit", defval = "BYBIT:BTCUSDT") coinbase_ = security(coinbase, timeframe.period, close) bybit_ = security(bybit, timeframe.period, close) diff = coinbase_ - bybit_ col = diff >= 0 ? #FFFFFF : #FF69B4 plot(diff, color=col, style=plot.style_histogram, linewidth=1)
Market bars sentiment
https://www.tradingview.com/script/bwKOzDxZ/
DRAWA2009
https://www.tradingview.com/u/DRAWA2009/
28
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © DRAWA2009 //Consu pour l'utilisation en graphique de temps : D et W de preferance. //Attention indicateur adapté pour évaluer les setiments d'achat pour : CRYPTOS,INDICES BURSIER et ACTIONS. //En cas d'utilisation sur Forex eventuelemtnt pour evaluer les sentiments de la paire de devise a l'achat! //@version=5 indicator("Market bars sentiment",overlay=true) //variable: Ema1 = ta.ema(close,120) Lower = ta.lowest(Ema1, 9) Upper = ta.highest(Ema1, 9) Du = ta.sma((Upper - Ema1),2) Dl = ta.sma((Lower - Ema1),2) // couleur green = sentiment achat positive, couleur lime = achat euphorieque, couleur red= vent panique barcolor(Dl<Dl[1] ? color.lime : Dl>=Dl[1] and Du<=Du[1] ? color.new(color.green, 45) : color.red)
Fibonacci levels MTF
https://www.tradingview.com/script/6BL47X8Q-Fibonacci-levels-MTF/
LonesomeTheBlue
https://www.tradingview.com/u/LonesomeTheBlue/
3,413
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("Fibonacci levels MTF", overlay = true) timeframe = input.timeframe(defval = "D", title = "Higher Time Frame") currentlast = input.string(defval = "Last", title = "Current or Last HTF Candle", options = ["Current", "Last"]) showfibolabels = input.bool(defval = true, title = "Price Labels") showhtfcandle = input.bool(defval = false, title = "Show HTF Candles", inline ="candle") upcol = input.color(defval = color.rgb(0, 255, 0, 75), title = "", inline ="candle") downcol = input.color(defval = color.rgb(255, 0, 0, 75), title = "", inline ="candle") wickcol = input.color(defval = color.new(color.gray, 75), title = "", inline ="candle") enable0 = input.bool(defval = true, title = "Level 0", inline = "0", group = "Fibonacci Levels") level0 = input.float(defval = 0.000, title = "", minval = 0, inline = "0", group = "Fibonacci Levels") color0 = input.color(defval = color.blue, title = "", inline = "0", group = "Fibonacci Levels") enable1 = input.bool(defval = true, title = "Level 1", inline = "1", group = "Fibonacci Levels") level1 = input.float(defval = 0.236, title = "", minval = 0, inline = "1", group = "Fibonacci Levels") color1 = input.color(defval = color.lime, title = "", inline = "1", group = "Fibonacci Levels") enable2 = input.bool(defval = true, title = "Level 2", inline = "2", group = "Fibonacci Levels") level2 = input.float(defval = 0.382, title = "", minval = 0, inline = "2", group = "Fibonacci Levels") color2 = input.color(defval = color.red, title = "", inline = "2", group = "Fibonacci Levels") enable3 = input.bool(defval = true, title = "Level 3", inline = "3", group = "Fibonacci Levels") level3 = input.float(defval = 0.500, title = "", minval = 0, inline = "3", group = "Fibonacci Levels") color3 = input.color(defval = color.orange, title = "", inline = "3", group = "Fibonacci Levels") enable4 = input.bool(defval = true, title = "Level 4", inline = "4", group = "Fibonacci Levels") level4 = input.float(defval = 0.618, title = "", minval = 0, inline = "4", group = "Fibonacci Levels") color4 = input.color(defval = color.teal, title = "", inline = "4", group = "Fibonacci Levels") enable5 = input.bool(defval = true, title = "Level 5", inline = "5", group = "Fibonacci Levels") level5 = input.float(defval = 0.786, title = "", minval = 0, inline = "5", group = "Fibonacci Levels") color5 = input.color(defval = color.navy, title = "", inline = "5", group = "Fibonacci Levels") enable100 = input.bool(defval = true, title = "Level 6", inline = "100", group = "Fibonacci Levels") level100 = input.float(defval = 1, title = "", minval = 0, inline = "100", group = "Fibonacci Levels") color100 = input.color(defval = color.blue, title = "", inline = "100", group = "Fibonacci Levels") // htf candle newbar = ta.change(time(timeframe)) != 0 var float htfhigh = high var float htflow = low var float htfopen = open float htfclose = close var counter = 0 if newbar htfhigh := high htflow := low htfopen := open counter := 0 else htfhigh := math.max(htfhigh, high) htflow := math.min(htflow, low) counter += 1 if showhtfcandle var candle = array.new_box(3, na) if not newbar for x = 0 to 2 box.delete(array.get(candle, x)) array.set(candle, 0, box.new(bar_index - counter, math.max(htfopen, htfclose), bar_index, math.min(htfopen, htfclose), border_width = 0, bgcolor = htfclose >= htfopen ? upcol : downcol)) array.set(candle, 1, box.new(bar_index - counter, htfhigh, bar_index, math.max(htfopen, htfclose), border_width = 0, bgcolor = wickcol)) array.set(candle, 2, box.new(bar_index - counter, math.min(htfopen, htfclose), bar_index, htflow, border_width = 0, bgcolor = wickcol)) var float open_ = na var float high_ = na var float low_ = na var float close_ = na if currentlast == "Last" and newbar open_ := htfopen[1] high_ := htfhigh[1] low_ := htflow[1] close_ := htfclose[1] else if currentlast == "Current" open_ := htfopen high_ := htfhigh low_ := htflow close_ := htfclose var enabled = array.from(enable100, enable5, enable4, enable3, enable2, enable1, enable0) var levels = array.from(level100, level5, level4, level3, level2, level1, level0) var colors = array.from(color100, color5, color4, color3, color2, color1, color0) mlevels = array.new_float(7, na) if not newbar for x = 0 to array.size(levels) - 1 array.set(mlevels, x, array.get(enabled, x) ? (close_ >= open_ ? high_ - (high_ - low_) * array.get(levels, x) : low_ + (high_ - low_) * array.get(levels, x)) : na) // fibonacci levels plot(array.get(mlevels, 0), color = array.get(colors, 0), style=plot.style_linebr) plot(array.get(mlevels, 1), color = array.get(colors, 1), style=plot.style_linebr) plot(array.get(mlevels, 2), color = array.get(colors, 2), style=plot.style_linebr) plot(array.get(mlevels, 3), color = array.get(colors, 3), style=plot.style_linebr) plot(array.get(mlevels, 4), color = array.get(colors, 4), style=plot.style_linebr) plot(array.get(mlevels, 5), color = array.get(colors, 5), style=plot.style_linebr) plot(array.get(mlevels, 6), color = array.get(colors, 6), style=plot.style_linebr) if barstate.islast and showfibolabels var flabels = array.new_label(0) for x = 0 to (array.size(flabels) > 0 ? array.size(flabels) - 1 : na) label.delete(array.pop(flabels)) float mid = (high_ + low_) / 2 for x = 0 to (array.size(enabled) > 0 ? array.size(enabled) - 1 : na) if array.get(enabled, x) level = array.get(mlevels, x) stl = level > mid ? label.style_label_lower_left : level < mid ? label.style_label_upper_left : label.style_label_left array.push(flabels, label.new(bar_index + 1, level, text = str.tostring(math.round(array.get(levels, x), 3)) + " (" + str.tostring(math.round_to_mintick(level)) + ")", color = array.get(colors, x), textcolor = color.white, style = stl))
Support Resistance Zones using confluence & Std. Deviation
https://www.tradingview.com/script/wp8feP9t-Support-Resistance-Zones-using-confluence-Std-Deviation/
TJalam
https://www.tradingview.com/u/TJalam/
407
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/ // © Badshah.E.Alam //@version=5 indicator('Support Resistance Zones using confluence & Std. Deviation', shorttitle='S/R Zone & Confluences', overlay=true, max_bars_back=1000, max_lines_count=400, max_labels_count=400) ////////////////////////////////////////////////////////////////// srnum = input.int(defval = 6, title = "Number of Support/Resistance", minval = 1, maxval = 6, confirm=true, group = "Setup", tooltip = "you can set the number of S/R levels to be shown") // 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, srnum > 5 ? input.price(0.0, title="S/R level 6", confirm=true, group = "Setup") : na) seprator8 = input.bool(true, '=====================================================',group="Setup") //////////////////////////////////////////////////////// //Confluence settings t_or_f_zone=input(true,"Display Zones",group="Confluence settings") display_line=input(false,"Display Individual confluences",group="Confluence settings") shift_box = input.int(100, "Shift box left by 'x' bars",group="Confluence settings",minval=0,maxval=400) shift_box_r = input.int(100, "Shift box Right by 'x' bars",group="Confluence settings",minval=0,maxval=400) st_deviation_input_val=input.float(20,"Minimum standard deviation",group="Confluence settings") nearest_n_values=input.int(4,"Number of confluence to check",minval=2,maxval=30,group="Confluence settings") resistancecol = input(defval = color.red, title = "Zone Resistance Color",group="Confluence settings") resistancecol_ = input(defval =color.new( color.red,80), title = "Zone background Resistance Color",group="Confluence settings") supportcol = input(defval =color.lime, title = "Zone Support Color",group="Confluence settings") supportcol_ = input(defval =color.new(color.lime,80), title = "Zone background Support Color",group="Confluence settings") individual_level_color= input(defval = color.blue, title = "individual level Color",group="Confluence settings") seprator5 = input.bool(true, '=====================================================',group="Confluence settings") ///////////////////////////////////////////////////////////////////////////////////////////////////////// //ATH, ATL, Weekly High, Weekly Low, two days ago high, two days ago low, previous day high , previous day low styleOption = input.string(title="Line Style", options=["solid (─)", "dotted (┈)", "dashed (╌)", "arrow left (←)", "arrow right (→)", "arrows both (↔)"], defval="solid (─)",group="Levels settings") lineStyle = (styleOption == "dotted (┈)") ? line.style_dotted : (styleOption == "dashed (╌)") ? line.style_dashed : (styleOption == "arrow left (←)") ? line.style_arrow_left : (styleOption == "arrow right (→)") ? line.style_arrow_right : (styleOption == "arrows both (↔)") ? line.style_arrow_both : line.style_solid styleOption_r = input.string(title="Line Style", options=["Right stretch", "Left stretch", "Full stretch"], defval="Full stretch",group="Levels settings") lineStyle_r = (styleOption_r == "Right stretch") ? extend.right : (styleOption_r == "Left stretch") ?extend.left: (styleOption_r == "Full stretch") ? extend.both :extend.none line_w=input.int(1,"Line Width",minval=1,maxval=5) col_ath=input.color(color.maroon,"ATH/ATH",group="Levels settings") col_atl=input.color(color.red,"Weekly H/L",group="Levels settings") col_atl_d=input.color(color.blue,"Daily H/L",group="Levels settings") col_atl_d_=input.color(color.yellow,"Two day ago H/L",group="Levels settings") remove_ath=input(false,"Display ATH",group="Levels settings") remove_atl=input(false,"Display ATL",group="Levels settings") remove_wklyh=input(false,"Display Weekly high",group="Levels settings") remove_wklyl=input(false,"Display Weekly Low",group="Levels settings") remove_pdh=input(false,"Display Pre Day High",group="Levels settings") remove_pdl=input(false,"Display Pre Day low",group="Levels settings") remove_2pdh=input(false,"Display two days High",group="Levels settings") remove_2pdl=input(false,"Display two days low",group="Levels settings") no_of_bars=ta.barssince(ta.change(time("D"))) ///////////////////////////////////////////////////////// //calculate ATH and ATL g = bar_index == 1 ath() => a = 0.0 a := g ? high : high > a[1] ? high : a[1] a_ = request.security(syminfo.tickerid, 'M', ath(), lookahead=barmerge.lookahead_on) atl() => r = 0.0 r := g ? low : low < r[1] ? low : r[1] r_ = request.security(syminfo.tickerid, 'M', atl(), lookahead=barmerge.lookahead_on) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Calculate WH/WL ftwh() => h = ta.highest(high[1], 1) h = request.security(syminfo.tickerid, 'W', ftwh(), lookahead=barmerge.lookahead_on) ftwl() => l = ta.lowest(low[1], 1) l = request.security(syminfo.tickerid, 'W', ftwl(), lookahead=barmerge.lookahead_on) //////////////////////////////////////////////////////////////////////////////////////////////// r_y = request.security(syminfo.tickerid, 'D', high[1], lookahead=barmerge.lookahead_on) _y_l = request.security(syminfo.tickerid, 'D', low[1], lookahead=barmerge.lookahead_on) ////////////////////////////////////// r_y_l = request.security(syminfo.tickerid, 'D', low[1], lookahead=barmerge.lookahead_on) r_y_2 = request.security(syminfo.tickerid, 'D', high[2], lookahead=barmerge.lookahead_on) r_y_l_2 = request.security(syminfo.tickerid, 'D', low[2], lookahead=barmerge.lookahead_on) //Plotting lines for All above levels line ln1=na label lb1=na line ln2=na label lb2=na line ln3=na label lb3=na line ln4=na label lb4=na line ln5=na label lb5=na line ln6=na label lb6=na line ln7=na label lb7=na line ln8=na label lb8=na if (barstate.islast) if remove_ath ln1:=line.new(x1=bar_index[no_of_bars], y1=a_, x2=bar_index, y2=a_, width=line_w, color=col_ath, style=lineStyle,extend=lineStyle_r) lb1:=label.new(bar_index, a_, ' ATH=' + str.tostring(a_), color=color.new(color.green, 100), textcolor=col_ath, size=size.small, style=label.style_label_up) if remove_atl ln2:=line.new(x1=bar_index[no_of_bars], y1=r_, x2=bar_index, y2=r_, width=line_w, color=col_ath, style=lineStyle,extend=lineStyle_r) lb2:=label.new(bar_index, r_, ' ATL=' + str.tostring(r_), color=color.new(color.red, 100), textcolor=col_ath, size=size.small, style=label.style_label_up) if remove_wklyh ln3:=line.new(x1=bar_index[no_of_bars], y1=h, x2=bar_index, y2=h, width=line_w, color=col_atl, style=lineStyle,extend=lineStyle_r) lb3:=label.new(bar_index, h, ' Weekly High=' + str.tostring(h), color=color.new(color.green, 100), textcolor=col_atl, size=size.small, style=label.style_label_up) if remove_wklyl ln4:=line.new(x1=bar_index[no_of_bars], y1=l, x2=bar_index, y2=l, width=line_w, color=col_atl, style=lineStyle,extend=lineStyle_r) lb4:=label.new(bar_index, l, ' Weekly Low=' + str.tostring(l), color=color.new(color.red, 100), textcolor=col_atl, size=size.small, style=label.style_label_up) if remove_pdh ln5:=line.new(x1=bar_index[no_of_bars], y1=r_y, x2=bar_index, y2=r_y, width=line_w, color=col_atl_d, style=lineStyle,extend=lineStyle_r) lb5:=label.new(bar_index, r_y, ' Pre Day High=' + str.tostring(r_y), color=color.new(color.green, 100), textcolor=col_atl_d, size=size.small, style=label.style_label_up) if remove_pdl ln6:=line.new(x1=bar_index[no_of_bars], y1=r_y_l, x2=bar_index, y2=r_y_l, width=line_w, color=col_atl_d, style=lineStyle,extend=lineStyle_r) lb6:=label.new(bar_index, r_y_l, ' Pre Day Low=' + str.tostring(r_y_l), color=color.new(color.red, 100), textcolor=col_atl_d, size=size.small, style=label.style_label_up) if remove_2pdh ln7:=line.new(x1=bar_index[no_of_bars], y1=r_y_l_2, x2=bar_index, y2=r_y_l_2, width=line_w, color=col_atl_d_, style=lineStyle,extend=lineStyle_r) lb7:=label.new(bar_index, r_y_l_2, ' Two Day ago Low=' + str.tostring(r_y_l_2 ), color=color.new(color.red, 100), textcolor=col_atl_d_, size=size.small, style=label.style_label_up) if remove_2pdl ln8:=line.new(x1=bar_index[no_of_bars], y1=r_y_2, x2=bar_index, y2=r_y_2, width=line_w, color=col_atl_d_, style=lineStyle,extend=lineStyle_r) lb8:=label.new(bar_index, r_y_2, ' Two Day ago High=' + str.tostring(r_y_2), color=color.new(color.green, 100), textcolor=col_atl_d_, size=size.small, style=label.style_label_up) line.delete(ln1[1]) label.delete(lb1[1]) line.delete(ln2[1]) label.delete(lb2[1]) line.delete(ln3[1]) label.delete(lb3[1]) line.delete(ln4[1]) label.delete(lb4[1]) line.delete(ln5[1]) label.delete(lb5[1]) line.delete(ln6[1]) label.delete(lb6[1]) line.delete(ln7[1]) label.delete(lb7[1]) line.delete(ln8[1]) label.delete(lb8[1]) //////////////////////////////////////////////////////// // code to get the divergence levels prd = input.int(defval=5, title='Pivot Period', minval=1, maxval=50,group="Divergence settings",group="Divergence settings") source = input.string(defval='Close', title='Source for Pivot Points', options=['Close', 'High/Low'],group="Divergence settings") searchdiv = input.string(defval='Regular', title='Divergence Type', options=['Regular', 'Hidden', 'Regular/Hidden'],group="Divergence settings") showindis = input.string(defval='Don\'t Show', title='Show Indicator Names', options=['Full', 'First Letter', 'Don\'t Show'],group="Divergence settings") showlimit = input.int(1, title='Minimum Number of Divergence', minval=1, maxval=11,group="Divergence settings") maxpp = input.int(defval=10, title='Maximum Pivot Points to Check', minval=1, maxval=20,group="Divergence settings") maxbars = input.int(defval=100, title='Maximum Bars to Check', minval=30, maxval=200,group="Divergence settings") shownum = input(defval=false, title='Show Divergence Number',group="Divergence settings") showlast = input(defval=false, title='Show Only Last Divergence',group="Divergence settings") dontconfirm = input(defval=false, title='Don\'t Wait for Confirmation',group="Divergence settings") showlines = input(defval=false, title='Show Divergence Lines',group="Divergence settings") showpivot = input(defval=false, title='Show Pivot Points',group="Divergence settings") calcmacd = input(defval=true, title='MACD',group="Divergence settings") calcmacda = input(defval=true, title='MACD Histogram',group="Divergence settings") calcrsi = input(defval=true, title='RSI',group="Divergence settings") calcstoc = input(defval=true, title='Stochastic',group="Divergence settings") calccci = input(defval=true, title='CCI',group="Divergence settings") calcmom = input(defval=true, title='Momentum',group="Divergence settings") calcobv = input(defval=true, title='OBV',group="Divergence settings") calcvwmacd = input(true, title='VWmacd',group="Divergence settings") calccmf = input(true, title='Chaikin Money Flow',group="Divergence settings") calcmfi = input(true, title='Money Flow Index',group="Divergence settings") calcext = input(false, title='Check External Indicator',group="Divergence settings") externalindi = input(defval=close, title='External Indicator',group="Divergence settings") pos_reg_div_col = input(defval=color.yellow, title='Positive Regular Divergence',group="Divergence settings") neg_reg_div_col = input(defval=color.navy, title='Negative Regular Divergence',group="Divergence settings") pos_hid_div_col = input(defval=color.lime, title='Positive Hidden Divergence',group="Divergence settings") neg_hid_div_col = input(defval=color.red, title='Negative Hidden Divergence',group="Divergence settings") pos_div_text_col = input(defval=color.black, title='Positive Divergence Text Color',group="Divergence settings") neg_div_text_col = input(defval=color.white, title='Negative Divergence Text Color',group="Divergence settings") reg_div_l_style_ = input.string(defval='Solid', title='Regular Divergence Line Style', options=['Solid', 'Dashed', 'Dotted'],group="Divergence settings") hid_div_l_style_ = input.string(defval='Dashed', title='Hdden Divergence Line Style', options=['Solid', 'Dashed', 'Dotted'],group="Divergence settings") reg_div_l_width = input.int(defval=2, title='Regular Divergence Line Width', minval=1, maxval=5,group="Divergence settings") hid_div_l_width = input.int(defval=1, title='Hidden Divergence Line Width', minval=1, maxval=5,group="Divergence settings") showmas = input.bool(defval=false, title='Show MAs 50 & 200', inline='ma12',group="Divergence settings") cma1col = input.color(defval=color.lime, title='', inline='ma12',group="Divergence settings") cma2col = input.color(defval=color.red, title='', inline='ma12',group="Divergence settings") plot(showmas ? ta.sma(close, 50) : na, color=showmas ? cma1col : na) plot(showmas ? ta.sma(close, 200) : na, color=showmas ? cma2col : na) // set line styles var reg_div_l_style = reg_div_l_style_ == 'Solid' ? line.style_solid : reg_div_l_style_ == 'Dashed' ? line.style_dashed : line.style_dotted var hid_div_l_style = hid_div_l_style_ == 'Solid' ? line.style_solid : hid_div_l_style_ == 'Dashed' ? line.style_dashed : line.style_dotted // get indicators rsi = ta.rsi(close, 14) // RSI [macd, signal, deltamacd] = ta.macd(close, 12, 26, 9) // MACD moment = ta.mom(close, 10) // Momentum cci = ta.cci(close, 10) // CCI Obv = ta.obv // OBV stk = ta.sma(ta.stoch(close, high, low, 14), 3) // Stoch maFast = ta.vwma(close, 12) // volume weighted macd maSlow = ta.vwma(close, 26) vwmacd = maFast - maSlow Cmfm = (close - low - (high - close)) / (high - low) // Chaikin money flow Cmfv = Cmfm * volume cmf = ta.sma(Cmfv, 21) / ta.sma(volume, 21) Mfi = ta.mfi(close, 14) // Moneyt Flow Index // keep indicators names and colors in arrays var indicators_name = array.new_string(11) var div_colors = array.new_color(4) if barstate.isfirst // names array.set(indicators_name, 0, showindis == 'Full' ? 'MACD' : 'M') array.set(indicators_name, 1, showindis == 'Full' ? 'Hist' : 'H') array.set(indicators_name, 2, showindis == 'Full' ? 'RSI' : 'E') array.set(indicators_name, 3, showindis == 'Full' ? 'Stoch' : 'S') array.set(indicators_name, 4, showindis == 'Full' ? 'CCI' : 'C') array.set(indicators_name, 5, showindis == 'Full' ? 'MOM' : 'M') array.set(indicators_name, 6, showindis == 'Full' ? 'OBV' : 'O') array.set(indicators_name, 7, showindis == 'Full' ? 'VWMACD' : 'V') array.set(indicators_name, 8, showindis == 'Full' ? 'CMF' : 'C') array.set(indicators_name, 9, showindis == 'Full' ? 'MFI' : 'M') array.set(indicators_name, 10, showindis == 'Full' ? 'Extrn' : 'X') //colors array.set(div_colors, 0, pos_reg_div_col) array.set(div_colors, 1, neg_reg_div_col) array.set(div_colors, 2, pos_hid_div_col) array.set(div_colors, 3, neg_hid_div_col) // Check if we get new Pivot High Or Pivot Low float ph = ta.pivothigh(source == 'Close' ? close : high, prd, prd) float pl = ta.pivotlow(source == 'Close' ? close : low, prd, prd) plotshape(ph and showpivot, text='H', style=shape.labeldown, color=color.new(color.white, 100), textcolor=color.new(color.red, 0), location=location.abovebar, offset=-prd) plotshape(pl and showpivot, text='L', style=shape.labelup, color=color.new(color.white, 100), textcolor=color.new(color.lime, 0), location=location.belowbar, offset=-prd) // keep values and positions of Pivot Highs/Lows in the arrays var int maxarraysize = 20 var ph_positions = array.new_int(maxarraysize, 0) var pl_positions = array.new_int(maxarraysize, 0) var ph_vals = array.new_float(maxarraysize, 0.) var pl_vals = array.new_float(maxarraysize, 0.) // add PHs to the array if ph array.unshift(ph_positions, bar_index) array.unshift(ph_vals, ph) if array.size(ph_positions) > maxarraysize array.pop(ph_positions) array.pop(ph_vals) // add PLs to the array if pl array.unshift(pl_positions, bar_index) array.unshift(pl_vals, pl) if array.size(pl_positions) > maxarraysize array.pop(pl_positions) array.pop(pl_vals) // functions to check Regular Divergences and Hidden Divergences // function to check positive regular or negative hidden divergence // cond == 1 => positive_regular, cond == 2=> negative_hidden positive_regular_positive_hidden_divergence(src, cond) => divlen = 0 prsc = source == 'Close' ? close : low // if indicators higher than last value and close price is higher than las close if dontconfirm or src > src[1] or close > close[1] startpoint = dontconfirm ? 0 : 1 // don't check last candle // we search last 15 PPs for x = 0 to maxpp - 1 by 1 len = bar_index - array.get(pl_positions, x) + prd // if we reach non valued array element or arrived 101. or previous bars then we don't search more if array.get(pl_positions, x) == 0 or len > maxbars break if len > 5 and (cond == 1 and src[startpoint] > src[len] and prsc[startpoint] < nz(array.get(pl_vals, x)) or cond == 2 and src[startpoint] < src[len] and prsc[startpoint] > nz(array.get(pl_vals, x))) slope1 = (src[startpoint] - src[len]) / (len - startpoint) virtual_line1 = src[startpoint] - slope1 slope2 = (close[startpoint] - close[len]) / (len - startpoint) virtual_line2 = close[startpoint] - slope2 arrived = true for y = 1 + startpoint to len - 1 by 1 if src[y] < virtual_line1 or nz(close[y]) < virtual_line2 arrived := false break virtual_line1 -= slope1 virtual_line2 -= slope2 virtual_line2 if arrived divlen := len break divlen // function to check negative regular or positive hidden divergence // cond == 1 => negative_regular, cond == 2=> positive_hidden negative_regular_negative_hidden_divergence(src, cond) => divlen = 0 prsc = source == 'Close' ? close : high // if indicators higher than last value and close price is higher than las close if dontconfirm or src < src[1] or close < close[1] startpoint = dontconfirm ? 0 : 1 // don't check last candle // we search last 15 PPs for x = 0 to maxpp - 1 by 1 len = bar_index - array.get(ph_positions, x) + prd // if we reach non valued array element or arrived 101. or previous bars then we don't search more if array.get(ph_positions, x) == 0 or len > maxbars break if len > 5 and (cond == 1 and src[startpoint] < src[len] and prsc[startpoint] > nz(array.get(ph_vals, x)) or cond == 2 and src[startpoint] > src[len] and prsc[startpoint] < nz(array.get(ph_vals, x))) slope1 = (src[startpoint] - src[len]) / (len - startpoint) virtual_line1 = src[startpoint] - slope1 slope2 = (close[startpoint] - nz(close[len])) / (len - startpoint) virtual_line2 = close[startpoint] - slope2 arrived = true for y = 1 + startpoint to len - 1 by 1 if src[y] > virtual_line1 or nz(close[y]) > virtual_line2 arrived := false break virtual_line1 -= slope1 virtual_line2 -= slope2 virtual_line2 if arrived divlen := len break divlen // calculate 4 types of divergence if enabled in the options and return divergences in an array calculate_divs(cond, indicator_1) => divs = array.new_int(4, 0) array.set(divs, 0, cond and (searchdiv == 'Regular' or searchdiv == 'Regular/Hidden') ? positive_regular_positive_hidden_divergence(indicator_1, 1) : 0) array.set(divs, 1, cond and (searchdiv == 'Regular' or searchdiv == 'Regular/Hidden') ? negative_regular_negative_hidden_divergence(indicator_1, 1) : 0) array.set(divs, 2, cond and (searchdiv == 'Hidden' or searchdiv == 'Regular/Hidden') ? positive_regular_positive_hidden_divergence(indicator_1, 2) : 0) array.set(divs, 3, cond and (searchdiv == 'Hidden' or searchdiv == 'Regular/Hidden') ? negative_regular_negative_hidden_divergence(indicator_1, 2) : 0) divs // array to keep all divergences var all_divergences = array.new_int(44) // 11 indicators * 4 divergence = 44 elements // set related array elements array_set_divs(div_pointer, index) => for x = 0 to 3 by 1 array.set(all_divergences, index * 4 + x, array.get(div_pointer, x)) // set divergences array array_set_divs(calculate_divs(calcmacd, macd), 0) array_set_divs(calculate_divs(calcmacda, deltamacd), 1) array_set_divs(calculate_divs(calcrsi, rsi), 2) array_set_divs(calculate_divs(calcstoc, stk), 3) array_set_divs(calculate_divs(calccci, cci), 4) array_set_divs(calculate_divs(calcmom, moment), 5) array_set_divs(calculate_divs(calcobv, Obv), 6) array_set_divs(calculate_divs(calcvwmacd, vwmacd), 7) array_set_divs(calculate_divs(calccmf, cmf), 8) array_set_divs(calculate_divs(calcmfi, Mfi), 9) array_set_divs(calculate_divs(calcext, externalindi), 10) // check minimum number of divergence, if less than showlimit then delete all divergence total_div = 0 for x = 0 to array.size(all_divergences) - 1 by 1 total_div += math.round(math.sign(array.get(all_divergences, x))) total_div if total_div < showlimit array.fill(all_divergences, 0) // keep line in an array var pos_div_lines = array.new_line(0) var neg_div_lines = array.new_line(0) var pos_div_labels = array.new_label(0) var neg_div_labels = array.new_label(0) // remove old lines and labels if showlast option is enabled delete_old_pos_div_lines() => if array.size(pos_div_lines) > 0 for j = 0 to array.size(pos_div_lines) - 1 by 1 line.delete(array.get(pos_div_lines, j)) array.clear(pos_div_lines) delete_old_neg_div_lines() => if array.size(neg_div_lines) > 0 for j = 0 to array.size(neg_div_lines) - 1 by 1 line.delete(array.get(neg_div_lines, j)) array.clear(neg_div_lines) delete_old_pos_div_labels() => if array.size(pos_div_labels) > 0 for j = 0 to array.size(pos_div_labels) - 1 by 1 label.delete(array.get(pos_div_labels, j)) array.clear(pos_div_labels) delete_old_neg_div_labels() => if array.size(neg_div_labels) > 0 for j = 0 to array.size(neg_div_labels) - 1 by 1 label.delete(array.get(neg_div_labels, j)) array.clear(neg_div_labels) // delete last creted lines and labels until we met new PH/PV delete_last_pos_div_lines_label(n) => if n > 0 and array.size(pos_div_lines) >= n asz = array.size(pos_div_lines) for j = 1 to n by 1 line.delete(array.get(pos_div_lines, asz - j)) array.pop(pos_div_lines) if array.size(pos_div_labels) > 0 label.delete(array.get(pos_div_labels, array.size(pos_div_labels) - 1)) array.pop(pos_div_labels) delete_last_neg_div_lines_label(n) => if n > 0 and array.size(neg_div_lines) >= n asz = array.size(neg_div_lines) for j = 1 to n by 1 line.delete(array.get(neg_div_lines, asz - j)) array.pop(neg_div_lines) if array.size(neg_div_labels) > 0 label.delete(array.get(neg_div_labels, array.size(neg_div_labels) - 1)) array.pop(neg_div_labels) // variables for Alerts pos_reg_div_detected = false neg_reg_div_detected = false pos_hid_div_detected = false neg_hid_div_detected = false // to remove lines/labels until we met new // PH/PL var last_pos_div_lines = 0 var last_neg_div_lines = 0 var remove_last_pos_divs = false var remove_last_neg_divs = false if pl remove_last_pos_divs := false last_pos_div_lines := 0 last_pos_div_lines if ph remove_last_neg_divs := false last_neg_div_lines := 0 last_neg_div_lines // draw divergences lines and labels divergence_text_top = '' divergence_text_bottom = '' distances = array.new_int(0) dnumdiv_top = 0 dnumdiv_bottom = 0 top_label_col = color.white bottom_label_col = color.white old_pos_divs_can_be_removed = true old_neg_divs_can_be_removed = true startpoint = dontconfirm ? 0 : 1 // used for don't confirm option for x = 0 to 10 by 1 div_type = -1 for y = 0 to 3 by 1 if array.get(all_divergences, x * 4 + y) > 0 // any divergence? div_type := y if y % 2 == 1 dnumdiv_top += 1 top_label_col := array.get(div_colors, y) top_label_col if y % 2 == 0 dnumdiv_bottom += 1 bottom_label_col := array.get(div_colors, y) bottom_label_col if not array.includes(distances, array.get(all_divergences, x * 4 + y)) // line not exist ? array.push(distances, array.get(all_divergences, x * 4 + y)) new_line = showlines ? line.new(x1=bar_index - array.get(all_divergences, x * 4 + y), y1=source == 'Close' ? close[array.get(all_divergences, x * 4 + y)] : y % 2 == 0 ? low[array.get(all_divergences, x * 4 + y)] : high[array.get(all_divergences, x * 4 + y)], x2=bar_index - startpoint, y2=source == 'Close' ? close[startpoint] : y % 2 == 0 ? low[startpoint] : high[startpoint], color=array.get(div_colors, y), style=y < 2 ? reg_div_l_style : hid_div_l_style, width=y < 2 ? reg_div_l_width : hid_div_l_width) : na if y % 2 == 0 if old_pos_divs_can_be_removed old_pos_divs_can_be_removed := false if not showlast and remove_last_pos_divs delete_last_pos_div_lines_label(last_pos_div_lines) last_pos_div_lines := 0 last_pos_div_lines if showlast delete_old_pos_div_lines() array.push(pos_div_lines, new_line) last_pos_div_lines += 1 remove_last_pos_divs := true remove_last_pos_divs if y % 2 == 1 if old_neg_divs_can_be_removed old_neg_divs_can_be_removed := false if not showlast and remove_last_neg_divs delete_last_neg_div_lines_label(last_neg_div_lines) last_neg_div_lines := 0 last_neg_div_lines if showlast delete_old_neg_div_lines() array.push(neg_div_lines, new_line) last_neg_div_lines += 1 remove_last_neg_divs := true remove_last_neg_divs // set variables for alerts if y == 0 pos_reg_div_detected := true pos_reg_div_detected if y == 1 neg_reg_div_detected := true neg_reg_div_detected if y == 2 pos_hid_div_detected := true pos_hid_div_detected if y == 3 neg_hid_div_detected := true neg_hid_div_detected // get text for labels if div_type >= 0 divergence_text_top += (div_type % 2 == 1 ? showindis != 'Don\'t Show' ? array.get(indicators_name, x) + '\n' : '' : '') divergence_text_bottom += (div_type % 2 == 0 ? showindis != 'Don\'t Show' ? array.get(indicators_name, x) + '\n' : '' : '') divergence_text_bottom // draw labels if showindis != 'Don\'t Show' or shownum if shownum and dnumdiv_top > 0 divergence_text_top += str.tostring(dnumdiv_top) divergence_text_top if shownum and dnumdiv_bottom > 0 divergence_text_bottom += str.tostring(dnumdiv_bottom) divergence_text_bottom if divergence_text_top != '' if showlast delete_old_neg_div_labels() array.push(neg_div_labels, label.new(x=bar_index, y=math.max(high, high[1]), text=divergence_text_top, color=top_label_col, textcolor=neg_div_text_col, style=label.style_label_down)) if divergence_text_bottom != '' if showlast delete_old_pos_div_labels() array.push(pos_div_labels, label.new(x=bar_index, y=math.min(low, low[1]), text=divergence_text_bottom, color=bottom_label_col, textcolor=pos_div_text_col, style=label.style_label_up)) seprator = input.bool(true, '=====================================================',group="Divergence settings") /////////////////////////FIB levels By DGT // -Inputs ══════════════════════════════════════════════════════════════════════════════════════ // tooltip_threshold = 'Deviation is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot' + '\n\nDepth affects the minimum number of bars that will be taken into account when building' // ---------------------------------------------------------------------------------------- // // pivots threshold threshold_multiplier = input.float(9, 'Deviation', minval=0, inline='Pivots', tooltip=tooltip_threshold,group="FIB by DGT settings") dev_threshold = ta.atr(10) / close * 100 * threshold_multiplier depth = input.int(1, 'Depth', minval=1, inline='Pivots',group="FIB by DGT settings") // pivots threshold // ---------------------------------------------------------------------------------------- // // Zig Zag ZigZag = input.bool(false, 'Zig Zag', inline='ZZ', group='Zig Zag Settings') zzColor = input.color(color.orange, '', inline='ZZ', group='Zig Zag Settings') zzWidth = input.int(1, '', minval=1, inline='ZZ', group='Zig Zag Settings') zzStyle = input.string('Solid', '', options=['Dashed', 'Dotted', 'Solid'], inline='ZZ', group='Zig Zag Settings') // Zig Zag // ---------------------------------------------------------------------------------------- // // Fibonacci group_fib_RetExt = 'Channel / Retracement-Extention Settings' isFibChannel = input.bool(false, 'Fib Channel     |   ', inline='FIB', group=group_fib_RetExt) fibExtRet = input.string('Fib Retracement', '', options=['Fib Retracement', 'Fib Extention'], inline='FIB', group=group_fib_RetExt) isFibRetOrExt = input.bool(true, '', inline='FIB', group=group_fib_RetExt) prevPivot = input.bool(false, 'Historical Channels / Retracements-Extentions', inline='hPVT', group=group_fib_RetExt) histPivot = input.int(1, '', minval=1, inline='hPVT', group=group_fib_RetExt) extendL = input.bool(false, 'Extend Lines', group=group_fib_RetExt) reverse = input.bool(false, 'Reverse Retracement-Extention Levels', group=group_fib_RetExt) channelLevels = input.bool(true, 'Level Labels : Channel | Retracement-Extention', inline='Levels', group=group_fib_RetExt) retExtLevels = input.bool(true, '', inline='Levels', group=group_fib_RetExt) levelPrices = input.bool(true, 'Prices    |    Levels', inline='Levels2', group=group_fib_RetExt) levelLevels = input.bool(true, '', inline='Levels2', group=group_fib_RetExt) levelFormat = input.string('Values', '', options=['Values', 'Percent'], inline='Levels2', group=group_fib_RetExt) uniColor = input.bool(false, 'UniColor : Channels | Retracements-Extentions', inline='uni', group=group_fib_RetExt) uniColor1 = input.color(#0ac9f0, '', inline='uni', group=group_fib_RetExt) uniColor2 = input.color(#ffa726, '', inline='uni', group=group_fib_RetExt) // Fibonacci // ---------------------------------------------------------------------------------------- // // -Calculations ════════════════════════════════════════════════════════════════════════════════ // var line lineLast = na var int iLast = 0 var int iPrev = 0 var float pLast = 0 var isHighLast = false // otherwise the last pivot is a low pivot var iPrevPivot = 0 var pPrevPivot = 0. var iLastPivot = 0 var pLastPivot = 0. pivots(src, length, isHigh) => l2 = length * 2 c = nz(src[length]) ok = true for i = 0 to l2 by 1 if isHigh and src[i] > c ok := false ok if not isHigh and src[i] < c ok := false ok if ok [bar_index[length], c] else [int(na), float(na)] [iH, pH] = pivots(high, depth / 2, true) [iL, pL] = pivots(low, depth / 2, false) calc_dev(base_price, price) => 100 * (price - base_price) / price pivotFound(dev, isHigh, index, price) => if isHighLast == isHigh and not na(lineLast) // same direction if isHighLast ? price > pLast : price < pLast line.set_xy2(lineLast, index, price) [lineLast, isHighLast] else [line(na), bool(na)] else // reverse the direction (or create the very first line) if math.abs(dev) > dev_threshold // price move is significant // ---------------------------------------------------------------------------------------- // [zzCol, zzWid, zzSty] = if not ZigZag [na, 1, line.style_dashed] else [zzColor, zzWidth, zzStyle == 'Solid' ? line.style_solid : zzStyle == 'Dotted' ? line.style_dotted : line.style_dashed] // ---------------------------------------------------------------------------------------- // id = line.new(iLast, pLast, index, price, color=zzCol, width=zzWid, style=zzSty) [id, isHigh] else [line(na), bool(na)] if not na(iH) dev = calc_dev(pLast, pH) [id, isHigh] = pivotFound(dev, true, iH, pH) if not na(id) if id != lineLast // ---------------------------------------------------------------------------------------- // iPrevPivot := line.get_x1(lineLast) pPrevPivot := line.get_y1(lineLast) iLastPivot := line.get_x2(lineLast) pLastPivot := line.get_y2(lineLast) if not ZigZag // ---------------------------------------------------------------------------------------- // line.delete(lineLast) lineLast := id isHighLast := isHigh iPrev := iLast iLast := iH pLast := pH pLast else if not na(iL) dev = calc_dev(pLast, pL) [id, isHigh] = pivotFound(dev, false, iL, pL) if not na(id) if id != lineLast // ---------------------------------------------------------------------------------------- // iPrevPivot := line.get_x1(lineLast) pPrevPivot := line.get_y1(lineLast) iLastPivot := line.get_x2(lineLast) pLastPivot := line.get_y2(lineLast) if not ZigZag // ---------------------------------------------------------------------------------------- // line.delete(lineLast) lineLast := id isHighLast := isHigh iPrev := iLast iLast := iL pLast := pL pLast iStartBase = prevPivot ? ta.valuewhen(ta.change(iPrevPivot), iPrevPivot, histPivot) : ta.valuewhen(ta.change(iPrevPivot), iPrevPivot, 0) pStartBase = prevPivot ? ta.valuewhen(ta.change(pPrevPivot), pPrevPivot, histPivot) : ta.valuewhen(ta.change(pPrevPivot), pPrevPivot, 0) iEndBase = prevPivot ? ta.valuewhen(ta.change(iLastPivot), iLastPivot, histPivot - 1) : line.get_x2(lineLast) pEndBase = prevPivot ? ta.valuewhen(ta.change(pLastPivot), pLastPivot, histPivot - 1) : line.get_y2(lineLast) iMidPivot = prevPivot ? ta.valuewhen(ta.change(iPrevPivot), iPrevPivot, histPivot - 1) : line.get_x1(lineLast) pMidPivot = prevPivot ? ta.valuewhen(ta.change(pPrevPivot), pPrevPivot, histPivot - 1) : line.get_y1(lineLast) slope = (pEndBase - pStartBase) / (iEndBase - iStartBase) iPivotDiff = iMidPivot - iStartBase pPivotDiff = math.abs(pMidPivot - pStartBase) _crossing_level(sr, r) => r > sr and r < sr[1] or r < sr and r > sr[1] var a_ln = array.new_line() if array.size(a_ln) > 0 a_ln_size = array.size(a_ln) for i = 1 to a_ln_size by 1 ln = array.shift(a_ln) line.delete(ln) f_draw_line(_iStart, _pStart, _iEnd, _pEnd, _color, _width, _style, _extend, _level) => style = _style == 'Solid' ? line.style_solid : _style == 'Dotted' ? line.style_dotted : line.style_dashed if _iStart < bar_index array.push(a_ln, line.new(_iStart, _pStart, _iEnd, _pEnd, xloc.bar_index, extendL ? extend.both : extend.right, _color, style, _width)) _draw_line(_price, _color, _ext) => var id = line.new(iLast, _price, bar_index, _price, xloc.bar_index, extendL ? extend.both : extend.right, _color, line.style_solid, 1) if not na(lineLast) line.set_xy1(id, _ext ? iMidPivot : iStartBase, _price) line.set_xy2(id, line.get_x2(lineLast), _price) _draw_label(index, price, txt, txtColor, style, align) => labelsAlignStr = txt + '\n ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ \n' var id = label.new(index, price, txt, textcolor=txtColor, style=style, textalign=align, color=#00000000) label.set_xy(id, index, price) label.set_text(id, labelsAlignStr) label.set_textcolor(id, txtColor) _label_txt(level, price) => l = levelFormat == 'Values' ? str.tostring(level) : str.tostring(level * 100) + '%' (levelLevels ? l : '') + (levelPrices ? ' (' + str.tostring(math.round(price / syminfo.mintick) * syminfo.mintick) + ')' : '') processLevel(show, value, colorL) => array.push(a_ln, line.new(iStartBase, pStartBase, iMidPivot, pMidPivot, xloc.bar_index, extend.none, color.gray, line.style_dashed, 1)) var float pass_value = na if isFibChannel array.push(a_ln, line.new(iMidPivot, pMidPivot, iEndBase, pEndBase, xloc.bar_index, extend.none, color.gray, line.style_dashed, 1)) if show iStart = int(math.round(iStartBase + iPivotDiff * value)) intercept = pStartBase < pMidPivot ? pStartBase + pPivotDiff * value - slope * iStart : pStartBase - pPivotDiff * value - slope * iStart pStart = slope * iStart + intercept iEnd = iStart < iEndBase ? iEndBase : bar_index pEnd = slope * iEnd + intercept f_draw_line(iStart, pStart, iEnd, pEnd, uniColor ? uniColor1 : colorL, 1, 'Solid', true, value) if channelLevels _draw_label(bar_index, slope * bar_index + intercept, _label_txt(value, slope * bar_index + intercept), uniColor ? uniColor1 : colorL, label.style_label_left, text.align_left) if isFibRetOrExt r = 0. isExt = false if fibExtRet == 'Fib Extention' array.push(a_ln, line.new(iMidPivot, pMidPivot, iEndBase, pEndBase, xloc.bar_index, extend.none, color.gray, line.style_dashed, 1)) isExt := true offset = math.abs(pMidPivot - pEndBase) r := pEndBase < pMidPivot ? pMidPivot - offset + (reverse ? -1 : 1) * pPivotDiff * value : pMidPivot + offset - (reverse ? -1 : 1) * pPivotDiff * value r else r := pStartBase < pMidPivot ? (reverse ? pMidPivot : pStartBase) + (reverse ? -1 : 1) * pPivotDiff * value : (reverse ? pMidPivot : pStartBase) - (reverse ? -1 : 1) * pPivotDiff * value r pass_value := r if show _draw_line(r, uniColor ? uniColor2 : colorL, isExt) if retExtLevels _draw_label(isExt ? iMidPivot : iStartBase, r, _label_txt(value, r), uniColor ? uniColor2 : colorL, label.style_label_right, text.align_right) [pass_value] group_fib_levels = 'Channel / Retracement-Extention Levels' show_0 = input.bool(false, '', inline='Level1', group=group_fib_levels) value_0 = input.float(0., '', inline='Level1', group=group_fib_levels) color_0 = input.color(#787b86, '', inline='Level1', group=group_fib_levels) [r0] = processLevel(show_0, value_0, color_0) show_0_236 = input.bool(false, '', inline='Level2', group=group_fib_levels) value_0_236 = input.float(0.236, '', inline='Level2', group=group_fib_levels) color_0_236 = input.color(#f44336, '', inline='Level2', group=group_fib_levels) [r236] = processLevel(show_0_236, value_0_236, color_0_236) show_0_5 = input.bool(false, '', inline='Level3', group=group_fib_levels) value_0_5 = input.float(0.5, '', inline='Level3', group=group_fib_levels) color_0_5 = input.color(#4caf50, '', inline='Level3', group=group_fib_levels) [r5] = processLevel(show_0_5, value_0_5, color_0_5) show_0_618 = input.bool(false, '', inline='Level4', group=group_fib_levels) value_0_618 = input.float(0.618, '', inline='Level4', group=group_fib_levels) color_0_618 = input.color(#009688, '', inline='Level4', group=group_fib_levels) [r618] = processLevel(show_0_618, value_0_618, color_0_618) show_0_786 = input.bool(false, '', inline='Level5', group=group_fib_levels) value_0_786 = input.float(0.786, '', inline='Level5', group=group_fib_levels) color_0_786 = input.color(#64b5f6, '', inline='Level5', group=group_fib_levels) [r786] = processLevel(show_0_786, value_0_786, color_0_786) seprator_ = input.bool(true, '=====================================================',group=group_fib_levels) //////////////////////////////////////////////////// //Pivot calcuation part pivot_w_tf=input.timeframe("W","Select Pivot two timeframe",group="Pivot 'W' settings") [sec_open_w, sec_high_w, sec_low_w, sec_close_w] = request.security(syminfo.tickerid, pivot_w_tf, [open, high, low, close], lookahead=barmerge.lookahead_on) sec_open_gaps_on_w = request.security(syminfo.tickerid, pivot_w_tf, open, gaps=barmerge.gaps_on, lookahead=barmerge.lookahead_on) DEF_COLOR_w=color.red p_show_w = input.bool(false, 'P‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏', inline='P',group="Pivot 'W' settings") p_color_w = DEF_COLOR_w s1r1_show_w = input.bool(false, 'S1/R1', inline='S1/R1',group="Pivot 'W' settings") s1r1_color_w = DEF_COLOR_w s2r2_show_w = input.bool(false, 'S2/R2', inline='S2/R2',group="Pivot 'W' settings") s2r2_color_w = DEF_COLOR_w s3r3_show_w = input.bool(false, 'S3/R3', inline='S3/R3',group="Pivot 'W' settings") s3r3_color_w = DEF_COLOR_w pivotX_Median_w = (sec_high_w + sec_low_w + sec_close_w) / 3 pivot_range_w = sec_high_w - sec_low_w p_w=ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w),1)<0?0:ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w),1) r1_w= ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w * 2 - sec_low_w),1)<0?0:ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w * 2 - sec_low_w),1) s1_w= ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w * 2 - sec_high_w),1)<0?0:ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w * 2 - sec_high_w),1) r2_w= ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w + 1 * pivot_range_w),1)<0?0:ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w + 1 * pivot_range_w),1) s2_w= ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w - 1 * pivot_range_w),1)<0?0:ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w - 1 * pivot_range_w),1) r3_w= ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w + 2 * pivot_range_w),1)<0?0:ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w + 2 * pivot_range_w),1) s3_w= ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w - 2 * pivot_range_w),1)<0?0:ta.valuewhen(ta.change(time(pivot_w_tf)),(pivotX_Median_w - 2 * pivot_range_w),1) plot(p_show_w and not ta.change(p_w)?p_w:na,color=p_color_w, style=plot.style_linebr,linewidth=2,title="P 'W'") plot(s1r1_show_w and not ta.change(r1_w)?r1_w:na,color=s1r1_color_w, style=plot.style_linebr,linewidth=2,title="S1 'W'") plot(s2r2_show_w and not ta.change(r2_w)?r2_w:na,color=s2r2_color_w, style=plot.style_linebr,linewidth=2,title="S2 'W'") plot(s3r3_show_w and not ta.change(r3_w)?r3_w:na,color=s3r3_color_w, style=plot.style_linebr,linewidth=2,title="S3 'W'") plot(s1r1_show_w and not ta.change(s1_w)?s1_w:na,color=s1r1_color_w, style=plot.style_linebr,linewidth=2,title="R1 'W'") plot(s2r2_show_w and not ta.change(s2_w)?s2_w:na,color=s2r2_color_w, style=plot.style_linebr,linewidth=2,title="R2 'W'") plot(s3r3_show_w and not ta.change(s3_w)?s3_w:na,color=s3r3_color_w, style=plot.style_linebr,linewidth=2,title="R3 'W'") seprator2 = input.bool(true, '=====================================================',group="Pivot 'W' settings") // //////////////////////////////////////////////////////////////////////////////////////// //EMA calculation disable_emas=input.bool(false,"Plot EMA",group="EMA setting") color_200 = #4caf50 color_50 = #ff0000 color_21 = #2962ff mtfM = input.timeframe(title='EMA', defval='',group="EMA setting") ma_length200M = input(200, title='EMA Period ',group="EMA setting") ma200M = request.security(syminfo.tickerid, mtfM, ta.ema(close, ma_length200M)) p_200M = plot(disable_emas?ma200M:na, color=color_200, linewidth=1, offset=0, style=plot.style_linebr,title="EMA 200") ma_length100M = input(100, title='EMA Period ',group="EMA setting") ma100M = request.security(syminfo.tickerid, mtfM, ta.ema(close, ma_length100M)) p_100M = plot(disable_emas?ma100M:na, color=color_50, linewidth=1, offset=0, style=plot.style_linebr,title="EMA 100") ma_length50M = input(50, title='EMA Period ',group="EMA setting") ma50M = request.security(syminfo.tickerid, mtfM, ta.ema(close, ma_length50M)) p_50M = plot(disable_emas?ma50M:na, color=color_50, linewidth=1, offset=0, style=plot.style_linebr,title="EMA 50") ma_length20M = input(20, title='EMA Period ',group="EMA setting") ma20M = request.security(syminfo.tickerid, mtfM, ta.ema(close, ma_length20M)) p_20M = plot(disable_emas?ma20M:na, color=color_50, linewidth=1, offset=0, style=plot.style_linebr,title="EMA 20") seprator3 = input.bool(true, '=====================================================',group="EMA setting") ////////////////////////////////////////////////////////////////// //assigning values to each level //recent positive divergence levels level_01 = ta.valuewhen(pos_reg_div_detected, close, 0) level_02 = ta.valuewhen(pos_reg_div_detected, close, 1) level_03 = ta.valuewhen(pos_reg_div_detected, close, 2) level_21 =ta.valuewhen(pos_reg_div_detected, close, 3) //recent negative divergence levels level_04 = ta.valuewhen(neg_reg_div_detected, close, 0) level_05 = ta.valuewhen(neg_reg_div_detected, close, 1) level_06 = ta.valuewhen(neg_reg_div_detected, close, 2) level_25 =ta.valuewhen(neg_reg_div_detected, close, 3) //Fibonacci levels level_07 =r0 level_08 =r236 level_09 =r5 level_10 =r618 level_11 =r786 //Interative S/R levels input from the user level_12 =array.get(srarray,0) level_13 =array.get(srarray,1) level_14 =array.get(srarray,2) level_15 =array.get(srarray,3) level_16 =array.get(srarray,4) //Pivot levels level_17 =p_w level_18 =r1_w level_19 =r2_w level_20 =r3_w level_22 =s1_w level_23 =s2_w level_24 =s3_w //EMA levels level_26 =ma200M level_27 =ma50M level_28 =ma20M level_29 =ma100M //ATH, ATL, Weekly High, Weekly Low, two days ago high, two days ago low, previous day high , previous day low level_30 =a_ level_31 =r_ level_32 =h level_33 =l level_34 =r_y level_35 =r_y_l level_36 =r_y_l_2 level_37 =r_y_2 level_38 =100000000 //function to call names and the points for each confluence score_nomen(value)=> score=0 abb="" if value==level_01 score:=1 abb:=" DP1" else if value==level_02 score:=1 abb:=" DP2" else if value==level_03 score:=1 abb:=" DP3" else if value==level_04 score:=1 abb:=" DN1" else if value==level_05 score:=1 abb:=" DN2" else if value==level_06 score:=1 abb:=" DN3" else if value==level_07 score:=1 abb:=" Fib0" else if value==level_08 score:=1 abb:=" Fib236" else if value==level_09 score:=1 abb:=" Fib5" else if value==level_10 score:=1 abb:=" Fib618" else if value==level_11 score:=1 abb:=" Fib786" else if value==level_12 score:=1 abb:=" SR1" else if value==level_13 score:=1 abb:=" SR2" else if value==level_14 score:=1 abb:=" SR3" else if value==level_15 score:=1 abb:=" SR4" else if value==level_16 score:=1 abb:=" SR5" else if value==level_17 score:=1 abb:=" P" else if value==level_18 score:=1 abb:=" PR1" else if value==level_19 score:=1 abb:=" PR2" else if value==level_20 score:=1 abb:=" PR3" else if value==level_21 score:=1 abb:=" DP4" else if value==level_22 score:=1 abb:=" PS1" else if value==level_23 score:=1 abb:=" PS2" else if value==level_24 score:=1 abb:=" PS3" else if value==level_25 score:=1 abb:=" DN4" else if value==level_26 score:=1 abb:=" E"+str.tostring(ma_length200M) else if value==level_27 score:=1 abb:=" E"+str.tostring(ma_length50M) else if value==level_28 score:=1 abb:=" E"+str.tostring(ma_length20M) else if value==level_29 score:=1 abb:=" E"+str.tostring(ma_length100M) else if value==level_30 score:=1 abb:=" ATH" else if value==level_31 score:=1 abb:=" ATL" else if value==level_32 score:=1 abb:=" WH" else if value==level_33 score:=1 abb:=" WL" else if value==level_34 score:=1 abb:=" PDH" else if value==level_35 score:=1 abb:=" PDL" else if value==level_36 score:=1 abb:=" TDH" else if value==level_37 score:=1 abb:=" TDL" else if value==level_38 score:=1 abb:=" " if value==0 score:=0 abb:=" " [score,abb] //defining array for inputing the levels var levels_array = array.new_float() //Funtion to plot individual levels line_label_plot(y_,total_score,abbrevation,t_or_f)=> if t_or_f and not y_==0 line.new(bar_index-shift_box, y_ , bar_index + shift_box_r, y_, color=individual_level_color, width=1, extend=extend.none) label.new(x=bar_index, y=y_, text=" "+str.tostring(total_score)+"- " +abbrevation, textcolor=individual_level_color, style=label.style_none,textalign=text.align_left) //funtion to plot zones label_box_plot(zone_array_size,first_zone_val,first_zone_high_val,total_score,abbrevation,t_or_f)=> zone_color=close>first_zone_high_val and close>first_zone_val?supportcol:resistancecol zone_color_bg=close>first_zone_high_val and close>first_zone_val?supportcol_:resistancecol_ if not zone_array_size==0 and total_score>=nearest_n_values and t_or_f and (not first_zone_high_val==0 or not first_zone_val==0) var id = label.new(x=bar_index, y=first_zone_val, text=" "+str.tostring(total_score)+"- " +abbrevation, textcolor=zone_color, style=label.style_none,textalign=text.align_left) var openBox1 = box.new(left=bar_index-shift_box, top=first_zone_high_val , right=bar_index + shift_box_r, bottom=first_zone_val, bgcolor=zone_color_bg,border_color=zone_color ,border_width=1, extend=extend.none) label.set_textalign(id, text.align_left) //funtion to calculate nearest 'k' confluence levels findKClosestElements(nums, k, target)=> levels_array_zones = array.new_float() left = 0 right = array.size(nums) - 1 while right - left >= k if math.abs(array.get(nums,left) - target) > math.abs(array.get(nums,right) - target) left := left + 1 else right := right - 1 for i=left to left + k if left<array.size(nums) - 1 array.push(levels_array_zones,array.get(nums,i)) if array.size(levels_array_zones) > k array.pop(levels_array_zones) [levels_array_zones,left , left + k] //funtion to calculate STD. deviation of the 'k' levels in around the input level st_deviation(src) => sample = array.new_float(0) length= array.size(src) sampleMean = array.avg(src) for i=0 to length-1 array.push(sample, math.pow(array.get(src,i) - sampleMean, 2)) sum = array.sum(sample) st_deviation_=math.sqrt(sum / (length-1)) //getting each individual confluence name ploting_zones_levels(nearest_array_set_a,st_deviation_value_rs1,left,right)=> size_a=array.size(nearest_array_set_a)-1 first_zone_val=array.get(nearest_array_set_a,0) first_zone_high_val=array.get(nearest_array_set_a,size_a) total_score=0 abbrevation=" " for i=left to right [score,abbre]=score_nomen(array.get(levels_array, i)) total_score:=score+total_score abbrevation:=abbre+abbrevation if st_deviation_value_rs1<st_deviation_input_val label_box_plot(1,first_zone_val,first_zone_high_val,total_score,abbrevation,t_or_f_zone) for i=0 to array.size(levels_array)-1 if array.get(levels_array,i)!=array.max(levels_array) and array.get(levels_array,i)!=0 [score_non,abbre_non]=score_nomen(array.get(levels_array, i)) line_label_plot(array.get(levels_array, i),score_non,abbre_non,display_line) if barstate.islastconfirmedhistory //pushing all confluence level in the array array.push(levels_array, level_01) array.push(levels_array, level_02) array.push(levels_array, level_03) array.push(levels_array, level_04) array.push(levels_array, level_05) array.push(levels_array, level_06) array.push(levels_array, level_07) array.push(levels_array, level_08) array.push(levels_array, level_09) array.push(levels_array, level_10) array.push(levels_array, level_11) array.push(levels_array, level_12) array.push(levels_array, level_13) array.push(levels_array, level_14) array.push(levels_array, level_15) array.push(levels_array,level_16) array.push(levels_array,level_17) array.push(levels_array,level_18) array.push(levels_array,level_19) array.push(levels_array,level_20) array.push(levels_array,level_21) array.push(levels_array,level_22) array.push(levels_array,level_23) array.push(levels_array,level_24) array.push(levels_array,level_25) array.push(levels_array,level_26) array.push(levels_array,level_27) array.push(levels_array,level_28) array.push(levels_array,level_29) array.push(levels_array,level_30) array.push(levels_array,level_31) array.push(levels_array,level_32) array.push(levels_array,level_33) array.push(levels_array,level_34) array.push(levels_array,level_35) array.push(levels_array,level_36) array.push(levels_array,level_37) array.push(levels_array,level_38) if array.size(levels_array) > 38 array.pop(levels_array) array.sort(levels_array, order.ascending) //calling function to get nearest conflunece levels [nearest_array_set_a,left,right]=findKClosestElements(levels_array, nearest_n_values, level_12) st_deviation_value_rs1=st_deviation(nearest_array_set_a) [nearest_array_set_b,left_b,right_b]=findKClosestElements(levels_array, nearest_n_values, level_13) st_deviation_value_rs2=st_deviation(nearest_array_set_b) [nearest_array_set_c,left_c,right_c]=findKClosestElements(levels_array, nearest_n_values, level_14) st_deviation_value_rs3=st_deviation(nearest_array_set_c) [nearest_array_set_d,left_d,right_d]=findKClosestElements(levels_array, nearest_n_values, level_15) st_deviation_value_rs4=st_deviation(nearest_array_set_d) [nearest_array_set_e,left_e,right_e]=findKClosestElements(levels_array, nearest_n_values, level_16) st_deviation_value_rs5=st_deviation(nearest_array_set_e) //calling function to plot nearest conflunece name and points ploting_zones_levels(nearest_array_set_a,st_deviation_value_rs1,left,right) ploting_zones_levels(nearest_array_set_b,st_deviation_value_rs2,left_b,right_b) ploting_zones_levels(nearest_array_set_c,st_deviation_value_rs3,left_c,right_c) ploting_zones_levels(nearest_array_set_d,st_deviation_value_rs4,left_d,right_d) ploting_zones_levels(nearest_array_set_e,st_deviation_value_rs5,left_e,right_e) //to get maximum and minimum value of the Std deviation max_st_deviation=math.max(st_deviation_value_rs1,st_deviation_value_rs2,st_deviation_value_rs3,st_deviation_value_rs4,st_deviation_value_rs5) min_st_deviation=math.min(st_deviation_value_rs1,st_deviation_value_rs2,st_deviation_value_rs3,st_deviation_value_rs4,st_deviation_value_rs5) var t = table.new( position=position.top_right, columns=5, rows=21, bgcolor=color.silver, frame_color=color.gray, frame_width=2, border_color=color.black, border_width=1) text_size = input.string("SMALL", "Table Size", options=["AUTO", "TINY","SMALL", "NORMAL", "LARGE", "HUGE"],group="Display setting") //table_size = input.int(6, "Table Width:") text_ =text_size == "TINY"?size.tiny: text_size == "SMALL"?size.small: text_size == "NORMAL"?size.normal: text_size == "LARGE"?size.large: text_size == "HUGE"? size.huge:size.auto table.cell(t, 0, 0, "Title", bgcolor = color.blue,text_size=text_) table.cell(t, 0, 1, "Max Std. Deviation",text_size=text_) table.cell(t, 0, 2, "Min Std. Deviation",text_size=text_) table.cell(t, 0, 3, "Input value Std. Deviation",text_size=text_) table.cell(t, 1, 0, "Value", bgcolor = color.blue,text_size=text_) table.cell(t, 1, 1, str.tostring(math.round(max_st_deviation,2)), width = 15, bgcolor = color.green,text_size=text_) table.cell(t, 1, 2, str.tostring(math.round(min_st_deviation,2)), width = 15, bgcolor = color.green,text_size=text_) table.cell(t, 1, 3, str.tostring(math.round(st_deviation_input_val,2)), width = 15, bgcolor = color.green,text_size=text_)
Indicator by Mathi
https://www.tradingview.com/script/rO1WrS58-Indicator-by-Mathi/
stockist247
https://www.tradingview.com/u/stockist247/
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/ // © stockist247 //@version=5 indicator("Indicator by Mathi", "Mathi Trading", overlay=true, max_lines_count=500, max_labels_count=500) AUTO = "Auto" DAILY = "Daily" WEEKLY = "Weekly" MONTHLY = "Monthly" QUARTERLY = "Quarterly" YEARLY = "Yearly" BIYEARLY = "Biyearly" TRIYEARLY = "Triyearly" QUINQUENNIALLY = "Quinquennially" DECENNIALLY = "Decennially" TRADITIONAL = "Traditional" FIBONACCI = "Fibonacci" WOODIE = "Woodie" CLASSIC = "Classic" DEMARK = "DM" CAMARILLA = "Camarilla" kind = input.string(title="Type", defval="Traditional", options=[TRADITIONAL, FIBONACCI, WOODIE, CLASSIC, DEMARK, CAMARILLA]) pivot_time_frame = input.string(title="Pivots Timeframe", defval=AUTO, options=[AUTO, DAILY, WEEKLY, MONTHLY, QUARTERLY, YEARLY, BIYEARLY, TRIYEARLY, QUINQUENNIALLY, DECENNIALLY]) look_back = input.int(title="Number of Pivots Back", defval=15, minval=1, maxval=5000) is_daily_based = input.bool(title="Use Daily-based Values", defval=true, tooltip = "When this option is unchecked, Pivot Points will use intraday data while calculating on intraday charts. If Extended Hours are displayed on the chart, they will be taken into account during the pivot level calculation. If intraday OHLC values are different from daily-based values (normal for stocks), the pivot levels will also differ.") show_labels = input.bool(title="Show Labels", defval=true, inline = "labels") position_labels = input.string("Left", "", options = ["Left", "Right"], inline = "labels") var DEF_COLOR = #FB8C00 var arr_time = array.new_int() var p = array.new_float() p_show = input(true, "P‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏", inline = "P") p_color = input(DEF_COLOR, "", inline = "P") var r1 = array.new_float() var s1 = array.new_float() s1r1_show = input(true, "S1/R1", inline = "S1/R1") s1r1_color = input(DEF_COLOR, "", inline = "S1/R1") var r2 = array.new_float() var s2 = array.new_float() s2r2_show = input(true, "S2/R2", inline = "S2/R2") s2r2_color = input(DEF_COLOR, "", inline = "S2/R2") var r3 = array.new_float() var s3 = array.new_float() s3r3_show = input(true, "S3/R3", inline = "S3/R3") s3r3_color = input(DEF_COLOR, "", inline = "S3/R3") var r4 = array.new_float() var s4 = array.new_float() s4r4_show = input(true, "S4/R4", inline = "S4/R4") s4r4_color = input(DEF_COLOR, "", inline = "S4/R4") var r5 = array.new_float() var s5 = array.new_float() s5r5_show = input(true, "S5/R5", inline = "S5/R5") s5r5_color = input(DEF_COLOR, "", inline = "S5/R5") pivotX_open = float(na) pivotX_open := nz(pivotX_open[1],open) pivotX_high = float(na) pivotX_high := nz(pivotX_high[1],high) pivotX_low = float(na) pivotX_low := nz(pivotX_low[1],low) pivotX_prev_open = float(na) pivotX_prev_open := nz(pivotX_prev_open[1]) pivotX_prev_high = float(na) pivotX_prev_high := nz(pivotX_prev_high[1]) pivotX_prev_low = float(na) pivotX_prev_low := nz(pivotX_prev_low[1]) pivotX_prev_close = float(na) pivotX_prev_close := nz(pivotX_prev_close[1]) get_pivot_resolution() => resolution = "M" if pivot_time_frame == AUTO if timeframe.isintraday resolution := timeframe.multiplier <= 15 ? "D" : "W" else if timeframe.isweekly or timeframe.ismonthly resolution := "12M" else if pivot_time_frame == DAILY resolution := "D" else if pivot_time_frame == WEEKLY resolution := "W" else if pivot_time_frame == MONTHLY resolution := "M" else if pivot_time_frame == QUARTERLY resolution := "3M" else if pivot_time_frame == YEARLY or pivot_time_frame == BIYEARLY or pivot_time_frame == TRIYEARLY or pivot_time_frame == QUINQUENNIALLY or pivot_time_frame == DECENNIALLY resolution := "12M" resolution var lines = array.new_line() var labels = array.new_label() draw_line(i, pivot, col) => if array.size(arr_time) > 1 array.push(lines, line.new(array.get(arr_time, i), array.get(pivot, i), array.get(arr_time, i + 1), array.get(pivot, i), color=col, xloc=xloc.bar_time)) draw_label(i, y, txt, txt_color) => if show_labels offset = '‏ ‏ ‏ ‏ ‏' labels_align_str_left= position_labels == "Left" ? txt + offset : offset + txt x = position_labels == "Left" ? array.get(arr_time, i) : array.get(arr_time, i + 1) array.push(labels, label.new(x = x, y=y, text=labels_align_str_left, textcolor=txt_color, style=label.style_label_center, color=#00000000, xloc=xloc.bar_time)) traditional() => pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3 array.push(p, pivotX_Median) array.push(r1, pivotX_Median * 2 - pivotX_prev_low) array.push(s1, pivotX_Median * 2 - pivotX_prev_high) array.push(r2, pivotX_Median + 1 * (pivotX_prev_high - pivotX_prev_low)) array.push(s2, pivotX_Median - 1 * (pivotX_prev_high - pivotX_prev_low)) array.push(r3, pivotX_Median * 2 + (pivotX_prev_high - 2 * pivotX_prev_low)) array.push(s3, pivotX_Median * 2 - (2 * pivotX_prev_high - pivotX_prev_low)) array.push(r4, pivotX_Median * 3 + (pivotX_prev_high - 3 * pivotX_prev_low)) array.push(s4, pivotX_Median * 3 - (3 * pivotX_prev_high - pivotX_prev_low)) array.push(r5, pivotX_Median * 4 + (pivotX_prev_high - 4 * pivotX_prev_low)) array.push(s5, pivotX_Median * 4 - (4 * pivotX_prev_high - pivotX_prev_low)) fibonacci() => pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3 pivot_range = pivotX_prev_high - pivotX_prev_low array.push(p, pivotX_Median) array.push(r1, pivotX_Median + 0.382 * pivot_range) array.push(s1, pivotX_Median - 0.382 * pivot_range) array.push(r2, pivotX_Median + 0.618 * pivot_range) array.push(s2, pivotX_Median - 0.618 * pivot_range) array.push(r3, pivotX_Median + 1 * pivot_range) array.push(s3, pivotX_Median - 1 * pivot_range) woodie() => pivotX_Woodie_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_open * 2)/4 pivot_range = pivotX_prev_high - pivotX_prev_low array.push(p, pivotX_Woodie_Median) array.push(r1, pivotX_Woodie_Median * 2 - pivotX_prev_low) array.push(s1, pivotX_Woodie_Median * 2 - pivotX_prev_high) array.push(r2, pivotX_Woodie_Median + 1 * pivot_range) array.push(s2, pivotX_Woodie_Median - 1 * pivot_range) pivot_point_r3 = pivotX_prev_high + 2 * (pivotX_Woodie_Median - pivotX_prev_low) pivot_point_s3 = pivotX_prev_low - 2 * (pivotX_prev_high - pivotX_Woodie_Median) array.push(r3, pivot_point_r3) array.push(s3, pivot_point_s3) array.push(r4, pivot_point_r3 + pivot_range) array.push(s4, pivot_point_s3 - pivot_range) classic() => pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close)/3 pivot_range = pivotX_prev_high - pivotX_prev_low array.push(p, pivotX_Median) array.push(r1, pivotX_Median * 2 - pivotX_prev_low) array.push(s1, pivotX_Median * 2 - pivotX_prev_high) array.push(r2, pivotX_Median + 1 * pivot_range) array.push(s2, pivotX_Median - 1 * pivot_range) array.push(r3, pivotX_Median + 2 * pivot_range) array.push(s3, pivotX_Median - 2 * pivot_range) array.push(r4, pivotX_Median + 3 * pivot_range) array.push(s4, pivotX_Median - 3 * pivot_range) demark() => pivotX_Demark_X = pivotX_prev_high + pivotX_prev_low * 2 + pivotX_prev_close if pivotX_prev_close == pivotX_prev_open pivotX_Demark_X := pivotX_prev_high + pivotX_prev_low + pivotX_prev_close * 2 if pivotX_prev_close > pivotX_prev_open pivotX_Demark_X := pivotX_prev_high * 2 + pivotX_prev_low + pivotX_prev_close array.push(p, pivotX_Demark_X / 4) array.push(r1, pivotX_Demark_X / 2 - pivotX_prev_low) array.push(s1, pivotX_Demark_X / 2 - pivotX_prev_high) camarilla() => pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3 pivot_range = pivotX_prev_high - pivotX_prev_low array.push(p, pivotX_Median) array.push(r1, pivotX_prev_close + pivot_range * 1.1 / 12.0) array.push(s1, pivotX_prev_close - pivot_range * 1.1 / 12.0) array.push(r2, pivotX_prev_close + pivot_range * 1.1 / 6.0) array.push(s2, pivotX_prev_close - pivot_range * 1.1 / 6.0) array.push(r3, pivotX_prev_close + pivot_range * 1.1 / 4.0) array.push(s3, pivotX_prev_close - pivot_range * 1.1 / 4.0) array.push(r4, pivotX_prev_close + pivot_range * 1.1 / 2.0) array.push(s4, pivotX_prev_close - pivot_range * 1.1 / 2.0) resolution = get_pivot_resolution() [sec_open, sec_high, sec_low, sec_close] = request.security(syminfo.tickerid, resolution, [open, high, low, close], lookahead = barmerge.lookahead_on) sec_open_gaps_on = request.security(syminfo.tickerid, resolution, open, gaps = barmerge.gaps_on, lookahead = barmerge.lookahead_on) var number_of_years = 0 is_change_years = false var custom_years_resolution = pivot_time_frame == BIYEARLY or pivot_time_frame == TRIYEARLY or pivot_time_frame == QUINQUENNIALLY or pivot_time_frame == DECENNIALLY if custom_years_resolution and ta.change(time(resolution)) number_of_years += 1 if pivot_time_frame == BIYEARLY and number_of_years % 2 == 0 is_change_years := true number_of_years := 0 else if pivot_time_frame == TRIYEARLY and number_of_years % 3 == 0 is_change_years := true number_of_years := 0 else if pivot_time_frame == QUINQUENNIALLY and number_of_years % 5 == 0 is_change_years := true number_of_years := 0 else if pivot_time_frame == DECENNIALLY and number_of_years % 10 == 0 is_change_years := true number_of_years := 0 var is_change = false var uses_current_bar = timeframe.isintraday and kind == WOODIE var change_time = int(na) is_time_change = (ta.change(time(resolution)) and not custom_years_resolution) or is_change_years if is_time_change change_time := time if (not uses_current_bar and is_time_change) or (uses_current_bar and not na(sec_open_gaps_on)) if is_daily_based pivotX_prev_open := sec_open[1] pivotX_prev_high := sec_high[1] pivotX_prev_low := sec_low[1] pivotX_prev_close := sec_close[1] pivotX_open := sec_open pivotX_high := sec_high pivotX_low := sec_low else pivotX_prev_high := pivotX_high pivotX_prev_low := pivotX_low pivotX_prev_open := pivotX_open pivotX_open := open pivotX_high := high pivotX_low := low pivotX_prev_close := close[1] if barstate.islast and not is_change and array.size(arr_time) > 0 array.set(arr_time, array.size(arr_time) - 1, change_time) else array.push(arr_time, change_time) if kind == TRADITIONAL traditional() else if kind == FIBONACCI fibonacci() else if kind == WOODIE woodie() else if kind == CLASSIC classic() else if kind == DEMARK demark() else if kind == CAMARILLA camarilla() if array.size(arr_time) > look_back if array.size(arr_time) > 0 array.shift(arr_time) if array.size(p) > 0 and p_show array.shift(p) if array.size(r1) > 0 and s1r1_show array.shift(r1) if array.size(s1) > 0 and s1r1_show array.shift(s1) if array.size(r2) > 0 and s2r2_show array.shift(r2) if array.size(s2) > 0 and s2r2_show array.shift(s2) if array.size(r3) > 0 and s3r3_show array.shift(r3) if array.size(s3) > 0 and s3r3_show array.shift(s3) if array.size(r4) > 0 and s4r4_show array.shift(r4) if array.size(s4) > 0 and s4r4_show array.shift(s4) if array.size(r5) > 0 and s5r5_show array.shift(r5) if array.size(s5) > 0 and s5r5_show array.shift(s5) is_change := true else if is_daily_based pivotX_high := math.max(pivotX_high, sec_high) pivotX_low := math.min(pivotX_low, sec_low) else pivotX_high := math.max(pivotX_high, high) pivotX_low := math.min(pivotX_low, low) if barstate.islast and array.size(arr_time) > 0 and is_change is_change := false if array.size(arr_time) > 2 and custom_years_resolution last_pivot_time = array.get(arr_time, array.size(arr_time) - 1) prev_pivot_time = array.get(arr_time, array.size(arr_time) - 2) estimate_pivot_time = last_pivot_time - prev_pivot_time array.push(arr_time, last_pivot_time + estimate_pivot_time) else array.push(arr_time, time_close(resolution)) for i = 0 to array.size(lines) - 1 if array.size(lines) > 0 line.delete(array.shift(lines)) if array.size(lines) > 0 label.delete(array.shift(labels)) for i = 0 to array.size(arr_time) - 2 if array.size(p) > 0 and p_show draw_line(i, p, p_color) draw_label(i, array.get(p, i), "P", p_color) if array.size(r1) > 0 and s1r1_show draw_line(i, r1, s1r1_color) draw_label(i, array.get(r1, i), "R1", s1r1_color) if array.size(s1) > 0 and s1r1_show draw_line(i, s1, s1r1_color) draw_label(i, array.get(s1, i), "S1", s1r1_color) if array.size(r2) > 0 and s2r2_show draw_line(i, r2, s2r2_color) draw_label(i, array.get(r2, i), "R2", s2r2_color) if array.size(s2) > 0 and s2r2_show draw_line(i, s2, s2r2_color) draw_label(i, array.get(s2, i), "S2", s2r2_color) if array.size(r3) > 0 and s3r3_show draw_line(i, r3, s3r3_color) draw_label(i, array.get(r3, i), "R3", s3r3_color) if array.size(s3) > 0 and s3r3_show draw_line(i, s3, s3r3_color) draw_label(i, array.get(s3, i), "S3", s3r3_color) if array.size(r4) > 0 and s4r4_show draw_line(i, r4, s4r4_color) draw_label(i, array.get(r4, i), "R4", s4r4_color) if array.size(s4) > 0 and s4r4_show draw_line(i, s4, s4r4_color) draw_label(i, array.get(s4, i), "S4", s4r4_color) if array.size(r5) > 0 and s5r5_show draw_line(i, r5, s5r5_color) draw_label(i, array.get(r5, i), "R5", s5r5_color) if array.size(s5) > 0 and s5r5_show draw_line(i, s5, s5r5_color) draw_label(i, array.get(s5, i), "S5", s5r5_color) // EMA //EMA - 1 len4 = input.int(20, minval=1, title="Length") src4 = input.source(close, title="Source") out4 = ta.ema(src4, len4) plot(out4, color=#0000FF, title="EMA20") //End of format //EMA - 2 len5 = input.int(50, minval=1, title="Length") src5 = input.source(close, title="Source") out5 = ta.ema(src5, len5) plot(out5, color=#006400, title="EMA50") //End of format //EMA - 3 len6 = input.int(100, minval=1, title="Length") src6 = input.source(close, title="Source") out6 = ta.ema(src6, len6) plot(out6, color=#FFFF00, title="EMA100") //End of format //EMA - 4 len7 = input.int(200, minval=1, title="Length") src7 = input.source(close, title="Source") out7 = ta.ema(src7, len7) plot(out7, color=#ff0000, title="EMA200") //End of format //SMA //SMA - 1 len8 = input.int(20, minval=1, title="Length") src8 = input.source(close, title="Source") out8 = ta.sma(src8, len8) plot(out8, color=#800080, title="SMA20") //SMA - 2 len9 = input.int(50, minval=1, title="Length") src9 = input.source(close, title="Source") out9 = ta.sma(src9, len9) plot(out9, color=#000000, title="SMA50") //SMA - 3 len10 = input.int(200, minval=1, title="Length") src10 = input.source(close, title="Source") out10 = ta.sma(src10, len10) plot(out10, color=#A52A2A, title="SMA200") //MA20 len11 = input.int(20, minval=1, title="Length") src11 = input(close, title="Source") offset = input.int(title="Offset", defval=0, minval=-500, maxval=500) out11 = ta.sma(src11, len11) plot(out11, color=#8F00FF, title="MA", offset=offset) //RSI rsiob = input.int(60, minval=50, title= "RSI Overbought") rsios = input.int(40, maxval=50, title= "RSI Oversold") myrsi = ta.rsi(close, 14) overboughtrsi = myrsi > rsiob barcolor(overboughtrsi? #ffffff: na) oversoldrsi = myrsi < rsios barcolor(oversoldrsi? #131722: na) //----------------------------------------------------------------------------------------------------------------------------- //TABLES by MATHI //SuperTrend source = close hilow = ((high - low)*100) openclose = ((close - open)*100) vol = (volume / hilow) spreadvol = (openclose * vol) VPT = spreadvol + ta.cum(spreadvol) window_len = 28 v_len = 14 price_spread = ta.stdev(high-low, window_len) v = spreadvol + ta.cum(spreadvol) smooth = ta.sma(v, v_len) v_spread = ta.stdev(v - smooth, window_len) shadow = (v - smooth) / v_spread * price_spread out = shadow > 0 ? high + shadow : low + shadow len=input(10) vpt=math.round(ta.ema(out,len),4) // INPUTS // st_mult = input.float(1, title = 'SuperTrend Multiplier', minval = 0, maxval = 100, step = 0.01) st_period = input.int(100, title = 'SuperTrend Period', minval = 1) // CALCULATIONS // up_lev = vpt - (st_mult * ta.atr(st_period)) dn_lev = vpt + (st_mult * ta.atr(st_period)) up_trend = 0.0 up_trend := close[1] > up_trend[1] ? math.max(up_lev, up_trend[1]) : up_lev down_trend = 0.0 down_trend := close[1] < down_trend[1] ? math.min(dn_lev, down_trend[1]) : dn_lev // Calculate trend var trend = "BUY" trend := close > down_trend[1] ? "BUY" : close < up_trend[1] ? "SELL" : "BUY" // Calculate SuperTrend Line st_line = trend =="BUY" ? up_trend : down_trend //------------------------------------------------------------------------------------- //RSI rsiob1 = input.int(60, minval=50, title= "RSI Overbought") rsios1 = input.int(40, maxval=50, title= "RSI Oversold") myrsi1 = math.round(ta.rsi(close, 14),2) overboughtrsi1 = myrsi1 > rsiob1 oversoldrsi1 = myrsi1 < rsios1 trend2 = "UP" trend2 := myrsi1 < rsiob1 and myrsi1 > rsios1 ? "FLAT" : myrsi1 > rsiob1 ? "UP" : "DOWN" //EMA AND SMA ema1 = math.round(ta.ema(close, 20),3) trend3 = "BUY" trend3 := ema1 < close ? "BUY" : "SELL" ema2 = math.round(ta.ema(close, 50),3) trend4 = "BUY" trend4 := ema2 < close ? "BUY" : "SELL" sma = math.round(ta.sma(close, 50),3) trend5 = "BUY" trend5 := sma < close ? "BUY" : "SELL" //------------------------------------------------------------------------------------------------------ //ADX for Table lenadx = input(14) th = input(20) TrueRange = math.max(math.max(high-low, math.abs(high-nz(close[1]))), math.abs(low-nz(close[1]))) DirectionalMovementPlus = high-nz(high[1]) > nz(low[1])-low ? math.max(high-nz(high[1]), 0): 0 DirectionalMovementMinus = nz(low[1])-low > high-nz(high[1]) ? math.max(nz(low[1])-low, 0): 0 SmoothedTrueRange = 0.0 SmoothedTrueRange := nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1])/lenadx) + TrueRange SmoothedDirectionalMovementPlus = 0.0 SmoothedDirectionalMovementPlus := nz(SmoothedDirectionalMovementPlus[1]) - (nz(SmoothedDirectionalMovementPlus[1])/lenadx) + DirectionalMovementPlus SmoothedDirectionalMovementMinus = 0.0 SmoothedDirectionalMovementMinus := nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1])/lenadx) + DirectionalMovementMinus DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100 DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100 DX = math.round(math.abs(DIPlus-DIMinus) / (DIPlus+DIMinus)*100, 2) ADX = math.round(ta.sma(DX, lenadx), 2) trend6 = "BUY" trend6 := DIPlus > DIMinus ? (ADX >= 20 ? "Strong BUY" : "BUY") : (ADX > 20 ? "Strong SELL" : "SELL") //------------------------------------------------------------------------------------------------------ //Table var table t = table.new(position.middle_right, 10, 10, border_width = 1) if (barstate.islast) table.cell(t, 0, 0, "Indicator", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t, 1, 0, "Value", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t, 2, 0, "Trend", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t, 0, 1, "ST", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t, 0, 2, "RSI", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t, 0, 3, "EMA20", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t, 0, 4, "EMA50", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t, 0, 5, "SMA50", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t, 0, 6, "ADX", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t, 1, 1, str.tostring(vpt), width = 5, text_size = size.normal, bgcolor = trend == "BUY" ? color.green : color.red) table.cell(t, 1, 2, str.tostring(myrsi1), width = 5, text_size = size.normal, bgcolor = trend2 == "UP" ? color.green : trend2 == "FLAT" ? color.silver : color.red) table.cell(t, 1, 3, str.tostring(ema1), width = 5, text_size = size.normal, bgcolor = trend3 == "BUY" ? color.green : color.red) table.cell(t, 1, 4, str.tostring(ema2), width = 5, text_size = size.normal, bgcolor = trend4 == "BUY" ? color.green : color.red) table.cell(t, 1, 5, str.tostring(sma), width = 5, text_size = size.normal, bgcolor = trend5 == "BUY" ? color.green : color.red) table.cell(t, 1, 6, str.tostring(ADX), width = 5, text_size = size.normal, bgcolor = ADX > 20 ? color.green : color.red) table.cell(t, 2, 1, str.tostring(trend), width = 5, text_size = size.normal, bgcolor = trend == "BUY" ? color.green : color.red) table.cell(t, 2, 2, str.tostring(trend2), width = 5, text_size = size.normal, bgcolor = trend2 == "UP" ? color.green : trend2 == "FLAT" ? color.silver : color.red) table.cell(t, 2, 3, str.tostring(trend3), width = 5, text_size = size.normal, bgcolor = trend3 == "BUY" ? color.green : color.red) table.cell(t, 2, 4, str.tostring(trend4), width = 5, text_size = size.normal, bgcolor = trend4 == "BUY" ? color.green : color.red) table.cell(t, 2, 5, str.tostring(trend5), width = 5, text_size = size.normal, bgcolor = trend5 == "BUY" ? color.green : color.red) table.cell(t, 2, 6, str.tostring(trend6), width = 6, text_size = size.normal, bgcolor = trend6 == "BUY" or trend6 == "Strong BUY" ? color.green : color.red) //------------------------------------------------------------------------------------------------------ //Watchlist table i_sym1 = input.symbol("NIFTY", "Symbol") i1 = math.round(request.security(i_sym1, 'D', close),2) o1 = math.round(request.security(i_sym1, 'D', open),2) h1 = math.round(request.security(i_sym1, 'D', high),2) c1 = math.round(request.security(i_sym1, 'D', 100*(close-open)/open), 2) i_sym2 = input.symbol("BANKNIFTY", "Symbol") i2 = math.round(request.security(i_sym2, 'D', close),2) o2 = math.round(request.security(i_sym2, 'D', open),2) h2 = math.round(request.security(i_sym2, 'D', high),2) c2 = math.round(request.security(i_sym2, 'D', 100*(close-open)/open), 2) i_sym3 = input.symbol("SENSEX", "Symbol") i3 = math.round(request.security(i_sym3, 'D', close),2) o3 = math.round(request.security(i_sym3, 'D', open),2) h3 = math.round(request.security(i_sym3, 'D', high),2) c3 = math.round(request.security(i_sym3, 'D', 100*(close-open)/open), 2) i_sym4 = input.symbol("BTCUSDT", "Symbol") i4 = math.round(request.security(i_sym4, 'D', close),2) o4 = math.round(request.security(i_sym4, 'D', open),2) h4 = math.round(request.security(i_sym4, 'D', high),2) c4 = math.round(request.security(i_sym4, 'D', 100*(close-open)/open), 2) var table t1 = table.new(position.top_right, 10, 10, border_width = 1) if (barstate.islast) table.cell(t1, 0, 0, "SYMBOL", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t1, 1, 0, "LTP", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t1, 2, 0, "OPEN", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t1, 3, 0, "HIGH", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t1, 4, 0, "%CHANGE", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t1, 0, 1, "NIFTY", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t1, 0, 2, "BN", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t1, 0, 3, "SENSEX", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t1, 0, 4, "BTC", width = 6, text_size = size.normal, bgcolor = #aaaaaa) table.cell(t1, 1, 1, str.tostring(i1), width = 5, text_size = size.normal, bgcolor = c1 > 0 ? color.green : color.red) table.cell(t1, 1, 2, str.tostring(i2), width = 5, text_size = size.normal, bgcolor = c2 > 0 ? color.green : color.red) table.cell(t1, 1, 3, str.tostring(i3), width = 5, text_size = size.normal, bgcolor = c3 > 0 ? color.green : color.red) table.cell(t1, 1, 4, str.tostring(i4), width = 5, text_size = size.normal, bgcolor = c4 > 0 ? color.green : color.red) table.cell(t1, 2, 1, str.tostring(o1), width = 5, text_size = size.normal, bgcolor = c1 > 0 ? color.green : color.red) table.cell(t1, 2, 2, str.tostring(o2), width = 5, text_size = size.normal, bgcolor = c2 > 0 ? color.green : color.red) table.cell(t1, 2, 3, str.tostring(o3), width = 5, text_size = size.normal, bgcolor = c3 > 0 ? color.green : color.red) table.cell(t1, 2, 4, str.tostring(o4), width = 5, text_size = size.normal, bgcolor = c4 > 0 ? color.green : color.red) table.cell(t1, 3, 1, str.tostring(h1), width = 5, text_size = size.normal, bgcolor = c1 > 0 ? color.green : color.red) table.cell(t1, 3, 2, str.tostring(h2), width = 5, text_size = size.normal, bgcolor = c2 > 0 ? color.green : color.red) table.cell(t1, 3, 3, str.tostring(h3), width = 5, text_size = size.normal, bgcolor = c3 > 0 ? color.green : color.red) table.cell(t1, 3, 4, str.tostring(h4), width = 5, text_size = size.normal, bgcolor = c4 > 0 ? color.green : color.red) table.cell(t1, 4, 1, str.tostring(c1), width = 5, text_size = size.normal, bgcolor = c1 > 0 ? color.green : color.red) table.cell(t1, 4, 2, str.tostring(c2), width = 5, text_size = size.normal, bgcolor = c2 > 0 ? color.green : color.red) table.cell(t1, 4, 3, str.tostring(c3), width = 5, text_size = size.normal, bgcolor = c3 > 0 ? color.green : color.red) table.cell(t1, 4, 4, str.tostring(c4), width = 5, text_size = size.normal, bgcolor = c4 > 0 ? color.green : color.red)
Daily Sun Flares Class M
https://www.tradingview.com/script/qAy7GC7L-Daily-Sun-Flares-Class-M/
firerider
https://www.tradingview.com/u/firerider/
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/ // © firerider //@version=5 indicator('Daily Sun Flares Class M') // from SunPy python package / GOES varip int[] f_class = array.from(0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 1, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1, 0, 1, 2, 1, 0, 2, 1, 4, 5, 2, 1, 2, 1, 1, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 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, 0, 1, 1, 0, 0, 0, 2, 0, 1, 5, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 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, 3, 3, 0, 2, 0, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 4, 9, 2, 1, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 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, 2, 1, 1, 1, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3, 2, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 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, 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, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 5, 3, 4, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 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, 2, 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, 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, 2, 0, 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.orange, 0))
TAPLOT Wick Play
https://www.tradingview.com/script/TGp7b78L-TAPLOT-Wick-Play/
TaPlot
https://www.tradingview.com/u/TaPlot/
718
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 12/17/2021 //Popularized by 2020 US Investing Champion Oliver Kell //Wick Play is a setup in which a strong stock with momentum to the upside closes off the highs of the day in yesterdays session. //Today's session opens in the candle "wick" of yesterdays bar. //if stock holds in the wick and doesn't trade in the body of yesterdays candle, it is a sign of strength. //Trigger happens on day 3 when price moves over the high of the wick inside day. //It is important to note that this setup should not be traded in isolation. Not every wick play is buyable. //This is to be used in the context of strong stocks like True Market Leaders and with buying momentum behind them. indicator(title="TAPLOT Wick Play", shorttitle="TAPLOT Wick Play", overlay=true) C_Paintbar = input.color(title="Bar Color", defval=color.new(color.aqua,0)) C_WickPlay = input.color(title="Wick Play Indicator Color", defval=color.new(color.aqua,0)) Paintbar=input(true,'Paint Bar?') ShowShape=input(true,'Show Wick Play?') wickUpDayYesterday = close[1]>open[1] and high[1]>close[1] wickDownDayYesterday = close[1]<open[1] and high[1]>open[1] wickDojiDayYesterday = close[1]==open[1] and high[1]>close[1] TodayInUpTheWick = high <=high[1] and low >= close[1] and wickUpDayYesterday TodayInDownTheWick = high <=high[1] and low >= open[1] and wickDownDayYesterday TodayInDojiTheWick = high <=high[1] and low >= close[1] and wickDojiDayYesterday WickPlay = TodayInUpTheWick or TodayInDownTheWick or TodayInDojiTheWick plotshape(WickPlay and ShowShape?1:na,style=shape.labelup, location=location.belowbar, color=C_WickPlay, size=size.tiny) barcolor(Paintbar and WickPlay? C_Paintbar : na)
[JL] Cross Candles
https://www.tradingview.com/script/1IveyclA-JL-Cross-Candles/
Jesse.Lau
https://www.tradingview.com/u/Jesse.Lau/
46
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Jesse.Lau //@version=5 indicator('[JL] Cross Candles', overlay=true,max_bars_back = 4900) Cross_select = input.string(title='Select Indicator:', defval='Stoch', options=['Stoch','RSI', 'MovingAverage', 'MACD','StochRSI','SAR','DMI','SuperTrend']) // RSI rsi_len = input.int(14, minval=1, title="RSI Length", group = 'RSI') rsi_len1 = input.int(5, minval=1, title="Average Period", group = 'RSI') rsi = ta.rsi(close, rsi_len) rsia = ta.sma(rsi,rsi_len1) rsi_green = ta.crossover(rsi,rsia) rsi_red = ta.crossunder(rsi,rsia) //MA Cross shortlen = input.int(9, "Short MA Length", minval=1, group = 'MovingAverage') longlen = input.int(21, "Long MA Length", minval=1, group = 'MovingAverage') short = ta.sma(close, shortlen) long = ta.sma(close, longlen) ma_green = ta.crossover(short,long) ma_red = ta.crossunder(short,long) //Stochastic periodK = input.int(14, title="Stochastic %K Length", minval=1, group = 'Stochastic') smoothK = input.int(1, title="Stochastic %K Smoothing", minval=1, group = 'Stochastic') periodD = input.int(3, title="Stochastic %D Smoothing", minval=1, group = 'Stochastic') k = ta.sma(ta.stoch(close, high, low, periodK), smoothK) d = ta.sma(k, periodD) stoch_green = ta.crossover(k,d) stoch_red = ta.crossunder(k,d) // MACD fast_length = input(title="MACD Fast Length", defval=12, group = 'MACD') slow_length = input(title="MACD Slow Length", defval=26, group = 'MACD') src = input(title="MACD Source", defval=close, group = 'MACD') signal_length = input.int(title="MACD Signal Smoothing", minval = 1, maxval = 50, defval = 9, group = 'MACD') sma_source = input.string(title="MACD Oscillator MA Type", defval="EMA", options=["SMA", "EMA"], group = 'MACD') sma_signal = input.string(title="MACD Signal Line MA Type", defval="EMA", options=["SMA", "EMA"], group = 'MACD') fast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length) slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length) macd = fast_ma - slow_ma signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length) macd_green = ta.crossover(macd,signal) macd_red = ta.crossunder(macd,signal) //SAR start = input(0.02, group = 'Parabolic SAR') increment = input(0.02, group = 'Parabolic SAR') maximum = input(0.2, "Max Value", group = 'Parabolic SAR') out = ta.sar(start, increment, maximum) sar_green = ta.crossover(close,out) sar_red = ta.crossunder(close,out) //DMI len = input.int(14, minval=1, title="DI Length", group = 'DMI') 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) trur = ta.rma(ta.tr, len) plus = fixnan(100 * ta.rma(plusDM, len) / trur) minus = fixnan(100 * ta.rma(minusDM, len) / trur) dmi_green = ta.crossover(plus,minus) dmi_red = ta.crossunder(plus,minus) //Stochastic RSI sr_smoothK = input.int(3, "K", minval=1, group = 'Stochastic RSI') sr_smoothD = input.int(3, "D", minval=1, group = 'Stochastic RSI') lengthRSI = input.int(14, "RSI Length", minval=1) lengthStoch = input.int(14, "Stochastic Length", minval=1) sr_src = input(close, title="RSI Source") rsi1 = ta.rsi(sr_src, lengthRSI) sr_k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), sr_smoothK) sr_d = ta.sma(sr_k, sr_smoothD) stochrsi_green = ta.crossover(sr_k,sr_d) stochrsi_red = ta.crossunder(sr_k,sr_d) //Supertrend atrPeriod = input(10, "ATR Length", group = 'Supertrend') factor = input.float(3.0, "Factor", step = 0.01, group = 'Supertrend') [supertrend, direction] = ta.supertrend(factor, atrPeriod) Supertrend_green = ta.crossunder(direction,0) Supertrend_red = ta.crossover(direction,0) // Cross Signals turnGreen = Cross_select == 'RSI' ? rsi_green : Cross_select == 'MovingAverage' ? ma_green : Cross_select == 'Stoch' ? stoch_green : Cross_select == 'MACD' ? macd_green : Cross_select == 'StochRSI' ? stochrsi_green : Cross_select == 'SAR' ? sar_green : Cross_select == 'DMI' ? dmi_green : Cross_select == 'SuperTrend' ? Supertrend_green : stoch_green turnRed = Cross_select == 'RSI' ? rsi_red : Cross_select == 'MovingAverage' ? ma_red : Cross_select == 'Stoch' ? stoch_red : Cross_select == 'MACD' ? macd_red : Cross_select == 'StochRSI' ? stochrsi_red : Cross_select == 'SAR' ? sar_red : Cross_select == 'DMI' ? dmi_red : Cross_select == 'SuperTrend' ? Supertrend_red : stoch_red //Draw Candles barsturngreen = bar_index - ta.valuewhen(turnGreen, bar_index, 0) barsturnred = bar_index - ta.valuewhen(turnRed, bar_index, 0) barsg = barsturngreen>0 ? barsturngreen : 1 h1 = ta.highest(high,barsg) l1 = ta.lowest(low,barsg) barsr = barsturnred>0 ? barsturnred : 1 h2 = ta.highest(high,barsr) l2 = ta.lowest(low,barsr) if turnRed box.new(bar_index - barsg, h1, bar_index, l1, border_color = na, bgcolor = color.new(#7CFC00, 50)) if turnGreen box.new(bar_index - barsr, h2, bar_index, l2, border_color = na, bgcolor = color.new(#FF4500, 50))
Quantitative Easing Dates
https://www.tradingview.com/script/38zQVQzO-Quantitative-Easing-Dates/
disster
https://www.tradingview.com/u/disster/
40
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/ // © disster //@version=4 study("Quantitative Easing Dates", overlay = true, max_bars_back = 4901) qe1 = time>=timestamp(2008, 11, 25) and time<=timestamp(2010, 03, 31) qe2 = time>=timestamp(2010, 11, 03) and time<=timestamp(2011, 06, 29) qe3 = time>=timestamp(2012, 09, 13) and time<=timestamp(2014, 10, 29) qe4 = time>=timestamp(2020, 03, 15) and time<=timestamp(2022, 03, 10) bgcolor(qe1 or qe2 or qe3 or qe4 ? color.blue : na )
GBTC Premium
https://www.tradingview.com/script/AzKSqqbB-GBTC-Premium/
WuTangFinancialBank
https://www.tradingview.com/u/WuTangFinancialBank/
48
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © WuTangFinancialBank //@version=5 indicator("GBTC Premium") // 1 GBTC = 0.00093207 BTC // Under 10% = Strong buy // Under 25% = Buy // Under 75% = Neutral // Under 100% = Sell // Over 100% = Strong Sell // Amount of BTC backing each share of GBTC gbtcSharePerBtc = 0.00090193 // Percent premium levels define the colors int discountUnderPercent = 0 int strongBuyUnderPercent = 10 int buyUnderPercent = 25 int neutralUnderPercent = 75 int sellUnderPercent = 100 int strongSellOverPercent = 100 // Colors defining the line color at different levels color discountUnderColor = color.purple color strongBuyUnderColor = color.blue color buyUnderColor = color.green color neutralUnderColor = color.orange color sellUnderColor = color.red color strongSellOverColor = color.maroon // Get the GBTC ticker gbtcTicker = request.security(syminfo.tickerid, "", close) // Get the BTC ticker btcTicker = ticker.new("BITSTAMP", "BTCUSD", syminfo.session) // Get the close for the specified timeframe timeframeClose = request.security(btcTicker, "", close) // Get the factional size per share for GBTC gbtcFractionalShare = timeframeClose * gbtcSharePerBtc // Get the % deflection from GBTC deflection = ((gbtcTicker - gbtcFractionalShare) / gbtcTicker) * 100 // Get a string representation of the deflection deflectionStr = str.tostring(math.round(deflection)) // Determine the line color color lineColor = if (deflection < discountUnderPercent) discountUnderColor else if ((discountUnderPercent <= deflection) and (deflection < strongBuyUnderPercent)) strongBuyUnderColor else if ((strongBuyUnderPercent <= deflection) and (deflection < buyUnderPercent)) buyUnderColor else if ((buyUnderPercent <= deflection) and (deflection < neutralUnderPercent)) neutralUnderColor else if ((neutralUnderPercent <= deflection) and (deflection < sellUnderPercent)) sellUnderColor else if (strongSellOverPercent <= deflection) strongSellOverColor // Paint a dotted line at 0 - Discount hline(discountUnderPercent, title="DOSCOUNT!", color=color.red, linestyle=hline.style_dashed) // Paint a dotted line at the Buy hline(buyUnderPercent, title="Buy Under", color=color.gray, linestyle=hline.style_dashed) var discountText = "Discount" color discountColor = color.green var premiumText = "Premium" color premiumColor = color.red // Label the current premium var label myLabel = label.new(x=bar_index, y=high, textcolor=color.white, color=color.red) // On the last bar, show the chart's bar count if (barstate.islast) // Set the label text labelText = if (deflection < discountUnderPercent) discountText else premiumText // Set the label color labelColor = if (deflection < discountUnderPercent) discountColor else premiumColor // Set the label content label.set_text(id=myLabel, text=labelText + ": " + deflectionStr + "%") label.set_color(id=myLabel, color=labelColor) // Update the label's location label.set_x(id=myLabel, x=bar_index) label.set_y(id=myLabel, y=deflection) // Add a label at the buy level buyUnderPercent var label buyLabel = label.new(x=bar_index - 50, y=buyUnderPercent, textcolor=color.white, color=color.gray) label.set_text(id=buyLabel, text="BuyLine") label.set_style(id=buyLabel, style=label.style_label_up) // Add a label at the buy level buyUnderPercent var label discountLabel = label.new(x=bar_index - 100, y=discountUnderPercent, textcolor=color.white, color=color.purple) label.set_text(id=discountLabel, text="Discount") label.set_style(id=discountLabel, style=label.style_label_up) // Plot plot(deflection, color=lineColor)
Candlestick Trading (Malaysia Stock Market)
https://www.tradingview.com/script/PZvsPHq9-Candlestick-Trading-Malaysia-Stock-Market/
taufan_ganas
https://www.tradingview.com/u/taufan_ganas/
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/ // © taufan_ganas //@version=5 indicator("Candlestick Trading", overlay = true) grp_1 = 'SHOWS BEARISH CANDLES IF ABOVE:' //Appear if above MA: MACS1 = input.int(title='MA 1', defval=20, minval=1, group = grp_1) MACS1type = input.string(title='MA 1 Type', defval='SMA', options=['SMA', 'EMA']) macs1(close, type, length) => type == 'SMA' ? ta.sma(close, MACS1) : type == 'EMA' ? ta.ema(close, MACS1) : na // MA1 Name MACS_1 = macs1(close, MACS1type, MACS1) MACS2 = input.int(title='MA 2', defval=50, minval=1, group = grp_1) MACS2type = input.string(title='MA 2 Type', defval='SMA', options=['SMA', 'EMA']) macs2(close, type, length) => type == 'SMA' ? ta.sma(close, MACS2) : type == 'EMA' ? ta.ema(close, MACS2) : na // MA2 Name MACS_2 = macs2(close, MACS2type, MACS2) MACS3 = input.int(title='MA 3', defval=200, minval=1, group = grp_1) MACS3type = input.string(title='MA 3 Type', defval='SMA', options=['SMA', 'EMA']) macs3(close, type, length) => type == 'SMA' ? ta.sma(close, MACS3) : type == 'EMA' ? ta.ema(close, MACS3) : na // MA2 Name MACS_3 = macs3(close, MACS3type, MACS3) grp_2 = 'BEARISH CANDLE TYPES AND LAST CANDLES DONE' //Bearish Candlestick Criteria //Bids xyz = close < 1 ? 0.005 : close >= 1 and close < 10 ? 2 * 0.005 : close >= 10 and close < 100 ? 4 * 0.005 : 0.10 change = close - open bids = change / xyz minbids = bids >= 3 //Dark Cloud Cover inputdccover = input(title='Dark Cloud Cover', defval=true, group = grp_2) darkcloudcover = inputdccover and open > close[1] and close >= open[1] and close[1] > close and open > close and close[1] > open[1] and (open - close)/xyz >= 4 and close >= MACS_1 and close >= MACS_2 and close >= MACS_3 plotshape(darkcloudcover, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Dark \nCloud \nCover\n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2) ) //Kickers inputkickers = input(title='Bearish Kickers', defval=true, group = grp_2) kickers = inputkickers and close[1] - open[1] > 0 and open > close and close[1] > open and open[1] > close and close >= MACS_1 and close >= MACS_2 plotshape(kickers, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Bearish \nKickers\n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2 ) ) //Bearish Engulfing inputbeareng = input(title='Bearish Engulfing', defval=true, group = grp_2) bearishengulfing = inputbeareng and open > close[1] and close < open[1] and open > close and close[1] > open[1] and close >= MACS_1 and close >= MACS_2 and close >= MACS_3 plotshape(bearishengulfing, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Bearish \nEngulfing\n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2) ) //Evening Star // inputevestar = input(title='Evening Star', defval=true, group = grp_2) day2 = close[2] > open[2] day1A = open[1] > close[1] and close[1] > close[2] and day2 day1B = open[1] == close[1] and high - open > 0 and close - low > 0 and close[1] > close[2] and day2 // abandoned baby day1C = open[1] == close[1] and high - open == 0 and close - low > 0 and close[1] > close[2] and day2 // dragon fly day1D = open[1] == close[1] and high - open > 0 and close - low > 0 and close[1] > open[2] and day2 //harami cross daytotal = day1A or day1B or day1C or day1D eveningstar = inputevestar and open > close and close[1] > open and daytotal and close[2] >= open and open >= open[2] and close >= MACS_1 and close >= MACS_2 plotshape(eveningstar, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Evening \nStar\n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2) ) //Three Black Crows input3bcrow = input(title='Three Black Crows', defval=true, group = grp_2) day3 = close[3] > open[3] day2a = open[2] > close[2] and day3 day = open[1] > close[1] and open[2] > open[1] and close[2] > close[1] and day2a threeblackcrows = input3bcrow and open > close and open[1] > open and close[1] > close and day and close >= MACS_1 and close >= MACS_2 // plotshape(threeblackcrows, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Three \nBlack \nCrows\n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2) ) //Hanging Man inputhangman = input(title='Hanging Man', defval=true, group = grp_2) hangingman = inputhangman and open > close? close >= close[1] and close - low >= 2 * math.abs(open - close) and open!=close and high - open <= math.abs(open - close) and close >= MACS_1 and close >= MACS_2 : open >= close[1] and low - close >= 2 * math.abs(close - open) and open!=close and high - close <= math.abs(close - open) and close >= MACS_1 and close >= MACS_2 plotshape(hangingman, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Hanging \nMan\n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2 )) //Shooting Star inputshostar = input(title='Shooting Star', defval=true, group = grp_2) shootingstar = inputshostar and open > close? close >= close[1] and high - open >= 2 * math.abs(open - close) and open!=close and close - low <= math.abs(open - close) and close >= MACS_1 and close >= MACS_2 : inputshostar and open >= close[1] and high - close >= 2 * math.abs(close - open) and open!=close and open - low <= math.abs(close - open) and close >= MACS_1 and close >= MACS_2 plotshape(shootingstar, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Shooting \nStar\n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2) ) //Tweezer Top inputtwetop = input(title='Tweezer Top', defval=true, group = grp_2) tweezertop = inputtwetop and open == close[1] and open > close and (open - close)/xyz >= 3 and close[1] > open[1] and close >= MACS_1 and close >= MACS_2 plotshape(tweezertop, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Tweezer \nTop\n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2) ) //Bearish Harami inputharami = input(title='Bearish Harami', defval=true, group = grp_2) bearishharami = inputharami and close[1] - open[1] > 0 and open > close and open - close < close[1]-open[1] and close > open[1] and close[1] > open and close >= MACS_1 and close >= MACS_2 plotshape(bearishharami, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Bearish \nHarami\n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2) ) //Doji inputdoji = input(title='Doji', defval=true, group = grp_2) doji = inputdoji and close == open and high - open > 0 and close - low > 0 and close >= MACS_1 and close >= MACS_2 plotshape(doji, color = #E040FB, size = size.tiny, style = shape.triangledown, location = location.abovebar, text = "Doji \n|\n|", show_last=input(title='Last Candles Done', defval=10, group = grp_2) ) //Potential Top grp_3 = 'POTENTIAL TOP: STOCHASTIC AND SIGNAL SETTINGS' periodK = input.int(14, title='K', minval=1, group = grp_3) periodD = input.int(3, title='D', minval=1, group = grp_3) smoothK = input.int(3, title='Smooth', minval=1, group = grp_3) k = ta.sma(ta.stoch(close, high, low, periodK), smoothK) d = ta.sma(k, periodD) labelpotentialtop = input(title='Potential Top', defval=true, group = grp_3) stotopline = input.int(75, title = 'Stochastic Level', minval = 0, maxval = 100) candlelist = darkcloudcover or bearishengulfing or eveningstar or threeblackcrows or hangingman or shootingstar or tweezertop or bearishharami or doji or kickers top = labelpotentialtop and k >= stotopline and candlelist if top potentialtop = label.new(bar_index, na, text = 'Potential\nTop\n▼ \n\n', color=#FFFFFF00, color = color.red, textcolor=color.red, style=label.style_label_up, size=size.normal, yloc = yloc.abovebar) label.delete(potentialtop[1]) //============================================================ grp_4 ='SHOW BULLISH CANDLES IF IN BETWEEN:' // MA1 MA1 = input.int(title='MA 4 Length', defval=30, minval=1, group = grp_4) MA1type = input.string(title='MA 4 Type', defval='EMA', options=['SMA', 'EMA']) ma1(close, type, length) => type == 'SMA' ? ta.sma(close, MA1) : type == 'EMA' ? ta.ema(close, MA1) : na // MA1 Name MA_1 = ma1(close, MA1type, MA1) //MA2 MA2 = input.int(title='MA 5 Length', defval=100, minval=1, group = grp_4) MA2type = input.string(title='MA 5 Type', defval='EMA', options=['SMA', 'EMA']) ma2(close, type, length) => type == 'SMA' ? ta.sma(close, MA2) : type == 'EMA' ? ta.ema(close, MA2) : na // MA2 Name MA_2 = ma2(close, MA2type, MA2) grp_5 = 'BULLISH CANDLE TYPES AND LAST CANDLES DONE' //Piercing inputpiercing = input(title='Piercing', defval=true, group = grp_5) piercing = inputpiercing and open[1] > close and close[1] > open and open[1] > open and close > open and open[1] > close[1] and (close - open)/xyz >= 4 and low <= MA_1 and close >= MA_2 plotshape(piercing, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nPiercing ", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //Bullish Kickers inputbullkickers = input(title='Bullish Kickers', defval=true, group = grp_5) bullkickers1 = inputbullkickers and open[1] > close[1] and close > open and open > open[1] and low <= MA_1 and close >= MA_2 bullkickers2 = inputbullkickers and open[1] > close[1] and close > open and open > close[1] and close > open[1] and low <= MA_1 and close >= MA_2 bullkickers = bullkickers1 or bullkickers2 plotshape(bullkickers, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nBullish\nKickers ", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //Bullish Engulfing inputbulleng = input(title='Bullish Engulfing', defval=true, group = grp_5) bullishengulfing = inputbulleng and close > open[1] and close[1] > open and close > open and open[1] > close[1] and low <= MA_1 and close >= MA_2 plotshape(bullishengulfing, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nBullish\nEngulfing ", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //Morning Star inputmorstar = input(title='Morning Star', defval=true, group = grp_5) day2x = open[2] > close[2] //bear candle day1Ax = close[1] > open[1] and close[2] > close[1] and day2x //morning star day1Bx = close[1] == open[1] and open - low > 0 and high - close > 0 and close[2] > close[1] and day2x // bullish abandoned baby day1Cx = close[1] == open[1] and high - open == 0 and close - low > 0 and close[2] > close[1] and day2x // dragon fly day1Dx = close[1] == open[1] and high - open > 0 and close - low > 0 and close[2] > close[1] and day2x //harami cross daytotalx = day1Ax or day1Bx or day1Cx or day1Dx morningstar = inputmorstar and close > open and open > close[1] and daytotalx and close[2] >= open and close >= close[2] and low <= MA_1 and close >= MA_2 plotshape(morningstar, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nMorning\nStar ", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //Three White Soldiers input3soldiers = input(title='Three White Soldiers', defval=true, group = grp_5) day3x = open[3] >= close[3] day2ax = close[2] > open[2] and day3x dayx = close[1] > open[1] and close[1] > close[2] and open[1] > open[2] and day2ax whitesoldiers = input3soldiers and close > open and close > close[1] and open > open[1] and dayx and low <= MA_1 and close >= MA_2 plotshape(whitesoldiers, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nThree\nWhite\nSoldiers ", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //Hammer inputhammer = input(title='Hammer', defval=true, group = grp_5) hammer = inputhammer and open > close? close[1] >= close and close - low >= 2 * math.abs(open - close) and open!=close and high - open <= math.abs(open - close) and low <= MA_1 and close >= MA_2 : inputhammer and close[1] >= open and open - low >= 2 * math.abs(close - open) and open!=close and high - close <= math.abs(close - open) and low <= MA_1 and close >= MA_2 plotshape(hammer, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nHammer ", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //Inverted Hammer inputinvhammer = input(title='Inverted Hammer', defval=true, group = grp_5) invertedhammer = inputinvhammer and open > close? open[1] >= close[1] and close[1] > open and high - open >= 2 * math.abs(open - close) and open!=close and close - low <= math.abs(open - close) and low <= MA_1 and close >= MA_2 : inputinvhammer and open[1] >= close[1] and close[1] > close and high - close >= 2 * math.abs(close - open) and open!=close and open - low <= math.abs(close - open) and low <= MA_1 and close >= MA_2 plotshape(invertedhammer, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nInverted\nHammer ", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //Tweezer Bottom inputtwebot = input(title='Tweezer Bottom', defval=true, group = grp_5) tweezerbot = inputtwebot and open == close[1] and close > open and (close - open)/xyz >= 3 and open[1] > close[1] and low <= MA_1 and close >= MA_2 plotshape(tweezerbot, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nTweezer\nBottom ", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //Bullish Harami inputbullharami = input(title='Bearish Harami', defval=true, group = grp_5) bullishharami = inputbullharami and open[1] - close[1] > 0 and close > open and close - open < open[1]-close[1] and open > close[1] and open[1] > close and low <= MA_1 and close >= MA_2 plotshape(bullishharami, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nBullish\nHarami ", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //Doji inputbulldoji = input(title='Bullish Doji', defval=true, group = grp_5) bulldoji = inputbulldoji and close == open and high - open > 0 and close - low > 0 and low <= MA_1 and close >= MA_2 plotshape(bulldoji, color = #E040FB, size = size.tiny, style = shape.triangleup, location = location.belowbar, text = "\n|\n|\nDoji", show_last=input(title='Last Candles Done', defval=10, group = grp_5) ) //================================================ //Potential Top And Bottom grp_6 = 'POTENTIAL BOTTOM: SIGNAL SETTINGS' pK = input.int(14, title='K', minval=1, group = grp_6) pD = input.int(3, title='D', minval=1, group = grp_6) sK = input.int(3, title='Smooth', minval=1, group = grp_6) K = ta.sma(ta.stoch(close, high, low, pK), sK) D = ta.sma(K, pD) //Potential Bottom labelpotentialbottom = input(title='Potential Bottom', defval=true, group = grp_6) stobottomline = input.int(25, title = 'Stochastic Level : Bottom Line', minval = 0, maxval = 100) bullcandlelist = piercing or bullkickers or bullishengulfing or morningstar or whitesoldiers or hammer or invertedhammer or tweezerbot or bullishharami or bulldoji bottom = labelpotentialbottom and K <= stobottomline and bullcandlelist if bottom potentialbottom = label.new(bar_index, na, text='\n▲\nPotential \nBottom', color=#FFFFFF00, textcolor=color.green, style=label.style_label_up, size=size.normal, yloc=yloc.belowbar) label.delete(potentialbottom[1])
Volume Bar Breakout and Breakdown Indicator
https://www.tradingview.com/script/V2cjsLhI-Volume-Bar-Breakout-and-Breakdown-Indicator/
iitiantradingsage
https://www.tradingview.com/u/iitiantradingsage/
3,084
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/ // © tradeswithashish //@version=5 indicator(title="Volume bar range", shorttitle="Highest Volume Bar Range", overlay=true) lookback=input.int(title="How many bars to check", defval=75, minval=5, maxval=500, step=5) //defining variables for high and low of volume bar var highVB = high var lowVB = low highestvol = ta.highest(volume, lookback) vol=volume>0 volMA=ta.sma(volume, 20) if vol for i = 1 to lookback by 1 if volume[i] == highestvol highVB := high[i] lowVB := low[i] colfill=highVB==highVB[1]?color.aqua:color.white plot1 = plot(highVB, title='Candle high', color=color.new(color.white,100),linewidth=1, style=plot.style_line) plot2 = plot(lowVB, title='Candle low', color=color.new(color.white,100), linewidth=1, style=plot.style_line) fill(plot1, plot2, title='Range of Volume bar', color=color.new(colfill, 80)) //Checking the breakout and breakdown criteria breakout=ta.crossover(close, highVB) and volume>volMA and barstate.isconfirmed and volume>volume[1] and (close-low)/(high-low)>0.5 breakdown=ta.crossunder(close, lowVB) and volume>volMA and barstate.isconfirmed and volume>volume[1] and (close-low)/(high-low)<0.5 plotshape(breakout, title="Breakout signal", style=shape.labelup, size=size.small, color=color.blue, location= location.belowbar, text="BUY", textcolor=color.white) plotshape(breakdown, title="Breakdown signal", style=shape.labeldown, size=size.small, color=color.black, location= location.abovebar, text="SELL", textcolor=color.white)
X-Mas Tree
https://www.tradingview.com/script/RAJSoAxg-X-Mas-Tree/
Trendoscope
https://www.tradingview.com/u/Trendoscope/
275
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("X-Mas Tree", overlay=true, max_lines_count=500, max_labels_count=500, max_bars_back=5000) showZigZag1 = input.bool(true, title='L1 Length', group='Zigzag', inline='main') zigzag1Length = input.int(5, step=1, minval=3, title='', group='Zigzag', inline='main') zigzag1Color = input.color(color.rgb(30, 86, 49, 0), title='', group='Zigzag', inline='main') showZigZag2 = input.bool(true, title='L2 Length', group='Zigzag', inline='sub1') zigzag2Length = input.int(3, step=1, minval=2, title='', group='Zigzag', inline='sub1') zigzag2Color = input.color(color.rgb(164, 222, 2, 0), title='', group='Zigzag', inline='sub1') showZigZag3 = input.bool(true, title='L3 Length', group='Zigzag', inline='sub2') zigzag3Length = input.int(3, step=1, minval=2, title='', group='Zigzag', inline='sub2') zigzag3Color = input.color(color.rgb(172, 223, 135, 0), title='', group='Zigzag', inline='sub2') showZigZag4 = input.bool(true, title='L4 Length', group='Zigzag', inline='sub3') zigzag4Length = input.int(3, step=1, minval=2, title='', group='Zigzag', inline='sub3') zigzag4Color = input.color(color.rgb(104, 187, 89, 0), title='', group='Zigzag', inline='sub3') greetingSize = input.string(size.large, "Greeting Size", options=[size.huge, size.large, size.normal, size.small, size.tiny, size.auto]) tbl = table.new(position.middle_center, 100, 100) //****************************************************** Make Snow *****************************************************/ varip counter = 1 counter := counter+1 var colPos = array.new_int() var snowStyle = array.new_int() if(array.size(colPos) == 0) for i=0 to 99 random = int(math.random(0, 100)) style = int(math.random(0,3)) array.push(colPos, random) array.push(snowStyle, style) snowflakeArray = array.from('❆', '❄', '❅') if(barstate.islast) for i=0 to 99 for j=0 to 99 val = ((counter+array.get(colPos, i)+(100-j))%10) if val == 0 table.cell(tbl, i, j, array.get(snowflakeArray, array.get(snowStyle, i)), text_color=color.white) //********************************************** Draw tree - using zigzags *********************************************/ useAlternativeSource = false source = close max_array_size = 50 useZigZagChain = false waitForConfirmation = false var zigzagpivots1 = array.new_float(0) var zigzagpivotbars1 = array.new_int(0) var zigzagpivotdirs1 = array.new_int(0) var zigzagpivots2 = array.new_float(0) var zigzagpivotbars2 = array.new_int(0) var zigzagpivotdirs2 = array.new_int(0) var zigzagpivots3 = array.new_float(0) var zigzagpivotbars3 = array.new_int(0) var zigzagpivotdirs3 = array.new_int(0) var zigzagpivots4 = array.new_float(0) var zigzagpivotbars4 = array.new_int(0) var zigzagpivotdirs4 = array.new_int(0) var zigzag1lines = array.new_line(0) var zigzag2lines = array.new_line(0) var zigzag3lines = array.new_line(0) var zigzag4lines = array.new_line(0) add_to_array(arr, val, maxItems) => array.unshift(arr, val) if array.size(arr) > maxItems array.pop(arr) pivots(length) => highsource = useAlternativeSource ? source : high lowsource = useAlternativeSource ? source : low float phigh = ta.highestbars(highsource, length) == 0 ? highsource : na float plow = ta.lowestbars(lowsource, length) == 0 ? lowsource : na [phigh, plow, bar_index, bar_index] outerpivots(startIndex, length, zigzagpivots, zigzagpivotbars) => zigzagminimal = array.slice(zigzagpivots, startIndex, length - 1) lastPivot = array.get(zigzagpivots, startIndex) lastPivotBar = array.get(zigzagpivotbars, startIndex) highestPivot = array.max(zigzagminimal) lowestPivot = array.min(zigzagminimal) float phigh = lastPivot == highestPivot ? lastPivot : na float plow = lastPivot == lowestPivot ? lastPivot : na int phighbar = lastPivot == highestPivot ? lastPivotBar : na int plowbar = lastPivot == lowestPivot ? lastPivotBar : na [phigh, plow, phighbar, plowbar] addnewpivot(zigzagpivots, zigzagpivotbars, zigzagpivotdirs, value, bar, dir) => newDir = dir if array.size(zigzagpivots) >= 2 LastPoint = array.get(zigzagpivots, 1) newDir := dir * value > dir * LastPoint ? dir * 2 : dir newDir add_to_array(zigzagpivots, value, max_array_size) add_to_array(zigzagpivotbars, bar, max_array_size) add_to_array(zigzagpivotdirs, newDir, max_array_size) zigzagcore(phigh, plow, phighbar, plowbar, zigzagpivots, zigzagpivotbars, zigzagpivotdirs) => pDir = 1 newZG = false doubleZG = phigh and plow if array.size(zigzagpivots) >= 1 pDir := array.get(zigzagpivotdirs, 0) pDir := pDir % 2 == 0 ? pDir / 2 : pDir pDir if (pDir == 1 and phigh or pDir == -1 and plow) and array.size(zigzagpivots) >= 1 pivot = array.shift(zigzagpivots) pivotbar = array.shift(zigzagpivotbars) pivotdir = array.shift(zigzagpivotdirs) value = pDir == 1 ? phigh : plow bar = pDir == 1 ? phighbar : plowbar useNewValues = value * pivotdir > pivot * pivotdir value := useNewValues ? value : pivot bar := useNewValues ? bar : pivotbar newZG := newZG or useNewValues addnewpivot(zigzagpivots, zigzagpivotbars, zigzagpivotdirs, value, bar, pDir) if pDir == 1 and plow or pDir == -1 and phigh value = pDir == 1 ? plow : phigh bar = pDir == 1 ? plowbar : phighbar dir = pDir == 1 ? -1 : 1 newZG := true addnewpivot(zigzagpivots, zigzagpivotbars, zigzagpivotdirs, value, bar, dir) [newZG, doubleZG] zigzag(length, zigzagpivots, zigzagpivotbars, zigzagpivotdirs) => [phigh, plow, phighbar, plowbar] = pivots(length) zigzagcore(phigh, plow, phighbar, plowbar, zigzagpivots, zigzagpivotbars, zigzagpivotdirs) outerzigzag(outerzigzagLength, zigzagpivots, zigzagpivotbars, outerzigzagpivots, outerzigzagpivotbars, outerzigzagpivotdirs, ignore) => newOuterZG = false newDoubleOuterZG = false startIndex = waitForConfirmation ? 1 : 0 if array.size(zigzagpivots) >= outerzigzagLength * 2 + startIndex [phigh, plow, phighbar, plowbar] = outerpivots(startIndex, outerzigzagLength * 2 + startIndex, zigzagpivots, zigzagpivotbars) [newZG, doubleZG] = zigzagcore(phigh, plow, phighbar, plowbar, outerzigzagpivots, outerzigzagpivotbars, outerzigzagpivotdirs) newOuterZG := newZG newDoubleOuterZG := doubleZG newDoubleOuterZG [newOuterZG, newDoubleOuterZG] draw_zg_line(idx1, idx2, zigzaglines, zigzagpivots, zigzagpivotbars, zigzagcolor, zigzagwidth, zigzagstyle) => if array.size(zigzagpivots) > 2 y1 = array.get(zigzagpivots, idx1) y2 = array.get(zigzagpivots, idx2) x1 = array.get(zigzagpivotbars, idx1) x2 = array.get(zigzagpivotbars, idx2) zline = line.new(x1=x1, y1=y1, x2=x2, y2=y2, color=zigzagcolor, width=zigzagwidth, style=zigzagstyle) if array.size(zigzaglines) >= 1 lastLine = array.get(zigzaglines, 0) if x2 == line.get_x2(lastLine) and y2 == line.get_y2(lastLine) line.delete(lastLine) array.unshift(zigzaglines, zline) if array.size(zigzaglines) > max_array_size * 10 line.delete(array.pop(zigzaglines)) draw_zigzag(doubleZG, zigzaglines, zigzagpivots, zigzagpivotbars, zigzagcolor, zigzagwidth, zigzagstyle) => if doubleZG draw_zg_line(1, 2, zigzaglines, zigzagpivots, zigzagpivotbars, zigzagcolor, zigzagwidth, zigzagstyle) if array.size(zigzagpivots) >= 2 draw_zg_line(0, 1, zigzaglines, zigzagpivots, zigzagpivotbars, zigzagcolor, zigzagwidth, zigzagstyle) getCellColorByDirection(dir) => dir == 2 ? color.green : dir == 1 ? color.lime : dir == -1 ? color.orange : dir == -2 ? color.red : color.silver [level1ZG, doublel1ZG] = zigzag(zigzag1Length, zigzagpivots1, zigzagpivotbars1, zigzagpivotdirs1) [level2ZG, doublel2ZG] = outerzigzag(zigzag2Length, zigzagpivots1, zigzagpivotbars1, zigzagpivots2, zigzagpivotbars2, zigzagpivotdirs2, level1ZG) [level3ZG, doublel3ZG] = outerzigzag(useZigZagChain ? zigzag3Length : zigzag2Length + zigzag3Length, useZigZagChain ? zigzagpivots2 : zigzagpivots1, useZigZagChain ? zigzagpivotbars2 : zigzagpivotbars1, zigzagpivots3, zigzagpivotbars3, zigzagpivotdirs3, useZigZagChain ? level2ZG : level1ZG) [level4ZG, doublel4ZG] = outerzigzag(useZigZagChain ? zigzag4Length : zigzag2Length + zigzag3Length + zigzag4Length, useZigZagChain ? zigzagpivots3 : zigzagpivots1, useZigZagChain ? zigzagpivotbars3 : zigzagpivotbars1, zigzagpivots4, zigzagpivotbars4, zigzagpivotdirs4, useZigZagChain ? level2ZG : level1ZG) if level1ZG and showZigZag1 draw_zigzag(doublel1ZG, zigzag1lines, zigzagpivots1, zigzagpivotbars1, zigzag1Color, 1, line.style_solid) if level2ZG and showZigZag2 draw_zigzag(doublel2ZG, zigzag2lines, zigzagpivots2, zigzagpivotbars2, zigzag2Color, 1, line.style_solid) if level1ZG and showZigZag3 draw_zigzag(doublel3ZG, zigzag3lines, zigzagpivots3, zigzagpivotbars3, zigzag3Color, 1, line.style_solid) if level2ZG and showZigZag4 draw_zigzag(doublel4ZG, zigzag4lines, zigzagpivots4, zigzagpivotbars4, zigzag4Color, 1, line.style_solid) //****************************************************** Decorate *****************************************************/ var decorationsUp = array.from("🦋", "🪲", "🐝", "🐞") var staticDecorations = array.from("🎗", "💠", "🔶", "🎅", "⛄","🎄"), var decorationsDown = array.from("🔴", "🔵", "🟠", "🟡", "🟢", "🟣") barcolor(color.green) var labelArray = array.new_label() for lbl in labelArray label.delete(lbl) if barstate.islast for i=0 to array.size(zigzagpivots4)-1 z4Price = array.get(zigzagpivots4, i) z4Bar = array.get(zigzagpivotbars4, i) z4Dir = array.get(zigzagpivotdirs4, i) if(z4Dir > 0) uh = label.new(z4Bar, z4Price, text = "🌟", xloc = xloc.bar_index, yloc=yloc.price, style=label.style_none, size=size.huge) array.push(labelArray, uh) else ul = label.new(z4Bar, z4Price-4*ta.tr, text = "🔔", xloc = xloc.bar_index, yloc=yloc.price, style=label.style_none, size=size.huge) array.push(labelArray, ul) for i=0 to array.size(zigzagpivots2)-1 z2Price = array.get(zigzagpivots2, i) z2Bar = array.get(zigzagpivotbars2, i) z2Dir = array.get(zigzagpivotdirs2, i) if(not array.includes(zigzagpivotbars4, z2Bar) and not array.includes(zigzagpivotbars3, z2Bar)) if(z2Dir > 0) decorationsIndex = int(math.random(0,array.size(decorationsUp))) uh = label.new(z2Bar, z2Price, text = array.get(decorationsUp,decorationsIndex) , xloc = xloc.bar_index, yloc=yloc.price, style=label.style_none, size=size.huge) array.push(labelArray, uh) else decorationsIndex = int(math.random(0,array.size(decorationsDown))) ul = label.new(z2Bar, z2Price-4*ta.tr, text = array.get(decorationsDown,decorationsIndex), xloc = xloc.bar_index, yloc=yloc.price, style=label.style_none, size=size.large) array.push(labelArray, ul) for i=0 to array.size(zigzagpivots3)-1 z3Price = array.get(zigzagpivots3, i) z3Bar = array.get(zigzagpivotbars3, i) z3Dir = array.get(zigzagpivotdirs3, i) if(not array.includes(zigzagpivotbars4, z3Bar)) if(z3Dir > 0) uh = label.new(z3Bar, z3Price, text = array.get(staticDecorations, i%array.size(staticDecorations)), xloc = xloc.bar_index, yloc=yloc.price, style=label.style_none, size=size.large) array.push(labelArray, uh) else uh = label.new(z3Bar, z3Price-2*ta.tr, text = array.get(staticDecorations, i%array.size(staticDecorations)), xloc = xloc.bar_index, yloc=yloc.price, style=label.style_none, size=size.large) array.push(labelArray, uh) //****************************************************** Greetings *****************************************************/ tblGreeting = table.new(position.bottom_center, 20, 5) table.cell(tblGreeting, 2,0, "🄼", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 3,0, "🄴", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 4,0, "🅁", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 5,0, "🅁", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 6,0, "🅈", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 7,0, " ", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 8,0, "🅇", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 9,0, "🄼", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 10,0, "🄰", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 11,0, "🅂", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 6,1, "🄰", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 7,1, "🄽", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 8,1, "🄳", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 0,2, "🄷", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 1,2, "🄰", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 2,2, "🄿", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 3,2, "🄿", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 4,2, "🅈", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 5,2, " ", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 6,2, "🄽", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 7,2, "🄴", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 8,2, "🅆", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 9,2, " ", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 10,2, "🅈", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 11,2, "🄴", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 12,2, "🄰", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80)) table.cell(tblGreeting, 13,2, "🅁", text_color=color.red, text_size=greetingSize, bgcolor=color.new(color.green, 80))
ETHE Premium
https://www.tradingview.com/script/l503kb8o-ETHE-Premium/
WuTangFinancialBank
https://www.tradingview.com/u/WuTangFinancialBank/
18
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/ // © WuTangFinancialBank //@version=5 indicator("ETHE Premium") // 1 ETHE = 0.01005138 ETH // Under 10% = Strong buy // Under 25% = Buy // Under 100% = Neutral // Under 250% = Sell // Over 250% = Strong Sell // Amount of ETH backing each share of ETHE ethPerShare = 0.00964733 // Percent premium levels define the colors int discountUnderPercent = 0 int strongBuyUnderPercent = 10 int buyUnderPercent = 25 int neutralUnderPercent = 100 int sellUnderPercent = 250 int strongSellOverPercent = 250 // Colors defining the line color at different levels color discountUnderColor = color.purple color strongBuyUnderColor = color.blue color buyUnderColor = color.green color neutralUnderColor = color.orange color sellUnderColor = color.red color strongSellOverColor = color.maroon // Get the ETHE ticker etheTicker = request.security(syminfo.tickerid, "", close) // Get the ETH ticker ethTicker = ticker.new("BITSTAMP", "ETHUSD", syminfo.session) // Get the close for the specified timeframe timeframeClose = request.security(ethTicker, "", close) // Get the factional size per share for ETHE etheFractionalShare = timeframeClose * ethPerShare // Get the % deflection from ETHE deflection = ((etheTicker - etheFractionalShare) / etheTicker) * 100 // Get a string representation of the deflection deflectionStr = str.tostring(math.round(deflection)) // Determine the line color color lineColor = if (deflection < discountUnderPercent) discountUnderColor else if ((discountUnderPercent <= deflection) and (deflection < strongBuyUnderPercent)) strongBuyUnderColor else if ((strongBuyUnderPercent <= deflection) and (deflection < buyUnderPercent)) buyUnderColor else if ((buyUnderPercent <= deflection) and (deflection < neutralUnderPercent)) neutralUnderColor else if ((neutralUnderPercent <= deflection) and (deflection < sellUnderPercent)) sellUnderColor else if (strongSellOverPercent <= deflection) strongSellOverColor // Paint a dotted line at 0 - Discount hline(discountUnderPercent, title="DISCOUNT!", color=color.red, linestyle=hline.style_dashed) // Paint a dotted line at the Buy hline(buyUnderPercent, title="Buy Under", color=color.gray, linestyle=hline.style_dashed) var discountText = "Discount" color discountColor = color.green var premiumText = "Premium" color premiumColor = color.red // Label the current premium var label myLabel = label.new(x=bar_index, y=high, textcolor=color.white, color=color.red) // On the last bar, show the chart's bar count if (barstate.islast) // Set the label text labelText = if (deflection < discountUnderPercent) discountText else premiumText // Set the label color labelColor = if (deflection < discountUnderPercent) discountColor else premiumColor // Set the label content label.set_text(id=myLabel, text=labelText + ": " + deflectionStr + "%") label.set_color(id=myLabel, color=labelColor) // Update the label's location label.set_x(id=myLabel, x=bar_index) label.set_y(id=myLabel, y=deflection) // Add a label at the buy level buyUnderPercent var label buyLabel = label.new(x=bar_index - 50, y=buyUnderPercent, textcolor=color.white, color=color.gray) label.set_text(id=buyLabel, text="BuyLine") label.set_style(id=buyLabel, style=label.style_label_up) // Add a label at the buy level buyUnderPercent var label discountLabel = label.new(x=bar_index - 100, y=discountUnderPercent, textcolor=color.white, color=color.purple) label.set_text(id=discountLabel, text="Discount") label.set_style(id=discountLabel, style=label.style_label_up) // Plot plot(deflection, color=lineColor)
conditional_returns
https://www.tradingview.com/script/rMIbDHJH-conditional-returns/
voided
https://www.tradingview.com/u/voided/
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/ // © voided //@version=5 indicator("conditional_returns", overlay = true) override = input.float(0, "override") / 100 start = input.time(timestamp("1 Jan 1950"), "start") end = input.time(timestamp("1 Jan 2300"), "end") in_clr = color.new(color.gray, 95) out_clr = color.new(color.white, 100) var x = array.new_float() var up = array.new_float() var dn = array.new_float() var up_all = array.new_float() var dn_all = array.new_float() ret = math.log(close / close[1]) in_range = time >= start and time < end bgcolor(in_range ? in_clr : out_clr) if in_range array.push(x, ret) if ret >= 0 array.push(up_all, ret) else array.push(dn_all, ret) if barstate.islast float selected = na if override == 0. selected := array.get(x, array.size(x) - 1) else selected := override for i = 0 to array.size(x) - 2 val = array.get(x, i) next = array.get(x, i + 1) if (val >= selected and selected > 0) or (val <= selected and selected < 0) if next >= 0 array.push(up, next) else array.push(dn, next) up_count = array.size(up) up_all_count = array.size(up_all) dn_count = array.size(dn) dn_all_count = array.size(dn_all) lbl_a = color.new(color.blue, 70) lbl_b = color.new(color.green, 70) lbl_c = color.new(color.yellow, 70) fmt = "#.##" t = table.new(position.top_right, 7, 3) table.cell(t, 0, 0, str.tostring(selected * 100, fmt), bgcolor = color.new(color.fuchsia, 70)) table.cell(t, 1, 0, "selected", bgcolor = lbl_a) table.cell(t, 2, 0, "%", bgcolor = lbl_a) table.cell(t, 3, 0, "avg", bgcolor = lbl_a) table.cell(t, 4, 0, "all", bgcolor = lbl_b) table.cell(t, 5, 0, "%", bgcolor = lbl_b) table.cell(t, 6, 0, "avg", bgcolor = lbl_b) table.cell(t, 0, 1, "up", bgcolor = lbl_c) table.cell(t, 1, 1, str.tostring(up_count), bgcolor = lbl_a) table.cell(t, 2, 1, str.tostring(up_count / (up_count + dn_count) * 100, fmt), bgcolor = lbl_a) table.cell(t, 3, 1, str.tostring(array.avg(up) * 100, fmt), bgcolor = lbl_a) table.cell(t, 4, 1, str.tostring(up_all_count), bgcolor = lbl_b) table.cell(t, 5, 1, str.tostring(up_all_count / (up_all_count + dn_all_count) * 100, fmt), bgcolor = lbl_b) table.cell(t, 6, 1, str.tostring(array.avg(up_all) * 100, fmt), bgcolor = lbl_b) table.cell(t, 0, 2, "down", bgcolor = lbl_c) table.cell(t, 1, 2, str.tostring(dn_count), bgcolor = lbl_a) table.cell(t, 2, 2, str.tostring(dn_count / (up_count + dn_count) * 100, fmt), bgcolor = lbl_a) table.cell(t, 3, 2, str.tostring(array.avg(dn) * 100, fmt), bgcolor = lbl_a) table.cell(t, 4, 2, str.tostring(dn_all_count), bgcolor = lbl_b) table.cell(t, 5, 2, str.tostring(dn_all_count / (up_all_count + dn_all_count) * 100, fmt), bgcolor = lbl_b) table.cell(t, 6, 2, str.tostring(array.avg(dn_all) * 100, fmt), bgcolor = lbl_b)
F&G_Index
https://www.tradingview.com/script/HRfPAD2m/
M_Ernest_
https://www.tradingview.com/u/M_Ernest_/
162
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(title="F&G_Index") // Warning: This version is updated daily or weekly in some cases. It is based on another version developed by cptpat plotValue = year == 2022 ? ( month == 1 ? ( dayofmonth == 29 ? 24 : dayofmonth == 28 ? 24 : dayofmonth == 27 ? 20 : dayofmonth == 26 ? 23 : dayofmonth == 25 ? 12 : dayofmonth == 24 ? 13 : dayofmonth == 23 ? 11 : dayofmonth == 22 ? 13 : dayofmonth == 21 ? 19 : dayofmonth == 20 ? 24 : dayofmonth == 19 ? 24 : dayofmonth == 18 ? 24 : dayofmonth == 17 ? 22 : dayofmonth == 16 ? 21 : dayofmonth == 15 ? 23 : dayofmonth == 14 ? 21 : dayofmonth == 13 ? 21 : dayofmonth == 12 ? 22 : dayofmonth == 11 ? 21 : dayofmonth == 10 ? 23 : dayofmonth == 9 ? 23 : dayofmonth == 8 ? 10 : dayofmonth == 7 ? 18 : dayofmonth == 6 ? 15 : dayofmonth == 5 ? 24 : dayofmonth == 4 ? 23 : dayofmonth == 3 ? 29 : dayofmonth == 2 ? 29 : dayofmonth == 1 ? 21 : na) : na) : year == 2021 ? ( month == 12 ? ( dayofmonth == 31 ? 28 : dayofmonth == 30 ? 22 : dayofmonth == 29 ? 27 : dayofmonth == 28 ? 41 : dayofmonth == 27 ? 40 : dayofmonth == 26 ? 37 : dayofmonth == 25 ? 39 : dayofmonth == 24 ? 41 : dayofmonth == 23 ? 34 : dayofmonth == 22 ? 45 : dayofmonth == 21 ? 27 : dayofmonth == 20 ? 25 : dayofmonth == 19 ? 29 : dayofmonth == 18 ? 24 : dayofmonth == 17 ? 23 : dayofmonth == 16 ? 29 : dayofmonth == 15 ? 28 : dayofmonth == 14 ? 21 : dayofmonth == 13 ? 28 : dayofmonth == 12 ? 27 : dayofmonth == 11 ? 16 : dayofmonth == 10 ? 24 : dayofmonth == 9 ? 29 : dayofmonth == 8 ? 28 : dayofmonth == 7 ? 25 : dayofmonth == 6 ? 16 : dayofmonth == 5 ? 18 : dayofmonth == 4 ? 25 : dayofmonth == 3 ? 31 : dayofmonth == 2 ? 32 : dayofmonth == 1 ? 34 : na) : month == 11 ? ( dayofmonth == 30 ? 40 : dayofmonth == 29 ? 33 : dayofmonth == 28 ? 27 : dayofmonth == 27 ? 21 : dayofmonth == 26 ? 47 : dayofmonth == 25 ? 32 : dayofmonth == 24 ? 42 : dayofmonth == 23 ? 33 : dayofmonth == 22 ? 50 : dayofmonth == 21 ? 49 : dayofmonth == 20 ? 43 : dayofmonth == 19 ? 34 : dayofmonth == 18 ? 54 : dayofmonth == 17 ? 52 : dayofmonth == 16 ? 71 : dayofmonth == 15 ? 72 : dayofmonth == 14 ? 74 : dayofmonth == 13 ? 72 : dayofmonth == 12 ? 74 : dayofmonth == 11 ? 77 : dayofmonth == 10 ? 75 : dayofmonth == 9 ? 84 : dayofmonth == 8 ? 75 : dayofmonth == 7 ? 73 : dayofmonth == 6 ? 71 : dayofmonth == 5 ? 73 : dayofmonth == 4 ? 73 : dayofmonth == 3 ? 76 : dayofmonth == 2 ? 73 : dayofmonth == 1 ? 74 : na) : month == 10 ? ( dayofmonth == 31 ? 74 : dayofmonth == 30 ? 73 : dayofmonth == 29 ? 70 : dayofmonth == 28 ? 66 : dayofmonth == 27 ? 73 : dayofmonth == 26 ? 76 : dayofmonth == 25 ? 72 : dayofmonth == 24 ? 73 : dayofmonth == 23 ? 74 : dayofmonth == 22 ? 75 : dayofmonth == 21 ? 84 : dayofmonth == 20 ? 82 : dayofmonth == 19 ? 75 : dayofmonth == 18 ? 78 : dayofmonth == 17 ? 79 : dayofmonth == 16 ? 78 : dayofmonth == 15 ? 71 : dayofmonth == 14 ? 70 : dayofmonth == 13 ? 70 : dayofmonth == 12 ? 78 : dayofmonth == 11 ? 71 : dayofmonth == 10 ? 71 : dayofmonth == 9 ? 72 : dayofmonth == 8 ? 74 : dayofmonth == 7 ? 76 : dayofmonth == 6 ? 68 : dayofmonth == 5 ? 59 : dayofmonth == 4 ? 54 : dayofmonth == 3 ? 49 : dayofmonth == 2 ? 54 : dayofmonth == 1 ? 27 : na) : month == 9 ? ( dayofmonth == 30 ? 20 : dayofmonth == 29 ? 24 : dayofmonth == 28 ? 25 : dayofmonth == 27 ? 26 : dayofmonth == 26 ? 27 : dayofmonth == 25 ? 28 : dayofmonth == 24 ? 33 : dayofmonth == 23 ? 27 : dayofmonth == 22 ? 21 : dayofmonth == 21 ? 27 : dayofmonth == 20 ? 50 : dayofmonth == 19 ? 53 : dayofmonth == 18 ? 50 : dayofmonth == 17 ? 48 : dayofmonth == 16 ? 53 : dayofmonth == 15 ? 49 : dayofmonth == 14 ? 30 : dayofmonth == 13 ? 44 : dayofmonth == 12 ? 32 : dayofmonth == 11 ? 31 : dayofmonth == 10 ? 46 : dayofmonth == 9 ? 45 : dayofmonth == 8 ? 47 : dayofmonth == 7 ? 79 : dayofmonth == 6 ? 79 : dayofmonth == 5 ? 73 : dayofmonth == 4 ? 72 : dayofmonth == 3 ? 74 : dayofmonth == 2 ? 74 : dayofmonth == 1 ? 71 : na) : month == 8 ? ( dayofmonth == 31 ? 73 : dayofmonth == 30 ? 73 : dayofmonth == 29 ? 72 : dayofmonth == 28 ? 78 : dayofmonth == 27 ? 71 : dayofmonth == 26 ? 75 : dayofmonth == 25 ? 73 : dayofmonth == 24 ? 79 : dayofmonth == 23 ? 79 : dayofmonth == 22 ? 76 : dayofmonth == 21 ? 78 : dayofmonth == 20 ? 70 : dayofmonth == 19 ? 70 : dayofmonth == 18 ? 73 : dayofmonth == 17 ? 72 : dayofmonth == 16 ? 72 : dayofmonth == 15 ? 71 : dayofmonth == 14 ? 76 : dayofmonth == 13 ? 70 : dayofmonth == 12 ? 70 : dayofmonth == 11 ? 70 : dayofmonth == 10 ? 71 : dayofmonth == 9 ? 65 : dayofmonth == 8 ? 74 : dayofmonth == 7 ? 69 : dayofmonth == 6 ? 52 : dayofmonth == 5 ? 50 : dayofmonth == 4 ? 42 : dayofmonth == 3 ? 48 : dayofmonth == 2 ? 48 : dayofmonth == 1 ? 60 : na) : month == 7 ? ( dayofmonth == 31 ? 60 : dayofmonth == 30 ? 53 : dayofmonth == 29 ? 50 : dayofmonth == 28 ? 50 : dayofmonth == 27 ? 32 : dayofmonth == 26 ? 26 : dayofmonth == 25 ? 27 : dayofmonth == 24 ? 22 : dayofmonth == 23 ? 23 : dayofmonth == 22 ? 21 : dayofmonth == 21 ? 10 : dayofmonth == 20 ? 19 : dayofmonth == 19 ? 24 : dayofmonth == 18 ? 19 : dayofmonth == 17 ? 15 : dayofmonth == 16 ? 22 : dayofmonth == 15 ? 20 : dayofmonth == 14 ? 21 : dayofmonth == 13 ? 20 : dayofmonth == 12 ? 25 : dayofmonth == 11 ? 20 : dayofmonth == 10 ? 20 : dayofmonth == 9 ? 20 : dayofmonth == 8 ? 20 : dayofmonth == 7 ? 28 : dayofmonth == 6 ? 20 : dayofmonth == 5 ? 29 : dayofmonth == 4 ? 27 : dayofmonth == 3 ? 24 : dayofmonth == 2 ? 21 : dayofmonth == 1 ? 28 : na) : month == 6 ? ( dayofmonth == 30 ? 28 : dayofmonth == 29 ? 25 : dayofmonth == 28 ? 25 : dayofmonth == 27 ? 22 : dayofmonth == 26 ? 20 : dayofmonth == 25 ? 27 : dayofmonth == 24 ? 22 : dayofmonth == 23 ? 14 : dayofmonth == 22 ? 10 : dayofmonth == 21 ? 23 : dayofmonth == 20 ? 21 : dayofmonth == 19 ? 23 : dayofmonth == 18 ? 25 : dayofmonth == 17 ? 26 : dayofmonth == 16 ? 33 : dayofmonth == 15 ? 38 : dayofmonth == 14 ? 28 : dayofmonth == 13 ? 23 : dayofmonth == 12 ? 28 : dayofmonth == 11 ? 21 : dayofmonth == 10 ? 21 : dayofmonth == 9 ? 14 : dayofmonth == 8 ? 13 : dayofmonth == 7 ? 15 : dayofmonth == 6 ? 17 : dayofmonth == 5 ? 24 : dayofmonth == 4 ? 27 : dayofmonth == 3 ? 24 : dayofmonth == 2 ? 23 : dayofmonth == 1 ? 20 : na) : month == 5 ? ( dayofmonth == 31 ? 18 : dayofmonth == 30 ? 10 : dayofmonth == 29 ? 18 : dayofmonth == 28 ? 21 : dayofmonth == 27 ? 27 : dayofmonth == 26 ? 22 : dayofmonth == 25 ? 22 : dayofmonth == 24 ? 10 : dayofmonth == 23 ? 14 : dayofmonth == 22 ? 12 : dayofmonth == 21 ? 19 : dayofmonth == 20 ? 11 : dayofmonth == 19 ? 23 : dayofmonth == 18 ? 21 : dayofmonth == 17 ? 27 : dayofmonth == 16 ? 20 : dayofmonth == 15 ? 27 : dayofmonth == 14 ? 26 : dayofmonth == 13 ? 31 : dayofmonth == 12 ? 68 : dayofmonth == 11 ? 61 : dayofmonth == 10 ? 72 : dayofmonth == 9 ? 73 : dayofmonth == 8 ? 67 : dayofmonth == 7 ? 64 : dayofmonth == 6 ? 65 : dayofmonth == 5 ? 48 : dayofmonth == 4 ? 68 : dayofmonth == 3 ? 61 : dayofmonth == 2 ? 66 : dayofmonth == 1 ? 68 : na) : month == 4 ? ( dayofmonth == 30 ? 51 : dayofmonth == 29 ? 52 : dayofmonth == 28 ? 59 : dayofmonth == 27 ? 50 : dayofmonth == 26 ? 27 : dayofmonth == 25 ? 31 : dayofmonth == 24 ? 37 : dayofmonth == 23 ? 55 : dayofmonth == 22 ? 65 : dayofmonth == 21 ? 73 : dayofmonth == 20 ? 73 : dayofmonth == 19 ? 74 : dayofmonth == 18 ? 79 : dayofmonth == 17 ? 76 : dayofmonth == 16 ? 78 : dayofmonth == 15 ? 79 : dayofmonth == 14 ? 75 : dayofmonth == 13 ? 74 : dayofmonth == 12 ? 74 : dayofmonth == 11 ? 76 : dayofmonth == 10 ? 70 : dayofmonth == 9 ? 70 : dayofmonth == 8 ? 73 : dayofmonth == 7 ? 72 : dayofmonth == 6 ? 75 : dayofmonth == 5 ? 71 : dayofmonth == 4 ? 74 : dayofmonth == 3 ? 73 : dayofmonth == 2 ? 74 : dayofmonth == 1 ? 74 : na) : month == 3 ? ( dayofmonth == 31 ? 76 : dayofmonth == 30 ? 72 : dayofmonth == 29 ? 72 : dayofmonth == 28 ? 74 : dayofmonth == 27 ? 65 : dayofmonth == 26 ? 54 : dayofmonth == 25 ? 60 : dayofmonth == 24 ? 65 : dayofmonth == 23 ? 66 : dayofmonth == 22 ? 70 : dayofmonth == 21 ? 73 : dayofmonth == 20 ? 75 : dayofmonth == 19 ? 71 : dayofmonth == 18 ? 72 : dayofmonth == 17 ? 71 : dayofmonth == 16 ? 71 : dayofmonth == 15 ? 76 : dayofmonth == 14 ? 78 : dayofmonth == 13 ? 74 : dayofmonth == 12 ? 70 : dayofmonth == 11 ? 73 : dayofmonth == 10 ? 68 : dayofmonth == 9 ? 81 : dayofmonth == 8 ? 81 : dayofmonth == 7 ? 76 : dayofmonth == 6 ? 77 : dayofmonth == 5 ? 77 : dayofmonth == 4 ? 84 : dayofmonth == 3 ? 78 : dayofmonth == 2 ? 78 : dayofmonth == 1 ? 38 : na) : month == 2 ? ( dayofmonth == 28 ? 55 : dayofmonth == 27 ? 56 : dayofmonth == 26 ? 55 : dayofmonth == 25 ? 79 : dayofmonth == 24 ? 76 : dayofmonth == 23 ? 94 : dayofmonth == 22 ? 94 : dayofmonth == 21 ? 91 : dayofmonth == 20 ? 91 : dayofmonth == 19 ? 93 : dayofmonth == 18 ? 91 : dayofmonth == 17 ? 95 : dayofmonth == 16 ? 95 : dayofmonth == 15 ? 93 : dayofmonth == 14 ? 95 : dayofmonth == 13 ? 92 : dayofmonth == 12 ? 92 : dayofmonth == 11 ? 93 : dayofmonth == 10 ? 92 : dayofmonth == 9 ? 95 : dayofmonth == 8 ? 83 : dayofmonth == 7 ? 86 : dayofmonth == 6 ? 84 : dayofmonth == 5 ? 81 : dayofmonth == 4 ? 80 : dayofmonth == 3 ? 78 : dayofmonth == 2 ? 76 : dayofmonth == 1 ? 77 : na) : month == 1 ? ( dayofmonth == 31 ? 78 : dayofmonth == 30 ? 76 : dayofmonth == 29 ? 77 : dayofmonth == 28 ? 55 : dayofmonth == 27 ? 78 : dayofmonth == 26 ? 71 : dayofmonth == 25 ? 74 : dayofmonth == 24 ? 70 : dayofmonth == 23 ? 74 : dayofmonth == 22 ? 40 : dayofmonth == 21 ? 75 : dayofmonth == 20 ? 78 : dayofmonth == 19 ? 80 : dayofmonth == 18 ? 79 : dayofmonth == 17 ? 79 : dayofmonth == 16 ? 84 : dayofmonth == 15 ? 88 : dayofmonth == 14 ? 83 : dayofmonth == 13 ? 78 : dayofmonth == 12 ? 84 : dayofmonth == 11 ? 90 : dayofmonth == 10 ? 94 : dayofmonth == 9 ? 93 : dayofmonth == 8 ? 93 : dayofmonth == 7 ? 91 : dayofmonth == 6 ? 95 : dayofmonth == 5 ? 93 : dayofmonth == 4 ? 94 : dayofmonth == 3 ? 93 : dayofmonth == 2 ? 94 : dayofmonth == 1 ? 94 : na) : na) : year == 2020 ? ( month == 12 ? ( dayofmonth == 31 ? 95 : dayofmonth == 30 ? 91 : dayofmonth == 29 ? 91 : dayofmonth == 28 ? 92 : dayofmonth == 27 ? 91 : dayofmonth == 26 ? 93 : dayofmonth == 25 ? 94 : dayofmonth == 24 ? 86 : dayofmonth == 23 ? 93 : dayofmonth == 22 ? 88 : dayofmonth == 21 ? 92 : dayofmonth == 20 ? 92 : dayofmonth == 19 ? 93 : dayofmonth == 18 ? 95 : dayofmonth == 17 ? 92 : dayofmonth == 16 ? 92 : dayofmonth == 15 ? 91 : dayofmonth == 14 ? 95 : dayofmonth == 13 ? 91 : dayofmonth == 12 ? 90 : dayofmonth == 11 ? 89 : dayofmonth == 10 ? 94 : dayofmonth == 9 ? 86 : dayofmonth == 8 ? 95 : dayofmonth == 7 ? 94 : dayofmonth == 6 ? 95 : dayofmonth == 5 ? 93 : dayofmonth == 4 ? 92 : dayofmonth == 3 ? 92 : dayofmonth == 2 ? 92 : dayofmonth == 1 ? 95 : na) : month == 11 ? ( dayofmonth == 30 ? 88 : dayofmonth == 29 ? 89 : dayofmonth == 28 ? 87 : dayofmonth == 27 ? 86 : dayofmonth == 26 ? 93 : dayofmonth == 25 ? 94 : dayofmonth == 24 ? 88 : dayofmonth == 23 ? 90 : dayofmonth == 22 ? 94 : dayofmonth == 21 ? 91 : dayofmonth == 20 ? 86 : dayofmonth == 19 ? 94 : dayofmonth == 18 ? 91 : dayofmonth == 17 ? 86 : dayofmonth == 16 ? 90 : dayofmonth == 15 ? 86 : dayofmonth == 14 ? 90 : dayofmonth == 13 ? 89 : dayofmonth == 12 ? 87 : dayofmonth == 11 ? 86 : dayofmonth == 10 ? 90 : dayofmonth == 9 ? 90 : dayofmonth == 8 ? 82 : dayofmonth == 7 ? 88 : dayofmonth == 6 ? 90 : dayofmonth == 5 ? 72 : dayofmonth == 4 ? 74 : dayofmonth == 3 ? 71 : dayofmonth == 2 ? 71 : dayofmonth == 1 ? 72 : na) : month == 10 ? ( dayofmonth == 31 ? 73 : dayofmonth == 30 ? 74 : dayofmonth == 29 ? 67 : dayofmonth == 28 ? 70 : dayofmonth == 27 ? 61 : dayofmonth == 26 ? 75 : dayofmonth == 25 ? 76 : dayofmonth == 24 ? 73 : dayofmonth == 23 ? 74 : dayofmonth == 22 ? 73 : dayofmonth == 21 ? 61 : dayofmonth == 20 ? 56 : dayofmonth == 19 ? 55 : dayofmonth == 18 ? 55 : dayofmonth == 17 ? 56 : dayofmonth == 16 ? 52 : dayofmonth == 15 ? 56 : dayofmonth == 14 ? 53 : dayofmonth == 13 ? 56 : dayofmonth == 12 ? 52 : dayofmonth == 11 ? 55 : dayofmonth == 10 ? 53 : dayofmonth == 9 ? 48 : dayofmonth == 8 ? 46 : dayofmonth == 7 ? 43 : dayofmonth == 6 ? 47 : dayofmonth == 5 ? 42 : dayofmonth == 4 ? 42 : dayofmonth == 3 ? 40 : dayofmonth == 2 ? 41 : dayofmonth == 1 ? 45 : na) : month == 9 ? ( dayofmonth == 30 ? 49 : dayofmonth == 29 ? 45 : dayofmonth == 28 ? 43 : dayofmonth == 27 ? 47 : dayofmonth == 26 ? 45 : dayofmonth == 25 ? 46 : dayofmonth == 24 ? 39 : dayofmonth == 23 ? 43 : dayofmonth == 22 ? 39 : dayofmonth == 21 ? 48 : dayofmonth == 20 ? 52 : dayofmonth == 19 ? 48 : dayofmonth == 18 ? 49 : dayofmonth == 17 ? 48 : dayofmonth == 16 ? 43 : dayofmonth == 15 ? 47 : dayofmonth == 14 ? 39 : dayofmonth == 13 ? 38 : dayofmonth == 12 ? 41 : dayofmonth == 11 ? 41 : dayofmonth == 10 ? 38 : dayofmonth == 9 ? 38 : dayofmonth == 8 ? 41 : dayofmonth == 7 ? 41 : dayofmonth == 6 ? 41 : dayofmonth == 5 ? 41 : dayofmonth == 4 ? 40 : dayofmonth == 3 ? 79 : dayofmonth == 2 ? 83 : dayofmonth == 1 ? 75 : na) : month == 8 ? ( dayofmonth == 31 ? 75 : dayofmonth == 30 ? 75 : dayofmonth == 29 ? 79 : dayofmonth == 28 ? 74 : dayofmonth == 27 ? 75 : dayofmonth == 26 ? 76 : dayofmonth == 25 ? 75 : dayofmonth == 24 ? 78 : dayofmonth == 23 ? 76 : dayofmonth == 22 ? 78 : dayofmonth == 21 ? 81 : dayofmonth == 20 ? 75 : dayofmonth == 19 ? 80 : dayofmonth == 18 ? 82 : dayofmonth == 17 ? 83 : dayofmonth == 16 ? 82 : dayofmonth == 15 ? 79 : dayofmonth == 14 ? 78 : dayofmonth == 13 ? 75 : dayofmonth == 12 ? 75 : dayofmonth == 11 ? 84 : dayofmonth == 10 ? 78 : dayofmonth == 9 ? 79 : dayofmonth == 8 ? 77 : dayofmonth == 7 ? 77 : dayofmonth == 6 ? 79 : dayofmonth == 5 ? 75 : dayofmonth == 4 ? 72 : dayofmonth == 3 ? 75 : dayofmonth == 2 ? 80 : dayofmonth == 1 ? 75 : na) : month == 7 ? ( dayofmonth == 31 ? 75 : dayofmonth == 30 ? 76 : dayofmonth == 29 ? 71 : dayofmonth == 28 ? 76 : dayofmonth == 27 ? 58 : dayofmonth == 26 ? 55 : dayofmonth == 25 ? 55 : dayofmonth == 24 ? 53 : dayofmonth == 23 ? 55 : dayofmonth == 22 ? 50 : dayofmonth == 21 ? 44 : dayofmonth == 20 ? 44 : dayofmonth == 19 ? 41 : dayofmonth == 18 ? 44 : dayofmonth == 17 ? 41 : dayofmonth == 16 ? 43 : dayofmonth == 15 ? 44 : dayofmonth == 14 ? 43 : dayofmonth == 13 ? 43 : dayofmonth == 12 ? 41 : dayofmonth == 11 ? 44 : dayofmonth == 10 ? 41 : dayofmonth == 9 ? 44 : dayofmonth == 8 ? 44 : dayofmonth == 7 ? 43 : dayofmonth == 6 ? 40 : dayofmonth == 5 ? 38 : dayofmonth == 4 ? 40 : dayofmonth == 3 ? 41 : dayofmonth == 2 ? 42 : dayofmonth == 1 ? 42 : na) : month == 6 ? ( dayofmonth == 30 ? 44 : dayofmonth == 29 ? 41 : dayofmonth == 28 ? 40 : dayofmonth == 27 ? 43 : dayofmonth == 26 ? 40 : dayofmonth == 25 ? 43 : dayofmonth == 24 ? 50 : dayofmonth == 23 ? 41 : dayofmonth == 22 ? 38 : dayofmonth == 21 ? 37 : dayofmonth == 20 ? 38 : dayofmonth == 19 ? 39 : dayofmonth == 18 ? 40 : dayofmonth == 17 ? 38 : dayofmonth == 16 ? 39 : dayofmonth == 15 ? 37 : dayofmonth == 14 ? 40 : dayofmonth == 13 ? 38 : dayofmonth == 12 ? 38 : dayofmonth == 11 ? 52 : dayofmonth == 10 ? 54 : dayofmonth == 9 ? 52 : dayofmonth == 8 ? 53 : dayofmonth == 7 ? 54 : dayofmonth == 6 ? 54 : dayofmonth == 5 ? 53 : dayofmonth == 4 ? 54 : dayofmonth == 3 ? 48 : dayofmonth == 2 ? 56 : dayofmonth == 1 ? 50 : na) : month == 5 ? ( dayofmonth == 31 ? 51 : dayofmonth == 30 ? 48 : dayofmonth == 29 ? 48 : dayofmonth == 28 ? 41 : dayofmonth == 27 ? 39 : dayofmonth == 26 ? 39 : dayofmonth == 25 ? 41 : dayofmonth == 24 ? 43 : dayofmonth == 23 ? 40 : dayofmonth == 22 ? 42 : dayofmonth == 21 ? 49 : dayofmonth == 20 ? 52 : dayofmonth == 19 ? 50 : dayofmonth == 18 ? 50 : dayofmonth == 17 ? 40 : dayofmonth == 16 ? 41 : dayofmonth == 15 ? 44 : dayofmonth == 14 ? 40 : dayofmonth == 13 ? 41 : dayofmonth == 12 ? 39 : dayofmonth == 11 ? 40 : dayofmonth == 10 ? 48 : dayofmonth == 9 ? 56 : dayofmonth == 8 ? 55 : dayofmonth == 7 ? 49 : dayofmonth == 6 ? 42 : dayofmonth == 5 ? 40 : dayofmonth == 4 ? 44 : dayofmonth == 3 ? 45 : dayofmonth == 2 ? 40 : dayofmonth == 1 ? 40 : na) : month == 4 ? ( dayofmonth == 30 ? 44 : dayofmonth == 29 ? 26 : dayofmonth == 28 ? 26 : dayofmonth == 27 ? 28 : dayofmonth == 26 ? 21 : dayofmonth == 25 ? 24 : dayofmonth == 24 ? 20 : dayofmonth == 23 ? 19 : dayofmonth == 22 ? 19 : dayofmonth == 21 ? 17 : dayofmonth == 20 ? 15 : dayofmonth == 19 ? 16 : dayofmonth == 18 ? 18 : dayofmonth == 17 ? 15 : dayofmonth == 16 ? 13 : dayofmonth == 15 ? 18 : dayofmonth == 14 ? 15 : dayofmonth == 13 ? 11 : dayofmonth == 12 ? 10 : dayofmonth == 11 ? 15 : dayofmonth == 10 ? 15 : dayofmonth == 9 ? 22 : dayofmonth == 8 ? 21 : dayofmonth == 7 ? 20 : dayofmonth == 6 ? 12 : dayofmonth == 5 ? 12 : dayofmonth == 4 ? 12 : dayofmonth == 3 ? 14 : dayofmonth == 2 ? 14 : dayofmonth == 1 ? 12 : na) : month == 3 ? ( dayofmonth == 31 ? 12 : dayofmonth == 30 ? 10 : dayofmonth == 29 ? 12 : dayofmonth == 28 ? 8 : dayofmonth == 27 ? 12 : dayofmonth == 26 ? 14 : dayofmonth == 25 ? 13 : dayofmonth == 24 ? 12 : dayofmonth == 23 ? 10 : dayofmonth == 22 ? 11 : dayofmonth == 21 ? 9 : dayofmonth == 20 ? 9 : dayofmonth == 19 ? 12 : dayofmonth == 18 ? 11 : dayofmonth == 17 ? 8 : dayofmonth == 16 ? 9 : dayofmonth == 15 ? 12 : dayofmonth == 14 ? 8 : dayofmonth == 13 ? 10 : dayofmonth == 12 ? 14 : dayofmonth == 11 ? 17 : dayofmonth == 10 ? 16 : dayofmonth == 9 ? 17 : dayofmonth == 8 ? 33 : dayofmonth == 7 ? 38 : dayofmonth == 6 ? 39 : dayofmonth == 5 ? 41 : dayofmonth == 4 ? 40 : dayofmonth == 3 ? 38 : dayofmonth == 2 ? 38 : dayofmonth == 1 ? 39 : na) : month == 2 ? ( dayofmonth == 29 ? 38 : dayofmonth == 28 ? 40 : dayofmonth == 27 ? 39 : dayofmonth == 26 ? 41 : dayofmonth == 25 ? 44 : dayofmonth == 24 ? 46 : dayofmonth == 23 ? 46 : dayofmonth == 22 ? 43 : dayofmonth == 21 ? 44 : dayofmonth == 20 ? 44 : dayofmonth == 19 ? 50 : dayofmonth == 18 ? 53 : dayofmonth == 17 ? 49 : dayofmonth == 16 ? 59 : dayofmonth == 15 ? 64 : dayofmonth == 14 ? 63 : dayofmonth == 13 ? 65 : dayofmonth == 12 ? 61 : dayofmonth == 11 ? 52 : dayofmonth == 10 ? 57 : dayofmonth == 9 ? 56 : dayofmonth == 8 ? 56 : dayofmonth == 7 ? 56 : dayofmonth == 6 ? 61 : dayofmonth == 5 ? 53 : dayofmonth == 4 ? 56 : dayofmonth == 3 ? 59 : dayofmonth == 2 ? 57 : dayofmonth == 1 ? 57 : na) : month == 1 ? ( dayofmonth == 31 ? 55 : dayofmonth == 30 ? 57 : dayofmonth == 29 ? 57 : dayofmonth == 28 ? 54 : dayofmonth == 27 ? 50 : dayofmonth == 26 ? 42 : dayofmonth == 25 ? 41 : dayofmonth == 24 ? 40 : dayofmonth == 23 ? 49 : dayofmonth == 22 ? 52 : dayofmonth == 21 ? 49 : dayofmonth == 20 ? 48 : dayofmonth == 19 ? 53 : dayofmonth == 18 ? 51 : dayofmonth == 17 ? 54 : dayofmonth == 16 ? 55 : dayofmonth == 15 ? 54 : dayofmonth == 14 ? 56 : dayofmonth == 13 ? 49 : dayofmonth == 12 ? 45 : dayofmonth == 11 ? 50 : dayofmonth == 10 ? 41 : dayofmonth == 9 ? 44 : dayofmonth == 8 ? 51 : dayofmonth == 7 ? 40 : dayofmonth == 6 ? 41 : dayofmonth == 5 ? 39 : dayofmonth == 4 ? 38 : dayofmonth == 3 ? 38 : dayofmonth == 2 ? 39 : dayofmonth == 1 ? 37 : na) : na) : year == 2019 ? ( month == 12 ? ( dayofmonth == 31 ? 38 : dayofmonth == 30 ? 40 : dayofmonth == 29 ? 37 : dayofmonth == 28 ? 37 : dayofmonth == 27 ? 38 : dayofmonth == 26 ? 39 : dayofmonth == 25 ? 22 : dayofmonth == 24 ? 25 : dayofmonth == 23 ? 33 : dayofmonth == 22 ? 20 : dayofmonth == 21 ? 23 : dayofmonth == 20 ? 23 : dayofmonth == 19 ? 21 : dayofmonth == 18 ? 15 : dayofmonth == 17 ? 23 : dayofmonth == 16 ? 24 : dayofmonth == 15 ? 21 : dayofmonth == 14 ? 27 : dayofmonth == 13 ? 22 : dayofmonth == 12 ? 23 : dayofmonth == 11 ? 20 : dayofmonth == 10 ? 26 : dayofmonth == 9 ? 32 : dayofmonth == 8 ? 28 : dayofmonth == 7 ? 32 : dayofmonth == 6 ? 29 : dayofmonth == 5 ? 21 : dayofmonth == 4 ? 24 : dayofmonth == 3 ? 28 : dayofmonth == 2 ? 28 : dayofmonth == 1 ? 25 : na) : month == 11 ? ( dayofmonth == 30 ? 38 : dayofmonth == 29 ? 31 : dayofmonth == 28 ? 32 : dayofmonth == 27 ? 20 : dayofmonth == 26 ? 21 : dayofmonth == 25 ? 17 : dayofmonth == 24 ? 21 : dayofmonth == 23 ? 23 : dayofmonth == 22 ? 20 : dayofmonth == 21 ? 30 : dayofmonth == 20 ? 32 : dayofmonth == 19 ? 32 : dayofmonth == 18 ? 38 : dayofmonth == 17 ? 38 : dayofmonth == 16 ? 41 : dayofmonth == 15 ? 38 : dayofmonth == 14 ? 41 : dayofmonth == 13 ? 38 : dayofmonth == 12 ? 39 : dayofmonth == 11 ? 40 : dayofmonth == 10 ? 39 : dayofmonth == 9 ? 38 : dayofmonth == 8 ? 42 : dayofmonth == 7 ? 54 : dayofmonth == 6 ? 53 : dayofmonth == 5 ? 54 : dayofmonth == 4 ? 49 : dayofmonth == 3 ? 56 : dayofmonth == 2 ? 51 : dayofmonth == 1 ? 49 : na) : month == 10 ? ( dayofmonth == 31 ? 50 : dayofmonth == 30 ? 53 : dayofmonth == 29 ? 54 : dayofmonth == 28 ? 52 : dayofmonth == 27 ? 50 : dayofmonth == 26 ? 53 : dayofmonth == 25 ? 24 : dayofmonth == 24 ? 20 : dayofmonth == 23 ? 33 : dayofmonth == 22 ? 39 : dayofmonth == 21 ? 37 : dayofmonth == 20 ? 37 : dayofmonth == 19 ? 41 : dayofmonth == 18 ? 40 : dayofmonth == 17 ? 40 : dayofmonth == 16 ? 40 : dayofmonth == 15 ? 39 : dayofmonth == 14 ? 37 : dayofmonth == 13 ? 38 : dayofmonth == 12 ? 38 : dayofmonth == 11 ? 39 : dayofmonth == 10 ? 41 : dayofmonth == 9 ? 37 : dayofmonth == 8 ? 39 : dayofmonth == 7 ? 27 : dayofmonth == 6 ? 32 : dayofmonth == 5 ? 31 : dayofmonth == 4 ? 30 : dayofmonth == 3 ? 37 : dayofmonth == 2 ? 39 : dayofmonth == 1 ? 38 : na) : month == 9 ? ( dayofmonth == 30 ? 27 : dayofmonth == 29 ? 33 : dayofmonth == 28 ? 32 : dayofmonth == 27 ? 24 : dayofmonth == 26 ? 12 : dayofmonth == 25 ? 15 : dayofmonth == 24 ? 39 : dayofmonth == 23 ? 41 : dayofmonth == 22 ? 37 : dayofmonth == 21 ? 37 : dayofmonth == 20 ? 41 : dayofmonth == 19 ? 31 : dayofmonth == 18 ? 38 : dayofmonth == 17 ? 41 : dayofmonth == 16 ? 38 : dayofmonth == 15 ? 38 : dayofmonth == 14 ? 39 : dayofmonth == 13 ? 38 : dayofmonth == 12 ? 39 : dayofmonth == 11 ? 38 : dayofmonth == 10 ? 41 : dayofmonth == 9 ? 41 : dayofmonth == 8 ? 43 : dayofmonth == 7 ? 39 : dayofmonth == 6 ? 43 : dayofmonth == 5 ? 41 : dayofmonth == 4 ? 43 : dayofmonth == 3 ? 41 : dayofmonth == 2 ? 28 : dayofmonth == 1 ? 24 : na) : month == 8 ? ( dayofmonth == 31 ? 20 : dayofmonth == 30 ? 24 : dayofmonth == 29 ? 20 : dayofmonth == 28 ? 32 : dayofmonth == 27 ? 30 : dayofmonth == 26 ? 41 : dayofmonth == 25 ? 33 : dayofmonth == 24 ? 39 : dayofmonth == 23 ? 33 : dayofmonth == 22 ? 5 : dayofmonth == 21 ? 11 : dayofmonth == 20 ? 39 : dayofmonth == 19 ? 30 : dayofmonth == 18 ? 14 : dayofmonth == 17 ? 20 : dayofmonth == 16 ? 31 : dayofmonth == 15 ? 13 : dayofmonth == 14 ? 11 : dayofmonth == 13 ? 45 : dayofmonth == 12 ? 48 : dayofmonth == 11 ? 45 : dayofmonth == 10 ? 59 : dayofmonth == 9 ? 60 : dayofmonth == 8 ? 61 : dayofmonth == 7 ? 45 : dayofmonth == 6 ? 66 : dayofmonth == 5 ? 64 : dayofmonth == 4 ? 62 : dayofmonth == 3 ? 61 : dayofmonth == 2 ? 61 : dayofmonth == 1 ? 57 : na) : month == 7 ? ( dayofmonth == 31 ? 31 : dayofmonth == 30 ? 22 : dayofmonth == 29 ? 19 : dayofmonth == 28 ? 16 : dayofmonth == 27 ? 47 : dayofmonth == 26 ? 24 : dayofmonth == 25 ? 42 : dayofmonth == 24 ? 20 : dayofmonth == 23 ? 40 : dayofmonth == 22 ? 42 : dayofmonth == 21 ? 42 : dayofmonth == 20 ? 34 : dayofmonth == 19 ? 42 : dayofmonth == 18 ? 40 : dayofmonth == 17 ? 19 : dayofmonth == 16 ? 34 : dayofmonth == 15 ? 16 : dayofmonth == 14 ? 61 : dayofmonth == 13 ? 65 : dayofmonth == 12 ? 33 : dayofmonth == 11 ? 62 : dayofmonth == 10 ? 83 : dayofmonth == 9 ? 84 : dayofmonth == 8 ? 74 : dayofmonth == 7 ? 67 : dayofmonth == 6 ? 72 : dayofmonth == 5 ? 67 : dayofmonth == 4 ? 76 : dayofmonth == 3 ? 79 : dayofmonth == 2 ? 63 : dayofmonth == 1 ? 65 : na) : month == 6 ? ( dayofmonth == 30 ? 78 : dayofmonth == 29 ? 74 : dayofmonth == 28 ? 62 : dayofmonth == 27 ? 92 : dayofmonth == 26 ? 95 : dayofmonth == 25 ? 87 : dayofmonth == 24 ? 80 : dayofmonth == 23 ? 84 : dayofmonth == 22 ? 83 : dayofmonth == 21 ? 84 : dayofmonth == 20 ? 81 : dayofmonth == 19 ? 82 : dayofmonth == 18 ? 83 : dayofmonth == 17 ? 84 : dayofmonth == 16 ? 80 : dayofmonth == 15 ? 75 : dayofmonth == 14 ? 67 : dayofmonth == 13 ? 63 : dayofmonth == 12 ? 60 : dayofmonth == 11 ? 61 : dayofmonth == 10 ? 46 : dayofmonth == 9 ? 62 : dayofmonth == 8 ? 62 : dayofmonth == 7 ? 27 : dayofmonth == 6 ? 34 : dayofmonth == 5 ? 27 : dayofmonth == 4 ? 42 : dayofmonth == 3 ? 66 : dayofmonth == 2 ? 63 : dayofmonth == 1 ? 62 : na) : month == 5 ? ( dayofmonth == 31 ? 61 : dayofmonth == 30 ? 73 : dayofmonth == 29 ? 71 : dayofmonth == 28 ? 71 : dayofmonth == 27 ? 70 : dayofmonth == 26 ? 67 : dayofmonth == 25 ? 69 : dayofmonth == 24 ? 64 : dayofmonth == 23 ? 65 : dayofmonth == 22 ? 69 : dayofmonth == 21 ? 68 : dayofmonth == 20 ? 73 : dayofmonth == 19 ? 70 : dayofmonth == 18 ? 67 : dayofmonth == 17 ? 65 : dayofmonth == 16 ? 75 : dayofmonth == 15 ? 77 : dayofmonth == 14 ? 78 : dayofmonth == 13 ? 78 : dayofmonth == 12 ? 75 : dayofmonth == 11 ? 76 : dayofmonth == 10 ? 71 : dayofmonth == 9 ? 69 : dayofmonth == 8 ? 63 : dayofmonth == 7 ? 69 : dayofmonth == 6 ? 57 : dayofmonth == 5 ? 67 : dayofmonth == 4 ? 66 : dayofmonth == 3 ? 63 : dayofmonth == 2 ? 50 : dayofmonth == 1 ? 51 : na) : month == 4 ? ( dayofmonth == 30 ? 42 : dayofmonth == 29 ? 42 : dayofmonth == 28 ? 40 : dayofmonth == 27 ? 42 : dayofmonth == 26 ? 41 : dayofmonth == 25 ? 58 : dayofmonth == 24 ? 65 : dayofmonth == 23 ? 68 : dayofmonth == 22 ? 61 : dayofmonth == 21 ? 62 : dayofmonth == 20 ? 62 : dayofmonth == 19 ? 61 : dayofmonth == 18 ? 64 : dayofmonth == 17 ? 61 : dayofmonth == 16 ? 50 : dayofmonth == 15 ? 60 : dayofmonth == 14 ? 51 : dayofmonth == 13 ? 62 : dayofmonth == 12 ? 42 : dayofmonth == 11 ? 65 : dayofmonth == 10 ? 62 : dayofmonth == 9 ? 64 : dayofmonth == 8 ? 65 : dayofmonth == 7 ? 69 : dayofmonth == 6 ? 65 : dayofmonth == 5 ? 59 : dayofmonth == 4 ? 61 : dayofmonth == 3 ? 71 : dayofmonth == 2 ? 60 : dayofmonth == 1 ? 62 : na) : month == 3 ? ( dayofmonth == 31 ? 56 : dayofmonth == 30 ? 57 : dayofmonth == 29 ? 50 : dayofmonth == 28 ? 49 : dayofmonth == 27 ? 44 : dayofmonth == 26 ? 43 : dayofmonth == 25 ? 46 : dayofmonth == 24 ? 44 : dayofmonth == 23 ? 50 : dayofmonth == 22 ? 56 : dayofmonth == 21 ? 62 : dayofmonth == 20 ? 55 : dayofmonth == 19 ? 56 : dayofmonth == 18 ? 56 : dayofmonth == 17 ? 58 : dayofmonth == 16 ? 54 : dayofmonth == 15 ? 55 : dayofmonth == 14 ? 55 : dayofmonth == 13 ? 54 : dayofmonth == 12 ? 56 : dayofmonth == 11 ? 56 : dayofmonth == 10 ? 55 : dayofmonth == 9 ? 55 : dayofmonth == 8 ? 54 : dayofmonth == 7 ? 56 : dayofmonth == 6 ? 42 : dayofmonth == 5 ? 35 : dayofmonth == 4 ? 36 : dayofmonth == 3 ? 44 : dayofmonth == 2 ? 41 : dayofmonth == 1 ? 42 : na) : month == 2 ? ( dayofmonth == 28 ? 39 : dayofmonth == 27 ? 39 : dayofmonth == 26 ? 40 : dayofmonth == 25 ? 47 : dayofmonth == 24 ? 69 : dayofmonth == 23 ? 63 : dayofmonth == 22 ? 61 : dayofmonth == 21 ? 59 : dayofmonth == 20 ? 59 : dayofmonth == 19 ? 65 : dayofmonth == 18 ? 63 : dayofmonth == 17 ? 38 : dayofmonth == 16 ? 43 : dayofmonth == 15 ? 43 : dayofmonth == 14 ? 48 : dayofmonth == 13 ? 48 : dayofmonth == 12 ? 38 : dayofmonth == 11 ? 46 : dayofmonth == 10 ? 40 : dayofmonth == 9 ? 42 : dayofmonth == 8 ? 37 : dayofmonth == 7 ? 18 : dayofmonth == 6 ? 14 : dayofmonth == 5 ? 21 : dayofmonth == 4 ? 27 : dayofmonth == 3 ? 19 : dayofmonth == 2 ? 22 : dayofmonth == 1 ? 23 : na) : month == 1 ? ( dayofmonth == 31 ? 17 : dayofmonth == 30 ? 22 : dayofmonth == 29 ? 21 : dayofmonth == 28 ? 35 : dayofmonth == 27 ? 39 : dayofmonth == 26 ? 41 : dayofmonth == 25 ? 35 : dayofmonth == 24 ? 37 : dayofmonth == 23 ? 33 : dayofmonth == 22 ? 27 : dayofmonth == 21 ? 30 : dayofmonth == 20 ? 35 : dayofmonth == 19 ? 31 : dayofmonth == 18 ? 29 : dayofmonth == 17 ? 28 : dayofmonth == 16 ? 24 : dayofmonth == 15 ? 27 : dayofmonth == 14 ? 16 : dayofmonth == 13 ? 21 : dayofmonth == 12 ? 22 : dayofmonth == 11 ? 19 : dayofmonth == 10 ? 37 : dayofmonth == 9 ? 42 : dayofmonth == 8 ? 39 : dayofmonth == 7 ? 39 : dayofmonth == 6 ? 31 : dayofmonth == 5 ? 36 : dayofmonth == 4 ? 48 : dayofmonth == 3 ? 33 : dayofmonth == 2 ? 30 : dayofmonth == 1 ? 24 : na) : na) : na // Greed Fear Line Plot plot(series=plotValue, title="F&G_Index", linewidth=1, style=plot.style_linebr, color=color.blue) //Greed-Fear Horizontal Lines plot(81, title="Very Extreme Geed", color=color.maroon, linewidth=1, style=plot.style_cross, transp=40) plot(69, title="Extreme Greed", color=color.red, linewidth=1, style=plot.style_cross, transp=40) plot(24, title="Extreme Fear", color=color.green, linewidth=1, style=plot.style_cross, transp=40) plot(12, title="Very Extreme Fear", color=color.lime, linewidth=1, style=plot.style_cross, transp=40) // Breaches HighlightBreaches = input(true, title="Highlight Oversold/Overbought?", type=input.bool) upper = 69 lower = 24 extremeupper = 81 extremelower = 12 top = hline(upper, color=color.new(color.gray, 100), linewidth=1, editable=false) bottom = hline(lower, color=color.new(color.gray, 100), linewidth=1, editable=false) color_1 = color.new(color.red, 70) color_2 = color.new(color.green, 60) b_color = plotValue > upper ? color_1 : plotValue < lower ? color_2 : na color_3 = color.new(color.maroon, 70) color_4 = color.new(color.lime, 60) b_color2 = plotValue > extremeupper ? color_3 : plotValue < extremelower ? color_4 : na bgcolor(HighlightBreaches ? b_color : na) bgcolor(HighlightBreaches ? b_color2 : na) fill(top, bottom, color=color.gray, transp=80)
Linear Regression
https://www.tradingview.com/script/69jBNyb5-Linear-Regression/
Electrified
https://www.tradingview.com/u/Electrified/
58
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Electrified (electrifiedtrading) & shr395 // @version=5 // @description Produces deviation lines based upon a linear regression with the option to clean the data of outliers. indicator("Linear Regression", shorttitle="LR", overlay=true) import Electrified/DataCleaner/6 as Data var sess_minutes = syminfo.session == session.regular ? 390 : 1440 minutesPerBar = timeframe.isminutes ? timeframe.multiplier : timeframe.isseconds ? timeframe.multiplier / 60 : na BARS = 'Bars', MINUTES = 'Mins', DAYS = 'Days', LENGTH = "Length" minutesToLen(simple int len, simple string type) => switch type BARS => len MINUTES => len / minutesPerBar DAYS => timeframe.isintraday ? (sess_minutes * len / minutesPerBar) : timeframe.isdaily ? len : timeframe.isweekly ? len / 7 : timeframe.ismonthly ? len / 30 : na => na src = input.source(hlc3, "Source") len = minutesToLen( input.int(251, LENGTH, inline=LENGTH, minval=1), input.string(BARS, "", inline=LENGTH, options=[BARS, MINUTES, DAYS])) multiple = input.float(1.0, "Multiplier", minval=0, step=0.1, tooltip="Value to apply as a multipler to the standard deviation.") NEITHER = "Neither", RIGHT = "Right", LEFT = "Left", BOTH = "Both" extendLines = input.string(NEITHER, "Extend Lines", options=[NEITHER, RIGHT, LEFT, BOTH]) extend = switch extendLines NEITHER => extend.none RIGHT => extend.right LEFT => extend.left BOTH => extend.both level2 = input.bool(false, "Draw Level 2", tooltip="When true, shows another set of lines an additional standard deviation out from the level one lines.") maxDeviation = input.float(4, "Max Deviation", group="Data Cleaning", minval=0, step=0.5, tooltip="The maximum deviation before a value is considered an outlier and removed from the dataset.") ////////////////////////////////////////////////// calcForData(float[] data) => sumX = 0.0 sumY = 0.0 sumXSqr = 0.0 sumXY = 0.0 sumMsqr = 0.0 size = array.size(data) for i = 1 to size val = array.get(data, i - 1) sumX += i sumY += val sumXSqr += i * i sumXY += val * i slope = (size * sumXY - sumX * sumY) / (size * sumXSqr - sumX * sumX) average = sumY / size intercept = average - slope * sumX / size + slope // Get true deviation values. devArray = array.new_float(size) last = size - 1 for n = 0 to last array.set(devArray, n, array.get(data, n) - intercept + slope * n) [slope, average, intercept, intercept + slope * last, devArray] ////////////////////////////////////////////////// ////////////////////////////////////////////////// calc() => var data = array.new_float() array.push(data, src) size = array.size(data) if size > len array.shift(data) [slope, average, intercept, endValue, devArray] = calcForData(data) stddev = if Data.naArrayOutliers(devArray, maxDeviation) // SEDOND PASS // Data needs to be cleaned. Use new na values in devArray to clean the orignal data. n = array.new_float() for i = 0 to len - 1 if not na(array.get(devArray, i)) array.push(n, array.get(data, i)) [s, a, i, e, d] = calcForData(n) slope := s average := a intercept := i endValue := e array.stdev(d) else // Data was unchanged by cleaning process. No outilers present. array.stdev(devArray) [intercept, endValue, stddev * multiple] else [float(na), float(na), float(na)] ////////////////////////////////////////////////// [startPrice, endPrice, sd] = calc() drawLine(float priceOffset=0, style=line.style_solid, color=color.silver, transp=50) => var line L = na var c = color.new(color, transp) if na(startPrice) L else if na(L) L := line.new(time[len-1], startPrice+priceOffset, time, endPrice+priceOffset, width=1, extend=extend, color=c, style=style, xloc=xloc.bar_time) else if not na(startPrice) line.set_xy1(L, time[len-1], startPrice+priceOffset) line.set_xy2(L, time, endPrice+priceOffset) L drawLines(float priceOffset=0, style=line.style_solid, color=color.silver, transp=50) => drawLine(+priceOffset, style, color, transp) drawLine(-priceOffset, style, color, transp) drawLine(0) sdHalf = sd / 2 drawLines(sdHalf, line.style_dashed, transp=85) drawLines(sd, line.style_dashed) if level2 drawLines(3 * sdHalf, line.style_dashed, color.orange, 85) drawLines(2 * sd, line.style_dashed, color.orange)
Box Trading (Malaysia Stock Market)
https://www.tradingview.com/script/4UFYrOJ2-Box-Trading-Malaysia-Stock-Market/
taufan_ganas
https://www.tradingview.com/u/taufan_ganas/
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/ // © taufan_ganas //@version=5 indicator('Box Trading', overlay=true) //T+ Candles Title grp_1 = 'T0 - T3 Candle Settings' //Input Variables T0Height = input.int(title='Bids Suggestions: Below RM 1 (6 bids) / RM 1 to RM 10 (8 to 12 bids) / Above RM 100 (50 bids)', minval=1, maxval=100, defval=6, group = grp_1) //Bids y = close < 1 ? 0.005 : close >= 1 and close < 10 ? 2 * 0.005 : close >= 10 and close < 100 ? 4 * 0.005 : 0.10 change = close - open bids = change / y //Scanner Algorithms T0candle = bids >= T0Height T4candle = bids[4] >= T0Height and close >= low[4] //T+ Candle barcolor(color = close < 1 and bids >= T0Height? color.lime : close >= 1 and close < 10 and bids >= T0Height? color.aqua :close >= 10 and close < 100 and bids >= T0Height ? color.blue : na, title='T0 Candle', show_last=input(title='Last Candles Done - T0 Candle', defval=5, group = grp_1)) //Condition T+ Resistance Line resistT0 = T0candle ? high : na if(resistT0) resistT0_line = line.new(bar_index, high, bar_index[1], high, color = #f517a5, style=line.style_dashed, extend = extend.left, width=1) line.delete(resistT0_line[1]) //Condition T0 Support Line supportT0 = T0candle ? low : na if(supportT0) supportT0_line = line.new(bar_index, low, bar_index[1], low, color = #f517a5, style=line.style_dashed, extend = extend.left, width=1) line.delete(supportT0_line[1]) //T+ Count var barCount1 = 0 barCount1 := T0candle? 0 : barCount1 + 1 //Plot T+ Count T = label.new(time + 1440, high, '◄ T+' + str.tostring(barCount1), style = label.style_label_left, color = barCount1 <= 3? #FFFFFF00 : na, textcolor = barCount1 <= 3? #E040FB : na, size = size.small, xloc = xloc.bar_time, tooltip = 'Days before Force Selling on T+3 at 1230H') label.delete(T[1]) //Breakout Resistance bullBO = ta.valuewhen(resistT0,high,0) plotshape(ta.crossover(close,bullBO), size = size.tiny, style = shape.triangleup, location = location.belowbar, title='Breakout T0 Candle (Resistance)', show_last=input(title='Last Candles Done - Breakout T0 Candle (Resistance)', defval=5, group = grp_1)) //Breakout Support bearBO = ta.valuewhen(supportT0,low,0) plotshape(ta.crossover(bearBO,close), size = size.tiny, style = shape.triangledown, location = location.abovebar, color = color.red, title='Breakout T0 Candle (Support)', show_last=input(title='Last Candles Done - Breakout T0 Candle (Support)', defval=5, group = grp_1))
AZ Column Color
https://www.tradingview.com/script/dur7pJeU-AZ-Column-Color/
Settaphat_Assarakulsith
https://www.tradingview.com/u/Settaphat_Assarakulsith/
26
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/ // © Settaphat_Assarakulsith //@version=4 study("AZ Column Color") fast_ema = input(title = "Input Fast EMA",type = input.integer,defval = 12) slow_ema = input(title = "Input Slow EMA",type = input.integer,defval = 26) bull = false bear = false fast = ema(close,fast_ema) slow = ema(close,slow_ema) if fast > slow bull := true if slow > fast bear := true plot(bull ? 1:0,color=color.green,title="Bull",style=plot.style_columns) plot(bear ? 1:0,color=color.red,title="Bear",style=plot.style_columns)
Linear Regression, Volume Weighted
https://www.tradingview.com/script/zdSbSlb0-Linear-Regression-Volume-Weighted/
Electrified
https://www.tradingview.com/u/Electrified/
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/ // © Electrified (electrifiedtrading) & shr395 // @version=5 // @description Produces deviation lines based upon linear regression of volume adjusted price with the option to clean the data of outliers. indicator("Linear Regression, Volume Weighted", shorttitle="VWLR", overlay=true) import Electrified/DataCleaner/6 as Data var sess_minutes = syminfo.session == session.regular ? 390 : 1440 minutesPerBar = timeframe.isminutes ? timeframe.multiplier : timeframe.isseconds ? timeframe.multiplier / 60 : na BARS = 'Bars', MINUTES = 'Mins', DAYS = 'Days', LENGTH = "Length" minutesToLen(simple int len, simple string type) => switch type BARS => len MINUTES => len / minutesPerBar DAYS => timeframe.isintraday ? (sess_minutes * len / minutesPerBar) : timeframe.isdaily ? len : timeframe.isweekly ? len / 7 : timeframe.ismonthly ? len / 30 : na => na src = input.source(hlc3, "Source") len = minutesToLen( input.int(251, LENGTH, inline=LENGTH, minval=1), input.string(BARS, "", inline=LENGTH, options=[BARS, MINUTES, DAYS], tooltip="The length specifies the how far back to measure the regression.\nLines have a length limit so the lines may not extend all the way back. Use the 'extend' setting to extend further to the left.")) recency = input.float(0.0, "Recency Bias", minval=0.0, step=0.01, tooltip="The higher the number the more weight is given to recent values. Similar to the difference between SMA and WMA.\n\nNote: it may not take much to have an effect.") multiple = input.float(1.0, "Multiplier", minval=0, step=0.1, tooltip="Value to apply as a multipler to the standard deviation.") NEITHER = "Neither", RIGHT = "Right", LEFT = "Left", BOTH = "Both" extendLines = input.string(NEITHER, "Extend Lines", options=[NEITHER, RIGHT, LEFT, BOTH]) extend = switch extendLines NEITHER => extend.none RIGHT => extend.right LEFT => extend.left BOTH => extend.both level2 = input.bool(false, "Draw Level 2", tooltip="When true, shows another set of lines an additional standard deviation out from the level one lines.") maxDeviation = input.float(4, "Max Deviation", group="Data Cleaning", minval=0, step=0.5, tooltip="The maximum deviation before a value is considered an outlier and removed from the dataset.") ////////////////////////////////////////////////// calcForData(float[] data, float[] weights) => sumX = 0.0 sumY = 0.0 sumXSqr = 0.0 sumXY = 0.0 sumMsqr = 0.0 total = 0.0 size = array.size(data) last = size - 1 for i = 0 to last val = array.get(data, i) weight = array.get(weights, i) * (1 + recency * i) total += weight x = (i + 1) * weight y = val * weight sumX += x sumY += y sumXSqr += x * x / weight sumXY += x * y / weight slope = (total * sumXY - sumX * sumY) / (total * sumXSqr - sumX * sumX) average = sumY / total intercept = average - slope * sumX / total // Get true deviation values. devArray = array.new_float(size) for n = 0 to last array.set(devArray, n, array.get(data, n) - intercept + slope * n) [slope, average, intercept, intercept + slope * last, devArray] ////////////////////////////////////////////////// ////////////////////////////////////////////////// calc() => var data = array.new_float() var weights = array.new_float() array.push(data, src) array.push(weights, volume) size = array.size(data) if size > len array.shift(data) array.shift(weights) [slope, average, intercept, endValue, devArray] = calcForData(data, weights) stddev = if Data.naArrayOutliers(devArray, maxDeviation) // SEDOND PASS // Data needs to be cleaned. Use new na values in devArray to clean the orignal data. n = array.new_float() w = array.new_float() for i = 0 to len - 1 if not na(array.get(devArray, i)) array.push(n, array.get(data, i)) array.push(w, array.get(weights, i)) [s, a, i, e, d] = calcForData(n, w) slope := s average := a intercept := i endValue := e array.stdev(d) else // Data was unchanged by cleaning process. No outilers present. array.stdev(devArray) [intercept, endValue, stddev * multiple] else [float(na), float(na), float(na)] ////////////////////////////////////////////////// [startPrice, endPrice, sd] = calc() // NOTE lines have length limits. lineBarLimit = 1200 first = if len > lineBarLimit d = endPrice - startPrice s = d / len startPrice += s * (len - lineBarLimit) lineBarLimit else len - 1 drawLine(float priceOffset=0, style=line.style_solid, color=color.silver, transp=50) => var line L = na var c = color.new(color, transp) if na(startPrice) L else if na(L) L := line.new(time[first], startPrice+priceOffset, time, endPrice+priceOffset, width=1, extend=extend, color=c, style=style, xloc=xloc.bar_time) else if not na(startPrice) line.set_xy1(L, time[first], startPrice+priceOffset) line.set_xy2(L, time, endPrice+priceOffset) L drawLines(float priceOffset=0, style=line.style_solid, color=color.silver, transp=50) => drawLine(+priceOffset, style, color, transp) drawLine(-priceOffset, style, color, transp) drawLine(0) sdHalf = sd / 2 drawLines(sdHalf, line.style_dashed, transp=85) drawLines(sd, line.style_dashed) if level2 drawLines(3 * sdHalf, line.style_dashed, color.orange, 85) drawLines(2 * sd, line.style_dashed, color.orange)
Position Sizing Calculator
https://www.tradingview.com/script/eMTM3noE-Position-Sizing-Calculator/
Settaphat_Assarakulsith
https://www.tradingview.com/u/Settaphat_Assarakulsith/
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/ // © Settaphat_Assarakulsith //@version=4 study(title = "Position Sizing Calculator" , shorttitle = "Position Calc" , overlay = true ) //Input Capital = input(title = "Capital (USD)", type=input.integer , defval = 10000 , minval = 0 ,maxval = 10000000) Risk = input(title = "Risk (%)", type=input.integer , defval = 2 , minval = 0.1 ,maxval = 100 , options=[0.25,0.5,0.75,1.0,1.25,1.5,1.75,2.0]) //Calculation risk_money = (Capital * Risk)/100 lowest_low = lowest(close,12) last_close = close[0] Buy_amount = round(risk_money/(last_close - lowest_low),5) //plot label_text = "You should Buy " + tostring(Buy_amount) + " Coins" our_label = label.new(bar_index,y=na,text = label_text,yloc=yloc.belowbar,color=color.green,textcolor=color.white,style=label.style_label_up) label.delete(our_label[1]) plot(lowest_low,title = "Most significant low" , color=color.blue , style = plot.style_line,show_last = 1 )
[JL] Stoch Candle
https://www.tradingview.com/script/qgPosJE6-JL-Stoch-Candle/
Jesse.Lau
https://www.tradingview.com/u/Jesse.Lau/
92
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © jesselau76 //This script display stoch crossover/crossunder as candles. //K>D then display Green bars, //K<D then display Red bars. //It can not be traded directly. You can use these candles to watch the strong/weak trend or reverse. //I normally use higher timeframe to watch it. I am trading 15 min, so I will watch 1 hour/4 hour/Daily chart. //Combine with my other script Stochastic Divergence Alert https://www.tradingview.com/script/lJiDn2VR-JL-Stochastic-Divergence-Alert/ looks better //@version=5 indicator(title="[JL] Stoch Candle", overlay=true,max_boxes_count=500,max_bars_back = 4900) // Getting inputs periodK = input.int(9, title="%K Length", minval=1) smoothK = input.int(3, title="%K Smoothing", minval=1) periodD = input.int(3, title="%D Smoothing", minval=1) // Calculating k = ta.sma(ta.stoch(close, high, low, periodK), smoothK) d = ta.sma(k, periodD) turnGreen = ta.crossover(k,d) turnRed = ta.crossunder(k,d) barsturngreen = bar_index - ta.valuewhen(turnGreen, bar_index, 0) barsturnred = bar_index - ta.valuewhen(turnRed, bar_index, 0) barsg = barsturngreen>0 ? barsturngreen : 1 h1 = ta.highest(high,barsg) l1 = ta.lowest(low,barsg) barsr = barsturnred>0 ? barsturnred : 1 h2 = ta.highest(high,barsr) l2 = ta.lowest(low,barsr) if turnRed box.new(bar_index - barsg, h1, bar_index, l1, border_color = na, bgcolor = color.new(color.green, 50),border_width=2) if turnGreen box.new(bar_index - barsr, h2, bar_index, l2, border_color = na, bgcolor = color.new(color.red, 50),border_width=2)
Anchored BTC
https://www.tradingview.com/script/nvmG7QYM-Anchored-BTC/
Dicargo_Beam
https://www.tradingview.com/u/Dicargo_Beam/
73
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/ // © Dicargo_Beam //@version=5 indicator("Anchored BTC",overlay=true) xxx = input.bool(false,"' Times must be selected in Correlation Coefficient > 0.8 '") xxxa = input.bool(false,"' it means you should select times that alt and btc is well coupled.'") xxxx = input.bool(false,"' Time 1 and Time 2 must be Swing High or Swing Low '") t1 = input.time(timestamp("07 Jul 2021 00:00 +1200"),"Time 1") t2 = input.time(timestamp("21 Jul 2021 00:00 +1200"),"Time 2") var x1 = 0.0 var x2 = 0.0 var y1 = 0.0 var y2 = 0.0 btc_close = request.security(input.symbol("BINANCE:BTCUSDT"),"",close) if t1 == time x1 := math.log10(close) x2 := math.log10(btc_close) if t2 == time y1 := math.log10(close) y2 := math.log10(btc_close) f = math.abs((x1-y1)/(x2-y2)) f2 = if time>=t2 1 anchored_btc = 0.0 anchored_btc := if time==t2 close else math.pow(10,math.log10(anchored_btc[1]) + ta.change(math.log10(btc_close)) * f * f2) // plot(anchored_btc) col = if t1 <= time and t2 >= time color.new(color.yellow,90) bgcolor(color=col)
Supertrend 3 en 1
https://www.tradingview.com/script/p4o9afmx/
jereparedes
https://www.tradingview.com/u/jereparedes/
40
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("Supertrend 3 en 1", overlay = true, format=format.price, precision=2, resolution="") Periods1 = input(title="ATR Period 1", type=input.integer, defval=10) src1 = input(hl2, title="Source 1") Multiplier1 = input(title="ATR Multiplier 1", type=input.float, step=0.1, defval=1.0) Periods2 = input(title="ATR Period 2", type=input.integer, defval=11) src2 = input(hl2, title="Source 2") Multiplier2 = input(title="ATR Multiplier 2", type=input.float, step=0.1, defval=2.0) Periods3 = input(title="ATR Period 3", type=input.integer, defval=12) src3 = input(hl2, title="Source 3") Multiplier3 = input(title="ATR Multiplier 3", type=input.float, step=0.1, defval=3.0) changeATR= input(title="Change ATR Calculation Method ?", type=input.bool, defval=true) showsignals = input(title="Show Buy/Sell Signals ?", type=input.bool, defval=true) highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true) atr2 = sma(tr, Periods1) atr= changeATR ? atr(Periods1) : atr2 up=src1-(Multiplier1*atr) up1 = nz(up[1],up) up := close[1] > up1 ? max(up,up1) : up dn=src1+(Multiplier1*atr) dn1 = nz(dn[1], dn) dn := close[1] < dn1 ? min(dn, dn1) : dn trend = 1 trend := nz(trend[1], trend) trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend upPlot = plot(trend == 1 ? up : na, title="Up Trend 1", style=plot.style_linebr, linewidth=2, color=color.green) buySignal = trend == 1 and trend[1] == -1 plotshape(buySignal ? up : na, title="UpTrend Begins 1", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0) plotshape(buySignal and showsignals ? up : na, title="Buy 1", text="Buy 1", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0) dnPlot = plot(trend == 1 ? na : dn, title="Down Trend 1", style=plot.style_linebr, linewidth=2, color=color.red) sellSignal = trend == -1 and trend[1] == 1 plotshape(sellSignal ? dn : na, title="DownTrend Begins 1", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0) plotshape(sellSignal and showsignals ? dn : na, title="Sell 1", text="Sell 1", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0) mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0) longFillColor = highlighting ? (trend == 1 ? color.green : color.white) : color.white shortFillColor = highlighting ? (trend == -1 ? color.red : color.white) : color.white fill(mPlot, upPlot, title="UpTrend Highligter 1", color=longFillColor) fill(mPlot, dnPlot, title="DownTrend Highligter 1", color=shortFillColor) alertcondition(buySignal, title="SuperTrend Buy", message="SuperTrend Buy!") alertcondition(sellSignal, title="SuperTrend Sell", message="SuperTrend Sell!") changeCond = trend != trend[1] alertcondition(changeCond, title="SuperTrend Direction Change", message="SuperTrend has changed direction!") atr2_2 = sma(tr, Periods2) atr_2= changeATR ? atr(Periods2) : atr2_2 up_2=src2-(Multiplier2*atr_2) up1_2 = nz(up_2[1],up_2) up_2 := close[1] > up1_2 ? max(up_2,up1_2) : up_2 dn_2=src2+(Multiplier2*atr_2) dn1_2 = nz(dn_2[1], dn_2) dn_2 := close[1] < dn1_2 ? min(dn_2, dn1_2) : dn_2 trend_2 = 1 trend_2 := nz(trend_2[1], trend_2) trend_2 := trend_2 == -1 and close > dn1_2 ? 1 : trend_2 == 1 and close < up1_2 ? -1 : trend_2 upPlot_2 = plot(trend_2 == 1 ? up_2 : na, title="Up Trend 2", style=plot.style_linebr, linewidth=2, color=color.green) buySignal_2 = trend_2 == 1 and trend_2[1] == -1 plotshape(buySignal_2 ? up_2 : na, title="UpTrend Begins 2", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0) plotshape(buySignal_2 and showsignals ? up_2 : na, title="Buy 2", text="Buy 2", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0) dnPlot_2 = plot(trend_2 == 1 ? na : dn_2, title="Down Trend 2", style=plot.style_linebr, linewidth=2, color=color.red) sellSignal_2 = trend_2 == -1 and trend_2[1] == 1 plotshape(sellSignal_2 ? dn_2 : na, title="DownTrend Begins 2", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0) plotshape(sellSignal_2 and showsignals ? dn_2 : na, title="Sell 2", text="Sell 2", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0) mPlot_2 = plot(ohlc4, title="", style=plot.style_circles, linewidth=0) longFillColor_2 = highlighting ? (trend_2 == 1 ? color.green : color.white) : color.white shortFillColor_2 = highlighting ? (trend_2 == -1 ? color.red : color.white) : color.white fill(mPlot_2, upPlot_2, title="UpTrend Highligter 2", color=longFillColor_2) fill(mPlot_2, dnPlot_2, title="DownTrend Highligter 2", color=shortFillColor_2) alertcondition(buySignal_2, title="SuperTrend Buy", message="SuperTrend Buy!") alertcondition(sellSignal_2, title="SuperTrend Sell", message="SuperTrend Sell!") changeCond_2 = trend_2 != trend_2[1] alertcondition(changeCond_2, title="SuperTrend Direction Change", message="SuperTrend has changed direction!") atr2_3 = sma(tr, Periods3) atr_3= changeATR ? atr(Periods3) : atr2_3 up_3=src3-(Multiplier3*atr_3) up1_3 = nz(up_3[1],up_3) up_3 := close[1] > up1_3 ? max(up_3,up1_3) : up_3 dn_3=src3+(Multiplier3*atr_3) dn1_3 = nz(dn_3[1], dn_3) dn_3 := close[1] < dn1_3 ? min(dn_3, dn1_3) : dn_3 trend_3 = 1 trend_3 := nz(trend_3[1], trend_3) trend_3 := trend_3 == -1 and close > dn1_3 ? 1 : trend_3 == 1 and close < up1_3 ? -1 : trend_3 upPlot_3 = plot(trend_3 == 1 ? up_3 : na, title="Up Trend 3", style=plot.style_linebr, linewidth=2, color=color.green) buySignal_3 = trend_3 == 1 and trend_3[1] == -1 plotshape(buySignal_3 ? up_3 : na, title="UpTrend Begins 3", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0) plotshape(buySignal_3 and showsignals ? up_3 : na, title="Buy 3", text="Buy 3", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0) dnPlot_3 = plot(trend_3 == 1 ? na : dn_3, title="Down Trend 3", style=plot.style_linebr, linewidth=2, color=color.red) sellSignal_3 = trend_3 == -1 and trend_3[1] == 1 plotshape(sellSignal_3 ? dn_3 : na, title="DownTrend Begins 3", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0) plotshape(sellSignal_3 and showsignals ? dn_3 : na, title="Sell 3", text="Sell 3", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0) mPlot_3 = plot(ohlc4, title="", style=plot.style_circles, linewidth=0) longFillColor_3 = highlighting ? (trend_3 == 1 ? color.green : color.white) : color.white shortFillColor_3 = highlighting ? (trend_3 == -1 ? color.red : color.white) : color.white fill(mPlot_3, upPlot_3, title="UpTrend Highligter 3", color=longFillColor_3) fill(mPlot_3, dnPlot_3, title="DownTrend Highligter 3", color=shortFillColor_3) alertcondition(buySignal_3, title="SuperTrend Buy", message="SuperTrend Buy!") alertcondition(sellSignal_3, title="SuperTrend Sell", message="SuperTrend Sell!") changeCond_3 = trend_3 != trend_3[1] alertcondition(changeCond_3, title="SuperTrend Direction Change", message="SuperTrend has changed direction!")
Daily Weekly Monthly Yearly Opens
https://www.tradingview.com/script/Itfe3JfL-Daily-Weekly-Monthly-Yearly-Opens/
meliksah55
https://www.tradingview.com/u/meliksah55/
424
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/ // © meliksah55 // 2021-12-14 //@version=5 indicator('Daily Weekly Monthly Yearly Opens', shorttitle='DWMY O', overlay=true) //---------------------------- Constants ------------------------------ var DEFAULT_LINE_WIDTH = 1 var DEFAULT_TAIL_STYLE = line.style_dotted var DEFAULT_LABEL_SIZE = size.small var DEFAULT_LABEL_STYLE = label.style_none //------------------------------ Inputs ------------------------------- var i_isDailyEnabled = input.bool(defval=true, title='Daily', group='Current Opens', inline='Daily') var i_dailyColor = input.color(defval=color.green, title='', group='Current Opens', inline='Daily') var i_isWeeklyEnabled = input.bool(defval=true, title='Weekly', group='Current Opens', inline='Weekly') var i_weeklyColor = input.color(defval=color.orange, title='', group='Current Opens', inline='Weekly') var i_isMonthlyEnabled = input.bool(defval=true, title='Monthly', group='Current Opens', inline='Monthly') var i_monthlyColor = input.color(defval=color.red, title='', group='Current Opens', inline='Monthly') var i_isYearlyEnabled = input.bool(defval=true, title='Yearly', group='Current Opens', inline='Yearly') var i_yearlyColor = input.color(defval=color.blue, title='', group='Current Opens', inline='Yearly') var i_isPDailyEnabled = input.bool(defval=true, title='Daily', group='Previous Opens', inline='Daily') var i_pdailyColor = input.color(defval=color.green, title='', group='Previous Opens', inline='Daily') var i_isPWeeklyEnabled = input.bool(defval=true, title='Weekly', group='Previous Opens', inline='Weekly') var i_pweeklyColor = input.color(defval=color.orange, title='', group='Previous Opens', inline='Weekly') var i_isPMonthlyEnabled = input.bool(defval=true, title='Monthly', group='Previous Opens', inline='Monthly') var i_pmonthlyColor = input.color(defval=color.red, title='', group='Previous Opens', inline='Monthly') var i_isPYearlyEnabled = input.bool(defval=true, title='Yearly', group='Previous Opens', inline='Yearly') var i_pyearlyColor = input.color(defval=color.blue, title='', group='Previous Opens', inline='Yearly') var i_isMondayHighEnabled = input.bool(defval=true, title='Monday High', group='Current High/Low', inline='Monday High') var i_mondayHighColor = input.color(defval=color.lime, title='', group='Current High/Low', inline='Monday High') var i_isMondayLowEnabled = input.bool(defval=true, title='MondayLow', group='Current High/Low', inline='Monday Low') var i_mondayLowColor = input.color(defval=color.lime, title='', group='Current High/Low', inline='Monday Low') var i_isDailyHEnabled = input.bool(defval=true, title='Daily High', group='Current High/Low', inline='Daily High') var i_dailyHColor = input.color(defval=color.green, title='', group='Current High/Low', inline='Daily High') var i_isDailyLEnabled = input.bool(defval=true, title='Daily Low', group='Current High/Low', inline='Daily Low') var i_dailyLColor = input.color(defval=color.green, title='', group='Current High/Low', inline='Daily Low') var i_isWeeklyHEnabled = input.bool(defval=true, title='Weekly High', group='Current High/Low', inline='Weekly High') var i_weeklyHColor = input.color(defval=color.orange, title='', group='Current High/Low', inline='Weekly High') var i_isWeeklyLEnabled = input.bool(defval=true, title='Weekly Low', group='Current High/Low', inline='Weekly Low') var i_weeklyLColor = input.color(defval=color.orange, title='', group='Current High/Low', inline='Weekly Low') var i_isMonthlyHEnabled = input.bool(defval=true, title='Monthly High', group='Current High/Low', inline='Monthly High') var i_monthlyHColor = input.color(defval=color.red, title='', group='Current High/Low', inline='Monthly High') var i_isMonthlyLEnabled = input.bool(defval=true, title='Monthly Low', group='Current High/Low', inline='Monthly Low') var i_monthlyLColor = input.color(defval=color.red, title='', group='Current High/Low', inline='Monthly Low') var i_isYearlyHEnabled = input.bool(defval=false, title='Yearly High', group='Current High/Low', inline='Yearly High') var i_yearlyHColor = input.color(defval=color.orange, title='', group='Current High/Low', inline='Yearly High') var i_isYearlyLEnabled = input.bool(defval=false, title='Yearly Low', group='Current High/Low', inline='Yearly Low') var i_yearlyLColor = input.color(defval=color.orange, title='', group='Current High/Low', inline='Yearly Low') var i_isPDailyHEnabled = input.bool(defval=false, title='Daily High', group='Previous High/Low', inline='Daily High') var i_pdailyHColor = input.color(defval=color.green, title='', group='Previous High/Low', inline='Daily High') var i_isPDailyLEnabled = input.bool(defval=false, title='Daily Low', group='Previous High/Low', inline='Daily Low') var i_pdailyLColor = input.color(defval=color.green, title='', group='Previous High/Low', inline='Daily Low') var i_isPWeeklyHEnabled = input.bool(defval=false, title='Weekly High', group='Previous High/Low', inline='Weekly High') var i_pweeklyHColor = input.color(defval=color.orange, title='', group='Previous High/Low', inline='Weekly High') var i_isPWeeklyLEnabled = input.bool(defval=false, title='Weekly Low', group='Previous High/Low', inline='Weekly Low') var i_pweeklyLColor = input.color(defval=color.orange, title='', group='Previous High/Low', inline='Weekly Low') var i_isPMonthlyHEnabled = input.bool(defval=false, title='Monthly High', group='Previous High/Low', inline='Monthly High') var i_pmonthlyHColor = input.color(defval=color.red, title='', group='Previous High/Low', inline='Monthly High') var i_isPMonthlyLEnabled = input.bool(defval=false, title='Monthly Low', group='Previous High/Low', inline='Monthly Low') var i_pmonthlyLColor = input.color(defval=color.red, title='', group='Previous High/Low', inline='Monthly Low') var i_isPYearlyHEnabled = input.bool(defval=false, title='Yearly High', group='Previous High/Low', inline='Yearly High') var i_pyearlyHColor = input.color(defval=color.orange, title='', group='Previous High/Low', inline='Yearly High') var i_isPYearlyLEnabled = input.bool(defval=false, title='Yearly Low', group='Previous High/Low', inline='Yearly Low') var i_pyearlyLColor = input.color(defval=color.orange, title='', group='Previous High/Low', inline='Yearly Low') var i_isTailsEnabled = input.bool(defval=true, title='Show Tails', group='Settings') var i_projectionOffset = input.int(defval=20, title='Offset', group='Settings', minval=1) var i_doStr = input.string(defval="DO", title="Daily Opening Label", group="Label Captions") var i_woStr = input.string(defval="WO", title="Weekly Opening Label", group="Label Captions") var i_moStr = input.string(defval="MO", title="Monthly Opening Label", group="Label Captions") var i_yoStr = input.string(defval="YO", title="Yearly Opening Label", group="Label Captions") var i_pdoStr = input.string(defval="PDO", title="Previous Daily Opening Label", group="Label Captions") var i_pwoStr = input.string(defval="PWO", title="Previous Weekly Opening Label", group="Label Captions") var i_pmoStr = input.string(defval="PMO", title="Previous Monthly Opening Label", group="Label Captions") var i_pyoStr = input.string(defval="PYO", title="Previous Yearly Opening Label", group="Label Captions") var i_dhStr = input.string(defval="DH", title="Daily High Label", group="Label Captions") var i_dlStr = input.string(defval="DL", title="Daily Low Label", group="Label Captions") var i_whStr = input.string(defval="WH", title="Weekly High Label", group="Label Captions") var i_wlStr = input.string(defval="WL", title="Weekly Low Label", group="Label Captions") var i_mhStr = input.string(defval="MH", title="Monthly High Label", group="Label Captions") var i_mlStr = input.string(defval="ML", title="Monthly Low Label", group="Label Captions") var i_yhStr = input.string(defval="YH", title="Yearly High Label", group="Label Captions") var i_ylStr = input.string(defval="YL", title="Yearly High Label", group="Label Captions") var i_pdhStr = input.string(defval="PDH", title="Previous Daily High Label", group="Label Captions") var i_pdlStr = input.string(defval="PDL", title="Previous Daily Low Label", group="Label Captions") var i_pwhStr = input.string(defval="PWH", title="Previous Weekly High Label", group="Label Captions") var i_pwlStr = input.string(defval="PWL", title="Previous Weekly Low Label", group="Label Captions") var i_pmhStr = input.string(defval="PMH", title="Previous Monthly High Label", group="Label Captions") var i_pmlStr = input.string(defval="PML", title="Previous Monthly Low Label", group="Label Captions") var i_pyhStr = input.string(defval="PYH", title="Previous Yearly High Label", group="Label Captions") var i_pylStr = input.string(defval="PYL", title="Previous Yearly Low Label", group="Label Captions") var i_monhStr = input.string(defval="Monday High", title="Monday High Label", group="Label Captions") var i_monlStr = input.string(defval="Monday Low", title="Monday Low Label", group="Label Captions") //----------------------------- Securities ----------------------------- [dailyTime, dailyOpen, dailyHigh, dailyLow] = request.security(syminfo.tickerid, timeframe.isintraday ? '1440' : 'D', [time, open, high, low], lookahead=barmerge.lookahead_off) [weeklyTime, weeklyOpen, weeklyHigh, weeklyLow] = request.security(syminfo.tickerid, 'W', [time, open, high, low], lookahead=barmerge.lookahead_off) [monthlyTime, monthlyOpen, monthlyHigh, monthlyLow] = request.security(syminfo.tickerid, 'M', [time, open, high, low], lookahead=barmerge.lookahead_off) [yearlyTime, yearlyOpen, yearlyHigh, yearlyLow] = request.security(syminfo.tickerid, '12M', [time, open, high, low], lookahead=barmerge.lookahead_off) [pdailyTime, pdailyOpen, pdailyHigh, pdailyLow] = request.security(syminfo.tickerid, timeframe.isintraday ? '1440' : 'D', [time[1], open[1], high[1], low[1]], lookahead=barmerge.lookahead_off) [pweeklyTime, pweeklyOpen, pweeklyHigh, pweeklyLow] = request.security(syminfo.tickerid, 'W', [time[1], open[1], high[1], low[1]], lookahead=barmerge.lookahead_off) [pmonthlyTime, pmonthlyOpen, pmonthlyHigh, pmonthlyLow] = request.security(syminfo.tickerid, 'M', [time[1], open[1], high[1], low[1]], lookahead=barmerge.lookahead_off) [pyearlyTime, pyearlyOpen, pyearlyHigh, pyearlyLow] = request.security(syminfo.tickerid, '12M', [time[1], open[1], high[1], low[1]], lookahead=barmerge.lookahead_off) day = dayofweek(timenow) mondayOffset= day == dayofweek.monday ? 0 : day == dayofweek.tuesday ? 1 : day == dayofweek.wednesday ? 2 : day == dayofweek.thursday ? 3 : day == dayofweek.friday ? 4 : day == dayofweek.saturday ? 5 : 6 [mondayTime, mondayLow, mondayHigh] = request.security(syminfo.tickerid, timeframe.isintraday ? '1440' : 'D', [time[mondayOffset], low[mondayOffset], high[mondayOffset]], lookahead=barmerge.lookahead_off) //--------------------------- Function helpers ------------------------- f_drawLine(_x1, _x2, _y, _color, _width) => var _line = line.new(x1=_x1, x2=_x2, y1=_y, y2=_y, color=_color, width=_width, xloc=xloc.bar_time) line.set_xy1(_line, _x1, _y) line.set_xy2(_line, _x2, _y) f_drawLabel(_x, _y, _text, _textcolor, _style, _size) => var _label = label.new(x=_x, y=_y, text=_text, textcolor=_textcolor, style=_style, size=_size, xloc=xloc.bar_time) label.set_xy(_label, _x, _y) f_drawTail(_x1, _x2, _y, _color, _style, _width) => var _line = line.new(x1=_x1, x2=_x2, y1=_y, y2=_y, color=_color, style=_style, width=_width, extend=extend.left, xloc=xloc.bar_time) line.set_xy1(_line, _x1, _y) line.set_xy2(_line, _x2, _y) f_getRightOffset(_margin) => _padding = 4 _bar = math.min(time - time[1], time[1] - time[2]) time + _bar * (i_projectionOffset + _margin * _padding) f_drawCompleteLine(v_margin, v_open, v_time, v_color, v_str) => c_rightOffset = f_getRightOffset(v_margin) if i_isTailsEnabled f_drawTail(time, c_rightOffset, v_open, v_color, DEFAULT_TAIL_STYLE, DEFAULT_LINE_WIDTH) f_drawLine(time, c_rightOffset, v_open, v_color, DEFAULT_LINE_WIDTH) f_drawLine(v_time, time, v_open, v_color, DEFAULT_LINE_WIDTH) f_drawLabel(c_rightOffset, v_open, v_str, v_color, DEFAULT_LABEL_STYLE, DEFAULT_LABEL_SIZE) //------------------------------- Logic -------------------------------- var canShowDaily = timeframe.isintraday var canShowWeekly = (timeframe.isintraday or timeframe.isdaily) var canShowMonthly = (timeframe.isintraday or timeframe.isdaily or timeframe.isweekly) var canShowYearly = (timeframe.isintraday or timeframe.isdaily or timeframe.isweekly or timeframe.ismonthly and timeframe.multiplier < 12) wo = weeklyOpen wt = weeklyTime mo = monthlyOpen mt = monthlyTime yo = yearlyOpen yt = yearlyTime // Markets with extended sessions (e.g. TSLA) are available for intradays charts only // As the yearly, monthly and weekly data come respectively from the 12M, 1M, 1W timeframes, extended hours are excluded // When user chart option "ext" is toggled on, opens' price and time don't match // In such case, we visually want to use the extended hour open and time var float extWeeklyOpen = na var float extMonthlyOpen = na var float extYearlyOpen = na var float extWeeklyHigh = na var float extMonthlyHigh = na var float extYearlyHigh = na var float extWeeklyLow = na var float extMonthlyLow = na var float extYearlyLow = na var int extWeeklyTime = na var int extMonthlyTime = na var int extYearlyTime = na if timeframe.isintraday and syminfo.session == session.extended if weekofyear != weekofyear[1] extWeeklyOpen := dailyOpen extWeeklyHigh := dailyHigh extWeeklyLow := dailyLow extWeeklyTime := dailyTime extWeeklyTime if month != month[1] extMonthlyOpen := dailyOpen extMonthlyHigh := dailyHigh extMonthlyLow := dailyLow extMonthlyTime := dailyTime extMonthlyTime if year != year[1] extYearlyOpen := dailyOpen extYearlyHigh := dailyHigh extYearlyLow := dailyLow extYearlyTime := dailyTime extYearlyTime wo := extWeeklyOpen wt := extWeeklyTime mo := extMonthlyOpen mt := extMonthlyTime yo := extYearlyOpen yt := extYearlyTime yt // On the weekly timeframe, pinescript draws lines from the first weekly candle whose start date belongs to a given month/year // E.g. if the first weekly candle of the month start date is the 3rd of Feb, then the monthly open line is drawn from this candle // In such case, we visually want it to be anchored on the previous week which contains the 1st Feb var int weeklyTimeOnYearChange = na var int x1YearlyAnchor = na var int weeklyTimeOnMonthChange = na var int x1MonthlyAnchor = na if timeframe.isweekly if yearlyTime != yearlyTime[1] weeklyTimeOnYearChange := weeklyTime x1YearlyAnchor := weeklyTime[1] x1YearlyAnchor if monthlyTime != monthlyTime[1] weeklyTimeOnMonthChange := weeklyTime x1MonthlyAnchor := weeklyTime[1] x1MonthlyAnchor // Theorically we would adjust the position if the weekly start date is different than the 1st // Which pratically result actually of the first day of the month/year considering holidays if dayofmonth(weeklyTimeOnYearChange) != dayofmonth(yearlyTime) yt := x1YearlyAnchor yt if dayofmonth(weeklyTimeOnMonthChange) != dayofmonth(monthlyTime) mt := x1MonthlyAnchor mt //------------------------------ Plotting ------------------------------ if barstate.islast // // Yearly // if canShowYearly _margin = 0 if canShowDaily and dailyOpen == yo _margin := 1 _margin if canShowWeekly and wo == yo _margin += 1 _margin if canShowMonthly and mo == yo _margin += 1 _margin if i_isYearlyEnabled f_drawCompleteLine(_margin, yearlyOpen, yearlyTime, i_yearlyColor, i_yoStr) if i_isPYearlyEnabled f_drawCompleteLine(_margin, pyearlyOpen, pyearlyTime, i_pyearlyColor, i_pyoStr) if i_isYearlyHEnabled f_drawCompleteLine(_margin, yearlyHigh, yearlyTime, i_yearlyHColor, i_yhStr) if i_isPYearlyHEnabled f_drawCompleteLine(_margin, pyearlyHigh, pyearlyTime, i_pyearlyHColor, i_pyhStr) if i_isYearlyLEnabled f_drawCompleteLine(_margin, yearlyLow, yearlyTime, i_yearlyLColor, i_ylStr) if i_isPYearlyLEnabled f_drawCompleteLine(_margin, pyearlyLow, pyearlyTime, i_pyearlyLColor, i_pylStr) // // Monthly // if canShowMonthly _margin = 0 if canShowDaily and dailyOpen == mo _margin := 1 _margin if canShowMonthly and wo == mo _margin += 1 _margin if i_isMonthlyEnabled f_drawCompleteLine(_margin, monthlyOpen, monthlyTime, i_monthlyColor, i_moStr) if i_isPMonthlyEnabled f_drawCompleteLine(_margin, pmonthlyOpen, pmonthlyTime, i_pmonthlyColor, i_pmoStr) if i_isMonthlyHEnabled f_drawCompleteLine(_margin, monthlyHigh, monthlyTime, i_monthlyHColor, i_mhStr) if i_isPMonthlyHEnabled f_drawCompleteLine(_margin, pmonthlyHigh, pmonthlyTime, i_pmonthlyHColor, i_pmhStr) if i_isMonthlyLEnabled f_drawCompleteLine(_margin, monthlyLow, monthlyTime, i_monthlyLColor, i_mlStr) if i_isPMonthlyLEnabled f_drawCompleteLine(_margin, pmonthlyLow, pmonthlyTime, i_pmonthlyLColor, i_pmlStr) // // Weekly // if canShowWeekly _margin = 0 if canShowDaily and dailyOpen == wo _margin := 1 _margin if i_isWeeklyEnabled f_drawCompleteLine(_margin, weeklyOpen, weeklyTime, i_weeklyColor, i_woStr) if i_isPWeeklyEnabled f_drawCompleteLine(_margin, pweeklyOpen, pweeklyTime, i_pweeklyColor, i_pwoStr) if i_isMondayLowEnabled f_drawCompleteLine(0, mondayLow, mondayTime, i_mondayLowColor, i_monlStr) if i_isMondayHighEnabled f_drawCompleteLine(0, mondayHigh, mondayTime, i_mondayHighColor, i_monhStr) if i_isWeeklyHEnabled f_drawCompleteLine(_margin, weeklyHigh, weeklyTime, i_weeklyHColor, i_whStr) if i_isPWeeklyHEnabled f_drawCompleteLine(_margin, pweeklyHigh, pweeklyTime, i_pweeklyHColor, i_pwhStr) if i_isWeeklyLEnabled f_drawCompleteLine(_margin, weeklyLow, weeklyTime, i_weeklyLColor, i_wlStr) if i_isPWeeklyLEnabled f_drawCompleteLine(_margin, pweeklyLow, pweeklyTime, i_pweeklyLColor, i_pwlStr) // // Daily // if canShowDaily if i_isDailyEnabled f_drawCompleteLine(0, dailyOpen, dailyTime, i_dailyColor, i_doStr) if i_isPDailyEnabled f_drawCompleteLine(0, pdailyOpen,pdailyTime, i_pdailyColor, i_pdoStr) if i_isDailyHEnabled f_drawCompleteLine(0, dailyHigh, dailyTime, i_dailyHColor, i_dhStr) if i_isPDailyHEnabled f_drawCompleteLine(0, pdailyHigh, pdailyTime, i_pdailyHColor, i_pdhStr) if i_isDailyLEnabled f_drawCompleteLine(0, dailyLow, dailyTime, i_dailyLColor, i_dlStr) if i_isPDailyLEnabled f_drawCompleteLine(0, pdailyLow, pdailyTime, i_pdailyLColor, i_pdlStr)
Next Igor Session
https://www.tradingview.com/script/liqbwV4V-Next-Igor-Session/
a.unterweger
https://www.tradingview.com/u/a.unterweger/
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/ // © a.unterweger //@version=4 study("Next Igor Session", overlay=true) high_ = highest(high, 20) low_ = lowest(low, 20) drawTime(is, color_) => line.new(is, high_, is, low_, xloc = xloc.bar_time, extend = extend.both, style=line.style_dotted, color=color_) millis24h = 24 * 60 * 60 * 1000 is1 = timestamp("UTC", year, month, dayofmonth, 00, 00, 00) is2 = timestamp("UTC", year, month, dayofmonth, 06, 00, 00) is3 = timestamp("UTC", year, month, dayofmonth, 12, 00, 00) is4 = timestamp("UTC", year, month, dayofmonth, 20, 00, 00) prev = 0 next = if(timenow < is1) prev := is4 is1 else if(timenow < is2) prev := is1 is2 else if(timenow < is3) prev := is2 is3 else prev := is3 is4 //handle case after last session if timenow > next is1 := is1+millis24h next := is1 prev := is4 if(timenow < next) drawTime(next, color.gray) drawTime(prev, color.gray) //ny open showNyOpen = input(title="Show NY open", type=input.bool, defval=true) nyOpen = timestamp("America/New_York", year, month, dayofmonth, 09, 30, 00) //handle case after last ny open if timenow > nyOpen nyOpen := nyOpen+millis24h if(showNyOpen and timenow < nyOpen) drawTime(nyOpen, color.blue) //continental sessions showContSessions = input(title="Show continental sessions", type=input.bool, defval=true) asia = timestamp("UTC", year, month, dayofmonth, 00, 00, 00) london = timestamp("UTC", year, month, dayofmonth, 08, 00, 00) ny = timestamp("UTC", year, month, dayofmonth, 14, 30, 00) close_ = timestamp("UTC", year, month, dayofmonth, 19, 15, 00) nextCSession = if(timenow < asia) asia else if(timenow < london) london else if(timenow < ny) ny else close_ //handle case after last continental session if timenow > nextCSession asia := asia+millis24h nextCSession := asia if(showContSessions and timenow < nextCSession) drawTime(nextCSession, color.fuchsia) //history = input(title="Show history", type=input.bool, defval=true) //if(history) // drawTime(is1) // drawTime(is2) // drawTime(is3) // drawTime(is4)
bb_ema_hamed
https://www.tradingview.com/script/X3VvU99K-bb-ema-hamed/
availableDirec3937
https://www.tradingview.com/u/availableDirec3937/
4
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/ // © availableDirec3937 //@version=5 indicator(shorttitle="bb_ema", title="bb_ema", overlay=true, timeframe="", timeframe_gaps=true) length = input.int(20, minval=1) src = input(close, title="Source") mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev") basis = ta.sma(src, length) dev = mult * ta.stdev(src, length) upper = basis + dev lower = basis - dev offset = input.int(0, "Offset", minval = -500, maxval = 500) plot(basis, "Basis", color=#FF6D00, offset = offset) len = input.int(6, minval=1, title="Length") out = ta.ema(src, len) plot(out, title="EMA", color=color.blue, offset=offset)
Standard Deviation Candles (With Emoji)
https://www.tradingview.com/script/ekjdWkjz-Standard-Deviation-Candles-With-Emoji/
animecummer
https://www.tradingview.com/u/animecummer/
169
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 indicator('Standard Deviation Candles With Emoji', overlay=true, shorttitle='StDev Candles w/ Emoji', timeframe="", timeframe_gaps=true) up = close > open down = open > close //input len = input.int(defval=20, title='SD Period', minval=2, inline='00', group='Candle Coloring Based On Normal Distribution, Unique Colors When Current Bar Differs From Previous Candles By > 1.5, 2, 2.5, and 3 Std Dev. Note: Works good with Heikin Ashi!') showchars = input.bool(true, 'Show Emoji?', group='Candle Coloring Based On Normal Distribution, Unique Colors When Current Bar Differs From Previous Candles By > 1.5, 2, 2.5, and 3 Std Dev. Note: Works good with Heikin Ashi!', inline='00') showcolors = input.bool(true, 'Bar colors?', group='Candle Coloring Based On Normal Distribution, Unique Colors When Current Bar Differs From Previous Candles By > 1.5, 2, 2.5, and 3 Std Dev. Note: Works good with Heikin Ashi!', inline='00') fomoinp1 = input(open, 'Up              Baseline', group='How Significant Moves Are Measured', inline='0') fomoinp2 = input(high, 'High Point', group='How Significant Moves Are Measured', inline='0') dumpinp1 = input(open, 'Down          Baseline', group='How Significant Moves Are Measured', inline='1') dumpinp2 = input(low, ' Low Point', group='How Significant Moves Are Measured', inline='1') col_upreg = input.color(color.new(#26a69a, 0), 'Regular                Up', group='Regular Candles', inline='00') col_dnreg = input.color(color.new(#ff5252, 0), 'Down', group='Regular Candles', inline='00') transpreg = input.int(title='Transparency', defval=0, minval=0, maxval=100, group='Regular Candles', inline='00') // onepointfive = input.float(title='', defval=1.5, step=0.01, group='Candles Greater Than ... Standard Deviations', inline='03') col_up15 = input.color(color.new(#32bf8f, 0), 'Up', group='Candles Greater Than ... Standard Deviations', inline='03') col_dn15 = input.color(color.new(#ff2d70, 0), 'Down', group='Candles Greater Than ... Standard Deviations', inline='03') transpsd = input.int(title='Transparency', defval=0, minval=0, maxval=100, group='Candles Greater Than ... Standard Deviations', inline='03') twopointzero = input.float(title='', defval=2.0, step=0.01, group='Candles Greater Than ... Standard Deviations', inline='04') col_up20 = input.color(color.new(#6bd673, 0), 'Up', group='Candles Greater Than ... Standard Deviations', inline='04') col_dn20 = input.color(color.new(#ff0097, 0), 'Down', group='Candles Greater Than ... Standard Deviations', inline='04') twopointfive = input.float(title='', defval=2.5, step=0.01, group='Candles Greater Than ... Standard Deviations', inline='05') col_up25 = input.color(color.new(#b0e749, 0), 'Up', group='Candles Greater Than ... Standard Deviations', inline='05') col_dn25 = input.color(color.new(#ff00c8, 0), 'Down', group='Candles Greater Than ... Standard Deviations', inline='05') threepointzero = input.float(title='', defval=3.0, step=0.01, group='Candles Greater Than ... Standard Deviations', inline='06') col_up30 = input.color(color.new(#fff000, 0), 'Up', group='Candles Greater Than ... Standard Deviations', inline='06') col_dn30 = input.color(color.new(#ff00ff, 0), 'Down', group='Candles Greater Than ... Standard Deviations', inline='06') //normal distribution sd1_5 = ta.stdev(up ? fomoinp1 : dumpinp1, len) * onepointfive sd2 = ta.stdev(up ? fomoinp1 : dumpinp1, len) * twopointzero sd2_5 = ta.stdev(up ? fomoinp1 : dumpinp1, len) * twopointfive sd3 = ta.stdev(up ? fomoinp1 : dumpinp1, len) * threepointzero //logic grad = if up and showcolors == true (fomoinp2 - fomoinp1) >= sd3 ? col_up30 : (fomoinp2 - fomoinp1) >= sd2_5 ? col_up25 : (fomoinp2 - fomoinp1) >= sd2 ? col_up20 : (fomoinp2 - fomoinp1) >= sd1_5 ? col_up15 : col_upreg else if down and showcolors == true (dumpinp1 - dumpinp2) >= sd3 ? col_dn30 : (dumpinp1 - dumpinp2) >= sd2_5 ? col_dn25 : (dumpinp1 - dumpinp2) >= sd2 ? col_dn20 : (dumpinp1 - dumpinp2) >= sd1_5 ? col_dn15 : col_dnreg else up ? col_upreg : col_dnreg transp = if grad == col_upreg transpreg else if grad == col_dnreg transpreg else transpsd barcolor(color.new(grad, transp), title="Standard Deviation Candles") sigma3up = if up (fomoinp2 - fomoinp1) >= sd3 ? true : false else false sigma25up = if up (fomoinp2 - fomoinp1) >= sd2_5 ? true : false else false sigma2up = if up (fomoinp2 - fomoinp1) >= sd2 ? true : false else false sigma15up = if up (fomoinp2 - fomoinp1) >= sd1_5 ? true : false else false sigma3down = if down (fomoinp1 - dumpinp2) >= sd3 ? true : false else false sigma25down = if down (fomoinp1 - dumpinp2) >= sd2_5 ? true : false else false sigma2down = if down (fomoinp1 - dumpinp2) >= sd2 ? true : false else false sigma15down = if down (fomoinp1 - dumpinp2) >= sd1_5 ? true : false else false plotchar(sigma3up and showchars, "Sigma 3 UP", "🚀", location=location.belowbar, color=col_up30, size = size.auto) plotchar(sigma25up and showchars and not sigma3up, "Sigma 2.5 UP", "✈️️", location=location.belowbar, color=col_up25, size = size.auto) plotchar(sigma2up and showchars and not sigma3up and not sigma25up, "Sigma 2 UP", "🥂️", location=location.belowbar, color=col_up20, size = size.auto) plotchar(sigma15up and showchars and not sigma3up and not sigma25up and not sigma2up, "Sigma 1.5 UP", "🟢", location=location.belowbar, color=col_up15, size = size.auto) plotchar(sigma3down and showchars, "Sigma 3 down", "💀️", location=location.abovebar, color=col_dn30, size = size.auto) plotchar(sigma25down and showchars and not sigma3down, "Sigma 2.5 down", "🐻️️", location=location.abovebar, color=col_dn25, size = size.auto) plotchar(sigma2down and showchars and not sigma3down and not sigma25down, "Sigma 2 down", "💩️️", location=location.abovebar, color=col_dn20, size = size.auto) plotchar(sigma15down and showchars and not sigma3down and not sigma25down and not sigma2down, "Sigma 1.5 down", "🔻", location=location.abovebar, color=col_dn15, size = size.auto) alertcond = if up (fomoinp2 - fomoinp1) >= sd3 ? true : (fomoinp2 - fomoinp1) >= sd2_5 ? true : (fomoinp2 - fomoinp1) >= sd2 ? true : (fomoinp2 - fomoinp1) >= sd1_5 ? true : false else if down (dumpinp1 - dumpinp2) >= sd3 ? true : (dumpinp1 - dumpinp2) >= sd2_5 ? true : (dumpinp1 - dumpinp2) >= sd2 ? true : (dumpinp1 - dumpinp2) >= sd1_5 ? true : false else false //Alerts alertcondition(alertcond == true, 'Significant Price Move', 'Significant Price Move')
Akshay EMA Clouds
https://www.tradingview.com/script/i2Kpj0R0-Akshay-EMA-Clouds/
AK_INVEST
https://www.tradingview.com/u/AK_INVEST/
18
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/ // © Akshay R //@version=4 study("Akshay EMA Clouds","Akshay EMA Clouds", overlay=true) matype = input(title="MA Type", type=input.string, defval="EMA", options=["EMA", "SMA"]) ma_len1 = input(title="Short EMA1 Length", type=input.integer, defval=8) ma_len2 = input(title="Long EMA1 Length", type=input.integer, defval=9) ma_len3 = input(title="Short EMA2 Length", type=input.integer, defval=5) ma_len4 = input(title="Long EMA2 Length", type=input.integer, defval=13) ma_len5 = input(title="Short EMA3 Length", type=input.integer, defval=34) ma_len6 = input(title="Long EMA3 Length", type=input.integer, defval=50) ma_len7 = input(title="Short EMA4 Length", type=input.integer, defval=72) ma_len8 = input(title="Long EMA4 Length", type=input.integer, defval=89) ma_len9 = input(title="Short EMA5 Length", type=input.integer, defval=180) ma_len10 = input(title="Long EMA5 Length", type=input.integer, defval=200) src = input(title="Source", type=input.source, defval=hl2) ma_offset = input(title="Offset", type=input.integer, defval=0) //res = input(title="Resolution", type=resolution, defval="240") f_ma(malen) => float result = 0 if (matype == "EMA") result := ema(src, malen) if (matype == "SMA") result := sma(src, malen) result htf_ma1 = f_ma(ma_len1) htf_ma2 = f_ma(ma_len2) htf_ma3 = f_ma(ma_len3) htf_ma4 = f_ma(ma_len4) htf_ma5 = f_ma(ma_len5) htf_ma6 = f_ma(ma_len6) htf_ma7 = f_ma(ma_len7) htf_ma8 = f_ma(ma_len8) htf_ma9 = f_ma(ma_len9) htf_ma10 = f_ma(ma_len10) //plot(out1, color=green, offset=ma_offset) //plot(out2, color=red, offset=ma_offset) //lengthshort = input(8, minval = 1, title = "Short EMA Length") //lengthlong = input(200, minval = 2, title = "Long EMA Length") //emacloudleading = input(50, minval = 0, title = "Leading Period For EMA Cloud") //src = input(hl2, title = "Source") showlong = input(false, title="Show Long Alerts") showshort = input(false, title="Show Short Alerts") showLine = input(false, title="Display EMA Line") ema1 = input(true, title="Show EMA Cloud-1") ema2 = input(true, title="Show EMA Cloud-2") ema3 = input(true, title="Show EMA Cloud-3") ema4 = input(true, title="Show EMA Cloud-4") ema5 = input(true, title="Show EMA Cloud-5") emacloudleading = input(0, minval=0, title="Leading Period For EMA Cloud") mashort1 = htf_ma1 malong1 = htf_ma2 mashort2 = htf_ma3 malong2 = htf_ma4 mashort3 = htf_ma5 malong3 = htf_ma6 mashort4 = htf_ma7 malong4 = htf_ma8 mashort5 = htf_ma9 malong5 = htf_ma10 cloudcolour1 = mashort1 >= malong1 ? #036103 : #880e4f cloudcolour2 = mashort2 >= malong2 ? #4caf50 : #f44336 cloudcolour3 = mashort3 >= malong3 ? #2196f3 : #ffb74d cloudcolour4 = mashort4 >= malong4 ? #009688 : #f06292 cloudcolour5 = mashort5 >= malong5 ? #05bed5 : #e65100 //03abc1 mashortcolor1 = mashort1 >= mashort1[1] ? color.olive : color.maroon mashortcolor2 = mashort2 >= mashort2[1] ? color.olive : color.maroon mashortcolor3 = mashort3 >= mashort3[1] ? color.olive : color.maroon mashortcolor4 = mashort4 >= mashort4[1] ? color.olive : color.maroon mashortcolor5 = mashort5 >= mashort5[1] ? color.olive : color.maroon mashortline1 = plot(ema1 ? mashort1 : na, color=showLine ? mashortcolor1 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA1") mashortline2 = plot(ema2 ? mashort2 : na, color=showLine ? mashortcolor2 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA2") mashortline3 = plot(ema3 ?mashort3 : na, color=showLine ? mashortcolor3 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA3") mashortline4 = plot(ema4 ? mashort4 :na , color=showLine ? mashortcolor4 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA4") mashortline5 = plot(ema5 ? mashort5 : na, color=showLine ? mashortcolor5 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA5") malongcolor1 = malong1 >= malong1[1] ? color.green : color.red malongcolor2 = malong2 >= malong2[1] ? color.green : color.red malongcolor3 = malong3 >= malong3[1] ? color.green : color.red malongcolor4 = malong4 >= malong4[1] ? color.green : color.red malongcolor5 = malong5 >= malong5[1] ? color.green : color.red malongline1 = plot(ema1 ? malong1 : na, color=showLine ? malongcolor1 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA1") malongline2 = plot(ema2 ? malong2 : na, color=showLine ? malongcolor2 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA2") malongline3 = plot(ema3 ? malong3 : na, color=showLine ? malongcolor3 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA3") malongline4 = plot(ema4 ? malong4 : na, color=showLine ? malongcolor4 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA4") malongline5 = plot(ema5 ? malong5 : na, color=showLine ? malongcolor5 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA5") fill(mashortline1, malongline1, color=cloudcolour1, transp=45, title="MA Cloud1") fill(mashortline2, malongline2, color=cloudcolour2, transp=65, title="MA Cloud2") fill(mashortline3, malongline3, color=cloudcolour3, transp=70, title="MA Cloud3") fill(mashortline4, malongline4, color=cloudcolour4, transp=65, title="MA Cloud4") fill(mashortline5, malongline5, color=cloudcolour5, transp=65, title="MA Cloud5")
RiskONess
https://www.tradingview.com/script/16qj6gs8-RiskONess/
Austimize
https://www.tradingview.com/u/Austimize/
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/ // © bubblyCheetah52065 //@version=5 indicator("RiskONess") t1 = request.security("COMEX:HG1!", 'D', close) t2 = request.security("NYMEX:CL1!", 'D', close) t3 = request.security("CME_MINI:ES1!", 'D', close) b1 = request.security("OANDA:XAUUSD", 'D', close) b2 = request.security("CBOE:VX1!", 'D', close) b3 = request.security("CBOT:ZB1!", 'D', close) plot((t1*t2*t3)/(b1*b2*b3))
Ichimoku Screener
https://www.tradingview.com/script/etR3P7zy-Ichimoku-Screener/
hajixde
https://www.tradingview.com/u/hajixde/
689
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("Ichimoku Screener", overlay = false, max_bars_back = 500, precision = 2) conversionPeriods = input.int(9, minval=1, title="Conversion Line Length", group = "ichimoku") basePeriods = input.int(26, minval=1, title="Base Line Length", group = "ichimoku") laggingSpan2Periods = input.int(52, minval=1, title="Leading Span B Length", group = "ichimoku") displacement = input.int(26, minval=1, title="Displacement", group = "ichimoku") green = color.rgb(67, 160, 71, 10) red = color.rgb(244, 67, 54, 10) brightGreen = color.rgb(57, 220, 57, 0) brightRed = color.rgb(220, 20, 20, 0) gray = color.gray statColor() => //cloud color conversionLine = math.avg(ta.lowest(conversionPeriods), ta.highest(conversionPeriods)) baseLine = math.avg(ta.lowest(basePeriods), ta.highest(basePeriods)) leadLine1 = math.avg(conversionLine, baseLine) leadLine2 = math.avg(ta.lowest(laggingSpan2Periods), ta.highest(laggingSpan2Periods)) cloudColor = color.white int barsSinceColorChange = 0 x1 = ta.barssince(not(leadLine1 > leadLine2)) x2 = ta.barssince(leadLine1 > leadLine2) if leadLine1 > leadLine2 cloudColor :=green barsSinceColorChange := x1 else cloudColor := red barsSinceColorChange := x2 // Price above cloud closeAboveCloud = color.white int barsSinceCloseAboveCloud = 0 if not (close <= leadLine1[displacement*2] and close <= leadLine2[displacement*2]) and not (close >= leadLine1[displacement*2] and close >= leadLine2[displacement*2]) barsSinceCloseAboveCloud := -1 closeAboveCloud := gray else y1 = ta.barssince(close <= leadLine1[displacement*2] or close <= leadLine2[displacement*2]) y2 = ta.barssince(close >= leadLine1[displacement*2] or close >= leadLine2[displacement*2]) if close >= leadLine1[displacement*2] and close >= leadLine2[displacement*2] closeAboveCloud :=green barsSinceCloseAboveCloud := y1 else closeAboveCloud := red barsSinceCloseAboveCloud := y2 // conversion and baseline z1 = ta.barssince(not(conversionLine > baseLine)) z2 = ta.barssince(conversionLine > baseLine) int barsSinceConvAboveBase = 0 convAboveBaseColor = color.white if conversionLine > baseLine convAboveBaseColor :=green barsSinceConvAboveBase := z1 else convAboveBaseColor := red barsSinceConvAboveBase := z2 [cloudColor, closeAboveCloud, convAboveBaseColor, barsSinceColorChange, barsSinceCloseAboveCloud, barsSinceConvAboveBase] checkStat(coin) => [cloudColor, closeAboveCloud, convAboveBaseColor, barsSinceColorChange, barsSinceCloseAboveCloud, barsSinceConvAboveBase] = request.security(coin, timeframe.period, statColor()) [cloudColor, closeAboveCloud, convAboveBaseColor, barsSinceColorChange, barsSinceCloseAboveCloud, barsSinceConvAboveBase] 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("ANTUSDT", group = "Coins" , inline = "coins_") coin6 = input.string("COSUSDT", group = "Coins" , inline = "coins_") coin7 = input.string("NFTUSDT", group = "Coins" , inline = "coins_") coin8 = input.string("NEARUSDT", 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_") coin16 = input.string("HTUSDT", group = "Coins" , inline = "coins_") coin17 = input.string("MATICUSDT", group = "Coins" , inline = "coins_") coin18 = input.string("JSTUSDT", group = "Coins" , inline = "coins_") coin19 = input.string("ADAUSDT", group = "Coins" , inline = "coins_") coin20 = input.string("TRXUSDT", group = "Coins" , inline = "coins_") coin21 = input.string("XRPUSDT", group = "Coins" , inline = "coins_") coin22 = input.string("LUNAUSDT", group = "Coins" , inline = "coins_") coin23 = input.string("TFUELUSDT", group = "Coins" , inline = "coins_") coin24 = input.string("AVAXUSDT", group = "Coins" , inline = "coins_") coin25 = input.string("SUNUSDT", group = "Coins" , inline = "coins_") coin26 = input.string("SANDUSDT", group = "Coins" , inline = "coins_") coin27 = input.string("STEEMUSDT", group = "Coins" , inline = "coins_") coin28 = input.string("MANAUSDT", group = "Coins" , inline = "coins_") coin29 = input.string("JASMYUSDT", group = "Coins" , inline = "coins_") coin30 = input.string("YGGUSDT", group = "Coins" , inline = "coins_") var table statTable = table.new(position.middle_center, 15, 11, bgcolor = color.black, frame_width = 1, frame_color = color.black, border_color = color.black, border_width = 1) table.cell(statTable, 0, 0, "Coin", text_color = color.white, bgcolor = #336688) table.cell(statTable, 1, 0, "Cloud\nColor", text_color = color.white, bgcolor = #336688) table.cell(statTable, 2, 0, "Lagging\n>\nCloud", text_color = color.white, bgcolor = #336688) table.cell(statTable, 3, 0, "Conv.\n>\nBase", text_color = color.white, bgcolor = #336688) table.cell(statTable, 4, 0, "Entry", text_color = color.white, bgcolor = #336688) table.cell(statTable, 5, 0, "Coin", text_color = color.white, bgcolor = #336688) table.cell(statTable, 6, 0, "Cloud\nColor", text_color = color.white, bgcolor = #336688) table.cell(statTable, 7, 0, "Lagging\n>\nCloud", text_color = color.white, bgcolor = #336688) table.cell(statTable, 8, 0, "Conv.\n>\nBase", text_color = color.white, bgcolor = #336688) table.cell(statTable, 9, 0, "Entry", text_color = color.white, bgcolor = #336688) table.cell(statTable, 10, 0, "Coin", text_color = color.white, bgcolor = #336688) table.cell(statTable, 11, 0, "Cloud\nColor", text_color = color.white, bgcolor = #336688) table.cell(statTable, 12, 0, "Lagging\n>\nCloud", text_color = color.white, bgcolor = #336688) table.cell(statTable, 13, 0, "Conv.\n>\nBase", text_color = color.white, bgcolor = #336688) table.cell(statTable, 14, 0, "Entry", 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, 5, 1, coin11, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 5, 2, coin12, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 5, 3, coin13, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 5, 4, coin14, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 5, 5, coin15, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 5, 6, coin16, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 5, 7, coin17, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 5, 8, coin18, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 5, 9, coin19, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 5, 10, coin20, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 1, coin21, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 2, coin22, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 3, coin23, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 4, coin24, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 5, coin25, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 6, coin26, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 7, coin27, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 8, coin28, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 9, coin29, text_color = color.white, bgcolor = #9999EE) table.cell(statTable, 10, 10, coin30, text_color = color.white, bgcolor = #9999EE) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// calcStatAndFill(coin, yPos, xPos) => [cloudColor, closeAboveCloud, convAboveBaseColor, barsSinceColorChange, barsSinceCloseAboveCloud, barsSinceConvAboveBase] = checkStat(coin) table.cell(statTable, yPos, xPos, str.tostring(barsSinceColorChange), text_color = color.white, bgcolor = cloudColor) if barsSinceCloseAboveCloud == -1 table.cell(statTable, yPos+1, xPos, "-", text_color = color.white, bgcolor = closeAboveCloud) else table.cell(statTable, yPos+1, xPos, str.tostring(barsSinceCloseAboveCloud), text_color = color.white, bgcolor = closeAboveCloud) table.cell(statTable, yPos+2, xPos, str.tostring(barsSinceConvAboveBase), text_color = color.white, bgcolor = convAboveBaseColor) color entryColor = na msg = "N/A" if cloudColor == red and convAboveBaseColor == red and closeAboveCloud == red period = math.min(barsSinceColorChange, barsSinceCloseAboveCloud, barsSinceConvAboveBase) if period <= 1 entryColor := brightRed else entryColor := red msg := "S: " + str.tostring(period) if cloudColor == green and convAboveBaseColor == green and closeAboveCloud == green period = math.min(barsSinceColorChange, barsSinceCloseAboveCloud, barsSinceConvAboveBase) if period <= 1 entryColor := brightGreen else entryColor := green msg := "L: " + str.tostring(period) table.cell(statTable, yPos+3, xPos, msg, text_color = color.white, bgcolor = entryColor) start = false if cloudColor == green and closeAboveCloud == green and convAboveBaseColor == green and math.min(barsSinceColorChange, barsSinceCloseAboveCloud, barsSinceConvAboveBase) <= 1 start := true start startRamp = false startRamp := startRamp or calcStatAndFill(coin1, 1, 1) startRamp := startRamp or calcStatAndFill(coin2, 1, 2) startRamp := startRamp or calcStatAndFill(coin3, 1, 3) startRamp := startRamp or calcStatAndFill(coin4, 1, 4) startRamp := startRamp or calcStatAndFill(coin5, 1, 5) startRamp := startRamp or calcStatAndFill(coin6, 1, 6) startRamp := startRamp or calcStatAndFill(coin7, 1, 7) startRamp := startRamp or calcStatAndFill(coin8, 1, 8) startRamp := startRamp or calcStatAndFill(coin9, 1, 9) startRamp := startRamp or calcStatAndFill(coin10, 1, 10) startRamp := startRamp or calcStatAndFill(coin11, 6, 1) startRamp := startRamp or calcStatAndFill(coin12, 6, 2) startRamp := startRamp or calcStatAndFill(coin13, 6, 3) startRamp := startRamp or calcStatAndFill(coin14, 6, 4) startRamp := startRamp or calcStatAndFill(coin15, 6, 5) startRamp := startRamp or calcStatAndFill(coin16, 6, 6) startRamp := startRamp or calcStatAndFill(coin17, 6, 7) startRamp := startRamp or calcStatAndFill(coin18, 6, 8) startRamp := startRamp or calcStatAndFill(coin19, 6, 9) startRamp := startRamp or calcStatAndFill(coin20, 6, 10) startRamp := startRamp or calcStatAndFill(coin21, 11, 1) startRamp := startRamp or calcStatAndFill(coin22, 11, 2) startRamp := startRamp or calcStatAndFill(coin23, 11, 3) startRamp := startRamp or calcStatAndFill(coin24, 11, 4) startRamp := startRamp or calcStatAndFill(coin25, 11, 5) startRamp := startRamp or calcStatAndFill(coin26, 11, 6) startRamp := startRamp or calcStatAndFill(coin27, 11, 7) startRamp := startRamp or calcStatAndFill(coin28, 11, 8) startRamp := startRamp or calcStatAndFill(coin29, 11, 9) startRamp := startRamp or calcStatAndFill(coin30, 11, 10) alertcondition(startRamp, "Buy", "Buy")
Didi Index Plus
https://www.tradingview.com/script/el7AaNVM-Didi-Index-Plus/
vitorleo
https://www.tradingview.com/u/vitorleo/
156
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 Plus') // 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') // EXIT Alerts alertcondition(exitShort() and (tendenciaVenda() or temTendencia() == false), title='Exit short', message='{{exchange}}:{{ticker}} TRIX and Stochastic BUYING at {{close}}') alertcondition(exitLong() and (tendenciaCompra() or temTendencia() == false), title='Exit long', message='{{exchange}}:{{ticker}} TRIX and Stochastic SELLING at {{close}}') // Mostra a tabela com info sobre indicadores var table indTable = table.new(position.bottom_left, 3, 1, bgcolor=color.black, border_color=color.black, border_width=1) table.cell(indTable, 0, 0, "ADX " + str.tostring(math.round(adx[1], 1)) + " >> " + str.tostring(math.round(adx, 1)), text_halign=text.align_left, text_color=color.white, text_size=size.small) table.cell(indTable, 1, 0, "Stochastic", bgcolor=(stockComprado()?color.green:color.red), text_halign=text.align_left, text_color=color.white, text_size=size.small) table.cell(indTable, 2, 0, "TRIX", bgcolor=(trixComprado()?color.green:color.red), text_halign=text.align_left, text_color=color.white, text_size=size.small) //End
RAHUL CPR
https://www.tradingview.com/script/RJA4arIU-RAHUL-CPR/
more705681
https://www.tradingview.com/u/more705681/
4
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/ study("RAHUL CPR", overlay = true, shorttitle="C",precision=1) //******************LOGICS************************** //cenral pivot range pivot = (high + low + close) /3 //Central Povit BC = (high + low) / 2 //Below Central povit TC = (pivot - BC) + pivot //Top Central povot //3 support levels S1 = (pivot * 2) - high S2 = pivot - (high - low) S3 = low - 2 * (high - pivot) //3 resistance levels R1 = (pivot * 2) - low R2 = pivot + (high - low) R3 = high + 2 * (pivot-low) //Checkbox inputs CPRPlot = input(title = "Plot Daily CPR?", type=input.bool, defval=true) CPRPlot1 = input(title = "Plot Weekly CPR?", type=input.bool, defval=true) CPRPlot2 = input(title = "Plot Monthly CPR?", type=input.bool, defval=true) DayS1R1 = input(title = "Plot Daiy S1/R1?", type=input.bool, defval=true) DayS2R2 = input(title = "Plot Daiy S2/R2?", type=input.bool, defval=false) DayS3R3 = input(title = "Plot Daiy S3/R3?", type=input.bool, defval=false) //WeeklyPivotInclude = input(title = "Plot Weekly Pivot?", type=input.bool, defval=false) //WeeklyS1R1 = input(title = "Plot weekly S1/R1?", type=input.bool, defval=false) //WeeklyS2R2 = input(title = "Plot weekly S2/R2?", type=input.bool, defval=false) //WeeklyS3R3 = input(title = "Plot weekly S3/R3?", type=input.bool, defval=false) //MonthlyPivotInclude = input(title = "Plot Montly Pivot?", type=input.bool, defval=false) //MonthlyS1R1 = input(title = "Plot Monthly S1/R1?", type=input.bool, defval=false) //MonthlyS2R2 = input(title = "Plot Monthly S2/R2?", type=input.bool, defval=false) //MonthlyS3R3 = input(title = "Plot Montly S3/R3?", type=input.bool, defval=false) //DailyHigh = input(title = "Plot Daily High?", type=input.bool, defval=false) //DailyLow = input(title = "Plot Daily High?", type=input.bool, defval=false) //******************DAYWISE CPR & PIVOTS************************** // Getting daywise CPR DayPivot = security(syminfo.tickerid, "D", pivot[1], barmerge.gaps_off, barmerge.lookahead_on) DayBC = security(syminfo.tickerid, "D", BC[1], barmerge.gaps_off, barmerge.lookahead_on) DayTC = security(syminfo.tickerid, "D", TC[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks daywse for CPR CPColour = DayPivot != DayPivot[1] ? na : color.blue BCColour = DayBC != DayBC[1] ? na : color.blue TCColour = DayTC != DayTC[1] ? na : color.blue //Plotting daywise CPR plot(DayPivot, title = "CP" , color = CPColour, style = plot.style_linebr, linewidth =2) plot(CPRPlot ? DayBC : na , title = "BC" , color = BCColour, style = plot.style_line, linewidth =1) plot(CPRPlot ? DayTC : na , title = "TC" , color = TCColour, style = plot.style_line, linewidth =1) // Getting weekwise CPR WkPivot = security(syminfo.tickerid, "W", pivot[1], barmerge.gaps_off, barmerge.lookahead_on) WBC = security(syminfo.tickerid, "W", BC[1], barmerge.gaps_off, barmerge.lookahead_on) WTC = security(syminfo.tickerid, "W", TC[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks weekwse for CPR CPColour1 = WkPivot != WkPivot[1] ? na : color.blue BCColour1 = WBC != WBC[1] ? na : color.blue TCColour1 = WTC != WTC[1] ? na : color.blue //Plotting weekwise CPR plot(WkPivot, title = "CP" , color = CPColour1, style = plot.style_linebr, linewidth =3) plot(CPRPlot1 ? WBC : na , title = "BC" , color = BCColour1, style = plot.style_line, linewidth =1) plot(CPRPlot1 ? WTC : na , title = "TC" , color = TCColour1, style = plot.style_line, linewidth =1) // Getting Mwise CPR MPivot = security(syminfo.tickerid, "M", pivot[1], barmerge.gaps_off, barmerge.lookahead_on) MBC = security(syminfo.tickerid, "M", BC[1], barmerge.gaps_off, barmerge.lookahead_on) MTC = security(syminfo.tickerid, "M", TC[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks Mwse for CPR CPColour2 = MPivot != MPivot[1] ? na : color.blue BCColour2 = MBC != MBC[1] ? na : color.blue TCColour2 = MTC != MTC[1] ? na : color.blue //Plotting Mwise CPR plot(MPivot, title = "CP" , color = CPColour2, style = plot.style_linebr, linewidth =4) plot(CPRPlot2 ? MBC : na , title = "BC" , color = BCColour2, style = plot.style_line, linewidth =1) plot(CPRPlot2 ? MTC : na , title = "TC" , color = TCColour2, style = plot.style_line, linewidth =1) // Getting daywise Support levels DayS1 = security(syminfo.tickerid, "D", S1[1], barmerge.gaps_off, barmerge.lookahead_on) DayS2 = security(syminfo.tickerid, "D", S2[1], barmerge.gaps_off, barmerge.lookahead_on) DayS3 = security(syminfo.tickerid, "D", S3[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for daywise Support levels DayS1Color =DayS1 != DayS1[1] ? na : color.green DayS2Color =DayS2 != DayS2[1] ? na : color.green DayS3Color =DayS3 != DayS3[1] ? na : color.green //Plotting daywise Support levels plot(DayS1R1 ? DayS1 : na, title = "D-S1" , color = DayS1Color, style = plot.style_line, linewidth =1) plot(DayS2R2 ? DayS2 : na, title = "D-S2" , color = DayS2Color, style = plot.style_line, linewidth =1) plot(DayS3R3 ? DayS3 : na, title = "D-S3" , color = DayS3Color, style = plot.style_line, linewidth =1) // Getting daywise Resistance levels DayR1 = security(syminfo.tickerid, "D", R1[1], barmerge.gaps_off, barmerge.lookahead_on) DayR2 = security(syminfo.tickerid, "D", R2[1], barmerge.gaps_off, barmerge.lookahead_on) DayR3 = security(syminfo.tickerid, "D", R3[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for daywise Support levels DayR1Color =DayR1 != DayR1[1] ? na : color.red DayR2Color =DayR2 != DayR2[1] ? na : color.red DayR3Color =DayR3 != DayR3[1] ? na : color.red //Plotting daywise Resistance levels plot(DayS1R1 ? DayR1 : na, title = "D-R1" , color = DayR1Color, style = plot.style_line, linewidth =1) plot(DayS2R2 ? DayR2 : na, title = "D-R2" , color = DayR2Color, style = plot.style_line, linewidth =1) plot(DayS3R3 ? DayR3 : na, title = "D-R3" , color = DayR3Color, style = plot.style_line, linewidth =1) //******************WEEKLY PIVOTS************************** // Getting Weely Pivot //WPivot = security(syminfo.tickerid, "W", pivot[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for Weely Pivot //WeeklyPivotColor =WPivot != WPivot[1] ? na : color.blue //Plotting Weely Pivot //plot(WeeklyPivotInclude ? WPivot:na, title = "W-P" , color = WeeklyPivotColor, style = plot.style_circles, linewidth =1) // Getting Weely Support levels //WS1 = security(syminfo.tickerid, "W", S1[1],barmerge.gaps_off, barmerge.lookahead_on) //WS1 = security(syminfo.tickerid, 'D', high[1]) //WS2 = security(syminfo.tickerid, "W", S2[1],barmerge.gaps_off, barmerge.lookahead_on) //WS3 = security(syminfo.tickerid, "W", S3[1],barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for weekly Support levels //WS1Color =WS1 != WS1[1] ? na : color.green //WS2Color =WS2 != WS2[1] ? na : color.green //WS3Color =WS3 != WS3[1] ? na : color.green //Plotting Weely Support levels //plot(WeeklyS1R1 ? WS1 : na, title = "W-S1" , color = WS1Color, style = plot.style_cross, linewidth =1) //plot(WeeklyS2R2 ? WS2 : na, title = "W-S2" , color = WS2Color, style = plot.style_cross, linewidth =1) //plot(WeeklyS3R3 ? WS3 : na, title = "W-S3" , color = WS3Color, style = plot.style_cross, linewidth =1) // Getting Weely Resistance levels //WR1 = security(syminfo.tickerid, "W", R1[1], barmerge.gaps_off, barmerge.lookahead_on) //WR2 = security(syminfo.tickerid, "W", R2[1], barmerge.gaps_off, barmerge.lookahead_on) //WR3 = security(syminfo.tickerid, "W", R3[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for weekly Resistance levels //WR1Color = WR1 != WR1[1] ? na : color.red //WR2Color = WR2 != WR2[1] ? na : color.red //WR3Color = WR3 != WR3[1] ? na : color.red //Plotting Weely Resistance levels //plot(WeeklyS1R1 ? WR1 : na , title = "W-R1" , color = WR1Color, style = plot.style_cross, linewidth =1) //plot(WeeklyS2R2 ? WR2 : na , title = "W-R2" , color = WR2Color, style = plot.style_cross, linewidth =1) //plot(WeeklyS3R3 ? WR3 : na , title = "W-R3" , color = WR3Color, style = plot.style_cross, linewidth =1) //******************MONTHLY PIVOTS************************** // Getting Monhly Pivot //MPivot = security(syminfo.tickerid, "M", pivot[1],barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for Monthly Support levels //MonthlyPivotColor =MPivot != MPivot[1] ? na : color.blue //Plotting Monhly Pivot //plot(MonthlyPivotInclude? MPivot:na, title = " M-P" , color = MonthlyPivotColor, style = plot.style_line, linewidth =1) // Getting Monhly Support levels //MS1 = security(syminfo.tickerid, "M", S1[1],barmerge.gaps_off, barmerge.lookahead_on) //MS2 = security(syminfo.tickerid, "M", S2[1],barmerge.gaps_off, barmerge.lookahead_on) //MS3 = security(syminfo.tickerid, "M", S3[1],barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for Montly Support levels //MS1Color =MS1 != MS1[1] ? na : color.green //MS2Color =MS2 != MS2[1] ? na : color.green //MS3Color =MS3 != MS3[1] ? na : color.green //Plotting Monhly Support levels //plot(MonthlyS1R1 ? MS1 : na, title = "M-S1" , color = MS1Color, style = plot.style_circles, linewidth =1) //plot(MonthlyS2R2 ? MS2 : na, title = "M-S2" , color = MS2Color, style = plot.style_circles, linewidth =1) //plot(MonthlyS3R3 ? MS3 : na, title = "M-S3" , color = MS3Color, style = plot.style_circles, linewidth =1) // Getting Monhly Resistance levels //MR1 = security(syminfo.tickerid, "M", R1[1],barmerge.gaps_off, barmerge.lookahead_on) //MR2 = security(syminfo.tickerid, "M", R2[1],barmerge.gaps_off, barmerge.lookahead_on) //MR3 = security(syminfo.tickerid, "M", R3[1],barmerge.gaps_off, barmerge.lookahead_on) //MR1Color =MR1 != MR1[1] ? na : color.red //MR2Color =MR2 != MR2[1] ? na : color.red //MR3Color =MR3 != MR3[1] ? na : color.red //Plotting Monhly Resistance levels //plot(MonthlyS1R1 ? MR1 : na , title = "M-R1", color = MR1Color, style = plot.style_circles , linewidth =1) //plot(MonthlyS2R2 ? MR2 : na , title = "M-R2" , color = MR2Color, style = plot.style_circles, linewidth =1) //plot(MonthlyS3R3 ? MR3 : na, title = "M-R3" , color = MR3Color, style = plot.style_circles, linewidth =1) //*****************************INDICATORs************************** //SMA PlotSMA = input(title = "Plot SMA?", type=input.bool, defval=true) SMALength = input(title="SMA Length", type=input.integer, defval=50) SMASource = input(title="SMA Source", type=input.source, defval=close) SMAvg = sma (SMASource, SMALength) plot(PlotSMA ? SMAvg : na, color= color.orange, title="SMA") //EMA PlotEMA = input(title = "Plot EMA?", type=input.bool, defval=true) EMALength = input(title="EMA Length", type=input.integer, defval=50) EMASource = input(title="EMA Source", type=input.source, defval=close) EMAvg = ema (EMASource, EMALength) plot(PlotEMA ? EMAvg : na, color= color.red, title="EMA") //EMA //PlotEMA1 = input(title = "Plot EMA?", type=input.bool, defval=true) //EMALength1 = input(title="EMA Length", type=input.integer, defval=20) //EMASource1 = input(title="EMA Source", type=input.source, defval=close) //EMAvg1 = ema (EMASource1, EMALength1) //plot(PlotEMA1 ? EMAvg : na, color= color.blue, title="EMA") //VWAP PlotVWAP = input(title = "Plot VWAP?", type=input.bool, defval=true) VWAPSource = input(title="VWAP Source", type=input.source, defval=close) VWAPrice = vwap (VWAPSource) plot(PlotVWAP ? VWAPrice : na, color= color.teal,linewidth = 2, title="VWAP") //SuperTrend PlotSTrend = input(title = "Plot Super Trend?", type=input.bool, defval=true) InputFactor=input(3, minval=1,maxval = 100, title="Factor") InputLength=input(10, minval=1,maxval = 100, title="Lenght") BasicUpperBand=hl2-(InputFactor*atr(InputLength)) BasicLowerBand=hl2+(InputFactor*atr(InputLength)) FinalUpperBand=0.0 FinalLowerBand=0.0 FinalUpperBand:=close[1]>FinalUpperBand[1]? max(BasicUpperBand,FinalUpperBand[1]) : BasicUpperBand FinalLowerBand:=close[1]<FinalLowerBand[1]? min(BasicLowerBand,FinalLowerBand[1]) : BasicLowerBand IsTrend=0.0 IsTrend:= close > FinalLowerBand[1] ? 1: close< FinalUpperBand[1]? -1: nz(IsTrend[1],1) STrendline = IsTrend==1? FinalUpperBand: FinalLowerBand linecolor = IsTrend == 1 ? color.green : color.red Plotline = (PlotSTrend? STrendline: na) plot(Plotline, color = linecolor , style = plot.style_line , linewidth = 1,title = "SuperTrend") PlotShapeUp = cross(close,STrendline) and close>STrendline PlotShapeDown = cross(STrendline,close) and close<STrendline //plotshape(PlotSTrend? PlotShapeUp: na, "Up Arrow", shape.triangleup,location.belowbar,color.green,0,0) //plotshape(PlotSTrend? PlotShapeDown: na , "Down Arrow", shape.triangledown , location.abovebar, color.red,0,0) //BB //@version=4 //study(shorttitle="BB", title="Bollinger Bands", overlay=true, resolution="") length = input(20, minval=1) src = input(close, title="Source") mult = input(2.0, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=98) //HL //D_High = security(syminfo.tickerid, 'D', high) //D_Low = security(syminfo.tickerid, 'D', low[1]) //D_Close = security(tickerid, 'D', close[1]) //D_Open = security(tickerid, 'D', open[1]) //DHColour = D_High != D_High ? na : color.red //DLColour = D_Low != D_Low[1] ? na : color.blue //TCColour = DayTC != DayTC[1] ? na : color.blue //plot(DailyHigh ? D_High : na, title="Daily High",style=plot.style_line,linewidth=1) //plot(DailyLow ? D_Low : na, title="Daily Low",style=plot.style_line, linewidth=1) //D_High = security(syminfo.tickerid, 'D', high[1]) //D_Low = security(syminfo.tickerid, 'D', low[1]) //D_Close = security(tickerid, 'D', close[1]) //D_Open = security(tickerid, 'D', open[1]) //plot(DailyHigh ? D_High : na, title="Daily High",style=plot.style_line,linewidth=1) //plot(DailyLow ? D_Low : na, title="Daily Low",style=plot.style_line, linewidth=1) //plot(isintraday ? D_High : na, title="Daily High",style=line, color=blue,linewidth=1) //plot(isintraday ? D_Low : na, title="Daily Low",style=line, color=blue,linewidth=1) //D W M show_pd = input(title="Show Prev Day H/L", defval=true) show_pw = input(title="Show Prev Week H/L", defval=true) show_pm = input(title="Show Prev Month H/L", defval=true) [pdh, pdl] = security(syminfo.ticker, "D", [high[1], low[1]], lookahead=true) plot(show_pd ? pdh : na, color=color.purple) plot(show_pd ? pdl : na, color=color.purple) [pwh, pwl] = security(syminfo.ticker, "W", [high[1], low[1]], lookahead=true) plot(show_pw ? pwh : na, color=color.purple, linewidth = 2) plot(show_pw ? pwl : na, color=color.purple, linewidth = 2) [pmh, pml] = security(syminfo.ticker, "M", [high[1], low[1]], lookahead=true) plot(show_pm ? pmh : na, color=color.red, linewidth = 3) plot(show_pm ? pml : na, color=color.red, linewidth = 3) //LABEL //on_off = input(title="On/Off ?", type=input.bool, defval=true) //position_option = input(title="Position ?", defval="Above", options=["Above", "Below"]) //l = label.new(bar_index, na, 'Price '+tostring(close), // color=close >= open ? color.green : color.red, // textcolor=color.white, // style=label.style_labeldown, yloc=yloc.abovebar) //label.delete(l[1]) // Plot Buy and Sell Labels //plotshape(MPivot, title = "Buy Signal", text ="BUY", textcolor = color.white, style=shape.labelup, size = size.normal, location=location.belowbar, color = color.green, transp = 0) //plotshape(PlotSMA, title = "Sell Signal", text ="SELL", textcolor = color.white, style=shape.labeldown, size = size.normal, location=location.abovebar, color = color.red, transp = 0) //Plot Buy Signal //buySignal = ST_Trend == 1 and ST_Trend[1] == -1 //buySignal = MPivot //plotshape(buySignal, title="UpTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0) //plotshape(buySignal, title="BUY", text="BUY", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0) plotshape(MPivot,style=shape.labeldown,location=location.absolute,color=color.blue,textcolor=color.black,show_last=1,text="M.Pivot",offset = 15,transp=30) plotshape(MBC,style=shape.labeldown,location=location.absolute,color=color.blue,textcolor=color.black,show_last=1,text="M.TC",offset = 15,transp=30) plotshape(MTC,style=shape.labeldown,location=location.absolute,color=color.blue,textcolor=color.black,show_last=1,text="M.BC",offset = 15,transp=30) plotshape(SMAvg,style=shape.labeldown,location=location.absolute,color=color.yellow,textcolor=color.black,show_last=1,text="sma",offset = 11,transp=30) plotshape(EMAvg,style=shape.labeldown,location=location.absolute,color=color.red,textcolor=color.black,show_last=1,text="ema",offset = 11,transp=30) plotshape(WkPivot,style=shape.labeldown,location=location.absolute,color=color.blue,textcolor=color.black,show_last=1,text="W.Pivot",offset = 15,transp=30) plotshape(WBC,style=shape.labeldown,location=location.absolute,color=color.blue,textcolor=color.black,show_last=1,text="W.BC",offset = 15,transp=30) plotshape(WTC,style=shape.labeldown,location=location.absolute,color=color.blue,textcolor=color.black,show_last=1,text="W.TC",offset = 15,transp=30) plotshape(DayPivot,style=shape.labeldown,location=location.absolute,color=color.blue,textcolor=color.black,show_last=1,text="D.Pivot",offset = 25,transp=30) plotshape(DayBC,style=shape.labeldown,location=location.absolute,color=color.blue,textcolor=color.black,show_last=1,text="D.BC",offset = 30,transp=30) plotshape(DayTC,style=shape.labeldown,location=location.absolute,color=color.blue,textcolor=color.black,show_last=1,text="D.TC",offset = 35,transp=30) plotshape(upper,style=shape.labeldown,location=location.absolute,color=color.green,textcolor=color.black,show_last=1,text="UBB",offset = 8,transp=30) plotshape(lower,style=shape.labeldown,location=location.absolute,color=color.green,textcolor=color.black,show_last=1,text="LBB",offset = 8,transp=30) plotshape(basis,style=shape.labeldown,location=location.absolute,color=color.green,textcolor=color.black,show_last=1,text="MBB",offset = 8,transp=30) plotshape(STrendline,style=shape.labeldown,location=location.absolute,color=color.red,textcolor=color.black,show_last=1,text="S.T.",offset = 15,transp=30) plotshape(VWAPrice,style=shape.labeldown,location=location.absolute,color=color.black,textcolor=color.black,show_last=1,text="VWAP",offset = 15,transp=30) plotshape(pdh,style=shape.labeldown,location=location.absolute,color=color.purple,textcolor=color.black,show_last=1,text="PD.HIGH",offset = 10,transp=30) plotshape(pdl,style=shape.labeldown,location=location.absolute,color=color.purple,textcolor=color.black,show_last=1,text="PD.LOW",offset = 10,transp=30) plotshape(pwh,style=shape.labeldown,location=location.absolute,color=color.purple,textcolor=color.black,show_last=1,text="PW.HIGH",offset = 10,transp=30) plotshape(pwl,style=shape.labeldown,location=location.absolute,color=color.purple,textcolor=color.black,show_last=1,text="PW.LOW",offset = 10,transp=30) //plotshape(pmh,style=shape.labeldown,location=location.absolute,color=color.purple,textcolor=color.black,show_last=1,text="PM.HIGH",offset = 10,transp=30) //plotshape(pml,style=shape.labeldown,location=location.absolute,color=color.purple,textcolor=color.black,show_last=1,text="PM.LOW",offset = 10,transp=30)