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
Cubic Bézier Curve Extrapolation [LuxAlgo]
https://www.tradingview.com/script/2GtawcFy-Cubic-B%C3%A9zier-Curve-Extrapolation-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
1,426
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("Cubic Bézier Curve Extrapolation [LuxAlgo]",overlay=true,max_lines_count=500) length = input(20,'Extrapolation Length') src = input(close,'Source') width = input(1,group='Style') up = input.color(#0cb51a,'Colors',group='Style',inline='inline1') dn = input.color(#ff1100,'',group='Style',inline='inline1') a = input.time(0,'P1',confirm=true,group='Anchor Points',inline='a') a_y = input.price(0,'P1 Value',confirm=true,group='Anchor Points',inline='a') b = input.time(0,'P2',confirm=true,group='Anchor Points',inline='b') b_y = input.price(0,'P2 Value',confirm=true,group='Anchor Points',inline='b') c = input.time(0,'P3',confirm=true,group='Anchor Points',inline='c') c_y = input.price(0,'P3 Value',confirm=true,group='Anchor Points',inline='c') d = input.time(0,'P4',confirm=true,group='Anchor Points',inline='d') d_y = input.price(0,'P4 Value',confirm=true,group='Anchor Points',inline='d') //---- n = bar_index var a_x = 0 var b_x = 0 var c_x = 0 var d_x = 0 //---- if time == a a_x := n if time == b b_x := n line.new(a,a_y,b,b_y,xloc=xloc.bar_time,color=color.gray) if time == c c_x := n line.new(b,b_y,c,c_y,xloc=xloc.bar_time,color=color.gray) if time == d d_x := n line.new(c,c_y,d,d_y,xloc=xloc.bar_time,color=color.gray) //---- diff = d_x - a_x var float y1 = na var float y2 = na if time == math.max(a,b,c,d) for i = 0 to diff+length k = i/diff y2 := a_y*math.pow(1 - k,3) + 3*b_y*math.pow(1 - k,2)*k + 3*c_y*(1 - k)*math.pow(k,2) + d_y*math.pow(k,3) css = y2 > y1 ? up : dn line.new(n-diff+i,y2,n-diff+i-1,y1,color=css,style=i > diff ? line.style_dotted : line.style_solid,width=width) y1 := y2
Countdown Interval Timer
https://www.tradingview.com/script/LT5sWPb9-Countdown-Interval-Timer/
a_dema
https://www.tradingview.com/u/a_dema/
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/ // © a_dema //@version=5 // Given the execution model of Pine Script is ticked-based, alerts based on this indicator will only trigger if there is a tick at the right time. // Specifically, a tick would be required between the event target (close of bar time, end of minute/s interval), less the Trigger Threshold (default = 5 seconds before). // // Alert instructions: // 1. Create new alert // 2. Select Condition options as: // a) This indicator & desired plot (Ti_Cl, Ti_01, Ti_02, Ti_03, Ti_04 or Ti_05) // b) 'Crossing Down' // c) This indicator & 'Trigger' // 3. Set Options to 'Once Per Minute' // // Note that if you change the input values of this indicator you will need to recreate the alert as it will not pick up the changes. // For example if you change 'Time interval 01' from 1 to 3, the alert will remain at 1 indicator(title="Countdown Interval Timer", shorttitle="CIT", overlay=true, scale=scale.none, precision=0, max_bars_back=1) inThreshold = input.int(title="Trigger Threshold (secs)", minval=1, maxval=60, step=1, defval=5) inTimeTo_01 = input.int(title="Time Interval 01 (minute)", minval=1, maxval=60, step=1, defval=1) inTimeTo_02 = input.int(title="Time Interval 02 (minute)", minval=1, maxval=60, step=1, defval=5) inTimeTo_03 = input.int(title="Time Interval 03 (minute)", minval=1, maxval=60, step=1, defval=15) inTimeTo_04 = input.int(title="Time Interval 04 (minute)", minval=1, maxval=60, step=1, defval=30) inTimeTo_05 = input.int(title="Time Interval 05 (minute)", minval=1, maxval=60, step=1, defval=60) // Extra symbol formula, to add possibility of having a tick each second. // Can use formulas such as + or * to include multiple symbols inExtraSymbolFormula = input.symbol(title="Extra Symbol Formula", defval="", tooltip="Specify an extra symbol formula to trigger time ticks, to supplement those of the chart symbol. Multiple symbol formula recommended, for example:\nFX:EURUSD*BINANCE:BTCUSD*OANDA:XAUUSD") var string sExtraSymbolFormula = "" if inExtraSymbolFormula == "" sExtraSymbolFormula := syminfo.tickerid else sExtraSymbolFormula := inExtraSymbolFormula s1 = request.security(sExtraSymbolFormula, timeframe.period, close) TimeToBarClose_Secs() => if (barstate.isrealtime) (time_close - timenow) / 1000 else timeframe.in_seconds(timeframe.period) TimeTo_01_Secs() => math.round((inTimeTo_01 * 60) - ((timenow / 1000) % (inTimeTo_01 * 60))) TimeTo_02_Secs() => math.round((inTimeTo_02 * 60) - ((timenow / 1000) % (inTimeTo_02 * 60))) TimeTo_03_Secs() => math.round((inTimeTo_03 * 60) - ((timenow / 1000) % (inTimeTo_03 * 60))) TimeTo_04_Secs() => math.round((inTimeTo_04 * 60) - ((timenow / 1000) % (inTimeTo_04 * 60))) TimeTo_05_Secs() => math.round((inTimeTo_05 * 60) - ((timenow / 1000) % (inTimeTo_05 * 60))) plot(series=TimeToBarClose_Secs(), title="Ti_Cl", color=color.new(color.blue, 100), show_last=1, display=display.status_line + display.data_window) plot(series=TimeTo_01_Secs(), title="Ti_01", color=color.new(color.blue, 100), show_last=1, display=display.status_line + display.data_window) plot(series=TimeTo_02_Secs(), title="Ti_02", color=color.new(color.blue, 100), show_last=1, display=display.status_line + display.data_window) plot(series=TimeTo_03_Secs(), title="Ti_03", color=color.new(color.blue, 100), show_last=1, display=display.status_line + display.data_window) plot(series=TimeTo_04_Secs(), title="Ti_04", color=color.new(color.blue, 100), show_last=1, display=display.status_line + display.data_window) plot(series=TimeTo_05_Secs(), title="Ti_05", color=color.new(color.blue, 100), show_last=1, display=display.status_line + display.data_window) plot(series=inThreshold, title="Trigger", color=color.new(color.blue, 100), show_last=1, display=display.none)
BankNifty - OBV
https://www.tradingview.com/script/x9OMNx3S-BankNifty-OBV/
gokoffline
https://www.tradingview.com/u/gokoffline/
110
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © gokoffline //@version=5 indicator(title="BankNifty - OBV", shorttitle="BankNifty - OBV", format=format.volume) vol_ticker = input.symbol("NSE:BANKNIFTY1!",title="Volume Symbol") src = input.source(close ,title="Source") anchor_res = input.timeframe("1D" ,title="Session") res = timeframe.period int i = na float _high1 = na float _low1 = na float v_high = na float v_low = na float v_close = na float sopen = na //float obv_out = na float cum_obv = na t = time(anchor_res, session.regular) is_first = na(t[1]) and not na(t) or t[1] < t i := is_first ?1:i[1]+1 float _volume = request.security(vol_ticker,res,volume) //if barstate.isfirst // obv_out:=0 //else // obv_out := src>src[1]?obv_out[1]+_volume:src<src[1]?obv_out[1]-_volume:obv_out[1] obv_out=ta.cum(math.sign(ta.change(src)) * _volume) sopen := is_first?request.security(syminfo.tickerid, anchor_res, open[1] ):sopen[1] //d_open //da00ff // Color high_color = sopen != sopen[1] ? na : color.new(#0e8f14,15) low_color = sopen != sopen[1] ? na : color.new(color.red,15) close_color = sopen != sopen[1] ? na : color.new(color.black,15) //obv_color = sopen != sopen[1] ? na : color.new(#3A6CA8,15) obv_color = color.new(#3A6CA8,15) plot(obv_out, color=obv_color, title="OnBalanceVolume") if is_first _high1 := obv_out _low1 := obv_out v_high := _high1[1] v_low := _low1 [1] v_close := obv_out[1] else _high1 := obv_out > _high1[1]? obv_out:_high1[1] _low1 := obv_out < _low1[1] ? obv_out:_low1[1] v_high := v_high [1] v_low := v_low [1] v_close := v_close[1] plot(v_high ,color=high_color) plot(v_low ,color=low_color) plot(v_close ,color=close_color) // Plot Avg cum_obv := is_first?obv_out:obv_out+cum_obv[1] plot(cum_obv/i,color=color.orange,linewidth=2) plot(0,color=color.maroon) //end
The Bounded Slope Indicator
https://www.tradingview.com/script/gTYXu41z-The-Bounded-Slope-Indicator/
Sofien-Kaabar
https://www.tradingview.com/u/Sofien-Kaabar/
61
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Sofien-Kaabar //@version=5 indicator("Slope") lookback = input(defval = 14, title = 'Lookback') lookback_rsi = input(defval = 14, title = 'RSI Lookback') slope = (close - close[lookback]) / lookback indicator = ta.rsi(slope, lookback_rsi) plot(indicator, color = indicator > 50? color.blue : color.red) hline(70) hline(30) hline(50)
Day/Week/Month/3M/6M/12M MTF breaks by makuchaku
https://www.tradingview.com/script/7wFmLfEb-Day-Week-Month-3M-6M-12M-MTF-breaks-by-makuchaku/
makuchaku
https://www.tradingview.com/u/makuchaku/
625
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/ // © makuchaku //@version=4 study("Day/Week/Month/3M/6M/12M MTF breaks by makuchaku", shorttitle="Day/Week/Month/3M/6M/12M MTF breaks", overlay=true, scale=scale.none) // workaround to apply this indicator to another indicator src = input(title="Source", type=input.source, defval=close) is_new(resolution) => t = time(resolution) not na(t) and (na(t[1]) or t > t[1]) is_new_month() => is_new('M') is_new_week() => is_new('W') is_new_quarter() => is_new("3M") is_new_half_year() => is_new("6M") is_new_year() => is_new("12M") is_new_day() => is_new("D") // plotting plot(is_new_day() ? 1 : na, style=plot.style_histogram, color=color.new(color.gray, 50), title='Day breaks') plot(is_new_week() ? 1 : na, style=plot.style_histogram, color=color.new(color.blue, 50), title='Week breaks') plot(is_new_month() ? 1 : na, style=plot.style_histogram, color=color.new(color.red, 50), title='Month breaks') plot(is_new_year() ? 1 : na, style=plot.style_histogram, color=color.new(color.gray, 50), title='Year breaks') plot(is_new_quarter() ? 1 : na, style=plot.style_histogram, color=color.new(color.gray, 50), title='Quarter breaks') plot(is_new_half_year() ? 1 : na, style=plot.style_histogram, color=color.new(color.gray, 50), title='Half year breaks')
MM Chop Filter Range Boxes
https://www.tradingview.com/script/CM6mLvgR-MM-Chop-Filter-Range-Boxes/
MoneyMovesInvestments
https://www.tradingview.com/u/MoneyMovesInvestments/
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/ // © MoneyMovesInvestments //@version=5 indicator("MM Chop Filter Range Boxes", shorttitle = "MM Chop Filter Range Boxes", overlay = true) show_chop = input.bool(true, "Show") cae_len = input.int(14, minval=1, title="Length", inline="cae1") cae_src = input.source(close, "Source", inline="cae1") ch_ut=input.float(60.0, "Choppy Range Thresholds: Upper", inline = "choppy1") ch_lt=input.float(40.0, "Lower", inline = "choppy1") bout_circ=input.bool(true,"Break-Out Circles",inline="choppy2") bin_cross=input.bool(true,"Break-In Crosses <- Choppy Range",inline="choppy2") buy_alerts = input.bool(true,"Buy", inline="caeal") sell_alerts = input.bool(true,"Sell", inline="caeal") choppy_alerts = input.bool(true,"Choppy <- Alerts", inline="caeal") //User has to agree to have the indi loading on the chart. var user_consensus = input.string(defval="", title="TYPE 'agree' TO ADD TO CHART. \nTrading involves a risk of loss, and may not be appropriate for every one. Please consider carefully if trading is appropriate for you. Past performance is not indicative of future results. Any and all indicator signals provided by 'MM Chop And Explode Chart' are for educational purposes only. Is your responsibility knowing that by typing 'agree' you are accepting that the AI would trade on your behalf at your own risk. \nRELEASE INFORMATION 2021 © Money Moves Investments", confirm = true, group="consensus") var icc = false if user_consensus == "agree" icc := true else icc := false cae_up = ta.rma(math.max(ta.change(cae_src), 0), cae_len) cae_down = ta.rma(-math.min(ta.change(cae_src), 0), cae_len) cae_rsi = cae_down == 0 ? 100 : cae_up == 0 ? 0 : 100 - (100 / (1 + cae_up / cae_down)) var is_chop = false var float chop_beg_h = na var float chop_beg_l = na var box chop_box = na var chop_cond = false chop_cond:= cae_rsi >= ch_lt and cae_rsi <= ch_ut if chop_cond and not is_chop[1] is_chop := true chop_beg_h:=high chop_beg_l:=low chop_box := icc and show_chop? box.new(bar_index, chop_beg_h, bar_index, chop_beg_l, bgcolor=color.new(color.orange,70), border_color=color.black):na else if chop_cond and is_chop[1] and is_chop box.set_right(chop_box, bar_index) if high>chop_beg_h box.set_top(chop_box, high) chop_beg_h:=high if low<chop_beg_l box.set_bottom(chop_box,low) chop_beg_l:=low else is_chop:=false chop_beg_h:=0.0 chop_beg_l:=0.0 choppy_bup = ta.crossover(cae_rsi, ch_ut) choppy_bdown = ta.crossunder(cae_rsi, ch_lt) up_to_choppy = ta.crossunder(cae_rsi, ch_ut) down_to_choppy = ta.crossover(cae_rsi, ch_lt) alertcondition(icc and choppy_bup and buy_alerts, "BUY", "Choppy Range Break-up") alertcondition(icc and choppy_bdown and sell_alerts, "SELL", "Choppy Range Break-down") alertcondition(icc and up_to_choppy and choppy_alerts, "BUY EXIT", "Got inside Choppy Range") alertcondition(icc and down_to_choppy and choppy_alerts, "SELL EXIT", "Got inside Choppy Range") plotshape(icc and choppy_bup and bout_circ, title="Choppy Range Break-ups",style=shape.circle,location=location.belowbar,color=color.aqua) plotshape(icc and choppy_bdown and bout_circ,title="Choppy Range Break-downs",style=shape.circle,location=location.abovebar,color=color.red) plotshape(icc and up_to_choppy and bin_cross, title="Choppy Range Down Break-Ins",style=shape.cross,location=location.abovebar,color=color.aqua) plotshape(icc and down_to_choppy and bin_cross,title="Choppy Range Up Break-Ins",style=shape.cross,location=location.belowbar,color=color.red)
IPDA operating range by makuchaku
https://www.tradingview.com/script/VvW0voGx-IPDA-operating-range-by-makuchaku/
makuchaku
https://www.tradingview.com/u/makuchaku/
1,682
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/ // © makuchaku //@version=4 study("IPDA operating range by makuchaku", shorttitle="IPDA operating range", overlay=true) // all timeframes <= 2H d_htf_h = security(syminfo.tickerid, "D", high, barmerge.gaps_off, barmerge.lookahead_on) d_htf_l = security(syminfo.tickerid, "D", low, barmerge.gaps_off, barmerge.lookahead_on) d_htf_h1 = security(syminfo.tickerid, "D", high[1], barmerge.gaps_off, barmerge.lookahead_on) d_htf_l1 = security(syminfo.tickerid, "D", low[1], barmerge.gaps_off, barmerge.lookahead_on) // all timeframes > 2H & < D w_htf_h = security(syminfo.tickerid, "W", high, barmerge.gaps_off, barmerge.lookahead_on) w_htf_l = security(syminfo.tickerid, "W", low, barmerge.gaps_off, barmerge.lookahead_on) w_htf_h1 = security(syminfo.tickerid, "W", high[1], barmerge.gaps_off, barmerge.lookahead_on) w_htf_l1 = security(syminfo.tickerid, "W", low[1], barmerge.gaps_off, barmerge.lookahead_on) // For Daily m_htf_h = security(syminfo.tickerid, "M", high, barmerge.gaps_off, barmerge.lookahead_on) m_htf_l = security(syminfo.tickerid, "M", low, barmerge.gaps_off, barmerge.lookahead_on) m_htf_h1 = security(syminfo.tickerid, "M", high[1], barmerge.gaps_off, barmerge.lookahead_on) m_htf_l1 = security(syminfo.tickerid, "M", low[1], barmerge.gaps_off, barmerge.lookahead_on) // For Weekly m6_htf_h = security(syminfo.tickerid, "6M", high, barmerge.gaps_off, barmerge.lookahead_on) m6_htf_l = security(syminfo.tickerid, "6M", low, barmerge.gaps_off, barmerge.lookahead_on) m6_htf_h1 = security(syminfo.tickerid, "6M", high[1], barmerge.gaps_off, barmerge.lookahead_on) m6_htf_l1 = security(syminfo.tickerid, "6M", low[1], barmerge.gaps_off, barmerge.lookahead_on) //////////////////// IPDA RANGE ////////////////// htf_h = 0.0 htf_l = 0.0 htf_h1 = 0.0 htf_l1 = 0.0 if timeframe.isintraday and timeframe.multiplier <= 120 htf_h := d_htf_h htf_l := d_htf_l htf_h1 := d_htf_h1 htf_l1 := d_htf_l1 if timeframe.isintraday and timeframe.multiplier > 120 htf_h := w_htf_h htf_l := w_htf_l htf_h1 := w_htf_h1 htf_l1 := w_htf_l1 if timeframe.period == "D" htf_h := m_htf_h htf_l := m_htf_l htf_h1 := m_htf_h1 htf_l1 := m_htf_l1 if timeframe.period == "W" htf_h := m6_htf_h htf_l := m6_htf_l htf_h1 := m6_htf_h1 htf_l1 := m6_htf_l1 range_high = htf_h1 if htf_h > htf_h1 range_high := htf_h range_low = htf_l1 if htf_l < htf_l1 range_low := htf_l range_50pc = range_low + ((range_high - range_low)/2) range_25pc = range_low + ((range_high - range_low)/4) range_75pc = range_low + (3*(range_high - range_low)/4) x_value_high = valuewhen((high >= range_high), bar_index, 0) x_value_low = valuewhen((low <= range_low), bar_index, 0) var line lh = na var line ll = na var line l50 = na var line l25 = na var line l75 = na if barstate.islast line.delete(lh) line.delete(ll) line.delete(l50) line.delete(l75) line.delete(l25) lh := line.new(x1=x_value_high, y1=range_high, x2=bar_index, y2=range_high, extend=extend.right, color=color.new(color.red, 0), style=line.style_dashed, width=2) ll := line.new(x1=x_value_low, y1=range_low, x2=bar_index, y2=range_low, extend=extend.right, color=color.new(color.green, 0), style=line.style_dashed, width=2) l50 := line.new(x1=bar_index-1, y1=range_50pc, x2=bar_index, y2=range_50pc, extend=extend.right, color=color.new(color.black, 50), style=line.style_dashed, width=2) l25 := line.new(x1=bar_index-1, y1=range_25pc, x2=bar_index, y2=range_25pc, extend=extend.right, color=color.new(color.gray, 75), style=line.style_dashed, width=2) l75 := line.new(x1=bar_index-1, y1=range_75pc, x2=bar_index, y2=range_75pc, extend=extend.right, color=color.new(color.gray, 75), style=line.style_dashed, width=2) //////////////////// IPDA RANGE //////////////////
Relative Strength
https://www.tradingview.com/script/EjEKIdlh-Relative-Strength/
WebPro_Expert
https://www.tradingview.com/u/WebPro_Expert/
97
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/ // © WebPro_Expert //@version=5 indicator("Relative Strength") f_barssince(_cond, _count) => _barssince = int(math.max(1, nz(bar_index - ta.valuewhen(_cond, bar_index, _count)))) _barssince var int dec = str.length(str.tostring(syminfo.mintick))-2 // Input showRsnhbp = input(true, 'Show RSNHBP') showRsnh = input(true, 'Show RSNH') alert = input(true, 'Alert') tf = input.string('3M', 'Timeframe', ['3M', '6M', '1Y']) correlationPair = input.symbol('SPX', 'Correlation Pair') emaLen1 = input(4, 'RS Line EMA 1 Length') emaLen2 = input(21, 'RS Line EMA 2 Length') labCol = input.color(color.white, 'Label Color') texCol = input.color(color.black, 'Text Color') // Establish look back length: Length = tf=='3M' ? 63 : tf=='6M' ? 126 : 252 // cpOpen = request.security(correlationPair, 'D', open , lookahead= barmerge.lookahead_on) cpClose = request.security(correlationPair, 'D', close, lookahead= barmerge.lookahead_on) cpHigh = request.security(correlationPair, 'D', high , lookahead= barmerge.lookahead_on) cpLow = request.security(correlationPair, 'D', low , lookahead= barmerge.lookahead_on) fFormatNumber(x)=> x<1?x*10 : x<0.1?x*100 : x<0.01? x*1000 : x<0.001? x*10000 : x<0.0001? x*100000 : x rsOpen = fFormatNumber(open / cpOpen ) rsClose = fFormatNumber(close / cpClose) rsHigh = fFormatNumber(high / cpHigh ) rsLow = fFormatNumber(low / cpLow ) // barcount notmalize ath atl rsLine = rsClose highestRs = ta.highest(rsClose, Length) rsnhbpCond = rsClose >= highestRs and close < ta.highest(close, Length)? highestRs : na rsnhCond = rsnhbpCond==na and rsClose==highestRs ? highestRs : na rsnhbp = rsnhbpCond? highestRs : na rsnh = rsnhCond ? highestRs : na // ------- // EMA rsLine emaRsLine1 = ta.ema(rsLine, emaLen1) emaRsLine2 = ta.ema(rsLine, emaLen2) // ------------ var barCount = 0 if na(close) if na(barCount[1]) barCount := 1 else barCount := barCount[1] + 1 else barCount = barCount[1] // Normalize Relative Strength newRngMax = 99 newRngMin = 1 var sinceFBar = 0 sinceFBar := request.security(syminfo.tickerid, "1M", f_barssince(na(rsClose[1]) and not na(rsClose), 0)) fGetHighest(dataSeries) => var float highestHigh = 0 if dataSeries > highestHigh highestHigh := dataSeries highestHigh fATH(dataSeries) => a = request.security(syminfo.tickerid, "", fGetHighest(dataSeries)) fGetLowest(dataSeries) => var float lowestLow = 9999999 if dataSeries < lowestLow lowestLow := dataSeries lowestLow fATL(dataSeries) => a = request.security(syminfo.tickerid, "", fGetLowest(dataSeries)) hhRsOpen = fATH(rsOpen ) llRsOpen = fATL(rsOpen ) hhRsClose = fATH(rsClose) llRsClose = fATL(rsClose) hhRsHigh = fATH(rsHigh ) llRsHigh = fATL(rsHigh ) hhRsLow = fATH(rsLow ) llRsLow = fATL(rsLow ) fNormalize(x__, hx, lx)=> int(((((newRngMax-newRngMin)*(x__-lx)) / (hx-lx)) + newRngMin)) normalizeRsClose = fNormalize(rsClose, hhRsClose, llRsClose) normalizeRsOpen = fNormalize(rsOpen , hhRsOpen , llRsOpen ) normalizeRsHigh = fNormalize(rsHigh , hhRsHigh , llRsHigh ) normalizeRsLow = fNormalize(rsLow , hhRsLow , llRsLow ) textLabel = 'RS: ' + str.tostring(normalizeRsClose) rsLabel = label.new(bar_index, rsClose, textLabel, style=label.style_label_left, color=labCol, textcolor=texCol) label.delete(rsLabel[1]) plot(normalizeRsClose, 'RS', color=color.new(color.red, 100), display=display.none) plot(rsClose, 'RS Close' , color=rsClose>rsClose[1]? #2b98f2 : #e358fb) plot(emaRsLine1, 'EMA RS 1', color=#decfb8) plot(emaRsLine2, 'EMA RS 2', color=#6fff2b) plot(showRsnhbp? rsnhbp:na , 'RSNHBP', style=plot.style_circles, color=#c45ee1, linewidth=3) plot(showRsnh ? rsnh:na , 'RSNH' , style=plot.style_circles, color=color.green, linewidth=3) if alert and rsnhbpCond alert("Relative Strength Line New Highs Before Price", alert.freq_once_per_bar_close) if alert and rsnhCond alert("Relative Strength Line New Highs", alert.freq_once_per_bar_close)
Down since Initial Price
https://www.tradingview.com/script/CTtbObTc-Down-since-Initial-Price/
lirre8
https://www.tradingview.com/u/lirre8/
19
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © lirre8 // // ========================================= // // Don't hesitate to send me a message if you have questions, noticed any bugs or have suggestions on improvements. // // ========================================= //@version=5 indicator(title="Down since Initial Price", shorttitle="DIP", overlay=true) DisplayCurrent = input(true, "Display from current price") DisplayLowest = input(true, "Display from lowest price") LabelColor = input(color.blue, "Label color") TextColor = input(color.black, "Text color") open_price = 0.0 open_price := barstate.isfirst ? open : open_price[1] low_price = 0.0 low_price := barstate.isfirst ? low : low < low_price[1] ? low : low_price[1] low_index = 0 low_index := barstate.isfirst ? 0 : low < low_price[1] ? bar_index : low_index[1] if DisplayLowest and barstate.islast and low_price < open_price txt = str.format("{0,number,percent} since initial price", (low_price - open_price) / open_price) label.new(low_index, 0, yloc=yloc.belowbar, text=txt, style=label.style_label_up, color=LabelColor, textcolor=TextColor) if DisplayCurrent and barstate.islast txt = str.format("{0,number,percent} since initial price", (close - open_price) / open_price) label.new(bar_index+1, close, text=txt, style=label.style_label_left)
VIX Monitor
https://www.tradingview.com/script/JwjTLx2e-VIX-Monitor/
DominatorTrades
https://www.tradingview.com/u/DominatorTrades/
22
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/ // © Dominator_Trades //@version=5 indicator('VIX Monitor') vixOpen = request.security('TVC:VIX', timeframe.period, open) vixHigh = request.security('TVC:VIX', timeframe.period, high) vixLow = request.security('TVC:VIX', timeframe.period, low) vixClose = request.security('TVC:VIX', timeframe.period, close) plotcandle(vixOpen, vixHigh, vixLow, vixClose, title='Vix', color=vixClose >= vixOpen ? color.green : color.red)
LinearityFinder
https://www.tradingview.com/script/F7I6y83D-linearityfinder/
AlexD169
https://www.tradingview.com/u/AlexD169/
14
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/ // © AlexD169 //@version=5 indicator(title="LinearityFinder") period = input(24) mixing = input(1000) smoothed_volume_tmp = ta.sma(volume, period) standart_deviation_tmp = ta.stdev(close, period) smoothed_volume_mixed = ta.stoch(smoothed_volume_tmp, smoothed_volume_tmp, smoothed_volume_tmp, mixing) standart_deviation_mixed = ta.stoch(standart_deviation_tmp, standart_deviation_tmp, standart_deviation_tmp, mixing) plot(smoothed_volume_mixed, title="Volume", color=color.yellow) plot(standart_deviation_mixed, title="StdDev", color=color.aqua)
Ratio MA100/MA200
https://www.tradingview.com/script/WDcmm7pw/
CepheidsPulses
https://www.tradingview.com/u/CepheidsPulses/
11
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/ // © peterbutterknife //@version=4 study("WeekMA100200") sma100 = sma(close, 100) sma200 = sma(close, 200) ratio = sma100/sma200 dif = log(sma100-sma200) Change = (ratio-ratio[120]) Time = input(1, minval=1) velocity=Change-Change[120] Velocity = Change/Time Delta_Velocity= (Velocity-Velocity[1]) aceleration = Delta_Velocity/Time Delta_Aceleration = (aceleration-aceleration[1]) // Plot values //plot(series=sma100, color=color.lime, linewidth=2) //plot(series=sma200, color=color.fuchsia, linewidth=2) plot(series=ratio, color=color.blue, linewidth=3) //plot(series=dif, color=color.blue, linewidth=2) //plot(series=velocity, color=color.purple, linewidth=2) //plot(series=aceleration, color=color.red, linewidth=3) //hline(0, title="Zero", color=color.gray, linestyle=hline.style_dashed)
Extreme Volumes
https://www.tradingview.com/script/QfvTPagG-Extreme-Volumes/
LucasVivien
https://www.tradingview.com/u/LucasVivien/
131
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/ // Scipt Author: © LucasVivien // Special credits: Matthew J. Slabosz / Zen & The Art of Trading //@version=4 study("Extreme Volumes") // Input LabelLoc = input(title="Label Location" , type=input.string , defval="Right", options=["Right", "Above", "Below"], tooltip="Label text = How many times the current volume has to be above to selected EMA to be considered extreme. Which corresponds (=) to X % of occurences over chart's total bars count") MAlenght = input(title="EMA Lenght" , type=input.integer, defval=200 , tooltip="EMA lookback period") Trigger = input(title="Extrem Volume Trigger", type=input.float , defval=5, step=0.1 , tooltip="Current volume has to be X times above EMA to be considered Extreme") // Volume Vol = volume MA = sma(Vol, MAlenght) ExtVol = Vol / MA ExtVolAlert = ExtVol >= Trigger // Counts var BarCount = 0 var ExtVolcount = 0 if close > 0 BarCount := BarCount + 1 if ExtVolAlert == true ExtVolcount := ExtVolcount + 1 // Label Location var LabelStyle = label.style_label_left if LabelLoc == "Above" LabelStyle := label.style_label_down if LabelLoc == "Below" LabelStyle := label.style_label_up // Plots plot(Vol , title="Volume" , color=ExtVolAlert ? color.yellow : close > open ? color.green : color.red, style=plot.style_columns) plot(MA , title="MA" , color=color.blue) plot(MA * Trigger, title="ExtVol*MA", color=color.yellow) Lab = label.new(bar_index, MA*Trigger, color=color.yellow, text="Volume " + tostring(Trigger) + "* > EMA" + tostring(MAlenght) + " (=) " + tostring(round(ExtVolcount/BarCount*100, 2)) + "%", style=LabelStyle) label.delete(Lab[1]) // Alert alertcondition(ExtVolAlert, title="Extreme Volume Alert", message="Extreme Volume alert for {{ticker}}")
Exponentially Deviating Moving Average (MZ EDMA)
https://www.tradingview.com/script/x5PyksrR-Exponentially-Deviating-Moving-Average-MZ-EDMA/
MightyZinger
https://www.tradingview.com/u/MightyZinger/
199
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('Exponentially Deviating Moving Average (MZ EDMA)', shorttitle='MZ EDMA', overlay=true) import MightyZinger/Chikou/3 as filter ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// Source Options ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // ─── Different Sources Options List ───► [ string SRC_Tv = 'Use traditional TradingView Sources ' string SRC_Wc = '(open+close+3(high+low))/8' string SRC_Wo = 'close+high+low-2*open' string SRC_Wu = '(close+5(high+low)-7(open))/4' string SRC_Wi = '(open+close+5(high+low))/12' string SRC_Exi = 'close>open ? high : low' string SRC_Exj = 'Heiken-ashi(close>open) ? high : low' string src_grp = 'Source Parameters' // ●───────── Inputs ─────────● { diff_src = input.string(SRC_Exi, '→ Different Sources Options', options=[SRC_Tv, SRC_Wc, SRC_Wo, SRC_Wu, SRC_Wi, SRC_Exi, SRC_Exj], group=src_grp) i_sourceSetup = input.source(close, 'Tradingview Source Setup', group=src_grp) i_Sym = input.bool(true, 'Apply Symmetrically Weighted Moving Average at the price source (May Result Repainting)', group=src_grp) // Heikinashi Candles for calculations f_ha_open() => haopen = float(na) haopen := na(haopen[1]) ? (open + close) / 2 : (nz(haopen[1]) + nz(ohlc4[1])) / 2 haopen h_open = f_ha_open() // Get Source src_o = diff_src == SRC_Wc ? (open+close+3*(high+low))/8 : diff_src == SRC_Wo ? close+high+low-2*open : diff_src == SRC_Wu ? (close+5*(high+low)-7*(open))/4 : diff_src == SRC_Wi ? (open+close+5*(high+low))/12 : diff_src == SRC_Exi ? (close > open ? high : low) : diff_src == SRC_Exj ? (ohlc4 > h_open ? high : low) : i_sourceSetup src_f = i_Sym ? ta.swma(src_o) : src_o // Symmetrically Weighted Moving Average? ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// string grp1 = 'MA Parameters' edma_Length = input.int(20, title='MA Length:', group=grp1) i_Symmetrical = input(true, '‍ Apply Symmetrically Weighted Moving Average at EDMA') ema1_Length = input.int(20, title='EMA 1 Length:', group=grp1) show_ema1 = input(true, '‍ Show EMA 1') ema2_Length = input.int(40, title='EMA 2 Length:', group=grp1) show_ema2 = input(false, '‍ Show EMA 2') s_len_panel = input(true, '‍ Show Length Info Panel') string grp2 = 'Chikou Filter Parameters' c_len = input.int(25, title='Chikou Period (Displaced Source)', group=grp2) c_bull_col = input.color(color.green, 'Bull Color  ', group = grp2, inline='c_col') c_bear_col = input.color(color.red, 'Bear Color  ', group = grp2, inline='c_col') c_rvsl_col = input.color(color.yellow, 'Consollidation/Reversal Color  ', group = grp2, inline='c_col') string grp3 = 'EMA Color Settings' ema1_col = input.color(#2962FF, 'EMA 1 Color  ', group = grp3, inline='e_col') ema2_col = input.color(#FF6D00, 'EMA 2 Color  ', group = grp3, inline='e_col') string grp4 = 'Trade Parameters' showSignals = input.bool(true, title='Show Cross Alerts', group=grp4) conf_chk = input.bool(false, title='Use Chikou Filter for Confirmation', group=grp4) ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // EDMA Function f_edma(src, len)=> var hexp = float(na) // Initiallizing Variables var lexp = float(na) var _hma = float(na) var _edma = float(na) float smoothness = 1.0 // Increasing smoothness will result in MA same as EMA h_len = int(len/1.5) // Length to be used in final calculation of Hull Moving Average // Defining Exponentially Expanding Moving Line hexp := na(hexp[1]) ? src : src >= hexp[1] ? src : hexp[1] + (src - hexp[1]) * (smoothness / (len + 1)) // Defining Exponentially Contracting Moving Line lexp := na(lexp[1]) ? hexp : src <= lexp[1] ? hexp : lexp[1] + (src - lexp[1]) * (smoothness / (len + 1)) // Calculating Hull Moving Average of resulted Exponential Moving Line with 3/2 of total length _hma := ta.wma(2 * ta.wma(lexp, h_len / 2) - ta.wma(lexp, h_len), math.round(math.sqrt(h_len))) _edma := _hma // EDMA will be equal to resulted smoothened Hull Moving Average _edma ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// edma = i_Symmetrical ? ta.swma(f_edma(src_f, edma_Length)) : f_edma(src_f, edma_Length) ema1 = ta.ema(src_f, ema1_Length) ema2 = ta.ema(src_f, ema2_Length) // Calling Chikou filter function from library to obtaing dynamic color of EDMA Band and also Chikou Trend [edma_col, _trend] = filter.chikou(src_f, c_len, high, low, c_bull_col, c_bear_col, c_rvsl_col) edma_plot = plot(edma, title='EDMA', color= edma_col , linewidth=4) // Plotting EDMA with dynamic color from Chikou Filter Function ema1_plot = plot(show_ema1 ? ema1 : na, title='EMA 1', color= ema1_col , linewidth=3) ema2_plot = plot(show_ema2 ? ema2 : na, title='EMA 2', color= ema2_col , linewidth=3) fill(ema1_plot , edma_plot, title = "Background", color = color.new(edma_col,70)) // Filling the bands inbetween EMA and EDMA // ─── Length Info Panel Function ───► [ len_panel_f()=> barLength = time + 14 * (time - time[1]) // Label to show live lengths of EDMA and EMA on chart _label_text = 'EDMA '+ str.tostring(edma_Length) + ' : ' + str.tostring(math.round(edma,3)) + '\n' + 'EMA '+ str.tostring(ema1_Length) + ' : ' + str.tostring(math.round(ema1,3)) len_label = label.new(barLength, low , _label_text, xloc.bar_time, yloc.price, color.black, label.style_label_left, color.white, size.normal, text.align_left) label.delete(len_label[1]) if barstate.islast and s_len_panel len_panel_f() ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Trade Signals and Alerts L1 = ema2 > edma // Weak Uptrend Condition L2 = ema1 > edma // Strong Uptrend Condition L3 = _trend == 1 // Chikou Filter Uptrend Condition S1 = ema2 < edma // Weak Downtrend Condition S2 = ema1 < edma // Strong Downtrend Condition S3 = _trend == -1 // Chikou Filter Downtrend Condition // Setting confirmation conditional operator for Chikou Filter weak_up = conf_chk ? L1 and L3 : L1 strong_up = conf_chk ? L2 and L3 : L2 weak_dn = conf_chk ? S1 and S3 : S1 strong_dn = conf_chk ? S2 and S3 : S2 // Defining condition equivalent to Crossover & Crossunder bool[] signal_a = array.from(weak_up, strong_up, weak_dn, strong_dn) var swing_a = array.new_int(2) f_signal()=> for i = 0 to 1 var sig = 0 if array.get(signal_a, i) and sig <= 0 sig := 1 if array.get(signal_a, i+2) and sig >= 0 sig := -1 array.set(swing_a, i, sig) f_signal() buy_weak = array.get(swing_a, 0) == 1 and array.get(swing_a, 0)[1] != 1 buy_strong = array.get(swing_a, 1) == 1 and array.get(swing_a, 1)[1] != 1 sell_weak = array.get(swing_a, 0) == -1 and array.get(swing_a, 0)[1] != -1 sell_strong = array.get(swing_a, 1) == -1 and array.get(swing_a, 1)[1] != -1 // Plotting Signals on Chart atrOver = 0.7 * ta.atr(5) // Atr to place alert shape on chart plotshape(showSignals and buy_strong ? (low - atrOver) : na, style=shape.triangleup, color=color.new(color.green, 30), location=location.absolute, text='Buy', size=size.small) plotshape(showSignals and sell_strong ? (high + atrOver) : na, style=shape.triangledown, color=color.new(color.red, 30), location=location.absolute, text='Sell', size=size.small) // Alerts alertcondition(buy_weak, "Weak Buy", "Possible long") alertcondition(buy_strong, "Strong Buy", "Go long") alertcondition(sell_weak, "Weak Sell", "Possible short") alertcondition(sell_strong, "Strong Sell", "Go short ")
Trading Panel
https://www.tradingview.com/script/bClJoZGj/
kruskakli
https://www.tradingview.com/u/kruskakli/
55
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/ // © kruskakli // // When trading, position sizing and risk calculation is the key to become successful. // // We need to keep the losses small and adjust the position size according to what // risk we are prepared to take for the planned Entry. // // Based on the Account Size and the max percentage we want to risk for any trade, // we calculate, for a number of fixed max Loss percentages: // // - The Position size, both in percent and in the selected currency. // - Number of shares to buy. // - Where to put the Stop Loss. // - Where a 1RTP (1 Risk amount Take Profit) level could be put . // // We also calculate the numbers based on the ATR times a multiple. // // The values are presented in a table format and will hopefully aid in selecting // a suitable Stop Loss (based on the chart sutuation) and hence the proper Position Size. // // We also allow for expressing the Account size in currencies other than USD. // Example: // // Account Size in USD and trading US stocks: select USD // Account Size in SEK but trading US stocks: select USDSEK // // //@version=4 study("Position Sizes", overlay=true) kaki1 = color.new(#fff68f, 0) text_sz = size.small src = close // Change in percent cpt(_x, _x1) => _cpt = ((_x / _x1) - 1) * 100 _cpt // Which account to display. whatAccount = input(title = "Display Account", defval = "Account 1", options = ["Account 1", "Account 2"]) useAccount = (whatAccount == "Account 1") ? 1 : 2 // // Account 1 // accSize = input(20000, title="Account 1 Size", group="Account 1", type=input.integer) accountRiskPercent_in = input(0.5, title="Account 1 Risk Size (%)", group="Account 1", type=input.float) accountRiskPercent = accountRiskPercent_in / 100 convert = input(title = "Convert to USD", defval = "USD", group="Account 1", options = ["USDSEK","USDEUR","USDCAD","USDAUD","USDGBP","USDJPY","USD","SEK","EUR","CAD","AUD","GBP","JPY"]) // Can't have security in an 'if'...sigh... cur = security(convert, timeframe.period, close) USDcur = float(cur) // Convert or do not convert...? if (convert == "USD") or (convert == "SEK") or (convert == "EUR") or (convert == "CAD") or (convert == "AUD") or (convert == "GBP") or(convert == "JPY") USDcur := 1.0 // // Account 2 // accSize2 = input(20000, title="Account 2 Size", group="Account 2", type=input.integer) accountRiskPercent_in2 = input(0.5, title="Account 2 Risk Size (%)", group="Account 2", type=input.float) accountRiskPercent2 = accountRiskPercent_in2 / 100 convert2 = input(title = "Convert to USD", defval = "USD", group="Account 2", options = ["USDSEK","USDEUR","USDCAD","USDAUD","USDGBP","USDJPY","USD","SEK","EUR","CAD","AUD","GBP","JPY"]) // Can't have security in an 'if'...sigh... cur2 = security(convert2, timeframe.period, close) USDcur2 = float(cur2) // Convert or do not convert...? if (convert2 == "USD") or (convert2 == "SEK") or (convert2 == "EUR") or (convert2 == "CAD") or (convert2 == "AUD") or (convert2 == "GBP") or (convert2 == "JPY") USDcur2 := 1.0 // // Input four Loss percentage levels. // slPercent1_in = input(2, title="1.Loss percent", group="Risk levels in percent", type=input.float) slPercent1 = slPercent1_in / 100 slPercent1str = tostring(slPercent1_in) slPercent2_in = input(3, title="2.Loss percent", group="Risk levels in percent", type=input.float) slPercent2 = slPercent2_in / 100 slPercent2str = tostring(slPercent2_in) slPercent3_in = input(4, title="3.Loss percent", group="Risk levels in percent", type=input.float) slPercent3 = slPercent3_in / 100 slPercent3str = tostring(slPercent3_in) slPercent4_in = input(5, title="4.Loss percent", group="Risk levels in percent", type=input.float) slPercent4 = slPercent4_in / 100 slPercent4str = tostring(slPercent4_in) // Calculate the Stop-Loss sl1 = close * (1 - slPercent1) sl1str = tostring(round(sl1,2)) sl2 = close * (1 - slPercent2) sl2str = tostring(round(sl2,2)) sl3 = close * (1 - slPercent3) sl3str = tostring(round(sl3,2)) sl4 = close * (1 - slPercent4) sl4str = tostring(round(sl4,2)) // Calculate the 1R Take Profit tp1 = close * (1 + slPercent1) tp1str = tostring(round(tp1,2)) tp2 = close * (1 + slPercent2) tp2str = tostring(round(tp2,2)) tp3 = close * (1 + slPercent3) tp3str = tostring(round(tp3,2)) tp4 = close * (1 + slPercent4) tp4str = tostring(round(tp4,2)) // // Account 1 // // Calculate the Position Percentage posPercent1 = accountRiskPercent / slPercent1 posPercent1str = tostring(round(posPercent1*100,2)) posPercent2 = accountRiskPercent / slPercent2 posPercent2str = tostring(round(posPercent2*100,2)) posPercent3 = accountRiskPercent / slPercent3 posPercent3str = tostring(round(posPercent3*100,2)) posPercent4 = accountRiskPercent / slPercent4 posPercent4str = tostring(round(posPercent4*100,2)) // Calculate the Position Size posSize1 = (accSize * (posPercent1)) / USDcur posSize1str = tostring(round(posSize1)) posSize2 = (accSize * (posPercent2)) / USDcur posSize2str = tostring(round(posSize2)) posSize3 = (accSize * (posPercent3)) / USDcur posSize3str = tostring(round(posSize3)) posSize4 = (accSize * (posPercent4)) / USDcur posSize4str = tostring(round(posSize4)) // Calculate the number of shares noShares1 = floor(posSize1 / close) noShares1str = tostring(noShares1) noShares2 = floor(posSize2 / close) noShares2str = tostring(noShares2) noShares3 = floor(posSize3 / close) noShares3str = tostring(noShares3) noShares4 = floor(posSize4 / close) noShares4str = tostring(noShares4) // // Account 2 // // Calculate the Position Percentage posPercent1_2 = accountRiskPercent2 / slPercent1 posPercent1str_2 = tostring(round(posPercent1_2*100,2)) posPercent2_2 = accountRiskPercent2 / slPercent2 posPercent2str_2 = tostring(round(posPercent2_2*100,2)) posPercent3_2 = accountRiskPercent2 / slPercent3 posPercent3str_2 = tostring(round(posPercent3_2*100,2)) posPercent4_2 = accountRiskPercent2 / slPercent4 posPercent4str_2 = tostring(round(posPercent4_2*100,2)) // Calculate the Position Size posSize1_2 = (accSize2 * (posPercent1_2)) / USDcur2 posSize1str_2 = tostring(round(posSize1_2)) posSize2_2 = (accSize2 * (posPercent2_2)) / USDcur2 posSize2str_2 = tostring(round(posSize2_2)) posSize3_2 = (accSize2 * (posPercent3_2)) / USDcur2 posSize3str_2 = tostring(round(posSize3_2)) posSize4_2 = (accSize2 * (posPercent4_2)) / USDcur2 posSize4str_2 = tostring(round(posSize4_2)) // Calculate the number of shares noShares1_2 = floor(posSize1_2 / close) noShares1str_2 = tostring(noShares1_2) noShares2_2 = floor(posSize2_2 / close) noShares2str_2 = tostring(noShares2_2) noShares3_2 = floor(posSize3_2 / close) noShares3str_2 = tostring(noShares3_2) noShares4_2 = floor(posSize4_2 / close) noShares4str_2 = tostring(noShares4_2) // Calculate ATR base Stop Loss. ATRLen = input(defval=14, title="ATR Length", group="ATR based Risk level", type=input.integer) ATRMul = input(defval=1, title="ATR multiple", group="ATR based Risk level", type=input.float) // Use ATR x Multiple to calculate the Stop Loss ATR = atr(ATRLen) ATRpercent = 1 - (close - ATR*ATRMul) / close ATRpercentStr = tostring(round(ATRpercent*100,2)) ATRslStr = tostring(round(close - (ATR*ATRMul),2)) ATRtpStr = tostring(round(close + (ATR*ATRMul),2)) // // Account 1 // ATRposPercent = accountRiskPercent / ATRpercent ATRposPercentStr = tostring(round(ATRposPercent*100,2)) ATRposSize = (accSize * (ATRposPercent)) / USDcur ATRposSizeStr = tostring(round(ATRposSize)) ATRnoShares = floor(ATRposSize / close) ATRnoSharesStr = tostring(ATRnoShares) // // Account 2 // ATRposPercent_2 = accountRiskPercent2 / ATRpercent ATRposPercentStr_2 = tostring(round(ATRposPercent_2*100,2)) ATRposSize_2 = (accSize2 * (ATRposPercent_2)) / USDcur2 ATRposSizeStr_2 = tostring(round(ATRposSize_2)) ATRnoShares_2 = floor(ATRposSize_2 / close) ATRnoSharesStr_2 = tostring(ATRnoShares_2) // // Construct the Table // tabLoc = input(title="Table Location", defval="Lower Right", group="Table Layout", options=["Upper Right","Middle Right","Lower Right"]) tabPos = (tabLoc == "Upper Right") ? position.top_right : (tabLoc == "Middle Right") ? position.middle_right : position.bottom_right // User selectable colors. text_col = input(title="Header Color", defval=color.yellow, group="Table Layout", type=input.color) value_col = input(title="Value Color", defval=color.white, group="Table Layout", type=input.color) atr_col = input(title="ATR Color", defval=kaki1, group="Table Layout", type=input.color) table t = table.new(tabPos, 6, 6, frame_color=color.gray, frame_width=1, border_color=color.gray, border_width=1) if barstate.islast and useAccount == 1 and timeframe.period != "M" table.cell(t, 0, 0, "SL%", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 1, 0, "Stop", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 2, 0, "1RTP", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 3, 0, "Pos%", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 4, 0, "PosSz", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 5, 0, "#", text_halign=text.align_center, text_size=text_sz, text_color=text_col) // table.cell(t, 0, 1, slPercent1str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 1, 1, sl1str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 2, 1, tp1str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 3, 1, posPercent1str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 4, 1, posSize1str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 5, 1, noShares1str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) // table.cell(t, 0, 2, slPercent2str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 1, 2, sl2str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 2, 2, tp2str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 3, 2, posPercent2str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 4, 2, posSize2str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 5, 2, noShares2str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) // table.cell(t, 0, 3, slPercent3str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 1, 3, sl3str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 2, 3, tp3str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 3, 3, posPercent3str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 4, 3, posSize3str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 5, 3, noShares3str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) // table.cell(t, 0, 4, slPercent4str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 1, 4, sl4str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 2, 4, tp4str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 3, 4, posPercent4str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 4, 4, posSize4str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 5, 4, noShares4str, text_halign=text.align_left, text_size=text_sz,text_color=value_col) // table.cell(t, 0, 5, ATRpercentStr, text_halign=text.align_left, text_size=text_sz, text_color=atr_col) table.cell(t, 1, 5, ATRslStr, text_halign=text.align_left, text_size=text_sz, text_color=atr_col) table.cell(t, 2, 5, ATRtpStr, text_halign=text.align_left, text_size=text_sz, text_color=atr_col) table.cell(t, 3, 5, ATRposPercentStr, text_halign=text.align_left, text_size=text_sz,text_color=atr_col) table.cell(t, 4, 5, ATRposSizeStr, text_halign=text.align_left, text_size=text_sz,text_color=atr_col) table.cell(t, 5, 5, ATRnoSharesStr, text_halign=text.align_left, text_size=text_sz,text_color=atr_col) if barstate.islast and useAccount == 2 and timeframe.period != "M" table.cell(t, 0, 0, "SL%", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 1, 0, "Stop", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 2, 0, "1RTP", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 3, 0, "Pos%", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 4, 0, "PosSz", text_halign=text.align_center, text_size=text_sz, text_color=text_col) table.cell(t, 5, 0, "#", text_halign=text.align_center, text_size=text_sz, text_color=text_col) // table.cell(t, 0, 1, slPercent1str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 1, 1, sl1str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 2, 1, tp1str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 3, 1, posPercent1str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 4, 1, posSize1str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 5, 1, noShares1str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) // table.cell(t, 0, 2, slPercent2str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 1, 2, sl2str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 2, 2, tp2str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 3, 2, posPercent2str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 4, 2, posSize2str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 5, 2, noShares2str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) // table.cell(t, 0, 3, slPercent3str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 1, 3, sl3str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 2, 3, tp3str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 3, 3, posPercent3str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 4, 3, posSize3str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 5, 3, noShares3str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) // table.cell(t, 0, 4, slPercent4str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 1, 4, sl4str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 2, 4, tp4str, text_halign=text.align_left, text_size=text_sz, text_color=value_col) table.cell(t, 3, 4, posPercent4str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 4, 4, posSize4str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) table.cell(t, 5, 4, noShares4str_2, text_halign=text.align_left, text_size=text_sz,text_color=value_col) // table.cell(t, 0, 5, ATRpercentStr, text_halign=text.align_left, text_size=text_sz, text_color=atr_col) table.cell(t, 1, 5, ATRslStr, text_halign=text.align_left, text_size=text_sz, text_color=atr_col) table.cell(t, 2, 5, ATRtpStr, text_halign=text.align_left, text_size=text_sz, text_color=atr_col) table.cell(t, 3, 5, ATRposPercentStr_2, text_halign=text.align_left, text_size=text_sz,text_color=atr_col) table.cell(t, 4, 5, ATRposSizeStr_2, text_halign=text.align_left, text_size=text_sz,text_color=atr_col) table.cell(t, 5, 5, ATRnoSharesStr_2, text_halign=text.align_left, text_size=text_sz,text_color=atr_col)
MTF ATR Levels by makuchaku
https://www.tradingview.com/script/EpOUltZv-MTF-ATR-Levels-by-makuchaku/
makuchaku
https://www.tradingview.com/u/makuchaku/
616
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/ // © makuchaku //@version=5 indicator("MTF ATR Levels by makuchaku", overlay=true) atrPeriod = input.int(12, "atrPeriod") levelOffset = input.int(5, "levelOffset") timeFrame = input.timeframe('D', "timeFrame") mtf_atr = request.security(syminfo.tickerid, timeFrame, expression=ta.atr(atrPeriod)) mtf_close = request.security(syminfo.tickerid, timeFrame, expression=close[1]) // Above plotchar(mtf_close + (0.75*mtf_atr), char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.red, 80), size=size.large, title="+75% Range") plotchar(mtf_close + mtf_atr, char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.red, 60), size=size.large, title="+100% Range") plotchar(mtf_close + (1.5*mtf_atr), char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.red, 40), size=size.large, title="+150% Range") plotchar(mtf_close + (2*mtf_atr), char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.red, 20), size=size.large, title="+200% Range") plotchar(mtf_close + (3*mtf_atr), char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.red, 0), size=size.large, title="+300% Range") // Below plotchar(mtf_close - (0.75*mtf_atr), char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.green, 80), size=size.large, title="-75% Range") plotchar(mtf_close - mtf_atr, char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.green, 60), size=size.large, title="-100% Range") plotchar(mtf_close - (1.5*mtf_atr), char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.green, 40), size=size.large, title="-150% Range") plotchar(mtf_close - (2*mtf_atr), char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.green, 20), size=size.large, title="-200% Range") plotchar(mtf_close - (3*mtf_atr), char='―', show_last=1, location=location.absolute, offset=levelOffset, color=color.new(color.green, 0), size=size.large, title="-300% Range")
active buy/sell effectiveness
https://www.tradingview.com/script/61Q50cpT/
wzkkzw12345
https://www.tradingview.com/u/wzkkzw12345/
48
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/ // © wzkkzw12345 //@version=4 study(title="move easiness") res = input("1", type=input.resolution) length = input(12 , title="EMA length") length2 = input(72, title="Smoothing length") f_intrabarData(_chartTf) => // string _chartTf: chart TF in `timeframe.period` format. It is used to detect the first intrabar. var float up = 0. var float dn = 0. var float up_v = 0. var float dn_v = 0. var int _intrabars = na var int up_intrabars = na var int dn_intrabars = na abs_low = min(close[1], low) abs_high = max(close[1], high) if change(time(_chartTf)) // First intrabar detected: reset data. up_intrabars := 0 dn_intrabars := 0 _intrabars := 0 dn_v := 0 up_v := 0 up := 0 dn := 0 if close>close[1] up_intrabars += 1 up := log(close/close[1])//*total_volume up_v := volume*(abs_high-close[1])/(abs_high-abs_low) else if close< close[1] dn_intrabars += 1 dn := log(close[1]/close)//*total_volume dn_v :=volume*(close[1]-abs_low)/(abs_high-abs_low) else _intrabars += 1 if close>close[1] up_intrabars += 1 up += log(close/close[1])//*total_volume up_v += volume*(abs_high-close[1])/(abs_high-abs_low) else if close< close[1] dn_intrabars += 1 dn += log(close[1]/close)//*total_volume dn_v += volume*(close[1]-abs_low)/(abs_high-abs_low) [up, up_v, dn, dn_v, up_intrabars, dn_intrabars, _intrabars] _f_intrabarSqMove(_chartTf) => security(syminfo.tickerid, res, f_intrabarData(_chartTf)) //mean = security(syminfo.tickerid, "1", sma(log(close/open), 1440)) [up, up_v, dn, dn_v, up_intrabars, dn_intrabars, _intrabars] = if timeframe.period == "M" [a,b, c, d, e,f,g] = _f_intrabarSqMove("M") else if timeframe.period == "W" [a,b, c, d, e,f,g] = _f_intrabarSqMove("W") else if timeframe.period == "D" [a,b, c, d, e,f,g] =_f_intrabarSqMove("D") else if timeframe.period == "1440" [a,b, c, d, e,f,g] = _f_intrabarSqMove("1440") else if timeframe.period == "720" [a,b, c, d, e,f,g] = _f_intrabarSqMove("720") else if timeframe.period == "360" [a,b, c, d, e,f,g] = _f_intrabarSqMove("360") else if timeframe.period == "240" [a,b, c, d, e,f,g] = _f_intrabarSqMove("240") else if timeframe.period == "180" [a,b, c, d, e,f,g] = _f_intrabarSqMove("180") else if timeframe.period == "120" [a,b, c, d, e,f,g] =_f_intrabarSqMove("120") else if timeframe.period == "80" [a,b, c, d, e,f,g] = _f_intrabarSqMove("80") else if timeframe.period == "60" [a,b, c, d, e,f,g] = _f_intrabarSqMove("60") else if timeframe.period == "30" [a,b, c, d, e,f,g] = _f_intrabarSqMove("30") else if timeframe.period == "15" [a,b, c, d, e,f,g] = _f_intrabarSqMove("15") else if timeframe.period == "10" [a,b, c, d, e,f,g] = _f_intrabarSqMove("10") else if timeframe.period == "5" [a,b, c, d, e,f,g] = _f_intrabarSqMove("5") else if timeframe.period == "3" [a,b, c, d, e,f,g] = _f_intrabarSqMove("3") else [float(na), float(na), float(na), float(na), int(0), int(0), int(1)] //up_ema = ema(up*100000 , length) //up_v_ema = ema(up_v, length) //dn_ema = ema(dn*100000, length) //dn_v_ema = ema(dn_v, length) //plot(up_ema/up_v_ema,color=color.green) //plot(dn_ema/dn_v_ema,color=color.red) float up_result = na float dn_result = na up_reliability = sqrt(float(up_intrabars)) dn_reliability = sqrt(float(dn_intrabars)) up_reliability_ema = ema(up_reliability, length) dn_reliability_ema = ema(dn_reliability, length) up_result := up_v>0.?up*1000/up_v*(volume):up_result[1] dn_result := dn_v>0.?dn*1000/dn_v*(volume):dn_result[1] up_eff = ema(up_result*up_reliability, length)/ up_reliability_ema dn_eff = ema(dn_result*dn_reliability, length)/ dn_reliability_ema volume_ema=ema(volume,length) weighted_up_eff = up_eff/volume_ema*1000 weighted_dn_eff = dn_eff/volume_ema*1000 plot(weighted_up_eff,color=color.green, linewidth=2) plot(weighted_dn_eff,color=color.red, linewidth=2) range_high = highest(max(weighted_dn_eff, weighted_up_eff),length2) range_low = lowest(min(weighted_dn_eff, weighted_up_eff),length2) relative_width = sqrt(sqrt(sqrt(range_low/range_high))) plot(range_high/relative_width,color=color.red) plot(range_low * relative_width,color=color.green) volume_ema2 = ema(volume, length2) volume_times_log_weighted_up = log(weighted_up_eff)*volume volume_times_log_weighted_dn = log(weighted_dn_eff)*volume up_ema = exp(ema(volume_times_log_weighted_up,length2)/volume_ema2) //*hlc3 dn_ema = exp(ema(volume_times_log_weighted_dn,length2)/volume_ema2) plot((up_v!=0. and dn_v!=0.)? up_ema:na,color=color.new(color.green,30)) plot((up_v!=0. and dn_v!=0.)? dn_ema:na,color=color.new(color.red,30)) cross_UP = up_ema>dn_ema and up_ema[1]<dn_ema[1] cross_DN = up_ema<dn_ema and up_ema[1]>dn_ema[1] plot(cross_UP ? up_ema : na, title="Dots", color=color.new(color.green ,30), style=plot.style_circles, linewidth=4, editable=false) plot(cross_DN ? up_ema : na, title="Dots", color=color.new(color.red ,30), style=plot.style_circles, linewidth=4, editable=false) //plot(ema(ema((up*100000/up_v*volume-dn*100000/dn_v*volume), length)*(up_v-dn_v)/volume_ema,length),color=color.orange, linewidth=2) //hline(0.) //hline(0.84) //hline(1.16) //hline(2.1)
Market Indicator
https://www.tradingview.com/script/QCfkCDPm-Market-Indicator/
CepheidsPulses
https://www.tradingview.com/u/CepheidsPulses/
45
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © peterbutterknife //@version=4 study("MarketIndicator", overlay=false) ma20 = sma(close,20) ind = log(close/ma20) plot(ind,color=color.white) // Colour background backgroundRed = if ind<0 color.red backgroundGreen = if ind>0 color.lime bgcolor(backgroundRed, transp=40, title="Conditionally coloured background") bgcolor(backgroundGreen, transp=40)
Find Best Performing MA For Golden Cross
https://www.tradingview.com/script/bawUsb2e-Find-Best-Performing-MA-For-Golden-Cross/
KioseffTrading
https://www.tradingview.com/u/KioseffTrading/
168
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/ // © KioseffTrading // ----------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------- // Shoutout to Duyck (JD) for instructing how to sort the elements in one array based on the values of a separate array!!! // https://www.tradingview.com/script/Mzc4dmq7-ma-sorter-sort-by-array-example-JD/ <----- (Duyck's original array script) // ----------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------- // //@version=5 indicator("Find Best Performing MA For Golden Cross", overlay = true) dataType = input.string(defval = "Custom", title = "MA Lengths", options = ["50/200", "Custom"]) instructions = input.string(defval = "Off", title = "Indicator Instructions", options = ["Off", "On"]) smaS = input.string("Off", title = "SMA Type (For Plot)", options = ["Off", "SMA", "EMA", "ALMA", "HMA", "WMA", "VWMA", "LSMA"]) sma50 = ta.sma(close, 50) sma200 = ta.sma(close, 200) ema50 = ta.ema(close, 50) ema200 = ta.ema(close, 200) alma50 = ta.alma(close, 50, 0.85, 6) alma200 = ta.alma(close, 200, 0.85, 6) hma50 = ta.hma(close, 50) hma200 = ta.hma(close, 200) wma50 = ta.wma(close, 50) wma200 = ta.wma(close, 200) vwma50 = ta.vwma(close, 50) vwma200 = ta.vwma(close, 200) rma50 = ta.rma(close, 50) rma200 = ta.rma(close, 200) ls50 = ta.linreg(close, 50, 0) ls200 = ta.linreg(close, 200, 0) a = input.source(close, title = "MA Source") b = input.int(5, title = "Short MA Length", minval = 2) c = input.int(20, title = "Long MA Length", minval = 2) sma5 = ta.sma(a, b) sma20 = ta.sma(a, c) ema5 = ta.ema(a, b) ema20 = ta.ema(a, c) alma5 = ta.alma(a, b, 0.85, 6) alma20 = ta.alma(a, c, 0.85, 6) hma5 = ta.hma(a, b) hma20 = ta.hma(a, c) wma5 = ta.wma(a, b) wma20 = ta.wma(a, c) vwma5 = ta.vwma(a, b) vwma20 = ta.vwma(a, c) rma5 = ta.rma(a, b) rma20 = ta.rma(a, c) ls5 = ta.linreg(a, b, 0) ls20 = ta.linreg(a, c, 0) p1 = plot(smaS == "SMA" ? sma5 : smaS == "EMA" ? ema5 : smaS == "ALMA" ? alma5 : smaS == "HMA" ? hma5 : smaS == "WMA" ? wma5 : smaS == "VWMA" ? vwma5 : smaS == "LSMA" ? ls5 : na, color = #03ff00, linewidth = 2) p2 = plot(smaS == "SMA" ? sma20 : smaS == "EMA" ? ema20 : smaS == "ALMA" ? alma20 : smaS == "HMA" ? hma20 : smaS == "WMA" ? wma20 : smaS == "VWMA" ? vwma20 : smaS == "LSMA" ? ls20 : na, color = color.orange, linewidth = 2) // SMA var int smacount = 0 var int smacount2 = 0 var float smap = 0.0 var float smap1 = 0.0 var int counts = 0 var int counts1 = 0 if ta.crossover(sma50, sma200) and smacount == 0 smap := close smacount := 1 counts := bar_index if ta.crossunder(sma50, sma200) and smacount == 1 smacount := 0 smap1 := ((close / smap) - 1) * 100 smap1 := smap1[1] + smap1 smacount2 += 1 counts1 := bar_index - counts counts1 := counts1[1] + counts1 finsmap = (smap1 / smacount2) fincounts = counts1 / smacount2 // EMA var int emacount = 0 var int emacount2 = 0 var float emap = 0.0 var float emap1 = 0.0 var int counte = 0 var int counte1 = 0 if ta.crossover(ema50, ema200) and emacount == 0 emap := close emacount := 1 counte := bar_index if ta.crossunder(ema50, ema200) and emacount == 1 emacount := 0 emap1 := ((close / emap) - 1) * 100 emap1 := emap1[1] + emap1 emacount2 += 1 counte1 := bar_index - counte counte1 := counte1[1] + counte1 finemap = (emap1 / emacount2) fincounte = counte1 / emacount2 // ALMA var int almacount = 0 var int almacount2 = 0 var float almap = 0.0 var float almap1 = 0.0 var int counta = 0 var int counta1 = 0 if ta.crossover(alma50, alma200) and almacount == 0 almap := close almacount := 1 counta := bar_index if ta.crossunder(alma50, alma200) and almacount == 1 almacount := 0 almap1 := ((close / almap) - 1) * 100 almap1 := almap1[1] + almap1 almacount2 += 1 counta1 := bar_index - counta counta1 := counta1[1] + counta1 finalmap = (almap1 / almacount2) fincounta = counta1 / almacount2 // HMA var int hmacount = 0 var int hmacount2 = 0 var float hmap = 0.0 var float hmap1 = 0.0 var int counth = 0 var int counth1 = 0 if ta.crossover(hma50, hma200) and hmacount == 0 hmap := close hmacount := 1 counth := bar_index if ta.crossunder(hma50, hma200) and hmacount == 1 hmacount := 0 hmap1 := ((close / hmap) - 1) * 100 hmap1 := hmap1[1] + hmap1 hmacount2 += 1 counth1 := bar_index - counth counth1 := counth1[1] + counth1 finhmap = (hmap1 / hmacount2) fincounth = counth1 / hmacount2 // WMA var int wmacount = 0 var int wmacount2 = 0 var float wmap = 0.0 var float wmap1 = 0.0 var int countw = 0 var int countw1 = 0 if ta.crossover(wma50, wma200) and wmacount == 0 wmap := close wmacount := 1 countw := bar_index if ta.crossunder(wma50, wma200) and wmacount == 1 wmacount := 0 wmap1 := ((close / wmap) - 1) * 100 wmap1 := wmap1[1] + wmap1 wmacount2 += 1 countw1 := bar_index - countw countw1 := countw1[1] + countw1 finwmap = (wmap1 / wmacount2) fincountw = countw1 / wmacount2 // VWMA var int vwmacount = 0 var int vwmacount2 = 0 var float vwmap = 0.0 var float vwmap1 = 0.0 var int countvw = 0 var int countvw1 = 0 if ta.crossover(vwma50, vwma200) and vwmacount == 0 vwmap := close vwmacount := 1 countvw := bar_index if ta.crossunder(vwma50, vwma200) and vwmacount == 1 vwmacount := 0 vwmap1 := ((close / vwmap) - 1) * 100 vwmap1 := vwmap1[1] + vwmap1 vwmacount2 += 1 countvw1 := bar_index - countvw countvw1 := countvw1[1] + countvw1 finvwmap = (vwmap1 / vwmacount2) fincountvw = countvw1 / vwmacount2 // ls var int lscount = 0 var int lscount2 = 0 var float lsp = 0.0 var float lsp1 = 0.0 var int countls = 0 var int countls1 = 0 if ta.crossover(ls50, ls200) and lscount == 0 lsp := close lscount := 1 countls := bar_index if ta.crossunder(ls50, ls200) and lscount == 1 lscount := 0 lsp1 := ((close / lsp) - 1) * 100 lsp1 := lsp1[1] + lsp1 lscount2 += 1 countls1 := bar_index - countls countls1 := countls1[1] + countls1 finlsp = (lsp1 / lscount2) fincountls = countls1 / lscount2 // SMA var int smacountx = 0 var int smacount2x = 0 var float smapx = 0.0 var float smap1x = 0.0 var int countsx = 0 var int countsx1 = 0 if ta.crossover(sma5, sma20) and smacountx == 0 smapx := close smacountx := 1 countsx := bar_index if ta.crossunder(sma5, sma20) and smacountx == 1 smacountx := 0 smap1x := ((close / smapx) - 1) * 100 smap1x := smap1x[1] + smap1x smacount2x += 1 countsx1 := bar_index - countsx countsx1 := countsx1[1] + countsx1 finsmapx = (smap1x / smacount2x) fincountsx = countsx1 / smacount2x // EMA var int emacountx = 0 var int emacount2x = 0 var float emapx = 0.0 var float emap1x = 0.0 var int countex = 0 var int countex1 = 0 if ta.crossover(ema5, ema20) and emacountx == 0 emapx := close emacountx := 1 countex := bar_index if ta.crossunder(ema5, ema20) and emacountx == 1 emacountx := 0 emap1x := ((close / emapx) - 1) * 100 emap1x := emap1x[1] + emap1x emacount2x += 1 countex1 := bar_index - countex countex1 := countex1[1] + countex1 finemapx = (emap1x / emacount2x) fincountex = countex1 / emacount2x // ALMA var int almacountx = 0 var int almacount2x = 0 var float almapx = 0.0 var float almap1x = 0.0 var int countax = 0 var int countax1 = 0 if ta.crossover(alma5, alma20) and almacountx == 0 almapx := close almacountx := 1 countax := bar_index if ta.crossunder(alma5, alma20) and almacountx == 1 almacountx := 0 almap1x := ((close / almapx) - 1) * 100 almap1x := almap1x[1] + almap1x almacount2x += 1 countax1 := bar_index - countax countax1 := countax1[1] + countax1 finalmapx = (almap1x / almacount2x) fincountax = countax1 / almacount2x // HMA var int hmacountx = 0 var int hmacount2x = 0 var float hmapx = 0.0 var float hmap1x = 0.0 var int counthx = 0 var int counthx1 = 0 if ta.crossover(hma5, hma20) and hmacountx == 0 hmapx := close hmacountx := 1 counthx := bar_index if ta.crossunder(hma5, hma20) and hmacountx == 1 hmacountx := 0 hmap1x := ((close / hmapx) - 1) * 100 hmap1x := hmap1x[1] + hmap1x hmacount2x += 1 counthx1 := bar_index - counthx counthx1 := counthx1[1] + counthx1 finhmapx = (hmap1x / hmacount2x) fincounthx = counthx1 / hmacount2x // WMA var int wmacountx = 0 var int wmacount2x = 0 var float wmapx = 0.0 var float wmap1x = 0.0 var int countwx = 0 var int countwx1 = 0 if ta.crossover(wma5, wma20) and wmacountx == 0 wmapx := close wmacountx := 1 countwx := bar_index if ta.crossunder(wma5, wma20) and wmacountx == 1 wmacountx := 0 wmap1x := ((close / wmapx) - 1) * 100 wmap1x := wmap1x[1] + wmap1x wmacount2x += 1 countwx1 := bar_index - countwx countwx1 := countwx1[1] + countwx1 finwmapx = (wmap1x / wmacount2x) fincountwx = countwx1 / wmacount2x // VWMA var int vwmacountx = 0 var int vwmacount2x = 0 var float vwmapx = 0.0 var float vwmap1x = 0.0 var int countvwx = 0 var int countvwx1 = 0 if ta.crossover(vwma5, vwma20) and vwmacountx == 0 vwmapx := close vwmacountx := 1 countvwx := bar_index if ta.crossunder(vwma5, vwma20) and vwmacountx == 1 vwmacountx := 0 vwmap1x := ((close / vwmapx) - 1) * 100 vwmap1x := vwmap1x[1] + vwmap1x vwmacount2x += 1 countvwx1 := bar_index - countvwx countvwx1 := countvwx1[1] + countvwx1 finvwmapx= (vwmap1x / vwmacount2x) fincountvwx = countvwx1 / vwmacount2x // ls var int lscountx = 0 var int lscount2x = 0 var float lspx = 0.0 var float lsp1x = 0.0 var int countlsx = 0 var int countlsx1 = 0 if ta.crossover(ls5, ls20) and lscountx == 0 lspx := close lscountx := 1 countlsx := bar_index if ta.crossunder(ls5, ls20) and lscountx == 1 lscountx := 0 lsp1x := ((close / lspx) - 1) * 100 lsp1x := lsp1x[1] + lsp1x lscount2x += 1 countlsx1 := bar_index - countlsx countlsx1 := countlsx1[1] + countlsx1 finlspx = (lsp1x / lscount2x) fincountlsx = countlsx1 / lscount2x f_sort_by_array(_array1, _array2, _array3) => _array1_size = array.size(_array1) _array1_sorted = array.new_string(_array1_size) _array3_sorted = array.copy(_array3) _array2_sorted = array.copy(_array2) if _array1_size == array.size(_array2) and _array1_size == array.size(_array2) array.sort(_array2_sorted, order.descending) for i = 0 to _array1_size - 1 _sorted_value = array.get(_array2_sorted, i) _unsorted_index = math.max(0, array.indexof(_array2, _sorted_value)) _unsorted_value = array.get (_array1, _unsorted_index) _unsorted_value2 = array.get(_array3, _unsorted_index) array.set(_array1_sorted, i, _unsorted_value) array.set(_array3_sorted, i, _unsorted_value2) [_array1_sorted, _array2_sorted, _array3_sorted] orgname = array.new_string(7) org = array.new_float(7) org1 = array.new_float(7) orgname1 = array.new_string(7) sma = finsmap, array.set(orgname, 0, "SMA"), array.set(org, 0, dataType == "50/200" ? finsmap : finsmapx), array.set(org1, 0, dataType == "50/200" ? fincounts : fincountsx) ema = finemap, array.set(orgname, 1, "EMA"), array.set(org, 1, dataType == "50/200" ? finemap : finemapx), array.set(org1, 1, dataType == "50/200" ? fincounte : fincountex) alma = finalmap, array.set(orgname, 2, "ALMA"), array.set(org, 2, dataType == "50/200" ? finalmap : finalmapx), array.set(org1, 2, dataType == "50/200" ? fincounta : fincountax) hma = finhmap, array.set(orgname, 3, "HMA"), array.set(org, 3, dataType == "50/200" ? finhmap : finhmapx), array.set(org1, 3, dataType == "50/200" ? fincounth : fincounthx) wma = finwmap, array.set(orgname, 4, "WMA"), array.set(org, 4, dataType == "50/200" ? finwmap : finwmapx), array.set(org1, 4, dataType == "50/200" ? fincountw : fincountwx) vwma = finvwmap, array.set(orgname, 5, "VWMA"), array.set(org, 5, dataType == "50/200" ? finvwmap : finvwmapx), array.set(org1, 5, dataType == "50/200" ? fincountvw : fincountvwx) lsma = finlsp, array.set(orgname, 6, "LSMA"), array.set(org, 6,dataType == "50/200" ? finlsp : finlspx), array.set(org1, 6, dataType == "50/200" ? fincountls : fincountlsx) [orgname_sorted, org_sorted, org1_sorted] = f_sort_by_array(orgname, org, org1) sourceS = a == close ? "Close" : a == open ? "Open" : a == high ? "High" : a == low ? "Low" : a == hl2 ? "HL2" : a == hlc3 ? "HLC3" : a == ohlc4 ? "OHLC4" : a == hlcc4 ? "HLCC4" : a == ta.obv ? "OBV" : "Other" orgtext = "" table1 = table.new(position.bottom_right, 10, 10, bgcolor = color.new(color.white, 100)) if barstate.islast and dataType == "Custom" table.cell(table1, 0,0,text = "Golden Cross Performance" + "\n" + "\n" + str.tostring(b) + "/" + str.tostring(c) + " (" + sourceS + ")" , text_color = color.blue, text_size = size.normal) for i = 0 to array.size(org) - 1 orgtext := orgtext + array.get(orgname_sorted, i) + ": " + str.tostring(array.get(org_sorted, i), format.percent) + " (" +str.tostring(array.get(org1_sorted, i), '#') + " Candles" + ")" + "\n" +"\n" table.cell(table1, 0,1,text = orgtext, text_color = color.white) table.cell(table1, 0,2, text = (smaS == "SMA" ? "Short SMA Plotted" : smaS == "EMA" ? "Short EMA Plotted" : smaS == "ALMA" ? "Short ALMA Plotted" : smaS == "HMA" ? "Short HMA Plotted" : smaS == "WMA" ? "Short WMA Plotted" : smaS == "VWMA" ? "Short VWMA Plotted" : smaS == "LSMA" ? "Short LSMA Plotted" : na), text_color = #03ff00) table.cell(table1, 0,3, text = (smaS == "SMA" ? "Long SMA Plotted" : smaS == "EMA" ? "Long EMA Plotted" : smaS == "ALMA" ? "Long ALMA Plotted" : smaS == "HMA" ? "Long HMA Plotted" : smaS == "WMA" ? "Long WMA Plotted" : smaS == "VWMA" ? "Long VWMA Plotted" : smaS == "LSMA" ? "Long LSMA Plotted" : na), text_color = color.orange) else if barstate.islast and dataType != "Custom " table.cell(table1, 0,0,text = "Golden Cross Performance \n \n (50/200)" + " (" + sourceS + ")", text_color = color.blue, text_size = size.normal) for i = 0 to array.size(org) - 1 orgtext := orgtext + array.get(orgname_sorted, i) + ": " + str.tostring(array.get(org_sorted, i), format.percent) + " (" +str.tostring(array.get(org1_sorted, i), '#') + " Candles" + ")" + "\n" +"\n" table.cell(table1, 0,1,text = orgtext, text_color = color.white) table.cell(table1, 0,2, text = (smaS == "SMA" ? "Short SMA Plotted" : smaS == "EMA" ? "Short EMA Plotted" : smaS == "ALMA" ? "Short ALMA Plotted" : smaS == "HMA" ? "Short HMA Plotted" : smaS == "WMA" ? "Short WMA Plotted" : smaS == "VWMA" ? "Short VWMA Plotted" : smaS == "LSMA" ? "Short LSMA Plotted" : na), text_color = #03ff00) table.cell(table1, 0,3, text = (smaS == "SMA" ? "Long SMA Plotted" : smaS == "EMA" ? "Long EMA Plotted" : smaS == "ALMA" ? "Long ALMA Plotted" : smaS == "HMA" ? "Long HMA Plotted" : smaS == "WMA" ? "Long WMA Plotted" : smaS == "VWMA" ? "Long VWMA Plotted" : smaS == "LSMA" ? "Long LSMA Plotted" : na), text_color = color.orange) if instructions == "On" and barstate.islast table.cell(table1, 0,6, text = "The script calculates and compares asset performance after \nmoving average golden crossovers (short MA crossover long MA)" + "\n" + "\nThe best performing moving averages are listed in descending order!" + "\nWorks for any asset on any timeframe with any listed data source (i.e. open, high, close, rsi, stochastic%k, %b) !" + "\n" + "\n" + "The integers inside parentheses indicate the AVERAGE\n number of candles that the SHORTER MA\n remains above the LONGER MA following\n following a golden cross!", text_color = color.green)
Volume for NiftyBN
https://www.tradingview.com/script/9PtBBZ27-Volume-for-NiftyBN/
blackhole07
https://www.tradingview.com/u/blackhole07/
71
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/ // © blackhole07 //@version=4 study("Volume for NiftyBN", format=format.volume) nifty_volume = security("NSE:NIFTY1!", timeframe.period, volume) bn_volume = security("NSE:BANKNIFTY1!", timeframe.period, volume) v = if(syminfo.ticker == "NIFTY") nifty_volume else if (syminfo.ticker == "BANKNIFTY") bn_volume else volume palette = open > close ? color.red : color.green plot(v, color = palette, style=plot.style_columns, title="Volume", transp=65)
Makuchaku's Trade Tools - Pivots/Fractals & Crossovers
https://www.tradingview.com/script/VRkbRgCf-Makuchaku-s-Trade-Tools-Pivots-Fractals-Crossovers/
makuchaku
https://www.tradingview.com/u/makuchaku/
461
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/ // © makuchaku //@version=4 study("Makuchaku's Trade Tools - Pivots & Crossovers", overlay=true) pivotLookup = input(title="pivotLookup", type=input.integer, defval=1, group="Pivots") boxLength = input(title="boxLength", type=input.integer, defval=3, group="General", inline="General") boxTransparency = input(title="boxTransparency", type=input.integer, defval=95, group="General", inline="General") isUp(index) => close[index] > open[index] isDown(index) => close[index] < open[index] isObUp(index) => isDown(index+1) and isUp(index) and (close[index] > high[index+1]) isObDown(index) => isUp(index+1) and isDown(index) and (close[index] < low[index+1]) //////////////////// Pivots //////////////////// plotPivots = true hih = pivothigh(high, pivotLookup, pivotLookup) lol = pivotlow (low , pivotLookup, pivotLookup) top = valuewhen(hih, high[pivotLookup], 0) bottom = valuewhen(lol, low [pivotLookup], 0) plot(top, offset=-pivotLookup, linewidth=2, color=(top != top[1] ? na : (plotPivots ? color.silver : na)), title="pivotTop") plot(bottom, offset=-pivotLookup, linewidth=2, color=(bottom != bottom[1] ? na : (plotPivots ? color.silver : na)), title="pivotBottom") if crossover(close, top) box.new(left=bar_index, top=top, right=bar_index+boxLength, bottom=bottom, bgcolor=color.new(color.green, boxTransparency), border_color=color.new(color.green, 80)) if crossunder(close, bottom) box.new(left=bar_index, top=top, right=bar_index+boxLength, bottom=bottom, bgcolor=color.new(color.red, boxTransparency), border_color=color.new(color.red, 80)) //////////////////// Pivots ////////////////////
KINSKI RSI/RSX Divergence
https://www.tradingview.com/script/KtgSKFu9/
KINSKI
https://www.tradingview.com/u/KINSKI/
172
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/ // © KINSKI //@version=5 indicator('KINSKI RSI/RSX Divergence', shorttitle='RSI/RSX Divergence', format=format.price, precision=2, timeframe='', timeframe_gaps=true, overlay=false) //************ Colors color valColorsGreen = #00FF11 color valColorsGreenDark = #007007 color valColorsGreenLight = #82FFC9 color valColorsGreenLightDark = #498F70 color valColorsRed = #FF0004 color valColorsRedDark = #8A0002 color valColorsAqua = #00EEFF color valColorsAquaDark = #00919C color valColorsPurple = #9900FF color valColorsPurpleDark = #590094 color valColorsPink = #FF00D4 color valColorsPinkDark = #910079 color valColorsBearColor = color.red color valColorsBullColor = color.green color valColorsBearColorDark = valColorsRedDark color valColorsBullColorDark = valColorsGreenDark color valColorsTextColor = color.white color valColorsNaColor = color.new(color.white, 100) //********** Functions // Normalizes series with unknown min/max using historical min/max. // _src : series to rescale. // _min, _min: min/max values of rescaled series. // Example: _funcNormalize(ta.sma(_src, _len), -50, 50) _funcNormalize(_src, _min, _max) => var _historicMin = 10e10 var _historicMax = -10e10 _historicMin := math.min(nz(_src, _historicMin), _historicMin) _historicMax := math.max(nz(_src, _historicMax), _historicMax) _min + (_max - _min) * (_src - _historicMin) / math.max(_historicMax - _historicMin, 10e-10) // Smoothed Moving Average (SMMA) _funcSMMA(_src, _len) => tmpSMA = ta.sma(_src, _len) tmpVal = 0.0 tmpVal := na(tmpVal[1]) ? tmpSMA : (tmpVal[1] * (_len - 1) + _src) / _len return_1 = tmpVal return_1 // Triple EMA (TEMA) _funcTEMA(_src, _len) => ema1 = ta.ema(_src, _len) ema2 = ta.ema(ema1, _len) ema3 = ta.ema(ema2, _len) return_1 = 3 * (ema1 - ema2) + ema3 return_1 // Double Expotential Moving Average (DEMA) _funcDEMA(_src, _len) => return_2 = 2 * ta.ema(_src, _len) - ta.ema(ta.ema(_src, _len), _len) return_2 // Hull Moving Average (HMA) _funcHMA(_src, _len) => tmpVal = math.max(2, _len) return_3 = ta.wma(2 * ta.wma(_src, tmpVal / 2) - ta.wma(_src, tmpVal), math.round(math.sqrt(tmpVal))) return_3 // Exponential Hull Moving Average (EHMA) _funcEHMA(_src, _len) => tmpVal = math.max(2, _len) return_4 = ta.ema(2 * ta.ema(_src, tmpVal / 2) - ta.ema(_src, tmpVal), math.round(math.sqrt(tmpVal))) return_4 // Kaufman's Adaptive Moving Average (KAMA) _funcKAMA(_src, _len) => tmpVal = 0.0 sum_1 = math.sum(math.abs(_src - _src[1]), _len) sum_2 = math.sum(math.abs(_src - _src[1]), _len) tmpVal := nz(tmpVal[1]) + math.pow((sum_1 != 0 ? math.abs(_src - _src[_len]) / sum_2 : 0) * (0.666 - 0.0645) + 0.0645, 2) * (_src - nz(tmpVal[1])) return_5 = tmpVal return_5 // Variable Index Dynamic Average (VIDYA) _funcVIDYA(_src, _len) => _diff = ta.change(_src) _uppperSum = math.sum(_diff > 0 ? math.abs(_diff) : 0, _len) _lowerSum = math.sum(_diff < 0 ? math.abs(_diff) : 0, _len) _chandeMomentumOscillator = (_uppperSum - _lowerSum) / (_uppperSum + _lowerSum) _factor = 2 / (_len + 1) tmpVal = 0.0 tmpVal := _src * _factor * math.abs(_chandeMomentumOscillator) + nz(tmpVal[1]) * (1 - _factor * math.abs(_chandeMomentumOscillator)) return_6 = tmpVal return_6 // Coefficient of Variation Weighted Moving Average (COVWMA) _funcCOVWMA(_src, _len) => _coefficientOfVariation = ta.stdev(_src, _len) / ta.sma(_src, _len) _cw = _src * _coefficientOfVariation tmpVal = math.sum(_cw, _len) / math.sum(_coefficientOfVariation, _len) return_7 = tmpVal return_7 // Fractal Adaptive Moving Average (FRAMA) _funcFRAMA(_src, _len) => _coefficient = -4.6 _n3 = (ta.highest(high, _len) - ta.lowest(low, _len)) / _len _hd2 = ta.highest(high, _len / 2) _ld2 = ta.lowest(low, _len / 2) _n2 = (_hd2 - _ld2) / (_len / 2) _n1 = (_hd2[_len / 2] - _ld2[_len / 2]) / (_len / 2) _dim = _n1 > 0 and _n2 > 0 and _n3 > 0 ? (math.log(_n1 + _n2) - math.log(_n3)) / math.log(2) : 0 _alpha = math.exp(_coefficient * (_dim - 1)) _sc = _alpha < 0.01 ? 0.01 : _alpha > 1 ? 1 : _alpha tmpVal = _src tmpVal := ta.cum(1) <= 2 * _len ? _src : _src * _sc + nz(tmpVal[1]) * (1 - _sc) return_8 = tmpVal return_8 // Karobein _funcKarobein(_src, _len) => tmpMA = ta.ema(_src, _len) tmpUpper = ta.ema(tmpMA < tmpMA[1] ? tmpMA/tmpMA[1] : 0, _len) tmpLower = ta.ema(tmpMA > tmpMA[1] ? tmpMA/tmpMA[1] : 0, _len) tmpRescaleResult = (tmpMA/tmpMA[1]) / (tmpMA/tmpMA[1] + tmpLower) (2*((tmpMA/tmpMA[1]) / (tmpMA/tmpMA[1] + tmpRescaleResult * tmpUpper)) - 1) * 100 // calculate the moving average with the transferred settings _funcCalcMA(_type, _src, _len) => float ma = switch _type "COVWMA" => _funcCOVWMA(_src, _len) "DEMA" => _funcDEMA(_src, _len) "EMA" => ta.ema(_src, _len) "EHMA" => _funcEHMA(_src, _len) "HMA" => _funcHMA(_src, _len) "KAMA" => _funcKAMA(_src, _len) "RMA" => ta.rma(_src, _len) "SMA" => ta.sma(_src, _len) "SMMA" => _funcSMMA(_src, _len) "TEMA" => _funcTEMA(_src, _len) "FRAMA" => _funcFRAMA(_src, _len) "VWMA" => ta.vwma(_src, _len) "VIDYA" => _funcVIDYA(_src, _len) "WMA" => ta.wma(_src, _len) "Karobein" => _funcKarobein(_src, _len) => float(na) _funcCalcMaFinal(_type, _src, _len, _showBreakoutsOnOff, _obLevel, _osLevel, _colorDefault, _colorOverbought, _colorOversold) => tmpMA = _funcCalcMA(_type, _src, _len) tmpColor = tmpMA > _obLevel ? _colorOverbought : tmpMA < _osLevel ? _colorOversold : _colorDefault tmpColorFinal = _showBreakoutsOnOff ? tmpColor : _colorDefault [tmpMA, tmpColorFinal] _funcRSI(_src, _len, _showBreakoutsOnOff, _obLevel, _osLevel, _colorDefault, _colorOverbought, _colorOversold, _smoothingType, _smoothingPeriod) => tmpVal = ta.rsi(_src, _len) [tmpValAlternative] = _funcCalcMaFinal(_smoothingType, tmpVal, _smoothingPeriod, _showBreakoutsOnOff, _obLevel, _osLevel, _colorDefault, _colorOverbought, _colorOversold) tmpRSI = _smoothingType != 'DISABLED' ? tmpValAlternative : tmpVal tmpColor = tmpRSI > _obLevel ? _colorOverbought : tmpRSI < _osLevel ? _colorOversold : _colorDefault tmpColorFinal = _showBreakoutsOnOff ? tmpColor : _colorDefault [tmpRSI, tmpColorFinal] _funcRSX(_src, _len, _showBreakoutsOnOff, _obLevel, _osLevel, _colorDefault, _colorOverbought, _colorOversold, _smoothingType, _smoothingPeriod) => //---- Base script: RSX Divergence — SharkCIA by Jaggedsoft https://www.tradingview.com/script/ujh3sCzy-RSX-Divergence-SharkCIA/ f8 = 100 * _src f10 = nz(f8[1]) v8 = f8 - f10 f18 = 3 / (_len + 2) f20 = 1 - f18 f28 = 0.0 f28 := f20 * nz(f28[1]) + f18 * v8 f30 = 0.0 f30 := f18 * f28 + f20 * nz(f30[1]) vC = f28 * 1.5 - f30 * 0.5 f38 = 0.0 f38 := f20 * nz(f38[1]) + f18 * vC f40 = 0.0 f40 := f18 * f38 + f20 * nz(f40[1]) v10 = f38 * 1.5 - f40 * 0.5 f48 = 0.0 f48 := f20 * nz(f48[1]) + f18 * v10 f50 = 0.0 f50 := f18 * f48 + f20 * nz(f50[1]) v14 = f48 * 1.5 - f50 * 0.5 f58 = 0.0 f58 := f20 * nz(f58[1]) + f18 * math.abs(v8) f60 = 0.0 f60 := f18 * f58 + f20 * nz(f60[1]) v18 = f58 * 1.5 - f60 * 0.5 f68 = 0.0 f68 := f20 * nz(f68[1]) + f18 * v18 f70 = 0.0 f70 := f18 * f68 + f20 * nz(f70[1]) v1C = f68 * 1.5 - f70 * 0.5 f78 = 0.0 f78 := f20 * nz(f78[1]) + f18 * v1C f80 = 0.0 f80 := f18 * f78 + f20 * nz(f80[1]) v20 = f78 * 1.5 - f80 * 0.5 f88_ = 0.0 f90_ = 0.0 f88 = 0.0 f90_ := nz(f90_[1]) == 0 ? 1 : nz(f88[1]) <= nz(f90_[1]) ? nz(f88[1]) + 1 : nz(f90_[1]) + 1 f88 := nz(f90_[1]) == 0 and _len - 1 >= 5 ? _len - 1 : 5 f0 = f88 >= f90_ and f8 != f10 ? 1 : 0 f90 = f88 == f90_ and f0 == 0 ? 0 : f90_ v4_ = f88 < f90 and v20 > 0 ? (v14 / v20 + 1) * 50 : 50 tmpVal = v4_ > 100 ? 100 : v4_ < 0 ? 0 : v4_ [tmpValAlternative] = _funcCalcMaFinal(_smoothingType, tmpVal, _smoothingPeriod, _showBreakoutsOnOff, _obLevel, _osLevel, _colorDefault, _colorOverbought, _colorOversold) tmpRsx = _smoothingType != 'DISABLED' ? tmpValAlternative : tmpVal tmpColor = tmpRsx > _obLevel ? _colorOverbought : tmpRsx < _osLevel ? _colorOversold : _colorDefault tmpColorFinal = _showBreakoutsOnOff ? tmpColor : _colorDefault [tmpRsx, tmpColorFinal] _funcRange(_cond, _minLookbackRange, _maxLookbackRange) => bars = ta.barssince(_cond == true) _minLookbackRange <= bars and bars <= _maxLookbackRange _funcPivot(_src, _pivotLookbackLeft, _pivotLookbackRight, _pivotLookbackRangeMin, _pivotLookbackRangeMax) => // Pivot tmpPivotLowFound = na(ta.pivotlow(_src, _pivotLookbackLeft, _pivotLookbackRight)) ? false : true tmpPivotHighFound = na(ta.pivothigh(_src, _pivotLookbackLeft, _pivotLookbackRight)) ? false : true // Regular Bullish // Oscillator Higher Low tmpOscillatorHigherLow = _src[_pivotLookbackRight] > ta.valuewhen(tmpPivotLowFound, _src[_pivotLookbackRight], 1) and _funcRange(tmpPivotLowFound[1], _pivotLookbackRangeMin, _pivotLookbackRangeMax) // Price: Lower Low tmpPriceLowerLow = low[_pivotLookbackRight] < ta.valuewhen(tmpPivotLowFound, low[_pivotLookbackRight], 1) tmpBullishCondition = tmpPriceLowerLow and tmpOscillatorHigherLow and tmpPivotLowFound // Regular Bearish // Oscillator Lower High tmpOscillatorLowerHigh = _src[_pivotLookbackRight] < ta.valuewhen(tmpPivotHighFound, _src[_pivotLookbackRight], 1) and _funcRange(tmpPivotHighFound[1], _pivotLookbackRangeMin, _pivotLookbackRangeMax) // Price: Higher High tmpPriceHigherHigh = high[_pivotLookbackRight] > ta.valuewhen(tmpPivotHighFound, high[_pivotLookbackRight], 1) tmpBearishCondition = tmpPriceHigherHigh and tmpOscillatorLowerHigh and tmpPivotHighFound [tmpPivotLowFound, tmpPivotHighFound, tmpOscillatorHigherLow, tmpPriceLowerLow, tmpBullishCondition, tmpOscillatorLowerHigh, tmpPriceHigherHigh, tmpBearishCondition] _funcHistogram(_type, _src, _len) => tmpHistogramSignal = _funcCalcMA(_type, _src, _len) tmpHistogram = _src - tmpHistogramSignal iff_1 = tmpHistogram > nz(tmpHistogram[1]) ? valColorsGreen : valColorsGreenDark iff_2 = tmpHistogram < nz(tmpHistogram[1]) ? valColorsRed : valColorsRedDark tmpHistogramColor = tmpHistogram > 0 ? iff_1 : iff_2 [tmpHistogram, tmpHistogramColor] //********** Inputs inputCalculationSource = input(title='Calculation Source', defval=hlc3) // Histogram string inputHistogramVariant = input.string(title='Histogram: Variant', group="Histogram", defval='RSI', options=['DISABLED', 'RSI', 'RSX']) string inputHistogramType = input.string(title='Histogram: MA Type', group="Histogram", defval='SMA', options=['DISABLED', 'COVWMA', 'DEMA', 'EMA', 'EHMA', 'FRAMA', 'HMA', 'KAMA', 'Karobein', 'RMA', 'SMA', 'SMMA', 'TEMA', 'VIDYA', 'VWMA', 'WMA']) int inputHistogramLength = input.int(title='Histogram: Period', group="Histogram", defval=8, maxval=100) // RSI bool inputRsiEnable = input(title='RSI: On/Off', group="RSI", defval=true) bool inputRsiEnableVolumeBased = input(title='RSI: Volume Based Calculation On/Off', group="RSI", defval=false) bool inputRsiEnableDivergence = input(title='RSI: Show Divergence On/Off', group="RSI", defval=true) bool inputRsiEnableObLevel = input(title='RSI: Show Overboard/Oversold Breakouts On/Off', group="RSI", defval=false) int inputRsiLength = input.int(title='RSI: Period', group="RSI", minval=1, defval=14) string inputRsiSmoothingType = input.string(title='RSI: Smoothing Type', group="RSI", defval='DISABLED', options=['DISABLED', 'COVWMA', 'DEMA', 'EMA', 'EHMA', 'FRAMA', 'HMA', 'KAMA', 'Karobein', 'RMA', 'SMA', 'SMMA', 'TEMA', 'VIDYA', 'VWMA', 'WMA']) int inputRsiSmoothingPeriod = input.int(title='RSI: Smoothing Period', group="RSI", minval=1, defval=5) int inputRsiLineWidth = input.int(title='RSI: Line Width', group="RSI", minval=1, defval=2) int inputRsiTransparency = input.int(title='RSI: Transparency', group="RSI", defval=0, maxval=100) color inputRsiColorBreakoutDefault = input(title='RSI: Color', group="RSI", defval=valColorsPurple) color inputRsiColorBreakoutOverbought = input(title='RSI: Color Overbought', group="RSI", defval=valColorsRed) color inputRsiColorBreakoutOversold = input(title='RSI: Color Oversold', group="RSI", defval=valColorsGreen) // RSX bool inputRsxEnable = input(title='RSX: On/Off', group="RSX", defval=true) bool inputRsxEnableVolumeBased = input(title='RSX: Volume Based Calculation On/Off', group="RSX", defval=false) bool inputRsxEnableDivergence = input(title='RSX: Show Divergence On/Off', group="RSX", defval=false) bool inputRsxEnableObLevel = input(title='RSX: Show Overboard/Oversold Breakouts On/Off', group="RSX", defval=false) int inputRsxLength = input.int(title='RSX: Period', group="RSX", minval=1, defval=14) string inputRsxSmoothingType = input.string(title='RSX: Smoothing Type', group="RSX", defval='DISABLED', options=['DISABLED', 'COVWMA', 'DEMA', 'EMA', 'EHMA', 'FRAMA', 'HMA', 'KAMA', 'Karobein', 'RMA', 'SMA', 'SMMA', 'TEMA', 'VIDYA', 'VWMA', 'WMA']) int inputRsxSmoothingPeriod = input.int(title='RSX: Smoothing Period', group="RSX", minval=1, defval=5) int inputRsxLineWidth = input.int(title='RSX: Line Width', group="RSX", minval=1, defval=2) int inputRsxTransparency = input.int(title='RSX: Transparency', group="RSX", defval=0, maxval=100) color inputRsxColorBreakoutDefault = input(title='RSX: Color', group="RSX", defval=valColorsAquaDark) color inputRsxColorBreakoutOverbought = input(title='RSX: Color Overbought', group="RSX", defval=valColorsRed) color inputRsxColorBreakoutOversold = input(title='RSX: Color Oversold', group="RSX", defval=valColorsGreen) // Divergence Identification int inputPivotLookbackLeft = input(title='Divergence: Pivot Lookback Left', group="Divergence Identification", defval=5) int inputPivotLookbackRight = input(title='Divergence: Pivot Lookback Right', group="Divergence Identification", defval=5) int inputPivotLookbackRangeMin = input(title='Divergence: Min Lookback Range', group="Divergence Identification", defval=5) int inputPivotLookbackRangeMax = input(title='Divergence: Max Lookback Range', group="Divergence Identification", defval=18) // Levels: displaying Overbought, Oversold and Crossline Level bool inputLevelEnable = input(title='Level: On/Off', group="Levels", defval=true) int inputLevelOverBought = input(title='Level: Overbought', group="Levels", defval=70) int inputLevelOverSold = input(title='Level: Oversold', group="Levels", defval=30) int inputLevelCrossLine = input(title='Level: Crossline', group="Levels", defval=50) int inputLevelTransparency = input.int(title='Level: Transparency', group="Levels", defval=90, maxval=100) //********** Calculation float volumeBased = ta.cum(ta.change(inputCalculationSource) * volume) // RSI float inputCalculationSourceRsi = inputRsiEnableVolumeBased ? volumeBased : inputCalculationSource [valRsi, valRsiColor] = _funcRSI(inputCalculationSourceRsi, inputRsiLength, inputRsiEnableObLevel, inputLevelOverBought, inputLevelOverSold, inputRsiColorBreakoutDefault, inputRsiColorBreakoutOverbought, inputRsiColorBreakoutOversold, inputRsiSmoothingType, inputRsiSmoothingPeriod) // RSI: Pivot [valRsiPivotLowFound, valRsiPivotHighFound, valRsiPivotOscillatorHigherLow, valRsiPivotPriceLowerLow, valRsiPivotBullishCondition, valRsiPivotOscillatorLowerHigh, valRsiPivotPriceHigherHigh, valRsiPivotBearishCondition] = _funcPivot(valRsi, inputPivotLookbackLeft, inputPivotLookbackRight, inputPivotLookbackRangeMin, inputPivotLookbackRangeMax) // RSX float inputCalculationSourceRsx = inputRsxEnableVolumeBased ? volumeBased : inputCalculationSource [valRsx, valRsxColor] = _funcRSX(inputCalculationSourceRsx, inputRsxLength, inputRsxEnableObLevel, inputLevelOverBought, inputLevelOverSold, inputRsxColorBreakoutDefault, inputRsxColorBreakoutOverbought, inputRsxColorBreakoutOversold, inputRsxSmoothingType, inputRsxSmoothingPeriod) // RSX: Pivot [valRsxPivotLowFound, valRsxPivotHighFound, valRsxPivotOscillatorHigherLow, valRsxPivotPriceLowerLow, valRsxPivotBullishCondition, valRsxPivotOscillatorLowerHigh, valRsxPivotPriceHigherHigh, valRsxPivotBearishCondition] = _funcPivot(valRsx, inputPivotLookbackLeft, inputPivotLookbackRight, inputPivotLookbackRangeMin, inputPivotLookbackRangeMax) // Histogram valHistogramSource = inputHistogramVariant == 'RSI' ? valRsi : inputHistogramVariant == 'RSX' ? valRsx : na [valHistogram, valHistogramColor] = _funcHistogram(inputHistogramType, valHistogramSource, inputHistogramLength) //************ Plotting //**** Levels valLineOverBought = hline(inputLevelEnable ? inputLevelOverBought : na, title='Overbought', color=color.new(color.gray, 65), linestyle=hline.style_dashed, linewidth=1) valLineOverSold = hline(inputLevelEnable ? inputLevelOverSold : na, title='Oversold', color=color.new(color.gray, 45), linestyle=hline.style_dashed, linewidth=1) valLineCross = hline(inputLevelEnable ? inputLevelCrossLine : na, title='Cross', color=color.new(color.gray, 65), linestyle=hline.style_dashed, linewidth=1) fill(valLineOverBought, valLineOverSold, color=color.new(valColorsPink, inputLevelTransparency), editable=false) //**** RSI Histogram plot((inputHistogramVariant != 'DISABLED') ? valHistogram : na, style=plot.style_columns, color=valHistogramColor, linewidth=2) //**** RSI plot(inputRsiEnable ? valRsi : na, title='RSI', color=color.new(valRsiColor, inputRsiTransparency), linewidth=inputRsiLineWidth, style=plot.style_line) plot(inputRsiEnable and inputRsiEnableDivergence and valRsiPivotLowFound ? valRsi[inputPivotLookbackRight] : na, offset=-inputPivotLookbackRight, title='Regular Bullish', linewidth=3, color=valRsiPivotBullishCondition ? valColorsBullColor : valColorsNaColor) plotshape(inputRsiEnable and inputRsiEnableDivergence and valRsiPivotBullishCondition ? valRsi[inputPivotLookbackRight] : na, offset=-inputPivotLookbackRight, title='Regular Bullish Label', text='Bull', style=shape.labelup, location=location.absolute, color=color.new(valColorsBullColor, 0), textcolor=color.new(valColorsTextColor, 0)) plot(inputRsiEnable and inputRsiEnableDivergence and valRsiPivotHighFound ? valRsi[inputPivotLookbackRight] : na, offset=-inputPivotLookbackRight, title='Regular Bearish', linewidth=3, color=valRsiPivotBearishCondition ? valColorsBearColor : valColorsNaColor) plotshape(inputRsiEnable and inputRsiEnableDivergence and valRsiPivotBearishCondition ? valRsi[inputPivotLookbackRight] : na, offset=-inputPivotLookbackRight, title='Regular Bearish Label', text='Bear', style=shape.labeldown, location=location.absolute, color=color.new(valColorsBearColor, 0), textcolor=color.new(valColorsTextColor, 0)) //**** RSX plot(inputRsxEnable ? valRsx : na, title='RSX', linewidth=inputRsxLineWidth, color=color.new(valRsxColor, inputRsxTransparency)) plot(inputRsxEnable and inputRsxEnableDivergence and valRsxPivotLowFound ? valRsx[inputPivotLookbackRight] : na, offset=-inputPivotLookbackRight, title='Regular Bullish', linewidth=3, color=valRsxPivotBullishCondition ? valColorsBullColorDark : valColorsNaColor) plotshape(inputRsxEnable and inputRsxEnableDivergence and valRsxPivotBullishCondition ? valRsx[inputPivotLookbackRight] : na, offset=-inputPivotLookbackRight, title='Regular Bullish Label', text='Bull', style=shape.labelup, location=location.absolute, color=color.new(valColorsBullColorDark, 0), textcolor=color.new(valColorsTextColor, 0)) plot(inputRsxEnable and inputRsxEnableDivergence and valRsxPivotHighFound ? valRsx[inputPivotLookbackRight] : na, offset=-inputPivotLookbackRight, title='Regular Bearish', linewidth=3, color=valRsxPivotBearishCondition ? valColorsBearColorDark : valColorsNaColor) plotshape(inputRsxEnable and inputRsxEnableDivergence and valRsxPivotBearishCondition ? valRsx[inputPivotLookbackRight] : na, offset=-inputPivotLookbackRight, title='Regular Bearish Label', text='Bear', style=shape.labeldown, location=location.absolute, color=color.new(valColorsBearColorDark, 0), textcolor=color.new(valColorsTextColor, 0))
BTC buy/sell effectiveness
https://www.tradingview.com/script/cWL5bizS/
wzkkzw12345
https://www.tradingview.com/u/wzkkzw12345/
75
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © wzkkzw12345 //@version=4 study(title="BTC move easiness", resolution="60") res = input("1", type=input.resolution) length = input(12 , title="EMA length") length2 = input(72, title="Smoothing length") show_lines = input(true, title="show high/low levels (for 1H 1m)") f_intrabarBTCdata(res,_chartTf) => // string _chartTf: chart TF in `timeframe.period` format. It is used to detect the first intrabar. var float up = 0. var float dn = 0. var float up_v = 0. var float dn_v = 0. var float v = 0. var int up_intrabars = na var int dn_intrabars = na total_volume = volume + sign(change(close))*(security("BINANCE:BTCBUSD", res, sign(change(close))*volume)+security("KUCOIN:BTCUSDT", res, sign(change(close))*volume)+security("COINBASE:BTCUSD", res, sign(change(close))*volume)+security("FTX:BTCUSDT",res, sign(change(close))*volume)/hlc3+security("FTX:BTCUSD",res, sign(change(close))*volume)/hlc3 +security("BITFINEX:BTCUSD",res, sign(change(close))*volume)) abs_low = min(close[1], low) abs_high = max(close[1], high) if change(time(_chartTf)) // First intrabar detected: reset data. up_intrabars := 0 dn_intrabars := 0 v := total_volume dn_v := 0 up_v := 0 up := 0 dn := 0 if close>close[1] up_intrabars += 1 up := log(close/close[1])//*total_volume up_v := total_volume*(abs_high-close[1])/(abs_high-abs_low) else if close< close[1] dn_intrabars += 1 dn := log(close[1]/close)//*total_volume dn_v :=total_volume*(close[1]-abs_low)/(abs_high-abs_low) else v += total_volume if close>close[1] up_intrabars += 1 up += log(close/close[1])//*total_volume up_v += total_volume*(abs_high-close[1])/(abs_high-abs_low) else if close< close[1] dn_intrabars += 1 dn += log(close[1]/close)//*total_volume dn_v += total_volume*(close[1]-abs_low)/(abs_high-abs_low) [up, up_v, dn, dn_v, v, up_intrabars, dn_intrabars] _f_intrabarBTCMove(_chartTf) => security("BINANCE:BTCUSDT", res, f_intrabarBTCdata(res,_chartTf)) //mean = security(syminfo.tickerid, "1", sma(log(close/open), 1440)) [up, up_v, dn, dn_v, v, up_intrabars, dn_intrabars] = if timeframe.period == "M" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("M") else if timeframe.period == "W" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("W") else if timeframe.period == "D" [a,b, c, d, e,f,g] =_f_intrabarBTCMove("D") else if timeframe.period == "1440" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("1440") else if timeframe.period == "720" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("720") else if timeframe.period == "360" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("360") else if timeframe.period == "240" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("240") else if timeframe.period == "180" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("180") else if timeframe.period == "120" [a,b, c, d, e,f,g] =_f_intrabarBTCMove("120") else if timeframe.period == "60" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("60") else if timeframe.period == "30" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("30") else if timeframe.period == "15" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("15") else if timeframe.period == "10" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("10") else if timeframe.period == "5" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("5") else if timeframe.period == "3" [a,b, c, d, e,f,g] = _f_intrabarBTCMove("3") else [float(na), float(na), float(na), float(na), float(na), int(1), int(1)] //up_ema = ema(up*100000 , length) //up_v_ema = ema(up_v, length) //dn_ema = ema(dn*100000, length) //dn_v_ema = ema(dn_v, length) //plot(up_ema/up_v_ema,color=color.green) //plot(dn_ema/dn_v_ema,color=color.red) float up_result = na float dn_result = na up_reliability = sqrt(float(up_intrabars)) dn_reliability = sqrt(float(dn_intrabars)) up_reliability_ema = ema(up_reliability, length) dn_reliability_ema = ema(dn_reliability, length) up_result := up_v>0.?up*1000/up_v*(v):up_result[1] dn_result := dn_v>0.?dn*1000/dn_v*(v):dn_result[1] up_eff = ema(up_result*up_reliability, length)/ up_reliability_ema dn_eff = ema(dn_result*dn_reliability, length)/ dn_reliability_ema volume_ema=ema(v,length)/1000 weighted_up_eff = up_eff/volume_ema weighted_dn_eff = dn_eff/volume_ema plot(weighted_up_eff,color=color.green, linewidth=2) plot(weighted_dn_eff,color=color.red, linewidth=2) range_high = highest(max(weighted_dn_eff, weighted_up_eff),length2) range_low = lowest(min(weighted_dn_eff, weighted_up_eff),length2) relative_width = sqrt(sqrt(sqrt(range_low/range_high))) plot(range_high /relative_width,color=color.red) plot(range_low *relative_width,color=color.green) volume_ema2 = ema(v, length2) volume_times_log_weighted_up = log(weighted_up_eff)*v volume_times_log_weighted_dn = log(weighted_dn_eff)*v up_ema = exp(ema(volume_times_log_weighted_up,length2)/volume_ema2) //*hlc3 dn_ema = exp(ema(volume_times_log_weighted_dn,length2)/volume_ema2) plot((up_intrabars!=0. and dn_intrabars!=0.)? up_ema:na,color=color.new(color.green,30)) plot((up_intrabars!=0. and dn_intrabars!=0.)? dn_ema:na,color=color.new(color.red,30)) cross_UP = up_ema>dn_ema and up_ema[1]<dn_ema[1] cross_DN = up_ema<dn_ema and up_ema[1]>dn_ema[1] plot(cross_UP ? up_ema : na, title="Dots", color=color.new(color.green ,30), style=plot.style_circles, linewidth=4, editable=false) plot(cross_DN ? up_ema : na, title="Dots", color=color.new(color.red ,30), style=plot.style_circles, linewidth=4, editable=false) //plot(ema(ema((up*100000/up_v*volume-dn*100000/dn_v*volume), length)*(up_v-dn_v)/volume_ema,length),color=color.orange, linewidth=2) //hline(0.) hline(show_lines?13.87:na, color=color.purple) hline(show_lines?6.31:na, color=color.purple) //hline(2.1)
Makuchaku's Trade Tools - Fair Value Gaps
https://www.tradingview.com/script/0Uavi8yy-Makuchaku-s-Trade-Tools-Fair-Value-Gaps/
makuchaku
https://www.tradingview.com/u/makuchaku/
501
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/ // © makuchaku //@version=4 study("Makuchaku's Trade Tools - Fair Value Gaps", overlay=true) boxLength = input(title="boxLength", type=input.integer, defval=3, group="General", inline="General") boxTransparency = input(title="boxTransparency", type=input.integer, defval=95, group="General", inline="General") isUp(index) => close[index] > open[index] isDown(index) => close[index] < open[index] isObUp(index) => isDown(index+1) and isUp(index) and (close[index] > high[index+1]) isObDown(index) => isUp(index+1) and isDown(index) and (close[index] < low[index+1]) //////////////////// FVG ////////////////// bullishFvg = (low[0] > high[2]) bearishFvg = (high[0] < low[2]) if bullishFvg box.new(left=bar_index-2, top=low[0], right=bar_index+boxLength, bottom=high[2], bgcolor=color.new(color.black, boxTransparency), border_color=color.new(color.black, boxTransparency)) if bearishFvg box.new(left=bar_index-2, top=low[2], right=bar_index+boxLength, bottom=high[0], bgcolor=color.new(color.black, boxTransparency), border_color=color.new(color.black, boxTransparency)) //////////////////// FVG //////////////////
Makuchaku's Trade Tools - Order Blocks
https://www.tradingview.com/script/57AqoZME-Makuchaku-s-Trade-Tools-Order-Blocks/
makuchaku
https://www.tradingview.com/u/makuchaku/
749
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/ // © makuchaku //@version=4 study("Makuchaku's Trade Tools - Order Blocks", overlay=true) boxLength = input(title="boxLength", type=input.integer, defval=3, group="General", inline="General") boxTransparency = input(title="boxTransparency", type=input.integer, defval=95, group="General", inline="General") isUp(index) => close[index] > open[index] isDown(index) => close[index] < open[index] isObUp(index) => isDown(index+1) and isUp(index) and (close[index] > high[index+1]) isObDown(index) => isUp(index+1) and isDown(index) and (close[index] < low[index+1]) //////////////////// OB's ////////////////// if isObDown(1) box.new(left=bar_index-2, top=max(high[2], high[1]), right=bar_index+boxLength, bottom=low[2], bgcolor=color.new(color.purple, boxTransparency), border_color=color.new(color.purple, boxTransparency)) if isObUp(1) box.new(left=bar_index-2, top=high[2], right=bar_index+boxLength, bottom=min(low[2], low[1]), bgcolor=color.new(color.lime, boxTransparency), border_color=color.new(color.lime, boxTransparency)) //////////////////// OB's //////////////////
BTC Gravity Oscillator
https://www.tradingview.com/script/XNB6zCb7-BTC-Gravity-Oscillator/
nickolassteel
https://www.tradingview.com/u/nickolassteel/
70
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © nickolassteel //@version=5 indicator(title='BTC Gravity Oscillator', format=format.price, precision=1) //Variables BTC = request.security('BTCUSD', 'W', close) //COG BTCcog = ((ta.cog(BTC, 20)) + 12) * (10/6) fx = math.pow(math.e, -1 * ((bar_index - 250)* 0.01)) + 6.8 BTCadj = (BTCcog / fx) * 10 //Graph c_grad = color.from_gradient(BTCadj, 0, 10, color.rgb(0, 500, 0, 25), color.rgb(500, 0, 0, 0)) plot(BTCadj, linewidth=2, color=c_grad) hline(5)
Simple FX Market Hours
https://www.tradingview.com/script/VzEOqxCS-Simple-FX-Market-Hours/
BongHuyn
https://www.tradingview.com/u/BongHuyn/
72
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/ // © BongHuyn //@version=5 indicator('Simple FX Market Hours', overlay=true) color DEF_IN_SESS_COL = color.new(#00de94, 0) color DEF_OUT_SESS_COL = color.black var string tz_info = input.string(defval = "GMT+0", title = "Timezone", options=["GMT-12", "GMT-11", "GMT-10", "GMT-9", "GMT-8", "GMT-7", "GMT-6", "GMT-5", "GMT-4", "GMT-3", "GMT-2", "GMT-1", "GMT+0", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5", "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12"]) var string table_position = input.string(defval = "Top Right", title = "Session Position", options = ["Top Left", "Top Center", "Top Right", "Middle Left", "Middle Center", "Middle Right", "Bottom Left", "Bottom Center", "Bottom Right"]) var color in_sess_col = input.color(DEF_IN_SESS_COL, "In Session") var color out_sess_col = input.color(DEF_OUT_SESS_COL, "out Session") var bool override_sess = input.bool(false, "Override", tooltip="Because this indicator doesn't support daylight saving yet! So this is a temporary way for you to override the session time.", group="Override") var string sydney_sess_override = input.session("2200-0700", "Sydney Session", group="Override") var string tokyo_sess_override = input.session("0000-0900", "Tokyo Session", group="Override") var string london_sess_override = input.session("0800-1700", "London Session", group="Override") var string newyork_sess_override = input.session("1300-2200", "Newyork Session", group="Override") var int weekend_start_end_override = input.int(22, "Weekend", tooltip="Weekend Start & End. For example, for GMT+0 timezone the weekend start from 22:00 (10PM) on Friday and end at 22:00 (10PM) on Sunday", group="Override") var string t_pos = switch table_position "Top Left" => position.top_left "Top Center" => position.top_center "Top Right" => position.top_right "Middle Left" => position.middle_left "Middle Center" => position.middle_center "Middle Right" => position.middle_right "Bottom Left" => position.bottom_left "Bottom Center" => position.bottom_center "Bottom Right" => position.bottom_right var table ms_table = table.new(position = t_pos, columns = 4, rows = 1, bgcolor = color(na), frame_color = color(na), border_color = color.white, border_width = 1) var bool is_sym_forex = syminfo.type == "forex" if is_sym_forex table.cell(ms_table, 0, 0, " SYDNEY ", text_color = out_sess_col) table.cell(ms_table, 1, 0, " TOKYO ", text_color = out_sess_col) table.cell(ms_table, 2, 0, " LONDON ", text_color = out_sess_col) table.cell(ms_table, 3, 0, " NEW YORK ", text_color = out_sess_col) var string SYDNEY_SESS_GMT_0 = "2200-0700" var string TOKYO_SESS_GMT_0 = "0000-0900" var string LONDON_SESS_GMT_0 = "0800-1700" var string NEWYORK_SESS_GMT_0 = "1300-2200" var int WEEKEND_GMT_0 = 22 var string SYDNEY_SESS_GMT_1 = "2300-0800" var string TOKYO_SESS_GMT_1 = "0100-1000" var string LONDON_SESS_GMT_1 = "0900-1800" var string NEWYORK_SESS_GMT_1 = "1400-2300" var string SYDNEY_SESS_GMT_2 = "0000-0900" var string TOKYO_SESS_GMT_2 = "0200-1100" var string LONDON_SESS_GMT_2 = "1000-1900" var string NEWYORK_SESS_GMT_2 = "1500-0000" var string SYDNEY_SESS_GMT_3 = "0100-1000" var string TOKYO_SESS_GMT_3 = "0300-1200" var string LONDON_SESS_GMT_3 = "1100-2000" var string NEWYORK_SESS_GMT_3 = "1600-0100" var string SYDNEY_SESS_GMT_4 = "0200-1100" var string TOKYO_SESS_GMT_4 = "0400-1300" var string LONDON_SESS_GMT_4 = "1200-2100" var string NEWYORK_SESS_GMT_4 = "1700-0200" var string SYDNEY_SESS_GMT_5 = "0300-1200" var string TOKYO_SESS_GMT_5 = "0500-1400" var string LONDON_SESS_GMT_5 = "1300-2200" var string NEWYORK_SESS_GMT_5 = "1800-0300" var string SYDNEY_SESS_GMT_6 = "0400-1300" var string TOKYO_SESS_GMT_6 = "0600-1500" var string LONDON_SESS_GMT_6 = "1400-2300" var string NEWYORK_SESS_GMT_6 = "1900-0400" var string SYDNEY_SESS_GMT_7 = "0500-1400" var string TOKYO_SESS_GMT_7 = "0700-1600" var string LONDON_SESS_GMT_7 = "1500-0000" var string NEWYORK_SESS_GMT_7 = "2000-0500" var string SYDNEY_SESS_GMT_8 = "0600-1500" var string TOKYO_SESS_GMT_8 = "0800-1700" var string LONDON_SESS_GMT_8 = "1600-0100" var string NEWYORK_SESS_GMT_8 = "2100-0600" var string SYDNEY_SESS_GMT_9 = "0700-1600" var string TOKYO_SESS_GMT_9 = "0900-1800" var string LONDON_SESS_GMT_9 = "1700-0200" var string NEWYORK_SESS_GMT_9 = "2200-0700" var string SYDNEY_SESS_GMT_10 = "0800-1700" var string TOKYO_SESS_GMT_10 = "1000-1900" var string LONDON_SESS_GMT_10 = "1800-0300" var string NEWYORK_SESS_GMT_10 = "2300-0800" var string SYDNEY_SESS_GMT_11 = "0900-1800" var string TOKYO_SESS_GMT_11 = "1100-2000" var string LONDON_SESS_GMT_11 = "1900-0400" var string NEWYORK_SESS_GMT_11 = "0000-0900" var string SYDNEY_SESS_GMT_12 = "1000-1900" var string TOKYO_SESS_GMT_12 = "1200-2100" var string LONDON_SESS_GMT_12 = "2000-0500" var string NEWYORK_SESS_GMT_12 = "0100-1000" var string SYDNEY_SESS_GMT_01 = "2100-0600" var string TOKYO_SESS_GMT_01 = "2300-0800" var string LONDON_SESS_GMT_01 = "0700-1600" var string NEWYORK_SESS_GMT_01 = "1200-2100" var string SYDNEY_SESS_GMT_02 = "2000-0500" var string TOKYO_SESS_GMT_02 = "2200-0700" var string LONDON_SESS_GMT_02 = "0600-1500" var string NEWYORK_SESS_GMT_02 = "1100-2000" var string SYDNEY_SESS_GMT_03 = "1900-0400" var string TOKYO_SESS_GMT_03 = "2100-0600" var string LONDON_SESS_GMT_03 = "0500-1400" var string NEWYORK_SESS_GMT_03 = "1000-1900" var string SYDNEY_SESS_GMT_04 = "1800-0300" var string TOKYO_SESS_GMT_04 = "2000-0500" var string LONDON_SESS_GMT_04 = "0400-1300" var string NEWYORK_SESS_GMT_04 = "0900-1800" var string SYDNEY_SESS_GMT_05 = "1700-0200" var string TOKYO_SESS_GMT_05 = "1900-0400" var string LONDON_SESS_GMT_05 = "0300-1200" var string NEWYORK_SESS_GMT_05 = "0800-1700" var string SYDNEY_SESS_GMT_06 = "1600-0100" var string TOKYO_SESS_GMT_06 = "1800-0300" var string LONDON_SESS_GMT_06 = "0200-1100" var string NEWYORK_SESS_GMT_06 = "0700-1600" var string SYDNEY_SESS_GMT_07 = "1500-0000" var string TOKYO_SESS_GMT_07 = "1700-0200" var string LONDON_SESS_GMT_07 = "0100-1000" var string NEWYORK_SESS_GMT_07 = "0600-1500" var string SYDNEY_SESS_GMT_08 = "1400-2300" var string TOKYO_SESS_GMT_08 = "1600-0100" var string LONDON_SESS_GMT_08 = "0000-0900" var string NEWYORK_SESS_GMT_08 = "0500-1400" var string SYDNEY_SESS_GMT_09 = "1300-2200" var string TOKYO_SESS_GMT_09 = "1500-0000" var string LONDON_SESS_GMT_09 = "2300-0800" var string NEWYORK_SESS_GMT_09 = "0400-1300" var string SYDNEY_SESS_GMT_010 = "1200-2100" var string TOKYO_SESS_GMT_010 = "1400-2300" var string LONDON_SESS_GMT_010 = "2200-0700" var string NEWYORK_SESS_GMT_010 = "0300-1200" var string SYDNEY_SESS_GMT_011 = "1100-2000" var string TOKYO_SESS_GMT_011 = "1300-2200" var string LONDON_SESS_GMT_011 = "2100-0600" var string NEWYORK_SESS_GMT_011 = "0200-1100" var string SYDNEY_SESS_GMT_012 = "1000-1900" var string TOKYO_SESS_GMT_012 = "1200-2100" var string LONDON_SESS_GMT_012 = "2000-0500" var string NEWYORK_SESS_GMT_012 = "0100-1000" var string sydney_sess = if override_sess sydney_sess_override else switch (tz_info) "GMT-12" => SYDNEY_SESS_GMT_012 "GMT-11" => SYDNEY_SESS_GMT_011 "GMT-10" => SYDNEY_SESS_GMT_010 "GMT-9" => SYDNEY_SESS_GMT_09 "GMT-8" => SYDNEY_SESS_GMT_08 "GMT-7" => SYDNEY_SESS_GMT_07 "GMT-6" => SYDNEY_SESS_GMT_06 "GMT-5" => SYDNEY_SESS_GMT_05 "GMT-4" => SYDNEY_SESS_GMT_04 "GMT-3" => SYDNEY_SESS_GMT_03 "GMT-2" => SYDNEY_SESS_GMT_02 "GMT-1" => SYDNEY_SESS_GMT_01 "GMT+0" => SYDNEY_SESS_GMT_0 "GMT+1" => SYDNEY_SESS_GMT_1 "GMT+2" => SYDNEY_SESS_GMT_2 "GMT+3" => SYDNEY_SESS_GMT_3 "GMT+4" => SYDNEY_SESS_GMT_4 "GMT+5" => SYDNEY_SESS_GMT_5 "GMT+6" => SYDNEY_SESS_GMT_6 "GMT+7" => SYDNEY_SESS_GMT_7 "GMT+8" => SYDNEY_SESS_GMT_8 "GMT+9" => SYDNEY_SESS_GMT_9 "GMT+10" => SYDNEY_SESS_GMT_10 "GMT+11" => SYDNEY_SESS_GMT_11 "GMT+12" => SYDNEY_SESS_GMT_12 => "" var string tokyo_sess = if override_sess tokyo_sess_override else switch tz_info "GMT-12" => TOKYO_SESS_GMT_012 "GMT-11" => TOKYO_SESS_GMT_011 "GMT-10" => TOKYO_SESS_GMT_010 "GMT-9" => TOKYO_SESS_GMT_09 "GMT-8" => TOKYO_SESS_GMT_08 "GMT-7" => TOKYO_SESS_GMT_07 "GMT-6" => TOKYO_SESS_GMT_06 "GMT-5" => TOKYO_SESS_GMT_05 "GMT-4" => TOKYO_SESS_GMT_04 "GMT-3" => TOKYO_SESS_GMT_03 "GMT-2" => TOKYO_SESS_GMT_02 "GMT-1" => TOKYO_SESS_GMT_01 "GMT+0" => TOKYO_SESS_GMT_0 "GMT+1" => TOKYO_SESS_GMT_1 "GMT+2" => TOKYO_SESS_GMT_2 "GMT+3" => TOKYO_SESS_GMT_3 "GMT+4" => TOKYO_SESS_GMT_4 "GMT+5" => TOKYO_SESS_GMT_5 "GMT+6" => TOKYO_SESS_GMT_6 "GMT+7" => TOKYO_SESS_GMT_7 "GMT+8" => TOKYO_SESS_GMT_8 "GMT+9" => TOKYO_SESS_GMT_9 "GMT+10" => TOKYO_SESS_GMT_10 "GMT+11" => TOKYO_SESS_GMT_11 "GMT+12" => TOKYO_SESS_GMT_12 => "" var string london_sess = if override_sess london_sess_override else switch tz_info "GMT-12" => LONDON_SESS_GMT_012 "GMT-11" => LONDON_SESS_GMT_011 "GMT-10" => LONDON_SESS_GMT_010 "GMT-9" => LONDON_SESS_GMT_09 "GMT-8" => LONDON_SESS_GMT_08 "GMT-7" => LONDON_SESS_GMT_07 "GMT-6" => LONDON_SESS_GMT_06 "GMT-5" => LONDON_SESS_GMT_05 "GMT-4" => LONDON_SESS_GMT_04 "GMT-3" => LONDON_SESS_GMT_03 "GMT-2" => LONDON_SESS_GMT_02 "GMT-1" => LONDON_SESS_GMT_01 "GMT+0" => LONDON_SESS_GMT_0 "GMT+1" => LONDON_SESS_GMT_1 "GMT+2" => LONDON_SESS_GMT_2 "GMT+3" => LONDON_SESS_GMT_3 "GMT+4" => LONDON_SESS_GMT_4 "GMT+5" => LONDON_SESS_GMT_5 "GMT+6" => LONDON_SESS_GMT_6 "GMT+7" => LONDON_SESS_GMT_7 "GMT+8" => LONDON_SESS_GMT_8 "GMT+9" => LONDON_SESS_GMT_9 "GMT+10" => LONDON_SESS_GMT_10 "GMT+11" => LONDON_SESS_GMT_11 "GMT+12" => LONDON_SESS_GMT_12 => "" var string newyork_sess = if override_sess newyork_sess_override else switch tz_info "GMT-12" => NEWYORK_SESS_GMT_012 "GMT-11" => NEWYORK_SESS_GMT_011 "GMT-10" => NEWYORK_SESS_GMT_010 "GMT-9" => NEWYORK_SESS_GMT_09 "GMT-8" => NEWYORK_SESS_GMT_08 "GMT-7" => NEWYORK_SESS_GMT_07 "GMT-6" => NEWYORK_SESS_GMT_06 "GMT-5" => NEWYORK_SESS_GMT_05 "GMT-4" => NEWYORK_SESS_GMT_04 "GMT-3" => NEWYORK_SESS_GMT_03 "GMT-2" => NEWYORK_SESS_GMT_02 "GMT-1" => NEWYORK_SESS_GMT_01 "GMT+0" => NEWYORK_SESS_GMT_0 "GMT+1" => NEWYORK_SESS_GMT_1 "GMT+2" => NEWYORK_SESS_GMT_2 "GMT+3" => NEWYORK_SESS_GMT_3 "GMT+4" => NEWYORK_SESS_GMT_4 "GMT+5" => NEWYORK_SESS_GMT_5 "GMT+6" => NEWYORK_SESS_GMT_6 "GMT+7" => NEWYORK_SESS_GMT_7 "GMT+8" => NEWYORK_SESS_GMT_8 "GMT+9" => NEWYORK_SESS_GMT_9 "GMT+10" => NEWYORK_SESS_GMT_10 "GMT+11" => NEWYORK_SESS_GMT_11 "GMT+12" => NEWYORK_SESS_GMT_12 => "" int weekend_start_end = override_sess ? weekend_start_end_override : WEEKEND_GMT_0 f_time_in_range(tf, session, tz) => not na(time(tf, session, tz)) ? 1 : 0 bool is_sydney_sess = f_time_in_range(timeframe.period, sydney_sess, tz_info) bool is_tokyo_sess = f_time_in_range(timeframe.period, tokyo_sess, tz_info) bool is_london_sess = f_time_in_range(timeframe.period, london_sess, tz_info) bool is_newyork_sess = f_time_in_range(timeframe.period, newyork_sess, tz_info) bool is_weekend = (dayofweek(timenow, "GMT+0") == dayofweek.friday and hour(timenow, "GMT+0") >= weekend_start_end) or dayofweek(timenow, "GMT+0") == dayofweek.saturday or (dayofweek(timenow, "GMT+0") == dayofweek.sunday and hour(timenow, "GMT+0") < weekend_start_end) if is_sym_forex if not is_weekend table.cell_set_text_color(ms_table, 0, 0, is_sydney_sess ? in_sess_col : out_sess_col) table.cell_set_text_color(ms_table, 1, 0, is_tokyo_sess ? in_sess_col : out_sess_col) table.cell_set_text_color(ms_table, 2, 0, is_london_sess ? in_sess_col : out_sess_col) table.cell_set_text_color(ms_table, 3, 0, is_newyork_sess ? in_sess_col : out_sess_col) else table.cell_set_text_color(ms_table, 0, 0, out_sess_col) table.cell_set_text_color(ms_table, 1, 0, out_sess_col) table.cell_set_text_color(ms_table, 2, 0, out_sess_col) table.cell_set_text_color(ms_table, 3, 0, out_sess_col)
Ultimate Time Filter V1
https://www.tradingview.com/script/4gj35S5s-Ultimate-Time-Filter-V1/
FloppyDisque
https://www.tradingview.com/u/FloppyDisque/
87
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © FloppyDisque //@version=5 indicator("Ultimate Time Filter", shorttitle = "UTFv1", overlay = true) // Time Filter { // Beginning / End date filter { g_time = "Time Filter" timeZone = input.string("GMT+0", "Time Zone", group = g_time, tooltip = "GMT and UTC is the same thing \nMatch this setting to bottom right time", options = ["GMT-10", "GMT-9", "GMT-8", "GMT-7", "GMT-6", "GMT-5", "GMT-4", "GMT-3", "GMT+0", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5", "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+10:30", "GMT+11", "GMT+12", "GMT+13", "GMT+13:45"]) startTimeIn = input.time(timestamp("24 Feb 2022"), "Start Date Filter", group = g_time, tooltip = "Changing timezone at bottom right of chart will change start time\nSet chart timezone to your prefered time first, then change indicator setting") endTimeIn = input.time(timestamp("01 Jan 2099"), "End Date Filter", group = g_time) startTimeYear = year (startTimeIn, timeZone) startTimeMonth = month (startTimeIn, timeZone) startTimeDay = dayofmonth(startTimeIn, timeZone) endTimeYear = year (endTimeIn, timeZone) endTimeMonth = month (endTimeIn, timeZone) endTimeDay = dayofmonth(endTimeIn, timeZone) startTime = timestamp(timeZone, startTimeYear, startTimeMonth, startTimeDay) endTime = timestamp(timeZone, endTimeYear, endTimeMonth, endTimeDay) inDate = time >= startTime and time <= endTime //} // Weekdays Filter { useWeek = input.bool(true, "Use Weekdays Filter?", group = g_time, tooltip = "Disable to allow all weekdays, Enable to choose certain days") useMon = input.bool(true, "Mon  ", inline = "Days", group = g_time) useTue = input.bool(true, "Tue  ", inline = "Days", group = g_time) useWed = input.bool(true, "Wed  ", inline = "Days", group = g_time) useThu = input.bool(true, "Thu  ", inline = "Days", group = g_time) useFri = input.bool(true, "Fri  ", inline = "Days", group = g_time) useSat = input.bool(true, "Sat  ", inline = "Days", group = g_time) useSun = input.bool(true, "Sun", inline = "Days", group = g_time) inWeek = if useWeek and useMon and dayofweek(time, timeZone) == dayofweek.monday true else if useWeek and useTue and dayofweek(time, timeZone) == dayofweek.tuesday true else if useWeek and useWed and dayofweek(time, timeZone) == dayofweek.wednesday true else if useWeek and useThu and dayofweek(time, timeZone) == dayofweek.thursday true else if useWeek and useFri and dayofweek(time, timeZone) == dayofweek.friday true else if useWeek and useSat and dayofweek(time, timeZone) == dayofweek.saturday true else if useWeek and useSun and dayofweek(time, timeZone) == dayofweek.sunday true else if not(useWeek) true //} // Session Filter { isInSess(_sess) => time(timeframe.period, _sess, timeZone) useSess = input.bool(false, "Use Session Filter?", group = g_time) timeSess1 = input.session("0900-1730", "Time Session", group = g_time) inSess1 = isInSess(timeSess1) useSess2 = input.bool(false, "Use 2ND Session Filter?", group = g_time) timeSess2 = input.session("1930-2100", "Time Session 2", group = g_time) inSess2 = isInSess(timeSess2) inSess = if useSess and inSess1 true else if useSess2 and inSess2 true else if not (useSess) true //} // Display Time Filter --- USE VARIABLE -->"inTime"<-- AS TIME FILTER IN ANY CODE { inTime = inDate and inWeek and inSess bgcolor(inTime ? color.new(color.blue, 90) : na, title = "Time Filter") //} //}
WVF - Oscillator
https://www.tradingview.com/script/VBeas28q-WVF-Oscillator/
Trendoscope
https://www.tradingview.com/u/Trendoscope/
344
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('WVF - Oscillator', overlay=false) import HeWhoMustNotBeNamed/enhanced_ta/12 as eta period = input.int(100, "Loopback", step=10, group="WVF") maType = input.string(title='MA Type', defval='hma', options=['ema', 'sma', 'hma', 'rma', 'vwma', 'wma', 'swma'], group='WVF') useHistoricalRange = input.bool(false, group='WVF') getWvfMomentum(source, maType, pd)=> //WVF formula/concept taken from @ChrisMoody wvf = (ta.highest(source, pd) - source)*100 / ta.highest(source, pd) ma = eta.ma(wvf, maType, pd) wvfMomentum = ta.linreg(wvf-ma, pd, 0) wvfMomentum o = getWvfMomentum(open, maType, period) h = getWvfMomentum(high, maType, period) l = getWvfMomentum(low, maType, period) c = getWvfMomentum(close, maType, period) barcolor = o<c and c[1] < c? color.green : o > c and c[1] > c? color.red : color.silver plotcandle(o, h, l, c, "WVF Candles", barcolor, barcolor, bordercolor=barcolor) var wvfMomentumArray = array.new_float() var wvfHighArray = array.new_float() var wvfLowArray = array.new_float() array.push(wvfMomentumArray, c) array.push(wvfHighArray, ta.highest(h, period)) array.push(wvfLowArray, ta.lowest(l, period)) wvfMedian = useHistoricalRange ? array.median(wvfMomentumArray) : ta.median(c, period) wvfHigh = useHistoricalRange ? array.median(wvfHighArray) : ta.median(ta.highest(h, period), period) wvfLow = useHistoricalRange ? array.median(wvfLowArray) : ta.median(ta.lowest(h, period), period) PMEDIAN = plot(wvfMedian, title="Median", color=color.blue) PHIGH = plot(wvfHigh, title="High", color=color.red) PLOW = plot(wvfLow, title="Low", color=color.green)
volatility-weighted price change divergence
https://www.tradingview.com/script/79g2LUbn/
wzkkzw12345
https://www.tradingview.com/u/wzkkzw12345/
46
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/ // © wzkkzw12345 //@version=4 study(title="Direction") res = input("15", type=input.resolution) length = input(28, title="EMA length") f_intrabarSqMove(_chartTf) => // string _chartTf: chart TF in `timeframe.period` format. It is used to detect the first intrabar. var float _sq = na var int _intrabars = na rate = log(close/open) if change(time(_chartTf)) // First intrabar detected: reset data. _intrabars := 1 _sq := rate*rate else _intrabars += 1 _sq += rate*rate [_sq, _intrabars] _f_intrabarSqMove(_chartTf) => security(syminfo.tickerid, res, f_intrabarSqMove(_chartTf)) //mean = security(syminfo.tickerid, "1", sma(log(close/open), 1440)) [sq, n_bars] = if timeframe.period == "M" [a,b] = _f_intrabarSqMove("M") else if timeframe.period == "W" [a,b] = _f_intrabarSqMove("W") else if timeframe.period == "D" [a,b] =_f_intrabarSqMove("D") else if timeframe.period == "1440" [a,b] = _f_intrabarSqMove("1440") else if timeframe.period == "720" [a,b] = _f_intrabarSqMove("720") else if timeframe.period == "360" [a,b] = _f_intrabarSqMove("360") else if timeframe.period == "240" [a,b] = _f_intrabarSqMove("240") else if timeframe.period == "180" [a,b] = _f_intrabarSqMove("180") else if timeframe.period == "120" [a,b] =_f_intrabarSqMove("120") else if timeframe.period == "60" [a,b] = _f_intrabarSqMove("60") else if timeframe.period == "30" [a,b] = _f_intrabarSqMove("30") else if timeframe.period == "15" [a,b] = _f_intrabarSqMove("15") else if timeframe.period == "10" [a,b] = _f_intrabarSqMove("10") else if timeframe.period == "5" [a,b] = _f_intrabarSqMove("5") else if timeframe.period == "3" [a,b] = _f_intrabarSqMove("3") else [float(na), int(1)] mean_rate = log(close/open)/n_bars _time = timeframe.multiplier * ( timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na) vol_rate = sqrt(sq/n_bars - mean_rate*mean_rate) ema_vol_rate_sq = rma(vol_rate*vol_rate, 2*length) action = ema(vol_rate*log(close/open),length) //plot(action, color=action>=0.? color.green : color.red ) avg_move = ema(log(close/open),length) //plot(avg_move) //plot(chaotic_rate, color=chaotic_rate>0.5? color.red : chaotic_rate>0.06 ? color.blue : color.green ) //effective_action = ema_action/ema_abs_move //plot(effective_action, color= effective_action>=0.? color.green:color.red) hline(0.) //_ema = ema(chaotic_rate,length) diff = (action/sqrt(ema_vol_rate_sq)-avg_move)*100. plot(diff,color=color.new(diff>= 0.? color.green : color.red,60),style=plot.style_area) upper_divergence = avg_move> avg_move[1] and diff< diff[1] - abs(diff[1])*(0.03+1.5/length) lower_divergence = avg_move< avg_move[1] and diff> diff[1] + abs(diff[1])*(0.03+1.5/length) plot(upper_divergence or lower_divergence ?diff:na,color=color.new(lower_divergence? color.green : color.red,0),style=plot.style_linebr, linewidth=2) //hline(0.06) //hline(0.84) //hline(1.16) //hline(2.1)
Volume Surge indicator
https://www.tradingview.com/script/ys60M0Jw-Volume-Surge-indicator/
MoriFX
https://www.tradingview.com/u/MoriFX/
217
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/ // © MoriFX //@version=5 indicator("Volume Surge", overlay=true, format=format.volume) lookback = input.int(30, 'Lookback period for average volume') multiplier = input.float(2, 'Volume surge X') alert = input.bool(true, 'Sending Alerts when volume surge happened') vol = volume sumVol = math.sum(volume, lookback) avgVol = sumVol / lookback volSurge = (vol > (avgVol * multiplier)) alertcondition(alert ? volSurge : na, title='Alert if Volume surged', message='Volume surge happened on {{ticker}}') bgcolor(color= volSurge and (close>open) ? color.new(color.green, 80) : volSurge and (close<open) ? color.new(color.red, 80) : na)
Short Volume Stamper
https://www.tradingview.com/script/nLYgzrMB-Short-Volume-Stamper/
KioseffTrading
https://www.tradingview.com/u/KioseffTrading/
869
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/ // © KioseffTrading //@version=5 indicator("Short Volume Stamper [Kioseff Trading]", precision = 12, overlay = true, max_bars_back = 4000, max_lines_count = 500, max_labels_count = 500) sVolType = input.string(defval = "QUANDL", title = "Short Vol Data Source", options = ["QUANDL", "TradingView"]) sVolNASDAQ = request.quandl("FINRA/FNSQ_" + syminfo.ticker, index = 0, ignore_invalid_symbol = true) sVolNYSE = request.quandl("FINRA/FNYX_" + syminfo.ticker, index = 0, ignore_invalid_symbol = true) tvsVol = request.security(syminfo.ticker + "_SHORT_VOLUME", "D", close, ignore_invalid_symbol = true) runtime = input.string(defval = "On", title = "Show Runtime Error?", options = ["On", "Off"]) instructions = input.string(defval = "Off", title = "Instructions?", options = ["On", "Off"]) totalShort = 0.0 totalShort := if sVolType == "QUANDL" sVolNASDAQ + sVolNYSE else tvsVol vHigh = ta.highest(totalShort, 100) preciseHigh = ta.highest(high, 11) preciseLow = ta.lowest(low, 11) * .90 var float x = 0.0 var float x1 = 0.0 var float x2 = 0.0 var int y = 0 var int y1 = 0 var int counter = 0 if vHigh > vHigh[1] x := totalShort[4] + totalShort[3] + totalShort[2] + totalShort[1] + totalShort + totalShort[5] y := bar_index x2 := volume[4] + volume[3] + volume[2] + volume[1] + volume + volume[5] counter := 1 if bar_index - y == 5 x := x[1] + totalShort[4] + totalShort[3] + totalShort[2] + totalShort[1] x2 := x2[1] + volume[4] + volume[3] + volume[2] + volume[1] if bar_index - y == 6 x := 0 x2 := 0 counter := 0 calc(s, t) => div = s / t fin = div * 100 fin pCalc = calc(x[1], x2[1]) sSMA = ta.sma(totalShort, 20) vSMA = ta.sma(volume, 20) svrSMA = ta.sma(calc(totalShort, volume), 20) var label m = na var line n = na var line n1 = na var line n2 = na var line n3 = na var float nfloat =0.0 var linefill nfill = na vwapAvg = (ta.vwap[2] + ta.vwap[3] + ta.vwap[4] + ta.vwap[5] + ta.vwap[6] + ta.vwap[7] + ta.vwap[8] + ta.vwap[9] + ta.vwap[10] + ta.vwap[11]) / 10 var int countern = 0 if x[1] > 0 and x == 0 nfloat := vwapAvg countern += 1 m := label.new(bar_index - 6, preciseHigh * 1.05, text = "10 Session Aggregate Short Volume: " + str.tostring(x[1], format.volume) + "\n10 Session Aggregate Total Volume: " + str.tostring(x2[1], format.volume) +"\n Short Volume % Of Total Volume: " + str.tostring(calc(x[1], x2[1]), format.percent) + "\nVolume Weighted Average Price Area: $" + str.tostring(nfloat, format.mintick) + "\n10 Session Short Vol. Approximate Dollar Value: $" + str.tostring(nfloat * x[1], format.volume), color = pCalc >= 20.00 ? color.new(color.red, 50) : color.new(color.green, 50), textcolor = color.white, style = label.style_label_down) n := line.new(bar_index - 11, preciseHigh, bar_index - 2, preciseHigh, color = pCalc >= 20.00 ? color.red : color.green, width = 2) n1 := line.new(bar_index - 11, preciseLow,bar_index - 2, preciseLow, color = pCalc >= 20.00 ? color.red : color.green, width = 2) n2 := line.new(bar_index - 11, preciseLow, bar_index -11, preciseHigh, color =pCalc >= 20.00 ? color.red : color.green, width = 2) n3 := line.new(bar_index - 2, preciseLow, bar_index -2, preciseHigh, color = pCalc >= 20.00 ? color.red : color.green, width = 2) nfill := linefill.new(n2, n3, color = pCalc >= 20.00 ? color.new(color.red, 90) : color.new(color.green, 90)) if countern == 4 countern := 0 pHigh = na(ta.pivothigh(high, 25, 25)) ? false : true var float ofloat1 = 0.0 var float ofloat2 = 0.0 var float ofloat3 = na var float ofloat4 = 0.0 var line o1 = na var line o2 = na var line o3 = na var line o4 = na var linefill o5 = na var label o6 = na lowN = ta.lowest(low, 7)[22] if pHigh == true and ta.barssince(ta.change(counter)) > 29 ofloat1 := volume[23] + volume[24] + volume[25] + volume[26] + volume[27] + volume[28] ofloat2 := totalShort[23] + totalShort[24] + totalShort[25] + totalShort[26] + totalShort[27] + totalShort[28] ofloat3 := (ta.vwap[23] + ta.vwap[24] + ta.vwap[25] + ta.vwap[26] + ta.vwap[27] + ta.vwap[28]) / 6 ofloat4 := (ofloat2 / ofloat1) * 100 o1 := line.new(bar_index - 28, high[25], bar_index - 23, high[25], style = line.style_solid, color = ofloat4 >= 20.0 ? color.red : color.green, width = 2) o2 := line.new(bar_index - 28, lowN, bar_index - 23, lowN, style = line.style_solid, color = ofloat4 >= 20.0 ? color.red : color.green, width = 2) o3 := line.new(bar_index - 28, high[25], bar_index - 28, lowN, style = line.style_solid, color = ofloat4 >= 20.0 ? color.red : color.green, width = 2) o4 := line.new(bar_index - 23, high[25], bar_index - 23, lowN, style = line.style_solid, color = ofloat4 >= 20.0 ? color.red : color.green, width = 2) o5 := linefill.new(o3, o4, color = ofloat4 >= 20.00 ? color.new(color.red, 90) : color.new(color.green, 90)) countern += 1 o6 := label.new(bar_index - 25, high[25] * 1.05 , text = "6 Session Aggregate Short Volume: " + str.tostring(ofloat2, format.volume) + "\n6 Session Aggregate Total Volume: " + str.tostring(ofloat1, format.volume) +"\n Short Volume % Of Total Volume: " + str.tostring(ofloat4, format.percent) + "\nVolume Weighted Average Price Area: $" + str.tostring(ofloat3, format.mintick) +"\n6 Session Short Vol. Approximate Dollar Value: $" + str.tostring(ofloat3 * ofloat2, format.volume), color = ofloat4 >= 20.00 ? color.new(color.red, 50) : color.new(color.green, 50), textcolor = color.white, style = label.style_label_down) var float f1 = 0.0 var float f2 = 0.0 var float t = 0.0 var float t1 = 0.0 var float t2 = 0.0 var float f4 = 0.0 var float f5 = 0.0 t24High = ta.highest(high, 504) if t24High == t24High[1] and totalShort > 0 f1 := totalShort[1] if t24High == t24High[1] and f1 > 0 f1 := f1[1] + f1 f4 := ta.vwap * totalShort f4 := f4 + f4[1] f5 := ta.vwap * volume f5 := f5[1] + f5 if ta.change(t24High) and totalShort > 0 f1 := 0 t := year(time) t1 := month(time) t2 := dayofmonth(time) f4 := 0 f4 := (ta.vwap * totalShort) f5 := 0 f5 := (ta.vwap * volume) if t24High == t24High[1] and totalShort > 0 f2 := volume[1] if t24High == t24High[1]and f2 > 0 f2 := f2[1] + f2 if ta.change(t24High) and totalShort > 0 f2 := 0 finf1 = f1 + totalShort finf2 = f2 + volume finf3 = calc(finf1, finf2) finf4 = ta.vwap * finf2 var float floatv = 0.0 var int intv = 0 var line lineV = na var label labelV = na if ta.barssince(t24High > t24High[1]) == 1 floatv := high[1] intv := bar_index[1] line.delete(lineV[1]) lineV := line.new(intv, floatv, bar_index, high, color = finf3 >= 20.0 ? color.new(#ff0400, 50) : color.new(#03ff00, 50), width = 2) if high > t24High[1] line.delete(lineV[1]) if bar_index[1] < bar_index line.delete(lineV) lineV := line.new(intv, floatv, bar_index, high, color = finf3 >= 20.0 ? color.new(#ff0400, 50) : color.new(#03ff00, 50), width = 2) label.delete(labelV[1]) labelV := label.new(bar_index, high * 1.02, text = "Total Short Volume Since 2-Year High: " + str.tostring(finf1, format.volume) + " (" + str.tostring(t) + "/" + str.tostring(t1) + "/" + str.tostring(t2) + ")" + "\nApproximate Dollar Value Of Short Vol. Since 2-Year High: $" + str.tostring(f4, format.volume) + "\nTotal Volume Since 2-Year High: " + str.tostring(finf2, format.volume) + "\n Dollar Value Of Total Volume Minus Total Short Volume: $" + str.tostring(f5 - f4, format.volume) + "\nShort Volume Ratio Since 2-Year High: " + str.tostring(finf3, format.percent), color = finf3 >= 20.0 ? color.new(#ff0400, 50) : color.new(#03ff00, 50), textcolor = color.white) logicalOpString = totalShort > sSMA ? " > " : totalShort == sSMA ? "==" : " < " logicalOpString1 = volume > vSMA ? " > " : volume == vSMA ? "==" : " < " logicalOpString2 = calc(totalShort, volume) > svrSMA ? " > " : calc(totalShort, volume) == svrSMA ? "==" : " < " table1 = table.new(position.bottom_right, 9, 9, bgcolor = color.new(color.white, 100)) if barstate.islast table.cell(table1, 0 ,0, text = "Short Volume: " + str.tostring(totalShort, format.volume) + logicalOpString + "(" + str.tostring(sSMA, format.volume) + " Avg.)", text_color = color.white) table.cell(table1, 0, 1, text = "Total Volume: " + str.tostring(volume, format.volume) + logicalOpString1 + "(" + str.tostring(vSMA, format.volume) + " Avg.)", text_color = color.white) table.cell(table1, 0, 2, text = "Short Volume Ratio: " + str.tostring(calc(totalShort, volume), format.percent) + logicalOpString2 + "(" + str.tostring(svrSMA, format.percent) + " Avg.)", text_color = color.white) if timeframe.isintraday and runtime == "Off" and barstate.islast table.cell(table1, 0, 3, text = "SHORT VOLUME IS REPORTED DAILY! \nNOT TICK BY TICK! \nINTRASESSION CALCULATIONS ARE INCORRECT!", text_color = color.red) if timeframe.isintraday and runtime == "On" and barstate.islast runtime.error("SHORT VOLUME IS REPORTED DAILY! \nNOT TICK BY TICK! \nINTRASESSION CALCULATIONS WILL BE INCORRECT!") if barstate.islast and na(totalShort) and sVolType == "QUANDL" and year(time) <= 2013 and syminfo.prefix == "NASDAQ" or na(totalShort) and sVolType == "QUANDL" and year(time) <= 2013 and syminfo.prefix == "NYSE" or na(totalShort) and sVolType == "QUANDL" and year(time) <= 2013 and syminfo.prefix == "AMEX" or na(totalShort) and year(time) <= 2013 and syminfo.prefix == "BATS" and sVolType == "QUANDL" table.cell(table1, 0, 4, text = "SHORT VOLUME DATA FOR THIS EXCHANGE IS UNAVAILBLE FOR THIS PERIOD", text_color = color.red) if barstate.islast and na(totalShort) and sVolType == "TradingView" and year(time) <= 2018 and syminfo.prefix == "NASDAQ" or na(totalShort) and sVolType == "TradingView" and year(time) <= 2018 and syminfo.prefix == "NYSE" or na(totalShort) and sVolType == "TradingView" and year(time) <= 2018 and syminfo.prefix == "AMEX" or na(totalShort) and year(time) <= 2018 and syminfo.prefix == "BATS" and sVolType == "TradingView" table.cell(table1, 0, 4, text = "SHORT VOLUME DATA FOR THIS PERIOD IS NOT PROVIDED BY TRADINGVIEW", text_color = color.red) if barstate.islast and na(totalShort) table.cell(table1, 0, 4, text = "SHORT VOLUME FOR THIS EXCHANGE IS NOT REPORTED BY FINRA", text_color = color.red) if instructions == "On" and barstate.islast table.cell(table1, 0,5, text = "When Short Volume Is Aggregated for 10 Sessions: \nA New 1-Year High in Short Volume Was Achieved (The Session the Label Is Pointing Towards)." + "\n" + "\nWhen Short Volume Is Aggregated for 6 Sessions: \n a Pivot High Point Was Reached (Highest High Over 51 Sessions)." + "\n" +"\nThe Continually Updating Line Connects the 2-Year High to the Current Session’s High. \nThe Total Short Volume Between the Two Sessions Is Calculated, in Addition to Other Measurements." , text_color = color.blue) table.cell(table1, 0,6, text = "Red Labels, Red Boxes, and Red Lines Indicate a Short Volume Ratio Greater Than or Equal to 20% Over the Corresponding Period.", text_color = color.red) table.cell(table1, 0,7, text = "Green Labels, Green Boxes, and Green Lines Indicate a Short Volume Ratio Less Than 20% Over the Corresponding Period. ", text_color = color.green) if timeframe.ismonthly or timeframe.isweekly and runtime == "Off" and barstate.islast runtime.error("ERROR: TRY DAILY CHART!")
Position Size Calc. (Risk Management Tool)
https://www.tradingview.com/script/4eOoj67v-Position-Size-Calc-Risk-Management-Tool/
DojiEmoji
https://www.tradingview.com/u/DojiEmoji/
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/ // © DojiEmoji //@version=5 indicator("Position Size Calc. [KL]", overlay=true, max_labels_count=3) var string GROUP_RM = "Risk Mgt. with ATR Based Stop" var float risk_amt = input.float(10, title="Amount risk", group=GROUP_RM) var int atr_len = input.int(14,title="ATR Length", inline="RM1", group=GROUP_RM) var float atr_multi = input.int(2 , title="ATR multiplier", group=GROUP_RM, inline="RM1") var string _TT = "Adjustments for how much one point is worth for this specific symbol" var string sym_filter1 = input.symbol("MNQ1!", inline="_point_worth1", title="Filter:", group=GROUP_RM) var float point_worth1 = input.float(2, title="Point value", inline="_point_worth1", group=GROUP_RM) var string sym_filter2 = input.symbol("MES1!", inline="_point_worth2", title="Filter:", group=GROUP_RM) var float point_worth2 = input.float(5, title="Point value", inline="_point_worth2", group=GROUP_RM) var string GROUP_SLTPLINES = "Stoploss Guidelines" var string STR_CURRENT_ATR = "Current ATR" var string STR_SUPTREND = "Supertrend" var string type_guideline = input.string(STR_CURRENT_ATR, title="Guideline type (Current ATR / Supertrend)", options=[STR_CURRENT_ATR, STR_SUPTREND], group=GROUP_SLTPLINES) var int offset = input.int(20, title="Offset SL/TP Lines (For Current ATR)", group=GROUP_SLTPLINES) var string GROUP_OTHERS = "Others" var string tab_pos = input.string(position.bottom_right, options=[position.top_left,position.top_right,position.bottom_left,position.bottom_right], title="Position of table", group=GROUP_OTHERS) var color DEFAULT_CELL_COLOR = #aaaaaa var color DEFAULT_TXT_COLOR = color.white var color DEFAULT_HEADER_COLOR = color.gray var tbl = table.new(tab_pos, 3, 3, frame_color=#151715, frame_width=1, border_width=2, border_color=color.new(DEFAULT_TXT_COLOR, 100)) var line ln_sl_short = na, line.delete(ln_sl_short[1]) var line ln_sl_long = na, line.delete(ln_sl_long[1]) var string text_size = size.small var label lbl_top = na, label.delete(lbl_top[1]) var label lbl_bott = na, label.delete(lbl_bott[1]) var line ln_tp_long = na, line.delete(ln_tp_long[1]) var line ln_tp_short = na, line.delete(ln_tp_short[1]) var line ln_crnt_close = na, line.delete(ln_crnt_close) // Show the table (Unless ignored, ie for VIX) ignored_list(sym) => bool ignore = switch sym "VIX" => true // every else not ignored => false float sl_buffer = atr_multi * ta.atr(atr_len) float _denom = 1 _denom := array.get(str.split(sym_filter1,":"),1) == syminfo.ticker ? point_worth1 : _denom _denom := array.get(str.split(sym_filter2,":"),1) == syminfo.ticker ? point_worth2 : _denom safetytab_pos_size = risk_amt / sl_buffer / _denom if barstate.islast and not ignored_list(syminfo.root) // (0,0):[Risk amt.] (1,0):[data] // (0,1):[ATR n*multi] (1,1):[data] // (0,2):[Pos. Size] (1,2):[data] table.cell(tbl, 0, 0, "Risk amt.", text_halign = text.align_left, bgcolor = DEFAULT_HEADER_COLOR, text_color = DEFAULT_TXT_COLOR, text_size = text_size) table.cell(tbl, 1, 0, str.tostring(risk_amt,"#.##"), text_halign = text.align_right, bgcolor = DEFAULT_HEADER_COLOR, text_color = DEFAULT_TXT_COLOR, text_size = text_size) table.cell(tbl, 0, 1, "ATR(" + str.tostring(atr_len,"#") + ") x "+str.tostring(atr_multi,"#"), text_halign = text.align_left, bgcolor = color.gray, text_color = DEFAULT_TXT_COLOR, text_size = text_size) table.cell(tbl, 1, 1, str.tostring(sl_buffer, "#.#"), text_halign = text.align_right, bgcolor = DEFAULT_CELL_COLOR, text_color = DEFAULT_TXT_COLOR, text_size = text_size) table.cell(tbl, 0, 2, "Pos. Size", text_halign = text.align_left, bgcolor = color.gray, text_color = DEFAULT_TXT_COLOR, text_size = text_size) table.cell(tbl, 1, 2, str.tostring(safetytab_pos_size, "#.##"), text_halign = text.align_right, bgcolor = DEFAULT_CELL_COLOR, text_color = DEFAULT_TXT_COLOR, text_size = text_size) if type_guideline == STR_CURRENT_ATR // TP SL Lines float y_top = open+sl_buffer float y_bott = open-sl_buffer ln_sl_short := line.new(bar_index-1+offset, y_top, bar_index+offset+1, y_top, color=color.red, extend=extend.right) ln_sl_long := line.new(bar_index-1+offset, y_bott, bar_index+offset+1, y_bott, color=color.green, extend=extend.right) _y_offset = sl_buffer/10 lbl_top := label.new(bar_index+offset+5, y_top+_y_offset, str.tostring(y_top,"#.##"), xloc.bar_index, yloc.price,color.new(color.gray,100), style=label.style_label_right) lbl_bott := label.new(bar_index+offset+5, y_bott-_y_offset, str.tostring(y_bott,"#.##"), xloc.bar_index, yloc.price,color.new(color.gray,100), style=label.style_label_right) // Supertrend guided TSL [supertrend, direction] = ta.supertrend(atr_multi, atr_len) p0 = plot((open + close) / 2, display=display.none) p1_up = plot(direction[1] < 0 ? supertrend[1] : na, "Up Trend", color = type_guideline == STR_SUPTREND ? color.green : na, style=plot.style_linebr) p2_dn = plot(direction[1] < 0? na : supertrend[1], "Down Trend", color = type_guideline == STR_SUPTREND ? color.red : na, style=plot.style_linebr) fill(p0, p1_up, type_guideline == STR_SUPTREND ? color.new(color.green, 90) : na, fillgaps=false) fill(p0, p2_dn, type_guideline == STR_SUPTREND ? color.new(color.red, 90) : na, fillgaps=false)
RSI Failure Swings & AO Divergences
https://www.tradingview.com/script/sNZ6Ckh3-RSI-Failure-Swings-AO-Divergences/
KioseffTrading
https://www.tradingview.com/u/KioseffTrading/
421
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © KioseffTrading //@version=5 indicator("RSI Failure Swings & AO Divergences", overlay = false, max_bars_back = 4000) // Input Values -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- indicator = input.string(defval = "RSI", title = "Indicator Type", options = ["RSI", "AO"]) fSwings = input.bool(true, title = "Failure Swings?") percentiles = input.string("On",title = "Percentile Range", options = ["On", "Off"]) rangeMax = input.int(title = "Maximum Lookback (Candles)", defval = 14) rangeMin = input.int(title = "Minimum Lookback (Candles)", defval = 2) lookAheadRight = input.int(defval = 2, title = "Pivot Look Ahead Right") breakPoint = input.bool(true, title = "Break Point?") // Indicators-------------------------------------------------------------------------------------------------------------------------------------------------------------------- rsi = ta.rsi(close, 14) ao = ta.sma(hl2, 5) - ta.sma(hl2, 14) difference = ao - ao[1] // RSI Plots-------------------------------------------------------------------------------------------------------------------------------------------------------------------- plot(indicator == "RSI" ? rsi : ao, linewidth = 1, color = indicator == "RSI" ? color.new(#FDD500, 0) : indicator == "AO" and difference >= 0 ? color.white : indicator == "AO" and difference < 0 ? color.black : na, style = indicator == "AO" ? plot.style_columns : plot.style_line) mid = hline(indicator == "RSI" ? 50 : 0) h1 = hline(indicator == "RSI" ? 70 : na, color = color.new(color.aqua, 50), linewidth = 1, linestyle = hline.style_solid) h2 = hline(indicator == "RSI" ? 30 : na, color = color.new(color.aqua, 50), linewidth = 1, linestyle = hline.style_solid) fill(h1, h2, color = indicator == "RSI" ? color.new(color.purple, 95) : na) // RSI Pivots-------------------------------------------------------------------------------------------------------------------------------------------------------------------- PHrsi = na(ta.pivothigh(rsi, 1, lookAheadRight)) ? false : true PLrsi = na(ta.pivotlow(rsi, 1, lookAheadRight)) ? false : true // RSI Divergences & Failure Swings-------------------------------------------------------------------------------------------------------------------------------------------------------------------- rsiHigher = fSwings == false ? rsi[lookAheadRight] > ta.valuewhen(PLrsi, rsi[lookAheadRight], 1) and ta.barssince(PLrsi[1]) > rangeMin and ta.barssince(PLrsi[1]) <= rangeMax and ta.valuewhen(PLrsi, rsi[lookAheadRight], 1) < 30 and rsi[lookAheadRight] < 30 : rsi[lookAheadRight] > ta.valuewhen(PLrsi, rsi[lookAheadRight], 1) and ta.barssince(PLrsi[1]) > rangeMin and ta.barssince(PLrsi[1]) <= rangeMax and ta.valuewhen(PLrsi, rsi[lookAheadRight], 1) < 30 lc = close[lookAheadRight] < ta.valuewhen(PLrsi, close[lookAheadRight], 1) bullDivergence = lc and rsiHigher and PLrsi rsiLower = fSwings == false ? rsi[lookAheadRight] < ta.valuewhen(PHrsi, rsi[lookAheadRight], 1) and ta.barssince(PHrsi[1]) > rangeMin and ta.barssince(PHrsi[1]) <= rangeMax and ta.valuewhen(PHrsi, rsi[lookAheadRight], 1) > 70 and rsi[lookAheadRight] > 70 : rsi[lookAheadRight] < ta.valuewhen(PHrsi, rsi[lookAheadRight], 1) and ta.barssince(PHrsi[1]) > rangeMin and ta.barssince(PHrsi[1]) <= rangeMax and ta.valuewhen(PHrsi, rsi[lookAheadRight], 1) > 70 hc = close[lookAheadRight] > ta.valuewhen(PHrsi, close[lookAheadRight], 1) bearDivergence = hc and rsiLower and PHrsi // Plot RSI Divergences-------------------------------------------------------------------------------------------------------------------------------------------------------------------- plot(PLrsi and indicator == "RSI" ? rsi[lookAheadRight] : na, offset = lookAheadRight * -1, title = "Bullish Divergence", linewidth =3 , color = bullDivergence ? color.new(#09FF00, 0) : color.new(#161923, 100)) plot(PHrsi and indicator == "RSI" ? rsi[lookAheadRight] : na, offset = lookAheadRight * -1, title = "Bearish Divergence", linewidth =3 , color = bearDivergence ? color.new(color.red, 0) : color.new(#161923, 100)) // Basic Labels -------------------------------------------------------------------------------------------------------------------------------------------------------------------- if bullDivergence and (rsi[lookAheadRight] < 30) and indicator == "RSI" label.new(bar_index[lookAheadRight], math.round(rsi[lookAheadRight]), text = "Bullish Divergence", style = label.style_label_up, color = color.new(color.green, 100), textcolor = color.white, size = size.small) if bearDivergence and (rsi[lookAheadRight] > 70) and indicator == "RSI" label.new(bar_index[lookAheadRight], math.round(rsi[lookAheadRight]), text = "Bearish Divergence", style = label.style_label_down, color = color.new(color.red, 100), textcolor = color.white, size = size.small) // Bottom Failure Swing if bullDivergence and (rsi[lookAheadRight] >= 30) and indicator == "RSI" label.new(bar_index[lookAheadRight], math.round(rsi[lookAheadRight]), text = "Bottom Failure Swing", style = label.style_label_up, color = color.new(color.green, 100), textcolor = color.white, size = size.small) // Top Failure Swing -------------------------------------------------------------------------------------------------------------------------------------------------------------------- if bearDivergence and (rsi[lookAheadRight] < 70) and indicator == "RSI" label.new(bar_index[lookAheadRight], math.round(rsi[lookAheadRight]), text = "Top Failure Swing", style = label.style_label_down, color = color.new(color.red, 100), textcolor = color.white, size = size.small) // Advanced Plots And Labels -------------------------------------------------------------------------------------------------------------------------------------------------------------------- var int counter = 0 var int counter1 = 0 var float rsiHigherVar = 0.0 var line lineZ = na rsiHighest = ta.highest(rsi, bar_index + 1 - counter)[lookAheadRight] if PLrsi and not bullDivergence and rsi[lookAheadRight] < 30 and ta.barssince(bullDivergence) > 14 and indicator == "RSI" counter := bar_index[lookAheadRight] if bullDivergence and indicator == "RSI" and rsi[lookAheadRight] > 30 counter1 := bar_index[lookAheadRight] - counter rsiHigherVar := rsiHighest var int counter2 = 0 var label labelZ = na if ta.change(rsiHigherVar) and breakPoint == true and rsi[lookAheadRight] > 30 and indicator == "RSI" lineZ := line.new(counter, rsiHigherVar, bar_index + 2, rsiHigherVar, color = color.green, width = 2) counter2 := 1 if counter2 == 1 and breakPoint == true and indicator == "RSI" label.delete(labelZ[1]) lineZ := line.new(counter, rsiHigherVar, bar_index + 2, rsiHigherVar, color = color.green, width = 2) labelZ := label.new(bar_index, line.get_y1(lineZ), color = color.new(color.white, 100), textcolor = color.white, text = str.tostring(rsiHigherVar, format = '#.00') + "(Break Point)") if rsi[1] > line.get_price(lineZ, bar_index) and rsi > line.get_price(lineZ, bar_index) and counter2 == 1 and breakPoint == true and indicator == "RSI" label.delete(labelZ) labelZ := label.new(line.get_x1(lineZ), line.get_y1(lineZ) * .90, color = color.new(color.white, 100), textcolor = color.white, text = str.tostring(rsiHigherVar, format = '#.00') + "(CLEARED)") counter2 := 0 // BFS Labels -------------------------------------------------------------------------------------------------------------------------------------------------------------------- var int counterx = 0 var int counter1x = 0 var float rsiLowerVar = 0.0 var line lineX = na rsiLowest = ta.lowest(rsi, bar_index + 1 - counterx)[lookAheadRight] if PHrsi and not bearDivergence and rsi[lookAheadRight] > 70 and ta.barssince(bearDivergence) > 14 and indicator == "RSI" counterx := bar_index[lookAheadRight] if bearDivergence and indicator == "RSI" and rsi[lookAheadRight] < 70 counter1x := bar_index[lookAheadRight] - counterx rsiLowerVar := rsiLowest var int counter2x = 0 var label labelX = na if ta.change(rsiLowerVar) and breakPoint == true and counter2x == 0 and indicator == "RSI" lineX := line.new(counterx, rsiLowerVar, bar_index + 2, rsiLowerVar, color = color.red, width = 2) counter2x := 1 if counter2x == 1 and breakPoint == true and indicator == "RSI" lineX := line.new(counterx, rsiLowerVar, bar_index + 2, rsiLowerVar, color = color.red, width = 2) label.delete(labelX[1]) labelX := label.new(bar_index, line.get_y1(lineX), color = color.new(color.white, 100), textcolor = color.white, text = str.tostring(rsiLowerVar, format = '#.00') + "(Break Point)", style = label.style_label_up) if rsi[1] < line.get_price(lineX, bar_index) and rsi < line.get_price(lineX, bar_index) and counter2x == 1 and breakPoint == true and indicator == "RSI" label.delete(labelX) labelX := label.new(line.get_x1(lineX), line.get_y1(lineX), color = color.new(color.white, 100), textcolor = color.white, text = str.tostring(rsiLowerVar, format = '#.00') + "(CLEARED)" , style = label.style_label_up) counter2x := 0 // Percentiles -------------------------------------------------------------------------------------------------------------------------------------------------------------------- p90 = ta.percentile_linear_interpolation(ao, 1000, 90) p99 = ta.percentile_linear_interpolation(ao, 1000, 99) p10 = ta.percentile_linear_interpolation(ao, 1000, 10) p1 = ta.percentile_linear_interpolation(ao, 1000, 1) // AO Plots-------------------------------------------------------------------------------------------------------------------------------------------------------------------- x1 = plot(indicator == "AO" ? p90 : na, color = color.new(#161923, 100)) x2 = plot(indicator == "AO" ? p99 : na, color = color.new(#161923, 100)) fill(x1, x2, color = indicator == "AO" and percentiles == "On" ? color.new(color.red, 75) : color.new(#161923, 100)) x3 = plot(indicator == "AO" ? p10 : na, color = color.new(#161923, 100)) x4 = plot(indicator == "AO" ? p1 : na, color = color.new(#161923, 100)) fill(x3, x4, color = indicator == "AO" and percentiles == "On" ? color.new(color.green, 75) : color.new(#161923, 100)) // AO Pivots-------------------------------------------------------------------------------------------------------------------------------------------------------------------- PHao = na(ta.pivothigh(ao, 1, lookAheadRight)) ? false : true PLao = na(ta.pivotlow(ao, 1, lookAheadRight)) ? false : true // AO Divergences-------------------------------------------------------------------------------------------------------------------------------------------------------------------- aoHigher = ao[lookAheadRight] > ta.valuewhen(PLao, ao[lookAheadRight], 1) and ta.barssince(PLao[1]) > rangeMin and ta.barssince(PLao[1]) <= rangeMax and ta.valuewhen(PLao, ao[lookAheadRight], 1) < p10 and ao[lookAheadRight] < p10 lcao = close[lookAheadRight] < ta.valuewhen(PLao, close[lookAheadRight], 1) aobullDivergence = lcao and aoHigher and PLao aoLower = ao[lookAheadRight] < ta.valuewhen(PHao, ao[lookAheadRight], 1) and ta.barssince(PHao[1]) > rangeMin and ta.barssince(PHao[1]) <= rangeMax and ta.valuewhen(PHao, ao[lookAheadRight], 1) > p90 and ao[lookAheadRight] > p90 hcao = close[lookAheadRight] > ta.valuewhen(PHao, close[lookAheadRight], 1) aobearDivergence = hcao and aoLower and PHao // AO Plots-------------------------------------------------------------------------------------------------------------------------------------------------------------------- plot(PLao and indicator == "AO" ? ao[lookAheadRight] : na, offset = lookAheadRight * -1, title = "Bullish Divergence", linewidth =3 , color = aobullDivergence ? color.new(#09FF00, 0) : color.new(#161923, 100)) plot(PHao and indicator == "AO" ? ao[lookAheadRight] : na, offset = lookAheadRight * -1, title = "Bearish Divergence", linewidth =3 , color = aobearDivergence ? color.new(color.red, 0) : color.new(#161923, 100)) // AO Basic Labels-------------------------------------------------------------------------------------------------------------------------------------------------------------------- if aobullDivergence and ao[lookAheadRight] < p10 and indicator == "AO" label.new(bar_index[lookAheadRight], math.round(ao[lookAheadRight]), text = "Bullish Divergence", style = label.style_label_up, color = color.new(color.green, 100), textcolor = color.white, size = size.small) if aobearDivergence and ao[lookAheadRight] > p90 and indicator == "AO" label.new(bar_index[lookAheadRight], math.round(ao[lookAheadRight]), text = "Bearish Divergence", style = label.style_label_down, color = color.new(color.red, 100), textcolor = color.white, size = size.small)
ORB with Price Targets
https://www.tradingview.com/script/ZpONAzhm-ORB-with-Price-Targets/
getthatcashmoney
https://www.tradingview.com/u/getthatcashmoney/
1,027
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/ // © amitgandhinz //@version=5 indicator(title="ORB", overlay=true) // Input options // openingRangeMinutes = input.int(15, title="Opening Range Period (minutes)", options=[5, 15, 30]) // hack the tradingview issue where int combo boxes no longer display correctly (12/21/2022), but string combo boxes still work sOpeningRangeMinutes = input.string("15", title="Period (minutes)", options=["5", "15", "30", "0"], tooltip="Set to 0 if you want to use International Overrides") openingRangeMinutes = str.tonumber(sOpeningRangeMinutes) //session = input.session("0930-0945", title="Opening Range Session Time", options=["0930-0935", "0930-0945", "0930-1000"]) alertBreakoutsOnly = input.bool(false, "Alert only on ORB breakouts (not price ticks)") showLabels = input.bool(true, "Show ORB labels", group="Display Lines") showPreviousDayORBs = input.bool(true, "Show ORB ranges on previous days", group="Display Lines") showEntries = input.bool(true, "Show potential ORB Breakouts and Retests (BRB)", group="Display Lines") showPriceTargets= input.bool(true, "Show Default Price Targets (50%, 100%)", group="Display Lines") showPriceTargetsExtended = input.bool(false, "Show Extended Price Targets (150%, 200%)", group="Display Lines") showMidPoint = input.bool(false, "Show ORB Mid Point", group="Display Lines") showFibTargets = false//input.bool(false, "Show Fibonacci Targets (21.2%, 61.8%)", group="Display Lines") boxBorderSize = 2 // input.int(2, title="Box border size", minval=0, group="Style") showShadedBox = input.bool(true, "Shade the ORB Range", group="ORB Box") shadeColor = input.color(color.teal, "Shaded ORB Range Color", group="ORB Box") sORBStartTime = input.string("0930-0945", title="Time Override", tooltip="Set Period to 0 to apply. Format should be 0930-0945", group="Optional International Overrides") sTimeZone = input.string("America/New_York", title="Timezone", options=["America/New_York", "Europe/Amsterdam", "Europe/Berlin", "Asia/Kolkata", "Asia/Shanghai", "Asia/Tokyo", "Etc/UTC"], group="Optional International Overrides") session = switch openingRangeMinutes 5 => "0930-0935" 15 => "0930-0945" 30 => "0930-1000" 0 => sORBStartTime => "0930-0945" inputMax = openingRangeMinutes timeinrange(session) => not na(time(timeframe.period, session + ":23456", sTimeZone)) ? 1 : 0 // t = time(timeframe.period, session + ":23456") in_session = timeinrange(session) hideOpen = timeframe.isintraday and timeframe.multiplier <= inputMax and not in_session // Create variables var orbTitle = "ORB" + str.tostring(openingRangeMinutes) var orbHighPrice = 0.0 var orbLowPrice = 0.0 var box dailyBox = na var inBreakout = false // See if a new calendar day started on the intra-day time frame newDayStart = dayofmonth != dayofmonth[1] and timeframe.isintraday bool isToday = false if year(timenow) == year(time) and month(timenow) == month(time) and dayofmonth(timenow) == dayofmonth(time) and session.ismarket isToday := true // determine ORB15 levels is_newbar(res) => ta.change(time(res)) != 0 is_first = in_session and not in_session[1] and session.ismarket if is_first orbHighPrice := high orbLowPrice := low inBreakout := false else orbHighPrice := orbHighPrice[1] orbLowPrice := orbLowPrice[1] if high > orbHighPrice and in_session orbHighPrice := high if low < orbLowPrice and in_session orbLowPrice := low bool drawOrbs = showPreviousDayORBs or (not showPreviousDayORBs and isToday) // When a new day start, create a new box for that day. // Else, during the day, update that day's box. if ( drawOrbs) if (showShadedBox) if is_first dailyBox := box.new(left=bar_index, top=orbHighPrice, right=bar_index + 1, bottom=orbLowPrice, border_width=boxBorderSize) // If we don't want the boxes to join, the previous box shouldn't // end on the same bar as the new box starts. box.set_right(dailyBox[1], bar_index[1]) else box.set_top(dailyBox, orbHighPrice) box.set_rightbottom(dailyBox, right=bar_index + 1, bottom=orbLowPrice) box.set_bgcolor(dailyBox, color.new(shadeColor, 80)) box.set_border_color(dailyBox, color.teal) plot(not in_session and drawOrbs ? orbHighPrice : na, style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.green, title="ORB High", linewidth=2) plot(not in_session and drawOrbs ? orbLowPrice : na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.red, title="ORB Low", linewidth=2) // plot PT for ORB - 50% retracement orbRange = orbHighPrice - orbLowPrice plot(not in_session and showPriceTargets and showMidPoint and drawOrbs ? orbLowPrice + (orbRange * 0.5): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.gray, title="ORB Mid Point", linewidth=1) plot(not in_session and showPriceTargets and drawOrbs ? orbHighPrice + (orbRange * 0.5) : na, style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.purple, title="ORB High PT 0.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs ? orbHighPrice + (orbRange * 1.0): na , style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.blue, title="ORB High PT 1.0", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbHighPrice + (orbRange * 1.5): na , style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.teal, title="ORB High PT 1.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbHighPrice + (orbRange * 2.0): na , style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.teal, title="ORB High PT 2.0", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbHighPrice + (orbRange * 2.5): na , style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.teal, title="ORB High PT 2.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbHighPrice + (orbRange * 3.0): na , style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.teal, title="ORB High PT 3.0", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbHighPrice + (orbRange * 3.5): na , style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.teal, title="ORB High PT 3.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbHighPrice + (orbRange * 4.0): na , style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.teal, title="ORB High PT 4.0", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbHighPrice + (orbRange * 4.5): na , style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.teal, title="ORB High PT 4.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbHighPrice + (orbRange * 5.0): na , style=plot.style_linebr, color=orbHighPrice[1] != orbHighPrice ? na : color.teal, title="ORB High PT 5.0", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs ? orbLowPrice + (orbRange * -0.5): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.purple, title="ORB Low PT 0.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs ? orbLowPrice + (orbRange * -1.0): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.blue, title="ORB Low PT 1.0", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbLowPrice + (orbRange * -1.5): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.teal, title="ORB Low PT 1.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbLowPrice + (orbRange * -2.0): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.teal, title="ORB Low PT 2.0", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbLowPrice + (orbRange * -2.5): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.teal, title="ORB Low PT 2.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbLowPrice + (orbRange * -3.0): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.teal, title="ORB Low PT 3.0", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbLowPrice + (orbRange * -3.5): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.teal, title="ORB Low PT 3.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbLowPrice + (orbRange * -4.0): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.teal, title="ORB Low PT 4.0", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbLowPrice + (orbRange * -4.5): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.teal, title="ORB Low PT 4.5", linewidth=2) plot(not in_session and showPriceTargets and drawOrbs and showPriceTargetsExtended ? orbLowPrice + (orbRange * -5.0): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.teal, title="ORB Low PT 5.0", linewidth=2) // fib levels plot(not in_session and showFibTargets ? orbHighPrice + (orbRange * 0.272): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.orange, title="ORB 27.2%", linewidth=2) plot(not in_session and showFibTargets ? orbHighPrice + (orbRange * 0.618): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.fuchsia, title="ORB 61.8%", linewidth=2) plot(not in_session and showFibTargets ? orbLowPrice + (orbRange * -0.272): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.orange, title="ORB 27.2%", linewidth=2) plot(not in_session and showFibTargets ? orbLowPrice + (orbRange * -0.618): na , style=plot.style_linebr, color=orbLowPrice[1] != orbLowPrice ? na : color.fuchsia, title="ORB 61.8%", linewidth=2) drawPriceTargetLabel(fromPrice, level, name, col) => if showLabels var pt = label.new(bar_index, fromPrice + (orbRange * level), style=label.style_label_lower_left, text=orbTitle + " " + name, color=col, textcolor=color.white) label.set_xy(pt, bar_index + 2, fromPrice + (orbRange * level)) drawPriceTargetLabel(orbHighPrice, 0, "HIGH", color.green) drawPriceTargetLabel(orbLowPrice, 0, "LOW", color.red) if (not in_session and showPriceTargets and isToday and session.ismarket and drawOrbs ) drawPriceTargetLabel(orbHighPrice, 0.5, "PT 50%", color.purple) drawPriceTargetLabel(orbHighPrice, 1.0, "PT 100%", color.blue) drawPriceTargetLabel(orbLowPrice, -0.5, "PT 50%", color.purple) drawPriceTargetLabel(orbLowPrice, -1.0, "PT 100%", color.blue) if showPriceTargetsExtended drawPriceTargetLabel(orbHighPrice, 1.5, "PT 150%", color.teal) drawPriceTargetLabel(orbHighPrice, 2.0, "PT 200%", color.teal) drawPriceTargetLabel(orbHighPrice, 2.5, "PT 250%", color.teal) drawPriceTargetLabel(orbHighPrice, 3.0, "PT 300%", color.teal) drawPriceTargetLabel(orbHighPrice, 3.5, "PT 350%", color.teal) drawPriceTargetLabel(orbHighPrice, 4.0, "PT 400%", color.teal) drawPriceTargetLabel(orbHighPrice, 4.5, "PT 450%", color.teal) drawPriceTargetLabel(orbHighPrice, 5.0, "PT 500%", color.teal) drawPriceTargetLabel(orbLowPrice, -1.5, "PT 150%", color.teal) drawPriceTargetLabel(orbLowPrice, -2.0, "PT 200%", color.teal) drawPriceTargetLabel(orbLowPrice, -2.5, "PT 250%", color.teal) drawPriceTargetLabel(orbLowPrice, -3.0, "PT 300%", color.teal) drawPriceTargetLabel(orbLowPrice, -3.5, "PT 350%", color.teal) drawPriceTargetLabel(orbLowPrice, -4.0, "PT 400%", color.teal) drawPriceTargetLabel(orbLowPrice, -4.5, "PT 450%", color.teal) drawPriceTargetLabel(orbLowPrice, -5.0, "PT 500%", color.teal) if showMidPoint drawPriceTargetLabel(orbLowPrice, 0.5, "MIDPOINT", color.gray) if (not in_session and showFibTargets and isToday and session.ismarket and drawOrbs ) drawPriceTargetLabel(orbHighPrice, 0.272, "FIB 27.2%", color.orange) drawPriceTargetLabel(orbHighPrice, 0.618, "FIB 61.8%", color.fuchsia) drawPriceTargetLabel(orbLowPrice, -0.272, "FIB 27.2%", color.orange) drawPriceTargetLabel(orbLowPrice, -0.618, "FIB 61.8%", color.fuchsia) // candle crossed orb level, next candle stayed above it, current candle also stayed above it, and had volume in there //volumeSMA = ta.sma(volume, 20) //bool volumeSpiked = volume[2] > volumeSMA[2] or volume[1] > volumeSMA[1] or volume > volumeSMA bool highCrossBO = (low[2] < orbHighPrice and close[2] > orbHighPrice and low[1] > orbHighPrice and close[1] > orbHighPrice and close > low[1] and low > orbHighPrice) and session.ismarket bool lowCrossBO = (high[2] > orbLowPrice and close[2] < orbLowPrice and high[1] < orbLowPrice and close[1] < orbLowPrice and close < high[1] and high < orbLowPrice) and session.ismarket bool highCross = (not alertBreakoutsOnly and ta.cross(close, orbHighPrice)) or (alertBreakoutsOnly and highCrossBO) bool lowCross = (not alertBreakoutsOnly and ta.cross(close, orbLowPrice)) or (alertBreakoutsOnly and lowCrossBO) bool isRetestOrbHigh = close[1] > orbHighPrice and low <= orbHighPrice and close >= orbHighPrice bool isRetestOrbLow = close[1] < orbLowPrice and high >= orbLowPrice and close <= orbLowPrice bool failedRetest = inBreakout and ((close[1] > orbHighPrice and close < orbHighPrice) or (close[1] < orbLowPrice and close > orbLowPrice)) // show entries if (showEntries and session.ismarket) if (highCrossBO) lbl = label.new(bar_index, na) label.set_color(lbl, color.green) label.set_textcolor(lbl, color.green) label.set_text(lbl, "Breakout\n Wait for Retest") label.set_yloc( lbl,yloc.abovebar) label.set_style(lbl, label.style_triangledown) label.set_size(lbl, size.tiny) inBreakout := true if (lowCrossBO) lbl = label.new(bar_index, na) label.set_color(lbl, color.green) label.set_textcolor(lbl, color.green) label.set_text(lbl, "Breakout,\n Wait for Retest") label.set_yloc( lbl,yloc.belowbar) label.set_style(lbl, label.style_triangleup) label.set_size(lbl, size.tiny) inBreakout := true if inBreakout and (isRetestOrbHigh or isRetestOrbLow) // we have our breakout and retest lbl = label.new(bar_index, na) label.set_color(lbl, color.green) label.set_textcolor(lbl, color.white) label.set_text(lbl, "Retest") label.set_yloc( lbl,yloc.abovebar) label.set_style(lbl, label.style_label_down) label.set_size(lbl, size.tiny) inBreakout := false if inBreakout and failedRetest // we have failed the retest lbl = label.new(bar_index, na) label.set_color(lbl, color.red) label.set_textcolor(lbl, color.white) label.set_text(lbl, "Failed Retest") label.set_yloc( lbl,yloc.abovebar) label.set_style(lbl, label.style_label_down) label.set_size(lbl, size.tiny) inBreakout := false // show alerts alertcondition(not in_session and session.ismarket and (highCross or lowCross), title="ORB Level Cross", message="Price crossing ORB Level") alertcondition(not in_session and session.ismarket and alertBreakoutsOnly and (highCrossBO or lowCrossBO), title="ORB Breakout", message="Price Breaking out of ORB Level, Look for Retest") if (not in_session and isToday and session.ismarket) if (not alertBreakoutsOnly) if highCross alert("Price crossing ORB High Level", alert.freq_once_per_bar) if lowCross alert("Price crossing ORB Low Level", alert.freq_once_per_bar) if (alertBreakoutsOnly) if highCrossBO alert("Price breaking out of ORB High Level, Look for Retest", alert.freq_once_per_bar) if lowCrossBO alert("Price breaking out of ORB Low Level, Look for Retest", alert.freq_once_per_bar)
Correction Territory
https://www.tradingview.com/script/0gms2U8h/
FX365_Thailand
https://www.tradingview.com/u/FX365_Thailand/
91
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/ // © FX365_Thailand //Revision History //v8.0 First release //v20.0 Enabled to select source to calculate correction rate //@version=4 study("Correction Territory",overlay=false,shorttitle="Correction Territory") //Users input i_period = input(type=input.integer, title="Period", defval=20) i_source = input(type=input.string,defval="low", options=["low","close"], title="Source") //Get highest h = highest(high,i_period) source = i_source == "low" ? low : close //Calcurate correction rate rate = (source - h ) / h * 100 // Plot a=plot(rate, color=color.red, title="Correction Rate",style=plot.style_area) //high line hline(-20, title="Hiline1") hline(-30, title="Hiline2") hline(-35, title="Hiline3")
Smarter Pullback + Candlestick Pattern (Steven Hart)
https://www.tradingview.com/script/L1dxLLZV-Smarter-Pullback-Candlestick-Pattern-Steven-Hart/
hanabil
https://www.tradingview.com/u/hanabil/
408
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/ // © hanabil //@version=5 indicator("Smarter Pullback + Candlestick Pattern", overlay=true) gr1 = 'Pullback' minimumPullback = input.int(2, 'Previous Candle of Pullback', 1, 5, group=gr1) gr2 = 'Candlestick Pattern of Pullback' engulfing = input(true, 'Engulfing', group=gr2) doji = input(true, 'Doji', group=gr2) hs = input(true, 'Hammer - Shooting Star', group=gr2) gr3 = 'EMA Trend Filter' trendFilter = input(true, 'Trend Filter By EMA', group=gr3) emaLen = input(50, 'EMA Period', group=gr3) ema = ta.ema(close, emaLen) gr4 = 'Styling' showPattern = input(true, 'Show Pattern Name', group=gr4) textCol = input.color(color.white, 'Text Color', group=gr4) bullText = input('🔼', 'Bull', '', '1', gr4) bullCol = input.color(#2962ff, '', '', '1', gr4) bearText = input('🔽', 'Bear', '', '2', gr4) bearCol = input.color(#f23645, '', '', '2', gr4) fLabel(x, y, pn)=> labelStyle = y==high? label.style_label_down : label.style_label_up labelCol = y==high? bearCol : bullCol labelText_ = y==high? bearText : bullText labelText = showPattern? labelText_ + pn : labelText_ if x label.new(bar_index, y, labelText, style=labelStyle, color=labelCol, size=size.small, textcolor=textCol) plot(ema, 'EMA', color=color.blue) bullEmaFilter = close>ema bearEmaFilter = close<ema isGreen = close>open isRed = close<open prevIs(x, y)=> y<=2? x[1] and x[2] : y<=3? x[1] and x[2] and x[3] : y<=4? x[1] and x[2] and x[3] and x[4] : y<=5? x[1] and x[2] and x[3] and x[4] and x[5] : na bullPb = prevIs(isRed , minimumPullback) bearPb = prevIs(isGreen, minimumPullback) // Engulfing bullEngulf = open<=close[1] and open<open[1] and close>open[1] bearEngulf = open>=close[1] and open>open[1] and close<open[1] bullPbEn = bullEngulf and bullPb and bullEmaFilter and engulfing bearPbEn = bearEngulf and bearPb and bearEmaFilter and engulfing fLabel(bullPbEn, low , ' EN') fLabel(bearPbEn, high, ' EN') alertcondition(bullPbEn, 'Bull Engulfing Pullback', 'Bull Engulfing Pullback Found') alertcondition(bearPbEn, 'Bear Engulfing Pullback', 'Bear Engulfing Pullback Found') // Doji wickPercent = 5.0 wickEqualPercent = 100.0 bodyPercent = 5.0 factor = 2 bodyHi = math.max(close, open) bodyLo = math.min(close, open) body = bodyHi - bodyLo shadowUp = high - bodyHi shadowDn = bodyLo - low candleRange = high-low shadowSize = shadowUp == shadowDn or (math.abs(shadowUp - shadowDn) / shadowDn * 100) < wickEqualPercent and (math.abs(shadowDn - shadowUp) / shadowUp * 100) < wickEqualPercent bodyAvg = ta.ema(body, 14) smallBody = body < bodyAvg hasShadowUp = shadowUp > wickPercent / 100 * body hasShadowDn = shadowDn > wickPercent / 100 * body isDojiBody = candleRange > 0 and body <= candleRange * bodyPercent / 100 isDoji = isDojiBody and shadowSize bullPbDj = isDoji[1] and bullPb and bullEmaFilter and doji bearPbDj = isDoji[1] and bearPb and bearEmaFilter and doji fLabel(bullPbDj, low , ' DJ') fLabel(bearPbDj, high, ' DJ') alertcondition(bullPbDj, 'Bull Doji Pullback', 'Bull Doji Pullback Found') alertcondition(bearPbDj, 'Bear Doji Pullback', 'Bear Doji Pullback Found') // Hammer - Shooting Star bullHs = smallBody and body > 0 and bodyLo > hl2 and (shadowDn >= factor * body) and not hasShadowUp bearHs = smallBody and body > 0 and bodyHi < hl2 and (shadowUp >= factor * body) and not hasShadowDn bullPbHs = bullHs and bullPb and bullEmaFilter and hs bearPbHs = bearHs and bearPb and bearEmaFilter and hs fLabel(bullPbHs, low , ' H') fLabel(bearPbHs, high, ' SS') alertcondition(bullPbHs, 'Bull Hammer Pullback', 'Bull Hammer Pullback Found') alertcondition(bearPbHs, 'Bear Shooting-Star Pullback', 'Bear Shooting-Star Pullback Found') // ------ // quotes gr50 = 'QUOTES' showTable = input(true, 'Show Quotes Table', group=gr50) quote = input('Keep Spirit 😗', 'Drop Your Quotes Here', group=gr50) tabPosI_ = input.string('Top', 'Table Position', ['Top', 'Middle', 'Bot'], group=gr50) tabPos_ = tabPosI_=='Top'? position.top_right : tabPosI_=='Bot'? position.bottom_right : position.middle_right tabColor = input.color(color.new(#512da8, 35) , 'Background', group=gr50) borderCol = input.color(color.black , 'Border', group=gr50) tabTextCol = input.color(color.white, 'Text', group=gr50) var saTable = table.new(tabPos_, 10, 10, tabColor, borderCol, 1, borderCol, 1) if showTable table.cell(saTable, 0, 0, '🎓 SmarterAlgo 🎓', text_color=tabTextCol, text_size=size.small) table.cell(saTable, 0, 1, quote, text_color=tabTextCol, text_size=size.small)
Flat Detect By Bollinger Bands
https://www.tradingview.com/script/nzkbNJSw-Flat-Detect-By-Bollinger-Bands/
Eff_Hash
https://www.tradingview.com/u/Eff_Hash/
232
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/ // © Eff_Hash //@version=5 indicator(shorttitle="Flat Detect By BB", title="Flat Detect By Bollinger Bands", overlay=true, timeframe="", timeframe_gaps=true) //Inputs BBlength = input.int(20, minval=1, group='Bollinger Bands Config') BBsrc = input(close, title="Source", group='Bollinger Bands Config') BBmult = input.float(2.0, minval=0.001, maxval=50, title="StdDev", group='Bollinger Bands Config') BBThreshold_Type = input.string(title="Threshold Type", defval="Ticks", options=["Ticks", "%"], group='Bollinger Bands Config') BBThreshold_Width = input.float(0.055, minval=0, step=0.001, title="Threshold Width in Ticks (Old version)", group='Bollinger Bands Config') BBThreshold_Width_purcent = input.float(1.00, minval=0, step=0.1, title="Threshold Width in %", group='Bollinger Bands Config') Add_ATR_Filter = input.bool(title = 'Add ATR Filter', defval=false, group='ATR Config') ATR_length = input.int(title="Length", defval=14, minval=1, group='ATR Config') ATR_smoothing = input.string(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"], group='ATR Config') ATR_Threshold = input.float(minval=0.0, defval=25, title="ATR Threshold", group='ATR Config') //ATR Calcul ATR_ma_function(source, ATR_length) => switch ATR_smoothing "RMA" => ta.rma(source, ATR_length) "SMA" => ta.sma(source, ATR_length) "EMA" => ta.ema(source, ATR_length) => ta.wma(source, ATR_length) ATR_signal = ATR_ma_function(ta.tr(true), ATR_length) ATR_no_trade = Add_ATR_Filter ? (ATR_signal <= ATR_Threshold) : false ATR_go_trade = not ATR_no_trade //Bollinger Bands & Width calcul BBdev = BBmult * ta.stdev(BBsrc, BBlength) BBbasis = ta.sma(BBsrc, BBlength) BBupper = BBbasis + BBdev BBlower = BBbasis - BBdev bbw = (BBupper-BBlower)/BBbasis bbw_purcent = (BBupper-BBlower) / BBupper * 100 //Flat Zone color change BBcolor = color.white BackBBcolor = color.white //In % if BBThreshold_Type == "%" BBcolor := (bbw_purcent > BBThreshold_Width_purcent) and ATR_go_trade ? color.lime : color.red BackBBcolor := (bbw_purcent > BBThreshold_Width_purcent) and ATR_go_trade ? color.rgb(33, 250, 243, 90) : color.rgb(250, 5, 10, 90) //In Ticks if BBThreshold_Type == "Ticks" BBcolor := (bbw > BBThreshold_Width) and ATR_go_trade ? color.lime : color.red BackBBcolor := (bbw > BBThreshold_Width) and ATR_go_trade ? color.rgb(33, 250, 243, 90) : color.rgb(250, 5, 10, 90) //Display Indicator plot(BBbasis, "Basis", color=#FF6D00) BBp1 = plot(BBupper, "Upper", color=BBcolor) BBp2 = plot(BBlower, "Lower", color=BBcolor) fill(BBp1, BBp2, title = "Background", color=BackBBcolor) //Alerts AlertFlatflag = false AlertNotFlatflag = false AlertFlat = false AlertNotFlat = false if BBThreshold_Type == "%" AlertFlatflag := (bbw_purcent > BBThreshold_Width_purcent) and ATR_go_trade ? true : false AlertNotFlatflag := (bbw_purcent > BBThreshold_Width_purcent) and ATR_go_trade ? false : true AlertFlat := (AlertFlatflag[1] == false) and AlertFlatflag AlertNotFlat := (AlertNotFlatflag[1] == false) and AlertNotFlatflag if BBThreshold_Type == "Ticks" AlertFlatflag := (bbw > BBThreshold_Width) and ATR_go_trade ? true : false AlertNotFlatflag := (bbw > BBThreshold_Width) and ATR_go_trade ? false : true AlertFlat := (AlertFlatflag[1] == false) and AlertFlatflag AlertNotFlat := (AlertNotFlatflag[1] == false) and AlertNotFlatflag alertcondition(AlertFlat , title='Market is Flat', message='Market is Flat') alertcondition(AlertNotFlat , title='Market is not Flat', message='Market is not Flat')
Pivot Support/Resistance
https://www.tradingview.com/script/Xx1hnROe-Pivot-Support-Resistance/
ncy12
https://www.tradingview.com/u/ncy12/
100
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/ // © ncy12 //@version=5 indicator("Pivot Support/Resistance",overlay=true) gr="LENGTH LEFT / RIGHT" leftLenH = input.int(title="Pivot High", defval=10, minval=1, inline="Pivot High",group=gr) rightLenH = input.int(title="/", defval=10, minval=1, inline="Pivot High",group=gr) leftLenL = input.int(title="Pivot Low", defval=10, minval=1, inline="Pivot Low", group=gr) rightLenL = input.int(title="/", defval=10, minval=1, inline="Pivot Low",group=gr) numberOfBars = input.int(title="Number of Bars", defval=100, minval=1) extendParam = input.string(title="Extend", defval="NONE", options=["NONE", "BOTH", "LEFT", "RIGHT"]) lineDirection = input.string(title="Direction", defval="BOTH", options=["BOTH","UP", "DOWN"]) shCount = input.int(title="Swing Highs", defval=2, minval=2, step=2) slCount = input.int(title="Swing Lows", defval=2, minval=2, step=2) extendInput = switch extendParam "NONE" => extend.none "BOTH" => extend.both "LEFT" => extend.left "RIGHT" => extend.right ph = ta.pivothigh(high,leftLenH, rightLenH) var pha = array.new_float() var phai = array.new_int() pl = ta.pivotlow(low, leftLenL, rightLenL) var pla = array.new_float() var plai = array.new_int() if not na(ph) and last_bar_index - bar_index <= numberOfBars array.push(pha,ph) array.push(phai, bar_index) if not na(pl) and last_bar_index - bar_index <= numberOfBars array.push(pla,pl) array.push(plai, bar_index) max_bars_back(time, 5000) if (barstate.islast) //delete all lines a_allLines = line.all if array.size(a_allLines) > 0 for i = 0 to array.size(a_allLines) - 1 line.delete(array.get(a_allLines, i)) phac = array.copy(pha) plac = array.copy(pla) array.push(phac,close) array.push(plac,close) array.sort(phac) array.sort(plac) for i=0 to array.size(phac)-1 if array.get(phac,i) == close if (i != array.size(phac) -1) for j=1 to shCount/2 if (i+j >= array.size(phac)) continue if (lineDirection=="BOTH" or lineDirection=="UP") phindex = array.lastindexof(pha, array.get(phac,i+j)) line.new(array.get(phai,phindex)-leftLenH, array.get(phac,i+j), bar_index, array.get(phac,i+j),color=color.lime, extend=extendInput) if (i != 0) for j=1 to shCount/2 if (i-j < 0) continue if (lineDirection=="BOTH" or lineDirection=="DOWN") phindex = array.lastindexof(pha, array.get(phac,i-j)) line.new(array.get(phai,phindex)-leftLenH, array.get(phac,i-j), bar_index, array.get(phac,i-j),color=color.lime, extend=extendInput) for i=0 to array.size(plac)-1 if array.get(plac,i) == close if (i != array.size(plac) -1) for j=1 to slCount/2 if (i+j >= array.size(plac)) continue if (lineDirection=="BOTH" or lineDirection=="UP") phindex = array.lastindexof(pla, array.get(plac,i+j)) line.new(array.get(plai,phindex)-leftLenL, array.get(plac,i+j), bar_index, array.get(plac,i+j), color=color.red, extend=extendInput) if (i != 0) for j=1 to slCount/2 if (i-j < 0) continue if (lineDirection=="BOTH" or lineDirection=="DOWN") phindex = array.lastindexof(pla, array.get(plac,i-j)) line.new(array.get(plai,phindex)-leftLenL, array.get(plac,i-j), bar_index, array.get(plac,i-j), color=color.red, extend=extendInput)
Imbalanced zone
https://www.tradingview.com/script/7GES9cXf-Imbalanced-zone/
frozon
https://www.tradingview.com/u/frozon/
954
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/ // Update // - update screenshot // - add alerts // - fix deletion of triggered zone // - update screenshot // - add mid lines to imbalanced boxes // - add color option for each box type // Update 6-5-2023 // - add timeframe selection //@version=5 indicator(title='Imbalanced zone', overlay=true) tf = input.timeframe(defval = '', title = 'TimeFrame') penetrationRatio = input.float(defval=0.2, minval=0, maxval=1, step=0.1, title="Penetration Ratio") reduce = input.bool(defval=true, title="Reduce boxes") extendBoxes = input.bool(defval=true, title="Extend boxes") imbalancedDownColor = input.color(color.rgb(120,120,120,80), title="Box color", group="Imbalanced down") imbalancedDownMidLineColor = input.color(color.rgb(120,120,120), title="Mid line color", group="Imbalanced down") imbalancedUpColor = input.color(color.rgb(120,120,120,80), title="Box color", group="Imbalanced up") imbalancedUpMidLineColor = input.color(color.rgb(120,120,120), title="Mid line color", group="Imbalanced up") var box[] imbalancedDownBoxes = array.new_box() var box[] imbalancedUpBoxes = array.new_box() var line[] imbalancedDownMidLines = array.new_line() var line[] imbalancedUpMidLines = array.new_line() maxBarHistory = input.int(500, title="Max IPA age") extension = extend.none if extendBoxes extension := extend.right findImbalance(h1, h3, l1, l3) => if h3 < l1 and l3 != l3[1] array.push(imbalancedDownBoxes,box.new(left=bar_index - 2,bottom=h3,right=bar_index + 20,top=l1,bgcolor=imbalancedDownColor,border_color=imbalancedDownColor,extend=extension)) midPoint = (h3-l1)/2+l1 array.push(imbalancedDownMidLines, line.new(bar_index - 2, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedDownMidLineColor)) if l3 > h1 and h3 != h3[1] array.push(imbalancedUpBoxes, box.new(left=bar_index - 2, top=l3, right=bar_index + 20, bottom=h1, bgcolor=imbalancedUpColor, border_color=imbalancedUpColor, extend=extension)) midPoint = (h1-l3)/2+l3 array.push(imbalancedUpMidLines, line.new(bar_index - 2, midPoint, bar_index+20, midPoint, style=line.style_dotted, extend=extension, color=imbalancedUpMidLineColor)) [h1, h3, l1, l3] = request.security(syminfo.tickerid, tf, [high[1], high[3], low[1], low[3]],lookahead = barmerge.lookahead_on) findImbalance(h1, h3, l1, l3) if array.size(imbalancedUpBoxes) > 0 for i = array.size(imbalancedUpBoxes) - 1 to 0 by 1 imbalancedBox = array.get(imbalancedUpBoxes, i) top = box.get_top(imbalancedBox) bottom = box.get_bottom(imbalancedBox) invalidationLimit = (top - bottom) * penetrationRatio box.set_right(imbalancedBox, bar_index + 20) midLine = array.get(imbalancedUpMidLines, i) line.set_x2(midLine, bar_index + 20) age = box.get_left(imbalancedBox) if bar_index - age > maxBarHistory box.delete(imbalancedBox) array.remove(imbalancedUpBoxes, i) line.delete(midLine) array.remove(imbalancedUpMidLines, i) else if reduce and high > bottom box.set_bottom(imbalancedBox, high) if high >= bottom + invalidationLimit box.delete(imbalancedBox) array.remove(imbalancedUpBoxes, i) line.delete(midLine) array.remove(imbalancedUpMidLines, i) if array.size(imbalancedDownBoxes) > 0 for i = array.size(imbalancedDownBoxes) - 1 to 0 by 1 imbalancedBox = array.get(imbalancedDownBoxes, i) top = box.get_top(imbalancedBox) bottom = box.get_bottom(imbalancedBox) invalidationLimit = (top - bottom) * penetrationRatio box.set_right(imbalancedBox, bar_index + 20) midLine = array.get(imbalancedDownMidLines, i) line.set_x2(midLine, bar_index + 20) age = box.get_left(imbalancedBox) if bar_index - age > maxBarHistory box.delete(imbalancedBox) array.remove(imbalancedDownBoxes, i) line.delete(midLine) array.remove(imbalancedDownMidLines, i) else if reduce and low < top box.set_top(imbalancedBox, low) if low <= top - invalidationLimit box.delete(imbalancedBox) array.remove(imbalancedDownBoxes, i) line.delete(midLine) array.remove(imbalancedDownMidLines, i)
Moving Averages Trend Indicator
https://www.tradingview.com/script/Thz1txbP-Moving-Averages-Trend-Indicator/
Dr_Roboto
https://www.tradingview.com/u/Dr_Roboto/
106
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/ // © Dr_Roboto // Computes a metric (0.0-1.0) based on the relative (above/below) relationship of price (close) and the moving averages of // WMA0 (20day), SMA1 (50day), SMA2 (100day), SMA3 (200day). // Metric = 1.0 when price > SMA0 > SMA1 > SMA2 > SMA3 // Metric = 0.0 when price < SMA0 < SMA1 < SMA2 < SMA3 // This metric helps you track the price "trend." Color of the metric helps you track if the price is a bullish (green) or bearish (red). Blue indicates neutral. // // Settings: // Time Frame is adjustable // SMA lengths are adjustable // Threshold for bullish/bearish is adjustable //@version=4 study("Moving Average Trend Indicator", overlay=false, resolution="") //================================================================================================================================= // Moving Average (VWMA) // This code matches the "Four SMA Trends" Indicator and cRSI + Waves Strategy //================================================================================================================================= // --- Weight Moving Average for first trend --- smaLen0 = input(defval=20, title="WMA #0 Length", type=input.integer, minval=1, maxval=200) sma0 = wma(close, smaLen0) sma0_high = wma(high, smaLen0) sma0_low = wma(low, smaLen0) // --- Regular SMA --- price = close smaLen1 = input(defval=50, title="SMA #1 Length", type=input.integer, minval=1, maxval=200) sma1 = sma(price,smaLen1) // plot(sma1, title='SMA #1', color = color.blue, linewidth=smaLineWidth) smaLen2 = input(defval=100, title="SMA #2 Length", type=input.integer, minval=1, maxval=200) sma2 = sma(price,smaLen2) // plot(sma2, title='SMA #2', color = color.maroon, linewidth=smaLineWidth) smaLen3 = input(defval=200, title="SMA #2 Length", type=input.integer, minval=1, maxval=200) sma3 = sma(price,smaLen3) // plot(sma3, title='SMA #3', color = color.black, linewidth=smaLineWidth) //================================================================================================================================= // Trends //================================================================================================================================= // Lower weight for price and faster SMAs as the are a type of noise on the overall trend maxTrendStrength = 0 weight = 1 // price weight := 1 maxTrendStrength := maxTrendStrength + 4*weight trendStrengthP = 0 if close > sma0 trendStrengthP := trendStrengthP + weight if close > sma1 trendStrengthP := trendStrengthP + weight if close > sma2 trendStrengthP := trendStrengthP + weight if close > sma3 trendStrengthP := trendStrengthP + weight // sma0 weight := 2 maxTrendStrength := maxTrendStrength + 3*weight trendStrength0 = 0 if sma0 > sma1 trendStrength0 := trendStrength0 + weight if sma0 > sma2 trendStrength0 := trendStrength0 + weight if sma0 > sma3 trendStrength0 := trendStrength0 + weight // sma1 weight := 3 maxTrendStrength := maxTrendStrength + 2*weight trendStrength1 = 0 if sma1 > sma2 trendStrength1 := trendStrength1 + weight if sma1 > sma3 trendStrength1 := trendStrength1 + weight // sma2 weight := 4 maxTrendStrength := maxTrendStrength + 1*weight trendStrength2 = 0 if sma2 > sma3 trendStrength2 := trendStrength2 + weight // sum the individual trend strengths trendStrength = trendStrengthP + trendStrength0 + trendStrength1 + trendStrength2 // normalize strength to 1.0 trendStrength := trendStrength/maxTrendStrength // filter out noise using sma maLen = 5 //trendStrengthSmoothS = sma(trendStrength,maLen) // most phase lag //trendStrengthSmoothE = ema(trendStrength,maLen) // middle trendStrengthSmoothW = wma(trendStrength,maLen) // least phase lag //================================================================================================================================= // Plotting //================================================================================================================================= hline(1, title='zero', color=color.green, linestyle=hline.style_dashed, linewidth=1) hline(0.5, title='zero', color=color.gray, linestyle=hline.style_dashed, linewidth=1) hline(0, title='zero', color=color.red, linestyle=hline.style_dashed, linewidth=1) // Trend Color bear = input(defval=0.35, title="Bear Threshold", type=input.float, minval=0, maxval=1) bull = input(defval=0.65, title="Bull Threshold", type=input.float, minval=0, maxval=1) trendColor = color.blue if trendStrengthSmoothW < bear trendColor := color.red else if trendStrengthSmoothW > bull trendColor := color.green // plot(trendStrengthP, title='trendStrength', color = color.red, linewidth=1) // plot(trendStrength0, title='trendStrength', color = color.maroon, linewidth=1) // plot(trendStrength1, title='trendStrength', color = color.orange, linewidth=1) // plot(trendStrength2, title='trendStrength', color = color.yellow, linewidth=1) //plot(trendStrength, title='trendStrength', color = color.blue, linewidth=3) // plot(trendStrength, title='trendStrength', color = trendColor, linewidth=3) // plot(trendStrengthSmoothS, title='trendStrengthSmooth', color = color.red, linewidth=2) // plot(trendStrengthSmoothE, title='trendStrengthSmooth', color = color.green, linewidth=2) plot(trendStrengthSmoothW, title='trendStrengthSmooth', color = trendColor, linewidth=2)
MTF Vegas tunnel & pivots
https://www.tradingview.com/script/meo65JmN-MTF-Vegas-tunnel-pivots/
frozon
https://www.tradingview.com/u/frozon/
165
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/ // Thanks to benchch for his Major Minor Fib Points https://www.tradingview.com/script/9utjGwHh-Major-Minor-Fib-Points/ // I especially want to thank TradingView for its platform that facilitates development and learning. // NOTES: // - Use vegas tunnel to identify trend, support, resistance // - Use major & minor points to draw fib // - Use key fibs level & mid vegas to enter a trade //@version=4 study("MTF Vegas tunnel & pivots ", overlay=true) // VEGAS1 _1 = input(true, "Display tunnel 1", group="Tunnel 1min") ma_len = input(title="", type=input.integer, defval=144, inline="1", group="Tunnel 1min") src = input(title="/", type=input.source, defval=close, inline="1", group="Tunnel 1min") ma_offset = input(title="/", type=input.integer, defval=0, inline="1", group="Tunnel 1min") res = input(title="/", type=input.resolution, defval="1", inline="1", group="Tunnel 1min") htf_ma = ema(src, ma_len) out1=security(syminfo.tickerid, res, htf_ma) plotData1 = if (_1 == true) out1 else na plot_1 = plot(plotData1, color=color.new(#00CED1, 100), offset=ma_offset, title='144 VG1') ma_len2 = input(title="", type=input.integer, defval=169, inline="1b", group="Tunnel 1min") src2 = input(title="/", type=input.source, defval=close, inline="1b", group="Tunnel 1min") ma_offset2 = input(title="/", type=input.integer, defval=0, inline="1b", group="Tunnel 1min") res2 = input(title="/", type=input.resolution, defval="1", inline="1b", group="Tunnel 1min") htf_ma2 = ema(src2, ma_len2) out2 = security(syminfo.tickerid, res2, htf_ma2) plotData2 = if (_1 == true) out2 else na plot_2 = plot(plotData2,color=color.new(#00CED1, 60), offset=ma_offset2, title='169 VG1') ma_len3 = input(title="", type=input.integer, defval=233, inline="1c", group="Tunnel 1min") src3 = input(title="/", type=input.source, defval=close, inline="1c", group="Tunnel 1min") ma_offset3 = input(title="/", type=input.integer, defval=0, inline="1c", group="Tunnel 1min") res3 = input(title="/", type=input.resolution, defval="1", inline="1c", group="Tunnel 1min") htf_ma3 = ema(src3, ma_len3) out3 = security(syminfo.tickerid, res3, htf_ma3) plotData3 = if (_1 == true) out3 else na plot_3 = plot(plotData3, color=color.new(#00CED1, 100), offset=ma_offset3, title='233 VG1') fill(plot_1, plot_3, color=color.new(#00CED1, 90), editable=true) // VEGAS2 _2 = input(true, "Display tunnel 5", group="Tunnel 5min") ma_len4 = input(title="", type=input.integer, defval=144, inline="2", group="Tunnel 5min") src4 = input(title="/", type=input.source, defval=close, inline="2", group="Tunnel 5min") ma_offset4 = input(title="/", type=input.integer, defval=0, inline="2", group="Tunnel 5min") res4 = input(title="/", type=input.resolution, defval="5", inline="2", group="Tunnel 5min") htf_ma4 = ema(src4, ma_len4) out4 = security(syminfo.tickerid, res4, htf_ma4) plotData4 = if (_2 == true) out4 else na plot_4 = plot(plotData4, color=color.new(#00BFFF, 100), offset=ma_offset4, title='144 VG2') ma_len5 = input(title="", type=input.integer, defval=169, inline="2b", group="Tunnel 5min") src5 = input(title="/", type=input.source, defval=close, inline="2b", group="Tunnel 5min") ma_offset5 = input(title="/", type=input.integer, defval=0, inline="2b", group="Tunnel 5min") res5 = input(title="/", type=input.resolution, defval="5", inline="2b", group="Tunnel 5min") htf_ma5 = ema(src5, ma_len5) out5 = security(syminfo.tickerid, res5, htf_ma5) plotData5 = if (_2 == true) out5 else na plot_5 = plot(plotData5, color=color.new(#00BFFF, 60), offset=ma_offset5, title='169 VG2') ma_len6 = input(title="", type=input.integer, defval=233, inline="2c", group="Tunnel 5min") src6 = input(title="/", type=input.source, defval=close, inline="2c", group="Tunnel 5min") ma_offset6 = input(title="/", type=input.integer, defval=0, inline="2c", group="Tunnel 5min") res6 = input(title="/", type=input.resolution, defval="5", inline="2c", group="Tunnel 5min") htf_ma6 = ema(src6, ma_len6) out6 = security(syminfo.tickerid, res6, htf_ma6) plotData6 = if (_2 == true) out6 else na plot_6 = plot(plotData6, color=color.new(#00BFFF, 100), offset=ma_offset6, title='233 VG2') fill(plot_4, plot_6, color=color.new(#00BFFF, 90), editable=true) // VEGAS3 _3 = input(true, "Display tunnel 15", group="Tunnel 15min") ma_len7 = input(title="", type=input.integer, defval=144, inline="3", group="Tunnel 15min") src7 = input(title="/", type=input.source, defval=close, inline="3", group="Tunnel 15min") ma_offset7 = input(title="/", type=input.integer, defval=0, inline="3", group="Tunnel 15min") res7 = input(title="/", type=input.resolution, defval="15", inline="3", group="Tunnel 15min") htf_ma7 = ema(src7, ma_len7) out7 = security(syminfo.tickerid, res7, htf_ma7) plotData7 = if (_3 == true) out7 else na plot_7 = plot(plotData7, color=color.new(#4682B4, 100), offset=ma_offset7, title='144 VG3') ma_len8 = input(title="", type=input.integer, defval=169, inline="3b", group="Tunnel 15min") src8 = input(title="/", type=input.source, defval=close, inline="3b", group="Tunnel 15min") ma_offset8 = input(title="/", type=input.integer, defval=0, inline="3b", group="Tunnel 15min") res8 = input(title="/", type=input.resolution, defval="15", inline="3b", group="Tunnel 15min") htf_ma8 = ema(src8, ma_len8) out8 = security(syminfo.tickerid, res8, htf_ma8) plotData8 = if (_3 == true) out8 else na plot_8 = plot(plotData8, color=color.new(#4682B4, 60), offset=ma_offset8, title='169 VG3') ma_len9 = input(title="", type=input.integer, defval=233, inline="3c", group="Tunnel 15min") src9 = input(title="/", type=input.source, defval=close, inline="3c", group="Tunnel 15min") ma_offset9 = input(title="/", type=input.integer, defval=0, inline="3c", group="Tunnel 15min") res9 = input(title="/", type=input.resolution, defval="15", inline="3c", group="Tunnel 15min") htf_ma9 = ema(src9, ma_len9) out9 = security(syminfo.tickerid, res9, htf_ma9) plotData9 = if (_3 == true) out9 else na plot_9 = plot(plotData9, color=color.new(#4682B4, 100), offset=ma_offset9, title='233 VG3') fill(plot_7, plot_9, color=color.new(#4682B4, 90), editable=true) // VEGAS4 _4 = input(true, "Display tunnel H1", group="Tunnel H1") ma_len10 = input(title="", type=input.integer, defval=144, inline="4", group="Tunnel H1") src10 = input(title="/", type=input.source, defval=close, inline="4", group="Tunnel H1") ma_offset10 = input(title="/", type=input.integer, defval=0, inline="4", group="Tunnel H1") res10 = input(title="/", type=input.resolution, defval="60", inline="4", group="Tunnel H1") htf_ma10 = ema(src10, ma_len10) out10 = security(syminfo.tickerid, res10, htf_ma10) plotData10 = if (_4 == true) out10 else na plot_10 = plot(plotData10, color=color.new(#40E0D0, 100), offset=ma_offset10, title='144 VG4') ma_len11 = input(title="", type=input.integer, defval=169, inline="4b", group="Tunnel H1") src11 = input(title="/", type=input.source, defval=close, inline="4b", group="Tunnel H1") ma_offset11 = input(title="/", type=input.integer, defval=0, inline="4b", group="Tunnel H1") res11 = input(title="/", type=input.resolution, defval="60", inline="4b", group="Tunnel H1") htf_ma11 = ema(src11, ma_len11) out11 = security(syminfo.tickerid, res11, htf_ma11) plotData11 = if (_4 == true) out11 else na plot_11 = plot(plotData11, color=color.new(#40E0D0, 60), offset=ma_offset11, title='169 VG4') ma_len12 = input(title="", type=input.integer, defval=233, inline="4c", group="Tunnel H1") src12 = input(title="/", type=input.source, defval=close, inline="4c", group="Tunnel H1") ma_offset12 = input(title="/", type=input.integer, defval=0, inline="4c", group="Tunnel H1") res12 = input(title="/", type=input.resolution, defval="60", inline="4c", group="Tunnel H1") htf_ma12 = ema(src12, ma_len12) out12 = security(syminfo.tickerid, res12, htf_ma12) plotData12 = if (_4 == true) out12 else na plot_12 = plot(plotData12, color=color.new(#40E0D0, 100), offset=ma_offset12, title='233 VG4') fill(plot_10, plot_12, color=color.new(#40E0D0, 90), editable=true) // VEGAS5 _5 = input(true, "Display tunnel H4", group="Tunnel H4") ma_len13 = input(title="", type=input.integer, defval=144, inline="5", group="Tunnel H4") src13 = input(title="/", type=input.source, defval=close, inline="5", group="Tunnel H4") ma_offset13 = input(title="/", type=input.integer, defval=0, inline="5", group="Tunnel H4") res13 = input(title="/", type=input.resolution, defval="240", inline="5", group="Tunnel H4") htf_ma13 = ema(src13, ma_len13) out13 = security(syminfo.tickerid, res13, htf_ma13) plotData13 = if (_5 == true) out13 else na plot_13 = plot(plotData13, color=color.new(#40E0D0, 100), offset=ma_offset13, title='144 VG5') ma_len14 = input(title="", type=input.integer, defval=169, inline="5b", group="Tunnel H4") src14 = input(title="/", type=input.source, defval=close, inline="5b", group="Tunnel H4") ma_offset14 = input(title="/", type=input.integer, defval=0, inline="5b", group="Tunnel H4") res14 = input(title="/", type=input.resolution, defval="240", inline="5b", group="Tunnel H4") htf_ma14 = ema(src14, ma_len14) out14 = security(syminfo.tickerid, res14, htf_ma14) plotData14 = if (_5 == true) out14 else na plot_14 = plot(plotData14, color=color.new(#40E0D0, 60), offset=ma_offset14, title='169 VG5') ma_len15 = input(title="", type=input.integer, defval=233, inline="5c", group="Tunnel H4") src15 = input(title="/", type=input.source, defval=close, inline="5c", group="Tunnel H4") ma_offset15 = input(title="/", type=input.integer, defval=0, inline="5c", group="Tunnel H4") res15 = input(title="/", type=input.resolution, defval="240", inline="5c", group="Tunnel H4") htf_ma15 = ema(src15, ma_len15) out15 = security(syminfo.tickerid, res15, htf_ma15) plotData15 = if (_5 == true) out15 else na plot_15 = plot(plotData15, color=color.new(#40E0D0, 100), offset=ma_offset15, title='233 VG5') fill(plot_13, plot_15, color=color.new(#40E0D0, 90), editable=true) // VEGAS6 _6 = input(true, "Display tunnel D", group="Tunnel D") ma_len16 = input(title="", type=input.integer, defval=144, inline="6", group="Tunnel D") src16 = input(title="/", type=input.source, defval=close, inline="6", group="Tunnel D") ma_offset16 = input(title="/", type=input.integer, defval=0, inline="6", group="Tunnel D") res16 = input(title="/", type=input.resolution, defval="1D", inline="6", group="Tunnel D") htf_ma16 = ema(src16, ma_len16) out16 = security(syminfo.tickerid, res16, htf_ma16) plotData16 = if (_6 == true) out16 else na plot_16 = plot(plotData16, color=color.new(#40E0D0, 100), offset=ma_offset16, title='144 VG6') ma_len17 = input(title="", type=input.integer, defval=169, inline="6b", group="Tunnel D") src17 = input(title="/", type=input.source, defval=close, inline="6b", group="Tunnel D") ma_offset17 = input(title="/", type=input.integer, defval=0, inline="6b", group="Tunnel D") res17 = input(title="/", type=input.resolution, defval="1D", inline="6b", group="Tunnel D") htf_ma17 = ema(src17, ma_len17) out17 = security(syminfo.tickerid, res17, htf_ma17) plotData17 = if (_6 == true) out17 else na plot_17 = plot(plotData17, color=color.new(#40E0D0, 60), offset=ma_offset17, title='169 VG6') ma_len18 = input(title="", type=input.integer, defval=233, inline="6c", group="Tunnel D") src18 = input(title="/", type=input.source, defval=close, inline="6c", group="Tunnel D") ma_offset18 = input(title="/", type=input.integer, defval=0, inline="6c", group="Tunnel D") res18 = input(title="/", type=input.resolution, defval="1D", inline="6c", group="Tunnel D") htf_ma18 = ema(src18, ma_len18) out18 = security(syminfo.tickerid, res18, htf_ma18) plotData18 = if (_6 == true) out18 else na plot_18 = plot(plotData18, color=color.new(#40E0D0, 100), offset=ma_offset18, title='233 VG6') fill(plot_16, plot_18, color=color.new(#40E0D0, 90), editable=true) //------- Liquidity h_left_min = input(title="Minor Value", type=input.integer, defval=26, group="Liquidity", inline="liquidity") h_left_low_min = lowest(h_left_min) h_left_high_min = highest(h_left_min) newlow_min = low <= h_left_low_min newhigh_min = high >= h_left_high_min central_bar_low_min = low[h_left_min] central_bar_high_min = high[h_left_min] full_zone_low_min = lowest(h_left_min * 2) full_zone_high_min = highest(h_left_min * 2) highest_bar_min = central_bar_high_min >= full_zone_high_min lowest_bar_min = central_bar_low_min <= full_zone_low_min plotshape(highest_bar_min ? -1 : 0, offset=-h_left_min, style=shape.circle, location=location.abovebar, color=color.white) //, size=size.small) plotshape(lowest_bar_min ? 1 : 0, offset=-h_left_min, style=shape.circle, location=location.belowbar, color=color.white) //, size=size.small) h_left = input(title="Major Value", type=input.integer, defval=31, group="Liquidity", inline="liquidity") h_left_low = lowest(h_left) h_left_high = highest(h_left) newlow = low <= h_left_low newhigh = high >= h_left_high central_bar_low = low[h_left] central_bar_high = high[h_left] full_zone_low = lowest(h_left * 2) full_zone_high = highest(h_left * 2) highest_bar = central_bar_high >= full_zone_high lowest_bar = central_bar_low <= full_zone_low plotshape(highest_bar ? -1 : 0, offset=-h_left, style=shape.circle, location=location.abovebar, color=color.blue) //, size=size.small) plotshape(lowest_bar ? 1 : 0, offset=-h_left, style=shape.circle, location=location.belowbar, color=color.blue) //, size=size.small) //--------- BB% crossing up (lower band) or down (upper band) length = input(14, type=input.integer, minval=1, group="BB %") srcSignal = input(close, title="Source", group="BB %") mult = input(2.0, type=input.float, minval=0.001, maxval=50, title="StdDev", group="BB %") basis = sma(srcSignal, length) dev = mult * stdev(srcSignal, length) upper = basis + dev lower = basis - dev bbr = (srcSignal - lower)/(upper - lower) upperBand = input(0.80, type=input.float, title="Upper band signal", group="BB %") lowerBand = input(0.20, type=input.float, title="Lower band signal", group="BB %") plotshape(crossunder(bbr, upperBand), style=shape.triangledown, location=location.abovebar, color=color.purple) //, size=size.small) plotshape(crossover(bbr, lowerBand), style=shape.triangleup, location=location.belowbar, color=color.purple) //, size=size.small)
first hour high and low by akash maurya
https://www.tradingview.com/script/D0FyPJE7-first-hour-high-and-low-by-akash-maurya/
akash_maurya563
https://www.tradingview.com/u/akash_maurya563/
171
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © akash_maurya //@version=5 indicator(title='first hour high and low', shorttitle='FIRST HOUR', overlay=true,explicit_plot_zorder=true) t = time('1440', session.regular) //3600000 var line fhHLine = na var line fhLLine = na var line vLine = na var line secLineLow = na var line secLineHigh = na hourHigh = request.security(syminfo.tickerid, '60', high) hourLow = request.security(syminfo.tickerid, '60', low) isShowEverywhere = input.bool(false, "Show lines daily", inline = "01") isShowVert = input.bool(true, "show vertical line") isLastBar() => not na(t[1]) and na(t) or t[1] < t // setLastBar(lineValue)=> // if isLastBar() // line.set_xy2(lineValue, bar_index[0], hourHigh[1]) if time - t == 3600000 if not isShowEverywhere line.delete(fhHLine) line.delete(secLineLow) line.delete(secLineHigh) line.set_x2(fhHLine, bar_index) line.set_extend(fhHLine, extend.none) fhHLine := line.new(na,na,na,na, style=line.style_solid, color=color.green, extend=extend.right) line.set_xy1(fhHLine,bar_index[1], hourHigh[1]) line.set_xy2(fhHLine, bar_index, hourHigh[1]) // setLastBar(fhHLine) // if isLastBarValue // line.set_xy2(fhHLine, bar_index[1], hourHigh[1]) if not isShowEverywhere line.delete(fhLLine) line.set_x2(fhLLine, bar_index) line.set_extend(fhLLine, extend.none) fhLLine := line.new(bar_index[1], hourLow[1], bar_index, hourLow[1], style=line.style_solid, color=color.red, extend=extend.right) if not isShowVert line.delete(vLine) vLine := line.new(bar_index[1], hourHigh[1], bar_index[1], hourLow[1], color=color.yellow, width=3) perCh = ((hourHigh[1]-hourLow[1])/hourHigh[1]) * 100 if perCh > 1.5 secLineLow := line.new(bar_index[1], hourLow[1]+2, bar_index, hourLow[1]+2, style=line.style_solid, color=color.new(color.red,50), extend=extend.right) secLineHigh := line.new(bar_index[1], hourHigh[1]-2, bar_index, hourHigh[1]-2, style=line.style_solid, color=color.new(color.green,50), extend=extend.right) color labelCol = if perCh > 1.5 color.green else color.red labelTextCol = if perCh >= 1.5 color.white else color.white upperLabel = label.new(x=bar_index[1], y=hourHigh[1] + 0.5,color=labelCol,textcolor= labelTextCol, text=str.format('{0,number,#.#} %',perCh))
Trend Step - Trailing
https://www.tradingview.com/script/uEduDGeJ-Trend-Step-Trailing/
ProValueTrader
https://www.tradingview.com/u/ProValueTrader/
276
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/ // © ProValueTrader //@version=5 indicator('Trend Step - Trailing', overlay=true) matype = input.string("WMA", title="MA Type", options=["SMA", "EMA", "WMA", "RMA", "HMA"]) len = input.int(50, minval=2, title='Length') Step = input.int(50, minval=0, title='Step Size [Ticks]') * syminfo.mintick // The syminfo.mintick variable returns the minimum tick value for the instrument that the script calculates on (TradingView, n.d.). That value is the instrument’s smallest possible price movement. We can use the syminfo.mintick variable in indicator (study) and strategy scripts. switchcol = input(false, title="Switch color based on the Average?") col = input.color(color.aqua, title="Color") width = input.int(2, minval=1, title="Linewidth") ma(type)=> float ma = switch type "EMA" => ta.ema(close, len) "SMA" => ta.sma(close, len) "RMA" => ta.rma(close, len) "WMA" => ta.wma(close, len) "HMA" => ta.hma(close, len) // Default => ta.sma(close, len) set_ma = ma(matype) varip MA = close if set_ma > MA + Step MA := set_ma MA else if set_ma < MA - Step MA := set_ma MA col_switch = set_ma[1]<set_ma?color.lime:color.red plot(MA, title="Trend Step - Trailing", color=switchcol?col_switch:col,style=plot.style_stepline, linewidth=width) plot(set_ma, title="Average", color=col_switch) licence = input.string("Licence", group="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/",tooltip="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/")
KCGmut
https://www.tradingview.com/script/sZvBR1Vq-KCGmut/
eykpunter
https://www.tradingview.com/u/eykpunter/
471
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/ // © eykpunter //@version=5 indicator("Keltner Center Of Gravity Channel Mutations Indicator", shorttitle="KCGMut") //calculate lookback //script automatically adepts lookback to timeframe per=14 //initialize per setper= 14 //initialize setper tf=timeframe.period setper:= tf=="M"? 14: tf=="W"? 14: tf=="D"? 21: tf=="240"? 28: tf=="180"? 28: tf=="120"? 35: tf=="60"? 35: tf=="45"? 35: tf=="30"? 42: tf=="15"? 42: tf=="5"? 49: tf=="3"? 49: tf=="1"? 56: 10 per:= setper //KeltCOG RELEVANT CODE //Calculate channel //Calculate COG donhigh=ta.highest(high,per) //COG calculated using values of Donchian channel donlow=ta.lowest(low,per) cent=(donhigh+donlow)/2 //center line not plotted, used calculation of widthpercent donrange=donhigh-donlow coglow=donlow+donrange*0.382 //Actually a Center Low fibonacci line in my donchian fibonacci channel coghigh=donlow+donrange*0.618 //center high fibonacci //Calculate borders //calculate width (i.e. COG to border) //script adepts width to lookback period varwidth=2.00 //initialize variable width formula=math.round(2 + per/25 - 6/per, 1) //Script uses this formula to adapt Width (i.e COG to border) to look back period varwidth:= formula dis=ta.atr(per) //Keltner channels have lines spaced by average true range horizontal=false //Initialize horizontal boolean. New values only calculated when the COG (Center of Gravity) changes outerhigh=coghigh //initialize Outer Keltner line above COG outerlow=coglow //initialize outer Kelner below COG horizontal:= coglow==coglow[1]?true: false //set horizontal COG changes result in Keltner changes, otherwize Keltner is horizontal outerhigh:= horizontal?outerhigh[1]: coghigh+varwidth*dis outerlow:= horizontal?outerlow[1]: coglow-varwidth*dis //CALCULATE VALUES FOR INDICATOR //define direction trendup=close>coghigh trenddown=close<coglow trendside=close<=coghigh and close>=coglow //define width percent of channel widchan=outerhigh-outerlow perchan = trendside? math.round(widchan/cent*25, 1): math.round(widchan/cent*50, 1) //indicator uses half of width, whisch is a little more than atr-percent negperchan=-perchan //define width percent of cog widcog=coghigh-coglow percog = trendside? math.round(widcog/cent*50, 1) :math.round(widcog/cent*100, 1) negpercog = -percog //CALCULATE VOLUME EXPANSION EVENTS //Function finding the usual value of a series with a pick and choose statistical procedure, inspects 8 periods but averages the 'middlest' 4. usual(src) => pick = math.sum(src,3) -ta.highest(src,3) -ta.lowest(src,3) //pick the middle (math.sum(pick,6) -ta.highest(pick,6) -ta.lowest(pick,6))/4 //choose the mediocre out of the picks // end of function //finding volume events usuvol= usual(volume) //find something to compare present volume with relv= volume>usuvol? 100*(volume-usuvol)/volume :0 //only rises reported eventbig=relv>50 event=relv>20 and relv<=50 evline=eventbig? widchan/cent*60 :event? widchan/cent*45: 0 negevline=eventbig? -widchan/cent*60 :event? -widchan/cent*35: 0 volcol = eventbig? color.blue: color.maroon //firstplots plot(evline, title="volume event pos", color=volcol, style=plot.style_histogram, linewidth=2 ) plot(negevline, title="volume event neg", color=volcol, style=plot.style_histogram, linewidth=2 ) //PRAPARE AND EXECUTE PLOTS //define swelling situations chanswellup = widchan>widchan[1] and trendup chanswelldown = widchan>widchan[1] and trenddown chanswellside = widchan>widchan[1] and trendside cogswellup = widcog>widcog[1] and trendup cogswelldown = widcog>widcog[1] and trenddown cogswellside = widcog>widcog[1] and trendside //define colors chancol = chanswellup? color.rgb(236, 177, 38, 00) : chanswelldown? color.maroon: chanswellside? color.rgb(245,124,00,00): trenddown? color.rgb(210,140,185,0): color.rgb(130,148,164,0) cogcol = cogswellup ? color.lime: cogswelldown? color.red: cogswellside? color.orange: color.black //second plots plot(trendup or trendside? perchan :na, title="channelwidth as percent of middle line", style=plot.style_columns, color=chancol) plot(trendup or trendside? percog :na, title="COGwidth as percent of middle line", style=plot.style_columns, color=cogcol ) plot(trenddown or trendside? negperchan :na, title="channelwidth as percent negative", style=plot.style_columns, color=chancol ) plot(trenddown or trendside? negpercog :na, title="COGwidth as percent negative", style=plot.style_columns, color=cogcol )
Position & Lot Size Calculator
https://www.tradingview.com/script/TAdXWzdc-Position-Lot-Size-Calculator/
hanabil
https://www.tradingview.com/u/hanabil/
728
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/ // © hanabil // Versi lama di v56 //@version=5 indicator("Position/Lot Size Calculator", max_bars_back=2000, overlay=true) tst(x)=> str.tostring(x) var int dec = str.length(str.tostring(syminfo.mintick))-2 trc(number) => factor = math.pow(10, dec) int(number * factor) / factor trc_(number) => factor = math.pow(10, 0) int(number * factor) / factor // ------------------------- // Price gr1 = 'Entry & SL Price' eP = input.price(100, 'Entry Price' , group=gr1, inline='1') sl = input.price(200, 'StopLoss Price' , group=gr1, inline='2') eCol = input.color(color.green, '', inline='1', group=gr1) sCol = input.color(color.red , '', inline='2', group=gr1) // RISK MANAGER gr11 = 'Risk Manager' equity = input(100000, 'Equity', group=gr11) riskInp = input(0.100, title='Risk % of Equity' , group=gr11) perLotSize = input(100000, title='Unit Size per Lot', group=gr11) risk = riskInp balance = equity riskCurr = risk*balance/100 slRangeL = eP>sl? eP-sl : sl-eP st = slRangeL/syminfo.mintick pz = riskCurr/slRangeL lz = pz/perLotSize // ---------------- // Smart Table // -------- gr10 = 'Table' tabPosI = input.string('Top', 'Table Position', ['Top', 'Middle', 'Bot'], group=gr10) tabCol = input.color(color.new(#512da8, 35), 'Table Color', inline='1', group=gr10) textCol = input.color(color.white, 'Text', inline='1', group=gr10) textSizeI = input.string('Small', 'Text Size', ['Small', 'Tiny', 'Normal'], group=gr10) textSize = textSizeI=='Small'? size.small : textSizeI=='Tiny'? size.tiny : size.normal tabPos = tabPosI=='Top'? position.top_right : tabPosI=='Bot'? position.bottom_right : position.middle_right var smartTable = table.new(tabPos, 50, 50, color.new(color.black,100), color.black, 1, color.black,1) table.cell(smartTable, 0, 0, 'Equity' , text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 1, 'Risk' , text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 2, 'Entry' , text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 3, 'Stoploss' , text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 4, 'SL Tick' , text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 5, 'Position Size' , text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 0, 6, 'Lot Size' , text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 0, tst(equity) , text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 1, tst(risk) , text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 2, tst(trc(eP)), text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 3, tst(trc(sl)), text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 4, tst(trc_(st)), text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 5, tst(trc(pz)), text_color=textCol, text_size=textSize, bgcolor=tabCol) table.cell(smartTable, 1, 6, tst(trc(lz)), text_color=textCol, text_size=textSize, bgcolor=tabCol) transCol = color.new(color.red, 100) eL = line.new (bar_index, eP, bar_index+10, eP, extend=extend.left, color=eCol) sL = line.new (bar_index, sl, bar_index+10, sl, extend=extend.left, color=sCol) eL1 = label.new(bar_index+10, eP, 'Entry : ' + tst(trc(eP)), textcolor=eCol, color=transCol, style=label.style_label_left) sL1 = label.new(bar_index+10, sl, 'Stoploss : ' + tst(trc(sl)), textcolor=sCol, color=transCol, style=label.style_label_left) line.delete (eL[1]) line.delete (sL[1]) label.delete(eL1[1]) label.delete(sL1[1])
YOY_change
https://www.tradingview.com/script/LROoFOz3-YOY-change/
ilovewordsworth
https://www.tradingview.com/u/ilovewordsworth/
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/ // © ilovewordsworth //@version=5 indicator("YOY_change") yoy = math.log(close[0]) - math.log(close[12]) plot(yoy, color=color.blue)
Gap Finder
https://www.tradingview.com/script/kmK1RGNj-Gap-Finder/
Tiestobob
https://www.tradingview.com/u/Tiestobob/
84
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © the_zoro //@version=5 indicator("Gap Finder", overlay=false) threshold_min = input.int(4, "Min. Gap (%)", minval=0, maxval=100, step=1) threshold_max = input.int(10, "Max. Gap (%)", minval=0, maxval=100, step=1) comp1 = open comp2 = close[1] diff = math.abs(comp1-comp2) gap_perc = (diff/close)*100 plot(gap_perc > threshold_min and gap_perc < threshold_max ? 1 : 0, style=plot.style_histogram)
Saylor to Schiff Ratio
https://www.tradingview.com/script/qMcJykRw-Saylor-to-Schiff-Ratio/
nickolassteel
https://www.tradingview.com/u/nickolassteel/
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/ // © nickolassteel //@version=5 indicator("Saylor/Schiff Ratio", overlay=false, max_bars_back=100, timeframe="W") //Variables BTC = request.security("BTCUSD", "W", close) GOLD = request.security("GOLD", "W", close) roc = ta.roc((BTC/GOLD), 4) pivot = 0 // Calculation bullish_cross = ta.crossover(roc, pivot) bearish_cross = ta.crossunder(roc, pivot) //Plot plot(roc,title="Saylor/Schiff Ratio", color=color.gray) hline(0,linewidth=2) // Visual Alerts plotshape(bullish_cross==1? bullish_cross : na, title="Buy Signal",location=location.absolute, color=color.green, size=size.tiny, text="Buy") plotshape(bearish_cross==1? bearish_cross : na, title="Sell Signal",location=location.absolute, color=color.red, size=size.tiny, text="Sell") // Condition Alerts alertcondition(bullish_cross==1 ? bullish_cross : na, title="Buy Alert", message="Buy, {{close}}") alertcondition(bearish_cross==1 ? bearish_cross :na, title="Sell Alert", message="Sell, {{close}}")
Close strength line
https://www.tradingview.com/script/wuPd8VIk-Close-strength-line/
akjuvekar1
https://www.tradingview.com/u/akjuvekar1/
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/ // © akjuvekar1 //@version=5 indicator(title="Close strength", shorttitle="Close strength") len=input(13,title="Interval") val1=ta.sma(high-low,len) //strength val2=close-val1 plot(ta.sma(val2,len*3),color=color.red,title="Close strength")
Days to expected ROI
https://www.tradingview.com/script/w3AMZnQA-Days-to-expected-ROI/
trader24521
https://www.tradingview.com/u/trader24521/
2
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/ // © trader24521 //** USE "1 Day" resolution **// //@version=5 indicator(title="Days to expected ROI", shorttitle="Days to ROI") start = input.time(timestamp("2021-01-01T00:00:00"), "Start Date") expected_roi = input.float(20.0, "Expected ROI %") / 100.0 + 1.0 not_found = input.int(0, "Value to plot if not found") current_date = timestamp(year(time), month(time), dayofmonth(time), 0, 0) start_date = timestamp(year(start), month(start), dayofmonth(start), 0, 0) max_days = (current_date - start_date) / (24 * 60 * 60 * 1000) max_days := math.max(max_days - 1, 0) // plotchar(max_days, "days", "", location=location.top) fg_values = array.new_int(max_days) if barstate.islast for i=1 to max_days-1 for j=i-1 to 0 roi = close[j]/close[i] if roi >= expected_roi and na(array.get(fg_values, i)) array.set(fg_values, i, math.abs(i-j)) diff = time - time[1] var box b0 = na, box.delete(b0) var box b1 = na, box.delete(b1) var box b2 = na, box.delete(b2) var box b3 = na, box.delete(b3) var box b4 = na, box.delete(b4) var box b5 = na, box.delete(b5) var box b6 = na, box.delete(b6) var box b7 = na, box.delete(b7) var box b8 = na, box.delete(b8) var box b9 = na, box.delete(b9) var box b10 = na, box.delete(b10) var box b11 = na, box.delete(b11) var box b12 = na, box.delete(b12) var box b13 = na, box.delete(b13) var box b14 = na, box.delete(b14) var box b15 = na, box.delete(b15) var box b16 = na, box.delete(b16) var box b17 = na, box.delete(b17) var box b18 = na, box.delete(b18) var box b19 = na, box.delete(b19) var box b20 = na, box.delete(b20) var box b21 = na, box.delete(b21) var box b22 = na, box.delete(b22) var box b23 = na, box.delete(b23) var box b24 = na, box.delete(b24) var box b25 = na, box.delete(b25) var box b26 = na, box.delete(b26) var box b27 = na, box.delete(b27) var box b28 = na, box.delete(b28) var box b29 = na, box.delete(b29) var box b30 = na, box.delete(b30) var box b31 = na, box.delete(b31) var box b32 = na, box.delete(b32) var box b33 = na, box.delete(b33) var box b34 = na, box.delete(b34) var box b35 = na, box.delete(b35) var box b36 = na, box.delete(b36) var box b37 = na, box.delete(b37) var box b38 = na, box.delete(b38) var box b39 = na, box.delete(b39) var box b40 = na, box.delete(b40) var box b41 = na, box.delete(b41) var box b42 = na, box.delete(b42) var box b43 = na, box.delete(b43) var box b44 = na, box.delete(b44) var box b45 = na, box.delete(b45) var box b46 = na, box.delete(b46) var box b47 = na, box.delete(b47) var box b48 = na, box.delete(b48) var box b49 = na, box.delete(b49) if barstate.islast index = max_days - 1, current_bar = start_date + 2 * diff, next_bar = current_bar + diff b0 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b1 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b2 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b3 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b4 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b5 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b6 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b7 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b8 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b9 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b10 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b11 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b12 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b13 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b14 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b15 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b16 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b17 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b18 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b19 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b20 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b21 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b22 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b23 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b24 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b25 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b26 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b27 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b28 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b29 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b30 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b31 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b32 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b33 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b34 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b35 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b36 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b37 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b38 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b39 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b40 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b41 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b42 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b43 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b44 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b45 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b46 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b47 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b48 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff b49 := box.new(left=current_bar, top=nz(array.get(fg_values, index), not_found), right=next_bar, bottom=0, xloc=xloc.bar_time, bgcolor=color.blue, border_color=color.navy), index -= 1, index := math.max(0, index), current_bar += diff, next_bar += diff
CDOI Profile
https://www.tradingview.com/script/Ns6uFgFx-CDOI-Profile/
Dereek69
https://www.tradingview.com/u/Dereek69/
571
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/ // © Dereek69 //@version=5 indicator('CDOI Profile', shorttitle='CDOI', overlay=true, max_boxes_count=500) //-----------------------------------------------------------// //---------------------- FUNCTIONS --------------------------// //-----------------------------------------------------------// endIf() => line.delete(na) // initializeVP(step_size, array_l, array_h) => // Creates the arrays without adding any volume to it min = array.min(array_l) max = array.max(array_h) start = min - min % step_size end = max + step_size - max % step_size steps = (end - start) / step_size out_lvls = array.new_float(math.round(steps) + 1) for n = 0 to array.size(out_lvls) - 1 by 1 array.set(out_lvls, n, start + step_size * n) out_v = array.new_float(array.size(out_lvls) - 1, 0) [out_v, out_lvls] // adaptVP(step_size, in_v, in_lvls, array_l, array_h) => //rescales the arrays for the L and H provided and keeps the old Volume values out_v = in_v out_lvls = in_lvls min = array.min(array_l) max = array.max(array_h) if array.get(out_lvls, 0) > min steps_away = math.round((array.get(out_lvls, 0) - min + step_size - (array.get(out_lvls, 0) - min) % step_size) / step_size) if steps_away > 0 bot = array.get(out_lvls, 0) for n = 0 to steps_away - 1 by 1 array.insert(out_lvls, n, bot - step_size * (steps_away - n)) array.insert(out_v, n, 0) if array.get(out_lvls, array.size(out_lvls) - 1) < max steps_away = (max - array.get(out_lvls, array.size(out_lvls) - 1) + step_size - (max - array.get(out_lvls, array.size(out_lvls) - 1)) % step_size) / step_size for n = array.size(out_lvls) - 1 to array.size(out_lvls) - 1 + steps_away by 1 array.push(out_lvls, array.get(out_lvls, n) + step_size) array.push(out_v, 0) [out_v, out_lvls] // addToVP(in_v, in_lvls, array_l, array_h, array_v) => // Adds arrays of two volumes out_v = in_v out_lvls = in_lvls for i = 0 to array.size(array_l) - 1 by 1 _l = array.get(array_l, i) _h = array.get(array_h, i) _v = array.get(array_v, i) for n = 0 to array.size(out_lvls) - 2 by 1 cur_tier = array.get(out_lvls, n) next_tier = array.get(out_lvls, n + 1) if _l > cur_tier and _l < next_tier and _h > cur_tier and _h < next_tier old_v = array.get(out_v, n) array.set(out_v, n, old_v + _v) else if _l > cur_tier and _l < next_tier vol_in_range = (next_tier - _l) / (_h - _l) * _v old_v = array.get(out_v, n) array.set(out_v, n, old_v + vol_in_range) else if _h > cur_tier and _h < next_tier vol_in_range = (_h - cur_tier) / (_h - _l) * _v old_v = array.get(out_v, n) array.set(out_v, n, old_v + vol_in_range) else if _h > next_tier and _l < cur_tier vol_in_range = (next_tier - cur_tier) / (_h - _l) * _v old_v = array.get(out_v, n) array.set(out_v, n, old_v + vol_in_range) [out_v, out_lvls] plotDeltaBox(_in_v, _in_lvls, _start_bar, _end_bar, _transp, _ui_color) => var int _box_end = bar_index var color _col = color.white var color _start_col = color.new(color.white, _transp) var color _pos_col = color.new(color.green, _transp) var color _neg_col = color.new(color.red, _transp) box[] _boxes = array.new_box() _center = math.floor((_end_bar + _start_bar) / 2) _max_v = array.max(_in_v) _min_v = array.min(_in_v) _max = math.max(_max_v,-_min_v) for x = 0 to array.size(_in_v) - 1 by 1 _box_top = array.get(_in_lvls, x + 1) - int(close * 0.0005) _box_bot = array.get(_in_lvls, x) + int(close * 0.0005) _box_val = array.get(_in_v, x) if _box_val >= 0 _box_end := _center + math.round(_box_val / _max * (_end_bar - _center)) _col := color.from_gradient(_box_end, _center, _end_bar, _start_col, _pos_col) _col else _box_end := _center + math.round(_box_val / -_max * (_start_bar - _center)) _col := color.from_gradient(_box_end, _start_bar, _center, _neg_col, _start_col) _col array.push(_boxes, box.new(_center, _box_top, _box_end, _box_bot, _col, bgcolor=_col)) array.push(_boxes, box.new(_start_bar,array.max(_in_lvls),_end_bar,array.min(_in_lvls), border_color = _ui_color, bgcolor = color.new(color.white, 100))) _boxes clearBoxes(box_array) => if array.size(box_array) > 0 for i = 0 to array.size(box_array) - 1 by 1 box.delete(array.get(box_array, i)) // sec(_tf, _src, _ref) => request.security(syminfo.tickerid, _tf, _src[_ref]) // sec2(_tf, _src, _ref) => var ticker = syminfo.tickerid + "_OI" request.security(ticker, _tf, _src[_ref]) // printArray(_array) => _text = "" for x = 0 to array.size(_array)-1 by 1 if str.length(_text) < 4000 _text := _text + str.tostring(array.get(_array,x)) + "\n" _text // //-----------------------------------------------------------// //---------------------- VARIABLES --------------------------// //-----------------------------------------------------------// cond = input.string('Session', title='Condition', options=['Session', 'Day', 'Weekly', 'Month']) sampling = input(10, 'Sampling rate', 'max is 10 and multiplied by the timeframe it should equal the current timeframe in minutes') tf = input('6', 'Timeframe', '1/Nth of the TF') transp = input(50, 'Transparency of profile') min_change = input(0.2, 'Minimum change', '% change for a bar') last_bar_limit = input(500, 'Bars Limit', 'Limits the amounts of bars the script is run for (lower = faster loading)') ui_color = input.color(color.white, 'UI Color', "Color of the surrounding Box and center line") src = close var int div = int(100 / min_change) var float step_size = math.round_to_mintick(src / div) var int last_plot_bar = 0 var vp = array.new_float(1, 0) var vp_lvls = array.new_float(2, src) var temp_boxes = array.new_box(0) var boxes = array.new_box(0) var high_vp = array.new_float(1, 0) var high_vp_lvls = array.new_float(2, src) var low_vp = array.new_float(1, 0) var low_vp_lvls = array.new_float(2, src) var h = array.new_float(sampling, 0) var l = array.new_float(sampling, 0) var v = array.new_float(sampling, 0) //-----------------------------------------------------------// //---------------------- CONDITIONS -------------------------// //-----------------------------------------------------------// sessions = cond == 'Session' and (hour == 0 and hour[1] == 23 or hour == 8 and hour[1] == 7 or hour == 16 and hour[1] == 15) daily = cond == 'Day' and dayofweek != dayofweek[1] weekly = cond == 'Week' and dayofweek != dayofweek[1] and dayofweek == dayofweek.monday monthly = cond == 'Month' and month != month[1] //-----------------------------------------------------------// //---------------------- SAMPLING ---------------------------// //-----------------------------------------------------------// if sampling >= 1 array.set(h, 0, nz(sec(tf, high, 0), high)) array.set(l, 0, nz(sec(tf, low, 0), low)) array.set(v, 0, nz(sec2(tf, ta.change(close), 0), 0)) if sampling >= 2 array.set(h, 1, nz(sec(tf, high, 1), high)) array.set(l, 1, nz(sec(tf, low, 1), low)) array.set(v, 1, nz(sec2(tf, ta.change(close), 1), 0)) if sampling >= 3 array.set(h, 2, nz(sec(tf, high, 2), high)) array.set(l, 2, nz(sec(tf, low, 2), low)) array.set(v, 2, nz(sec2(tf, ta.change(close), 2), 0)) if sampling >= 4 array.set(h, 3, nz(sec(tf, high, 3), high)) array.set(l, 3, nz(sec(tf, low, 3), low)) array.set(v, 3, nz(sec2(tf, ta.change(close), 3), 0)) if sampling >= 5 array.set(h, 4, nz(sec(tf, high, 4), high)) array.set(l, 4, nz(sec(tf, low, 4), low)) array.set(v, 4, nz(sec2(tf, ta.change(close), 4), 0)) if sampling >= 6 array.set(h, 5, nz(sec(tf, high, 5), high)) array.set(l, 5, nz(sec(tf, low, 5), low)) array.set(v, 5, nz(sec2(tf, ta.change(close), 5), 0)) if sampling >= 7 array.set(h, 6, nz(sec(tf, high, 6), high)) array.set(l, 6, nz(sec(tf, low, 6), low)) array.set(v, 6, nz(sec2(tf, ta.change(close), 6), 0)) if sampling >= 8 array.set(h, 7, nz(sec(tf, high, 7), high)) array.set(l, 7, nz(sec(tf, low, 7), low)) array.set(v, 7, nz(sec2(tf, ta.change(close), 7), 0)) if sampling >= 9 array.set(h, 8, nz(sec(tf, high, 8), high)) array.set(l, 8, nz(sec(tf, low, 8), low)) array.set(v, 8, nz(sec2(tf, ta.change(close), 8), 0)) if sampling >= 10 array.set(h, 9, nz(sec(tf, high, 9), high)) array.set(l, 9, nz(sec(tf, low, 9), low)) array.set(v, 9, nz(sec2(tf, ta.change(close), 9), 0)) //-----------------------------------------------------------// //---------------------- CHART ------------------------------// //-----------------------------------------------------------// if bar_index > (last_bar_index - last_bar_limit) clearBoxes(temp_boxes) if sessions or daily or weekly or monthly boxes := plotDeltaBox(vp, vp_lvls, last_plot_bar, bar_index, transp, ui_color) _center = math.floor((bar_index + last_plot_bar) / 2) line.new(_center,array.max(vp_lvls),_center,array.min(vp_lvls), color = ui_color) last_plot_bar := bar_index step_size := math.round_to_mintick(src / div) [_vp, _vp_lvls] = initializeVP(step_size, l, h) vp := _vp vp_lvls := _vp_lvls endIf() else temp_boxes := plotDeltaBox(vp, vp_lvls, last_plot_bar, bar_index, transp, ui_color) [a_vp, a_vp_lvls] = adaptVP(step_size, vp, vp_lvls, l, h) vp := a_vp vp_lvls := a_vp_lvls endIf() [b_vp, b_vp_lvls] = addToVP(vp, vp_lvls, l, h, v) vp := b_vp vp_lvls := b_vp_lvls else if sessions or daily or weekly or monthly last_plot_bar := bar_index step_size := math.round_to_mintick(src / div) [_vp, _vp_lvls] = initializeVP(step_size, l, h) vp := _vp vp_lvls := _vp_lvls endIf() plot(close, color=color.new(color.black, 100))
Smarter SNR (Support and Ressistance, Trendline, MTF OSC)
https://www.tradingview.com/script/g1ZVGdT1-Smarter-SNR-Support-and-Ressistance-Trendline-MTF-OSC/
hanabil
https://www.tradingview.com/u/hanabil/
2,768
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/ // © hanabil //@version=5 indicator("Smarter SnR", overlay=true, max_bars_back=5000, max_labels_count=500, max_lines_count=500) // General Function f_barssince(_cond, _count) => _barssince = bar_index - ta.valuewhen(_cond, bar_index, _count) _barssince barssince(_cond, _count) => int(math.max(1, nz(f_barssince(_cond, _count)))) f_vw(cond, expr, count) => ta.valuewhen(cond, expr, count) tostring(x, y)=> x + str.tostring(y) var int dec = str.length(str.tostring(syminfo.mintick))-2 truncate(number) => factor = math.pow(10, dec) int(number * factor) / factor EndTime = timestamp('19 Jan 2022 00:00 +0000') inDateRange = time<=EndTime //------------------------- // Input Zigzag gr1 = 'General' showSnr = input(true, 'SnR', group=gr1) showTL = input(true, 'TrendLine', group=gr1) showZZ = input(false, 'Show Zigzag', group=gr1, inline='1') zzCol = input.color(color.black, title='', group=gr1, inline='1') // ----------------- // Input SnR labStyleUp = label.style_label_up labStyleDn = label.style_label_down labLeft = label.style_label_left linDashed = line.style_dashed gr3 = 'Support and Ressistance' showPriceSnr= input(true, 'Show Price', group=gr3) snrType = input.string('Swing HiLo', 'SnR Type', ['Volume', 'Swing HiLo'], group=gr3) Period = input.int(defval=20, title='Swing Period', minval=1, group=gr3) lStyleSRI = input.string('Solid', 'Line Style', ['Solid', 'Dashed', 'Dotted'], group=gr3) lStyleSR = lStyleSRI=='Solid'? line.style_solid : lStyleSRI=='Dashed'? line.style_dashed : line.style_dotted linWidth = input(1, 'Linewidth', group=gr3) lineExtendI = input.string('None', 'Line Extend', ['None', 'Left', 'Right', 'Both'], group=gr3) lineExtend = lineExtendI=='None'? extend.none : lineExtendI=='Left'? extend.left : lineExtendI=='Both'? extend.both : extend.right supCol = input.color(color.new(color.black, 100), 'Support Label', group=gr3 , inline='1') supTextCol = input.color(color.red, 'Text', group=gr3 , inline='1') supLineCol = input.color(color.red, 'Line', group=gr3 , inline='1') resCol = input.color(color.new(color.black, 100), 'Ressistance Label', group=gr3 , inline='2') resTextCol = input.color(color.blue, 'Text', group=gr3 , inline='2') resLineCol = input.color(color.blue, 'Line', group=gr3 , inline='2') // Snr Pivot ph = ta.pivothigh(Period, Period) pl = ta.pivotlow(Period, Period) ph0 = ta.valuewhen(ph, close[Period], 0) ph1 = ta.valuewhen(ph, close[Period], 1) ph2 = ta.valuewhen(ph, close[Period], 2) pl0 = ta.valuewhen(pl, close[Period], 0) pl1 = ta.valuewhen(pl, close[Period], 1) pl2 = ta.valuewhen(pl, close[Period], 2) P0 = ta.valuewhen(ph or pl, close[Period], 0) P1 = ta.valuewhen(ph or pl, close[Period], 1) P2 = ta.valuewhen(ph or pl, close[Period], 2) bar_pl1 = int(math.max(1, nz(f_barssince(pl, 1)))) highest_1 = ta.highest(high[Period], bar_pl1) highestbars_1 = ta.highestbars(high[Period], bar_pl1) bar_ph1 = int(math.max(1, nz(f_barssince(ph, 1)))) lowest_1 = ta.lowest(low[Period], bar_ph1) lowestbars_1 = ta.lowestbars(low[Period], bar_ph1) h = ph hA = pl and P1 == pl1 hAA= pl and P1 == pl1 and P2 == pl2 l = pl lA = ph and P1 == ph1 lAA= ph and P1 == ph1 and P2 == pl2 h0 = ta.valuewhen(h, high[Period], 0) h1 = ta.valuewhen(h, high[Period], 1) hA0= ta.valuewhen(hA, highest_1, 0) l0 = ta.valuewhen(l, low[Period], 0) l1 = ta.valuewhen(l, low[Period], 1) lA0= ta.valuewhen(lA, lowest_1, 0) //---------------------------------------------- // Fix Zigzag Pivot f_AA(x, xA, x0, xA0) => ta.valuewhen(x or xA, close, 0) == ta.valuewhen(x, close, 0)? x0 : xA0 f_offset(x, xA, xAbars) => ta.valuewhen(x or xA, close, 0) == ta.valuewhen(x, close, 0)? -Period : xAbars-Period fixPh = hA or h fixPl = lA or l fixPhVal = f_AA(h, hA, h0, hA0) fixPlVal = f_AA(l, lA, l0, lA0) fixPhVal1= ta.valuewhen(fixPh, fixPhVal, 1) fixPlVal1= ta.valuewhen(fixPl, fixPlVal, 1) offsetPh = -f_barssince(fixPh, 0) + f_offset(h, hA, highestbars_1) offsetPl = -f_barssince(fixPl, 0) + f_offset(l, lA, lowestbars_1) offsetPh1= ta.valuewhen(fixPh, offsetPh, 1) - f_barssince(fixPh, 1) offsetPl1= ta.valuewhen(fixPl, offsetPl, 1) - f_barssince(fixPl, 1) fixOffset = fixPh? offsetPh : offsetPl fixPivotVal = fixPh? fixPhVal : fixPlVal offsetForHa = -f_barssince(l, 1)- Period offsetForLa = -f_barssince(h, 1)- Period if hA and showZZ line.new(bar_index+offsetPh, hA0, bar_index-Period, fixPlVal, xloc.bar_index, color=zzCol) line.new(bar_index+offsetForHa, l1, bar_index+offsetPh, hA0, color=zzCol) if lA and showZZ line.new(bar_index+offsetPl, lA0, bar_index-Period, fixPhVal, xloc.bar_index, color=zzCol) line.new(bar_index+offsetForLa, h1, bar_index+offsetPl, lA0, color=zzCol) if h and showZZ line.new(bar_index-Period, fixPhVal, bar_index+offsetPl, fixPlVal, color=zzCol) if l and showZZ line.new(bar_index-Period, fixPlVal, bar_index+offsetPh, fixPhVal, color=zzCol) // --------- // SnR Swing HiLo fVwSeries (x, xVal, xBar)=> x0 = truncate(ta.valuewhen(x, xVal, 0)) x1 = truncate(ta.valuewhen(x, xVal, 1)) x2 = truncate(ta.valuewhen(x, xVal, 2)) x0Bar = ta.valuewhen(x, xBar, 0) - f_barssince(x, 0) x1Bar = ta.valuewhen(x, xBar, 1) - f_barssince(x, 1) x2Bar = ta.valuewhen(x, xBar, 2) - f_barssince(x, 2) [x0, x1, x2, x0Bar, x1Bar, x2Bar] [s1, s2, s3, s1Bar, s2Bar, s3Bar] = fVwSeries(fixPl, fixPlVal, offsetPl) [r1, r2, r3, r1Bar, r2Bar, r3Bar] = fVwSeries(fixPh, fixPhVal, offsetPh) fLL(show_, showPrice, x1, y1, x2, y2, text_, labelcol, labelstyle, textcol, extend_, linecol, linestyle, linewidth) => if close and show_ line_ = line.new(x1, y1, x2, y2, xloc.bar_index, extend_, linecol, linestyle, linewidth) line.delete (line_ [1]) if showPrice label_ = label.new(x2, y2, text_, xloc.bar_index, yloc.price, labelcol, labelstyle, textcol) label.delete(label_[1]) fTst(x, y)=> x + str.tostring(y) fLL(showSnr, showPriceSnr, bar_index+s1Bar, s1, bar_index+10, s1, fTst('S1 -> ', s1), supCol, labLeft, supTextCol, lineExtend, supLineCol, lStyleSR, linWidth) fLL(showSnr, showPriceSnr, bar_index+s2Bar, s2, bar_index+10, s2, fTst('S2 -> ', s2), supCol, labLeft, supTextCol, lineExtend, supLineCol, lStyleSR, linWidth) fLL(showSnr, showPriceSnr, bar_index+s3Bar, s3, bar_index+10, s3, fTst('S3 -> ', s3), supCol, labLeft, supTextCol, lineExtend, supLineCol, lStyleSR, linWidth) fLL(showSnr, showPriceSnr, bar_index+r1Bar, r1, bar_index+10, r1, fTst('R1 -> ', r1), resCol, labLeft, resTextCol, lineExtend, resLineCol, lStyleSR, linWidth) fLL(showSnr, showPriceSnr, bar_index+r2Bar, r2, bar_index+10, r2, fTst('R2 -> ', r2), resCol, labLeft, resTextCol, lineExtend, resLineCol, lStyleSR, linWidth) fLL(showSnr, showPriceSnr, bar_index+r3Bar, r3, bar_index+10, r3, fTst('R3 -> ', r3), resCol, labLeft, resTextCol, lineExtend, resLineCol, lStyleSR, linWidth) //------------------------------------ // Trendlines gr5 = 'Trendlines' showPriceTl = input(true, 'Show Price', group=gr5) newestTL = input(true, 'Show Newest', group=gr5) newestBreak = input(true, 'Show Newest Break Only', group=gr5) period = input(20, 'Trendline Period', group=gr5) srcI = input.string('Close Body', 'Source', ['Close Body', 'Shadow'], group=gr5) srcL = srcI=='Shadow'? low : close srcH = srcI=='Shadow'? high : close lStyleI = input.string('Dashed', 'Line Style', ['Solid', 'Dashed', 'Dotted'], group=gr5, inline='2') y2_mult = input(1, title='Trendline Length', group=gr5, inline='2') lStyle = lStyleI=='Solid'? line.style_solid : lStyleI=='Dashed'? line.style_dashed : line.style_dotted lWidth = input(1, 'Line Width', group=gr5, inline='1') lColor = input.color(color.black, '', group=gr5, inline='1') phFound = ta.pivothigh(srcH, period, period) plFound = ta.pivotlow (srcL, period, period) phVal = ta.valuewhen(phFound, srcH[period], 0) plVal = ta.valuewhen(plFound, srcL[period], 0) phVal1 = ta.valuewhen(phFound, srcH[period], 1) plVal1 = ta.valuewhen(plFound, srcL[period], 1) a_bar_time = time - time[1] noneCol = color.new(color.red, 100) fGetPriceTl(slope_, x2_, y2_) => current_price = y2_ + (slope_/(x2_ - time)) current_price f_trendline(cond_, y1Val_, x1Bar_, y2Val_, x2Bar_, color_, tlPriceText, textCol) => x1 = ta.valuewhen(cond_, time[x1Bar_], 0) x2 = ta.valuewhen(cond_, time[x2Bar_], 0) y1 = ta.valuewhen(cond_, y1Val_, 0) y2 = ta.valuewhen(cond_, y2Val_, 0) slope_ = ta.valuewhen(cond_, (y2-y1)/(x2-x1), 0) currentPrice = truncate(y2 + (time-x2)*slope_) var label tlPrice = na if close and newestTL a_trendline = line.new (x1, y1, time, currentPrice, xloc.bar_time, color=lColor, style=lStyle, width=lWidth) line.delete (a_trendline[1]) a_trendline newY2 = x2 + (y2_mult * a_bar_time * 25) if cond_ and not newestTL a_trendline = line.new(x1, y1, newY2, currentPrice, xloc.bar_time, color=lColor, style=lStyle, width=lWidth) a_trendline if showPriceTl tlPrice := label.new(bar_index+10, currentPrice, fTst(tlPriceText, currentPrice), color=noneCol, style=label.style_label_left, textcolor=textCol) label.delete(tlPrice[1]) currentPrice newUp = phFound and phVal<phVal1 and showTL newLo = plFound and plVal>plVal1 and showTL upperTl = f_trendline(newUp, phVal1, f_barssince(phFound,1)+period, phVal, f_barssince(phFound,0)+period, color.black, 'Upper -> ', resTextCol) lowerTl = f_trendline(newLo, plVal1, f_barssince(plFound,1)+period, plVal, f_barssince(plFound,0)+period, color.black, 'Lower -> ', supTextCol) highestSince = ta.highest(srcH, barssince(phFound and phVal<phVal1 and showTL,0)) lowestSince = ta.lowest (srcL, barssince(plFound and plVal>plVal1 and showTL,0)) breakUpper = srcH[1]<upperTl[1] and srcH>upperTl breakLower = srcL[1]>lowerTl[1] and srcL<lowerTl var label bu = na var label bl = na if breakUpper and barstate.isconfirmed bu := label.new(bar_index, low , '🔼', color=resTextCol, style=label.style_label_up) if newestBreak label.delete(bu[1]) if breakLower and barstate.isconfirmed bl := label.new(bar_index, high, '🔽', color=supTextCol) if newestBreak label.delete(bl[1]) alertcondition(breakUpper and barstate.isconfirmed, 'Upper Trendline Breaked') alertcondition(breakLower and barstate.isconfirmed, 'Lower Trendline Breaked') sCO = ta.crossover (close, s1) or ta.crossover (close, s2) or ta.crossover (close, s3) sCU = ta.crossunder(close, s1) or ta.crossunder(close, s2) or ta.crossunder(close, s3) rCO = ta.crossover (close, r1) or ta.crossover (close, r2) or ta.crossover (close, r3) rCU = ta.crossunder(close, r1) or ta.crossunder(close, r2) or ta.crossunder(close, r3) alertcondition(rCO, 'Close Price Crossover The Resistance') alertcondition(rCU, 'Close Price Crossunder The Resistance') alertcondition(sCO, 'Close Price Crossover The Support') alertcondition(sCU, 'Close Price Crossunder The Support') // ---------------------- // Dashboard gr6 = 'Dashboard' dash = input(true, 'Dashboard', group=gr6) dashTitle = input('😎 Smarter Dashboard 😎', 'Title', group=gr6) dashColor = input.color(color.new(#512da8, 35) , 'Label', group=gr6, inline='3') dashTextCol = input.color(color.white, 'Text', group=gr6, inline='3') dashDist = input(50, 'Dashboard Distance', group=gr6) trendlineText = showTL? '\n〰️〰️〰️〰️〰️〰️〰️〰️〰️' + '\nTrendline Price' + '\n🔸 Upper = ' + str.tostring(upperTl) + '\n🔸 Lower = ' + str.tostring(lowerTl) : na snrText = showSnr? '\n〰️〰️〰️〰️〰️〰️〰️〰️〰️' + '\nSupport and Resistance' + '\nS1 = ' + str.tostring(s1) + ', R1 = ' + str.tostring(r1) + '\nS2 = ' + str.tostring(s2) + ', R2 = ' + str.tostring(r2) + '\nS3 = ' + str.tostring(s3) + ', R3 = ' + str.tostring(r3) : na smarterDashText = dashTitle + snrText + trendlineText if dash dashSmarter = label.new(bar_index+dashDist, close, smarterDashText, style=label.style_label_center, color=dashColor, textcolor=dashTextCol) label.delete(dashSmarter[1]) // ------ // quotes gr50 = 'QUOTES' showTable = input(true, 'Show Quotes Table', group=gr50) quote = input('🎓 Smarter Trade Give Better Pain & Gain 🎓', 'Drop Your Quotes Here', group=gr50) tabPosI_ = input.string('Top', 'Table Position', ['Top', 'Middle', 'Bot'], group=gr50) tabPos_ = tabPosI_=='Top'? position.top_right : tabPosI_=='Bot'? position.bottom_right : position.middle_right tabColor = input.color(color.new(#512da8, 35) , 'Background', group=gr50) borderCol = input.color(color.black , 'Border', group=gr50) tabTextCol = input.color(color.white, 'Text', group=gr50) var saTable = table.new(tabPos_, 1, 1, tabColor, borderCol, 1, borderCol, 1) if showTable table.cell(saTable, 0, 0, quote, text_color=tabTextCol, text_size=size.small) // ---------------- // Smart Table // -------- gr10 = 'Table' useTab = input(true, 'Show Table?', group=gr10) tf1 = input.timeframe('', 'Timeframe - A', group=gr10) tf2 = input.timeframe('45', 'Timeframe - B', group=gr10) tf3 = input.timeframe('D', 'Timeframe - C', group=gr10) tabPosI = input.string('Bot', 'Table Position', ['Top', 'Middle', 'Bot'], group=gr10) bullCol = input.color(color.new(color.green, 0) , 'Oversold' , '', '1', gr10) bearCol = input.color(color.new(color.red, 0) , 'Overbought' , '', '1', gr10) neutralCol = input.color(color.new(#bbd9fb, 0) , 'Not Over' , '', '1', gr10) textCol = input.color(color.white, 'Text', inline='1', group=gr10) textSizeI = input.string('Small', 'Text Size', ['Small', 'Tiny', 'Normal'], group=gr10) textSize = textSizeI=='Small'? size.small : textSizeI=='Tiny'? size.tiny : size.normal tabPos = tabPosI=='Top'? position.top_right : tabPosI=='Bot'? position.bottom_right : position.middle_right var smartTable = table.new(tabPos, 50, 50, color.new(color.black,100), color.black, 1, color.black,1) // ---- // RSI gr11 = 'RSI' rsiSource = input(close, 'RSI -- Source', '1', gr11) rsiPeriod = input(14, 'Period', '', '1', gr11) obRsi = input(80, 'Overbought', '', '2', gr11) osRsi = input(20, 'Oversold ', '', '2', gr11) // Stoch gr12 = 'Stochastic' stochSource = input(close, 'Stochastic -- Source', '2', group=gr12) stochPeriod = input(14, 'Period', '', '2', gr12) periodK = input(14, 'Period -- K', '', '1', gr12) periodD = input(3 , 'D', '', '1', gr12) smoothK = input(1 , 'Smooth K', '', '0', gr12) obStoch = input(80, 'Overbought', '', '2', gr12) osStoch = input(20, 'Oversold ', '', '2', gr12) fCol(x)=> x=='Overbought'? bearCol : x=='Oversold'? bullCol : neutralCol fTable(tf, rowNumber)=> k = request.security(syminfo.ticker, tf, ta.sma(ta.stoch(close, high, low, periodK), smoothK)) d = ta.sma(k, periodD) r = request.security(syminfo.ticker, tf, ta.rsi(rsiSource, rsiPeriod)) sStatus = k>obStoch? 'Overbought' : k<osStoch? 'Oversold' : 'Not Over' rStatus = r>obRsi ? 'Overbought' : r<osRsi ? 'Oversold' : 'Not Over' sCol = fCol(sStatus) rCol = fCol(rStatus) if useTab table.cell(smartTable, 0, 0, 'Timeframe' , text_color=textCol, text_size=textSize, bgcolor=dashColor) table.cell(smartTable, 1, 0, 'Stochastic' , text_color=textCol, text_size=textSize, bgcolor=dashColor) table.cell(smartTable, 2, 0, 'RSI' , text_color=textCol, text_size=textSize, bgcolor=dashColor) tfDes = tf==''? timeframe.period : tf table.cell(smartTable, 0, rowNumber, tfDes , text_color=textCol, text_size=textSize, bgcolor=dashColor) table.cell(smartTable, 1, rowNumber, sStatus, text_color=textCol, text_size=textSize, bgcolor=sCol) table.cell(smartTable, 2, rowNumber, rStatus, text_color=textCol, text_size=textSize, bgcolor=rCol) fTable(tf1, 1) fTable(tf2, 2) fTable(tf3, 3) //
Intraday JXMODI Cross
https://www.tradingview.com/script/fg6TiTem-Intraday-JXMODI-Cross/
jxmodi
https://www.tradingview.com/u/jxmodi/
244
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/ // © Jxmodi //@version=4 study(title="Intraday JXMODI Cross", shorttitle="JxCross",precision=1) len1 = input(title="MA 1", defval = 15) len2 = input(title="MA 1", defval = 43) h1 = hline(45.) h2 = hline(50.) h3 = hline(55.) fill(h1, h3, color = color.new(color.gray, 95)) sh = rsi(close, len1) ln = sma(sh, len2) p1 = plot(sh, color = color.black) p2 = plot(ln, color = color.red) mycol = sh > ln ? color.green : color.fuchsia fill(p1, p2, color = mycol) buy = (sh[1] < ln[1] and sh > ln) sell = (sh[1] > ln[1] and sh < ln) alertcondition(buy, title='Buy', message='JxCross. Buy Signal') alertcondition(sell, title='Sell', message='JxCross. Sell Signal')
SARW
https://www.tradingview.com/script/udOmP9YO-SARW/
Sultan_shaya
https://www.tradingview.com/u/Sultan_shaya/
89
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/ // © Sultan_shaya //@version=5 indicator("SARW", overlay = true, max_bars_back=5000) //SCRW = Sultan Asset Correlation - using Waves //-------------------------------------------------------------------------------------------- BASIC INPUTS DECLARING Maxbar = input(defval=1000, title='Max LookBack length?') Swing_intensity = input.int(defval=20, title='Swing intensity') Base_Asset = input.symbol('BTCUSDT', title='Base Asset') f() => [high, low] [Base_Asset_High, Base_Asset_Low] = request.security(Base_Asset, timeframe.period, f()) //CC = Second Chart First_bar = Maxbar if (math.abs(ta.barssince(barstate.isfirst)) < Maxbar) First_bar := math.abs(ta.barssince(barstate.isfirst)) //-------------------------------------------------------------------------------------------- MAIN VARS float LastSwing_UP = 0 float LastSwing_DOWN = 0 float BaseAsset_LastSwing_UP = 0 float BaseAsset_LastSwing_DOWN = 0 bool LastIsHigh = true float Final_Correlation = 0 int SwingCounter = 0 int Stander_ceiling = 100000 //-------------------------------------------------------------------------------------------- MAIN FUNCTIONS Standardization (X) => Result = X while math.abs(Result) > Stander_ceiling Result /= 10 Result prcentage (RecentSwing, PriviousSwing) => (PriviousSwing - RecentSwing) / (RecentSwing / 100) Correlation (FirstAsset, SecondAsset) => float R = (FirstAsset/SecondAsset)*100 if math.abs(R) > Stander_ceiling R := Standardization(R) R //-------------------------------------------------------------------------------------------- if barstate.islast LastSwing_UP := (low[Swing_intensity] + (high[Swing_intensity] - low[Swing_intensity]) / 2) //Consider first candle as swing to start with LastSwing_DOWN := (low[Swing_intensity] + (high[Swing_intensity] - low[Swing_intensity]) / 2) BaseAsset_LastSwing_UP := (Base_Asset_Low[Swing_intensity] + (Base_Asset_High[Swing_intensity] - Base_Asset_Low[Swing_intensity]) / 2) BaseAsset_LastSwing_DOWN := (Base_Asset_Low[Swing_intensity] + (Base_Asset_High[Swing_intensity] - Base_Asset_Low[Swing_intensity]) / 2) for i = Swing_intensity to First_bar by 1 SwingLow = true SwingHigh = true //for loop to check if the candle is either high or low swing for j = 1 to Swing_intensity by 1 if not(low[i] <= low[i - j]) or not(low[i] <= low[i + j]) or (low[i] == low[i + 1]) or (low[i] == low[i + 2]) SwingLow := false SwingLow if not(high[i] >= high[i - j]) or not(high[i] >= high[i + j]) or (high[i] == high[i + 1]) or (high[i] == high[i + 2]) SwingHigh := false SwingHigh if SwingLow if LastIsHigh // If swing is low AND last swing was high SwingCounter +=1 if (SwingCounter >= 2) Current_prec = prcentage(LastSwing_UP, LastSwing_DOWN) Base_prec = prcentage(BaseAsset_LastSwing_UP, BaseAsset_LastSwing_DOWN) correlation_Result = Correlation(Current_prec, Base_prec) Final_Correlation += correlation_Result BaseAsset_LastSwing_DOWN := Base_Asset_Low[i] LastSwing_DOWN := low[i] LastIsHigh := false else // For first time finding low swing LastSwing_DOWN := low[i] BaseAsset_LastSwing_DOWN := Base_Asset_Low[i] LastIsHigh := false else if (low[i] < LastSwing_DOWN) // If swing is low AND last swing was low too LastSwing_DOWN := low[i] BaseAsset_LastSwing_DOWN := Base_Asset_Low[i] if SwingHigh if not LastIsHigh or (SwingCounter < 1) // (If swing is high AND last swing was low) OR (If this is the first swing ever) SwingCounter += 1 if (SwingCounter >= 2) Current_prec = prcentage(LastSwing_DOWN, LastSwing_UP) Base_prec = prcentage(BaseAsset_LastSwing_DOWN, BaseAsset_LastSwing_UP) correlation_Result = Correlation(Current_prec, Base_prec) Final_Correlation += correlation_Result BaseAsset_LastSwing_UP := Base_Asset_High[i] LastSwing_UP := high[i] LastIsHigh := true else LastSwing_UP := high[i] BaseAsset_LastSwing_UP := Base_Asset_High[i] LastIsHigh := true else if (high[i] > LastSwing_UP) // If swing is high AND last swing was high too LastSwing_UP := high[i] BaseAsset_LastSwing_UP := Base_Asset_High[i] SwingCounter -= 1 Final_Correlation := (Final_Correlation/SwingCounter) TextBox = "No Correlation" if math.abs(Final_Correlation) >= 40 if Final_Correlation >= 40 TextBox := "Direct Correlation"+"\nCorrelation Precentage : "+str.tostring(math.round(Final_Correlation))+"%" else TextBox := "Inverse Correlation"+"\nCorrelation Precentage : "+str.tostring(math.round(Final_Correlation))+"%" Lable = label.new(bar_index, high+high/5, text=TextBox, textcolor=color.black, size=size.huge, color=color.silver) Lable
Cowen Corridor
https://www.tradingview.com/script/pgmh3XGs-Cowen-Corridor/
nickolassteel
https://www.tradingview.com/u/nickolassteel/
162
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/ // © nickolassteel //@version=5 indicator("Cowen Corridor", overlay=true) w20_sma = request.security(syminfo.tickerid, 'W', ta.sma(close, 20)) fx = math.pow(math.e, -1 * ((bar_index - 90)* 0.01)) + 1 Upperbound = 2.4 * w20_sma * fx Lowerbound = (0.65) * w20_sma * 1/fx Top = plot(Upperbound, color = color.red) Bottom = plot(Lowerbound, color = color.green) fill(Top, Bottom, color = color.rgb(0, 188, 212, 80))
Cipher & Divergence
https://www.tradingview.com/script/70oKW1rm-Cipher-Divergence/
frozon
https://www.tradingview.com/u/frozon/
232
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/ // Thanks to LazyBear for his WaveTrend Oscillator https://www.tradingview.com/script/2KE8wTuF-Indicator-WaveTrend-Oscillator-WT/ // Thanks to vumanchu for his script vmc sipher B https://www.tradingview.com/script/Msm4SjwI-VuManChu-Cipher-B-Divergences/ // I especially want to thank TradingView for its platform that facilitates development and learning. // NOTES: // - I use it not to buy the bottom, but to get a confirmation when to enter // - Watch for a divergence to appear // - Wait for our wave trend to cross the zero line // - Enter on a pullback at key fib levels //@version=4 study("Cipher & Divergence") //---------------------------------------------------------------------- // Helpers //---------------------------------------------------------------------- // Thanks to vumanchu for his div finder https://www.tradingview.com/script/Msm4SjwI-VuManChu-Cipher-B-Divergences/ f_top_fractal(src) => src[4] < src[2] and src[3] < src[2] and src[2] > src[1] and src[2] > src[0] f_bot_fractal(src) => src[4] > src[2] and src[3] > src[2] and src[2] < src[1] and src[2] < src[0] f_fractalize(src) => f_top_fractal(src) ? 1 : f_bot_fractal(src) ? -1 : 0 f_findDivs(src, topLimit, botLimit, useLimits) => fractalTop = f_fractalize(src) > 0 and (useLimits ? src[2] >= topLimit : true) ? src[2] : na fractalBot = f_fractalize(src) < 0 and (useLimits ? src[2] <= botLimit : true) ? src[2] : na highPrev = valuewhen(fractalTop, src[2], 0)[2] highPrice = valuewhen(fractalTop, high[2], 0)[2] lowPrev = valuewhen(fractalBot, src[2], 0)[2] lowPrice = valuewhen(fractalBot, low[2], 0)[2] bearSignal = fractalTop and high[2] > highPrice and src[2] < highPrev bullSignal = fractalBot and low[2] < lowPrice and src[2] > lowPrev [fractalTop, fractalBot, bearSignal, bullSignal] //---------------------------------------------------------------------- // 0 line //---------------------------------------------------------------------- plot(0, color=color.gray) //---------------------------------------------------------------------- // Main signal //---------------------------------------------------------------------- chanLength = input(20, "Channel Length", group="Wave trend") avgLength = input(5, "Average Length", group="Wave trend") maLength = input(2, "MA Length", group="Wave trend") src = input(title="Source", defval=hlc3, type=input.source, group="Wave trend") esa = ema(src, chanLength) d = ema(abs(src - esa), chanLength) ci = (src - esa) / (0.015 * d) wt1 = ema(ci, avgLength) wt2 = sma(wt1, maLength) wt1p = plot(wt1, color=color.gray, transp=100) wt2p = plot(wt2, color=color.gray, transp=100) fill(wt1p, wt2p, color=(wt1 > wt2 ? color.green : color.red), transp=0) //---------------------------------------------------------------------- // Divs //---------------------------------------------------------------------- wtDivOBLevel = input(45, title = 'Bearish Divergence min', type = input.integer, group="Divergences") wtDivOSLevel = input(-65, title = 'Bullish Divergence min', type = input.integer, group="Divergences") [fractalTop, fractalBot, bearDiv, bullDiv] = f_findDivs(wt2, wtDivOBLevel, wtDivOSLevel, true) bearDivColor = bearDiv ? color.red : na bullDivColor = bullDiv ? color.green : na plot(series = fractalTop ? wt2[2] : na, title = 'Bearish Divergence', color = bearDivColor, linewidth = 2, offset = -2) plot(series = fractalBot ? wt2[2] : na, title = 'Bullish Divergence', color = bullDivColor, linewidth = 2, offset = -2) //---------------------------------------------------------------------- // Alerts //---------------------------------------------------------------------- alertcondition(bearDiv, title="Bearish diversion") alertcondition(bullDiv, title="Bullish diversion") alertcondition(crossover(wt2, 0), title="Wave trend crossed over 0 line") alertcondition(crossunder(wt2, 0), title="Wave trend crossed under 0 line")
FuzzyInx
https://www.tradingview.com/script/0vT7Oclo-FuzzyInx/
R26am
https://www.tradingview.com/u/R26am/
16
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © R26am // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © R26am //@version=5 indicator("FuzzyInx", overlay=true) length = input.int(60, minval=1, title="Period") per = input.int(8, minval=5, title="persentLength") per1 = input.float(1.8, minval=1.1, title="persentATR") sum = 0.0 for j = 0.0 to length-1 sum := sum + (high[j] - low[j]) sign() => s = 1.0 if open- close > 0 s := -1 s //------------------- size = 2 persentLength = per //--------------------- le(size,ind) => sign = sign()[ind] len = 0.0 h = 0.0 l = 8000000000000.0 ind_i = ind for i=ind_i to size+ind-1 if sign()[i] == sign()[i+1] h := math.max(high[i],high[i+1],h) l := math.min(low[i],low[i+1],l) ind_i := i+1 else h := math.max(high[i],h) l := math.min(low[i],l) ind_i := i+1 break len := h-l if sum/len*persentLength > len len := 0 [len,sign,ind_i,h,l] // //-------------------------------------- [can_l1,sign1,idx1,h1,l1] = le(size,0) [can_l2,sign2,idx2,h2,l2] = le(size,idx1) sss = 0 diff = 10 if sign1 != sign2 if can_l2 > 0 and can_l1 > 0 and (math.max(can_l1,can_l2) / math.min(can_l1,can_l2) <= 1.3) if (sign2 == 1 and l1 < l2) or (sign2 == -1 and h1 > h2) sss := 1 if sss if sign1 == 1 label.new(bar_index, na, str.tostring(can_l1), yloc = yloc.belowbar, color = color.new(color.green, 70), textcolor = color.black, style = label.style_label_up) else label.new(bar_index, na, str.tostring(can_l1), yloc = yloc.abovebar, color = color.new(color.red, 70) , textcolor = color.black, style = label.style_label_down)
Senkou/Tenkan/Kijun Higher Time Frame
https://www.tradingview.com/script/KImVE6ie/
GiuseppeInzirillo
https://www.tradingview.com/u/GiuseppeInzirillo/
33
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © GiuseppeInzirillo //@version=5 indicator("Senkou/Tenkan/Kijun Higher Time Frame", shorttitle="Ichimoku HTF", overlay=true) // input declarations tenkan_len = input.int(9, title="Tenkan Length") kijun_len = input.int(26, title="Kijun Length") senkou_b_period = input.int(52) timeframe1 = input.timeframe("15", "Higher Timeframe1") timeframe2 = input.timeframe("30", "Higher Timeframe2") timeframe3 = input.timeframe("60", "Higher Timeframe3") timeframe4 = input.timeframe("240", "Higher Timeframe4") timeframe5 = input.timeframe("D", "Higher Timeframe5") timeframe6 = input.timeframe("W", "Higher Timeframe6") timeframe7 = input.timeframe("M", "Higher Timeframe7") // Tenkan Definition tenkan = math.avg(ta.highest(high,tenkan_len), ta.lowest(low, tenkan_len)) tenkan_high1 = request.security(syminfo.tickerid,timeframe1,tenkan) tenkan_high2 = request.security(syminfo.tickerid,timeframe2,tenkan) tenkan_high3 = request.security(syminfo.tickerid,timeframe3,tenkan) tenkan_high4 = request.security(syminfo.tickerid,timeframe4,tenkan) tenkan_high5 = request.security(syminfo.tickerid,timeframe5,tenkan) tenkan_high6 = request.security(syminfo.tickerid,timeframe6,tenkan) tenkan_high7 = request.security(syminfo.tickerid,timeframe7,tenkan) // Kijun Definition kijun = math.avg(ta.highest(high,kijun_len), ta.lowest(low, kijun_len)) kijun_high1 = request.security(syminfo.tickerid,timeframe1,kijun) kijun_high2 = request.security(syminfo.tickerid,timeframe2,kijun) kijun_high3 = request.security(syminfo.tickerid,timeframe3,kijun) kijun_high4 = request.security(syminfo.tickerid,timeframe4,kijun) kijun_high5 = request.security(syminfo.tickerid,timeframe5,kijun) kijun_high6 = request.security(syminfo.tickerid,timeframe6,kijun) kijun_high7 = request.security(syminfo.tickerid,timeframe7,kijun) // Senkou Span A Definition senkou_a = math.avg(tenkan, kijun) ssa_high1 = request.security(syminfo.tickerid,timeframe1,senkou_a[kijun_len - 1]) ssa_high2 = request.security(syminfo.tickerid,timeframe2,senkou_a[kijun_len - 1]) ssa_high3 = request.security(syminfo.tickerid,timeframe3,senkou_a[kijun_len - 1]) ssa_high4 = request.security(syminfo.tickerid,timeframe4,senkou_a[kijun_len - 1]) ssa_high5 = request.security(syminfo.tickerid,timeframe5,senkou_a[kijun_len - 1]) ssa_high6 = request.security(syminfo.tickerid,timeframe6,senkou_a[kijun_len - 1]) ssa_high7 = request.security(syminfo.tickerid,timeframe7,senkou_a[kijun_len - 1]) // Senkou Span B Definition senkou_b = math.avg(ta.highest(high,senkou_b_period), ta.lowest(low, senkou_b_period)) ssb_high1 = request.security(syminfo.tickerid,timeframe1,senkou_b[kijun_len - 1]) ssb_high2 = request.security(syminfo.tickerid,timeframe2,senkou_b[kijun_len - 1]) ssb_high3 = request.security(syminfo.tickerid,timeframe3,senkou_b[kijun_len - 1]) ssb_high4 = request.security(syminfo.tickerid,timeframe4,senkou_b[kijun_len - 1]) ssb_high5 = request.security(syminfo.tickerid,timeframe5,senkou_b[kijun_len - 1]) ssb_high6 = request.security(syminfo.tickerid,timeframe6,senkou_b[kijun_len - 1]) ssb_high7 = request.security(syminfo.tickerid,timeframe7,senkou_b[kijun_len - 1]) //senkou_a_plot = plot(senkou_a, offset = kijun_len - 1, color=#A5D6A7, title="Seknou Span A") //senkou_b_plot = plot(senkou_b, offset = kijun_len - 1, color=#EF9A9A, title="Senkou Span B") plot(tenkan_high1, color=#81c784, title="Tenkan 15M", linewidth=1) plot(kijun_high1, color=#81c784, title="Kijun 15M", linewidth=1) plot(ssa_high1, color=#81c784, title="SSA 15M", style=plot.style_circles, linewidth=1) plot(ssb_high1, color=#81c784, title="SSB 15M", style=plot.style_circles, linewidth=1) plot(tenkan_high2, color=#42bda8, title="Tenkan 30M", linewidth=1) plot(kijun_high2, color=#42bda8, title="Kijun 30M", linewidth=1) plot(ssa_high2, color=#42bda8, title="SSA 30M", style=plot.style_circles, linewidth=1) plot(ssb_high2, color=#42bda8, title="SSB 30M", style=plot.style_circles, linewidth=1) plot(tenkan_high3, color=color.gray, title="Tenkan H1", linewidth=1) plot(kijun_high3, color=color.gray, title="Kijun H1", linewidth=1) plot(ssa_high3, color=color.gray, title="SSA H1", style=plot.style_circles, linewidth=1) plot(ssb_high3, color=color.gray, title="SSB H1", style=plot.style_circles, linewidth=1) plot(tenkan_high4, color=color.orange, title="Tenkan H4", linewidth=1) plot(kijun_high4, color=color.orange, title="Kijun H4", linewidth=1) plot(ssa_high4, color=color.orange, title="SSA H4", style=plot.style_circles, linewidth=1) plot(ssb_high4, color=color.orange, title="SSB H4", style=plot.style_circles, linewidth=1) plot(tenkan_high5, color=color.maroon, title="Tenkan D", linewidth=1) plot(kijun_high5, color=color.maroon, title="Kijun D", linewidth=1) plot(ssa_high5, color=color.maroon, title="SSA D", style=plot.style_circles, linewidth=1) plot(ssb_high5, color=color.maroon, title="SSB D", style=plot.style_circles, linewidth=1) plot(tenkan_high6, color=color.olive, title="Tenkan W", linewidth=1) plot(kijun_high6, color=color.olive, title="Kijun W", linewidth=1) plot(ssa_high6, color=color.olive, title="SSA W", style=plot.style_circles, linewidth=1) plot(ssb_high6, color=color.olive, title="SSB W", style=plot.style_circles, linewidth=1) plot(tenkan_high7, color=color.purple, title="Tenkan M", linewidth=1) plot(kijun_high7, color=color.purple, title="Kijun M", linewidth=1) plot(ssa_high7, color=color.purple, title="SSA M", style=plot.style_circles, linewidth=1) plot(ssb_high7, color=color.purple, title="SSB M", style=plot.style_circles, linewidth=1)
Close Combination Lock Style - Visual Appeal
https://www.tradingview.com/script/wNpGQend-Close-Combination-Lock-Style-Visual-Appeal/
processingclouds
https://www.tradingview.com/u/processingclouds/
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/ // © processingclouds //@version=5 indicator("Close Prices - Combination Lock Style", "Stylish Price Change", overlay=true) // ----- Variable { varip float up_lvl1 = na varip float up_lvl2 = na varip float up_lvl3 = na varip float dn_lvl1 = na varip float dn_lvl2 = na varip float dn_lvl3 = na varip float current = na var int integral = na var int fractional = na var int isDecimal = na var table combinations = na // Get Integral and Fractional part of close price value = close isDecimal := str.pos(str.tostring(value), ".") integral := na(isDecimal)?str.length(str.tostring(value)):str.pos(str.tostring(value), ".") fractional := na(isDecimal)?0:str.length(str.substring(str.tostring(value), isDecimal+1)) // Inputs theme = input.string(defval="Black Dials", title="Choose Theme", options=["Black Dials","Silver Dials"]) // ----- } // ----- Table Creation Functions { fillTable(tableId, col, row, value, lvl) => backColor = color.new(theme == "Black Dials" ? color.black : color.white, lvl==0?0:lvl==1?40:60) foreColor = color.new(theme == "Black Dials" ? color.white : color.black, 0) table.cell(tableId, col, row, value, 0,3, foreColor, text.align_center, text.align_center, lvl==0?size.large:lvl==1?size.normal:size.small, backColor) fillCell(value, row) => if not na(value) valueAsString = str.tostring(value) for i = 0 to integral - 1 fillTable(combinations, i, row, str.substring(valueAsString,i,i+1), row==2?0:(row==1 or row==3)?1:2) if isDecimal fillTable(combinations, integral, row, ".", row==2?0:(row==1 or row==3)?1:2) if (str.length(valueAsString)-integral>0) for i = 0 to fractional - 1 fillTable(combinations, i+integral+1, row, str.substring(valueAsString,i+integral+1,i+integral+2), row==2?0:(row==1 or row==3)?1:2) // ----- } // ----- Main Logic { // Create New Table if (barstate.isfirst) combinations := table.new(position.middle_right, fractional + integral + 1 + 1, 5, border_color=theme=="Black Dials"?color.white:color.black, border_width =1) // Update all combination values if (barstate.isrealtime or barstate.islast) value = close if (current != value) if value < current up_lvl3 := up_lvl2 up_lvl2 := up_lvl1 up_lvl1 := current if (dn_lvl1 == value) dn_lvl1 := dn_lvl2 dn_lvl2 := dn_lvl3 dn_lvl3 := low table.cell(combinations, fractional + integral + 1, 2, "▼", 0, 3, color.red, text.align_center, text.align_center, size.large, color.new(theme == "Black Dials" ? color.black : color.silver, 0)) if value > current dn_lvl3 := dn_lvl2 dn_lvl2 := dn_lvl1 dn_lvl1 := current if (up_lvl1 == value) up_lvl1 := up_lvl2 up_lvl2 := up_lvl3 up_lvl3 := high table.cell(combinations, fractional + integral + 1, 2, "▲", 0, 3, color.green, text.align_center, text.align_center, size.large, color.new(theme == "Black Dials" ? color.black : color.silver, 0)) else table.cell(combinations, fractional + integral + 1, 2, "=", 0, 3, color.yellow, text.align_center, text.align_center, size.large, color.new(theme == "Black Dials" ? color.black : color.silver, 0)) current := value // Call function to fill table with values fillCell(up_lvl1, 0) fillCell(up_lvl2, 1) fillCell(current, 2) fillCell(dn_lvl1, 3) fillCell(dn_lvl2, 4) // ----- } // ----- Versions // 02 19 22 - First Version published
Risk Assist
https://www.tradingview.com/script/75VbryO1-Risk-Assist/
Electrified
https://www.tradingview.com/u/Electrified/
115
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Electrified //@version=5 indicator("Risk Assist", overlay=true) import Electrified/LabelHelper/8 as LH targetTake = input.float(33.3, "Target Safe Take %", step=0.1, minval=0, maxval=100, tooltip="The desired maximium percent of the position to exit in order to avoid a losing position.") entryTime = input.time(-1, "Entry", confirm=true, tooltip="The point in time the entry was executed.\nThe price is defaulted to the HLC3 of that bar.") costBasis = input.price(0, "Basis", tooltip="The cost basis to use instead of the HLC3 of the entry.\nA value of zero or less will assume the entry price is the HLC3 from the entry bar.") stopLevel = input.price(-1, "Stop", confirm=true, tooltip="A stop level below the entry price assumes a long position, and a price above assumes a short position.") ready = entryTime != -1 and stopLevel != -1 var L = 100 var float EP = na // entry price var float RA = na // risk amount var float TL = na // target level float GA = na // gain if ready and na(EP) // Necessary for if time frame has been changed. if time == entryTime EP := costBasis==0 ? hlc3 : costBasis else if time > entryTime EP := costBasis==0 ? hlc3[1] : costBasis if not na(EP) RA := EP - stopLevel TL := EP + L * RA / targetTake - RA line.new(time, stopLevel, time, EP, xloc.bar_time, extend.both, color.white, line.style_dotted, 2) line.new(time, stopLevel, time + timeframe.multiplier, stopLevel, xloc.bar_time, extend.right, color.red, line.style_dotted, 2) line.new(time, TL, time + timeframe.multiplier, TL, xloc.bar_time, extend.right, color.lime, line.style_dotted, 2) box.new(time, EP, time + timeframe.multiplier, stopLevel, border_width=0, xloc=xloc.bar_time, extend=extend.right, bgcolor=color.new(color.red, 85)) box.new(time, TL, time + timeframe.multiplier, EP, border_width=0, xloc=xloc.bar_time, extend=extend.right, bgcolor=color.new(color.orange, 95)) digits(float value) => a = math.abs(value) v = a < 1 ? 4 : a < 10 ? 3 : 2 d = math.pow(10, v) str.tostring(math.floor(value * d) / d) if not na(RA) GA := close - EP plot(na(RA) ? na : stopLevel, "Stop Level", color.rgb(120, 0, 0), 0) plot(TL, "Target Level", color.rgb(0, 120, 0), 0) alertcondition(EP>stopLevel and close>=TL or EP<stopLevel and close<=TL, "1) Target Gain Reached", "Target Gain Reached. ({{ticker}} {{interval}})") alertcondition(EP>stopLevel and close>EP or EP<stopLevel and close<EP, "2) Winning Position", "Winning Position. ({{ticker}} {{interval}})") alertcondition(EP>stopLevel and close<EP or EP<stopLevel and close>EP, "3) Losing Position", "Losing Position. ({{ticker}} {{interval}})") alertcondition(EP>stopLevel and close<stopLevel or EP<stopLevel and close>stopLevel, "4) Risk Exceeded", "Risk Exceeded. ({{ticker}} {{interval}})")
Entanglement Pen
https://www.tradingview.com/script/btpQbrkv/
slmgtv1
https://www.tradingview.com/u/slmgtv1/
223
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/ // © slmgtv1 // v1.0 2022/02/20 // v1.1 2022/02/27 新增“破前低”的标签。(Add "Break-previous-low" label.) // v2.0 2022/03/17 大幅简化计算流程,使得呈现速度更快,覆盖的bar数也更多。(Significantly simplifies the calculation process, making rendering faster and covering more bars.) // v2.1 2022/03/18 更正“前低”的计算逻辑,并使“破前低”标记覆盖所有bar。(Correct the calculation logic of "pre-low" and make the "break pre-low" marker cover all bars.) //@version=5 indicator("缠论笔", overlay=true) // --------------------------------------------------------------------------------------------------------------- // 1.定义变量 // --------------------------------------------------------------------------------------------------------------- // N_small = input.int(N_small, '小顶和小底的计算bar数:') N_small = 2000 is_plot_qiandi = input.bool(true, '是否画出“前低”线?') is_display_labels = input.bool(true, '是否呈现各类label(顶、底、破前低)?') n1 = 0 n2 = 0 n3 = 0 // 计算顶部强度的周期 n4 = 0 // 计算底部强度的周期 is_top_strong = false // 顶部是否足够强?即:顶部与底部的价差足够大:顶部的low>底部的high is_bottom_strong = false // 底部是否足够强?即:顶部与底部的价差足够大:顶部的low>底部的high is_up_strong = false // 涨势是否足够强?即:low和high都在连续上涨 is_down_strong = false // 跌势是否足够强?即:low和high都在连续下跌 is_last_top = false // 短期内连续出现多个顶部bar时,此bar是否最后一个顶部bar is_last_bottom = false // --------------------------------------------------------------------------------------------------------------- // 2.计算简单周期 // --------------------------------------------------------------------------------------------------------------- // n1 : 此BAR的高点是多少bar的最高点? // N1HIGH:=TOPRANGE(H); for i = 1 to N_small n1 := i-1 if high<=high[i] break // n2 : 此BAR的低点是多少bar的最低点? // N2LOW:=LOWRANGE(L); for i = 1 to N_small n2 := i-1 if low>low[i] break // n3 : n1内,high的最低点到当前BAR的bar数 // N3:=LLVBARS(H,N1HIGH); lowest_high = high if n1>1 for i = 1 to n1-1 lowest_high := math.min(lowest_high, high[i]) n3 := na if n1>0 for i = 0 to n1 n3 := i if high[i]==lowest_high break // n4 : n2内,low的最高点到当前BAR的bar数 // N4:=HHVBARS(L,N2LOW); highest_low = low if n2>1 for i = 1 to n2-1 highest_low := math.max(highest_low, low[i]) n4 := na if n2>0 for i = 0 to n2 n4 := i if low[i]==highest_low break // --------------------------------------------------------------------------------------------------------------- // 3.计算复杂标签 // --------------------------------------------------------------------------------------------------------------- // 顶部是否足够强?即:顶部与底部的价差足够大:顶部的low>底部的high // N3+1内,L的最高点,是否大于H的最低点? // TOPSTRENGTH:=HHV(L,N3+1)>LLV(H,N3+1); highest_low_n3 = low if n3>1 for i = 1 to n3 highest_low_n3 := math.max(highest_low_n3, low[i]) lowest_high_n3 = high if n3>1 for i = 1 to n3 lowest_high_n3 := math.min(lowest_high_n3, high[i]) is_top_strong := highest_low_n3 > lowest_high_n3 // 底部是否足够强?即:顶部与底部的价差足够大:顶部的low>底部的high // N4+1内,L的最高点,是否大于H的最低点? // BOTTOMSTRENGTH:=HHV(L,N4+1)>LLV(H,N4+1); highest_low_n4 = low if n4>1 for i = 1 to n4 highest_low_n4 := math.max(highest_low_n4, low[i]) lowest_high_n4 = high if n4>1 for i = 1 to n4 lowest_high_n4 := math.min(lowest_high_n4, high[i]) is_bottom_strong := highest_low_n4 > lowest_high_n4 // 涨势是否足够强?即:low和high都在连续上涨 // N3内,此低>=前低,的次数,是否>2;且:周期3内,此高>=前高,的次数,是否>2 // TOPINCLUDE:=COUNT(L>=REF(L,1),N3)>2 AND COUNT(H>=REF(H,1),N3)>2; n_up_low = 0 if n3>0 for i = 0 to n3 if low[i]>low[i+1] n_up_low := n_up_low + 1 n_up_high = 0 if n3>0 for i = 0 to n3 if high[i]>high[i+1] n_up_high := n_up_high + 1 is_up_strong := (n_up_low>2) and (n_up_high>2) // 跌势是否足够强?即:low和high都在连续下跌 // {N4内,此高<=前高,的次数,是否>2;且:周期5内,此低<=前低,的次数,是否>2}{标记4} // BOTTOMINCLUDE:=COUNT(H<=REF(H,1),N4)>2 AND COUNT(L<=REF(L,1),N4)>2; n_down_low = 0 if n4>0 for i = 0 to n4 if low[i]<low[i+1] n_down_low := n_down_low + 1 n_down_high = 0 if n4>0 for i = 0 to n4 if high[i]<high[i+1] n_down_high := n_down_high + 1 is_down_strong := (n_down_low>2) and (n_down_high>2) // --------------------------------------------------------------------------------------------------------------- // 4.确定小顶和小底 // --------------------------------------------------------------------------------------------------------------- // {顶BAR成立的前提条件:周期1 且 标记1 且 标记3 且 周期3>3} // TOP0:=N1HIGH AND TOPSTRENGTH AND TOPINCLUDE AND N3>3; is_top_0 = (n1>0) and (n3>3) and is_top_strong and is_up_strong // {底BAR成立的前提条件:周期2 且 标记2 且 标记4 且 周期4>3} // BOTTOM0:=N2LOW AND BOTTOMSTRENGTH AND BOTTOMINCLUDE AND N4>3; is_bottom_0 = (n2>0) and (n4>3) and is_bottom_strong and is_down_strong // {TOPDAYS:前一个TOP0的BAR,距离现在几根BAR?} // TOP0DAYS:=BARSLAST(TOP0); n_top0_previous = bar_index - ta.valuewhen(is_top_0, bar_index, 0) n_bottom0_previous = bar_index - ta.valuewhen(is_bottom_0, bar_index, 0) // {间隔是否足够长?如果本BAR就是TOP0,则返回BOTTOMDAYS,若有则返回TOPDAYS;BAR数是否>=3} // IS3BAR:=IF(TOP0DAYS=0,BOTTOM0DAYS,TOP0DAYS)>=3; is_3_bar = (n_top0_previous==0 ? n_bottom0_previous : n_top0_previous)>=3 // {顶BAR:顶BAR前提 且 足够长 且 此高是前一个BOTTOM0成立以来的最高点} // TOP:=TOP0 AND IS3BAR AND H=HHV(H, BOTTOM0DAYS); highest_high = high if n_bottom0_previous>1 for i = 1 to n_bottom0_previous highest_high := math.max(highest_high, high[i]) is_top = is_top_0 and is_3_bar and high==highest_high if is_top and is_display_labels label.new(bar_index, high, str.tostring('顶'), style=label.style_label_down, color=color.gray, textcolor=color.white, size=size.small) // {底BAR:底BAR前提 且 足够长 且 此低是前一个TOP0成立以来的最低点} // BOTTOM:=BOTTOM0 AND IS3BAR AND L=LLV(L, TOP0DAYS); lowest_low = low if n_top0_previous>1 for i = 1 to n_top0_previous lowest_low := math.min(lowest_low, low[i]) // is_top_last = false // is_bottom_last = false // label_top2 = '顶' is_bottom = is_bottom_0 and is_3_bar and low==lowest_low if is_bottom and is_display_labels label.new(bar_index, low, str.tostring('底'), style=label.style_label_up, color=color.gray, textcolor=color.white, size=size.small) // --------------------------------------------------------------------------------------------------------------- // 5.画出大顶和大底,并连线 // --------------------------------------------------------------------------------------------------------------- x1 = bar_index x2 = bar_index y1 = 0.0 y2 = 0.0 if is_bottom // 对于1个小底来说,它之前最近的1个小顶,就是大顶 for i = 1 to N_small if is_top[i] x2 := bar_index[i] y2 := high[i] if is_display_labels label.new(x2, y2, '顶', style=label.style_label_down, color=color.blue, textcolor=color.white, size=size.normal) for j = 1 to N_small // 然后从这个大顶出发,找之前最近的一个小底,即最近的一个大底,连线它俩 if is_bottom[i+j] x1 := bar_index[i+j] y1 := low[i+j] line.new(x1, y1, x2, y2, color = color.black) break break if is_bottom[i] // 若先找到小底,则说明是连续小底,则退出循环 break if is_top // 对于1个小顶来说,它之前最近的1个小底,就是大底 for i = 1 to N_small if is_bottom[i] x2 := bar_index[i] y2 := low[i] if is_display_labels label.new(x2, y2, '底', style=label.style_label_up, color=color.blue, textcolor=color.white, size=size.normal) for j = 1 to N_small if is_top[i+j] x1 := bar_index[i+j] y1 := high[i+j] line.new(x1, y1, x2, y2, color = color.black) break break if is_top[i] // 若先找到小顶,则说明是连续小顶,则退出循环 break // bottom_value = 0.0 // bottom_value := is_bottom ? low : bottom_value[1] // plot(bottom_value, color = color.purple) // top_value = 0.0 // top_value := is_top ? high : top_value[1] // plot(top_value, color = color.olive) // --------------------------------------------------------------------------------------------------------------- // 6.当前bar是否破前低 // --------------------------------------------------------------------------------------------------------------- qiandi = 0.0 // 前低是多少 is_top_near = false // 最近一个有标记的bar是top bar吗? is_po_qiandi = false ts_di = 0 if is_top // 若此bar是顶bar,则允许更新前低值 for i = 0 to N_small // 从当前bar出发,往前找最近一个小底(也是大底): if is_bottom[i] qiandi := low[i] ts_di := time[i] break else if is_bottom[1] or is_po_qiandi[1] // 若前一个bar是小底或破前低bar,则允许更新前低值 qiandi := low[1] ts_di := time[1] else // 其他情况下,前低值不变 qiandi := qiandi[1] ts_di := ts_di[1] plot(is_plot_qiandi ? qiandi : na, linewidth=2) msg1 = '{ "group": "8", "ticker": "'+ syminfo.ticker + '", "k_time": "' + timeframe.period + '", "timestamp": "' + str.tostring(time) + '", "price": "' + str.tostring(close, "#.000") + '", "type": "break_previous_low", "ts_di": "' + str.tostring(ts_di) + '" }' label_po_qiandi = 0.0 if close < qiandi is_po_qiandi := true label_po_qiandi := close alert(msg1, alert.freq_once_per_bar_close) if is_display_labels label.new(bar_index, high, '破前低', style=label.style_label_down, color=color.red, textcolor=color.white, size=size.normal) // plot(label_po_qiandi, color = color.red, linewidth=1) plot(is_plot_qiandi ? label_po_qiandi : na, color = color.maroon, linewidth=1, style = plot.style_histogram ) // label.new(bar_index, low, str.tostring(n2), style=label.style_label_up, color=color.blue, textcolor=color.white, size=size.normal) // label.new(bar_index, low, str.tostring(bar_index), style=label.style_label_up, color=color.blue, textcolor=color.white, size=size.normal)
EMA Oscilator [Azzrael]
https://www.tradingview.com/script/qM9wm0PW-EMA-Oscilator-Azzrael/
Azzrael
https://www.tradingview.com/u/Azzrael/
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/ // © Azzrael //@version=5 indicator("EMA Oscilator by Azzrael", overlay=false) ema_length = input.int(9, "EMA Period", minval=2, step=1) limit = input.float(2, "Limit Factor", minval=1, step=0.1, maxval=10) v = close - ta.ema(close, ema_length) dev = ta.stdev(v, ema_length) dev_limit = dev*limit // Plot Standard Deviations plot(dev, "Std Dev Green", color=color.new(color.blue, 70)) plot(dev*-1, "Std Dev Red", color=color.new(color.orange, 70)) plot(dev_limit, "Std Dev Green 2", color=color.new(color.green, 80)) plot(dev_limit*-1, "Std Dev Red 2", color=color.new(color.orange, 80)) // Plot Oscilator Value color = v >= dev_limit ? color.green : v > 0 ? color.new(color.blue, 80) : v > dev_limit*-1 ? color.new(color.orange, 80): color.red plot(v, "EMA Osc", style=plot.style_histogram, color=color)
[Fedra Algotrading LR + TTP Indicator Lite]
https://www.tradingview.com/script/X5AkOntp-Fedra-Algotrading-LR-TTP-Indicator-Lite/
Fedra_Algotrading
https://www.tradingview.com/u/Fedra_Algotrading/
518
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/ // © francobarberis // User Version //@version=5 indicator('[Fedra Algotrading LR + TTP Indicator Lite]', '[Fedra Algotrading LR + TTP Indicator Lite] 3.5', overlay = true, format=format.price, precision=2, max_labels_count=500) ///////////////SESSION InSession(sessionTimes, sessionTimeZone=syminfo.timezone) => not na(time(timeframe.period, sessionTimes, sessionTimeZone)) // Create the inputs sessionInput = input.session("0000-0000", title="Session Times", group="Trading Session", tooltip="Use the checkboxes to select " + "on which days of the week this session is active. The session " + "has to be active on at least one day.") monSession = input.bool(true, title="Mon ", group="Trading Session", inline="d1") tueSession = input.bool(true, title="Tue ", group="Trading Session", inline="d1") wedSession = input.bool(true, title="Wed ", group="Trading Session", inline="d1") thuSession = input.bool(true, title="Thu ", group="Trading Session", inline="d1") friSession = input.bool(true, title="Fri   ", group="Trading Session", inline="d2") satSession = input.bool(true, title="Sat  ", group="Trading Session", inline="d2") sunSession = input.bool(true, title="Sun ", group="Trading Session", inline="d2") BGSession = input.bool(false, title="Session Background?", group="Trading Session") // Make a days of week string based on the value of the checkboxes sessionDays = "" if sunSession sessionDays += "1" if monSession sessionDays += "2" if tueSession sessionDays += "3" if wedSession sessionDays += "4" if thuSession sessionDays += "5" if friSession sessionDays += "6" if satSession sessionDays += "7" // Make the session string by joining the time with the days tradingSession = sessionInput + ":" + sessionDays bgcolor(InSession(tradingSession) and BGSession ? color.new(color.fuchsia, 85) : na) // Highlight background when bars happen inside session specified /////////////////////////// source = input.source(open, group='LR Settings (BUY & SELL)') length = input.int(title='Lenght', defval= 10, step = 10, minval=1, group='LR Settings (BUY & SELL)', tooltip="Number of candles used to calculate the Linear Regression. Recommended values are between 10 and 100.") offset = 0//input.int(0, minval=0, group='LR Settings (BUY & SELL)') dev = input.float(title='Deviation: -3/0/3', defval= 2.0, step = 0.5, group='LR Settings (BUY & SELL)', tooltip="Linear regression deviation to establish the range. Recommended values are between 0 and 3.") smoothing = 1//input.int(1, minval=1, group='LR Settings (BUY & SELL)') mtf_val = input.timeframe('', 'Resolution', group='LR Settings (BUY & SELL)') line_thick = 1//input.int(1, 'S&R Thickness', minval=1, maxval=4, group='LR Settings') p = 'Lime'//input.string('Lime', 'Up Color', options=['Red', 'Lime', 'Orange', 'Teal', 'Yellow', 'White', 'Black'], group='LR Settings') q = 'Red'//input.string('Red', 'Down Color', options=['Red', 'Lime', 'Orange', 'Teal', 'Yellow', 'White', 'Black'], group='LR Settings') goto = 0//input.int(0, 'End At Bar Index', group='LR Settings') var totalPnl = 0.0 var pnlPos = 0 var pnlNeg = 0 var totalTrades = 0 var hold = 0.0 byh = (((close-hold)/hold)*100) var start = timestamp(year, month, dayofweek, hour, minute, second) enableEma200 = input.bool(title='Enable confirmation MA Filter?', defval=false, group='MA Settings to determine downtrend (BUY & SELL)', tooltip="Add an MA for trend confirmation") bigTrend_lenght = input.int(title= "Lenght of the confirmation MA Filter", defval= 200, step = 10, group='MA Settings to determine downtrend (BUY & SELL)', tooltip="Longs only when green") MAsource = input.source(open, title= "MAs Source", group='MA Settings to determine downtrend (BUY & SELL)') emaLength = input.int(title='Fast MA Length', defval=20, group='MA Settings to determine downtrend (BUY & SELL)', tooltip="Yellow line: Suggested optimization values, between 10 and 50") showSTfilter = input.bool(title='Apply Supertrend Filter?', defval=false, group='SuperTrend Settings (BUY)', tooltip="Add super trend confirmation to the trend filter") //showTSL = input.bool(title='Enable SL?', defval=true, group='Fine Tunning Settings (SELL)', tooltip="This option enables the stop loss (red line).") //enableSL = input.bool(title='Enable "Exit in Loss"?', defval=true, group='Fine Tunning Settings (SELL)', tooltip="This option enables selling at a loss when it determines that the trade is unlikely to be favorable: the price is below 'Exit in loss' (fuchsia line) and breaks upwards the deviation of the linear regression (orange triangle).") //enableBE = input.bool(title='Enable Break Even?', defval=false, group='Fine Tunning Settings (SELL)', tooltip="This option enables a take profit on break even when the price is between the fast MA (yellow line) and the slow MA (blue line) and the default percentage of 1.5% is reached.") //showSLEMAfilter = input.bool(title='Apply Trend Filter to "Exit in Loss"?', defval=true, group='Fine Tunning Settings (SELL)', tooltip="With this condition enabled, the Fast MA (yellow line) must be above the Slow MA (blue line), for 'Sell in loss' to be allowed.") string i_maType = input.string("SMA", "Fast MA type", options = ["SMA","EMA", "RMA", "WMA","HMA", "CHANGE","CMO","COG","DEV","HIGHEST","LOWEST","MEDIAN","MOM","RANGE","STDEV","VARIANCE"], group='MA Settings to determine downtrend (BUY & SELL)') float ma = switch i_maType "SMA" => ta.sma(MAsource, emaLength) "EMA" => ta.ema(MAsource, emaLength) "RMA" => ta.rma(MAsource, emaLength) "HMA" => ta.hma(MAsource, emaLength) "CHANGE" => ta.change(MAsource, emaLength) "CMO" => ta.cmo(MAsource, emaLength) "COG" => ta.cog(MAsource, emaLength) "DEV" => ta.dev(MAsource, emaLength) "HIGHEST" => ta.highest(MAsource, emaLength) "LOWEST" => ta.lowest(MAsource, emaLength) "MEDIAN" => ta.median(MAsource, emaLength) "MOM" => ta.mom(MAsource, emaLength) "RANGE" => ta.range(MAsource, emaLength) "STDEV" => ta.stdev(MAsource, emaLength) "VARIANCE" => ta.variance(MAsource, emaLength) // Default used when the three first cases do not match. => ta.wma(MAsource, emaLength) emaLength2 = input.int(title='Slow MA Length', defval=100, step=10, group='MA Settings to determine downtrend (BUY & SELL)', tooltip="Blue line: Suggested optimization values, between 50 and 200") string i_maType2 = input.string("SMA", "Slow MA type", options = ["SMA","EMA","RMA", "WMA","HMA", "CHANGE", "CMO","COG","DEV","HIGHEST","LOWEST","MEDIAN", "MOM","RANGE","STDEV","VARIANCE"], group='MA Settings to determine downtrend (BUY & SELL)') float ma2 = switch i_maType2 "SMA" => ta.sma(MAsource, emaLength2) "EMA" => ta.ema(MAsource, emaLength2) "RMA" => ta.rma(MAsource, emaLength2) "HMA" => ta.hma(MAsource, emaLength2) "CHANGE" => ta.change(MAsource, emaLength2) "CMO" => ta.cmo(MAsource, emaLength2) "COG" => ta.cog(MAsource, emaLength2) "DEV" => ta.dev(MAsource, emaLength2) "HIGHEST" => ta.highest(MAsource, emaLength2) "LOWEST" => ta.lowest(MAsource, emaLength2) "MEDIAN" => ta.median(MAsource, emaLength2) "MOM" => ta.mom(MAsource, emaLength2) "RANGE" => ta.range(MAsource, emaLength2) "STDEV" => ta.stdev(MAsource, emaLength2) "VARIANCE" => ta.variance(MAsource, emaLength2) // Default used when the three first cases do not match. => ta.wma(MAsource, emaLength2) ema200 = ta.sma(open, bigTrend_lenght) linecolor = (open > ema200) ? color.new(color.green, 50) : (open < ema200) ? color.new(color.red, 50) : na line200 = plot(enableEma200 ? ema200 : na, linewidth=4, title= "SMA 200", color=linecolor) //showLRplot = input.bool(title='Show LR line', defval=false, group='Appearance') showMA = input.bool(title='Show SMA', defval=true, group='Appearance') showBGcolor = true//input.bool(title='Show BG Color', defval=true, group='Appearance') showBGcolorSL = true//input.bool(title='Show SL Active Color', defval=true, group='Appearance') EMAfilter = ma > ma2 redBars = 1//input.int(title='Bars in Downtrend to sell', defval=1, minval= 0, group='Fine Tunning Settings (SELL)') d = ta.barssince(ta.crossunder(ma, ma2)) if ta.crossover(ma,ma2) d:=0 downStreak = redBars == d EMAbuy = ta.crossover(ma,ma2) line1 = plot(showMA ? ma : na, linewidth=2, color=color.new(color.yellow, 0)) line2 = plot(showMA ? ma2 : na, linewidth=2, color=color.new(color.blue, 0)) fill(line1, line2, color = ma > ma2 ? color.green : color.red, transp=85) //Opcional//plotshape(buy2, title= "Buy2", location=location.abovebar, color=color.blue, transp=0, style=shape.labelup) price = input.source(close, title= "Price source.", group='Fine Tunning Settings (SELL)') uptrend = price > ma downtrend = price < ma ////////LR cc(x) => x == 'Red' ? color.red : x == 'Lime' ? color.lime : x == 'Orange' ? color.orange : x == 'Teal' ? color.teal : x == 'Yellow' ? color.yellow : x == 'Black' ? color.black : color.white data(x) => ta.sma(request.security(syminfo.tickerid, mtf_val != '' ? mtf_val : timeframe.period, x), smoothing) linreg = data(ta.linreg(source, length, offset)) linreg_p = data(ta.linreg(source, length, offset + 1)) //plot(linreg, "Regression Line", cc(linreg>linreg[1]?p:q), editable=false) x = bar_index slope = linreg - linreg_p intercept = linreg - x * slope deviationSum = 0.0 for i = 0 to length - 1 by 1 deviationSum := deviationSum + math.pow(source[i] - (slope * (x - i) + intercept), 2) deviationSum deviation = math.sqrt(deviationSum / length) x1 = x - length x2 = x y1 = slope * (x - length) + intercept y2 = linreg updating = goto <= 0 or x < goto if updating line b = line.new(x1, y1, x2, y2, xloc.bar_index, extend.right, color.aqua, width=line_thick) line.delete(b[1]) line dp = line.new(x1, deviation * dev + y1, x2, deviation * dev + y2, xloc.bar_index, extend.right, cc(q), width=line_thick) line.delete(dp[1]) line dm = line.new(x1, -deviation * dev + y1, x2, -deviation * dev + y2, xloc.bar_index, extend.right, cc(p), width=line_thick) line.delete(dm[1]) dm_current = -deviation * dev + y2 dp_current = deviation * dev + y2 sellup = ta.crossover(price, dp_current) /////////////Trailing Take Profit //////////////////////////////SUPERTREND Periods = input.int(title="ATR Period", defval=10, group='SuperTrend Settings (BUY)') src2 = input(hl2, title="Source", group='SuperTrend Settings (BUY)') Multiplier = input.float(title="ATR Multiplier", step=0.1, defval=3.0, group='SuperTrend Settings (BUY)') changeATR= false//input.bool(title="Change ATR Calculation Method ?", defval=false, group='SuperTrend Settings (BUY)') //showsignals = input.bool(title="Show Buy/Sell Signals ?", defval=true) //highlighting = input.bool(title="Highlighter On/Off ?", defval=true, group='SuperTrend Settings') atr2 = ta.sma(ta.tr, Periods) atr= changeATR ? ta.atr(Periods) : atr2 up=src2-(Multiplier*atr) up1 = nz(up[1],up) up := close[1] > up1 ? math.max(up,up1) : up dn=src2+(Multiplier*atr) dn1 = nz(dn[1], dn) dn := close[1] < dn1 ? math.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 //showST = input.bool(title='Show Super Trend', defval=false, group='Appearance') upPlot = plot(showSTfilter and trend == 1 ? up : na, title="Up Trend", style=plot.style_linebr, linewidth=1, color=color.aqua) buySignal = trend == 1 and trend[1] == -1 //plotshape(buySignal ? up : na, title="UpTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0) //plotshape(buySignal and showsignals ? up : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0) dnPlot = plot(showSTfilter and trend != 1 ? dn : na, title="Down Trend", style=plot.style_linebr, linewidth=1, color=color.maroon) sellSignal = trend == -1 and trend[1] == 1 //plotshape(sellSignal ? dn : na, title="DownTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0) //plotshape(sellSignal and showsignals ? dn : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0) isup = trend == 1 ? up : na isdn = trend == 1 ? dn : na ////////////////////////////// mapositive = ma-ma2 > ma[1]-ma2[1] ////////////////////////////// ////////// buy = ((EMAfilter == false and ta.crossunder(price, dm_current) and isup) and mapositive) buy2 = open > ma2 and ma < ma2 if enableEma200 if showSTfilter == true buy := ta.crossunder(price, dm_current) and isup and mapositive and close > ema200 else buy := ta.crossunder(price, dm_current) and mapositive and close > ema200 else if showSTfilter == true buy := ta.crossunder(price, dm_current) and isup and mapositive else buy := ta.crossunder(price, dm_current) and mapositive var S_sell = false var S_buy = false buyalert = not S_sell and buy and EMAfilter and mapositive entry_price = ta.valuewhen(buyalert, close, 0) takePer = input.float(3.0, title='Take Profit %', group='Fine Tunning Settings (SELL)', tooltip="Green line") / 100 breakEven = input.float(1.5, title='Break Even % (<TP)', step= 0.1, group='Fine Tunning Settings (SELL)', tooltip="Put any value > to TP to disable it") / 100 longTake = entry_price * (1 + takePer) longBreakeven = entry_price * (1 + breakEven) TraditionalPer = input.float(3.0, title='Stop Loss %', group='Fine Tunning Settings (SELL)', tooltip="Red line") / 100 sl = entry_price * (1 - TraditionalPer) trailpoints = 0.00001 //input.float(title='Trail Points', defval=0.01, minval=0.0, maxval=2.0, step=0.01, group='Fine Tunning Settings (SELL)') //trailoffset = input.float(title='Trail Offset (0.01 = 1%)', defval=0.010, minval=0.0, maxval=2.0, step=0.005, group='Fine Tunning Settings (SELL)', tooltip = "Percentage for the trailing stop loss that is triggered once the TP is reached. Expressed in float for ease of calculation (0.01 = 1%).") trailloss = 0.01 //input.float(title='Trail loss', defval=0.01, minval=0.0, maxval=2.0, step=0.01, group='Fine Tunning Settings (SELL)') if showSTfilter == true buyalert := not S_sell and buy and EMAfilter and isup and mapositive and InSession(tradingSession) else buyalert := not S_sell and buy and EMAfilter and mapositive and InSession(tradingSession) //enterLong = input(title = 'Enter Long Command', defval="", group='Optional bot Command Settings {{strategy.order.comment}}', tooltip="Enter here the command provided by your preferred bot platform to enter long.") //exitLong = input(title= 'Exit Long Command', defval="", group='Optional bot Command Settings {{strategy.order.comment}}', tooltip="Enter here the command provided by your preferred bot platform to exit long.") plotshape(buy, title='buy', location=location.belowbar, color=color.new(color.yellow, 0), style=shape.triangleup) //plotshape(sellup, title='sellup', location=location.abovebar, color=color.new(color.orange, 0), style=shape.triangledown) var tradecloseprice = 0.0 if close > 0 and not S_buy tplabel = label.new(x=bar_index[0], y=high[0]+high[0]*0.02, color=color.gray, textcolor=color.white, style=label.style_label_down, text='Unr.PnL: ' + str.tostring(((close-tradecloseprice)/tradecloseprice)*100)+'%') //pnl = (((close-tradecloseprice)/tradecloseprice)*100) //totalPnl := totalPnl + pnl tplabel label.delete(tplabel[1]) if buyalert buylabel = label.new(x=bar_index, y=low[0] - low[0]*0.02, color=color.blue, textcolor=color.white, style=label.style_label_up, text='BUY :' + str.tostring(close)) buylabel if totalPnl == 0.0 hold := close //start := timestamp(timezone, year, month, day, hour, minute, second) //(((close-tradecloseprice)/tradecloseprice)*100) //entry_price := longTake := entry_price * (1 + takePer) longBreakeven = entry_price * (1 + breakEven) tradecloseprice := close S_sell := true S_buy := false sellTPalert = not S_buy and price >= longTake if sellTPalert tplabel = label.new(x=bar_index[0], y=high[0] + high[0] * 0.02, color=color.green, textcolor=color.white, style=label.style_label_down, text='TP P/L: ' + str.tostring(((close-tradecloseprice)/tradecloseprice)*100)+'%') pnl = (((close-tradecloseprice)/tradecloseprice)*100) totalPnl := totalPnl + pnl tplabel S_sell := false S_buy := true pnlPos := pnlPos + 1 totalTrades := totalTrades +1 sellBEalert = not S_buy and price >= longBreakeven and downtrend if sellBEalert belabel = label.new(x=bar_index, y=high[0] + high[0] * 0.02, color=color.orange, textcolor=color.white, style=label.style_label_down, text='BE P/L: ' + str.tostring(((close-tradecloseprice)/tradecloseprice)*100)+'%') pnl = (((close-tradecloseprice)/tradecloseprice)*100) totalPnl := totalPnl + pnl belabel S_sell := false S_buy := true pnlPos := pnlPos + 1 totalTrades := totalTrades +1 sellSLalert = not S_buy and price <= sl if sellSLalert sllabel = label.new(x=bar_index, y=low[0] - low[0]*0.02, color=color.red, textcolor=color.white, style=label.style_label_up, text='SL P/L: ' + str.tostring(((close-tradecloseprice)/tradecloseprice)*100)+'%') pnl = (((close-tradecloseprice)/tradecloseprice)*100) totalPnl := totalPnl + pnl sllabel S_sell := false S_buy := true pnlNeg := pnlNeg + 1 totalTrades := totalTrades +1 winratio = pnlPos/pnlNeg var pnlTable = table.new(position = position.top_right, columns = 4, rows = 4, border_color = color.white, border_width = 1) table.cell(table_id = pnlTable, column = 0, row = 0, bgcolor = color.gray, text_color = color.white, text = "Closed Trades") table.cell(table_id = pnlTable, column = 1, row = 0, bgcolor = color.gray, text_color = color.white, text = "Profit Factor") table.cell(table_id = pnlTable, column = 2, row = 0, bgcolor = color.gray, text_color = color.white, text = "Cumulative PnL") table.cell(table_id = pnlTable, column = 3, row = 0, bgcolor = color.gray, text_color = color.white, text = "Buy & Hold") table.cell(table_id = pnlTable, column = 0, row = 1, bgcolor = color.gray, text_color = color.white, text = str.tostring(totalTrades)) table.cell(table_id = pnlTable, column = 1, row = 1, bgcolor = color.gray, text_color = color.yellow, text = str.tostring(winratio)) table.cell(table_id = pnlTable, column = 2, row = 1, bgcolor = color.gray, text_color = color.white,text = str.tostring(totalPnl)+'%') table.cell(table_id = pnlTable, column = 3, row = 1, bgcolor = color.gray, text_color = color.yellow, text = str.tostring(byh)+'%') if totalPnl > 0 table.cell_set_bgcolor(pnlTable, column = 2, row = 1, bgcolor = color.green) else table.cell_set_bgcolor(pnlTable, column = 2, row = 1, bgcolor = color.red) if winratio > 1 table.cell_set_bgcolor(pnlTable, column = 1, row = 1, bgcolor = color.green) else table.cell_set_bgcolor(pnlTable, column = 1, row = 1, bgcolor = color.red) table.cell(table_id = pnlTable, column = 0, row = 2, bgcolor = color.blue, text_color = color.white, text = 'Fedra Algotrading Scripts') table.merge_cells(pnlTable, 0, 2, 3, 2) //table.cell(table_id = pnlTable, column = 0, row = 3, bgcolor = color.green, text_color = color.white, text = 'Support me in https://www.patreon.com/fedra_strategy') //table.merge_cells(pnlTable, 0, 3, 3, 3) //if byh > close // table.cell_set_bgcolor(pnlTable, column = 2, row = 1, bgcolor = color.green) //else // table.cell_set_bgcolor(pnlTable, column = 2, row = 1, bgcolor = color.red) //debuglabel = label.new(x=bar_index, y=low[0] - low[0]*0.02, color=color.red, textcolor=color.white, style=label.style_label_up, text='Win Ratio ' + str.tostring(winratio)+'%') //label.delete(debuglabel[1]) alertcondition(buyalert, title='BUY Alert') alertcondition(sellTPalert or sellBEalert, title='SELL Alert TP') alertcondition(sellBEalert or sellBEalert, title='SELL Alert BE') alertcondition(sellSLalert or sellBEalert, title='SELL Alert SL') plot(S_sell ? longTake : na, style=plot.style_linebr, color=color.new(color.green, 0), linewidth=1, title='Long Take Profit') plot(S_sell ? sl : na, style=plot.style_linebr, color=color.new(color.maroon, 0), linewidth=1, title='Long Take Profit') disclaimer = input.bool (defval = false, title = '🔥🔥This indicator is a simplified version of my automatic trading strategy for bots "Fedra Algotrading Strategy". In order to function as an indicator, several sacrifices had to be made: - No backtesting to optimize the parameters. -Cannot use the current price on each tick, so the calculations are made at the closing value of each candle and trailing take profit isnt possible. -Automation for automatic trading is limited. -It is not possible to take advantage of advanced risk management and capital management functions. If you are interested in more advanced versions, please check my other scripts..🔥🔥', tooltip = "Check out the advanced script 'Fedra Algotrading Strategy'")
Bias Pivot Point
https://www.tradingview.com/script/8300QEnE-Bias-Pivot-Point/
Botnet101
https://www.tradingview.com/u/Botnet101/
813
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/ // © Botnet101 //@version=5 indicator(title='Bias Pivot Point', overlay=true) // INPUTS //{ _timeframe = input.string(defval='3M' , title='Pivots Timeframe', options=['15', '30', '60', '240', 'D', 'W', 'M', '3M', '12M']) colourBars = input.bool (defval=false, title='Colour Bars?' , group="Plot Settings") showPivot = input.bool (defval=true , title='Show Pivot Points?', group="Plot Settings") fillPlot = input.bool (defval=true , title='Fill plot?' , group="Plot Settings") colour_bullish = input.color(defval=color.new(color.green, 70), title="Bullish", group="Colours") colour_bearish = input.color(defval=color.new(color.red , 70), title="Bearish", group="Colours") //} // FUNCTIONS //{ GetData(timeframe, data) => request.security(syminfo.tickerid, timeframe, data[1], lookahead=barmerge.lookahead_on) GetColour (canShow, _colour) => canShow ? _colour : na // Calculate Pivot Points CalculatPivotPoint () => float dailyHigh = GetData(_timeframe, high ) float dailyLow = GetData(_timeframe, low ) float dailyClose = GetData(_timeframe, close) (dailyHigh + dailyLow + dailyClose) / 3 //} float pivotPoint = CalculatPivotPoint () color bias_colour = close > pivotPoint ? colour_bullish : colour_bearish color cloud_colour = GetColour(fillPlot , bias_colour ) color pivotPoint_colour = GetColour(showPivot , color.new(bias_colour, 0)) color bar_colour = GetColour(colourBars, color.new(bias_colour, 0)) plot_close = plot(ohlc4 , title='Close', color=na , style=plot.style_stepline, editable=false ) plot_pivot = plot(pivotPoint, title='Pivot', color=pivotPoint_colour, style=plot.style_stepline, editable=true , linewidth=2) fill (plot_pivot, plot_close, color=cloud_colour, editable=false) barcolor(bar_colour , editable=false)
[Dipiers] Phoenix MTF v2.1
https://www.tradingview.com/script/4j1x9VAx-Dipiers-Phoenix-MTF-v2-1/
dipiers
https://www.tradingview.com/u/dipiers/
30
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(title='[Dipiers] Phoenix MTF v2.1', format=format.price, overlay=false, max_bars_back=5000) x1_resolution = input.timeframe(title='Chart TF', defval='', inline='1', group='Multi-TimeFrame') x2_resolution = input.timeframe(title='2nd TF', defval='60', inline='1', group='Multi-TimeFrame') x3_resolution = input.timeframe(title='3rd TF', defval='120', inline='2', group='Multi-TimeFrame') x4_resolution = input.timeframe(title='4th TF', defval='240', inline='2', group='Multi-TimeFrame') x5_resolution = input.timeframe(title='5th TF', defval='480', inline='3', group='Multi-TimeFrame') x6_resolution = input.timeframe(title='6th TF', defval='720', inline='3', group='Multi-TimeFrame') x7_resolution = input.timeframe(title='7th TF', defval='1D', inline='4', group='Multi-TimeFrame') x8_resolution = input.timeframe(title='8th TF', defval='2D', inline='4', group='Multi-TimeFrame') // --- Helper function for retrieving previous values in multi-timeframe --- lastSeriesValue(series) => series[ta.barssince(series > series[1] or series < series[1]) + 1] //------------------------------------------------------------------------------ //Multi Time Frames version of the Phoenix Ascending by WyckoffMode (https://www.tradingview.com/script/ay9QX4dy-Phoenix-Ascending-2-201/) //------------------------------------------------------------------------------ // Inputs { // Sources: src0 = open src1 = high src2 = low src3 = close src4 = hl2 src5 = hlc3 src6 = ohlc4 src7 = ta.tr vol = volume // Inputs: n1x = input.int(9, 'Phx master', inline='1', group='Phoenix') n2x = input.int(6, 'Phx time 1', inline='2', group='Phoenix') n3x = input.int(3, 'Phx time 2', inline='2', group='Phoenix') n4x = input.int(32, 'LSMA 1', inline='3', group='Phoenix') n5x = input.int(0, 'LSMA 1', inline='3', group='Phoenix') // } //----------------------------------------------------------------------------------------------------------------------------------------------------------------- tci(src) => ta.ema((src - ta.ema(src, n1x)) / (0.025 * ta.ema(math.abs(src - ta.ema(src, n1x)), n1x)), n2x) + 50 mfx(src, vol) => 100.0 - 100.0 / (1.0 + math.sum(vol * (ta.change(src) <= 0 ? 0 : src), n3x) / math.sum(vol * (ta.change(src) >= 0 ? 0 : src), n3x)) willy(src) => 60 * (src - ta.highest(src, n2x)) / (ta.highest(src, n2x) - ta.lowest(src, n2x)) + 80 tradition(src, vol) => math.avg(tci(src), mfx(src, vol), ta.rsi(src, n3x)) phoenix(_hlc3, vol) => // calculate phoneix indicator green = tradition(_hlc3, vol) red = ta.sma(green, 6) ext1 = red < 20 ? red + 5 : red > 80 ? red - 5 : na lsma = ta.linreg(green, n4x, n5x) energy = ta.ema((green - red) * 2 + 50, n3x) // get previous values last_green = lastSeriesValue(green) last_red = lastSeriesValue(red) last_lsma = lastSeriesValue(lsma) last_energy = lastSeriesValue(energy) // extract features // crosses green_red_crossing = ta.cross(green, red) green_lsma_crossing = ta.cross(green, lsma) red_lsma_crossing = ta.cross(red, lsma) // green green_rising = green > last_green green_falling = green < last_green // red red_rising = red > last_red red_falling = red < last_red // lsma lsma_rising = lsma > last_lsma lsma_falling = lsma < last_lsma // energy energy_rising = energy > last_energy energy_falling = energy < last_energy [green, red, lsma, energy, green_red_crossing, green_lsma_crossing, red_lsma_crossing, green_rising, green_falling, red_rising, red_falling, lsma_rising, lsma_falling, energy_rising, energy_falling] /////////////////////////////////////////////// Getting values - - - Coded by Neuromantic based on Dipiers indications [x1_green, x1_red, x1_lsma, x1_energy, x1_green_red_crossing, x1_green_lsma_crossing, x1_red_lsma_crossing, x1_green_rising, x1_green_falling, x1_red_rising, x1_red_falling, x1_lsma_rising, x1_lsma_falling, x1_energy_rising, x1_energy_falling] = request.security(syminfo.tickerid, x1_resolution, phoenix(hlc3[barstate.isrealtime ? 1 : 0], volume[barstate.isrealtime ? 1 : 0]), barmerge.gaps_off, barmerge.lookahead_off) [x2_green, x2_red, x2_lsma, x2_energy, x2_green_red_crossing, x2_green_lsma_crossing, x2_red_lsma_crossing, x2_green_rising, x2_green_falling, x2_red_rising, x2_red_falling, x2_lsma_rising, x2_lsma_falling, x2_energy_rising, x2_energy_falling] = request.security(syminfo.tickerid, x2_resolution, phoenix(hlc3[barstate.isrealtime ? 1 : 0], volume[barstate.isrealtime ? 1 : 0]), barmerge.gaps_off, barmerge.lookahead_off) [x3_green, x3_red, x3_lsma, x3_energy, x3_green_red_crossing, x3_green_lsma_crossing, x3_red_lsma_crossing, x3_green_rising, x3_green_falling, x3_red_rising, x3_red_falling, x3_lsma_rising, x3_lsma_falling, x3_energy_rising, x3_energy_falling] = request.security(syminfo.tickerid, x3_resolution, phoenix(hlc3[barstate.isrealtime ? 1 : 0], volume[barstate.isrealtime ? 1 : 0]), barmerge.gaps_off, barmerge.lookahead_off) [x4_green, x4_red, x4_lsma, x4_energy, x4_green_red_crossing, x4_green_lsma_crossing, x4_red_lsma_crossing, x4_green_rising, x4_green_falling, x4_red_rising, x4_red_falling, x4_lsma_rising, x4_lsma_falling, x4_energy_rising, x4_energy_falling] = request.security(syminfo.tickerid, x4_resolution, phoenix(hlc3[barstate.isrealtime ? 1 : 0], volume[barstate.isrealtime ? 1 : 0]), barmerge.gaps_off, barmerge.lookahead_off) [x5_green, x5_red, x5_lsma, x5_energy, x5_green_red_crossing, x5_green_lsma_crossing, x5_red_lsma_crossing, x5_green_rising, x5_green_falling, x5_red_rising, x5_red_falling, x5_lsma_rising, x5_lsma_falling, x5_energy_rising, x5_energy_falling] = request.security(syminfo.tickerid, x5_resolution, phoenix(hlc3[barstate.isrealtime ? 1 : 0], volume[barstate.isrealtime ? 1 : 0]), barmerge.gaps_off, barmerge.lookahead_off) [x6_green, x6_red, x6_lsma, x6_energy, x6_green_red_crossing, x6_green_lsma_crossing, x6_red_lsma_crossing, x6_green_rising, x6_green_falling, x6_red_rising, x6_red_falling, x6_lsma_rising, x6_lsma_falling, x6_energy_rising, x6_energy_falling] = request.security(syminfo.tickerid, x6_resolution, phoenix(hlc3[barstate.isrealtime ? 1 : 0], volume[barstate.isrealtime ? 1 : 0]), barmerge.gaps_off, barmerge.lookahead_off) [x7_green, x7_red, x7_lsma, x7_energy, x7_green_red_crossing, x7_green_lsma_crossing, x7_red_lsma_crossing, x7_green_rising, x7_green_falling, x7_red_rising, x7_red_falling, x7_lsma_rising, x7_lsma_falling, x7_energy_rising, x7_energy_falling] = request.security(syminfo.tickerid, x7_resolution, phoenix(hlc3[barstate.isrealtime ? 1 : 0], volume[barstate.isrealtime ? 1 : 0]), barmerge.gaps_off, barmerge.lookahead_off) [x8_green, x8_red, x8_lsma, x8_energy, x8_green_red_crossing, x8_green_lsma_crossing, x8_red_lsma_crossing, x8_green_rising, x8_green_falling, x8_red_rising, x8_red_falling, x8_lsma_rising, x8_lsma_falling, x8_energy_rising, x8_energy_falling] = request.security(syminfo.tickerid, x8_resolution, phoenix(hlc3[barstate.isrealtime ? 1 : 0], volume[barstate.isrealtime ? 1 : 0]), barmerge.gaps_off, barmerge.lookahead_off) ext1 = x1_red < 20 ? x1_red + 5 : x1_red > 80 ? x1_red - 5 : na ext2 = x2_red < 20 ? x2_red + 5 : x2_red > 80 ? x2_red - 5 : na ext3 = x3_red < 20 ? x3_red + 5 : x3_red > 80 ? x3_red - 5 : na ext4 = x4_red < 20 ? x4_red + 5 : x4_red > 80 ? x4_red - 5 : na ext5 = x5_red < 20 ? x5_red + 5 : x5_red > 80 ? x5_red - 5 : na ext6 = x6_red < 20 ? x6_red + 5 : x6_red > 80 ? x6_red - 5 : na ext7 = x7_red < 20 ? x7_red + 5 : x7_red > 80 ? x7_red - 5 : na ext8 = x8_red < 20 ? x8_red + 5 : x8_red > 80 ? x8_red - 5 : na ext1over = x1_red < 5 ? x1_red - 5 : x1_red > 95 ? x1_red + 5 : na ext2over = x2_red < 5 ? x2_red - 5 : x2_red > 95 ? x2_red + 5 : na ext3over = x3_red < 5 ? x3_red - 5 : x3_red > 95 ? x3_red + 5 : na ext4over = x4_red < 5 ? x4_red - 5 : x4_red > 95 ? x4_red + 5 : na ext5over = x5_red < 5 ? x5_red - 5 : x5_red > 95 ? x5_red + 5 : na ext6over = x6_red < 5 ? x6_red - 5 : x6_red > 95 ? x6_red + 5 : na ext7over = x7_red < 5 ? x7_red - 5 : x7_red > 95 ? x7_red + 5 : na ext8over = x8_red < 5 ? x8_red - 5 : x8_red > 95 ? x8_red + 5 : na //------------------------------------------------------------------------------ //Real Time plotting idea by HedgeMode - https://www.tradingview.com/u/HedgeMode/#published-charts //------------------------------------------------------------------------------ isBarConfirmed = barstate.isconfirmed plot_x1 = input.bool(false, title='Unplot Current TF Phoenix?', group='Plots') plot(plot_x1 ? na : x1_green, 'Curren Green Line', color = isBarConfirmed ? color.new(color.lime, 0) : color.new(color.lime, 50), linewidth=2) plot(plot_x1 ? na : x1_red, 'Current Red RSI', color=color.new(color.red, 0), linewidth=2) plot(plot_x1 ? na : x1_lsma, 'Current LSMA', color=color.new(color.blue, 0), linewidth=2) plot(plot_x1 ? na : x1_energy, 'Current Energy', color = isBarConfirmed ? color.new(color.white, 70) : color.new(color.white, 80), style=plot.style_area, histbase=50) plot(plot_x1 ? na : ext1 ? ext1 : na, 'Current Pressure', color=color.new(color.yellow, 0), style=plot.style_circles, linewidth=2) plot(plot_x1 ? na : ext1over ? ext1over : na, 'Current Pressure Over', color=color.new(color.red, 0), style=plot.style_circles, linewidth=2) plot_x2 = input.bool(true, title='Unplot x2 TF Phoenix?', group='Plots') plot(plot_x2 ? na : x2_green, '2nd Green Line', color=color.new(color.lime, 0), linewidth=2) plot(plot_x2 ? na : x2_red, '2nd Red RSI', color=color.new(color.red, 0), linewidth=2) plot(plot_x2 ? na : x2_lsma, '2nd LSMA', color=color.new(color.blue, 0), linewidth=2) plot(plot_x2 ? na : x2_energy, '2nd Energy', color = isBarConfirmed ? color.new(color.white, 70) : color.new(color.white, 80), style=plot.style_area, histbase=50) plot(plot_x2 ? na : ext2 ? ext2 : na, '2nd Pressure', color=color.new(color.yellow, 0), style=plot.style_circles, linewidth=2) plot(plot_x2 ? na : ext2over ? ext2over : na, '2nd Pressure Over', color=color.new(color.red, 0), style=plot.style_circles, linewidth=2) plot_x3 = input.bool(true, title='Unplot x3 TF Phoenix?', group='Plots') plot(plot_x3 ? na : x3_green, '3rd Green Line', color=color.new(color.lime, 0), linewidth=2) plot(plot_x3 ? na : x3_red, '3rd Red RSI', color=color.new(color.red, 0), linewidth=2) plot(plot_x3 ? na : x3_lsma, '3rd LSMA', color=color.new(color.blue, 0), linewidth=2) plot(plot_x3 ? na : x3_energy, '3rd Energy', color = isBarConfirmed ? color.new(color.white, 70) : color.new(color.white, 80), style=plot.style_area, histbase=50) plot(plot_x3 ? na : ext3 ? ext3 : na, '3rd Pressure', color=color.new(color.yellow, 0), style=plot.style_circles, linewidth=2) plot(plot_x3 ? na : ext3over ? ext3over : na, '3rd Pressure Over', color=color.new(color.red, 0), style=plot.style_circles, linewidth=2) plot_x4 = input.bool(true, title='Unplot x4 TF Phoenix?', group='Plots') plot(plot_x4 ? na : x4_green, '4th Green Line', color=color.new(color.lime, 0), linewidth=2) plot(plot_x4 ? na : x4_red, '4th Red RSI', color=color.new(color.red, 0), linewidth=2) plot(plot_x4 ? na : x4_lsma, '4th LSMA', color=color.new(color.blue, 0), linewidth=2) plot(plot_x4 ? na : x4_energy, '4th Energy', color = isBarConfirmed ? color.new(color.white, 70) : color.new(color.white, 80), style=plot.style_area, histbase=50) plot(plot_x4 ? na : ext4 ? ext4 : na, '4th Pressure', color=color.new(color.yellow, 0), style=plot.style_circles, linewidth=2) plot(plot_x4 ? na : ext4over ? ext4over : na, '4th Pressure Over', color=color.new(color.red, 0), style=plot.style_circles, linewidth=2) plot_x5 = input.bool(true, title='Unplot x5 TF Phoenix?', group='Plots') plot(plot_x5 ? na : x5_green, '5th Green Line', color=color.new(color.lime, 0), linewidth=2) plot(plot_x5 ? na : x5_red, '5th Red RSI', color=color.new(color.red, 0), linewidth=2) plot(plot_x5 ? na : x5_lsma, '5th LSMA', color=color.new(color.blue, 0), linewidth=2) plot(plot_x5 ? na : x5_energy, '5th Energy', color = isBarConfirmed ? color.new(color.white, 70) : color.new(color.white, 80), style=plot.style_area, histbase=50) plot(plot_x5 ? na : ext5 ? ext5 : na, '5th Pressure', color=color.new(color.yellow, 0), style=plot.style_circles, linewidth=2) plot(plot_x5 ? na : ext5over ? ext5over : na, '5th Pressure Over', color=color.new(color.red, 0), style=plot.style_circles, linewidth=2) plot_x6 = input.bool(true, title='Unplot x6 TF Phoenix?', group='Plots') plot(plot_x6 ? na : x6_green, '6th Green Line', color=color.new(color.lime, 0), linewidth=2) plot(plot_x6 ? na : x6_red, '6th Red RSI', color=color.new(color.red, 0), linewidth=2) plot(plot_x6 ? na : x6_lsma, '6th LSMA', color=color.new(color.blue, 0), linewidth=2) plot(plot_x6 ? na : x6_energy, '6th Energy', color = isBarConfirmed ? color.new(color.white, 70) : color.new(color.white, 80), style=plot.style_area, histbase=50) plot(plot_x6 ? na : ext6 ? ext6 : na, '6th Pressure', color=color.new(color.yellow, 0), style=plot.style_circles, linewidth=2) plot(plot_x6 ? na : ext6over ? ext6over : na, '6th Pressure Over', color=color.new(color.red, 0), style=plot.style_circles, linewidth=2) plot_x7 = input.bool(true, title='Unplot x7 TF Phoenix?', group='Plots') plot(plot_x7 ? na : x7_green, '7th Green Line', color=color.new(color.lime, 0), linewidth=2) plot(plot_x7 ? na : x7_red, '7th Red RSI', color=color.new(color.red, 0), linewidth=2) plot(plot_x7 ? na : x7_lsma, '7th LSMA', color=color.new(color.blue, 0), linewidth=2) plot(plot_x7 ? na : x7_energy, '7th Energy', color = isBarConfirmed ? color.new(color.white, 70) : color.new(color.white, 80), style=plot.style_area, histbase=50) plot(plot_x7 ? na : ext7 ? ext7 : na, '7th Pressure', color=color.new(color.yellow, 0), style=plot.style_circles, linewidth=2) plot(plot_x7 ? na : ext7over ? ext7over : na, '7th Pressure Over', color=color.new(color.red, 0), style=plot.style_circles, linewidth=2) plot_x8 = input.bool(true, title='Unplot x8 TF Phoenix?', group='Plots') plot(plot_x8 ? na : x8_green, '8th Green Line', color=color.new(color.lime, 0), linewidth=2) plot(plot_x8 ? na : x8_red, '8th Red RSI', color=color.new(color.red, 0), linewidth=2) plot(plot_x8 ? na : x8_lsma, '8th LSMA', color=color.new(color.blue, 0), linewidth=2) plot(plot_x8 ? na : x8_energy, '8th Energy', color = isBarConfirmed ? color.new(color.white, 70) : color.new(color.white, 80), style=plot.style_area, histbase=50) plot(plot_x8 ? na : ext8 ? ext8 : na, '8th Pressure', color=color.new(color.yellow, 0), style=plot.style_circles, linewidth=2) plot(plot_x8 ? na : ext8over ? ext8over : na, '8th Pressure Over', color=color.new(color.red, 0), style=plot.style_circles, linewidth=2) hline(110, color = color.new(color.red, 70), linewidth = 2, linestyle = hline.style_solid) hline(100, color = color.new(color.orange, 50), linewidth = 1, linestyle = hline.style_dotted) hline(90, color = color.new(color.aqua, 50), linewidth = 1, linestyle = hline.style_dotted) hline(80, color = color.new(color.white, 50), linewidth = 2, linestyle = hline.style_solid) hline(70, color = color.new(color.white, 50), linewidth = 1, linestyle = hline.style_dotted) hline(60, color = color.new(color.yellow, 50), linewidth = 1, linestyle = hline.style_dotted) hline(50, color = color.new(color.yellow, 30), linewidth = 2, linestyle = hline.style_solid) hline(40, color = color.new(color.yellow, 50), linewidth = 1, linestyle = hline.style_dotted) hline(30, color = color.new(color.white, 50), linewidth = 1, linestyle = hline.style_dotted) hline(20, color = color.new(color.white, 50), linewidth = 2, linestyle = hline.style_solid) hline(10, color = color.new(color.aqua, 50), linewidth = 1, linestyle = hline.style_dotted) hline(00, color = color.new(color.orange, 50), linewidth = 1, linestyle = hline.style_dotted) hline(-10, color = color.new(color.red, 70), linewidth = 2, linestyle = hline.style_solid)
BTC Cap Dominance RSI
https://www.tradingview.com/script/KfXF5iJd/
chanu_lev10k
https://www.tradingview.com/u/chanu_lev10k/
19
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © chanu_lev10k //@version=5 indicator("BTC Cap Dominance RSI") // Inputs src = input.source(title='Source', defval=close) res = input.timeframe(title='Resolution', defval='') len = input.int(defval=14, title='Length') isdomin = input.bool(title='Use Combination of Dominance RSI ?', defval=true) bullLevel = input.float(title='Bull Level', defval=63, step=1.0, maxval=100, minval=0) bearLevel = input.float(title='Bear Level', defval=35, step=1.0, maxval=100, minval=0) highlightBreakouts = input(title='Highlight Bull/Bear Breakouts ?', defval=true) // BTC Cap Dominance RSI Definition totalcap = request.security('CRYPTOCAP:TOTAL', res, src) altcoincap = request.security('CRYPTOCAP:TOTAL2', res, src) bitcoincap = totalcap - altcoincap dominance = bitcoincap / totalcap domin_f(res, len) => n = ta.rsi(bitcoincap, len) t = (ta.rsi(bitcoincap, len) + ta.rsi(dominance, len))/2 isdomin ? t : n tot_rsi = domin_f(res, len) // Plot rcColor = tot_rsi > bullLevel ? #0ebb23 : tot_rsi < bearLevel ? #ff0000 : #f4b77d maxBand = hline(100, title='Max Level', linestyle=hline.style_dotted, color=color.white) hline(0, title='Zero Level', linestyle=hline.style_dotted) minBand = hline(0, title='Min Level', linestyle=hline.style_dotted, color=color.white) bullBand = hline(bullLevel, title='Bull Level', linestyle=hline.style_dotted) bearBand = hline(bearLevel, title='Bear Level', linestyle=hline.style_dotted) fill(bullBand, bearBand, color=color.new(color.purple, 95)) bullFillColor = tot_rsi > bullLevel and highlightBreakouts ? color.green : na bearFillColor = tot_rsi < bearLevel and highlightBreakouts ? color.red : na fill(maxBand, bullBand, color=color.new(bullFillColor, 80)) fill(minBand, bearBand, color=color.new(bearFillColor, 80)) plot(tot_rsi, title='BTC Cap Dominance RSI', linewidth=2, color=rcColor) plot(ta.rsi(bitcoincap, len), title='BTC Cap RSI', linewidth=1, color=color.new(color.purple, 0)) plot(ta.rsi(dominance, len), title='BTC Dominance RSI', linewidth=1, color=color.new(color.blue, 0))
Supply & Demand
https://www.tradingview.com/script/V5WpHJdy-Supply-Demand/
frozon
https://www.tradingview.com/u/frozon/
567
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/ // © frozon // Updates: // - update screenshot // - update zone discovery //@version=4 study("Supply & Demand", overlay=true) srcH = input(high, title="Pivot High", inline="Pivot High") leftLenH = input(title="", type=input.integer, defval=2, minval=1, inline="Pivot High") rightLenH = input(title="/", type=input.integer, defval=1, minval=1, inline="Pivot High") srcL = input(low, title="Pivot Low ", inline="Pivot Low") leftLenL = input(title="", type=input.integer, defval=2, minval=1, inline="Pivot Low") rightLenL = input(title="/", type=input.integer, defval=1, minval=1, inline="Pivot Low") demandBoxColor = input(title="Demand box color", type=input.color, defval=color.rgb(120, 120, 120, 60)) supplyBoxColor = input(title="Supply box color", type=input.color, defval=color.rgb(120, 120, 120, 60)) f_boxExistsInArray(top, bottom, boxArr) => if array.size(boxArr) > 0 for i = 0 to array.size(boxArr) - 1 by 1 b = array.get(boxArr, i) boxTop = box.get_top(b) boxBot = box.get_bottom(array.get(boxArr, i)) if boxTop == top and boxBot == bottom true else false else false var box[] demandBoxes = array.new_box() var box[] supplyBoxes = array.new_box() var line[] testLine = array.new_line() ph = pivothigh(srcH, leftLenH, rightLenH) pl = pivotlow(srcL, leftLenL, rightLenL) pvtH = 0.0 pvtL = 0.0 pvtHIdx = 0 pvtLIdx = 0 pvtH := na(ph) ? pvtH[1] : ph pvtL := na(pl) ? pvtL[1] : pl pvtHIdx := na(ph) ? pvtHIdx[1] : bar_index pvtLIdx := na(pl) ? pvtLIdx[1] : bar_index // Check if we releasized an imbalanced if high[3] < low[1] // imbalanced up if pvtHIdx[3] < pvtLIdx[2] exists = f_boxExistsInArray(pvtH[3], pvtL[2], demandBoxes) if not exists array.push(demandBoxes, box.new(left=bar_index + 5, top=pvtH[3], right=bar_index + 20, bottom=pvtL[2], bgcolor=demandBoxColor, border_color=demandBoxColor)) if low[3] > high[1] // imbalanced down if pvtLIdx[3] < pvtHIdx[2] exists = f_boxExistsInArray(pvtH[3], pvtL[2], supplyBoxes) if not exists array.push(supplyBoxes, box.new(left=bar_index + 5, top=pvtH[2], right=bar_index + 20, bottom=pvtL[3], bgcolor=supplyBoxColor, border_color=supplyBoxColor)) if array.size(demandBoxes) > 0 for i = array.size(demandBoxes) - 1 to 0 by 1 dsBox = array.get(demandBoxes, i) top = box.get_top(dsBox) left = box.get_left(dsBox) if low <= top and left < bar_index box.delete(dsBox) array.remove(demandBoxes, i) if low > top box.set_right(dsBox, bar_index + 20) if array.size(supplyBoxes) > 0 for i = array.size(supplyBoxes) - 1 to 0 by 1 dsBox = array.get(supplyBoxes, i) bottom = box.get_bottom(dsBox) left = box.get_left(dsBox) if high >= bottom and left < bar_index box.delete(dsBox) array.remove(supplyBoxes, i) if high < bottom box.set_right(dsBox, bar_index + 20)
Financial Growth
https://www.tradingview.com/script/w5VmuuDA-Financial-Growth/
morzor61
https://www.tradingview.com/u/morzor61/
898
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/ // © morzor61 // ###### Revision Note ################################################################ // // 1. Released // 2. Add more items //--------------------------------------------------------------------------------------// // 3. 2022-Dec-17 : // - add 2 financial item. // - add, eps diluted. // - re-arrange code. //--------------------------------------------------------------------------------------// // 4. 2023-Jan-22 // - Add more items. // - re-arranged code. //@version=5 indicator("Financial Growth",overlay=false, format = format.volume) // TEXT SIZE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ text_size_AUTO = size.auto , 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 // TABLE POSITION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tb_pos_POS01 = position.top_left , tb_pos_POS02 = position.top_center tb_pos_POS03 = position.top_right , tb_pos_POS04 = position.middle_left tb_pos_POS05 = position.middle_center , tb_pos_POS06 = position.middle_right tb_pos_POS07 = position.bottom_left , tb_pos_POS08 = position.bottom_center tb_pos_POS09 = position.bottom_right // Financial Items +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Income Statement _revenue = "Revenue" ,_revenue_id = 'TOTAL_REVENUE' _net_income = "Net Income" ,_net_income_id = 'NET_INCOME' _ebitda = "EBITDA" ,_ebitda_id = "EBITDA" _eps = "EPS" ,_eps_id = "EARNINGS_PER_SHARE_BASIC" _eps_diluted = "EPS, Diluted" ,_eps_diluted_id = 'EARNINGS_PER_SHARE_DILUTED' _dvps = "Dividend per share" ,_dvps_id = 'DPS_COMMON_STOCK_PRIM_ISSUE' // Balance Sheet _total_asset = "Total Assets", _total_asset_id = "TOTAL_ASSETS" _total_liability = "Total Liabilities", _total_liability_id = "TOTAL_LIABILITIES" _total_debt = "Total Debt" ,_total_debt_id = 'TOTAL_DEBT' // Interest Bearing Debt _short_term_debt = "ST Debt", _short_term_debt_id = "SHORT_TERM_DEBT" _long_term_debt = "LT Debt", _long_term_debt_id = "LONG_TERM_DEBT" _net_debt = "Net Debt", _net_debt_id = "NET_DEBT" _interest_expense_on_debt = "Interest Expense", _interest_expense_on_debt_id = "INTEREST_EXPENSE_ON_DEBT" _total_euity = "Total Equity", _total_equity_id = "TOTAL_EQUITY" // Cash Flow _free_cash_flow = "Free Cash Flow" ,_free_cash_flow_id = 'FREE_CASH_FLOW' // Statistics and Ratios _de = "D/E", _de_id = "DEBT_TO_EQUITY" _interest_coverage = "Coverage Ratio", _interest_coverage_id = "INTERST_COVER" _gross_margin = "Gross Margin" ,_gross_margin_id = 'GROSS_MARGIN' _operating_margin = "Operating Margin" ,_operating_margin_id = "OPERATING_MARGIN" _ebitda_margin = "EBITDA Margin" ,_ebitda_margin_id = 'EBITDA_MARGIN' _net_margin = "Net Margin" ,_net_margin_id = 'NET_MARGIN' _roe = "ROE" ,_roe_id = 'RETURN_ON_EQUITY' _roa = "ROA" ,_roa_id = 'RETURN_ON_ASSETS' // Calculated Items _pbv = "P/BV" //,_pbv_id = 'BOOK_VALUE_PER_SHARE' _pe = "P/E" //,_pe_id = "P/E" // Calculated _ps = "P/S" //,_ps_id = "P/S" // Price to Sales Total outstanding share (FQ), * close / Total Revenue (TTM) _pfcf = "P/FCF" //,_pfcf_id = "P/FCF" // Price to Free Cash Flow, Total outstanding share (FQ) * close / Free Cash Flow (FQ) price_to_earning = close / request.financial(syminfo.tickerid, "EARNINGS_PER_SHARE_DILUTED",'TTM', ignore_invalid_symbol = true) price_to_book_value = close / request.financial(syminfo.tickerid, "BOOK_VALUE_PER_SHARE", 'FQ', ignore_invalid_symbol = true) price_to_sales = ( (request.financial(syminfo.tickerid, "TOTAL_SHARES_OUTSTANDING", "FQ", ignore_invalid_symbol = true ) * close) / request.financial(syminfo.tickerid, "TOTAL_REVENUE", "TTM", ignore_invalid_symbol = true ) ) price_to_free_cash_flow = ( (request.financial(syminfo.tickerid, "TOTAL_SHARES_OUTSTANDING", "FQ", ignore_invalid_symbol = true ) * close) / request.financial(syminfo.tickerid, "FREE_CASH_FLOW", "FQ", ignore_invalid_symbol = true ) ) published_date() => // Get published date of financial report _ticker = 'ESD_FACTSET:'+syminfo.prefix+';'+syminfo.ticker+';EARNINGS' published_date = request.security(_ticker, 'D',time,gaps=barmerge.gaps_on, ignore_invalid_symbol=true, lookahead=barmerge.lookahead_on) // 3. INPUT ============================================================================= group4 ='Input' group_item_01 = "Items" group_item_01_line_01 = "line 01" group_item_01_line_02 = "line 02" group_item_01_line_03 = "line 03" group_item_02 = "Group 02" financial_item_selection_01 = input.string( _revenue, "Item 1 / 2", options=[ "===== Income ======", _revenue,_net_income, _ebitda, _eps, _eps_diluted, _dvps, "== Balance Sheet ==", _total_asset, _total_liability, _total_debt, _net_debt, _long_term_debt, _short_term_debt, _interest_expense_on_debt , _total_euity, "==== Cash Flow ====", _free_cash_flow, "===== Margin =====", _gross_margin, _ebitda_margin, _operating_margin, _net_margin, "===== Ratio =====", _roe, _roa, _pbv, _pe, _ps, _pfcf, _de, _interest_coverage], inline = group_item_01_line_01, group = group_item_01) financial_item_selection_02 = input.string( _net_income, "", options=[ "===== Income ======", _revenue, _net_income, _ebitda, _eps, _eps_diluted, _dvps, "== Balance Sheet ==", _total_asset, _total_liability, _total_debt, _net_debt, _long_term_debt, _short_term_debt, _interest_expense_on_debt , _total_euity, "==== Cash Flow ====", _free_cash_flow, "===== Margin =====", _gross_margin, _ebitda_margin, _operating_margin, _net_margin, "===== Ratio =====", _roe, _roa, _pbv, _pe, _ps, _pfcf, _de, _interest_coverage ], inline = group_item_01_line_01, group = group_item_01 ) period_selection = input.string('FQ', 'Period / Number of Period', options=['FQ', 'FY', 'TTM'], inline = group_item_01_line_02, group=group_item_01) data_size_selection = input.int(4, '', minval = 4, inline = group_item_01_line_02, group=group_item_01) +5 // Future Plan // report_date = input.string(defval = "Period Ended", title = "Report Date", options = ["Period Ended", "Published Date"], inline = group_item_01_line_03, group = group_item_01) group_table_01 = 'Table' show_table = input.bool(true, 'Show Table', inline='01', group=group_table_01) is_qoq = input.bool(true, "Show QoQ", inline='02', group=group_table_01) is_yoy = input.bool(true, "Show YoY", inline='02', group=group_table_01) is_cagr = input.bool(false, "Show CAGR", inline='02', group=group_table_01) table_text_color = input.color(color.black, 'Text/BG/Head/Body', inline = group_table_01, group = group_table_01) table_bg_color = input.color(color.new(#979797, 0), '', inline = group_table_01, group = group_table_01) table_body_color = input.color(color.new(#fffffa, 0), '', inline = group_table_01, group = group_table_01) table_header_color= input.color(color.new(#f0af8a, 0), '', inline = group_table_01, group = group_table_01) table_text_size = input.string(text_size_NORMAL, 'Text Size/Postion', options=[text_size_AUTO, text_size_TINY, text_size_SMALL, text_size_NORMAL, text_size_LARGE, text_size_HUGE], inline='02', group=group_table_01) table_position_selection = input.string(tb_pos_POS09, '', options=[tb_pos_POS01,tb_pos_POS02, tb_pos_POS03, tb_pos_POS04, tb_pos_POS05, tb_pos_POS06, tb_pos_POS07, tb_pos_POS08, tb_pos_POS09], inline='02', group=group_table_01) group_plot_01 = "Plotting" group_plot_line_01 = "plotting line" show_plot = input.bool(false, "Show plot", inline = group_plot_01, group = group_plot_01) show_plot_label = input.bool(false, "Show plot labels", inline = group_plot_01, group = group_plot_01) label_text_color = input.color(color.new(color.black, 0), 'Text', inline=group_plot_line_01, group=group_plot_01) label_bg_color = input.color(color.new(color.aqua, 25), 'Bg Color', inline=group_plot_line_01, group=group_plot_01) // 2. FUNCTION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Function for Financial is_calculated_data(_financial_item)=> bool logic = (_financial_item == _pbv or _financial_item == _pe or _financial_item == _pfcf or _financial_item == _ps) get_financial_ratio(_financial_ratio)=> switch _financial_ratio _pe => price_to_earning _pbv => price_to_book_value _ps => price_to_sales _pfcf => price_to_free_cash_flow => na get_financial_id(_financial_item)=> // Get financial id from financial item switch _financial_item // income statement _revenue => _revenue_id _net_income => _net_income_id _ebitda => _ebitda_id _eps => _eps_id _eps_diluted => _eps_diluted_id _dvps => _dvps_id // balance sheet _total_asset =>_total_asset_id _total_liability =>_total_liability_id // Debt _total_debt =>_total_debt_id _long_term_debt => _long_term_debt_id _short_term_debt => _short_term_debt_id _net_debt => _net_debt_id _interest_expense_on_debt => _interest_expense_on_debt_id _total_euity =>_total_equity_id // cash flow _free_cash_flow =>_free_cash_flow_id // statistic and ratio _gross_margin =>_gross_margin_id _ebitda_margin =>_ebitda_margin_id _operating_margin => _operating_margin_id _net_margin =>_net_margin_id _roe =>_roe_id _roa =>_roa_id _de => _de_id _interest_coverage => _interest_coverage_id // _pbv =>_pbv_id // _pe =>_pe_id // _ps =>_ps_id // _pfcf =>_pfcf_id retreive_financial_data(_financial_item, _period)=> // Retreive financial data from finanancial id. // _id Financial id // _period period, FQ, FY, TTM _id = get_financial_id(_financial_item = _financial_item) financial_data = request.financial(syminfo.tickerid, _id, _period, barmerge.gaps_on, ignore_invalid_symbol = true) create_array(arrayId, val) => // Function to get financial data from TradingView. array.unshift(arrayId, val) // append value to an array array.pop(arrayId) // array.push(arrayId, val) // array.shift(arrayId) get_value_formating(_financial_item)=> // return format, divider and suffix of value. value_divider = 0 , value_decimal = "", value_suffix = "" is_true = ( _financial_item == _revenue or _financial_item ==_net_income or _financial_item == _ebitda or _financial_item == _free_cash_flow or _financial_item == _total_asset or _financial_item == _total_liability or // Debt _financial_item == _total_debt or _financial_item == _long_term_debt or _financial_item == _short_term_debt or _financial_item == _interest_expense_on_debt or _financial_item == _net_debt or _financial_item == _total_euity ) value_divider := is_true ? 1000000 : 1 value_suffix := is_true ? " M" : "" value_decimal := is_true ? "#,##0" : "#,##0.000" [value_divider, value_suffix, value_decimal] get_cagr(_data_array, _id, _idmax)=> // Get compound annual growth rate _current_value = array.get(_data_array, _id) _start_value = array.get(_data_array, _idmax) cagr = (math.pow((_current_value/math.abs(_start_value)), 1/_idmax)-1)*100 // Table ---------------------------------------------------------------------------- header_column( _table, _col, _row, _value) => table.cell(table_id = _table , column= _col , row= _row ,text = _value, text_color = table_text_color, text_size = table_text_size ,bgcolor = table_header_color) date_column( _table, _col, _row, _data_array, _id) => _date_value = str.format('{0, date, yyyy-MMM-dd}', array.get(_data_array, _id)) table.cell( table_id = _table, column = _col,row = _row, text = _date_value, text_color = table_text_color, text_size = table_text_size, bgcolor = table_body_color ) value_column( _table, _col, _row, _data_array, _id, _financial_item)=> [value_divider, value_suffix, value_decimal] = get_value_formating(_financial_item) val = array.get(_data_array, _id)/ value_divider table.cell(table_id= _table, column = _col, row = _row,text = str.tostring(val, value_decimal) + value_suffix, text_color = table_text_color, text_size = table_text_size, bgcolor = table_body_color) qoq_column( _table, _col, _row, _data_array, _id, _period)=> _compare = (_period == "FQ" or _period == "TTM") ? 1 : na _current_value = array.get(_data_array, _id), _previous_value = array.get(_data_array, _id+_compare) _different_value = ((_current_value-_previous_value)/ math.abs(_previous_value))*100 _symbol = _different_value >= 0 ? ' 😍' : ' 😡' _text = str.tostring(_different_value, '#,##0.0') + _symbol table.cell(table_id = _table, column = _col, row = _row,text = _text,text_halign = text.align_right,text_color = table_text_color,text_size = table_text_size, bgcolor = color.new(_different_value >= 0 ? color.green : color.red, 75)) yoy_column( _table, _col, _row, _data_array, _id, _period)=> _compare = (_period == "FQ" or _period == "TTM") ? 4 : 1 _current_value = array.get(_data_array, _id), _previous_value = array.get(_data_array, _id+_compare) _different_value = ((_current_value-_previous_value)/ math.abs(_previous_value))*100 _symbol = _different_value >= 0 ? ' 😍' : ' 😡' _text = str.tostring(_different_value, '#,##0.0') + _symbol table.cell( table_id = _table, column = _col, row = _row, text = _text, text_halign = text.align_right,text_color = table_text_color , text_size = table_text_size, bgcolor = color.new(_different_value >= 0 ? color.green : color.red, 75)) cagr_column( _table, _col, _row, _data_array, _id, _idmax)=> _value = get_cagr(_data_array, _id, _idmax) _symbol = _value >= 0 ? ' 😍' : ' 😡' _text = str.tostring(_value , '#,##0.0')+_symbol _bgcolor = color.new(_value >= 0 ? color.green : color.red, 75) table.cell( table_id = _table, column = _col, row = _row, text = _text, text_halign = text.align_right, text_color = table_text_color, text_size = table_text_size, bgcolor = _bgcolor) // // 4. Calculation ======================================================================= reference_revenue = request.financial(symbol = syminfo.tickerid, financial_id = 'TOTAL_REVENUE', period= period_selection, gaps= barmerge.gaps_on, ignore_invalid_symbol =true ) temp_financial_data_01 = retreive_financial_data(_financial_item = financial_item_selection_01, _period = period_selection) temp_financial_data_02 = retreive_financial_data(_financial_item = financial_item_selection_02, _period = period_selection) financial_data_01 = is_calculated_data(financial_item_selection_01) ? get_financial_ratio(financial_item_selection_01) : temp_financial_data_01 financial_data_02 = is_calculated_data(financial_item_selection_02) ? get_financial_ratio(financial_item_selection_02) : temp_financial_data_02 var date_array = array.new_int( data_size_selection) // Date var financial_data_array = array.new_float( data_size_selection) // EPS var financial_data_array_02 = array.new_float( data_size_selection) // EPS if reference_revenue create_array(date_array, time) create_array(financial_data_array, financial_data_01) create_array(financial_data_array_02, financial_data_02) // 5. TABLE ================================================================================ var table t = table.new( position = table_position_selection, columns = 10, rows = data_size_selection, bgcolor = table_bg_color, frame_color = color.rgb(156, 156, 156), frame_width = 2, border_color = color.rgb(229, 226, 229), border_width = 1 ) // Show & Hide Column bool qoq_column = (period_selection == "FQ" or period_selection == "TTM" ) and is_qoq bool yoy_column = (period_selection == "FQ" or period_selection == "TTM" or period_selection == "FY") and is_yoy bool cagr_column = (period_selection == "FY" or period_selection == "TTM") and is_cagr if barstate.islast and show_table period_header = period_selection == "FY" ? "Year" : "Quarter" header_column(_table = t, _col = 0, _row = 0, _value = period_header ) header_column(_table = t, _col = 1, _row = 0, _value = financial_item_selection_01 ) header_column(_table = t, _col = 5, _row = 0, _value = financial_item_selection_02 ) if qoq_column header_column(_table = t, _col = 2,_row = 0, _value = "QoQ") header_column(_table = t, _col = 6,_row = 0, _value = "QoQ") if yoy_column header_column(_table = t, _col = 3,_row = 0,_value = 'YoY') header_column(_table = t, _col = 7,_row = 0,_value = 'YoY') if cagr_column header_column(_table = t, _col = 4,_row = 0,_value = 'CAGR') header_column(_table = t, _col = 8,_row = 0,_value = 'CAGR') for _irow = 0 to data_size_selection - 5 if barstate.islast and show_table date_column( _table = t,_col = 0 ,_row = _irow + 1, _data_array = date_array, _id = _irow) value_column(_table = t,_col = 1 ,_row = _irow + 1, _data_array = financial_data_array, _id = _irow, _financial_item = financial_item_selection_01) value_column(_table = t,_col = 5 ,_row = _irow + 1, _data_array = financial_data_array_02,_id = _irow, _financial_item = financial_item_selection_02) if qoq_column qoq_column(_table = t,_col = 2,_row = _irow+1,_data_array = financial_data_array, _id = _irow, _period = period_selection) qoq_column(_table = t,_col = 6,_row = _irow+1,_data_array = financial_data_array_02,_id = _irow, _period = period_selection) if yoy_column yoy_column(_table = t, _col = 3, _row = _irow+1,_data_array = financial_data_array,_id = _irow, _period = period_selection) yoy_column(_table = t,_col = 7,_row = _irow+1,_data_array = financial_data_array_02,_id = _irow,_period = period_selection) if cagr_column cagr_column(_table = t,_col = 4,_row = _irow+1,_data_array = financial_data_array,_id = _irow,_idmax = data_size_selection-5 ) cagr_column(_table = t,_col = 8,_row = _irow+1,_data_array = financial_data_array_02,_id = _irow,_idmax = data_size_selection-5 ) // Ploting ========================================================================================================// plot_data_01 = show_plot ? financial_data_01 : na plot_data_02 = show_plot ? financial_data_02 : na plot(plot_data_01, "Plot 01", style = plot.style_circles, linewidth = 2, join = true, color = color.rgb(255, 2, 158)) plot(plot_data_02, "Plot 02", style = plot.style_circles, linewidth = 2, join = true, color = color.rgb(25, 0, 255)) // Labels if show_plot and show_plot_label and reference_revenue [val_divide, val_suffix, val_decimal] = get_value_formating(financial_item_selection_01) label_01 = label.new( x = bar_index, y = plot_data_01, text = str.tostring(plot_data_01/val_divide, val_decimal + val_suffix) , color = label_bg_color , textcolor = label_text_color) [val_divide2, val_suffix2, val_decimal2] = get_value_formating(financial_item_selection_02) label_02 = label.new( x = bar_index,y = plot_data_02, text = str.tostring(plot_data_02/val_divide2, val_decimal2+val_suffix2) , color = label_bg_color , textcolor = label_text_color)
Trapezoidal Weighted Moving Average and Bollinger Bands
https://www.tradingview.com/script/1VlB1g94-Trapezoidal-Weighted-Moving-Average-and-Bollinger-Bands/
rumpypumpydumpy
https://www.tradingview.com/u/rumpypumpydumpy/
143
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/ // © rumpypumpydumpy //@version=5 indicator("Trapezoidal Weighted Moving Average and Bollinger Bands", shorttitle = "TWMA+BB", overlay = true, timeframe = "", timeframe_gaps = true) len = input.int(100, title = "Length") src = input.source(close, title = "source") perc = input.float(15, title = "Weighted percentage", minval = 0, maxval = 50, tooltip = "Percentage of values to linearly weight at the beginning and the end of the rolling window") / 100 stdev_mult = input.float(2.000, title = "stdev mult") var float[] price_vals = array.new_float() var float[] weights = array.new_float(len) var float factor = 1 / (len * perc) var int linear_len = math.floor(len * perc) if barstate.isfirst for i = 0 to linear_len - 1 weight = factor * (i + 1) array.set(weights, i, weight) array.set(weights, len - 1 - i, (i + 1) * factor) for i = linear_len to len - linear_len - 1 array.set(weights, i, 1) array.unshift(price_vals, src) if array.size(price_vals) > len array.pop(price_vals) float wtd_sum = 0.0 float denom = 0.0 float twma = na float stdev = na if bar_index >= len - 1 for i = 0 to len - 1 weight = array.get(weights, i) wtd_sum += array.get(price_vals, i) * weight denom += weight twma := wtd_sum / denom float err_sum = 0.0 for j = 0 to len - 1 err_sum += math.pow(twma - array.get(price_vals, j), 2) * array.get(weights, j) stdev := math.sqrt(err_sum / denom) up = twma + stdev_mult * stdev dn = twma - stdev_mult * stdev plot(twma, title = "TWMA") plot(up, title = "TWMA : Upper BB") plot(dn, title = "TWMA : Lower BB")
Candles HTF on Heikin Ashi Chart
https://www.tradingview.com/script/nyKQ1TOA-Candles-HTF-on-Heikin-Ashi-Chart/
allanster
https://www.tradingview.com/u/allanster/
221
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/ // © allanster //@version=5 indicator(title = "Candles HTF on Heikin Ashi Chart", overlay = false) // This script enables calling and/or plotting of traditional Candles sources while loaded on Heikin Ashi charts. // Thanks to @PineCoders for rounding method: https://www.pinecoders.com/faq_and_code/#how-can-i-round-to-ticks // Thanks to @BeeHolder for method to regex normalize syminfo.tickerid. // NOTICE: While this script is meant to be utilized on Heikin Ashi charts it does NOT enable ability to backtest! // NOTICE: For more info on why non standard charts cannot be reliably backtested please see: // https://www.tradingview.com/script/q9laJNG9-Backtesting-on-Non-Standard-Charts-Caution-PineCoders-FAQ/ // === INPUTS === resHTF = input.timeframe(defval = '', title = "HTF Resolution", tooltip = "Only use with timeframes >= current period.") rpmHTF = input.string (defval = '🔮 Live (Repaints)', title = "HTF Uses Mode", options = ['🔮 Live (Repaints)', '✅ Safe (Lag1Look)'], tooltip = "IMPORTANT: When using Higher Timeframe with alerts or strategies do NOT choose '🔮 Live (Repaints)' else script behavior will not be reliable!") // === CANDLES === src(_src) => Close = close, Open = open, High = high, Low = low, HL2 = hl2, HLC3 = hlc3, HLCC4 = hlcc4, OHLC4 = ohlc4 Price = _src == 'close' ? Close : _src == 'open' ? Open : _src == 'high' ? High : _src == 'low' ? Low : _src == 'hl2' ? HL2 : _src == 'hlc3' ? HLC3 : _src == 'hlcc4' ? HLC3 : OHLC4 Source = math.round(Price / syminfo.mintick) * syminfo.mintick // PineCoders method for aligning Pine prices with chart instrument prices // === HTF === tickerID = str.match(syminfo.tickerid, "\\w+:\\w+") // BeeHolder method to normalize "blah syminfo.tickerid blah" -> "syminfo.tickerid" htf(_i) => [src('open')[_i], src('high')[_i], src('low')[_i], src('close')[_i]] // function create tuples [OrpY,HrpY,LrpY,CrpY] = request.security(tickerID, resHTF, htf(0)) // declare called htf 'Live (Repaints)' tuples [OrpN,HrpN,LrpN,CrpN] = request.security(tickerID, resHTF, htf(1), lookahead = barmerge.lookahead_on) // declare called htf 'Safe (Lag1Look)' tuples // NOTICE: For HTF with alerts or strategies ONLY use i = 1 ^ & lookahead = barmerge.lookahead_on else script behavior will not be reliable! // === PLOTTING === preEvalO = rpmHTF == '🔮 Live (Repaints)' ? OrpY : OrpN // pre-Evaluate! preEvalH = rpmHTF == '🔮 Live (Repaints)' ? HrpY : HrpN // pre-Evaluate! preEvalL = rpmHTF == '🔮 Live (Repaints)' ? LrpY : LrpN // pre-Evaluate! preEvalC = rpmHTF == '🔮 Live (Repaints)' ? CrpY : CrpN // pre-Evaluate! barColor = preEvalC > preEvalO ? #26a69a : #ef5350 // series color plotcandle(preEvalO, preEvalH, preEvalL, preEvalC, title = "", color = barColor, wickcolor = barColor, bordercolor = barColor) // plot candles
Wave Chart v1
https://www.tradingview.com/script/ynimQMf7/
Asano_Voyl
https://www.tradingview.com/u/Asano_Voyl/
83
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/ // © MNR_Anas //@version=5 indicator("Wavechart v1", overlay=true ,max_lines_count=500,max_bars_back=5000) ////input bars = input.int(7, minval=1, title="bars") //range to plot in the graph linecolor=input.color(color.red,title="line Color") bar_shift=input.int(0, title="bars_shift") //Shift the bar that command to plot bg=input.bool(false,title="highlight the bar that runs to plot") //highlight the bar that runs to plot showmessagebox=input.bool(true,title="Show MessageBox") ///// bars_calc=(bar_index+bar_shift)%bars+1 hbar=ta.highestbars(bars_calc) //bar that highest in range lbar=ta.lowestbars(bars_calc) //bar that lowest in range whigh=high[-hbar] //value of height from habr wlow=low[-lbar] //value of low from lbar var vx1=0, vx2=0 var px=0 //Previous x var py=0.0 //Provious y var vy1=0.0 var vy2=0.0 if(bars_calc==bars) //Runs only when it's the last bar in the range. if(hbar<lbar) //If the highest point comes before the lowest point vx1:=bar_index[-hbar] vy1:=whigh vx2:=bar_index[-lbar] vy2:=wlow else //If the Lowestest point comes before the lowest point vx1:=bar_index[-lbar] vy1:=wlow vx2:=bar_index[-hbar] vy2:=whigh if(px!=0 and py!=0) line.new(x1=px, y1=py, x2=vx1, y2=vy1,color=linecolor,width=2) //line between previous points line.new(x1=vx1, y1=vy1, x2=vx2, y2=vy2,color=linecolor,width=2) //line between highest to lowest in range //remember last point px:=vx2 py:=vy2 bgcolor(bg? bars_calc==bars? (color.new(color.gray,70) ) :na:na ) //highlight the bar that runs to plot // Message Box if(showmessagebox) statusText = "This indicator has a mistake\nPlease use the new version (wavechart V2)" text_location = 0.0 l = label.new(bar_index,na) //label.new(bar_index, na) label.set_text(l, statusText) label.set_y(l,high) boxColor = color.lime label.set_color(l, color.red) label.set_size(l,size.huge) label.delete(l[1])
Neowave chart cash data
https://www.tradingview.com/script/oRYLIOrO-Neowave-chart-cash-data/
jakklosi12
https://www.tradingview.com/u/jakklosi12/
87
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/ // © jakklosi12 //@version=4 study(title="Neowave chart", overlay=true, max_lines_count = 500) //Define variables string res = input("D") var float h_price = na var float l_price = na var int h_date = na var int l_date = na var float h1_price = na var float l1_price = na var int h1_date = na var int l1_date = na var line z = na var line w = na bool isnewtbar = change(time(res)) > 0 //getting lines if isnewtbar and bar_index > 1 h_price := high l_price := low h_date := time l_date := time z := line.new(x1=h_date, y1=h_price, x2=l_date, y2=l_price, xloc=xloc.bar_time, extend=extend.none, color=color.black, style=line.style_solid, width=2) w := line.new(x1=line.get_x2(z[1]), y1=line.get_y2(z[1]), x2=l_date, y2=l_price, xloc=xloc.bar_time, extend=extend.none, color=color.black, style=line.style_solid, width=2) if high > h_price h_price := high h_date := time if low < l_price l_price := low l_date := time if h_date <= l_date // low to high line.set_xy1(id=z, x=h_date, y=h_price) line.set_xy2(id=z, x=l_date, y=l_price) line.set_color(id=z, color=color.red) else // high to low line.set_xy1(id=z, x=l_date, y=l_price) line.set_xy2(id=z, x=h_date, y=h_price) line.set_color(id=z, color=color.lime) line.set_xy2(id=w, x=line.get_x1(z[0]), y=line.get_y1(z[0])) line.set_color(id=w, color=color.blue) // if isnewtbar and bar_index > 1 // h1_price := high[1] // l1_price := low[1] // h1_date := time // l1_date := time // if h1_date <= l1_date and h_date <= l_date // line.set_xy1(id =z, x = l1_date,y=l1_price) // line.set_xy2(id =z, x = h_date,y=h_price) // line.set_color(id=z, color=color.green)
SonicR PVA Volumes
https://www.tradingview.com/script/fFxNaJ1l-SonicR-PVA-Volumes/
crypteisfuture
https://www.tradingview.com/u/crypteisfuture/
82
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/ // © crypteisfuture //@version=5 indicator("Sonic PVA Volumes") neutralColor = color.gray risingBullColor = color.green risingBearColor = color.red climaxBullColor = color.blue climaxBearColor = color.maroon PVA_Climax_Period = input(14, title='Climax Period') PVA_Rising_Factor = input.float(1.61, title='Rising Factor') PVA_Extreme_Factor = input.float(4, title='Extreme Factor') // Normalize volume for Forex and Crypto markets normalized_volume = volume / 1000 ma_volume = ta.sma(normalized_volume, PVA_Climax_Period) _color = neutralColor if normalized_volume >= ma_volume * PVA_Rising_Factor _color := close > open ? risingBullColor : risingBearColor _color range_1 = (high - low) * normalized_volume maxRange = math.max(range_1[PVA_Climax_Period], range_1[1]) if range_1 >= maxRange or normalized_volume >= ma_volume * PVA_Extreme_Factor _color := close > open ? climaxBullColor : climaxBearColor _color plot(range_1, color=_color, style=plot.style_columns) strongBullVolume = _color == climaxBullColor strongBearVolume = _color == climaxBearColor standartBullVolume = _color == risingBullColor standartBearVolume = _color == risingBearColor alertcondition(strongBullVolume, title = 'Strong Bull Volume!', message = 'Strong Bull Volume!') alertcondition(strongBearVolume, title = 'Strong Bear Volume!', message = 'Strong Bear Volume!') alertcondition(standartBullVolume, title = 'Standart Bull Volume!', message = 'Standart Bull Volume!') alertcondition(standartBearVolume, title = 'Standart Bear Volume!', message = 'Standart Bear Volume!')
Normalized LWMA Slope
https://www.tradingview.com/script/65sUYfZF-Normalized-LWMA-Slope/
crypteisfuture
https://www.tradingview.com/u/crypteisfuture/
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/ // © crypteisfuture //@version=5 indicator("Normalized LWMA Slope") //credits to : @io72signals for lwma function get_lwma(src,period, weight) => price = src sub = (weight/period)-1 float p = na float d = na float sum = 0 float divider = 0 for i = 0 to period-1 p := price[i] * ((weight-i)-sub) d := (weight-i)-sub sum := sum + p divider := divider + d sum / divider source = input.source(close) atr_len = input.int(14) atr_ = ta.atr(atr_len) lwma_length = input.int(12) lwma_weight = input.int(2) lwma_ = get_lwma(source, lwma_length, lwma_weight) // <start> logic from https://fxcodebase.com/code/viewtopic.php?f=17&t=62214 lwma = (lwma_ - lwma_[1]) / atr_ color_ = lwma > 0 ? lwma > lwma[1] ? color.new(color.lime, 0) : color.new(color.red, 0) : lwma > lwma[1] ? color.new(color.green, 0) : color.new(color.maroon, 0) cond_ = lwma > 0 ? lwma > lwma[1] ? 2 : -1 : lwma > lwma[1] ? 1 : -2 plot(lwma, color = color_, style = plot.style_histogram) // <end> logic from https://fxcodebase.com/code/viewtopic.php?f=17&t=62214 alertcondition(cond_ == 2, title = 'Strong Buy!', message = 'Strong Buy!') alertcondition(cond_ == 1, title = 'Simple Buy!', message = 'Simple Buy!') alertcondition(cond_ == -2, title = 'Strong Buy!', message = 'Strong Sell!') alertcondition(cond_ == -1, title = 'Simple Buy!', message = 'Simple Sell!')
SARC
https://www.tradingview.com/script/y1zniXNH-SARC/
Sultan_shaya
https://www.tradingview.com/u/Sultan_shaya/
41
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Sultan_shaya //@version=5 indicator("SARC", overlay = true, max_bars_back=5000) //SCR = Sultan Asset Correlation - Candles //-------------------------------------------------------------------------------------------- Maxbar = input(defval=1000, title='Max LookBack length?') Correlation_factor = input.int(defval=30, title='Correlation Factor') SC = input.symbol('BTCUSDT', title='Base Asset') Show_Correlation = input(defval=false, title='Show Correlation Candles') f() => [open, close] [SC_O, SC_C] = request.security(SC, timeframe.period, f()) //CC = Second Chart First_bar = Maxbar if (math.abs(ta.barssince(barstate.isfirst)) < Maxbar) First_bar := math.abs(ta.barssince(barstate.isfirst)) //-------------------------------------------------------------------------------------------- prcentage(O, C) => //O = Candle Open //C = Candle Close (C - O) / (O / 100) Correlation(C1O, C1C, C2O, C2C) => //C1O = Candle 1 Open //C1C = Candle 1 Close FP = prcentage(C1O, C1C) //FP = First candle Precentage SP = prcentage(C2O, C2C) //SP = Second candle Precentage float R = (SP/FP)*100 R Change_Source(B_O,B_C,B_O1,B_C1,B_O2,B_C2,O,C,O1,C1,O2,C2) => if (((B_O<B_C) and (B_O1<B_C1) and (B_O2>B_C2)) and ((O<C) and (O1<C1) and (O2<C2))) or (((B_O>B_C) or (B_O1>B_C1) and (B_O2<B_C2)) and ((O>C) and (O1>C1) and (O2>C2))) [true,false] //[Current_follow_base, Base_follow_current] else if (((B_O<B_C) and (B_O1<B_C1) and (B_O2<B_C2)) and ((O<C) and (O1<C1) and (O2>C2))) or (((B_O>B_C) or (B_O1>B_C1) and (B_O2>B_C2)) and ((O>C) and (O1>C1) and (O2<C2))) [false,true] else [false,false] //-------------------------------------------------------------------------------------------- if barstate.islast direct = 0 inverse = 0 Current_follow_Base = 0 Base_follow_Current = 0 BFCBFC = 0 for i = 0 to First_bar by 1 if close[i] == na break else //------------------------------------------------------------------- //------------------------------------------------------------------- Res = Correlation(SC_O[i+1], SC_C[i+1], open[i+1], close[i+1]) // Resistence calculation if (Res >= Correlation_factor) // If candles are opposite add to counter direct += 1 else if (Res <= -Correlation_factor) // If candles have correlation, add to counter and check which one follows the other inverse += 1 if ( Correlation(SC_O[i+2], SC_C[i+2], open[i+2], close[i+2]) > 30) and ( Correlation(SC_O[i+3], SC_C[i+3], open[i+3], close[i+3]) > 30) [CFB,BFC] = Change_Source(SC_O[i+3], SC_C[i+3],SC_O[i+2], SC_C[i+2],SC_O[i+1], SC_C[i+1],open[i+3], close[i+3],open[i+2], close[i+2],open[i+1], close[i+1]) if BFC BFCBFC += 1 if ( Correlation(SC_O[i+1], SC_C[i+1], open[i], close[i]) > 0) and CFB Current_follow_Base += 1 if Show_Correlation line.new(bar_index[i+1],high[i+1],bar_index[i+1],high[i+1]*5,color = color.green, width = 5) else if ( Correlation(SC_O[i], SC_C[i], open[i+1], close[i+1]) > 0) and BFC Base_follow_Current += 1 if Show_Correlation line.new(bar_index[i+1],high[i+1],bar_index[i+1],high[i+1]*5,color = color.red, width = 5) TextBoxs = str.tostring(math.round(Res,2)) //------------------------------------------------------------------- //------------------------------------------------------------------- Last_Cor = Correlation(SC_O, SC_C, open, close) if (Last_Cor >= 30) direct += 1 else inverse += 1 output = "No Correlation Found" //Preparing final result Correlation_precentage = 0 if ((direct*(3/5))>=inverse) Correlation_precentage := (direct/First_bar)*100 output := "Direct Correlation"+"\nCorrelation Precentage : "+str.tostring(math.round(Correlation_precentage))+"%" if ((Current_follow_Base*(3/5))>=Base_follow_Current) output += "\nCurrent Asset Follows Base" else if ((Base_follow_Current*(3/5))>=Current_follow_Base) output += "\nBase Follows Current Asset" else if ((inverse*(2/3))>=direct) Correlation_precentage := (inverse/First_bar)*100 output := "Inverse Correlation"+"\nCorrelation Precentage : "+str.tostring(math.round(Correlation_precentage))+"%" TextBox = output label.new(bar_index, high+high/20, text=TextBox, textcolor=color.black, size=size.huge, color=color.silver)
Relative Standard Deviation
https://www.tradingview.com/script/RMjmmLwP-Relative-Standard-Deviation/
TradeAutomation
https://www.tradingview.com/u/TradeAutomation/
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/ // @version = 5 // Author = TradeAutomation indicator("Relative Standard Deviation", shorttitle="Relative Standard Deviation") // Calculation Inputs // MALength = input.int(200, "MA Length", tooltip="This is the length of the moving average that you are measuring Standard Deviation against.") DeviationLength = input.int(200, title="Deviation Lookback Length", tooltip="This is the amount of bars back that you using to measure Standard Deviation against the mean.") Source = input.source(title="Source", defval=close) // Population Standard Deviation Calcualtion // Mean = ta.sma(Source, MALength) StdDev = math.sqrt(ta.sma(math.pow(Source-Mean, 2), DeviationLength)) // Relative Calculation // RelativeStdDev = (StdDev/Source)*100 // Visualization Features // PlotRelStdDevInput = input.bool(true, "Plot Relative Standard Deviation?", tooltip="Blue - This is the Standard Deviation converted to a percentage that is relative to the current instrument's price, as a whole number. I.e. 11 = 11%") PlotStdDevInput = input.bool(false, "Plot Population Standard Deviation?", tooltip="Purple - This is the traditional calculation for Population Standard Deviation.") PlotHLineInput = input.bool(false, "Plot Custom Fixed Line?", tooltip="Gray - This is just a feature to make indicators easier to read (I.e. If you want to be able to easily tell if a value is over/under a custom value).") HLine = input.float(5, "Custom Fixed Line Value") RelStdDevPlot = PlotRelStdDevInput == true ? RelativeStdDev : na StdDevPlot = PlotStdDevInput == true ? StdDev : na HlinePlot = PlotHLineInput == true ? HLine : na plot(RelStdDevPlot, color=color.blue) plot(StdDevPlot, color=color.purple) hline(HlinePlot, color=color.gray)
JPM VIX Signal - Non Overlay
https://www.tradingview.com/script/4JYvnzhJ-JPM-VIX-Signal-Non-Overlay/
TsangYouJun
https://www.tradingview.com/u/TsangYouJun/
57
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/ // © TsangYouJun, Richard //@version=5 // Note: // The buy signal is triggered when the Cboe Volatility Index (VIX) rises by more than 50% of its 1-month moving average. // Use on SPY, Daily only indicator("JPM VIX Signal - Non Overlay", overlay = false) close_vs_1month_ma = (close / ta.sma(close, 30)) vix_close_vs_1month_ma = request.security("CBOE:VIX", "D", close_vs_1month_ma) plot(vix_close_vs_1month_ma, title='JPM VIX Buy Signal', color=color.new(#00ffaa, 70), linewidth=2, style=plot.style_area) hline(1.5, title='150%', color=color.blue, linestyle=hline.style_dotted, linewidth=2)
RedK Volume-Accelerated Directional Energy Ratio (RedK VADER)
https://www.tradingview.com/script/7s0lx2Bw-RedK-Volume-Accelerated-Directional-Energy-Ratio-RedK-VADER/
RedKTrader
https://www.tradingview.com/u/RedKTrader/
4,328
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/ // © RedKTrader //@version=5 indicator('RedK Volume-Accelerated Directional Energy Ratio', 'RedK VADER v4.0', precision=0, timeframe='', timeframe_gaps=false) // *********************************************************************************************************** // Choose MA type for the base DER calculation .. // WMA is my preference and is default .. SMA is really slow and lags a lot - but added for comparison f_derma(_data, _len, MAOption) => value = MAOption == 'SMA' ? ta.sma(_data, _len) : MAOption == 'EMA' ? ta.ema(_data, _len) : ta.wma(_data, _len) // *********************************************************************************************************** // =========================================================================================================== // Inputs // =========================================================================================================== price = close length = input.int(10, minval=1) DER_avg = input.int(5, 'Average', minval=1, inline='DER', group='Directional Energy Ratio') MA_Type = input.string('WMA', 'DER MA type', options=['WMA', 'EMA', 'SMA'], inline='DER', group='Directional Energy Ratio') smooth = input.int(3, 'Smooth', minval=1, inline='DER_1', group='Directional Energy Ratio') show_senti = input.bool(false, 'Sentiment', inline='DER_s', group='Directional Energy Ratio') senti = input.int(20, 'Length', minval=1, inline='DER_s', group='Directional Energy Ratio') v_calc = input.string('Relative', 'Calculation', options=['Relative', 'Full', 'None'], group='Volume Parameters') vlookbk = input.int(20, 'Lookback (for Relative)', minval=1, group='Volume Parameters') // =========================================================================================================== // Calculations // =========================================================================================================== // Volume Calculation Option -- will revert to no volume acceleration for instruments with no volume data // v4.0 => updated Relative Volume calculation fix per @m_b_round v = volume vola = v_calc == 'None' or na(volume) ? 1 : v_calc == 'Relative' ? ta.stoch(v, v, v, vlookbk) / 100 : v R = (ta.highest(2) - ta.lowest(2)) / 2 // R is the 2-bar average bar range - this method accomodates bar gaps sr = ta.change(price) / R // calc ratio of change to R rsr = math.max(math.min(sr, 1), -1) // ensure ratio is restricted to +1/-1 in case of big moves c = fixnan(rsr * vola) // add volume accel -- fixnan adresses cases where no price change between bars c_plus = math.max(c, 0) // calc directional vol-accel energy c_minus = -math.min(c, 0) // plot(c_plus) // plot(c_minus) avg_vola = f_derma(vola, length, MA_Type) dem = f_derma(c_plus, length, MA_Type) / avg_vola // directional energy ratio sup = f_derma(c_minus, length, MA_Type) / avg_vola adp = 100 * ta.wma(dem, DER_avg) // average DER asp = 100 * ta.wma(sup, DER_avg) anp = adp - asp // net DER.. anp_s = ta.wma(anp, smooth) // Calculate Sentiment - a VADER for a longer period and can act as a baseline (compared to a static 0 value) // note we're not re-calculating vol_avg, demand or supply energy for sentiment. this would've been a different approach s_adp = 100 * ta.wma(dem, senti) // average DER for sentiment length s_asp = 100 * ta.wma(sup, senti) V_senti = ta.wma(s_adp - s_asp, smooth) // =========================================================================================================== // Colors & plots // =========================================================================================================== c_adp = color.new(color.aqua, 30) c_asp = color.new(color.orange, 30) c_fd = color.new(color.green, 80) c_fs = color.new(color.red, 80) c_zero = color.new(#ffee00, 70) c_up = color.new(#359bfc, 0) c_dn = color.new(#f57f17, 0) c_sup = color.new(#33ff00, 80) c_sdn = color.new(#ff1111, 80) up = anp_s >= 0 s_up = V_senti >=0 hline(0, 'Zero Line', c_zero, hline.style_solid) // ============================================================================= // v3.0 --- Sentiment will be represented as a 4-color histogram c_grow_above = #1b5e2080 c_grow_below = #dc4c4a80 c_fall_above = #66bb6a80 c_fall_below = #ef8e9880 sflag_up = math.abs(V_senti) >= math.abs(V_senti[1]) plot(show_senti ? V_senti : na, "Sentiment", style=plot.style_columns, color = s_up ? (sflag_up ? c_grow_above : c_fall_above) : sflag_up ? c_grow_below : c_fall_below) // ============================================================================= s = plot(asp, 'Supply Energy', c_asp, 2, style=plot.style_circles, join=true) d = plot(adp, 'Demand Energy', c_adp, 2, style=plot.style_cross, join=true) fill(d, s, adp > asp ? c_fd : c_fs) plot(anp, 'VADER', color.new(color.gray, 30), display=display.none) plot(anp_s, 'Signal', up ? c_up : c_dn, 4) // =========================================================================================================== // v2.0 adding alerts // =========================================================================================================== Alert_up = ta.crossover(anp_s,0) Alert_dn = ta.crossunder(anp_s,0) Alert_swing = ta.cross(anp_s,0) // "." in alert title for the alerts to show in the right order up/down/swing alertcondition(Alert_up, ". VADER Crossing 0 Up", "VADER Up - Buying Energy Detected!") alertcondition(Alert_dn, ".. VADER Crossing 0 Down", "VADER Down - Selling Energy Detected!") alertcondition(Alert_swing, "... VADER Crossing 0", "VADER Swing - Possible Reversal") // =========================================================================================================== // v3.0 more alerts for VADER crossing Sentiment // =========================================================================================================== v_speedup = ta.crossover(anp_s, V_senti) v_slowdn = ta.crossunder(anp_s, V_senti) alertcondition(v_speedup, "* VADER Speeding Up", "VADER Speeding Up!") alertcondition(v_slowdn, "** VADER Slowing Down", "VADER Slowing Down!")
Pivot Points High Low & Missed Reversal Levels [LuxAlgo]
https://www.tradingview.com/script/OxJJqZiN-Pivot-Points-High-Low-Missed-Reversal-Levels-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
9,614
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("Pivot Points High Low & Missed Reversal Levels [LuxAlgo]",overlay=true,max_labels_count=500,max_lines_count=500,max_bars_back=500) length = input(50,'Pivot Length') show_reg = input.bool(true,'Regular Pivots',inline='inline1') reg_ph_css = input.color(#ef5350,'High',inline='inline1') reg_pl_css = input.color(#26a69a,'Low',inline='inline1') show_miss = input.bool(true,'Missed Pivots',inline='inline2') miss_ph_css = input.color(#ef5350,'High',inline='inline2') miss_pl_css = input.color(#26a69a,'Low',inline='inline2') label_css = input.color(color.white,'Text Label Color') //------------------------------------------------------------------------------ var line zigzag = na var line ghost_level = na var max = 0.,var min = 0. var max_x1 = 0,var min_x1 = 0 var follow_max = 0.,var follow_max_x1 = 0 var follow_min = 0.,var follow_min_x1 = 0 var os = 0,var py1 = 0.,var px1 = 0 //------------------------------------------------------------------------------ n = bar_index ph = ta.pivothigh(length,length) pl = ta.pivotlow(length,length) max := math.max(high[length],max) min := math.min(low[length],min) follow_max := math.max(high[length],follow_max) follow_min := math.min(low[length],follow_min) if max > max[1] max_x1 := n-length follow_min := low[length] if min < min[1] min_x1 := n-length follow_max := high[length] if follow_min < follow_min[1] follow_min_x1 := n-length if follow_max > follow_max[1] follow_max_x1 := n-length //------------------------------------------------------------------------------ line.set_x2(ghost_level[1],n) if ph if show_miss if os[1] == 1 label.new(min_x1,min,'👻',color=miss_pl_css,style=label.style_label_up,size=size.small, tooltip=str.tostring(min,'#.####')) zigzag := line.new(px1,py1,min_x1,min,color=miss_ph_css,style=line.style_dashed) px1 := min_x1,py1 := min line.set_x2(ghost_level[1],px1) ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_pl_css,50),width=2) else if ph < max label.new(max_x1,max,'👻',color=miss_ph_css,style=label.style_label_down,size=size.small, tooltip=str.tostring(max,'#.####')) label.new(follow_min_x1,follow_min,'👻',color=miss_pl_css,style=label.style_label_up,size=size.small, tooltip=str.tostring(min,'#.####')) zigzag := line.new(px1,py1,max_x1,max,color=miss_pl_css,style=line.style_dashed) px1 := max_x1,py1 := max line.set_x2(ghost_level[1],px1) ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_ph_css,50),width=2) zigzag := line.new(px1,py1,follow_min_x1,follow_min,color=miss_ph_css,style=line.style_dashed) px1 := follow_min_x1,py1 := follow_min line.set_x2(ghost_level,px1) ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_pl_css,50),width=2) if show_reg label.new(n-length,ph,'▼',textcolor=label_css,color=reg_ph_css,style=label.style_label_down,size=size.small, tooltip=str.tostring(ph,'#.####')) zigzag := line.new(px1,py1,n-length,ph,color=miss_pl_css,style=ph < max or os[1] == 1 ? line.style_dashed : line.style_solid) py1 := ph,px1 := n-length,os := 1,max := ph,min := ph //------------------------------------------------------------------------------ if pl if show_miss if os[1] == 0 label.new(max_x1,max,'👻',color=miss_ph_css,style=label.style_label_down,size=size.small, tooltip=str.tostring(max,'#.####')) zigzag := line.new(px1,py1,max_x1,max,color=miss_pl_css,style=line.style_dashed) px1 := max_x1,py1 := max line.set_x2(ghost_level[1],px1) ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_ph_css,50),width=2) else if pl > min label.new(follow_max_x1,follow_max,'👻',color=miss_ph_css,style=label.style_label_down,size=size.small, tooltip=str.tostring(max,'#.####')) label.new(min_x1,min,'👻',color=miss_pl_css,style=label.style_label_up,size=size.small, tooltip=str.tostring(min,'#.####')) zigzag := line.new(px1,py1,min_x1,min,color=miss_ph_css,style=line.style_dashed) px1 := min_x1,py1 := min line.set_x2(ghost_level[1],px1) ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_pl_css,50),width=2) zigzag := line.new(px1,py1,follow_max_x1,follow_max,color=miss_pl_css,style=line.style_dashed) px1 := follow_max_x1,py1 := follow_max line.set_x2(ghost_level,px1) ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_ph_css,50),width=2) if show_reg label.new(n-length,pl,'▲',textcolor=label_css,color=reg_pl_css,style=label.style_label_up,size=size.small, tooltip=str.tostring(pl,'#.####')) zigzag := line.new(px1,py1,n-length,pl,color=miss_ph_css,style=pl > min or os[1] == 0 ? line.style_dashed : line.style_solid) py1 := pl,px1 := n-length,os := 0,max := pl,min := pl //------------------------------------------------------------------------------ var label lbl = na if barstate.islast x = 0,y = 0. prices = array.new_float(0) prices_x = array.new_int(0) for i = 0 to n-px1-1 array.push(prices,os==1?low[i]:high[i]) array.push(prices_x,n-i) label.delete(lbl[1]) if os == 1 y := array.min(prices) x := array.get(prices_x,array.indexof(prices,y)) if show_miss lbl := label.new(x,y,'👻',color=miss_pl_css,style=label.style_label_up,size=size.small, tooltip=str.tostring(y,'#.####')) else y := array.max(prices) x := array.get(prices_x,array.indexof(prices,y)) if show_miss lbl := label.new(x,y,'👻',color=miss_ph_css,style=label.style_label_down,size=size.small, tooltip=str.tostring(y,'#.####')) if show_miss line.delete(line.new(px1,py1,x,y,color=os == 1 ? miss_ph_css : miss_pl_css,style=line.style_dashed)[1]) line.delete(line.new(x,y,n,y,color = color.new(os == 1 ? miss_ph_css : miss_pl_css,50),width=2)[1])
Market Risk Indicator
https://www.tradingview.com/script/02mLt5It-Market-Risk-Indicator/
greenfield_br
https://www.tradingview.com/u/greenfield_br/
53
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ f_roc(_a0, _a1) => 100 * (_a0 - _a1) / _a1 f_pct(_securityRequested, _length) => 100 * (_securityRequested - ta.lowest(_securityRequested, _length)) / (ta.highest(_securityRequested, _length) - ta.lowest(_securityRequested, _length)) WTI = request.security("TVC:USOIL", timeframe.period, close) HYG = request.security("AMEX:HYG", timeframe.period, close) UST = request.security("TVC:US10Y", timeframe.period, close) DXY = request.security("TVC:DXY", timeframe.period, close) USDT = request.security("CRYPTOCAP:USDT", timeframe.period, close) USDC = request.security("CRYPTOCAP:USDC", timeframe.period, close) vBTC = request.security("BINANCE:BTCUSDT", timeframe.period, volume) wtiPct = f_pct(WTI, 200) hygPct = f_pct(HYG, 200) ustPct = f_pct(UST, 200) dxyPct = f_pct(DXY, 200) f_color(_pct) => if (_pct < 33) color.red else if (_pct >= 33) and (_pct < 66) color.yellow else if (_pct >= 66) color.green plot(180, title='wti', color=color.new(f_color(wtiPct), 80), linewidth=0, style=plot.style_columns, offset=0, trackprice=false, editable=false, histbase=90) plot(90, title='hyg', color=color.new(f_color(hygPct), 80), linewidth=0, style=plot.style_columns, offset=0, trackprice=false, editable=false, histbase=0) plot(0, title='ust', color=color.new(f_color(100-ustPct), 80), linewidth=0, style=plot.style_columns, offset=0, trackprice=false, editable=false, histbase=-90) plot(-90, title='dxy', color=color.new(f_color(100-dxyPct), 80), linewidth=0, style=plot.style_columns, offset=0, trackprice=false, editable=false, histbase=-180) MRI = wtiPct+hygPct-ustPct-dxyPct plot(MRI, title='MRI', color=color.blue, linewidth=2) plot(ta.wma(wtiPct+hygPct-dxyPct-ustPct, 200), color=color.yellow) //Quads by Hedgeye GDP = request.security("ECONOMICS:USGDPCP", "3M", close) CPI = request.security("ECONOMICS:USCPI", "3M", close) rGDP = 100*ta.roc(GDP,1) rCPI = 100*ta.roc(CPI,1) dGDP = rGDP < 100 ? rGDP : 100 dGDP := dGDP > -100 ? dGDP : -100 dCPI = rCPI < 100 ? rCPI : 100 dCPI := dCPI > -100 ? dCPI : -100 plot(dGDP, title='dGDP', color=color.white, linewidth=2) plot(dCPI, title='dCPI', color=color.orange, linewidth=2) var table tabDisplay = table.new(position.top_right, 1, 4, frame_width = 0, frame_color = color.black) if barstate.islast // We only populate the table on the last bar. table.cell(tabDisplay, 0, 0, "wti", text_color = color.blue) table.cell(tabDisplay, 0, 1, "hyg", text_color = color.blue) table.cell(tabDisplay, 0, 2, "us10y", text_color = color.blue) table.cell(tabDisplay, 0, 3, "dxy", text_color = color.blue) table.cell_set_height(tabDisplay, 0, 0, 25) table.cell_set_height(tabDisplay, 0, 1, 25) table.cell_set_height(tabDisplay, 0, 2, 25) table.cell_set_height(tabDisplay, 0, 3, 25) //@version=5 indicator(title="MRI3", overlay=false)
Double EMA WIth Pullback Buy Sell Signal - Smarter Algo
https://www.tradingview.com/script/4H3SSSTg-Double-EMA-WIth-Pullback-Buy-Sell-Signal-Smarter-Algo/
hanabil
https://www.tradingview.com/u/hanabil/
894
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/ // © hanabil //@version=5 indicator("Double EMA Pullback - Buy Sell Signal", overlay=true, max_labels_count=500) gr0 = 'Pullback' pbStep = input(5, 'Backstep of Pullback', group=gr0) gr1 = 'Double EMA' emaSrc = input.source(close, 'EMA 1 Source', group=gr1) emaLen = input(50, 'EMA 1 Period', group=gr1) emaCol = input.color(color.blue, 'EMA 1 Color', group=gr1) ema1 = ta.ema(emaSrc, emaLen) plot(ema1, 'EMA 1', color=emaCol) emaSrc1 = input.source(close, 'EMA 2 Source', group=gr1) emaLen1 = input(200, 'EMA 2 Period', group=gr1) emaCol1 = input.color(color.red, 'EMA 2 Color', group=gr1) ema2 = ta.ema(emaSrc1, emaLen1) plot(ema2, 'EMA 2', color=emaCol1) buySignal = ta.crossover (close, ema1) and ema1>ema2 and close[pbStep]>ema1 sellSignal = ta.crossunder(close, ema1) and ema1<ema2 and close[pbStep]<ema1 gr4 = 'Styling' showPattern = input(true, 'Show Pattern Name', group=gr4) textCol = input.color(color.white, 'Text Color', group=gr4) bullText = input.string('Buy', 'Buy Signal', inline='ul', group=gr4) bullCol = input.color(color.green, '', '', 'ul', gr4) bearText = input('Sell', 'Sell Signal', '', 'ms', gr4) bearCol = input.color(color.red, '', '', 'ms', gr4) fLabel(x, y)=> labelStyle = y==high? label.style_label_down : label.style_label_up labelCol = y==high? bearCol : bullCol labelText = y==high? bearText : bullText //labelText = showPattern? labelText_ + pn : labelText_ if x label.new(bar_index, y, labelText, style=labelStyle, color=labelCol, size=size.small, textcolor=textCol) fLabel(buySignal , low ) fLabel(sellSignal, high) alertcondition(buySignal, 'Buy Signal', 'Buy!!') alertcondition(sellSignal, 'Sell Signal', 'Sell!!')
Tail Indicator - 84
https://www.tradingview.com/script/akOjIG4o-Tail-Indicator-84/
RicardoSantos
https://www.tradingview.com/u/RicardoSantos/
206
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/ // © RicardoSantos //@version=5 indicator(title='Tail Indicator - 84', shorttitle='TI-84') int atr_length = input.int (defval=84) int band_length = input.int (defval=84) float band_multiplier = input.float(defval=1.0) float maoc = math.max(close, open) float mioc = math.min(close, open) float tail = ((high - maoc) - (mioc - low)) / ta.atr(atr_length) [b, bu, bl] = ta.bb(tail, band_length, band_multiplier) hline(0) plot(series=tail, title='Tail', color=color.yellow) plot(series=bu, title='Tail+', color=color.red) plot(series=bl, title='Tail-', color=color.lime)
SHAD helper
https://www.tradingview.com/script/56vNUxvN-SHAD-helper/
seborax
https://www.tradingview.com/u/seborax/
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/ // © seborax //@version=5 indicator("SHAD helper", overlay=true) color color_up = input.color(color.teal, "Color for multiples 🚀") color color_down = input.color(color.red, "Color for losses 📉") label_size_input = input.string(defval="Normal", title="Label Size", options=["Auto", "Huge", "Large", "Normal", "Small", "Tiny"]) label_size = (label_size_input == "Huge") ? size.huge : (label_size_input == "Large") ? size.large : (label_size_input == "Small") ? size.small : (label_size_input == "Tiny") ? size.tiny : (label_size_input == "Auto") ? size.auto : size.normal plot(close / 4, color=color_down, trackprice=true, offset=-9999, title="/4") plot(close / 2, color=color_down, trackprice=true, offset=-9999, title="/2") plot(close * 2, color=color_up, trackprice=true, offset=-9999, title="x2") plot(close * 4, color=color_up, trackprice=true, offset=-9999, title="x4") plot(close * 8, color=color_up, trackprice=true, offset=-9999, title="x8") plot(close * 16, color=color_up, trackprice=true, offset=-9999, title="x16") if barstate.islast x = bar_index + 5 label.new(x, close / 4, "/4", textcolor=color_down, size=label_size, style=label.style_none) label.new(x, close / 2, "/2", textcolor=color_down, size=label_size, style=label.style_none) label.new(x, close * 2, "x2", textcolor=color_up, size=label_size, style=label.style_none) label.new(x, close * 4, "x4", textcolor=color_up, size=label_size, style=label.style_none) label.new(x, close * 8, "x8", textcolor=color_up, size=label_size, style=label.style_none) label.new(x, close * 16, "x16", textcolor=color_up, size=label_size, style=label.style_none)
CA - Indicators Colors
https://www.tradingview.com/script/WgUyfYJT-CA-Indicators-Colors/
camiloaguilar1
https://www.tradingview.com/u/camiloaguilar1/
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/ // © camiloaguilar1 //@version=5 indicator("CA - Indicators Colors", overlay=true) var table atrDisplay = table.new(position.top_right, 3, 3, border_color=color.black, border_width=2, frame_color=color.black, frame_width=2) table.cell(atrDisplay, 0, 0, "Indicator", bgcolor=color.gray) table.cell(atrDisplay, 1, 0, "1H", bgcolor=color.gray) table.cell(atrDisplay, 2, 0, "1D", bgcolor=color.gray) [dayCloseVal, dayHighVal, dayLowVal] = request.security(syminfo.tickerid, "D", [close, high, low], lookahead=barmerge.lookahead_on) [hourCloseVal, hourHighVal, hourLowVal] = request.security(syminfo.tickerid, "60", [close, high, low]) //MACD Starts fastLength = 12 slowLength = 26 signalLength = 9 hourFastEma = ta.ema(hourCloseVal, fastLength) hourSlowEma = ta.ema(hourCloseVal, slowLength) hourMacd = hourFastEma - hourSlowEma hourSignal = ta.ema(hourMacd, signalLength) [dMacd, dSignal] = request.security(syminfo.tickerid, "D", [hourMacd, hourSignal]) getMacdColor(macd, signal) => col_grow_above = #26A69A col_grow_below = #FFCDD2 col_fall_above = #B2DFDB col_fall_below = #EF5350 hist = macd-signal histColor = (hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : (hist[1] < hist ? col_grow_below : col_fall_below) ) histColor table.cell(atrDisplay, 0, 1, "MACD", bgcolor=color.gray) table.cell(atrDisplay, 1, 1, "", bgcolor=getMacdColor(hourMacd, hourSignal)) table.cell(atrDisplay, 2, 1, "", bgcolor=getMacdColor(dMacd, dSignal)) //MACD Ends // Stoch Starts lookback_period = 14 m1 = 5 m2 = 5 kHour = ta.sma(ta.stoch(hourCloseVal, hourHighVal, hourLowVal, lookback_period), m1) dHour = ta.sma(kHour, m2) [kDay, dDay] = request.security(syminfo.tickerid, "D", [kHour, dHour]) getStochColor(k, d) => var fillColor = color.red if k > d fillColor := color.green else fillColor := color.red fillColor table.cell(atrDisplay, 0, 2, "Stochastic", bgcolor=color.gray) table.cell(atrDisplay, 1, 2, "", bgcolor=getStochColor(kHour, dHour)) table.cell(atrDisplay, 2, 2, "", bgcolor=getStochColor(kDay, dDay)) // Stoch Ends
HighLow Box Highlight between Earnings
https://www.tradingview.com/script/43Om5LqX-HighLow-Box-Highlight-between-Earnings/
processingclouds
https://www.tradingview.com/u/processingclouds/
111
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/ // © processingclouds //@version=5 indicator("Highlight Earning Span", "Earning Blocks", overlay = true) // ----- Variables { var lowest = low var highest = high var flip = false var count = 0 drawBox = box(na) drawLabel = label(na) showWhichBox = input.string(defval = "both", title="Choose Boxes To Display", options=["both","earnings only","custom only"]) // ----- } // ----- Custom Date Boxes { // ----- Variables var string separator = ',' var string currentInput = na var string currentColor = na var customLowest = 100000000. var customHighest = 0. var customArrayCount = 1 var extractedDates = array.new_int() var extractedColor = array.new_color() var errorCustomTable = table.new("top_center", 1, 1) var hasErrorCustomInput = false drawBoxCustom = box(na) // ----- Custom Box Inputs customGroup = "Custom Box Dates" customDateTip = "Please seperate the dates by commas. Input in form of DATE, DATE,.... DATE where DATE=yyyymmdd" customColorTip = "Please seperate the colors by commas. Supported colors are blue, yellow, green, purple, orange, gray, red, olive, clear" customDates = input.string(defval="",title="Custom Dates", tooltip=customDateTip, group=customGroup) // e.g. 20210901,20211101,20211205,20220201 customColors = input.string(defval="", title="Colors", tooltip = customColorTip, group=customGroup) // e.g. orange,clear,purple // ----- Convert Inputs to Arrays var dateArray = str.split(customDates, separator) var colorArray = str.split(customColors, separator) // ----- Color Function - Returns Hex Code from String hexColorCode(colorString) => colorInput = str.replace(str.lower(colorString)," ", "") colorInput == "blue" ? #2196F340 : colorInput == "gray" ? #787B8640 : colorInput == "yellow" ? #FFEB3B40 : colorInput == "green" ? #4CAF5040 : colorInput == "orange" ? #FF980040 : colorInput == "red" ? #FF525240 : colorInput == "olive" ? #80800040 : colorInput == "purple" ? #9C27B040 : #FFFFFF40 if (not(customDates == "" or customColors == "") and (showWhichBox == "both" or showWhichBox == "custom only")) if (array.size(dateArray)-1 == array.size(colorArray)) if barstate.isfirst for i = 0 to array.size(dateArray) - 1 currentInput := str.replace(array.get(dateArray, i)," ","") if (not na(str.tonumber(currentInput)) and str.length(currentInput)==8) tempDate = timestamp(syminfo.timezone, int(str.tonumber(str.substring(currentInput,0,4))), int(str.tonumber(str.substring(currentInput,4,6))), int(str.tonumber(str.substring(currentInput,6))), 0,0) array.push(extractedDates, tempDate) for i = 0 to array.size(colorArray) - 1 array.push(extractedColor, color(hexColorCode(array.get(colorArray, i)))) if (array.size(extractedDates)-1 == array.size(extractedColor) and array.size(extractedDates) > 1) if (customArrayCount - 1 < array.size(dateArray)-1) if (time >= array.get(extractedDates, customArrayCount-1)) customLowest := math.min(customLowest, low) customHighest := math.max(customHighest, high) else customLowest := low customHighest := high if (customArrayCount < array.size(dateArray)) if (time > array.get(extractedDates, customArrayCount)) if (array.get(extractedColor, customArrayCount - 1) != color(#FFFFFF40)) drawBoxCustom := box.new(array.get(extractedDates, customArrayCount-1), customHighest, array.get(extractedDates, customArrayCount), customLowest, border_color = color.green, border_width=1, border_style=line.style_dotted, xloc=xloc.bar_time, bgcolor = array.get(extractedColor, customArrayCount - 1)) customArrayCount += 1 customLowest := low customHighest := high else hasErrorCustomInput := true else hasErrorCustomInput := true // Show messages on error from input if (barstate.isfirst and hasErrorCustomInput) table.cell_set_text (errorCustomTable, 0, 0, text = "ERROR in Custom Inputs\n 1.Make sure dates are formatted as yyyymmdd.\n2.Number of colors is one less than number of dates.\n3.Dates are in ascending order.\n4. There must be atleast 2 custom dates.") table.cell_set_text_color(errorCustomTable, 0, 0, text_color = color.red) table.cell_set_text_size (errorCustomTable, 0, 0, text_size = size.normal) table.cell_set_bgcolor (errorCustomTable, 0, 0, bgcolor = color.gray) // ----- } // ----- Get earnings and high and low points { e = request.earnings(syminfo.tickerid) lowest := math.min(lowest, low) highest := math.max(highest, high) // ----- } // ----- Check if new period has started to draw box on previous period if (showWhichBox == "both" or showWhichBox == "earnings only") if (e != e[1] or barstate.islast) if(count <= 1000) // Max Supported Value is 5279 but 1000 is good enough here flip := not flip drawBox := box.new(bar_index[count], highest, bar_index, lowest, border_color = color.green,border_width=1, border_style=line.style_dotted, bgcolor=(flip ? color.new(color.blue, 70) : color.new(color.yellow,70))) count := 0 lowest := low highest := high count += 1 // Updates - Version Histroy since v6: // 02162022 - Fixed Bug where lowest and highest points were not correctly being fetched // 02172022 - Cleaned up color input part of the code // - Added error check, so it removes blanks from color string input // - Added option to choose which boxes to display //
Constance Brown RSI
https://www.tradingview.com/script/s3mrd1tU-Constance-Brown-RSI/
Decam9
https://www.tradingview.com/u/Decam9/
103
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/ // © Decam9 //@version=4 study(title = "Constance Brown Altered RSI", shorttitle = "CB Altered RSI", overlay = false) //Plot the RSI rsiLength = input(defval = 14, title = "RSI Length"), rsiSource = input(defval = close, title = "RSI Source") rsi = rsi(rsiSource, rsiLength) Signal = ema(rsi,input(9, title = "Signal length")) plot(rsi, color = color.purple, title = "RSI") plot(Signal, color = color.black, title = "Signal") //Trend Determination Ma1 = input(defval = 100, title = "Short Trend MA") Ma2 = input(defval = 200, title = "Long Trend MA") isUptrend = sma(close,Ma1) >= sma(close,Ma2) //colors green = color.rgb(0,255,0,0) red = color.rgb(255,0,0,0) clear = color.rgb(0,0,0,100) bullshade = color.rgb(0,255,0,99) bearshade = color.rgb(255,0,0,99) //Bullzone Resistance BullOBT = plot(90, color = isUptrend ? green : clear, linewidth = 1, title = "Bullish Resistance") BullOBB = plot(80, color = isUptrend ? green : clear, linewidth = 1, title = "Bullish Resistance") //Bearzone Resistance BearOBT = plot(65, color = isUptrend ? clear : red, linewidth = 1, title = "Bearish Resistance") BearOBB = plot(55, color = isUptrend ? clear : red, linewidth = 1, title = "Bearish Resistance") //Bullzone Support BullOST = plot(50, color = isUptrend ? green : clear, linewidth = 1, title = "Bullish Support") BullOSB = plot(40, color = isUptrend ? green : clear, linewidth = 1, title = "Bullish Support") //Bearzone Support BearOST = plot(30, color = isUptrend ? clear : red, linewidth = 1, title = "Bearish Support") BearOSB = plot(20, color = isUptrend ? clear : red, linewidth = 1, title = "Bearish Support") //Fill the zones fill(BullOBT, BullOBB, color = isUptrend ? bullshade : clear, title = "Bullzone Resistance shade") fill(BullOST, BullOSB, color = isUptrend ? bearshade : clear, title = "Bullzone Support shade") fill(BearOBT, BearOBB, color = isUptrend ? clear : bullshade, title = "Bearzone Resistance shade") fill(BearOST, BearOSB, color = isUptrend ? clear : bearshade, title = "Bearzone Support shade")
Previous N Days/Weeks/Months High Low
https://www.tradingview.com/script/fqiMxTMr/
FX365_Thailand
https://www.tradingview.com/u/FX365_Thailand/
400
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/ // © FX365_Thailand //Revision History //v2.0 First release //v4.0 Fixed an issue to calculate previous N period highs/lows.(repainting issue) //@version=4 //Define indicator name study("Previous N Days/Weeks/Months High Low",overlay=true,shorttitle="Previous N Days/Weeks/Months High Low") //Users input f_ndays = input(true, title="Previous N Days", inline="#1") i_ndays = input(type=input.integer, title="High", defval=20, inline="#1") i_ndays_l = input(type=input.integer, title="Low", defval=20, inline="#1") f_nweeks = input(true, title="Previous N Weeks", inline="#2") i_nweeks = input(type=input.integer, title="High", defval=12, inline="#2") i_nweeks_l = input(type=input.integer, title="Low", defval=12, inline="#2") f_nmonths = input(true, title="Previous N Months", inline="#3") i_nmonths = input(type=input.integer, title="High", defval=6, inline="#3") i_nmonths_l = input(type=input.integer, title="Low", defval=6, inline="#3") bar_num = input(title="Number of candles to look back to draw lines", defval=50, tooltip="This is to control the number of candlestick to draw high/low lines.If you select 50, then each high/low line will be drawn for 50 bars from the current bar. If 0 , then lines will be drawn for all historical bars.") show_labels = input(title="Show Labels?", defval=true) size_labels = input(title="Label font size", defval=size.normal, options = [size.large,size.normal,size.small]) color_labels = input(title="Label font color", defval=color.black) label_position = input(title="Label Position", defval=10, minval=0, maxval=50,tooltip="When increasing number, labels move right") //Get High&Low Price isess = session.regular t = tickerid(syminfo.prefix, syminfo.ticker, session=isess) igaps = barmerge.gaps_off ilookaehad = barmerge.gaps_on previousdayHigh = security(t,"D",highest(high,i_ndays)[barstate.isconfirmed ? 0 : 1],gaps=igaps, lookahead=ilookaehad) previousdayLow = security(t,"D",lowest(low,i_ndays_l)[barstate.isconfirmed ? 0 : 1],gaps=igaps, lookahead=ilookaehad) previousweekHigh = security(t,"W",highest(high,i_nweeks)[barstate.isconfirmed ? 0 : 1],gaps=igaps, lookahead=ilookaehad) previousweekLow = security(t,"W",lowest(low,i_nweeks_l)[barstate.isconfirmed ? 0 : 1],gaps=igaps, lookahead=ilookaehad) previousmonthHigh = security(t,"M",highest(high,i_nmonths)[barstate.isconfirmed ? 0 : 1],gaps=igaps, lookahead=ilookaehad) previousmonthLow = security(t,"M",lowest(low,i_nmonths_l)[barstate.isconfirmed ? 0 : 1],gaps=igaps, lookahead=ilookaehad) //Edit label text txt_day_h = "Prev. " + tostring(i_ndays) + " Day's High" txt_day_l = "Prev. " + tostring(i_ndays_l) + " Day's Low" txt_week_h = "Prev. " + tostring(i_nweeks) + " Week's High" txt_week_l = "Prev. " + tostring(i_nweeks_l) + " Week's Low" txt_month_h = "Prev. " + tostring(i_nmonths) + " Month's High" txt_month_l = "Prev. " + tostring(i_nmonths_l) + " Month's Low" // Plot the other time frame's data a=plot(f_ndays ? (timeframe.isintraday or timeframe.isdaily) ? previousdayHigh : na : na, linewidth=1, title = "Previous N day's High", color=color.orange,style=plot.style_stepline,show_last=bar_num) b=plot(f_ndays ? (timeframe.isintraday or timeframe.isdaily) ? previousdayLow : na : na, linewidth=1, title = "Previous N day's Low", color=color.orange,style=plot.style_stepline, show_last=bar_num) c=plot(f_nweeks ? (timeframe.isintraday or timeframe.isdaily or timeframe.isweekly) ? previousweekHigh : na : na, linewidth=1, title = "Previous N week's High", color=color.blue, style=plot.style_stepline, show_last=bar_num) d=plot(f_nweeks ? (timeframe.isintraday or timeframe.isdaily or timeframe.isweekly) ? previousweekLow : na : na, linewidth=1, title = "Previous N week's Low", color=color.blue, style=plot.style_stepline, show_last=bar_num) e=plot(f_nmonths ? (timeframe.isintraday or timeframe.isdaily or timeframe.isweekly or timeframe.ismonthly) ? previousmonthHigh : na : na, linewidth=1, title = "Previous N month's High", color=color.purple,style=plot.style_stepline, show_last=bar_num) f=plot(f_nmonths ? (timeframe.isintraday or timeframe.isdaily or timeframe.isweekly or timeframe.ismonthly) ? previousmonthLow : na : na, linewidth=1, title = "Previous N month's Low", color=color.purple, style=plot.style_stepline, show_last=bar_num) //Draw labels if show_labels == true if (timeframe.isintraday == true or timeframe.isdaily == true) and f_ndays == true label YES_HIGH = label.new(bar_index + label_position, previousdayHigh, txt_day_h, style=label.style_none, textcolor = color_labels, size = size_labels, textalign = text.align_right), label.delete(YES_HIGH[1]) if (timeframe.isintraday == true or timeframe.isdaily == true) and f_ndays == true label YES_LOW = label.new(bar_index + label_position, previousdayLow, txt_day_l, style=label.style_none, textcolor = color_labels, size = size_labels, textalign = text.align_right), label.delete(YES_LOW[1]) if (timeframe.isdaily == true or timeframe.isintraday == true or timeframe.isweekly == true) and f_nweeks == true label prevW_HIGH = label.new(bar_index + label_position + 20, previousweekHigh, txt_week_h, style=label.style_none, textcolor = color_labels, size = size_labels, textalign = text.align_right), label.delete(prevW_HIGH[1]) if (timeframe.isdaily == true or timeframe.isintraday == true or timeframe.isweekly == true) and f_nweeks == true label prevW_LOW = label.new(bar_index + label_position + 20, previousweekLow, txt_week_l, style=label.style_none, textcolor = color_labels, size = size_labels, textalign = text.align_right), label.delete(prevW_LOW[1]) if (timeframe.isdaily == true or timeframe.isintraday == true or timeframe.isweekly == true or timeframe.ismonthly == true) and f_nmonths == true label prevM_HIGH = label.new(bar_index + label_position + 40, previousmonthHigh, txt_month_h, style=label.style_none, textcolor = color_labels, size = size_labels, textalign = text.align_right), label.delete(prevM_HIGH[1]) if (timeframe.isdaily == true or timeframe.isintraday == true or timeframe.isweekly == true or timeframe.ismonthly == true) and f_nmonths == true label prevM_LOW = label.new(bar_index + label_position + 40, previousmonthLow, txt_month_l, style=label.style_none, textcolor = color_labels, size = size_labels, textalign = text.align_right), label.delete(prevM_LOW[1]) //Judge cross over/under with high/low Al_co_yh = crossover(close, previousdayHigh) Al_cu_yl = crossunder(close, previousdayLow) Al_co_lwh = crossover(close, previousweekHigh) Al_cu_lwl = crossunder(close, previousweekLow) Al_co_lmh = crossover(close, previousmonthHigh) Al_cu_lml = crossunder(close, previousmonthLow) //Alert condition alertcondition(Al_co_yh, title="Cross over previous N day's High", message="Price crosses over previous N day's High") alertcondition(Al_cu_yl, title="Cross under previous N day's Low", message="Price crosses under previous N day's Low") alertcondition(Al_co_lwh, title="Cross over previous N week's High", message="Price crosses over previous N week's High") alertcondition(Al_cu_lwl, title="Cross under previous N week's Low", message="Price crosses under previous N week's Low") alertcondition(Al_co_lmh, title="Cross over previous N month's High", message="Price crosses over previous N month's High") alertcondition(Al_cu_lml, title="Cross under previous N month's Low", message="Price crosses under previous N month's Low")
Leverage Calculator
https://www.tradingview.com/script/2QOicTmi-Leverage-Calculator/
LamboLimbo
https://www.tradingview.com/u/LamboLimbo/
94
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/ // © LamboLimbo //@version=4 // This script is intended to be used as a risk management calculator. // It will calculate the best leverage to use based on the maximum percentage of loss you are willing to incur on your trading portfolio. // Also calculates the order value and order qty based on your inputs. // Please note this calculator does not take into account any trading fees imposed by the exchange you are using. // *** Only risking 1% to 5% of your portfolio is considered good risk management *** // ------ Settings Inputs ----------------------------------------------------------------------------------------------------- // "Portfolio Size" -- enter your portfolio balance // "% Willing to lose on this trade" -- enter the percent of your portfolio you are willing to lose if the stop loss is hit // "Entry Price" -- enter the price at which you will enter the trade // "Stop Loss Price" -- enter the price at which your stop loss will be set // ---------------------------------------------------------------------------------------------------------------------------- // ------ Outputs ------------------------------------------------------------------------------------------------------------- // "Portfolio" -- displays the portfolio balance entered in settings // "max loss on trade" -- displays the % loss entered in settings and the corresponding amount of your portfolio // "Entry Price" -- displays the entry price entered in settings // "Stop Loss Price" -- displays the stop loss price entered in settings // "Stop Loss %" -- displays the calculated percentage loss from the entry price // "Leverage calc" -- displays the calculated leverage based on your max loss and stop loss settings // "Order Value" -- displays the value of the order based on the calculated leverage // "Order Qty" -- displays the calculated order qty based on the calculated leverage study("Leverage Calculator", "LevCalc", overlay = false) // Get inputs port_size = input(title="Portfolio Size", type=input.float, defval=1000, minval=.001) max_loss_per_trade = input(title="% willing to lose this trade", type=input.float, defval=1, minval=0.1, maxval=100, step=0.1) * 0.01 entry_price = input(title="Entry Price", type=input.float, defval=0, minval=0) stop_loss_price = input(title="Stop Loss Price", type=input.float, defval=0, minval=0) // Calculations for risk amt_max_loss_per_trade = port_size * max_loss_per_trade stop_loss_pct = abs(((stop_loss_price/entry_price) - 1) * 100) stop_loss_pct := round(stop_loss_pct * 1000) / 1000 leverage = (max_loss_per_trade / stop_loss_pct) * 100 leverage := round(leverage * 10) / 10 order_qty = port_size * leverage // order_val := round(order_val * 1000) / 1000 order_val = entry_price * order_qty order_val := round(order_val * 100) / 100 // order_qty := round(order_qty * 10000) / 10000 if entry_price == 0 or stop_loss_price == 0 leverage := 0 order_val := 0 order_qty := 0 // Create and populate table var theTable = table.new(position=position.bottom_left, columns=4, rows=2, bgcolor=color.blue, border_width=1) if barstate.islast table.set_border_color(theTable, color.white) table.cell(theTable,0,0, text= "Portfolio = $" + tostring(port_size)) table.cell(theTable,0,1, text= tostring(max_loss_per_trade*100) + "% max loss on trade = $" + tostring(amt_max_loss_per_trade)) table.cell(theTable,1,0, text= "Entry Price = $" + tostring(entry_price)) table.cell(theTable,1,1, text= "Stop Loss = $" + tostring(stop_loss_price)) table.cell(theTable,2,1, text= "Stop Loss = " + tostring(stop_loss_pct) + "%") table.cell(theTable,2,0, text= "Leverage calc = " + tostring(leverage)) table.cell(theTable,3,0, text= "Order Value = $" + tostring(order_val)) table.cell(theTable,3,1, text= "Order Qty = " + tostring(order_qty))
Pretax EPS 10X TTM
https://www.tradingview.com/script/8PZHxlg9-Pretax-EPS-10X-TTM/
douglasjlupo
https://www.tradingview.com/u/douglasjlupo/
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/ // © xloexs //@version=5 indicator("Pretax EPS 10X") pi = request.financial(syminfo.tickerid,"PRETAX_INCOME","TTM") //plot(pi) so = request.financial(syminfo.tickerid,"TOTAL_SHARES_OUTSTANDING","FY") //plot(so) pteps = (pi/so) //plot(pteps) pteps10 = (pteps*10) plot(pteps10)
JPMorgan VIX Buy Signal
https://www.tradingview.com/script/llQZ4Lmr-JPMorgan-VIX-Buy-Signal/
TsangYouJun
https://www.tradingview.com/u/TsangYouJun/
162
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/ // Please use this on the VIX, DAILY CHART ONLY! // © TsangYouJun //@version=5 indicator("JPM VIX Buy Signal", overlay = true) jpm = (close / ta.sma(close, 30)) >= 1.5 plotshape(jpm, style=shape.triangleup, location=location.abovebar, color=color.red, size=size.tiny)
SuperIchi [LuxAlgo]
https://www.tradingview.com/script/vDGd9X9y-SuperIchi-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
2,798
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("SuperIchi [LUX]",'SuperIchi [LuxAlgo]',overlay=true,max_lines_count=500) tenkan_len = input(9,'Tenkan          ',inline='tenkan') tenkan_mult = input(2.,'',inline='tenkan') kijun_len = input(26,'Kijun             ',inline='kijun') kijun_mult = input(4.,'',inline='kijun') spanB_len = input(52,'Senkou Span B ',inline='span') spanB_mult = input(6.,'',inline='span') offset = input(26,'Displacement') //------------------------------------------------------------------------------ avg(src,length,mult)=> atr = ta.atr(length)*mult up = hl2 + atr dn = hl2 - atr upper = 0.,lower = 0. upper := src[1] < upper[1] ? math.min(up,upper[1]) : up lower := src[1] > lower[1] ? math.max(dn,lower[1]) : dn os = 0,max = 0.,min = 0. os := src > upper ? 1 : src < lower ? 0 : os[1] spt = os == 1 ? lower : upper max := ta.cross(src,spt) ? math.max(src,max[1]) : os == 1 ? math.max(src,max[1]) : spt min := ta.cross(src,spt) ? math.min(src,min[1]) : os == 0 ? math.min(src,min[1]) : spt math.avg(max,min) //------------------------------------------------------------------------------ tenkan = avg(close,tenkan_len,tenkan_mult) kijun = avg(close,kijun_len,kijun_mult) senkouA = math.avg(kijun,tenkan) senkouB = avg(close,spanB_len,spanB_mult) //------------------------------------------------------------------------------ tenkan_css = #2157f3 kijun_css = #ff5d00 cloud_a = color.new(color.teal,80) cloud_b = color.new(color.red,80) chikou_css = #7b1fa2 plot(tenkan,'Tenkan-Sen',tenkan_css) plot(kijun,'Kijun-Sen',kijun_css) plot(ta.crossover(tenkan,kijun) ? kijun : na,'Crossover',#2157f3,3,plot.style_circles) plot(ta.crossunder(tenkan,kijun) ? kijun : na,'Crossunder',#ff5d00,3,plot.style_circles) A = plot(senkouA,'Senkou Span A',na,offset=offset-1) B = plot(senkouB,'Senkou Span B',na,offset=offset-1) fill(A,B,senkouA > senkouB ? cloud_a : cloud_b) plot(close,'Chikou',chikou_css,offset=-offset+1,display=display.none)
Heikin-Ashi Candle Coloring
https://www.tradingview.com/script/G1UWXqE7-Heikin-Ashi-Candle-Coloring/
MrShadow_
https://www.tradingview.com/u/MrShadow_/
157
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/ // © @MrShadowTrader //@version=5 indicator("Heikin-Ashi candle coloring", overlay=true) [ha_open, ha_close] = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, [open, close]) barcolor(color = ha_close > ha_open? color.green : color.red, title = "Heikin-Ashi Candle Coloring")
CPR Option Selling Strategy
https://www.tradingview.com/script/d0R4THit-CPR-Option-Selling-Strategy/
DeuceDavis
https://www.tradingview.com/u/DeuceDavis/
1,214
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/ // © DeuceDavis //@version=5 indicator("CPR Option Sale Strategy", overlay=true) tradeSource = input.source(close, title='Source For Trigger') autoTF = input.string('Auto', title="Select Higher Timeframe", options=['Auto','Manual'], group='Pivot Settings') manPivotTF = input.timeframe('D', title='If Manual, Time Frame for Pivots', group='Pivot Settings', options=['60','90', '120','D', '2D', '3D', '4D', 'W', '2W', '3W', '4W', 'M','2M', '3M', '6M']) //nearStrikePremiumRisk = input.int(1, "Premium Risk Level[1-5 (Higher is riskier)]", maxval=5, step=1, // group="Near Strike Calculation Method") nearStrikeMethod = input.string('Traditional Pivot S1/R1', title="Near Strike Calculation Source", options=['Traditional Pivot S1/R1', 'Camarilla Pivot R1/S1', 'Camarilla Pivot R2/S2', 'Manual Offset From Central Pivot Point'], group="Near Strike Calculation Method") nearStrikeManualOffset = input.float(0, "Manual Offset Value", group="Near Strike Calculation Method") spreadMethod = input.string('Auto', title='Determine Spread', options=['Auto', 'Manual'], group='Spread Method') manSpreadValue = input.float(5.0, title="Spread Width, if Manual", group='Spread Method') showPriorDayHiLo = input.bool(false, title='Show Prior Day High and Low', group='Visual') showCurrentWeekHiLo= input.bool(false, title='Show Current Week Highs and Lows', group='Visual') priorDayHigh = request.security(syminfo.tickerid, 'D', high[1], lookahead=barmerge.lookahead_on) priorDayLow = request.security(syminfo.tickerid, 'D', low[1], lookahead=barmerge.lookahead_on) currentWeekHigh = request.security(syminfo.tickerid, 'W', high, lookahead=barmerge.lookahead_on) currentWeekLow = request.security(syminfo.tickerid, 'W', low, lookahead=barmerge.lookahead_on) pdHigh = plot(showPriorDayHiLo ? priorDayHigh : na, title="Prior Day High", color=color.new(color.red, 0)) pdLow = plot(showPriorDayHiLo ? priorDayLow : na, title="Prior Day Low", color=color.new(color.green, 0)) cwHigh = plot(showCurrentWeekHiLo ? currentWeekHigh : na, title="Current Week High", color=color.new(color.red, 0)) cwLow = plot(showCurrentWeekHiLo ? currentWeekLow : na, title="Current Week Low", color=color.new(color.green, 0)) //pivotPeriodShift =input.int(defval=1, title='Lookback Period for Pivot', group='Primary Settings') pivotPeriodShift = 1 sendStandardAlert = input.bool(false, title='Enable Standard Alert', group='Alerts') sendDiscordWebhookAlert = input.bool(false, title='Enable Discord Webhook Alert', group='Alerts') sendPremiumZoneChangeAlert = input.bool(false, title='Enable Price Movement Into Different Zone', group='Alerts') plotTS1R1 = input.bool(false, title='Plot Traditional Pivot R1/S1', group='Traditional Pivot Plots') plotTS2R2 = input.bool(false, title='Plot Traditional Pivot R2/S2', group='Traditional Pivot Plots') plotTS3R3 = input.bool(false, title='Plot Traditional Pivot R3/S3', group='Traditional Pivot Plots') plotCS1R1 = input.bool(false, title='Plot Camarilla Pivot R1/S1', group='Camarilla Pivot Plots') plotCS2R2 = input.bool(false, title='Plot Camarilla Pivot R2/S2', group='Camarilla Pivot Plots') plotCS3R3 = input.bool(false, title='Plot Camarilla Pivot R3/S3', group='Camarilla Pivot Plots') plotCS4R4 = input.bool(false, title='Plot Camarilla Pivot R4/S4', group='Camarilla Pivot Plots') plotCS5R5 = input.bool(false, title='Plot Camarilla Pivot R5/S5', group='Camarilla Pivot Plots') tradeOnMon = input.bool(true, title='Mondays', group='Trade Days (Good for Dailies)') tradeOnTue = input.bool(true, title='Tuesdays', group='Trade Days (Good for Dailies)') tradeOnWed = input.bool(true, title='Wednesdays', group='Trade Days (Good for Dailies)') tradeOnThu = input.bool(true, title='Thursdays', group='Trade Days (Good for Dailies)') tradeOnFri = input.bool(true, title='Fridays', group='Trade Days (Good for Dailies)') showHistoricalTradeLabel = input.bool(false, title='Show Historical Strike Value Labels', group='Visual') showFuture = input.bool(false, title='Extend Developing Levels Into Future', group='Visual') showHistoricalResults = input.bool(true, title='Show Historical Win/Loss Percentages', group='Visual') backtestStartDate = input.time(timestamp("1 Jan 2020"), group="Visual", title="Start Date", group="Backtest Time Period", tooltip="This start date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer.") backtestEndDate = input.time(timestamp("1 Jan 2099"), group="Visual", title="End Date", group="Backtest Time Period", tooltip="This end date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer.") var tradeTheDay = true switch dayofweek == dayofweek.monday => tradeTheDay := tradeOnMon dayofweek == dayofweek.tuesday => tradeTheDay := tradeOnTue dayofweek == dayofweek.wednesday => tradeTheDay := tradeOnWed dayofweek == dayofweek.thursday => tradeTheDay := tradeOnThu dayofweek == dayofweek.friday => tradeTheDay := tradeOnFri //auto higher time frame HTFo = timeframe.period == '1' ? '30' : timeframe.period == '3' ? '60' : timeframe.period == '5' ? '240' : timeframe.period == '15' ? 'D' : timeframe.period == '30' ? 'D' : timeframe.period == '45' ? 'D' : timeframe.period == '60' ? 'W' : timeframe.period == '120' ? 'W' : timeframe.period == '180' ? 'W' : timeframe.period == '240' ? 'W' : timeframe.period == 'D' ? 'W' : timeframe.period == 'W' ? '4W' : 'D' pivotTF = autoTF == 'Auto' ? HTFo : manPivotTF devPivotTFHigh = request.security(syminfo.tickerid, pivotTF, high, lookahead=barmerge.lookahead_on) devPivotTFLow = request.security(syminfo.tickerid, pivotTF, low, lookahead=barmerge.lookahead_on) devPivotTFClose = request.security(syminfo.tickerid, pivotTF, close, lookahead=barmerge.lookahead_on) pivotTFHigh = request.security(syminfo.tickerid, pivotTF, high[pivotPeriodShift], lookahead=barmerge.lookahead_on) pivotTFLow = request.security(syminfo.tickerid, pivotTF, low[pivotPeriodShift], lookahead=barmerge.lookahead_on) pivotTFClose = request.security(syminfo.tickerid, pivotTF, close[pivotPeriodShift], lookahead=barmerge.lookahead_on) priorPivotTFHigh = request.security(syminfo.tickerid, pivotTF, high[pivotPeriodShift + 1], lookahead=barmerge.lookahead_on) priorPivotTFLow = request.security(syminfo.tickerid, pivotTF, low[pivotPeriodShift + 1], lookahead=barmerge.lookahead_on) priorPivotTFClose = request.security(syminfo.tickerid, pivotTF, close[pivotPeriodShift + 1], lookahead=barmerge.lookahead_on) pivotLastBar = request.security(syminfo.tickerid, pivotTF, barstate.islast, lookahead=barmerge.lookahead_on) RANGE = pivotTFHigh- pivotTFLow //CPR Calculations centralPivot = (pivotTFHigh + pivotTFLow + pivotTFClose) / 3 tempBottomPivot = (pivotTFHigh + pivotTFLow) / 2 tempTopPivot = (centralPivot - tempBottomPivot) + centralPivot bottomPivot = (tempBottomPivot > tempTopPivot) ? tempTopPivot : tempBottomPivot topPivot = bottomPivot == tempBottomPivot ? tempTopPivot : tempBottomPivot cprRange = topPivot - bottomPivot //Traditional Pivot Point Calculations tS1 = 2 * centralPivot - pivotTFHigh tS2 = centralPivot - (pivotTFHigh - pivotTFLow) tS3 = tS1 - (pivotTFHigh - pivotTFLow) tR1 = 2 * centralPivot - pivotTFLow tR2 = centralPivot + (pivotTFHigh - pivotTFLow) tR3 = tR1 + (pivotTFHigh - pivotTFLow) //Camarilla Pivot Point Calculations camR5 = pivotTFHigh / pivotTFLow * pivotTFClose camR4 = pivotTFClose + RANGE * 1.1 / 2 camR3 = pivotTFClose + RANGE * 1.1 / 4 camR2 = pivotTFClose + RANGE * 1.1 / 6 camR1 = pivotTFClose + RANGE * 1.1 / 12 camS1 = pivotTFClose - RANGE * 1.1 / 12 camS2 = pivotTFClose - RANGE * 1.1 / 6 camS3 = pivotTFClose - RANGE * 1.1 / 4 camS4 = pivotTFClose - RANGE * 1.1 / 2 camS5 = pivotTFClose - (camR5 - pivotTFClose) //Developing CPR & tR1 & tS1 devCentralPivot = (devPivotTFHigh + devPivotTFLow + devPivotTFClose) / 3 devTempBottomPivot = (devPivotTFHigh + devPivotTFLow) / 2 devTempTopPivot = (devCentralPivot - devTempBottomPivot) + devCentralPivot devBottomPivot = (devTempBottomPivot > devTempTopPivot) ? devTempTopPivot : devTempBottomPivot devTopPivot = devBottomPivot == devTempBottomPivot ? devTempTopPivot : devTempBottomPivot devTS1 = 2 * devCentralPivot - devPivotTFHigh devTR1 = 2 * devCentralPivot - devPivotTFLow //spreadValue Floor & Ceiling spreadValueCalc(calcValue, spreadValue, callOrPutSide) => var retValue = 0.00 switch callOrPutSide == 'Call' => retValue := (math.ceil(calcValue/spreadValue)) * spreadValue callOrPutSide == 'Put' => retValue := (math.floor(calcValue/spreadValue)) * spreadValue //Strike Values spreadValue = spreadMethod == "Auto" ? close >= 1000 ? 50.0 : close >= 500 ? 10.0 : close >= 100 ? 5.0 : close >= 50 ? 2.5 : close >= 20 ? 1 : close < 20 ? 0.5 : 0 : manSpreadValue callTriggerValue = nearStrikeMethod == 'Traditional Pivot S1/R1' ? tS1 : nearStrikeMethod == 'Camarilla Pivot R1/S1' ? camS1 : nearStrikeMethod == 'Camarilla Pivot R2/S2' ? camS2 : centralPivot putTriggerValue = nearStrikeMethod == 'Traditional Pivot S1/R1' ? tR1 : nearStrikeMethod == 'Camarilla Pivot R1/S1' ? camR1 : nearStrikeMethod == 'Camarilla Pivot R2/S2' ? camR2 : centralPivot callNearStrikeSource = nearStrikeMethod == 'Traditional Pivot S1/R1' ? math.max(pivotTFHigh, tR1) : nearStrikeMethod == 'Camarilla Pivot R1/S1' ? math.max(pivotTFHigh, camR1) : nearStrikeMethod == 'Camarilla Pivot R2/S2' ? math.max(pivotTFHigh, camR2) : centralPivot + nearStrikeManualOffset putNearStrikeSource = nearStrikeMethod == 'Traditional Pivot S1/R1' ? math.min(pivotTFLow, tS1) : nearStrikeMethod == 'Camarilla Pivot R1/S1' ? math.min(pivotTFLow, camS1) : nearStrikeMethod == 'Camarilla Pivot R2/S2' ? math.min(pivotTFLow, camS2) : centralPivot - nearStrikeManualOffset calcCallValue = close < callTriggerValue ? topPivot : math.avg(centralPivot, callNearStrikeSource) callStrikeValue = spreadValueCalc(calcCallValue, spreadValue, 'Call') callStrikeValue2 = callStrikeValue + spreadValue calcPutValue = close > putTriggerValue ? bottomPivot : math.avg(centralPivot, putNearStrikeSource) putStrikeValue = spreadValueCalc(calcPutValue, spreadValue, 'Put') putStrikeValue2 = putStrikeValue - spreadValue icCallStrikeValue = spreadValueCalc(tR1,spreadValue, 'Call') icCallStrikeValue2 = icCallStrikeValue + spreadValue icPutStrikeValue = spreadValueCalc(tS1, spreadValue, 'Put') icPutStrikeValue2 = icPutStrikeValue - spreadValue //Tomorrow's Strikes calcDevCallValue = close < devTS1 ? devTopPivot : math.avg(devCentralPivot, math.max(devPivotTFHigh, devTR1)) calcDevPutValue = close > devTR1 ? devBottomPivot : math.avg(devCentralPivot, math.min(devPivotTFLow, devTS1)) devCallStrikeValue = spreadValueCalc(calcDevCallValue, spreadValue, 'Call') devPutStrikeValue = spreadValueCalc(calcDevPutValue, spreadValue, 'Put') plot(callStrikeValue, "Current Call", style=plot.style_line, color=color.new(color.orange, 75)) plot(putStrikeValue, "Current Put", style=plot.style_line, color=color.new(color.orange, 75)) plot(devCallStrikeValue, "Developing Call", style=plot.style_line, color=color.new(color.yellow, 95)) plot(devPutStrikeValue, "Developing Put", style=plot.style_line, color=color.new(color.yellow, 95)) plot(devTopPivot, "Developing Top Pivot", style=plot.style_line, color=color.new(color.blue, 95)) plot(devCentralPivot, "Developing Central Pivot", style=plot.style_line, color=color.new(color.purple, 95)) plot(devBottomPivot, "Developing Bottom Pivot", style=plot.style_line, color=color.new(color.blue, 95)) //Plots //Central Pivot Range plot(topPivot, "CP Top", style=plot.style_circles) plot(centralPivot, "Central Pivot", style=plot.style_cross, linewidth=2, color=color.orange) plot(bottomPivot, "CP Bottom", style=plot.style_circles) //Traditional Pivots plot(plotTS1R1 ? tR1 : na, "tR1", style=plot.style_circles, color=color.red) plot(plotTS1R1 ? tS1 : na, "tS1", style=plot.style_circles, color=color.green) plot(plotTS2R2 ? tR2 : na, "tR2", style=plot.style_circles, color=color.new(color.red, 30)) plot(plotTS2R2 ? tS2 : na, "tS2", style=plot.style_circles, color=color.new(color.green, 30)) plot(plotTS3R3 ? tR3 : na, "tR3", style=plot.style_circles, color=color.new(color.red, 60)) plot(plotTS3R3 ? tS3 : na, "tS3", style=plot.style_circles, color=color.new(color.green, 60)) // plot(plotCS3R3 ? camR3 : na, "cR3",style=plot.style_line, color=color.red) plot(plotCS3R3 ? camS3 : na, "cS3", style=plot.style_line, color=color.green) plot(plotCS1R1 ? camR1 : na, "cR1",style=plot.style_line, color=color.new(color.red, 75)) plot(plotCS1R1 ? camS1 : na, "cS1", style=plot.style_line, color=color.new(color.green, 75)) plot(plotCS2R2 ? camR2 : na, "cR2",style=plot.style_line, color=color.new(color.red, 90)) plot(plotCS2R2 ? camS2 : na, "cS2", style=plot.style_line, color=color.new(color.green, 90)) plot(plotCS4R4 ? camR4 : na, "cR4",style=plot.style_line, color=color.new(color.red, 25)) plot(plotCS4R4 ? camS4 : na, "cS4", style=plot.style_line, color=color.new(color.green, 25)) plot(plotCS5R5 ? camR5 : na, "cR5",style=plot.style_line, color=color.new(color.red, 90)) plot(plotCS5R5 ? camS5 : na, "cS5", style=plot.style_line, color=color.new(color.green, 90)) //New Bar is_newbar(res, sess) => t = time(res, sess) na(t[1]) and not na(t) or t[1] < t openingBarClosed = is_newbar(pivotTF, session.regular)[1] openingBarOpen = is_newbar(pivotTF, session.regular) //Trade Calculations string tradeType = switch tradeSource > topPivot => "Sell Put" tradeSource < bottomPivot => "Sell Call" (tradeSource < topPivot and tradeSource > bottomPivot) => "Sell IC" var tradeDecision = "No Trade" var strikeValue = 0.00 var strikeValue2 = 0.00 var yPlacement = 0.00 var labelStyle = label.style_label_lower_right var tradeLabelText = "None" var alertText ="None" inBacktestRange = time >= backtestStartDate and time <= backtestEndDate if openingBarClosed and tradeTheDay and inBacktestRange tradeDecision := tradeType[1] strikeValue := tradeDecision == "Sell Put" ? putStrikeValue : tradeDecision == "Sell Call" ? callStrikeValue : tradeDecision == "Sell IC" ? icCallStrikeValue : na strikeValue2 := tradeDecision == "Sell Put" ? putStrikeValue2 : tradeDecision == "Sell Call" ? callStrikeValue2 : tradeDecision == "Sell IC" ? icPutStrikeValue : na tradeLabelText := tradeDecision + ' for ' + str.tostring(strikeValue, '#.##') yPlacement := tradeDecision == "Sell Put" ? putStrikeValue : tradeDecision == "Sell Call" ? callStrikeValue : tradeDecision == "Sell IC" ? icCallStrikeValue : na labelStyle := tradeDecision == "Sell Put" ? label.style_label_upper_left: tradeDecision == "Sell Call" ? label.style_label_lower_left: tradeDecision == "Sell IC" ? label.style_label_lower_left: label.style_label_lower_left alertText := tradeDecision == "Sell Put" ? "Sell Put Strike " + str.tostring(strikeValue, '#.##') + " | " + "Buy Put Strike " + str.tostring(strikeValue2, '#.##') : tradeDecision == "Sell Call" ? "Sell Call Strike " + str.tostring(strikeValue, '#.##') + " | " + "Buy Call Strike " + str.tostring(strikeValue2, '#.##') : tradeDecision == "Sell IC" ? "IC | Sell Call Strike " + str.tostring(icCallStrikeValue, '#.##') + " | " + "Buy Call Strike " + str.tostring(icCallStrikeValue2, '#.##') + " | " + "Sell Put Strike " + str.tostring(icPutStrikeValue, '#.##') + " | " + "Buy Put Strike " + str.tostring(icPutStrikeValue2, '#.##') : na if showHistoricalTradeLabel or pivotLastBar label.new(x=bar_index, y=yPlacement, color=color.new(color.blue,50), textcolor=color.white, size=size.small, style=labelStyle, text=alertText) alertText := "Ticker: " + syminfo.ticker + " - " + alertText plot((tradeTheDay and not openingBarOpen and inBacktestRange) ? strikeValue : na, "Strike Value", color=color.white, style=plot.style_linebr) //Prior Day Trade Result var wins = 0 var losses = 0 var callWins = 0 var callLosses = 0 var icWins = 0 var icLosses = 0 var putWins = 0 var putLosses = 0 var callCount = 0 var icCount = 0 var putCount = 0 var tradeResult = "No Trade" if openingBarOpen and tradeTheDay[1] and inBacktestRange[1] if tradeDecision == "Sell Put" wins := close[1] > strikeValue ? wins + 1 : wins losses := close[1] < strikeValue ? losses + 1 : losses tradeResult := close[1] > strikeValue ? "Win" : "Loss" putWins := close[1] > strikeValue ? putWins + 1 : putWins putLosses := close[1] < strikeValue ? putLosses + 1 : putLosses putCount := putCount + 1 if tradeDecision == "Sell Call" wins := close[1] < strikeValue ? wins + 1 : wins losses := close[1] > strikeValue ? losses + 1 : losses tradeResult := close[1] < strikeValue ? "Win" : "Loss" callWins := close[1] < strikeValue ? callWins + 1 : callWins callLosses := close[1] > strikeValue ? callLosses + 1 : callLosses callCount := callCount + 1 if tradeDecision == "Sell IC" wins := (close[1] > strikeValue2 and close[1] < strikeValue) ? wins + 1 : wins losses := (close[1] < strikeValue2 or close[1] > strikeValue) ? losses + 1 : losses tradeResult := (close[1] > strikeValue2 and close[1] < strikeValue) ? "Win" : "Loss" icWins := (close[1] > strikeValue2 and close[1] < strikeValue) ? icWins + 1 : icWins icLosses := (close[1] < strikeValue2 or close[1] > strikeValue) ? icLosses + 1 : icLosses icCount := icCount + 1 label.new(x=bar_index -1, y=yPlacement, color=color.new(tradeResult == "Win" ? color.green : color.red,50), textcolor=color.white, size=size.small, style=labelStyle, text=tradeResult) // Results & Current Trade string premiumValue = switch (strikeValue < bottomPivot and close < bottomPivot) or (strikeValue > topPivot and close > topPivot) => "Optimal (Hedge)" (strikeValue < bottomPivot and close < centralPivot) or (strikeValue > topPivot and close > centralPivot) => "Good" (strikeValue < bottomPivot and close < topPivot) or (strikeValue > topPivot and close > bottomPivot) => "Decent" => "Standard" var table resultsDisplay = table.new(position.bottom_right, 4, 5) var table currentSetup = table.new(position.top_right, 2, 3) if barstate.islast var tfLabelText ="nothing" tfLabelText := '----Current Setup----\n\n' tfLabelText := tfLabelText + 'Pivot Timeframe: ' + pivotTF tfLabelText := tfLabelText + '\n' + tradeLabelText table.cell(currentSetup, 0, 0, 'Pivot TF', text_color=color.white) table.cell(currentSetup, 1, 0, pivotTF, text_color=color.white) table.cell(currentSetup, 0, 1, tradeDecision, text_color=color.white) table.cell(currentSetup, 1, 1, str.tostring(strikeValue, '#.##'), text_color=color.white) table.cell(currentSetup, 0, 2, 'Timing', text_color=color.white) table.cell(currentSetup, 1, 2, premiumValue, text_color=color.white) //Plot Future Values if showFuture futureCall = line.new(x1=bar_index, y1=devCallStrikeValue, x2=bar_index + 5, y2=devCallStrikeValue, color = color.gray, extend=extend.right) futurePut = line.new(x1=bar_index, y1=devPutStrikeValue, x2=bar_index + 5, y2=devPutStrikeValue, color = color.gray, extend=extend.right) futureTopPivot = line.new(x1=bar_index, y1=devTopPivot, x2=bar_index + 5, y2=devTopPivot, color = color.blue, extend=extend.right) futureCentralPivot = line.new(x1=bar_index, y1=devCentralPivot, x2=bar_index + 5, y2=devCentralPivot, color = color.purple, extend=extend.right) futureBottomPivot = line.new(x1=bar_index, y1=devBottomPivot, x2=bar_index + 5, y2=devBottomPivot, color = color.blue, extend=extend.right) line.delete(futureCall[1]) line.delete(futurePut[1]) line.delete(futureTopPivot[1]) line.delete(futureCentralPivot[1]) line.delete(futureBottomPivot[1]) // We only populate the table on the last bar. if showHistoricalResults table.cell(resultsDisplay, 1, 0, 'Trades', text_color=color.white) table.cell(resultsDisplay, 2, 0, 'Wins', text_color=color.white) table.cell(resultsDisplay, 3, 0, 'Win %', text_color=color.white) table.cell(resultsDisplay, 0, 1, 'All', text_color=color.white) table.cell(resultsDisplay, 1, 1, str.tostring(wins+losses, '#'), text_color=color.white) table.cell(resultsDisplay, 2, 1, str.tostring(wins, '#'), text_color=color.white) table.cell(resultsDisplay, 3, 1, str.tostring(wins/(wins+losses)*100, '#.#') , text_color=color.white) table.cell(resultsDisplay, 0, 2, 'Calls', text_color=color.white) table.cell(resultsDisplay, 1, 2, str.tostring(callWins + callLosses, '#'), text_color=color.white) table.cell(resultsDisplay, 2, 2, str.tostring(callWins, '#') , text_color=color.white) table.cell(resultsDisplay, 3, 2, str.tostring(callWins/(callWins+callLosses)*100, '#.#') , text_color=color.white) table.cell(resultsDisplay, 0, 3, 'Puts', text_color=color.white) table.cell(resultsDisplay, 1, 3, str.tostring(putWins + putLosses, '#'), text_color=color.white) table.cell(resultsDisplay, 2, 3, str.tostring(putWins, '#') , text_color=color.white) table.cell(resultsDisplay, 3, 3, str.tostring(putWins/(putWins + putLosses)*100, '#.#') , text_color=color.white) table.cell(resultsDisplay, 0, 4, 'ICs', text_color=color.white) table.cell(resultsDisplay, 1, 4, str.tostring(icWins + icLosses, '#'), text_color=color.white) table.cell(resultsDisplay, 2, 4, str.tostring(icWins, '#') , text_color=color.white) table.cell(resultsDisplay, 3, 4, str.tostring(icWins/(icWins + icLosses)*100, '#.#') , text_color=color.white) //Alerts sendAlert = close < 6000 webHookAlertMessage = '{\"content\":\"' + alertText + '\"}' //{"content":"{{ticker}} Long Entry Triggered | Open: {{open}} | Close: {{close}} | Low: {{low}} |High: {{high}}"} if (sendStandardAlert and openingBarClosed) alert(alertText, alert.freq_once_per_bar) if (sendDiscordWebhookAlert and openingBarClosed) alert(webHookAlertMessage, alert.freq_once_per_bar) premiumZoneChange = (premiumValue == "Optimal (Hedge)" and premiumValue[1]!= "Optimal (Hedge)") or (premiumValue == "Good" and (premiumValue[1] != "Optimal (Hedge)" and premiumValue[1] != "Good")) or (premiumValue == "Decent" and (premiumValue[1] != "Optimal (Hedge)" and premiumValue[1] != "Good" and premiumValue[1] != "Decent")) if premiumZoneChange and sendPremiumZoneChangeAlert alert(syminfo.ticker + " Premium Zone has changed to " + premiumValue, alert.freq_once_per_bar)
Bitcoin Inflation-Adjusted Support and Resistance
https://www.tradingview.com/script/yuwHSgJR-Bitcoin-Inflation-Adjusted-Support-and-Resistance/
okor96
https://www.tradingview.com/u/okor96/
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/ // © okor96 // @version=5 // Bitcoin Inflation-Adjusted Support and Resistance // 0.02836745 indicator(title='Bitcoin Inflation-Adjusted Support and Resistance', shorttitle='BTC Inflation S/R', overlay=true, linktoseries=true) t5yie_L1 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.23738765 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_L1 : na, title='Bitcoin Inflation L1', color=color.new(color.lime, 0), linewidth=1) t5yie_L2 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.2657551 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_L2 : na, title='Bitcoin Inflation L2', color=color.new(color.lime, 0), linewidth=1) t5yie_L3 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.29412255 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_L3 : na, title='Bitcoin Inflation L3', color=color.new(color.lime, 0), linewidth=1) t5yie_L4 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.32249 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_L4 : na, title='Bitcoin Inflation L4', color=color.new(color.lime, 0), linewidth=1) t5yie_M1 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.35085745 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_M1 : na, title='Bitcoin Inflation M1', color=color.new(color.orange, 0), linewidth=1) t5yie_M2 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.3792249 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_M2 : na, title='Bitcoin Inflation M2', color=color.new(color.orange, 0), linewidth=1) t5yie_M3 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.40412255 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_M3 : na, title='Bitcoin Inflation M3', color=color.new(color.orange, 0), linewidth=1) t5yie_H1 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.43249 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_H1 : na, title='Bitcoin Inflation H1', color=color.new(color.red, 0), linewidth=1) t5yie_H2 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.46085745 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_H2 : na, title='Bitcoin Inflation H2', color=color.new(color.red, 0), linewidth=1) t5yie_H3 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.4892249 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_H3 : na, title='Bitcoin Inflation H3', color=color.new(color.red, 0), linewidth=1) t5yie_H4 = nz(request.security('FRED:T5YIE', "D", close)) * math.exp(2.51759235 * time / math.pow(10, 11) - 28.3794) plot(time > 1365552000000 ? t5yie_H4 : na, title='Bitcoin Inflation H4', color=color.new(color.red, 0), linewidth=1) //END
How To Identify Argument Type Of Number Using Overloads
https://www.tradingview.com/script/NkCi3Pg6-How-To-Identify-Argument-Type-Of-Number-Using-Overloads/
allanster
https://www.tradingview.com/u/allanster/
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/ // © allanster //@version=5 indicator(title = "How To Identify Argument Type Of Number Using Overloads", shorttitle = 'argument type', overlay = true, precision = 16) // Example overload functions accept loading of _value for types float, int, or string, then positively // identifies the actual argument type of that specific loaded _value. // === Function === f_idType(int _value) => // input: type int | output: returns string of 'Type: Int' is_Intgr = _value ? 'Type: int' : string(na) // is definitely an integer f_idType(float _value) => // input: type float | output: returns string of 'Type: Float' is_Float = _value ? 'Type: float' : string(na) // is definitely a float f_idType(string _value) => // input: type string | output: returns string of input 'Type: String (info)' is_Numbr = not na(str.tonumber(_value)) // is number is_Float = is_Numbr and not na(str.pos(_value, '.')) // is float is_Intgr = is_Numbr and not is_Float // is integer identify = is_Intgr ? 'Type: string (Integer)' : is_Float ? 'Type: string (Float)' : 'Type: string' // return string of argument type // === EXAMPLE VALUES === float cnt0 = 0.123456789 // form const type float int cnt1 = 12345678901 // form const type integer string cnt2 = '0.123456789' // form const type string string cnt3 = '12345678901' // form const type string string cnt4 = 'hello world' // form const type string float inp0 = input( 0.123456789, 'Float') // form input type float int inp1 = input( 12345678901, 'Integer') // form input type integer string inp2 = input('0.123456789', 'String') // form input type string string inp3 = input('12345678901', 'String') // form input type string string inp4 = input('hello world', 'String') // form input type string float smp0 = syminfo.mintick // form simple type float int smp1 = timeframe.multiplier // form simple type integer string smp2 = timeframe.period // form simple type string float ser0 = close > open ? cnt0 : cnt0 // form series type float int ser1 = close > open ? cnt1 : cnt1 // form series type integer string ser2 = close > open ? cnt2 : cnt2 // form series type string string ser3 = close > open ? cnt3 : cnt3 // form series type string string ser4 = close > open ? cnt4 : cnt4 // form series type string // === EXAMPLE OUTPUT === C_(_str, _column, _row, _t) => // single cell of string _str of number _column of number _row of table _t table.cell(_t, _column, _row, _str, text_color = #ffffff, text_halign = text.align_center) R_(_t, _row, _strC0, _strC1, _strC2) => // single row of table _t of number _row of string columns _strCn C_(_strC0, 0, _row, _t), C_(_strC1, 1, _row, _t), C_(_strC2, 2, _row, _t) if barstate.islast var T = table.new(position.middle_right, 3, 19, bgcolor = color.new(#3f3f3f, 0), border_color = #bfbfbf, border_width = 1, frame_color = #7f7f7f, frame_width = 2) R_(T, 0, 'FORM TYPE', 'LOADED VALUE', 'f_idType(_value)') R_(T, 1, 'const float', '0.123456789', str.tostring(f_idType(cnt0))) R_(T, 2, 'const int', '12345678901', str.tostring(f_idType(cnt1))) R_(T, 3, 'const strng', '"0.123456789"', str.tostring(f_idType(cnt2))) R_(T, 4, 'const strng', '"12345678901"', str.tostring(f_idType(cnt3))) R_(T, 5, 'const strng', '"hello world"', str.tostring(f_idType(cnt4))) R_(T, 6, 'input float', str.tostring(inp0), str.tostring(f_idType(inp0))) R_(T, 7, 'input int', str.tostring(inp1), str.tostring(f_idType(inp1))) R_(T, 8, 'input strng', '"' + str.tostring(inp2) + '"', str.tostring(f_idType(inp2))) R_(T, 9, 'input strng', '"' + str.tostring(inp3) + '"', str.tostring(f_idType(inp3))) R_(T, 10, 'input strng', '"' + str.tostring(inp4) + '"', str.tostring(f_idType(inp4))) R_(T, 11, 'simple float', 'syminfo.mintick', str.tostring(f_idType(smp0))) R_(T, 12, 'simple int', 'timeframe.multiplier', str.tostring(f_idType(smp1))) R_(T, 13, 'simple strng', 'timeframe.period', str.tostring(f_idType(smp2))) R_(T, 14, 'series float', '0.123456789', str.tostring(f_idType(ser0))) R_(T, 15, 'series int', '12345678901', str.tostring(f_idType(ser1))) R_(T, 16, 'series strng', '"0.123456789"', str.tostring(f_idType(ser2))) R_(T, 17, 'series strng', '"12345678901"', str.tostring(f_idType(ser3))) R_(T, 18, 'series strng', '"hello world"', str.tostring(f_idType(ser4)))
Premium on BTC in Russia (%)
https://www.tradingview.com/script/rIfQ0IDp-Premium-on-BTC-in-Russia/
bjplayer
https://www.tradingview.com/u/bjplayer/
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/ // © bjplayer //@version=5 indicator("Premium RUS/BTC") RUBUSD = request.security("FOREXCOM:USDRUB","240",close) RUBBTC = request.security("BTCRUB","240",close) USDBTC = request.security("BTCUSD","240",close) RUSPREM=((RUBBTC/RUBUSD)/USDBTC-1)*100 plot(RUSPREM) plot(0,title='zero',color=color.white)
VOLD-MarketBreadth-Ratio
https://www.tradingview.com/script/DypGAzBg-VOLD-MarketBreadth-Ratio/
sskcharts
https://www.tradingview.com/u/sskcharts/
305
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © sskcharts //@version=5 indicator("VOLD-Market Breadth", 'VOLD-Market Breadth', true, scale=scale.none) src = input(title='Source', defval=close) var string GP1 = "Display" txt_sizeopt = input.string(title='Text Size', defval='auto', inline='10', options=['auto', 'tiny', 'small', 'normal', 'large', 'huge'], group=GP1) txt_size = txt_sizeopt == 'auto' ? size.auto : txt_sizeopt == 'tiny' ? size.tiny : txt_sizeopt == 'small' ? size.small : txt_sizeopt == 'normal' ? size.normal : txt_sizeopt == 'large' ? size.large : size.huge string i_tableYpos = input.string("top", "Panel position", inline = "1", options = ["top", "middle", "bottom"], group = GP1) string i_tableXpos = input.string("right", "", inline = "1", options = ["left", "center", "right"], group = GP1) var table VoldDisplay = table.new(i_tableYpos + "_" + i_tableXpos, 2, 2, border_width = 1, border_color=color.white) format_text(str) => str + '\n' t = ticker.new(syminfo.prefix, syminfo.ticker, session.regular) realS (t) => request.security(t, timeframe.period, src) NYSEuvol = realS ("USI:UVOL") NYSEdvol = realS ("USI:DVOL") NASDAQuvol = realS ("USI:UVOLQ") NASDAQdvol = realS ("USI:DVOLQ") NYSEratio = (NYSEuvol >= NYSEdvol) ? (NYSEuvol/NYSEdvol) : -(NYSEdvol/NYSEuvol) NASDAQratio = (NASDAQuvol >= NASDAQdvol) ? (NASDAQuvol/NASDAQdvol) : -(NASDAQdvol/NASDAQuvol) final_nasdaqvold = format_text("NQ " + str.tostring(math.round(NASDAQratio, 2)) + ":1") final_nysevold = format_text("NYSE " + str.tostring(math.round(NYSEratio, 2)) + ":1") color_nysevold = (NASDAQratio >= 0) ? color.new(color.green, 0) : color.new(color.red, 5) color_nadsaqvold = (NYSEratio >= 0) ? color.new(color.green, 0) : color.new(color.red, 5) if barstate.islast table.cell(VoldDisplay, 0, 0, final_nasdaqvold, bgcolor=color_nysevold, text_size=txt_size) table.cell(VoldDisplay, 1, 0, final_nysevold, bgcolor=color_nadsaqvold, text_size=txt_size) //END
Vwap Salvatierra
https://www.tradingview.com/script/3VQAvJvr/
Jesus_Salvatierra
https://www.tradingview.com/u/Jesus_Salvatierra/
222
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Jesus_Salvatierra //@version=5 indicator(title="Vwap Salvatierra", shorttitle="Vwap.svt", overlay=true) computeVWAP(src, isNewPeriod, stDevMultiplier) => var float sumSrcVol = na var float sumVol = na var float sumSrcSrcVol = na sumSrcVol := isNewPeriod ? src * volume : src * volume + sumSrcVol[1] sumVol := isNewPeriod ? volume : volume + sumVol[1] // sumSrcSrcVol calculates the dividend of the equation that is later used to calculate the standard deviation sumSrcSrcVol := isNewPeriod ? volume * math.pow(src, 2) : volume * math.pow(src, 2) + sumSrcSrcVol[1] _vwap = sumSrcVol / sumVol variance = sumSrcSrcVol / sumVol - math.pow(_vwap, 2) variance := variance < 0 ? 0 : variance stDev = math.sqrt(variance) lowerBand = _vwap - stDev * stDevMultiplier upperBand = _vwap + stDev * stDevMultiplier [_vwap, lowerBand, upperBand] var anchor = input.string(defval = "Session", title="Anchor Period", options=["Session", "Week", "Month", "Quarter", "Year", "Decade", "Half Decade"], group="VWAP Settings") src = input(title = "Source", defval = hlc3, group="VWAP Settings") hideonDWM = input(false, title="Hide VWAP on 1D or Above", group="VWAP Settings") showBands = input(true, title="Calculate Bands", group="Standard Deviation Bands Settings") showPrevious= input.bool(false, title= "Show Previous ZONES") stdevMult = input.float(1.0, title="DVA", group="Standard Deviation Bands Settings", step= 0.1) stdevMult2 = input.float(2.0, title="DVA+2", group="Standard Deviation Bands Settings", step= 0.1) stdevMult3 = input.float(3.0, title="DVA+3", group="Standard Deviation Bands Settings", step= 0.1) timeChange(period) => ta.change(time(period)) isNewPeriod = switch anchor "Session" => timeChange("D") "Week" => timeChange("W") "Month" => timeChange("M") "Quarter" => timeChange("3M") "Year" => timeChange("12M") "Half Decade" => timeChange("12M") and year % 05 == 0 "Decade" => timeChange("12M") and year % 10 == 0 => false isEsdAnchor = anchor == "Earnings" or anchor == "Dividends" or anchor == "Splits" if na(src[1]) and not isEsdAnchor isNewPeriod := true float vwapValue = na float std = na float upperBandValue = na float lowerBandValue = na float upperBandValue2 = na float lowerBandValue2 = na float upperBandValue3 = na float lowerBandValue3 = na float prevwap = na if not timeframe.isdwm or timeframe.isdwm [_vwap, bottom, top] = computeVWAP(src, isNewPeriod, stdevMult3) vwapValue := _vwap upperBandValue3 := showBands ? top : na lowerBandValue3 := showBands ? bottom : na prevwap:= isNewPeriod? na : _vwap[1] if not timeframe.isdwm or timeframe.isdwm [_vwap, bottom, top] = computeVWAP(src, isNewPeriod, stdevMult2) vwapValue := _vwap upperBandValue2 := showBands ? top : na lowerBandValue2 := showBands ? bottom : na prevwap:= isNewPeriod? na : _vwap[1] if not timeframe.isdwm or timeframe.isdwm [_vwap, bottom, top] = computeVWAP(src, isNewPeriod, stdevMult) vwapValue := _vwap upperBandValue := showBands ? top : na lowerBandValue := showBands ? bottom : na prevwap:= isNewPeriod? na : _vwap[1] //PREVIOUS VALUE AREAS pdvavwap = ta.valuewhen(isNewPeriod, vwapValue[1],0) pdvah = ta.valuewhen(isNewPeriod, upperBandValue[1],0) pdval = ta.valuewhen(isNewPeriod, lowerBandValue[1],0) prvwap= showPrevious? line.new(bar_index[30], pdvavwap, bar_index[0],pdvavwap, extend=extend.both,width= 2 , color=color.rgb(255,111,123,50)):na line.delete(prvwap[1]) prevdvah= showPrevious? line.new(bar_index[30], pdvah, bar_index[0],pdvah, extend=extend.both, width= 2 ,color=color.rgb(255,111,123,50)):na line.delete(prevdvah[1]) prevdval= showPrevious? line.new(bar_index[30], pdval, bar_index[0],pdval, extend=extend.both, width= 2 ,color=color.rgb(255,111,123,50)):na line.delete(prevdval[1]) line.set_style(prvwap, line.style_dashed) line.set_style(prevdvah, line.style_dashed) line.set_style(prevdval, line.style_dashed) //.........................LABELS labelvwap= showPrevious? label.new(bar_index[0], pdvavwap, text="PDVA VWAP",color=color.rgb(255,111,123,75), textcolor=color.rgb(255,255,255,10), textalign=text.align_right,size=size.small):na label.delete(labelvwap[1]) labeldval= showPrevious? label.new(bar_index[0], pdval, text="PDVAL",color=color.rgb(255,111,123,75), textcolor=color.rgb(255,255,255,10), textalign=text.align_right,size=size.small):na label.delete(labeldval[1]) labeldvah= showPrevious? label.new(bar_index[0], pdvah, text="PDVAH",color=color.rgb(255,111,123,75), textcolor=color.rgb(255,255,255,10), textalign=text.align_right,size=size.small):na label.delete(labeldvah[1]) plot(vwapValue, title="VWAP", color= close > vwapValue ? color.green : color.red, linewidth = 2) upperBand = plot(upperBandValue, title="DVAH", color=color.new(color.black,70)) lowerBand = plot(lowerBandValue, title="DVAL", color=color.new(color.black,70)) upper2 = plot(upperBandValue2, title="DVA+2", color=color.new(color.black,70)) lower2 = plot(lowerBandValue2, title="DVA-2", color=color.new(color.black,70)) upper3 = plot(upperBandValue3, title="DVA+3", color=color.new(color.black,70)) lower3 = plot(lowerBandValue3, title="DVA-3", color=color.new(color.black,70)) mu05 = plot(((vwapValue+upperBandValue)/2), title= "middle up 0.5", color= color.rgb(247,79,94,50), style = plot.style_circles) ml05 = plot(((vwapValue+lowerBandValue)/2), title= "middle down 0.5",color= color.rgb(247,79,94,50), style = plot.style_circles) mup2 =plot(((upperBandValue+upperBandValue2)/2), title= "Middle up 1.5",color= color.rgb(247,79,94,50), style = plot.style_circles) mudn2 =plot(((lowerBandValue+lowerBandValue2)/2), title= "Middle down 1.5", color= color.rgb(247,79,94,50), style = plot.style_circles) fill(upperBand, lowerBand, title="Bands Fill", color= showBands ? color.new(color.blue, 85) : na) fill(upper3, upper2, title="Bands Fill", color= showBands ? color.new(color.blue, 85) : na) fill(lower3, lower2, title="Bands Fill", color= showBands ? color.new(color.blue, 85) : na)
ADeXt
https://www.tradingview.com/script/szCtWmAm-ADeXt/
TheBacktestGuy
https://www.tradingview.com/u/TheBacktestGuy/
82
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/ // © wallneradam //@version=5 indicator("ADeXt") // This indicator uses my TaExt library, that can be used in any strategy or study where this indicator needed import wallneradam/TAExt/6 atr_length = input.int(14, "ATR Length", minval=1, group="ATR") atr_ma_type = input.string("RMA", "ATR MA Type", options=['SMA', 'EMA', 'WMA', "VWMA", "RMA", "DEMA", "TEMA", "ZLEMA", "HMA", "ALMA", "LSMA", "JMA"], group="ATR") atr_stdev_length = input.int(100, "STDev Length", minval=1, group="ATR") atr_stdev_mult = input.float(1.0, "STDev Multiplier", minval=0.0, step=0.1, group="ATR") high_src = input.source(high, "Source of High", group="DI") low_src = input.source(low, "Source of Low", group="DI") di_length = input.int(14, "DI Length", minval=1, group="DI") di_ma_type = input.string("RMA", "DI MA Type", options=['SMA', 'EMA', 'WMA', "VWMA", "RMA", "DEMA", "TEMA", "ZLEMA", "HMA", "ALMA", "LSMA", "ATRWSMA", "ATRWEMA", "ATRWRMA", "ATRWWMA", "JMA"], group="DI") di_hist_mult = input.float(2.0, "Histogram Multiplier", minval=0.01, step=0.1, group="DI") adx_length = input.int(14, "ADX Length", minval=1, group="ADX") adx_ma_type = input.string("RMA", "ADX MA Type", options=['SMA', 'EMA', 'WMA', "VWMA", "RMA", "DEMA", "TEMA", "ZLEMA", "HMA", "ALMA", "LSMA", "ATRWSMA", "ATRWEMA", "ATRWRMA", "ATRWWMA", "JMA"], group="ADX") [plus, minus, adx] = TAExt.adx(atr_length=atr_length, atr_ma_type=atr_ma_type, high_src=high_src, low_src=low_src, di_length=di_length, di_ma_type=di_ma_type, adx_length=adx_length, adx_ma_type=adx_ma_type, atr_stdev_length=atr_stdev_length, atr_stdev_mult=atr_stdev_mult) hist = plus - minus hist_color = hist > 0 ? color.new(color.green, 75) : color.new(color.red, 75) plot(plus, color=color.lime, title="+DI", display=display.none) plot(minus, color=color.red, title="-DI", display=display.none) plot(adx, color=color.yellow, title="ADX") plot(math.abs(hist) * di_hist_mult, "Histogram", color=hist_color, style=plot.style_columns) hline(20, "Threshold")