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
Gherkinit Futures Cycle
https://www.tradingview.com/script/iaLqP6dU-Gherkinit-Futures-Cycle/
TheWinterDev
https://www.tradingview.com/u/TheWinterDev/
178
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TheWinterDev //@version=5 indicator(title="Gherkinit Futures Cycle", shorttitle="GFC", overlay=true) //--Constants unix_day = 86400000 cycle_length = 34 + 34 + 15 + 8 // Equals: 91 Calendar Days main_opacity = 50 extra_opacity = 85 visibility_group = "Enable Draw" color_group = "Date Colors" extended_cycle_group = "Extended Cycle Data" extended_cycle_custom_group = "Extended Cycle Customization" doExposure = input(true, "ETF Exposure Dates", group=visibility_group) doRoll = input(true, "CME Roll Dates", group=visibility_group) doExpiration = input(true, "CME Expiration Dates", group=visibility_group) doTPlus = input(true, "T+ From Fail Dates", group=visibility_group) //------------------------- Drawing the past and present ------------------------- //-- Functions getDateInCycle(time_data) => unix_day_offset = time_data - time_tradingday days_elapsed = unix_day_offset / unix_day is_cycle_date = (days_elapsed % cycle_length) == 0 is_cycle_date ? (time >= time_tradingday) and (time <= time_tradingday + unix_day) : na getColoredData(time_data, range_color) => getDateInCycle(time_data) ? range_color : color.new(na, 100) //-- Exposure exposure_color = doExposure ? input(color.new(color.yellow, main_opacity), "Exposure", group=color_group) : color.new(na, 100) exposure_date = timestamp("UTC+11", 2020, 11, 24, 0, 0, 0) // Date of a known exposure date bgcolor(getColoredData(exposure_date, exposure_color)) //-- Roll roll_color = doRoll ? input(color.new(color.orange, main_opacity), "Roll", group=color_group) : color.new(na, 100) roll_date = timestamp("UTC+11", 2020, 12, 10, 0, 0, 0) // Date of a known roll date bgcolor(getColoredData(roll_date, roll_color)) //-- Expiration expiration_color = doExpiration ? input(color.new(color.red, main_opacity), "Expiration", group=color_group) : color.new(na, 100) expiration_date = timestamp("UTC+11", 2020, 12, 18, 0, 0, 0) // Date of a known expiration date bgcolor(getColoredData(expiration_date, expiration_color)) //-- T+ From Fail tplus_color = doTPlus ? input(color.new(color.green, extra_opacity), "T+ From Fail", group=color_group) : color.new(na, 100) tplus1_date = timestamp("UTC+11", 2020, 12, 28, 0, 0, 0) // Date of a known T+ date bgcolor(getColoredData(tplus1_date, tplus_color)) tplus2_date = timestamp("UTC+11", 2021, 1, 13, 0, 0, 0) // Date of a known T+ date bgcolor(getColoredData(tplus2_date, tplus_color)) tplus3_date = timestamp("UTC+11", 2021, 1, 21, 0, 0, 0) // Date of a known T+ date bgcolor(getColoredData(tplus3_date, tplus_color)) tplus4_date = timestamp("UTC+11", 2021, 1, 29, 0, 0, 0) // Date of a known T+ date bgcolor(getColoredData(tplus4_date, tplus_color)) //-------------------- Drawing The Future ;) ------------------------- //-- Variables last_cycle_id = math.floor(((time_tradingday - exposure_date) / unix_day) / cycle_length) extended_cycle_id = input(1, "Future Cycle ID", group=extended_cycle_group) isInfinite = input(true, "Is Line Infinite", group=extended_cycle_custom_group) line_width = input(3, "Line width", group=extended_cycle_custom_group) line_mult = input(1, "Line height multiplier", group=extended_cycle_custom_group) line_height = input(1000, "Line height ($)", group=extended_cycle_custom_group) * line_mult //-- Functions get_extended_date(base_date, extended_id) => base_date + (unix_day * cycle_length) * (last_cycle_id + extended_id) draw_vertical_line(line_date, line_color) => var line ln = isInfinite ? line.new(line_date, low, line_date, high, xloc=xloc.bar_time, color=line_color, width=line_width, extend=extend.both) : line.new(line_date, low-line_height, line_date, high+line_height, xloc=xloc.bar_time, color=line_color, width=line_width) line.set_x1(ln, line_date) line.set_x2(ln, line_date) //-- Drawing if extended_cycle_id != 0 if barstate.islast draw_vertical_line(get_extended_date(exposure_date, extended_cycle_id), exposure_color) draw_vertical_line(get_extended_date(roll_date, extended_cycle_id), roll_color) draw_vertical_line(get_extended_date(expiration_date, extended_cycle_id), expiration_color) draw_vertical_line(get_extended_date(tplus1_date, extended_cycle_id), tplus_color) draw_vertical_line(get_extended_date(tplus2_date, extended_cycle_id), tplus_color) draw_vertical_line(get_extended_date(tplus3_date, extended_cycle_id), tplus_color) // ----------------- // - Pickle 4 Life - // -----------------
Auto S/R v2
https://www.tradingview.com/script/MrtXV0I0-Auto-S-R-v2/
GM_Trades
https://www.tradingview.com/u/GM_Trades/
193
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © GM_Trades //@version=5 indicator("Auto S/R v2", overlay = true) supportresistance_tf = input.timeframe(defval='', title='S/R Timeframe', inline='1', group='S/R Settings') sr_closeness = input.float(defval=5.00, step=0.25, minval=0, maxval=10, title='S/R Spacer', inline='2', group='S/R Settings') sr_lines = input.int(20, title = 'Number of S/R Lines', inline = '3', minval = 5, maxval =50, group = 'S/R Settings') show_label = input.bool(true, title = "Show S/R Line Price Labels", inline = '4', group = 'S/R Settings') sr_color = input.color(color.new(color.gray,0), title='S/R Color', inline='5', group='S/R Settings') getLineValue(srcHigh, srcLow, strength) => pivotLow = ta.pivotlow(srcLow, strength, strength) levelLow = ta.valuewhen(pivotLow, srcLow[strength], 1) atr_value = ta.atr(200) * sr_closeness [pivotLow, levelLow,atr_value ] [is_bull_fractal, low_level, atr_value] = request.security(syminfo.tickerid, supportresistance_tf, getLineValue(high, low, 5)) //Delete all Lines and labels allLines = line.all alllabels = label.all if barstate.islast and array.size(allLines) > 0 for i = 0 to array.size(allLines) - 1 line.delete(array.get(allLines, i)) if barstate.islast and array.size(alllabels) > 0 for i = 0 to array.size(alllabels) - 1 label.delete(array.get(alllabels, i)) drawSR(key_levels, atr_value, line_color) => for i = 0 to sr_lines/2 by 1 support_level = key_levels - (atr_value * i) line s_line = line.new(x1=bar_index[1], x2=bar_index, y1=support_level, y2=support_level, xloc=xloc.bar_index, width=6, color=color.new(line_color,88), extend=extend.both) resistance_level = key_levels + (atr_value * (i+1)) line r_line = line.new(x1=bar_index[1], x2=bar_index, y1=resistance_level, y2=resistance_level, xloc=xloc.bar_index, width=6, color=color.new(line_color,88), extend=extend.both) if show_label label s_label = label.new(x=bar_index + 70, y=support_level, xloc=xloc.bar_index, yloc=yloc.price, text=str.tostring(support_level, format.mintick), textcolor=color.new(line_color,0) ,style=label.style_none, color=color.white, textalign=text.align_right, size=size.normal) label r_label = label.new(x=bar_index + 70, y=resistance_level, xloc=xloc.bar_index, yloc=yloc.price, text=str.tostring(resistance_level, format.mintick), textcolor=color.new(line_color,0) ,style=label.style_none, color=color.white, textalign=text.align_right, size=size.normal) drawSR(low_level, atr_value, sr_color)
Beakdoo swing trading box
https://www.tradingview.com/script/m0J66Py7-Beakdoo-swing-trading-box/
traderbaekdoosan
https://www.tradingview.com/u/traderbaekdoosan/
138
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © traderbaekdoosan //@version=5 indicator("Beakdoo swing trading box", overlay=true) AA=high[1]>ta.highest(close[2], 20) // cross up highest close till preday with Period 20 or 60 // starting point of 5 kiss or crossup 20 eavg BB=(close> ta.ema(close, 5)) or ta.crossover(close, ta.ema(close,20)) BBB=BB or BB[1] or BB[2] // crossup highest volume CC=volume[1]>ta.highest(volume[2], 20) CCC=CC or CC[1] or CC[2] // neg candle (or tail) // buy signal DD=open>close and close<(math.abs(close[1]-open[1])*2/3+math.min(close[1],open[1])) //support eavg(c, 20) //lower bound EE= math.max(ta.ema(close, 5), ta.ema(close,20)) FF=(close>(ta.highest(high[25],9)+ta.lowest(low[25],9)+ta.highest(high[25],26)+ta.lowest(low[25],26))/4 ) and (close>(ta.highest(high[25],52)+ta.lowest(low[25],52))/2) condition=AA and BBB and CCC and DD and FF line1=ta.valuewhen(condition, (math.abs(close[1]-open[1])*2/3+math.min(close[1], open[1])), 1) line2=ta.valuewhen(condition, math.max((math.abs(close[1]-open[1])*2/3+math.min(close[1], open[1]))*0.95, EE), 1) p11=plot(line1, color=color.new(color.orange, 20), title='upper box') p22=plot(line2, color=color.new(color.orange, 20), title='bottom box') fill(p11, p22, color=color.new(color.orange, 20))
Jeges Jigs
https://www.tradingview.com/script/3yRaRb0l-Jeges-Jigs/
Troptrap
https://www.tradingview.com/u/Troptrap/
178
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/ // © mildSnail31034 //@version=4 study("Jeges Jigs", overlay=true, max_bars_back=500) ATR = atr(14) showma = input (title="Plot Moving Average?", type=input.bool,defval=true) MAtype = input(title="MA type", defval="SMA", options=["EMA","SMA","ZLEMA","HMA","VWMA","SWMA","WMA","RMA"]) maperiod = input(title="What MA period defines trend", type=input.integer, defval=400,minval=1) zlema(source,period) => EMA1= ema(source,period) EMA2= ema(EMA1,period) Difference= EMA1 - EMA2 ZLEMA = EMA1 + Difference ZLEMA ZLEMA = zlema(close,maperiod) HMA = hma(close,maperiod) WMA = wma(close,maperiod) RMA = rma(close,maperiod) VWMA = vwma(close,maperiod) SWMA = swma(close) EMA = ema(close,maperiod) SMA = sma(close,maperiod) ma1 = sma(close, 1) MA = SMA if (MAtype=="ZLEMA") MA:=ZLEMA if (MAtype=="EMA") MA:=EMA if (MAtype=="HMA") MA:=HMA if (MAtype=="WMA") MA:=WMA if (MAtype=="VWMA") MA:=VWMA if (MAtype=="SWMA") MA:=SWMA if (MAtype=="RMA") MA:=RMA showBB = input(title="Apply Bollinger Bands to MA?", type=input.bool, defval=true) BBmult = input (title = "BB Std Dev",type=input.integer, defval=2, minval=0.001, maxval=50) dev = BBmult * stdev(close, maperiod) upperBB = MA + dev lowerBB = MA - dev showBB1 = input(title="Show other bands", type=input.bool, defval=true) BBmult1 = input (title = "BB Std Dev",type=input.integer, defval=1, minval=0.001, maxval=50) dev1 = BBmult1 * stdev(close, maperiod) upperBB1 = MA + dev1 lowerBB1 = MA - dev1 showBB2 = input(title="Show other bands", type=input.bool, defval=false) BBmult2 = input (title = "BB Std Dev",type=input.integer, defval=3, minval=0.001, maxval=50) dev2 = BBmult2 * stdev(close, maperiod) upperBB2 = MA + dev2 lowerBB2 = MA - dev2 showBBhilo = input(title="Highlight hi/lo BB breaks", type=input.bool,defval=true) lookback = input(title="Lookback period for ATR spike(bars)", type=input.integer,defval=300, minval=5) // Make inputs for length of highest high and lowest low hiLen = input(title="Highest High Lookback (near ATR spike)", type=input.integer, defval=15, minval=0) loLen = input(title="Lowest Low Lookback(near ATR spike)", type=input.integer, defval=15, minval=0) filterbyvol = input(title="Filter by high volume (Experimental, may break things)", type=input.bool,defval=false) volmaperiod = input(title="Volume MA period", type=input.integer, defval=50, minval=1) volma = sma(volume, volmaperiod) volmult = input(title="High volume (default 1.1x the average)", type=input.float, defval=1.1, minval=1) showatrpeak = input(title="Highlight ATR peak areas?", type=input.bool, defval=true) var float xhi = na var float xlo = na var label labelHi = na var label labelLo = na Bup = showBBhilo and crossover(ma1,upperBB) Bupp = showBBhilo and ma1 > upperBB Bdn = showBBhilo and crossunder(ma1,lowerBB) Bdnn = showBBhilo and ma1 < lowerBB if Bup xhi := high labelHi := label.new(bar_index, na, "▼", yloc = yloc.abovebar, color = #000000,textcolor = color.lime, style = label.style_none) else if Bdn xlo := low labelLo := label.new(bar_index,na, "▲", yloc =yloc.belowbar,color = #000000, textcolor = color.red, style =label.style_none) if Bupp and high>xhi xhi := high label.set_xy(labelHi,bar_index,na) else if Bdnn and low<xlo xlo := low label.set_xy(labelLo,bar_index,na) hb=abs(highestbars(ATR,lookback)) atrpeak=ATR[hb] hiHighs = high[hb] loLows = low[hb] hiHighsvol= if (close[hb]>MA[hb] and volume[hb]>volmult*volma[hb]) highest(high, hiLen)[hb+1] else na loLowsvol=if (close[hb]<MA[hb] and volume[hb]>volmult*volma[hb]) lowest(low,loLen)[hb+1] else na hiHighsnovol = if (close[hb]>MA[hb]) highest(high, hiLen)[hb+1] else na loLowsnovol = if (close[hb]<MA[hb]) lowest(low, loLen)[hb+1] else na if (filterbyvol==true) hiHighs := hiHighsvol loLows := loLowsvol else hiHighs := hiHighsnovol loLows := loLowsnovol MULT1 = input(title="ATR Multiplier 1", type=input.float, defval=3) MULT2 = input(title="ATR Multiplier 2", type=input.float, defval=9) MULT3 = input(title="ATR Multiplier 3", type=input.float, defval=27) U1=hiHighs+atrpeak*MULT1 U2=hiHighs+atrpeak*MULT2 U3=hiHighs+atrpeak*MULT3 L1=loLows-atrpeak*MULT1 L2=loLows-atrpeak*MULT2 L3=loLows-atrpeak*MULT3 showsar = input(title="Show Parabolic SAR", type=input.bool, defval=true) showzigzagsar = input(title="Show Zigzag SAR", type=input.bool, defval=true) start = input(title="SAR Start", type=input.float, step=0.001,defval=0.02) increment = input(title="SAR increment", type=input.float, step=0.001,defval=0.02) maxsar = input(title="SAR max", type=input.float, step=0.01, defval=0.2) psar = sar(start,increment, maxsar) dir = psar<close ? 1 : -1 sarcolor = dir==1 ? color.red : color.green plotsar = plot(showsar ? psar : na, title= "PSAR", style=plot.style_circles, color=sarcolor, linewidth=2 ) // Plot values for visual confirmation peakcolor = showatrpeak and hb==false ? color.rgb(233,0,118,90) : na bgcolor(peakcolor, title="ATR peak bg color") plot(series=U1,title="Mark up 1",style=plot.style_circles,show_last=1,color=color.red,linewidth=2) plot(series=U2,title="Mark up 2", style=plot.style_circles, show_last=1, color=color.red,linewidth=3) plot(series=U3,title="Mark up 3", style=plot.style_circles, show_last=1, color=color.red,linewidth=4) plot(series=L1,title="Mark down 1", style=plot.style_circles, show_last=1, color=color.green,linewidth=2) plot(series=L2,title="Mark down 2",style=plot.style_circles, show_last=1, color=color.green,linewidth=3) plot(series=L3,title="Mark down 3", style=plot.style_circles, show_last=1, color=color.green,linewidth=4) plot(series=loLows,style=plot.style_circles,show_last=1, color=color.teal, linewidth=1, title="Lowest Low") plot(series=hiHighs, style=plot.style_circles,show_last=1, color=color.fuchsia, linewidth=1, title="Highest High") plot(showma ? MA : na, style=plot.style_line,color=color.blue, linewidth=2, title="MA") uz = plot(showma and showBB ? upperBB : na, color=color.gray, linewidth=1,title="Upper BB line") lz = plot(showma and showBB ? lowerBB : na, color=color.gray, linewidth=1,title="Lower BB line") uz1 = plot(showma and showBB1 ? upperBB1 : na, color=color.gray, linewidth=1,title="Upper BB line") lz1 = plot(showma and showBB1 ? lowerBB1 : na, color=color.gray, linewidth=1,title="Lower BB line") uz2 = plot(showma and showBB2 ? upperBB2 : na, color=color.gray, linewidth=1,title="Upper BB line") lz2 = plot(showma and showBB2 ? lowerBB2 : na, color=color.gray, linewidth=1,title="Lower BB line") color fillcolor = color.rgb(0,212,188,95) fill(uz,lz, title="BB fill",color=fillcolor) showmtfsar = input(title="Show multi timeframe SAR levels", type=input.bool, defval=true) lbloff = input(title="Labels offset(bars)", type=input.integer,defval=3,minval=0) sar1 = security(syminfo.tickerid,"1",psar) sar5 = security(syminfo.tickerid,"5",psar) sar15 = security(syminfo.tickerid,"15",psar) sar60 = security(syminfo.tickerid,"60",psar) sar4hr = security(syminfo.tickerid,"240",psar) sarD = security(syminfo.tickerid,"D",psar) sarW = security(syminfo.tickerid,"W",psar) sarM = security(syminfo.tickerid,"M",psar) bullcolor = input(title="SAR MTF bull color",type=input.color,defval=color.green) bearcolor = input(title="SAR MTF bear color",type=input.color,defval=color.red) sar1lvl = input(title="Show 1m level",type=input.bool,defval=true) sar1line = input(title="Show 1m line",type=input.bool,defval=false) sar1color = sar1[0]>close ? bearcolor:bullcolor plot(showmtfsar and sar1lvl and sar1line ? sar1:na,show_last=1,offset=3,linewidth=2,trackprice=true,color=sar1color,title="1m SAR") plotshape(showmtfsar and sar1lvl?sar1:na,style=shape.cross ,location=location.absolute,offset=lbloff,show_last=1,text="1m",color=sar1color,title="1m SAR") sar5lvl = input(title="Show 5m level",type=input.bool,defval=true) sar5line = input(title="Show 5m line",type=input.bool,defval=false) sar5color = sar5[0]>close ? bearcolor:bullcolor plot(showmtfsar and sar5lvl and sar5line ? sar5:na,show_last=1,offset=3,linewidth=2,trackprice=true,color=sar5color,title="5m SAR") plotshape(showmtfsar and sar5lvl?sar5:na,style=shape.cross ,location=location.absolute,offset=lbloff,show_last=1,text="5m",color=sar5color,title="5m SAR") sar15lvl = input(title="Show 15m level",type=input.bool,defval=true) sar15line = input(title="Show 15m line",type=input.bool,defval=false) sar15color = sar15[0]>close ? bearcolor:bullcolor plot(showmtfsar and sar15lvl and sar15line ? sar15:na,show_last=1,offset=3,linewidth=2,trackprice=true,color=sar15color,title="15m SAR") plotshape(showmtfsar and sar15lvl?sar15:na,style=shape.cross ,location=location.absolute,offset=lbloff,show_last=1,text="15m",color=sar15color,title="15m SAR") sar60lvl = input(title="Show 1hr level",type=input.bool,defval=true) sar60line = input(title="Show 1hr line",type=input.bool,defval=false) sar60color = sar60[0]>close ? bearcolor:bullcolor plot(showmtfsar and sar60lvl and sar60line ? sar60:na,show_last=1,offset=3,linewidth=2,trackprice=true,color=sar60color,title="1hr SAR") plotshape(showmtfsar and sar60lvl?sar60:na,style=shape.cross ,location=location.absolute,offset=lbloff,show_last=1,text="1hr",color=sar60color,title="1hr SAR") sar4hrlvl = input(title="Show 4hrs level",type=input.bool,defval=true) sar4hrline = input(title="Show 4hrs line",type=input.bool,defval=false) sar4hrcolor = sar4hr[0]>close ? bearcolor:bullcolor plot(showmtfsar and sar4hrlvl and sar4hrline ? sar4hr:na,show_last=1,offset=3,linewidth=2,trackprice=true,color=sar4hrcolor,title="4hr SAR") plotshape(showmtfsar and sar4hrlvl?sar4hr:na,style=shape.cross ,location=location.absolute,offset=lbloff,show_last=1,text="4h",color=sar4hrcolor,title="4hr SAR") sarDlvl = input(title="Show daily level",type=input.bool,defval=true) sarDline = input(title="Show daily line",type=input.bool,defval=false) sarDcolor = sarD[0]>close ? bearcolor:bullcolor plot(showmtfsar and sarDlvl and sarDline ? sarD:na,show_last=1,offset=3,linewidth=2,trackprice=true,color=sarDcolor,title="Daily SAR") plotshape(showmtfsar and sarDlvl?sarD:na,style=shape.cross ,location=location.absolute,offset=lbloff,show_last=1,text="D",color=sarDcolor,title="Daily SAR") sarWlvl = input(title="Show weekly level",type=input.bool,defval=true) sarWline = input(title="Show weekly line",type=input.bool,defval=false) sarWcolor = sarW[0]>close ? bearcolor:bullcolor plot(showmtfsar and sarWlvl and sarWline ? sarW:na,show_last=1,offset=3,linewidth=2,trackprice=true,color=sarWcolor,title="Weekly SAR") plotshape(showmtfsar and sarWlvl?sarW:na,style=shape.cross ,location=location.absolute,offset=lbloff,show_last=1,text="W",color=sarWcolor,title="Weekly SAR") sarMlvl = input(title="Show monthly level",type=input.bool,defval=true) sarMline = input(title="Show monthly line",type=input.bool,defval=false) sarMcolor = sarM[0]>close ? bearcolor:bullcolor plot(showmtfsar and sarMlvl and sarMline ? sarM:na,show_last=1,offset=3,linewidth=2,trackprice=true,color=sarMcolor,title="Monthly SAR") plotshape(showmtfsar and sarMlvl?sarM:na,style=shape.cross ,location=location.absolute,offset=lbloff,show_last=1,text="M",color=sarMcolor,title="Monthly SAR") dirz = psar<close ? true : false up = dirz and dirz[1]==false dn = dirz==false and dirz[1] //sarcolor = dirz ? color.green : color.red lineupcolor = input(title="Zigzag up color", defval=color.green) linedncolor = input(title="Zigzag down color", defval=color.red) linewidth = input(title="Zigzag line width",type=input.integer,minval=1,maxval=4,defval=2) //plotsar = plot(showsar ? psar : na, title= "PSAR", style=plot.style_circles, color=sarcolor, linewidth=2 ) var line zzup = na var line zzdn = na var bt1 = 0 var bt2 = 0 var float hi = na var float lo = na if showzigzagsar and up hi :=high bt1 := time zzup := line.new(bt2,lo,bt1,hi,color=lineupcolor, width =linewidth,xloc=xloc.bar_time) if showzigzagsar and dn lo :=low bt2 := time zzdn := line.new(bt1,hi,bt2,lo,color=linedncolor, width=linewidth,xloc=xloc.bar_time) if (showzigzagsar and dirz and high > hi) hi :=high bt1 := time line.set_xy2(zzup,bt1,hi) if (showzigzagsar and dirz==false and low < lo) lo := low bt2 := time line.set_xy2(zzdn,bt2,lo) dummytrendlines = input(false,"==TREND LINES SECTION. ENABLE/DISABLE USING CONTROLS BELOW==") length = input(6, "Period (change this if it doesn't identify highs/lows correctly)", inline = "length") hist1 = input(true,"Lines between 1st pivot and 2nd") hist2 = input(true,"Lines between 2nd pivot and 3rd") hist3 = input(true,"Line between 3rd pivot and 4th") csrc = input(false,"Use Custom Source?", inline = "custom") src = input(close,"Select:", inline = "custom") //color = input("Black", "Line Color:", options=["Black","Red/Green", "White", "Yellow", "Blue"], inline = "custom2") color1 = input(title="Trend up color", defval=color.black) color2 = input(title="Trend down color", defval=color.black) lwidth = input("1", "Line Width:", options=["1", "2", "3", "4"], inline = "custom2") //Conditions upl = pivothigh(iff(csrc,src,high),length,length) dnl = pivotlow(iff(csrc,src,low),length,length) n = bar_index a1 = valuewhen(not na(upl),n,1) b1 = valuewhen(not na(dnl),n,1) a2 = valuewhen(not na(upl),n,0) b2 = valuewhen(not na(dnl),n,0) c1 = valuewhen(not na(upl),n,2) d1 = valuewhen(not na(dnl),n,2) c2 = valuewhen(not na(upl),n,1) d2 = valuewhen(not na(dnl),n,1) e1 = valuewhen(not na(upl),n,3) f1 = valuewhen(not na(dnl),n,3) e2 = valuewhen(not na(upl),n,2) f2 = valuewhen(not na(dnl),n,2) width1 = 1 if lwidth == "1" width1 := 1 if lwidth == "2" width1 := 2 if lwidth == "3" width1 := 3 if lwidth == "4" width1 := 4 line upper1 = hist1 ? line.new(n[n - a1 + length],upl[n - a1],n[n - a2 + length],upl[n - a2], extend=extend.right,color=color1,width=width1) : na line lower1 = hist1 ? line.new(n[n - b1 + length],dnl[n - b1],n[n - b2 + length],dnl[n - b2], extend=extend.right,color=color2,width=width1) : na line.delete(upper1[1]) line.delete(lower1[1]) line upper2 = hist2 ? line.new(n[n - c1 + length],upl[n - c1],n[n - c2 + length],upl[n - c2], extend=extend.right,color=color1,width=width1) : na line lower2 = hist2 ? line.new(n[n - d1 + length],dnl[n - d1],n[n - d2 + length],dnl[n - d2], extend=extend.right,color=color2,width=width1) : na line.delete(upper2[1]) line.delete(lower2[1]) line upper3 = hist3 ? line.new(n[n - e1 + length],upl[n - e1],n[n - e2 + length],upl[n - e2], extend=extend.right,color=color1,width=width1) : na line lower3 = hist3 ? line.new(n[n - f1 + length],dnl[n - f1],n[n - f2 + length],dnl[n - f2], extend=extend.right,color=color2,width=width1) : na line.delete(upper3[1]) line.delete(lower3[1])
All-Time High with Percentage Drops for ETF's and Large Caps
https://www.tradingview.com/script/RMWOiIrP-All-Time-High-with-Percentage-Drops-for-ETF-s-and-Large-Caps/
thacoolbreeze
https://www.tradingview.com/u/thacoolbreeze/
113
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/ // © str1nger //@version=4 study(title="All-time high and percentage drops", shorttitle="ATH % Drops", overlay=true) //////////////////////////////////////////////// //CALCULATE ALL-TIME HIGH AND PERCENTAGE DROPS// //////////////////////////////////////////////// //Best Used for ETF's and Large Cap Stocks/// //ALL-TIME HIGH// var highest = 0.0 var timeframe = "" if (high >= highest ) highest := high minus1pct = (highest*0.99) minus2pct = (highest*0.98) minus3pct = (highest*0.97) minus5pct = (highest*0.95) minus7pct = (highest*0.93) minus10pct = (highest*0.9) minus20pct = (highest*0.8) //PLOT ALL-TIME HIGH// alltimehigh = input(title="Show Alltime High?", type=input.bool, defval=true) ath = alltimehigh ? highest : na plot(ath, show_last=1) //PLOT PERCENTAGE DROPS// percentdrops = input(title="Show percentage drops?", type=input.bool, defval=true) pctdrops1 = percentdrops ? minus1pct : na pctdrops2 = percentdrops ? minus2pct : na pctdrops3 = percentdrops ? minus3pct : na pctdrops5 = percentdrops ? minus5pct : na pctdrops7 = percentdrops ? minus7pct : na pctdrops10 = percentdrops ? minus10pct : na pctdrops20 = percentdrops ? minus20pct : na plot(pctdrops1, title="1% drop", color=color.white, style=plot.style_line, show_last=1) plot(pctdrops2, title="2% drop", color=color.white, style=plot.style_line, show_last=1) plot(pctdrops3, title="3% drop", color=color.white, style=plot.style_line, show_last=1) plot(pctdrops5, title="5% drop", color=color.white, style=plot.style_line, show_last=1) plot(pctdrops7, title="7% drop", color=color.white, style=plot.style_line, show_last=1) plot(pctdrops10, title="10% drop", color=color.white, style=plot.style_line, show_last=1) plot(pctdrops20, title="20% drop", color=color.white, style=plot.style_line, show_last=1) //PRE-MADE ALERTS// alertcondition(condition=crossover(high,highest), title="New ATH", message="There is a new All-time high") alertcondition(condition=crossunder(low,pctdrops1), title="1% Drop!", message="Price has dropped 1% from ATH") alertcondition(condition=crossunder(low,pctdrops2), title="2% Drop!", message="Price has dropped 2% from ATH") alertcondition(condition=crossunder(low,pctdrops3), title="3% Drop!", message="Price has dropped 3% from ATH") alertcondition(condition=crossunder(low,pctdrops5), title="5% Drop!", message="Price has dropped 5% from ATH") alertcondition(condition=crossunder(low,pctdrops7), title="7% Drop!", message="Price has dropped 7% from ATH") alertcondition(condition=crossunder(low,pctdrops10), title="10% Drop!", message="Price has dropped 10% from ATH") alertcondition(condition=crossunder(low,pctdrops20), title="20% Drop!", message="Price has dropped 20% from ATH")
Cavuca Technical Analysis
https://www.tradingview.com/script/OXxE0AgL/
Cavuca-Trader
https://www.tradingview.com/u/Cavuca-Trader/
115
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/ ///\\===============================================================================//\\\ //████████╗██████╗ █████╗ ██████╗ ██╗███╗ ██╗ ██████╗ ██╗ ██╗██╗███████╗██╗ ██╗\\ //╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██║████╗ ██║██╔════╝ ██║ ██║██║██╔════╝██║ ██║\\ // ██║ ██████╔╝███████║██║ ██║██║██╔██╗ ██║██║ ███╗██║ ██║██║█████╗ ██║ █╗ ██║\\ // ██║ ██╔══██╗██╔══██║██║ ██║██║██║╚██╗██║██║ ██║╚██╗ ██╔╝██║██╔══╝ ██║███╗██║\\ // ██║ ██║ ██║██║ ██║██████╔╝██║██║ ╚████║╚██████╔╝ ╚████╔╝ ██║███████╗╚███╔███╔╝\\ // ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═══╝ ╚═╝╚══════╝ ╚══╝╚══╝ \\ //\\==============================================================================//\\ \\ // ----------------------------------------------------------------------------------- \\ // CAVUCA INDICATOR TECHNICAL ANALYSIS: Developed by Cavuca-Trader \\ // ----------------------------------------------------------------------------------- \\ // ................................................................................... \\ // Name : Cavuca Technical Analysis \\ // Surname : Cavuca \\ // Description : Technical Analysis Setup \\ // Info : Signals inputs and outputs through technical coloring \\ // Creation Date : 11/20/2021 \\ // Version TradingView : 4 \\ // ................................................................................... \\ // v1.0 - release = TrandingView = Ok \\ //=====================================================================================\\ // © Cavuca-Trader //@version=4 study(title="Cavuca Technical Analysis",shorttitle="Cavuca", overlay=true) //Parameters for the zigzag length = input(4, title = "High/Low length") h = highest(high, length * 2 + 1) l = lowest(low, length * 2 + 1) f_isMin(len) => l == low[len] f_isMax(len) => h == high[len] //Parameters MMR = input(9, minval=1, title="Fast Moving Average") MMM = input(21, minval=1, title="Moving Average Average") MML = input(200, minval=1, title="Slow Moving Average") src = input(close, title="Source") offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500) //Calculation MM1 = sma(src, MMR) MM2 = sma(src, MMM) MM3 = sma(src, MML) // Calculation for ZigZag var dirUp = false var lastLow = high * 100 var lastHigh = 0.0 var timeLow = bar_index var timeHigh = bar_index var line li = na var topo = 0.0 var fundo = high * 100 f_drawLine() => _li_color = dirUp ? color.teal : color.orange line.new(timeHigh - length, lastHigh, timeLow - length, lastLow, xloc.bar_index, color=_li_color, width=1) if dirUp if (f_isMin(length) and low[length] < lastLow) lastLow := low[length] timeLow := bar_index line.delete(li) li := f_drawLine() if (f_isMax(length) and high[length] > lastLow) lastHigh := high[length] timeHigh := bar_index topo := lastHigh dirUp := false li := f_drawLine() if not dirUp if (f_isMax(length) and high[length] > lastHigh) lastHigh := high[length] timeHigh := bar_index line.delete(li) li := f_drawLine() if f_isMin(length) and low[length] < lastHigh lastLow := low[length] timeLow := bar_index fundo := lastLow dirUp := true li := f_drawLine() if (f_isMax(length) and high[length] > lastLow) lastHigh := high[length] timeHigh := bar_index dirUp := false li := f_drawLine() //Candle coloring rule Dgbar = close>topo Drbar = close<fundo Dwbar = close<topo and close > fundo //Color of candles barcolor(Dgbar ? color.green : na) barcolor(Drbar ? color.red : na) barcolor(Dwbar ? color.white : na) // Plot plot(MM1, color=color.red, title="MMR", offset=offset, linewidth=1) plot(MM2, color=color.blue, title="MMM", offset=offset, linewidth=1) plot(MM3, color=color.white, title="MML", offset=offset, linewidth=1) plot(fundo, color=color.green, title="Fundo", offset=-length, style=plot.style_cross, linewidth=1) plot(topo, color=color.red, title="Topo", offset=-length, style=plot.style_cross, linewidth=1)
Moving Average Panel
https://www.tradingview.com/script/IoFaNt9N-Moving-Average-Panel/
animecummer
https://www.tradingview.com/u/animecummer/
175
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 indicator(title='Moving Average Panel', shorttitle='MA Panel', overlay=true) //Settings src = input.source(close, 'Source', inline='00', group='Calculates if the moving average is increasing for the specified lengths for SMA, EMA, RMA, WMA, VWMA, HMA, EHMA, TEMA, Least Squares, Tillson T3, Arnaud Legoux MA (ALMA), Note: Resolves to "bear" if not enough data.') string i_tableYpos = input.string('bottom', 'Table', inline='01', options=['top', 'middle', 'bottom']) string i_tableXpos = input.string('right', '', inline='01', options=['left', 'center', 'right']) mobilefriendly = input.bool(defval=false, title='Mobile Friendly?', inline='01') smaon = input.bool(defval=true, title='SMA', inline='10') emaon = input.bool(defval=true, title='EMA', inline='10') rmaon = input.bool(defval=true, title='RMA', inline='10') wmaon = input.bool(defval=true, title='WMA', inline='10') vwmaon = input.bool(defval=true, title='VWMA', inline='10') hmaon = input.bool(defval=true, title='HMA', inline='10') ehmaon = input.bool(defval=true, title='EHMA', inline='11') temaon = input.bool(defval=true, title='TEMA', inline='11') linregon = input.bool(defval=true, title='Least Sq.', inline='11') tillsonon = input.bool(defval=true, title='Tillson T3', inline='11') almaon = input.bool(defval=true, title='ALMA', inline='11') buycolor = input.color(color.new(#6bd673, 0), 'Bull', inline='22') sellcolor = input.color(color.new(#FFCDD2, 0), 'Bear', inline='22') neutralcolor = input.color(color.new(color.silver, 0), 'Neutral', inline='22') texcolor = input.color(color.new(color.black, 0), 'Text', inline='22') len1on = input.bool(defval=true, title='', inline='50') len1=input(5, inline='50') len2on = input.bool(defval=true, title='', inline='50') len2=input(9, inline='50') len3on = input.bool(defval=true, title='', inline='51') len3=input(12, inline='51') len4on = input.bool(defval=true, title='', inline='51') len4=input(15, inline='51') len5on = input.bool(defval=true, title='', inline='52') len5=input(18, inline='52') len6on = input.bool(defval=true, title='', inline='52') len6=input(21, inline='52') len7on = input.bool(defval=true, title='', inline='53') len7=input(26, inline='53') len8on = input.bool(defval=true, title='', inline='53') len8=input(50, inline='53') len9on = input.bool(defval=true, title='', inline='54') len9=input(100, inline='54') len10on = input.bool(defval=true, title='', inline='54') len10=input(200, inline='54') //special linregoffset = input.int(title='Least Squares Offset', defval=0, inline='11', group='Special MA Settings') a1 = input.float(title='Tillson T3 Volume Factor', defval=0.7, inline='21', step=0.001, group='Special MA Settings') almaoffset = input.float(title='ALMA Offset', defval=0.85, step=0.01, inline='31', group='Special MA Settings') almasigma = input.float(title='Sigma', defval=6, inline='31', group='Special MA Settings') //Functions f_ehma(_Source, _length) => _return = ta.ema(2 * ta.ema(_Source, _length / 2) - ta.ema(_Source, _length), math.round(math.sqrt(_length))) _return f_tema(_Source, _length) => _out = 3 * (ta.ema(_Source, _length) - ta.ema(ta.ema(_Source, _length), _length)) + ta.ema(ta.ema(ta.ema(_Source, _length), _length), _length) _out f_tillson(_source, _length, _a1) => _output = (-_a1 * _a1 * _a1) * (ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(_source, _length), _length), _length), _length), _length), _length)) + (3 * _a1 * _a1 + 3 * _a1 * _a1 * _a1) * (ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(_source, _length), _length), _length), _length), _length)) + (-6 * _a1 * _a1 - 3 * _a1 - 3 * _a1 * _a1 * _a1) * (ta.ema(ta.ema(ta.ema(ta.ema(_source, _length), _length), _length), _length)) + (1 + 3 * _a1 + _a1 * _a1 * _a1 + 3 * _a1 * _a1) * (ta.ema(ta.ema(ta.ema(_source, _length), _length), _length)) _output //moving averages sma1=ta.sma(src,len1) sma2=ta.sma(src,len2) sma3=ta.sma(src,len3) sma4=ta.sma(src,len4) sma5=ta.sma(src,len5) sma6=ta.sma(src,len6) sma7=ta.sma(src,len7) sma8=ta.sma(src,len8) sma9=ta.sma(src,len9) sma10=ta.sma(src,len10) ema1=ta.ema(src,len1) ema2=ta.ema(src,len2) ema3=ta.ema(src,len3) ema4=ta.ema(src,len4) ema5=ta.ema(src,len5) ema6=ta.ema(src,len6) ema7=ta.ema(src,len7) ema8=ta.ema(src,len8) ema9=ta.ema(src,len9) ema10=ta.ema(src,len10) rma1=ta.rma(src,len1) rma2=ta.rma(src,len2) rma3=ta.rma(src,len3) rma4=ta.rma(src,len4) rma5=ta.rma(src,len5) rma6=ta.rma(src,len6) rma7=ta.rma(src,len7) rma8=ta.rma(src,len8) rma9=ta.rma(src,len9) rma10=ta.rma(src,len10) wma1=ta.wma(src,len1) wma2=ta.wma(src,len2) wma3=ta.wma(src,len3) wma4=ta.wma(src,len4) wma5=ta.wma(src,len5) wma6=ta.wma(src,len6) wma7=ta.wma(src,len7) wma8=ta.wma(src,len8) wma9=ta.wma(src,len9) wma10=ta.wma(src,len10) vwma1=ta.vwma(src,len1) vwma2=ta.vwma(src,len2) vwma3=ta.vwma(src,len3) vwma4=ta.vwma(src,len4) vwma5=ta.vwma(src,len5) vwma6=ta.vwma(src,len6) vwma7=ta.vwma(src,len7) vwma8=ta.vwma(src,len8) vwma9=ta.vwma(src,len9) vwma10=ta.vwma(src,len10) hma1=ta.hma(src,len1) hma2=ta.hma(src,len2) hma3=ta.hma(src,len3) hma4=ta.hma(src,len4) hma5=ta.hma(src,len5) hma6=ta.hma(src,len6) hma7=ta.hma(src,len7) hma8=ta.hma(src,len8) hma9=ta.hma(src,len9) hma10=ta.hma(src,len10) ehma1=f_ehma(src,len1) ehma2=f_ehma(src,len2) ehma3=f_ehma(src,len3) ehma4=f_ehma(src,len4) ehma5=f_ehma(src,len5) ehma6=f_ehma(src,len6) ehma7=f_ehma(src,len7) ehma8=f_ehma(src,len8) ehma9=f_ehma(src,len9) ehma10=f_ehma(src,len10) tema1=f_tema(src,len1) tema2=f_tema(src,len2) tema3=f_tema(src,len3) tema4=f_tema(src,len4) tema5=f_tema(src,len5) tema6=f_tema(src,len6) tema7=f_tema(src,len7) tema8=f_tema(src,len8) tema9=f_tema(src,len9) tema10=f_tema(src,len10) tillson1=f_tillson(src,len1,a1) tillson2=f_tillson(src,len2,a1) tillson3=f_tillson(src,len3,a1) tillson4=f_tillson(src,len4,a1) tillson5=f_tillson(src,len5,a1) tillson6=f_tillson(src,len6,a1) tillson7=f_tillson(src,len7,a1) tillson8=f_tillson(src,len8,a1) tillson9=f_tillson(src,len9,a1) tillson10=f_tillson(src,len10,a1) linreg1=ta.linreg(src,len1,linregoffset) linreg2=ta.linreg(src,len2,linregoffset) linreg3=ta.linreg(src,len3,linregoffset) linreg4=ta.linreg(src,len4,linregoffset) linreg5=ta.linreg(src,len5,linregoffset) linreg6=ta.linreg(src,len6,linregoffset) linreg7=ta.linreg(src,len7,linregoffset) linreg8=ta.linreg(src,len8,linregoffset) linreg9=ta.linreg(src,len9,linregoffset) linreg10=ta.linreg(src,len10,linregoffset) alma1=ta.alma(src,len1,almaoffset,almasigma) alma2=ta.alma(src,len2,almaoffset,almasigma) alma3=ta.alma(src,len3,almaoffset,almasigma) alma4=ta.alma(src,len4,almaoffset,almasigma) alma5=ta.alma(src,len5,almaoffset,almasigma) alma6=ta.alma(src,len6,almaoffset,almasigma) alma7=ta.alma(src,len7,almaoffset,almasigma) alma8=ta.alma(src,len8,almaoffset,almasigma) alma9=ta.alma(src,len9,almaoffset,almasigma) alma10=ta.alma(src,len10,almaoffset,almasigma) //logic smacounter1 = sma1 >= sma1[1] ? '+' : '-' smacounter2 = sma2 >= sma2[1] ? '+' : '-' smacounter3 = sma3 >= sma3[1] ? '+' : '-' smacounter4 = sma4 >= sma4[1] ? '+' : '-' smacounter5 = sma5 >= sma5[1] ? '+' : '-' smacounter6 = sma6 >= sma6[1] ? '+' : '-' smacounter7 = sma7 >= sma7[1] ? '+' : '-' smacounter8 = sma8 >= sma8[1] ? '+' : '-' smacounter9 = sma9 >= sma9[1] ? '+' : '-' smacounter10 = sma10 >= sma10[1] ? '+' : '-' smacolor1 = smacounter1 == '+' ? buycolor : sellcolor smacolor2 = smacounter2 == '+' ? buycolor : sellcolor smacolor3 = smacounter3 == '+' ? buycolor : sellcolor smacolor4 = smacounter4 == '+' ? buycolor : sellcolor smacolor5 = smacounter5 == '+' ? buycolor : sellcolor smacolor6 = smacounter6 == '+' ? buycolor : sellcolor smacolor7 = smacounter7 == '+' ? buycolor : sellcolor smacolor8 = smacounter8 == '+' ? buycolor : sellcolor smacolor9 = smacounter9 == '+' ? buycolor : sellcolor smacolor10 = smacounter10 == '+' ? buycolor : sellcolor emacounter1 = ema1 >= ema1[1] ? '+' : '-' emacounter2 = ema2 >= ema2[1] ? '+' : '-' emacounter3 = ema3 >= ema3[1] ? '+' : '-' emacounter4 = ema4 >= ema4[1] ? '+' : '-' emacounter5 = ema5 >= ema5[1] ? '+' : '-' emacounter6 = ema6 >= ema6[1] ? '+' : '-' emacounter7 = ema7 >= ema7[1] ? '+' : '-' emacounter8 = ema8 >= ema8[1] ? '+' : '-' emacounter9 = ema9 >= ema9[1] ? '+' : '-' emacounter10 = ema10 >= ema10[1] ? '+' : '-' emacolor1 = emacounter1 == '+' ? buycolor : sellcolor emacolor2 = emacounter2 == '+' ? buycolor : sellcolor emacolor3 = emacounter3 == '+' ? buycolor : sellcolor emacolor4 = emacounter4 == '+' ? buycolor : sellcolor emacolor5 = emacounter5 == '+' ? buycolor : sellcolor emacolor6 = emacounter6 == '+' ? buycolor : sellcolor emacolor7 = emacounter7 == '+' ? buycolor : sellcolor emacolor8 = emacounter8 == '+' ? buycolor : sellcolor emacolor9 = emacounter9 == '+' ? buycolor : sellcolor emacolor10 = emacounter10 == '+' ? buycolor : sellcolor rmacounter1 = rma1 >= rma1[1] ? '+' : '-' rmacounter2 = rma2 >= rma2[1] ? '+' : '-' rmacounter3 = rma3 >= rma3[1] ? '+' : '-' rmacounter4 = rma4 >= rma4[1] ? '+' : '-' rmacounter5 = rma5 >= rma5[1] ? '+' : '-' rmacounter6 = rma6 >= rma6[1] ? '+' : '-' rmacounter7 = rma7 >= rma7[1] ? '+' : '-' rmacounter8 = rma8 >= rma8[1] ? '+' : '-' rmacounter9 = rma9 >= rma9[1] ? '+' : '-' rmacounter10 = rma10 >= rma10[1] ? '+' : '-' rmacolor1 = rmacounter1 == '+' ? buycolor : sellcolor rmacolor2 = rmacounter2 == '+' ? buycolor : sellcolor rmacolor3 = rmacounter3 == '+' ? buycolor : sellcolor rmacolor4 = rmacounter4 == '+' ? buycolor : sellcolor rmacolor5 = rmacounter5 == '+' ? buycolor : sellcolor rmacolor6 = rmacounter6 == '+' ? buycolor : sellcolor rmacolor7 = rmacounter7 == '+' ? buycolor : sellcolor rmacolor8 = rmacounter8 == '+' ? buycolor : sellcolor rmacolor9 = rmacounter9 == '+' ? buycolor : sellcolor rmacolor10 = rmacounter10 == '+' ? buycolor : sellcolor wmacounter1 = wma1 >= wma1[1] ? '+' : '-' wmacounter2 = wma2 >= wma2[1] ? '+' : '-' wmacounter3 = wma3 >= wma3[1] ? '+' : '-' wmacounter4 = wma4 >= wma4[1] ? '+' : '-' wmacounter5 = wma5 >= wma5[1] ? '+' : '-' wmacounter6 = wma6 >= wma6[1] ? '+' : '-' wmacounter7 = wma7 >= wma7[1] ? '+' : '-' wmacounter8 = wma8 >= wma8[1] ? '+' : '-' wmacounter9 = wma9 >= wma9[1] ? '+' : '-' wmacounter10 = wma10 >= wma10[1] ? '+' : '-' wmacolor1 = wmacounter1 == '+' ? buycolor : sellcolor wmacolor2 = wmacounter2 == '+' ? buycolor : sellcolor wmacolor3 = wmacounter3 == '+' ? buycolor : sellcolor wmacolor4 = wmacounter4 == '+' ? buycolor : sellcolor wmacolor5 = wmacounter5 == '+' ? buycolor : sellcolor wmacolor6 = wmacounter6 == '+' ? buycolor : sellcolor wmacolor7 = wmacounter7 == '+' ? buycolor : sellcolor wmacolor8 = wmacounter8 == '+' ? buycolor : sellcolor wmacolor9 = wmacounter9 == '+' ? buycolor : sellcolor wmacolor10 = wmacounter10 == '+' ? buycolor : sellcolor vwmacounter1 = vwma1 >= vwma1[1] ? '+' : '-' vwmacounter2 = vwma2 >= vwma2[1] ? '+' : '-' vwmacounter3 = vwma3 >= vwma3[1] ? '+' : '-' vwmacounter4 = vwma4 >= vwma4[1] ? '+' : '-' vwmacounter5 = vwma5 >= vwma5[1] ? '+' : '-' vwmacounter6 = vwma6 >= vwma6[1] ? '+' : '-' vwmacounter7 = vwma7 >= vwma7[1] ? '+' : '-' vwmacounter8 = vwma8 >= vwma8[1] ? '+' : '-' vwmacounter9 = vwma9 >= vwma9[1] ? '+' : '-' vwmacounter10 = vwma10 >= vwma10[1] ? '+' : '-' vwmacolor1 = vwmacounter1 == '+' ? buycolor : sellcolor vwmacolor2 = vwmacounter2 == '+' ? buycolor : sellcolor vwmacolor3 = vwmacounter3 == '+' ? buycolor : sellcolor vwmacolor4 = vwmacounter4 == '+' ? buycolor : sellcolor vwmacolor5 = vwmacounter5 == '+' ? buycolor : sellcolor vwmacolor6 = vwmacounter6 == '+' ? buycolor : sellcolor vwmacolor7 = vwmacounter7 == '+' ? buycolor : sellcolor vwmacolor8 = vwmacounter8 == '+' ? buycolor : sellcolor vwmacolor9 = vwmacounter9 == '+' ? buycolor : sellcolor vwmacolor10 = vwmacounter10 == '+' ? buycolor : sellcolor hmacounter1 = hma1 >= hma1[1] ? '+' : '-' hmacounter2 = hma2 >= hma2[1] ? '+' : '-' hmacounter3 = hma3 >= hma3[1] ? '+' : '-' hmacounter4 = hma4 >= hma4[1] ? '+' : '-' hmacounter5 = hma5 >= hma5[1] ? '+' : '-' hmacounter6 = hma6 >= hma6[1] ? '+' : '-' hmacounter7 = hma7 >= hma7[1] ? '+' : '-' hmacounter8 = hma8 >= hma8[1] ? '+' : '-' hmacounter9 = hma9 >= hma9[1] ? '+' : '-' hmacounter10 = hma10 >= hma10[1] ? '+' : '-' hmacolor1 = hmacounter1 == '+' ? buycolor : sellcolor hmacolor2 = hmacounter2 == '+' ? buycolor : sellcolor hmacolor3 = hmacounter3 == '+' ? buycolor : sellcolor hmacolor4 = hmacounter4 == '+' ? buycolor : sellcolor hmacolor5 = hmacounter5 == '+' ? buycolor : sellcolor hmacolor6 = hmacounter6 == '+' ? buycolor : sellcolor hmacolor7 = hmacounter7 == '+' ? buycolor : sellcolor hmacolor8 = hmacounter8 == '+' ? buycolor : sellcolor hmacolor9 = hmacounter9 == '+' ? buycolor : sellcolor hmacolor10 = hmacounter10 == '+' ? buycolor : sellcolor ehmacounter1 = ehma1 >= ehma1[1] ? '+' : '-' ehmacounter2 = ehma2 >= ehma2[1] ? '+' : '-' ehmacounter3 = ehma3 >= ehma3[1] ? '+' : '-' ehmacounter4 = ehma4 >= ehma4[1] ? '+' : '-' ehmacounter5 = ehma5 >= ehma5[1] ? '+' : '-' ehmacounter6 = ehma6 >= ehma6[1] ? '+' : '-' ehmacounter7 = ehma7 >= ehma7[1] ? '+' : '-' ehmacounter8 = ehma8 >= ehma8[1] ? '+' : '-' ehmacounter9 = ehma9 >= ehma9[1] ? '+' : '-' ehmacounter10 = ehma10 >= ehma10[1] ? '+' : '-' ehmacolor1 = ehmacounter1 == '+' ? buycolor : sellcolor ehmacolor2 = ehmacounter2 == '+' ? buycolor : sellcolor ehmacolor3 = ehmacounter3 == '+' ? buycolor : sellcolor ehmacolor4 = ehmacounter4 == '+' ? buycolor : sellcolor ehmacolor5 = ehmacounter5 == '+' ? buycolor : sellcolor ehmacolor6 = ehmacounter6 == '+' ? buycolor : sellcolor ehmacolor7 = ehmacounter7 == '+' ? buycolor : sellcolor ehmacolor8 = ehmacounter8 == '+' ? buycolor : sellcolor ehmacolor9 = ehmacounter9 == '+' ? buycolor : sellcolor ehmacolor10 = ehmacounter10 == '+' ? buycolor : sellcolor temacounter1 = tema1 >= tema1[1] ? '+' : '-' temacounter2 = tema2 >= tema2[1] ? '+' : '-' temacounter3 = tema3 >= tema3[1] ? '+' : '-' temacounter4 = tema4 >= tema4[1] ? '+' : '-' temacounter5 = tema5 >= tema5[1] ? '+' : '-' temacounter6 = tema6 >= tema6[1] ? '+' : '-' temacounter7 = tema7 >= tema7[1] ? '+' : '-' temacounter8 = tema8 >= tema8[1] ? '+' : '-' temacounter9 = tema9 >= tema9[1] ? '+' : '-' temacounter10 = tema10 >= tema10[1] ? '+' : '-' temacolor1 = temacounter1 == '+' ? buycolor : sellcolor temacolor2 = temacounter2 == '+' ? buycolor : sellcolor temacolor3 = temacounter3 == '+' ? buycolor : sellcolor temacolor4 = temacounter4 == '+' ? buycolor : sellcolor temacolor5 = temacounter5 == '+' ? buycolor : sellcolor temacolor6 = temacounter6 == '+' ? buycolor : sellcolor temacolor7 = temacounter7 == '+' ? buycolor : sellcolor temacolor8 = temacounter8 == '+' ? buycolor : sellcolor temacolor9 = temacounter9 == '+' ? buycolor : sellcolor temacolor10 = temacounter10 == '+' ? buycolor : sellcolor tillsoncounter1 = tillson1 >= tillson1[1] ? '+' : '-' tillsoncounter2 = tillson2 >= tillson2[1] ? '+' : '-' tillsoncounter3 = tillson3 >= tillson3[1] ? '+' : '-' tillsoncounter4 = tillson4 >= tillson4[1] ? '+' : '-' tillsoncounter5 = tillson5 >= tillson5[1] ? '+' : '-' tillsoncounter6 = tillson6 >= tillson6[1] ? '+' : '-' tillsoncounter7 = tillson7 >= tillson7[1] ? '+' : '-' tillsoncounter8 = tillson8 >= tillson8[1] ? '+' : '-' tillsoncounter9 = tillson9 >= tillson9[1] ? '+' : '-' tillsoncounter10 = tillson10 >= tillson10[1] ? '+' : '-' tillsoncolor1 = tillsoncounter1 == '+' ? buycolor : sellcolor tillsoncolor2 = tillsoncounter2 == '+' ? buycolor : sellcolor tillsoncolor3 = tillsoncounter3 == '+' ? buycolor : sellcolor tillsoncolor4 = tillsoncounter4 == '+' ? buycolor : sellcolor tillsoncolor5 = tillsoncounter5 == '+' ? buycolor : sellcolor tillsoncolor6 = tillsoncounter6 == '+' ? buycolor : sellcolor tillsoncolor7 = tillsoncounter7 == '+' ? buycolor : sellcolor tillsoncolor8 = tillsoncounter8 == '+' ? buycolor : sellcolor tillsoncolor9 = tillsoncounter9 == '+' ? buycolor : sellcolor tillsoncolor10 = tillsoncounter10 == '+' ? buycolor : sellcolor linregcounter1 = linreg1 >= linreg1[1] ? '+' : '-' linregcounter2 = linreg2 >= linreg2[1] ? '+' : '-' linregcounter3 = linreg3 >= linreg3[1] ? '+' : '-' linregcounter4 = linreg4 >= linreg4[1] ? '+' : '-' linregcounter5 = linreg5 >= linreg5[1] ? '+' : '-' linregcounter6 = linreg6 >= linreg6[1] ? '+' : '-' linregcounter7 = linreg7 >= linreg7[1] ? '+' : '-' linregcounter8 = linreg8 >= linreg8[1] ? '+' : '-' linregcounter9 = linreg9 >= linreg9[1] ? '+' : '-' linregcounter10 = linreg10 >= linreg10[1] ? '+' : '-' linregcolor1 = linregcounter1 == '+' ? buycolor : sellcolor linregcolor2 = linregcounter2 == '+' ? buycolor : sellcolor linregcolor3 = linregcounter3 == '+' ? buycolor : sellcolor linregcolor4 = linregcounter4 == '+' ? buycolor : sellcolor linregcolor5 = linregcounter5 == '+' ? buycolor : sellcolor linregcolor6 = linregcounter6 == '+' ? buycolor : sellcolor linregcolor7 = linregcounter7 == '+' ? buycolor : sellcolor linregcolor8 = linregcounter8 == '+' ? buycolor : sellcolor linregcolor9 = linregcounter9 == '+' ? buycolor : sellcolor linregcolor10 = linregcounter10 == '+' ? buycolor : sellcolor almacounter1 = alma1 >= alma1[1] ? '+' : '-' almacounter2 = alma2 >= alma2[1] ? '+' : '-' almacounter3 = alma3 >= alma3[1] ? '+' : '-' almacounter4 = alma4 >= alma4[1] ? '+' : '-' almacounter5 = alma5 >= alma5[1] ? '+' : '-' almacounter6 = alma6 >= alma6[1] ? '+' : '-' almacounter7 = alma7 >= alma7[1] ? '+' : '-' almacounter8 = alma8 >= alma8[1] ? '+' : '-' almacounter9 = alma9 >= alma9[1] ? '+' : '-' almacounter10 = alma10 >= alma10[1] ? '+' : '-' almacolor1 = almacounter1 == '+' ? buycolor : sellcolor almacolor2 = almacounter2 == '+' ? buycolor : sellcolor almacolor3 = almacounter3 == '+' ? buycolor : sellcolor almacolor4 = almacounter4 == '+' ? buycolor : sellcolor almacolor5 = almacounter5 == '+' ? buycolor : sellcolor almacolor6 = almacounter6 == '+' ? buycolor : sellcolor almacolor7 = almacounter7 == '+' ? buycolor : sellcolor almacolor8 = almacounter8 == '+' ? buycolor : sellcolor almacolor9 = almacounter9 == '+' ? buycolor : sellcolor almacolor10 = almacounter10 == '+' ? buycolor : sellcolor //counting mobile smamobilecounter1 = 0.0 emamobilecounter1 = 0.0 rmamobilecounter1 = 0.0 wmamobilecounter1 = 0.0 vwmamobilecounter1 = 0.0 hmamobilecounter1 = 0.0 ehmamobilecounter1 = 0.0 temamobilecounter1 = 0.0 tillsonmobilecounter1 = 0.0 linregmobilecounter1 = 0.0 almamobilecounter1 = 0.0 smamobilecounter2 = sma2 >= sma2[1] ? smamobilecounter1 + 1 : smamobilecounter1 - 1 smamobilecounter3 = sma3 >= sma3[1] ? smamobilecounter2 + 1 : smamobilecounter2 - 1 smamobilecounter4 = sma4 >= sma4[1] ? smamobilecounter3 + 1 : smamobilecounter3 - 1 smamobilecounter5 = sma5 >= sma5[1] ? smamobilecounter4 + 1 : smamobilecounter4 - 1 smamobilecounter6 = sma6 >= sma6[1] ? smamobilecounter5 + 1 : smamobilecounter5 - 1 smamobilecounter7 = sma7 >= sma7[1] ? smamobilecounter6 + 1 : smamobilecounter6 - 1 smamobilecounter8 = sma8 >= sma8[1] ? smamobilecounter7 + 1 : smamobilecounter7 - 1 smamobilecounter9 = sma9 >= sma9[1] ? smamobilecounter8 + 1 : smamobilecounter8 - 1 smamobilecounter10 = sma10 >= sma10[1] ? smamobilecounter9 + 1 : smamobilecounter9 - 1 smamobilecounter11 = sma1 >= sma1[1] ? smamobilecounter10 + 1 : smamobilecounter10 - 1 emamobilecounter2 = ema2 >= ema2[1] ? emamobilecounter1 + 1 : emamobilecounter1 - 1 emamobilecounter3 = ema3 >= ema3[1] ? emamobilecounter2 + 1 : emamobilecounter2 - 1 emamobilecounter4 = ema4 >= ema4[1] ? emamobilecounter3 + 1 : emamobilecounter3 - 1 emamobilecounter5 = ema5 >= ema5[1] ? emamobilecounter4 + 1 : emamobilecounter4 - 1 emamobilecounter6 = ema6 >= ema6[1] ? emamobilecounter5 + 1 : emamobilecounter5 - 1 emamobilecounter7 = ema7 >= ema7[1] ? emamobilecounter6 + 1 : emamobilecounter6 - 1 emamobilecounter8 = ema8 >= ema8[1] ? emamobilecounter7 + 1 : emamobilecounter7 - 1 emamobilecounter9 = ema9 >= ema9[1] ? emamobilecounter8 + 1 : emamobilecounter8 - 1 emamobilecounter10 = ema10 >= ema10[1] ? emamobilecounter9 + 1 : emamobilecounter9 - 1 emamobilecounter11 = ema1 >= ema1[1] ? emamobilecounter10 + 1 : emamobilecounter10 - 1 rmamobilecounter2 = rma2 >= rma2[1] ? rmamobilecounter1 + 1 : rmamobilecounter1 - 1 rmamobilecounter3 = rma3 >= rma3[1] ? rmamobilecounter2 + 1 : rmamobilecounter2 - 1 rmamobilecounter4 = rma4 >= rma4[1] ? rmamobilecounter3 + 1 : rmamobilecounter3 - 1 rmamobilecounter5 = rma5 >= rma5[1] ? rmamobilecounter4 + 1 : rmamobilecounter4 - 1 rmamobilecounter6 = rma6 >= rma6[1] ? rmamobilecounter5 + 1 : rmamobilecounter5 - 1 rmamobilecounter7 = rma7 >= rma7[1] ? rmamobilecounter6 + 1 : rmamobilecounter6 - 1 rmamobilecounter8 = rma8 >= rma8[1] ? rmamobilecounter7 + 1 : rmamobilecounter7 - 1 rmamobilecounter9 = rma9 >= rma9[1] ? rmamobilecounter8 + 1 : rmamobilecounter8 - 1 rmamobilecounter10 = rma10 >= rma10[1] ? rmamobilecounter9 + 1 : rmamobilecounter9 - 1 rmamobilecounter11 = rma1 >= rma1[1] ? rmamobilecounter10 + 1 : rmamobilecounter10 - 1 wmamobilecounter2 = wma2 >= wma2[1] ? wmamobilecounter1 + 1 : wmamobilecounter1 - 1 wmamobilecounter3 = wma3 >= wma3[1] ? wmamobilecounter2 + 1 : wmamobilecounter2 - 1 wmamobilecounter4 = wma4 >= wma4[1] ? wmamobilecounter3 + 1 : wmamobilecounter3 - 1 wmamobilecounter5 = wma5 >= wma5[1] ? wmamobilecounter4 + 1 : wmamobilecounter4 - 1 wmamobilecounter6 = wma6 >= wma6[1] ? wmamobilecounter5 + 1 : wmamobilecounter5 - 1 wmamobilecounter7 = wma7 >= wma7[1] ? wmamobilecounter6 + 1 : wmamobilecounter6 - 1 wmamobilecounter8 = wma8 >= wma8[1] ? wmamobilecounter7 + 1 : wmamobilecounter7 - 1 wmamobilecounter9 = wma9 >= wma9[1] ? wmamobilecounter8 + 1 : wmamobilecounter8 - 1 wmamobilecounter10 = wma10 >= wma10[1] ? wmamobilecounter9 + 1 : wmamobilecounter9 - 1 wmamobilecounter11 = wma1 >= wma1[1] ? wmamobilecounter10 + 1 : wmamobilecounter10 - 1 vwmamobilecounter2 = vwma2 >= vwma2[1] ? vwmamobilecounter1 + 1 : vwmamobilecounter1 - 1 vwmamobilecounter3 = vwma3 >= vwma3[1] ? vwmamobilecounter2 + 1 : vwmamobilecounter2 - 1 vwmamobilecounter4 = vwma4 >= vwma4[1] ? vwmamobilecounter3 + 1 : vwmamobilecounter3 - 1 vwmamobilecounter5 = vwma5 >= vwma5[1] ? vwmamobilecounter4 + 1 : vwmamobilecounter4 - 1 vwmamobilecounter6 = vwma6 >= vwma6[1] ? vwmamobilecounter5 + 1 : vwmamobilecounter5 - 1 vwmamobilecounter7 = vwma7 >= vwma7[1] ? vwmamobilecounter6 + 1 : vwmamobilecounter6 - 1 vwmamobilecounter8 = vwma8 >= vwma8[1] ? vwmamobilecounter7 + 1 : vwmamobilecounter7 - 1 vwmamobilecounter9 = vwma9 >= vwma9[1] ? vwmamobilecounter8 + 1 : vwmamobilecounter8 - 1 vwmamobilecounter10 = vwma10 >= vwma10[1] ? vwmamobilecounter9 + 1 : vwmamobilecounter9 - 1 vwmamobilecounter11 = vwma1 >= vwma1[1] ? vwmamobilecounter10 + 1 : vwmamobilecounter10 - 1 hmamobilecounter2 = hma2 >= hma2[1] ? hmamobilecounter1 + 1 : hmamobilecounter1 - 1 hmamobilecounter3 = hma3 >= hma3[1] ? hmamobilecounter2 + 1 : hmamobilecounter2 - 1 hmamobilecounter4 = hma4 >= hma4[1] ? hmamobilecounter3 + 1 : hmamobilecounter3 - 1 hmamobilecounter5 = hma5 >= hma5[1] ? hmamobilecounter4 + 1 : hmamobilecounter4 - 1 hmamobilecounter6 = hma6 >= hma6[1] ? hmamobilecounter5 + 1 : hmamobilecounter5 - 1 hmamobilecounter7 = hma7 >= hma7[1] ? hmamobilecounter6 + 1 : hmamobilecounter6 - 1 hmamobilecounter8 = hma8 >= hma8[1] ? hmamobilecounter7 + 1 : hmamobilecounter7 - 1 hmamobilecounter9 = hma9 >= hma9[1] ? hmamobilecounter8 + 1 : hmamobilecounter8 - 1 hmamobilecounter10 = hma10 >= hma10[1] ? hmamobilecounter9 + 1 : hmamobilecounter9 - 1 hmamobilecounter11 = hma1 >= hma1[1] ? hmamobilecounter10 + 1 : hmamobilecounter10 - 1 ehmamobilecounter2 = ehma2 >= ehma2[1] ? ehmamobilecounter1 + 1 : ehmamobilecounter1 - 1 ehmamobilecounter3 = ehma3 >= ehma3[1] ? ehmamobilecounter2 + 1 : ehmamobilecounter2 - 1 ehmamobilecounter4 = ehma4 >= ehma4[1] ? ehmamobilecounter3 + 1 : ehmamobilecounter3 - 1 ehmamobilecounter5 = ehma5 >= ehma5[1] ? ehmamobilecounter4 + 1 : ehmamobilecounter4 - 1 ehmamobilecounter6 = ehma6 >= ehma6[1] ? ehmamobilecounter5 + 1 : ehmamobilecounter5 - 1 ehmamobilecounter7 = ehma7 >= ehma7[1] ? ehmamobilecounter6 + 1 : ehmamobilecounter6 - 1 ehmamobilecounter8 = ehma8 >= ehma8[1] ? ehmamobilecounter7 + 1 : ehmamobilecounter7 - 1 ehmamobilecounter9 = ehma9 >= ehma9[1] ? ehmamobilecounter8 + 1 : ehmamobilecounter8 - 1 ehmamobilecounter10 = ehma10 >= ehma10[1] ? ehmamobilecounter9 + 1 : ehmamobilecounter9 - 1 ehmamobilecounter11 = ehma1 >= ehma1[1] ? ehmamobilecounter10 + 1 : ehmamobilecounter10 - 1 temamobilecounter2 = tema2 >= tema2[1] ? temamobilecounter1 + 1 : temamobilecounter1 - 1 temamobilecounter3 = tema3 >= tema3[1] ? temamobilecounter2 + 1 : temamobilecounter2 - 1 temamobilecounter4 = tema4 >= tema4[1] ? temamobilecounter3 + 1 : temamobilecounter3 - 1 temamobilecounter5 = tema5 >= tema5[1] ? temamobilecounter4 + 1 : temamobilecounter4 - 1 temamobilecounter6 = tema6 >= tema6[1] ? temamobilecounter5 + 1 : temamobilecounter5 - 1 temamobilecounter7 = tema7 >= tema7[1] ? temamobilecounter6 + 1 : temamobilecounter6 - 1 temamobilecounter8 = tema8 >= tema8[1] ? temamobilecounter7 + 1 : temamobilecounter7 - 1 temamobilecounter9 = tema9 >= tema9[1] ? temamobilecounter8 + 1 : temamobilecounter8 - 1 temamobilecounter10 = tema10 >= tema10[1] ? temamobilecounter9 + 1 : temamobilecounter9 - 1 temamobilecounter11 = tema1 >= tema1[1] ? temamobilecounter10 + 1 : temamobilecounter10 - 1 tillsonmobilecounter2 = tillson2 >= tillson2[1] ? tillsonmobilecounter1 + 1 : tillsonmobilecounter1 - 1 tillsonmobilecounter3 = tillson3 >= tillson3[1] ? tillsonmobilecounter2 + 1 : tillsonmobilecounter2 - 1 tillsonmobilecounter4 = tillson4 >= tillson4[1] ? tillsonmobilecounter3 + 1 : tillsonmobilecounter3 - 1 tillsonmobilecounter5 = tillson5 >= tillson5[1] ? tillsonmobilecounter4 + 1 : tillsonmobilecounter4 - 1 tillsonmobilecounter6 = tillson6 >= tillson6[1] ? tillsonmobilecounter5 + 1 : tillsonmobilecounter5 - 1 tillsonmobilecounter7 = tillson7 >= tillson7[1] ? tillsonmobilecounter6 + 1 : tillsonmobilecounter6 - 1 tillsonmobilecounter8 = tillson8 >= tillson8[1] ? tillsonmobilecounter7 + 1 : tillsonmobilecounter7 - 1 tillsonmobilecounter9 = tillson9 >= tillson9[1] ? tillsonmobilecounter8 + 1 : tillsonmobilecounter8 - 1 tillsonmobilecounter10 = tillson10 >= tillson10[1] ? tillsonmobilecounter9 + 1 : tillsonmobilecounter9 - 1 tillsonmobilecounter11 = tillson1 >= tillson1[1] ? tillsonmobilecounter10 + 1 : tillsonmobilecounter10 - 1 linregmobilecounter2 = linreg2 >= linreg2[1] ? linregmobilecounter1 + 1 : linregmobilecounter1 - 1 linregmobilecounter3 = linreg3 >= linreg3[1] ? linregmobilecounter2 + 1 : linregmobilecounter2 - 1 linregmobilecounter4 = linreg4 >= linreg4[1] ? linregmobilecounter3 + 1 : linregmobilecounter3 - 1 linregmobilecounter5 = linreg5 >= linreg5[1] ? linregmobilecounter4 + 1 : linregmobilecounter4 - 1 linregmobilecounter6 = linreg6 >= linreg6[1] ? linregmobilecounter5 + 1 : linregmobilecounter5 - 1 linregmobilecounter7 = linreg7 >= linreg7[1] ? linregmobilecounter6 + 1 : linregmobilecounter6 - 1 linregmobilecounter8 = linreg8 >= linreg8[1] ? linregmobilecounter7 + 1 : linregmobilecounter7 - 1 linregmobilecounter9 = linreg9 >= linreg9[1] ? linregmobilecounter8 + 1 : linregmobilecounter8 - 1 linregmobilecounter10 = linreg10 >= linreg10[1] ? linregmobilecounter9 + 1 : linregmobilecounter9 - 1 linregmobilecounter11 = linreg1 >= linreg1[1] ? linregmobilecounter10 + 1 : linregmobilecounter10 - 1 almamobilecounter2 = alma2 >= alma2[1] ? almamobilecounter1 + 1 : almamobilecounter1 - 1 almamobilecounter3 = alma3 >= alma3[1] ? almamobilecounter2 + 1 : almamobilecounter2 - 1 almamobilecounter4 = alma4 >= alma4[1] ? almamobilecounter3 + 1 : almamobilecounter3 - 1 almamobilecounter5 = alma5 >= alma5[1] ? almamobilecounter4 + 1 : almamobilecounter4 - 1 almamobilecounter6 = alma6 >= alma6[1] ? almamobilecounter5 + 1 : almamobilecounter5 - 1 almamobilecounter7 = alma7 >= alma7[1] ? almamobilecounter6 + 1 : almamobilecounter6 - 1 almamobilecounter8 = alma8 >= alma8[1] ? almamobilecounter7 + 1 : almamobilecounter7 - 1 almamobilecounter9 = alma9 >= alma9[1] ? almamobilecounter8 + 1 : almamobilecounter8 - 1 almamobilecounter10 = alma10 >= alma10[1] ? almamobilecounter9 + 1 : almamobilecounter9 - 1 almamobilecounter11 = alma1 >= alma1[1] ? almamobilecounter10 + 1 : almamobilecounter10 - 1 //mobilescores smamobilescore = smamobilecounter11 emamobilescore = emamobilecounter11 rmamobilescore = rmamobilecounter11 wmamobilescore = wmamobilecounter11 vwmamobilescore = vwmamobilecounter11 hmamobilescore = hmamobilecounter11 ehmamobilescore = ehmamobilecounter11 temamobilescore = temamobilecounter11 tillsonmobilescore = tillsonmobilecounter11 linregmobilescore = linregmobilecounter11 almamobilescore = almamobilecounter11 //mobile table color logic smacolor = if smamobilescore > 0 buycolor else if smamobilescore < 0 sellcolor else neutralcolor emacolor = if emamobilescore > 0 buycolor else if emamobilescore < 0 sellcolor else neutralcolor rmacolor = if rmamobilescore > 0 buycolor else if rmamobilescore < 0 sellcolor else neutralcolor wmacolor = if wmamobilescore > 0 buycolor else if wmamobilescore < 0 sellcolor else neutralcolor vwmacolor = if vwmamobilescore > 0 buycolor else if vwmamobilescore < 0 sellcolor else neutralcolor hmacolor = if hmamobilescore > 0 buycolor else if hmamobilescore < 0 sellcolor else neutralcolor ehmacolor = if ehmamobilescore > 0 buycolor else if ehmamobilescore < 0 sellcolor else neutralcolor temacolor = if temamobilescore > 0 buycolor else if temamobilescore < 0 sellcolor else neutralcolor tillsoncolor = if tillsonmobilescore > 0 buycolor else if tillsonmobilescore < 0 sellcolor else neutralcolor linregcolor = if linregmobilescore > 0 buycolor else if linregmobilescore < 0 sellcolor else neutralcolor almacolor = if almamobilescore > 0 buycolor else if almamobilescore < 0 sellcolor else neutralcolor //table panel mobile ncolumns = mobilefriendly == true ? 2 : 11 var table panel = table.new(i_tableYpos + '_' + i_tableXpos, ncolumns, 12) if barstate.islast and mobilefriendly == true table.cell(panel, 0, 0, 'MA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 0, '# Bull', text_color=texcolor, bgcolor=neutralcolor) if smaon == true table.cell(panel, 0, 1, 'SMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 1, str.tostring(smamobilescore), text_color=texcolor, bgcolor = smacolor) if emaon == true table.cell(panel, 0, 2, 'EMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 2, str.tostring(emamobilescore), text_color=texcolor, bgcolor = emacolor) if rmaon == true table.cell(panel, 0, 3, 'RMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 3, str.tostring(rmamobilescore), text_color=texcolor, bgcolor = rmacolor) if wmaon == true table.cell(panel, 0, 4, 'WMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 4, str.tostring(wmamobilescore), text_color=texcolor, bgcolor = wmacolor) if vwmaon == true table.cell(panel, 0, 5, 'VWMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 5, str.tostring(vwmamobilescore), text_color=texcolor, bgcolor = vwmacolor) if hmaon == true table.cell(panel, 0, 6, 'HMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 6, str.tostring(hmamobilescore), text_color=texcolor, bgcolor = hmacolor) if ehmaon == true table.cell(panel, 0, 7, 'EHMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 7, str.tostring(ehmamobilescore), text_color=texcolor, bgcolor = ehmacolor) if temaon == true table.cell(panel, 0, 8, 'TEMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 8, str.tostring(temamobilescore), text_color=texcolor, bgcolor = temacolor) if tillsonon == true table.cell(panel, 0, 9, 'Tillson T3', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 9, str.tostring(tillsonmobilescore), text_color=texcolor, bgcolor = tillsoncolor) if linregon == true table.cell(panel, 0, 10, 'LSMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 10, str.tostring(linregmobilescore), text_color=texcolor, bgcolor = linregcolor) if almaon == true table.cell(panel, 0, 11, 'ALMA', text_color=texcolor, bgcolor=neutralcolor) table.cell(panel, 1, 11, str.tostring(almamobilescore), text_color=texcolor, bgcolor = almacolor) else if barstate.islast and mobilefriendly == false table.cell(panel, 0, 0, 'MA', text_color=texcolor, bgcolor=neutralcolor) if len1on == true table.cell(panel, 1, 0, str.tostring(len1), text_color=texcolor, bgcolor=neutralcolor) if len2on == true table.cell(panel, 2, 0, str.tostring(len2), text_color=texcolor, bgcolor=neutralcolor) if len3on == true table.cell(panel, 3, 0, str.tostring(len3), text_color=texcolor, bgcolor=neutralcolor) if len4on == true table.cell(panel, 4, 0, str.tostring(len4), text_color=texcolor, bgcolor=neutralcolor) if len5on == true table.cell(panel, 5, 0, str.tostring(len5), text_color=texcolor, bgcolor=neutralcolor) if len6on == true table.cell(panel, 6, 0, str.tostring(len6), text_color=texcolor, bgcolor=neutralcolor) if len7on == true table.cell(panel, 7, 0, str.tostring(len7), text_color=texcolor, bgcolor=neutralcolor) if len8on == true table.cell(panel, 8, 0, str.tostring(len8), text_color=texcolor, bgcolor=neutralcolor) if len9on == true table.cell(panel, 9, 0, str.tostring(len9), text_color=texcolor, bgcolor=neutralcolor) if len10on == true table.cell(panel, 10, 0, str.tostring(len10), text_color=texcolor, bgcolor=neutralcolor) if smaon == true table.cell(panel, 0,1, 'SMA', text_color=texcolor, bgcolor=neutralcolor) if smaon == true and len1on == true table.cell(panel, 1,1, str.tostring(smacounter1), text_color=texcolor, bgcolor = smacolor1) if smaon == true and len2on == true table.cell(panel, 2,1, str.tostring(smacounter2), text_color=texcolor, bgcolor = smacolor2) if smaon == true and len3on == true table.cell(panel, 3,1, str.tostring(smacounter3), text_color=texcolor, bgcolor = smacolor3) if smaon == true and len4on == true table.cell(panel, 4,1, str.tostring(smacounter4), text_color=texcolor, bgcolor = smacolor4) if smaon == true and len5on == true table.cell(panel, 5,1, str.tostring(smacounter5), text_color=texcolor, bgcolor = smacolor5) if smaon == true and len6on == true table.cell(panel, 6,1, str.tostring(smacounter6), text_color=texcolor, bgcolor = smacolor6) if smaon == true and len7on == true table.cell(panel, 7,1, str.tostring(smacounter7), text_color=texcolor, bgcolor = smacolor7) if smaon == true and len8on == true table.cell(panel, 8,1, str.tostring(smacounter8), text_color=texcolor, bgcolor = smacolor8) if smaon == true and len9on == true table.cell(panel, 9,1, str.tostring(smacounter9), text_color=texcolor, bgcolor = smacolor9) if smaon == true and len10on == true table.cell(panel, 10,1, str.tostring(smacounter10), text_color=texcolor, bgcolor = smacolor10) if emaon == true table.cell(panel, 0,2, 'EMA', text_color=texcolor, bgcolor=neutralcolor) if emaon == true and len1on == true table.cell(panel, 1,2, str.tostring(emacounter1), text_color=texcolor, bgcolor = emacolor1) if emaon == true and len2on == true table.cell(panel, 2,2, str.tostring(emacounter2), text_color=texcolor, bgcolor = emacolor2) if emaon == true and len3on == true table.cell(panel, 3,2, str.tostring(emacounter3), text_color=texcolor, bgcolor = emacolor3) if emaon == true and len4on == true table.cell(panel, 4,2, str.tostring(emacounter4), text_color=texcolor, bgcolor = emacolor4) if emaon == true and len5on == true table.cell(panel, 5,2, str.tostring(emacounter5), text_color=texcolor, bgcolor = emacolor5) if emaon == true and len6on == true table.cell(panel, 6,2, str.tostring(emacounter6), text_color=texcolor, bgcolor = emacolor6) if emaon == true and len7on == true table.cell(panel, 7,2, str.tostring(emacounter7), text_color=texcolor, bgcolor = emacolor7) if emaon == true and len8on == true table.cell(panel, 8,2, str.tostring(emacounter8), text_color=texcolor, bgcolor = emacolor8) if emaon == true and len9on == true table.cell(panel, 9,2, str.tostring(emacounter9), text_color=texcolor, bgcolor = emacolor9) if emaon == true and len10on == true table.cell(panel, 10,2, str.tostring(emacounter10), text_color=texcolor, bgcolor = emacolor10) if rmaon == true table.cell(panel, 0,3, 'RMA/SMMA', text_color=texcolor, bgcolor=neutralcolor) if rmaon == true and len1on == true table.cell(panel, 1,3, str.tostring(rmacounter1), text_color=texcolor, bgcolor = rmacolor1) if rmaon == true and len2on == true table.cell(panel, 2,3, str.tostring(rmacounter2), text_color=texcolor, bgcolor = rmacolor2) if rmaon == true and len3on == true table.cell(panel, 3,3, str.tostring(rmacounter3), text_color=texcolor, bgcolor = rmacolor3) if rmaon == true and len4on == true table.cell(panel, 4,3, str.tostring(rmacounter4), text_color=texcolor, bgcolor = rmacolor4) if rmaon == true and len5on == true table.cell(panel, 5,3, str.tostring(rmacounter5), text_color=texcolor, bgcolor = rmacolor5) if rmaon == true and len6on == true table.cell(panel, 6,3, str.tostring(rmacounter6), text_color=texcolor, bgcolor = rmacolor6) if rmaon == true and len7on == true table.cell(panel, 7,3, str.tostring(rmacounter7), text_color=texcolor, bgcolor = rmacolor7) if rmaon == true and len8on == true table.cell(panel, 8,3, str.tostring(rmacounter8), text_color=texcolor, bgcolor = rmacolor8) if rmaon == true and len9on == true table.cell(panel, 9,3, str.tostring(rmacounter9), text_color=texcolor, bgcolor = rmacolor9) if rmaon == true and len10on == true table.cell(panel, 10,3, str.tostring(rmacounter10), text_color=texcolor, bgcolor = rmacolor10) if wmaon == true table.cell(panel, 0,4, 'WMA', text_color=texcolor, bgcolor=neutralcolor) if wmaon == true and len1on == true table.cell(panel, 1,4, str.tostring(wmacounter1), text_color=texcolor, bgcolor = wmacolor1) if wmaon == true and len2on == true table.cell(panel, 2,4, str.tostring(wmacounter2), text_color=texcolor, bgcolor = wmacolor2) if wmaon == true and len3on == true table.cell(panel, 3,4, str.tostring(wmacounter3), text_color=texcolor, bgcolor = wmacolor3) if wmaon == true and len4on == true table.cell(panel, 4,4, str.tostring(wmacounter4), text_color=texcolor, bgcolor = wmacolor4) if wmaon == true and len5on == true table.cell(panel, 5,4, str.tostring(wmacounter5), text_color=texcolor, bgcolor = wmacolor5) if wmaon == true and len6on == true table.cell(panel, 6,4, str.tostring(wmacounter6), text_color=texcolor, bgcolor = wmacolor6) if wmaon == true and len7on == true table.cell(panel, 7,4, str.tostring(wmacounter7), text_color=texcolor, bgcolor = wmacolor7) if wmaon == true and len8on == true table.cell(panel, 8,4, str.tostring(wmacounter8), text_color=texcolor, bgcolor = wmacolor8) if wmaon == true and len9on == true table.cell(panel, 9,4, str.tostring(wmacounter9), text_color=texcolor, bgcolor = wmacolor9) if wmaon == true and len10on == true table.cell(panel, 10,4, str.tostring(wmacounter10), text_color=texcolor, bgcolor = wmacolor10) if vwmaon == true table.cell(panel, 0,5, 'VWMA', text_color=texcolor, bgcolor=neutralcolor) if vwmaon == true and len1on == true table.cell(panel, 1,5, str.tostring(vwmacounter1), text_color=texcolor, bgcolor = vwmacolor1) if vwmaon == true and len2on == true table.cell(panel, 2,5, str.tostring(vwmacounter2), text_color=texcolor, bgcolor = vwmacolor2) if vwmaon == true and len3on == true table.cell(panel, 3,5, str.tostring(vwmacounter3), text_color=texcolor, bgcolor = vwmacolor3) if vwmaon == true and len4on == true table.cell(panel, 4,5, str.tostring(vwmacounter4), text_color=texcolor, bgcolor = vwmacolor4) if vwmaon == true and len5on == true table.cell(panel, 5,5, str.tostring(vwmacounter5), text_color=texcolor, bgcolor = vwmacolor5) if vwmaon == true and len6on == true table.cell(panel, 6,5, str.tostring(vwmacounter6), text_color=texcolor, bgcolor = vwmacolor6) if vwmaon == true and len7on == true table.cell(panel, 7,5, str.tostring(vwmacounter7), text_color=texcolor, bgcolor = vwmacolor7) if vwmaon == true and len8on == true table.cell(panel, 8,5, str.tostring(vwmacounter8), text_color=texcolor, bgcolor = vwmacolor8) if vwmaon == true and len9on == true table.cell(panel, 9,5, str.tostring(vwmacounter9), text_color=texcolor, bgcolor = vwmacolor9) if vwmaon == true and len10on == true table.cell(panel, 10,5, str.tostring(vwmacounter10), text_color=texcolor, bgcolor = vwmacolor10) if hmaon == true table.cell(panel, 0,6, 'HMA', text_color=texcolor, bgcolor=neutralcolor) if hmaon == true and len1on == true table.cell(panel, 1,6, str.tostring(hmacounter1), text_color=texcolor, bgcolor = hmacolor1) if hmaon == true and len2on == true table.cell(panel, 2,6, str.tostring(hmacounter2), text_color=texcolor, bgcolor = hmacolor2) if hmaon == true and len3on == true table.cell(panel, 3,6, str.tostring(hmacounter3), text_color=texcolor, bgcolor = hmacolor3) if hmaon == true and len4on == true table.cell(panel, 4,6, str.tostring(hmacounter4), text_color=texcolor, bgcolor = hmacolor4) if hmaon == true and len5on == true table.cell(panel, 5,6, str.tostring(hmacounter5), text_color=texcolor, bgcolor = hmacolor5) if hmaon == true and len6on == true table.cell(panel, 6,6, str.tostring(hmacounter6), text_color=texcolor, bgcolor = hmacolor6) if hmaon == true and len7on == true table.cell(panel, 7,6, str.tostring(hmacounter7), text_color=texcolor, bgcolor = hmacolor7) if hmaon == true and len8on == true table.cell(panel, 8,6, str.tostring(hmacounter8), text_color=texcolor, bgcolor = hmacolor8) if hmaon == true and len9on == true table.cell(panel, 9,6, str.tostring(hmacounter9), text_color=texcolor, bgcolor = hmacolor9) if hmaon == true and len10on == true table.cell(panel, 10,6, str.tostring(hmacounter10), text_color=texcolor, bgcolor = hmacolor10) if ehmaon == true table.cell(panel, 0,7, 'EHMA', text_color=texcolor, bgcolor=neutralcolor) if ehmaon == true and len1on == true table.cell(panel, 1,7, str.tostring(ehmacounter1), text_color=texcolor, bgcolor = ehmacolor1) if ehmaon == true and len2on == true table.cell(panel, 2,7, str.tostring(ehmacounter2), text_color=texcolor, bgcolor = ehmacolor2) if ehmaon == true and len3on == true table.cell(panel, 3,7, str.tostring(ehmacounter3), text_color=texcolor, bgcolor = ehmacolor3) if ehmaon == true and len4on == true table.cell(panel, 4,7, str.tostring(ehmacounter4), text_color=texcolor, bgcolor = ehmacolor4) if ehmaon == true and len5on == true table.cell(panel, 5,7, str.tostring(ehmacounter5), text_color=texcolor, bgcolor = ehmacolor5) if ehmaon == true and len6on == true table.cell(panel, 6,7, str.tostring(ehmacounter6), text_color=texcolor, bgcolor = ehmacolor6) if ehmaon == true and len7on == true table.cell(panel, 7,7, str.tostring(ehmacounter7), text_color=texcolor, bgcolor = ehmacolor7) if ehmaon == true and len8on == true table.cell(panel, 8,7, str.tostring(ehmacounter8), text_color=texcolor, bgcolor = ehmacolor8) if ehmaon == true and len9on == true table.cell(panel, 9,7, str.tostring(ehmacounter9), text_color=texcolor, bgcolor = ehmacolor9) if ehmaon == true and len10on == true table.cell(panel, 10,7, str.tostring(ehmacounter10), text_color=texcolor, bgcolor = ehmacolor10) if temaon == true table.cell(panel, 0,8, 'TEMA', text_color=texcolor, bgcolor=neutralcolor) if temaon == true and len1on == true table.cell(panel, 1,8, str.tostring(temacounter1), text_color=texcolor, bgcolor = temacolor1) if temaon == true and len2on == true table.cell(panel, 2,8, str.tostring(temacounter2), text_color=texcolor, bgcolor = temacolor2) if temaon == true and len3on == true table.cell(panel, 3,8, str.tostring(temacounter3), text_color=texcolor, bgcolor = temacolor3) if temaon == true and len4on == true table.cell(panel, 4,8, str.tostring(temacounter4), text_color=texcolor, bgcolor = temacolor4) if temaon == true and len5on == true table.cell(panel, 5,8, str.tostring(temacounter5), text_color=texcolor, bgcolor = temacolor5) if temaon == true and len6on == true table.cell(panel, 6,8, str.tostring(temacounter6), text_color=texcolor, bgcolor = temacolor6) if temaon == true and len7on == true table.cell(panel, 7,8, str.tostring(temacounter7), text_color=texcolor, bgcolor = temacolor7) if temaon == true and len8on == true table.cell(panel, 8,8, str.tostring(temacounter8), text_color=texcolor, bgcolor = temacolor8) if temaon == true and len9on == true table.cell(panel, 9,8, str.tostring(temacounter9), text_color=texcolor, bgcolor = temacolor9) if temaon == true and len10on == true table.cell(panel, 10,8, str.tostring(temacounter10), text_color=texcolor, bgcolor = temacolor10) if tillsonon == true table.cell(panel, 0,9, 'Tillson T3', text_color=texcolor, bgcolor=neutralcolor) if tillsonon == true and len1on == true table.cell(panel, 1,9, str.tostring(tillsoncounter1), text_color=texcolor, bgcolor = tillsoncolor1) if tillsonon == true and len2on == true table.cell(panel, 2,9, str.tostring(tillsoncounter2), text_color=texcolor, bgcolor = tillsoncolor2) if tillsonon == true and len3on == true table.cell(panel, 3,9, str.tostring(tillsoncounter3), text_color=texcolor, bgcolor = tillsoncolor3) if tillsonon == true and len4on == true table.cell(panel, 4,9, str.tostring(tillsoncounter4), text_color=texcolor, bgcolor = tillsoncolor4) if tillsonon == true and len5on == true table.cell(panel, 5,9, str.tostring(tillsoncounter5), text_color=texcolor, bgcolor = tillsoncolor5) if tillsonon == true and len6on == true table.cell(panel, 6,9, str.tostring(tillsoncounter6), text_color=texcolor, bgcolor = tillsoncolor6) if tillsonon == true and len7on == true table.cell(panel, 7,9, str.tostring(tillsoncounter7), text_color=texcolor, bgcolor = tillsoncolor7) if tillsonon == true and len8on == true table.cell(panel, 8,9, str.tostring(tillsoncounter8), text_color=texcolor, bgcolor = tillsoncolor8) if tillsonon == true and len9on == true table.cell(panel, 9,9, str.tostring(tillsoncounter9), text_color=texcolor, bgcolor = tillsoncolor9) if tillsonon == true and len10on == true table.cell(panel, 10,9, str.tostring(tillsoncounter10), text_color=texcolor, bgcolor = tillsoncolor10) if linregon == true table.cell(panel, 0,10, 'Least Sq.', text_color=texcolor, bgcolor=neutralcolor) if linregon == true and len1on == true table.cell(panel, 1,10, str.tostring(linregcounter1), text_color=texcolor, bgcolor = linregcolor1) if linregon == true and len2on == true table.cell(panel, 2,10, str.tostring(linregcounter2), text_color=texcolor, bgcolor = linregcolor2) if linregon == true and len3on == true table.cell(panel, 3,10, str.tostring(linregcounter3), text_color=texcolor, bgcolor = linregcolor3) if linregon == true and len4on == true table.cell(panel, 4,10, str.tostring(linregcounter4), text_color=texcolor, bgcolor = linregcolor4) if linregon == true and len5on == true table.cell(panel, 5,10, str.tostring(linregcounter5), text_color=texcolor, bgcolor = linregcolor5) if linregon == true and len6on == true table.cell(panel, 6,10, str.tostring(linregcounter6), text_color=texcolor, bgcolor = linregcolor6) if linregon == true and len7on == true table.cell(panel, 7,10, str.tostring(linregcounter7), text_color=texcolor, bgcolor = linregcolor7) if linregon == true and len8on == true table.cell(panel, 8,10, str.tostring(linregcounter8), text_color=texcolor, bgcolor = linregcolor8) if linregon == true and len9on == true table.cell(panel, 9,10, str.tostring(linregcounter9), text_color=texcolor, bgcolor = linregcolor9) if linregon == true and len10on == true table.cell(panel, 10,10, str.tostring(linregcounter10), text_color=texcolor, bgcolor = linregcolor10) if almaon == true table.cell(panel, 0,11, 'ALMA', text_color=texcolor, bgcolor=neutralcolor) if almaon == true and len1on == true table.cell(panel, 1,11, str.tostring(almacounter1), text_color=texcolor, bgcolor = almacolor1) if almaon == true and len2on == true table.cell(panel, 2,11, str.tostring(almacounter2), text_color=texcolor, bgcolor = almacolor2) if almaon == true and len3on == true table.cell(panel, 3,11, str.tostring(almacounter3), text_color=texcolor, bgcolor = almacolor3) if almaon == true and len4on == true table.cell(panel, 4,11, str.tostring(almacounter4), text_color=texcolor, bgcolor = almacolor4) if almaon == true and len5on == true table.cell(panel, 5,11, str.tostring(almacounter5), text_color=texcolor, bgcolor = almacolor5) if almaon == true and len6on == true table.cell(panel, 6,11, str.tostring(almacounter6), text_color=texcolor, bgcolor = almacolor6) if almaon == true and len7on == true table.cell(panel, 7,11, str.tostring(almacounter7), text_color=texcolor, bgcolor = almacolor7) if almaon == true and len8on == true table.cell(panel, 8,11, str.tostring(almacounter8), text_color=texcolor, bgcolor = almacolor8) if almaon == true and len9on == true table.cell(panel, 9,11, str.tostring(almacounter9), text_color=texcolor, bgcolor = almacolor9) if almaon == true and len10on == true table.cell(panel, 10,11, str.tostring(almacounter10), text_color=texcolor, bgcolor = almacolor10)
Multi-period ROC
https://www.tradingview.com/script/3rzI2SHd-Multi-period-ROC/
swanidhi
https://www.tradingview.com/u/swanidhi/
75
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © swanidhi //@version=5 indicator("Multi-period ROC") s = input(10, "Short Period") m = input(21, "Medium Period") l = input(45, "Long Period") enableOnWeekly = input.bool(false, "Enable on Weekly Charts") rocS = ta.roc(close, 10) rocM = ta.roc(close, 21) rocL = ta.roc(close, 45) goS = ta.roc(close, 10) >0 goM = ta.roc(close, 21) >0 goL = ta.roc(close, 45) >0 bullTrend = goS and goM and goL bgcolor((timeframe.isdaily or (timeframe.isweekly and enableOnWeekly)) and bullTrend?color.new(color.green, 90):na) plot(rocS, "Short Term", color=color.red) plot(rocM, "Medium Term", color=color.purple) plot(rocL, "Long Term", color=color.black) hline(0)
Price Converter WAVAX to USDT.e
https://www.tradingview.com/script/WCDPZehS/
Ondery
https://www.tradingview.com/u/Ondery/
29
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Ondery . //@version=4 study(title="Price Converter WAVAX to USDT.e", shorttitle="WAVAX to USDT.e", overlay=false, precision=4) // symO = security(syminfo.tickerid,"",open) symH = security(syminfo.tickerid,"",high) symL = security(syminfo.tickerid,"",low) symC = security(syminfo.tickerid,"",close) pWAVAXUsdtE = security("PANGOLIN:WAVAXUSDT.e","",close) choice = input(title="Type", defval="CandleStick", options=["CandleStick", "Line"]) linecolor = open < close ? color.green : color.red linecolor2 = open < close ? color.blue : color.maroon CPO = if (syminfo.currency == 'WAVAX' or syminfo.currency == 'AVAX') symO * pWAVAXUsdtE CPH = if (syminfo.currency == 'WAVAX' or syminfo.currency == 'AVAX') symH * pWAVAXUsdtE CPL = if (syminfo.currency == 'WAVAX' or syminfo.currency == 'AVAX') symL * pWAVAXUsdtE CPC = if (syminfo.currency == 'WAVAX' or syminfo.currency == 'AVAX') symC * pWAVAXUsdtE plotcandle(choice == "CandleStick" ? CPO:na, choice == "CandleStick" ? CPH:na, choice == "CandleStick" ? CPL:na, choice == "CandleStick" ? CPC:na, title='Candles', color = open < close ? color.green : color.red, wickcolor=color.black) plot(choice == "Line" ? CPC:na, title="Price", color=#3F812F, linewidth=2, transp=40)
LA_Crpyto_Pirate Modifie VuManChu B Script with Scalping Filters
https://www.tradingview.com/script/zqp0O7lt-LA-Crpyto-Pirate-Modifie-VuManChu-B-Script-with-Scalping-Filters/
LA_Crypto_Pirate
https://www.tradingview.com/u/LA_Crypto_Pirate/
520
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/ // © vumanchu //@version=4 // Thanks to dynausmaux for the code // Thanks to falconCoin for https://www.tradingview.com/script/KVfgBvDd-Market-Cipher-B-Free-version-with-Buy-and-sell/ inspired me to start this. // Thanks to LazyBear for WaveTrend Oscillator https://www.tradingview.com/script/2KE8wTuF-Indicator-WaveTrend-Oscillator-WT/ // Thanks to RicardoSantos for https://www.tradingview.com/script/3oeDh0Yq-RS-Price-Divergence-Detector-V2/ // Thanks to LucemAnb for Plain Stochastic Divergence https://www.tradingview.com/script/FCUgF8ag-Plain-Stochastic-Divergence/ // Thanks to andreholanda73 for MFI+RSI Area https://www.tradingview.com/script/UlGZzUAr/ // I especially want to thank TradingView for its platform that facilitates development and learning. // // CIRCLES & TRIANGLES: // - LITTLE CIRCLE: They appear at all WaveTrend wave crossings. // - GREEN CIRCLE: The wavetrend waves are at the oversold level and have crossed up (bullish). // - RED CIRCLE: The wavetrend waves are at the overbought level and have crossed down (bearish). // - GOLD/ORANGE CIRCLE: When RSI is below 20, WaveTrend waves are below or equal to -80 and have crossed up after good bullish divergence (DONT BUY WHEN GOLD CIRCLE APPEAR). // - None of these circles are certain signs to trade. It is only information that can help you. // - PURPLE TRIANGLE: Appear when a bullish or bearish divergence is formed and WaveTrend waves crosses at overbought and oversold points. // // NOTES: // - I am not an expert trader or know how to program pine script as such, in fact it is my first indicator only to study and all the code is copied and modified from other codes that are published in TradingView. // - I am very grateful to the entire TV community that publishes codes so that other newbies like me can learn and present their results. This is an attempt to imitate Market Cipher B. // - Settings by default are for 4h timeframe, divergences are more stronger and accurate. Haven't tested in all timeframes, only 2h and 4h. // - If you get an interesting result in other timeframes I would be very grateful if you would comment your configuration to implement it or at least check it. // // CONTRIBUTIONS: // - Tip/Idea: Add higher timeframe analysis for bearish/bullish patterns at the current timeframe. // + Bearish/Bullish FLAG: // - MFI+RSI Area are RED (Below 0). // - Wavetrend waves are above 0 and crosses down. // - VWAP Area are below 0 on higher timeframe. // - This pattern reversed becomes bullish. // - Tip/Idea: Check the last heikinashi candle from 2 higher timeframe // + Bearish/Bullish DIAMOND: // - HT Candle is red // - WT > 0 and crossed down study(title = 'VuManChu B Scalp Script with Filters', shorttitle = 'VMC Cipher_B_Scalper') // PARAMETERS { // WaveTrend wtShow = input(true, title = 'Show WaveTrend', type = input.bool) wtBuyShow = input(true, title = 'Show Buy dots', type = input.bool) wtGoldShow = input(false, title = 'Show Gold dots', type = input.bool) wtSellShow = input(true, title = 'Show Sell dots', type = input.bool) wtDivShow = input(false, title = 'Show Div. dots', type = input.bool) vwapShow = input(false, title = 'Show Fast WT', type = input.bool) wtChannelLen = input(9, title = 'WT Channel Length', type = input.integer) wtAverageLen = input(12, title = 'WT Average Length', type = input.integer) wtMASource = input(hlc3, title = 'WT MA Source', type = input.source) wtMALen = input(3, title = 'WT MA Length', type = input.integer) //wtFilter = input(true, title='Use LA Crypto Pitrate Filters', type = input.bool) // WaveTrend Overbought & Oversold lines obLevel = input(53, title = 'WT Overbought Level 1', type = input.integer) obLevel2 = input(60, title = 'WT Overbought Level 2', type = input.integer) obLevel3 = input(100, title = 'WT Overbought Level 3', type = input.integer) osLevel = input(-53, title = 'WT Oversold Level 1', type = input.integer) osLevel2 = input(-60, title = 'WT Oversold Level 2', type = input.integer) osLevel3 = input(-75, title = 'WT Oversold Level 3', type = input.integer) // Divergence WT wtShowDiv = input(false, title = 'Show WT Regular Divergences', type = input.bool) wtShowHiddenDiv = input(false, title = 'Show WT Hidden Divergences', type = input.bool) showHiddenDiv_nl = input(true, title = 'Not apply OB/OS Limits on Hidden Divergences', type = input.bool) wtDivOBLevel = input(45, title = 'WT Bearish Divergence min', type = input.integer) wtDivOSLevel = input(-65, title = 'WT Bullish Divergence min', type = input.integer) // Divergence extra range wtDivOBLevel_addshow = input(false, title = 'Show 2nd WT Regular Divergences', type = input.bool) wtDivOBLevel_add = input(15, title = 'WT 2nd Bearish Divergence', type = input.integer) wtDivOSLevel_add = input(-40, title = 'WT 2nd Bullish Divergence 15 min', type = input.integer) // RSI+MFI rsiMFIShow = input(true, title = 'Show MFI', type = input.bool) rsiMFIperiod = input(60,title = 'MFI Period', type = input.integer) rsiMFIMultiplier = input(250, title = 'MFI Area multiplier', type = input.float) rsiMFIPosY = input(2.5, title = 'MFI Area Y Pos', type = input.float) // RSI rsiShow = input(false, title = 'Show RSI', type = input.bool) rsiSRC = input(close, title = 'RSI Source', type = input.source) rsiLen = input(14, title = 'RSI Length', type = input.integer) rsiOversold = input(30, title = 'RSI Oversold', minval = 50, maxval = 100, type = input.integer) rsiOverbought = input(60, title = 'RSI Overbought', minval = 0, maxval = 50, type = input.integer) // Divergence RSI rsiShowDiv = input(false, title = 'Show RSI Regular Divergences', type = input.bool) rsiShowHiddenDiv = input(false, title = 'Show RSI Hidden Divergences', type = input.bool) rsiDivOBLevel = input(60, title = 'RSI Bearish Divergence min', type = input.integer) rsiDivOSLevel = input(30, title = 'RSI Bullish Divergence min', type = input.integer) // RSI Stochastic stochShow = input(false, title = 'Show Stochastic RSI', type = input.bool) stochUseLog = input(true, title=' Use Log?', type = input.bool) stochAvg = input(false, title='Use Average of both K & D', type = input.bool) stochSRC = input(close, title = 'Stochastic RSI Source', type = input.source) stochLen = input(14, title = 'Stochastic RSI Length', type = input.integer) stochRsiLen = input(14, title = 'RSI Length ', type = input.integer) stochKSmooth = input(3, title = 'Stochastic RSI K Smooth', type = input.integer) stochDSmooth = input(3, title = 'Stochastic RSI D Smooth', type = input.integer) // Divergence stoch stochShowDiv = input(false, title = 'Show Stoch Regular Divergences', type = input.bool) stochShowHiddenDiv = input(false, title = 'Show Stoch Hidden Divergences', type = input.bool) // Schaff Trend Cycle tcLine = input(false, title="Show Schaff TC line", type=input.bool) tcSRC = input(close, title = 'Schaff TC Source', type = input.source) tclength = input(10, title="Schaff TC", type=input.integer) tcfastLength = input(23, title="Schaff TC Fast Lenght", type=input.integer) tcslowLength = input(50, title="Schaff TC Slow Length", type=input.integer) tcfactor = input(0.5, title="Schaff TC Factor", type=input.float) // Sommi Flag sommiFlagShow = input(false, title = 'Show Sommi flag', type = input.bool) sommiShowVwap = input(false, title = 'Show Sommi F. Wave', type = input.bool) sommiVwapTF = input('720', title = 'Sommi F. Wave timeframe', type = input.string) sommiVwapBearLevel = input(0, title = 'F. Wave Bear Level (less than)', type = input.integer) sommiVwapBullLevel = input(0, title = 'F. Wave Bull Level (more than)', type = input.integer) soomiFlagWTBearLevel = input(0, title = 'WT Bear Level (more than)', type = input.integer) soomiFlagWTBullLevel = input(0, title = 'WT Bull Level (less than)', type = input.integer) soomiRSIMFIBearLevel = input(0, title = 'Money flow Bear Level (less than)', type = input.integer) soomiRSIMFIBullLevel = input(0, title = 'Money flow Bull Level (more than)', type = input.integer) // Sommi Diamond sommiDiamondShow = input(false, title = 'Show Sommi diamond', type = input.bool) sommiHTCRes = input('60', title = 'HTF Candle Res. 1', type = input.string) sommiHTCRes2 = input('240', title = 'HTF Candle Res. 2', type = input.string) soomiDiamondWTBearLevel = input(0, title = 'WT Bear Level (More than)', type = input.integer) soomiDiamondWTBullLevel = input(0, title = 'WT Bull Level (Less than)', type = input.integer) // macd Colors macdWTColorsShow = input(false, title = 'Show MACD Colors', type = input.bool) macdWTColorsTF = input('240', title = 'MACD Colors MACD TF', type = input.string) darkMode = input(false, title = 'Dark mode', type = input.bool) // Colors colorRed = #ff0000 colorPurple = #e600e6 colorGreen = #3fff00 colorOrange = #e2a400 colorYellow = #ffe500 colorWhite = #ffffff colorPink = #ff00f0 colorBluelight = #31c0ff colorWT1 = #90caf9 colorWT2 = #0d47a1 colorWT2_ = #131722 colormacdWT1a = #4caf58 colormacdWT1b = #af4c4c colormacdWT1c = #7ee57e colormacdWT1d = #ff3535 colormacdWT2a = #305630 colormacdWT2b = #310101 colormacdWT2c = #132213 colormacdWT2d = #770000 // } PARAMETERS // Get EMAs ema50 = ema(close,50) ema200 = ema(close, 200) //ema50pullback = close > ema50 - (ema50 * 0.05) and close < ema50 + (ema50 * 0.05) //EMA Filters emaLong = close > ema200 emaShort = close < ema200 // FUNCTIONS { // 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 bearDivHidden = fractalTop and high[2] < highPrice and src[2] > highPrev bullDivHidden = fractalBot and low[2] > lowPrice and src[2] < lowPrev [fractalTop, fractalBot, lowPrev, bearSignal, bullSignal, bearDivHidden, bullDivHidden] // RSI+MFI f_rsimfi(_period, _multiplier, _tf) => security(syminfo.tickerid, _tf, sma(((close - open) / (high - low)) * _multiplier, _period) - rsiMFIPosY) // WaveTrend f_wavetrend(src, chlen, avg, malen, tf) => tfsrc = security(syminfo.tickerid, tf, src) esa = ema(tfsrc, chlen) de = ema(abs(tfsrc - esa), chlen) ci = (tfsrc - esa) / (0.015 * de) wt1 = security(syminfo.tickerid, tf, ema(ci, avg)) wt2 = security(syminfo.tickerid, tf, sma(wt1, malen)) wtVwap = wt1 - wt2 wtOversold = wt2 <= osLevel wtOverbought = wt2 >= obLevel wtCross = cross(wt1, wt2) wtCrossUp = wt2 - wt1 <= 0 wtCrossDown = wt2 - wt1 >= 0 wtCrosslast = cross(wt1[2], wt2[2]) wtCrossUplast = wt2[2] - wt1[2] <= 0 wtCrossDownlast = wt2[2] - wt1[2] >= 0 [wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCrosslast, wtCrossUplast, wtCrossDownlast, wtVwap] // Schaff Trend Cycle f_tc(src, length, fastLength, slowLength) => ema1 = ema(src, fastLength) ema2 = ema(src, slowLength) macdVal = ema1 - ema2 alpha = lowest(macdVal, length) beta = highest(macdVal, length) - alpha gamma = (macdVal - alpha) / beta * 100 gamma := beta > 0 ? gamma : nz(gamma[1]) delta = gamma delta := na(delta[1]) ? delta : delta[1] + tcfactor * (gamma - delta[1]) epsilon = lowest(delta, length) zeta = highest(delta, length) - epsilon eta = (delta - epsilon) / zeta * 100 eta := zeta > 0 ? eta : nz(eta[1]) stcReturn = eta stcReturn := na(stcReturn[1]) ? stcReturn : stcReturn[1] + tcfactor * (eta - stcReturn[1]) stcReturn // Stochastic RSI f_stochrsi(_src, _stochlen, _rsilen, _smoothk, _smoothd, _log, _avg) => src = _log ? log(_src) : _src rsi = rsi(src, _rsilen) kk = sma(stoch(rsi, rsi, rsi, _stochlen), _smoothk) d1 = sma(kk, _smoothd) avg_1 = avg(kk, d1) k = _avg ? avg_1 : kk [k, d1] // MACD f_macd(src, fastlen, slowlen, sigsmooth, tf) => fast_ma = security(syminfo.tickerid, tf, ema(src, fastlen)) slow_ma = security(syminfo.tickerid, tf, ema(src, slowlen)) macd = fast_ma - slow_ma, signal = security(syminfo.tickerid, tf, sma(macd, sigsmooth)) hist = macd - signal [macd, signal, hist] // MACD Colors on WT f_macdWTColors(tf) => hrsimfi = f_rsimfi(rsiMFIperiod, rsiMFIMultiplier, tf) [macd, signal, hist] = f_macd(close, 28, 42, 9, macdWTColorsTF) macdup = macd >= signal macddown = macd <= signal macdWT1Color = macdup ? hrsimfi > 0 ? colormacdWT1c : colormacdWT1a : macddown ? hrsimfi < 0 ? colormacdWT1d : colormacdWT1b : na macdWT2Color = macdup ? hrsimfi < 0 ? colormacdWT2c : colormacdWT2a : macddown ? hrsimfi < 0 ? colormacdWT2d : colormacdWT2b : na [macdWT1Color, macdWT2Color] // Get higher timeframe candle f_getTFCandle(_tf) => _open = security(heikinashi(syminfo.tickerid), _tf, open, barmerge.gaps_off, barmerge.lookahead_on) _close = security(heikinashi(syminfo.tickerid), _tf, close, barmerge.gaps_off, barmerge.lookahead_on) _high = security(heikinashi(syminfo.tickerid), _tf, high, barmerge.gaps_off, barmerge.lookahead_on) _low = security(heikinashi(syminfo.tickerid), _tf, low, barmerge.gaps_off, barmerge.lookahead_on) hl2 = (_high + _low) / 2.0 newBar = change(_open) candleBodyDir = _close > _open [candleBodyDir, newBar] // Sommi flag f_findSommiFlag(tf, wt1, wt2, rsimfi, wtCross, wtCrossUp, wtCrossDown) => [hwt1, hwt2, hwtOversold, hwtOverbought, hwtCross, hwtCrossUp, hwtCrossDown, hwtCrosslast, hwtCrossUplast, hwtCrossDownlast, hwtVwap] = f_wavetrend(wtMASource, wtChannelLen, wtAverageLen, wtMALen, tf) bearPattern = rsimfi < soomiRSIMFIBearLevel and wt2 > soomiFlagWTBearLevel and wtCross and wtCrossDown and hwtVwap < sommiVwapBearLevel bullPattern = rsimfi > soomiRSIMFIBullLevel and wt2 < soomiFlagWTBullLevel and wtCross and wtCrossUp and hwtVwap > sommiVwapBullLevel [bearPattern, bullPattern, hwtVwap] f_findSommiDiamond(tf, tf2, wt1, wt2, wtCross, wtCrossUp, wtCrossDown) => [candleBodyDir, newBar] = f_getTFCandle(tf) [candleBodyDir2, newBar2] = f_getTFCandle(tf2) bearPattern = wt2 >= soomiDiamondWTBearLevel and wtCross and wtCrossDown and not candleBodyDir and not candleBodyDir2 bullPattern = wt2 <= soomiDiamondWTBullLevel and wtCross and wtCrossUp and candleBodyDir and candleBodyDir2 [bearPattern, bullPattern] // } FUNCTIONS // CALCULATE INDICATORS { // RSI rsi = rsi(rsiSRC, rsiLen) rsiColor = rsi <= rsiOversold ? colorGreen : rsi >= rsiOverbought ? colorRed : colorPurple // RSI + MFI Area rsiMFI = f_rsimfi(rsiMFIperiod, rsiMFIMultiplier, timeframe.period) rsiMFIColor = rsiMFI > 0 ? #3ee145 : #ff3d2e // Calculates WaveTrend [wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCross_last, wtCrossUp_last, wtCrossDown_last, wtVwap] = f_wavetrend(wtMASource, wtChannelLen, wtAverageLen, wtMALen, timeframe.period) // Stochastic RSI [stochK, stochD] = f_stochrsi(stochSRC, stochLen, stochRsiLen, stochKSmooth, stochDSmooth, stochUseLog, stochAvg) // Schaff Trend Cycle tcVal = f_tc(tcSRC, tclength, tcfastLength, tcslowLength) // Sommi flag [sommiBearish, sommiBullish, hvwap] = f_findSommiFlag(sommiVwapTF, wt1, wt2, rsiMFI, wtCross, wtCrossUp, wtCrossDown) //Sommi diamond [sommiBearishDiamond, sommiBullishDiamond] = f_findSommiDiamond(sommiHTCRes, sommiHTCRes2, wt1, wt2, wtCross, wtCrossUp, wtCrossDown) // macd colors [macdWT1Color, macdWT2Color] = f_macdWTColors(macdWTColorsTF) // WT Divergences [wtFractalTop, wtFractalBot, wtLow_prev, wtBearDiv, wtBullDiv, wtBearDivHidden, wtBullDivHidden] = f_findDivs(wt2, wtDivOBLevel, wtDivOSLevel, true) [wtFractalTop_add, wtFractalBot_add, wtLow_prev_add, wtBearDiv_add, wtBullDiv_add, wtBearDivHidden_add, wtBullDivHidden_add] = f_findDivs(wt2, wtDivOBLevel_add, wtDivOSLevel_add, true) [wtFractalTop_nl, wtFractalBot_nl, wtLow_prev_nl, wtBearDiv_nl, wtBullDiv_nl, wtBearDivHidden_nl, wtBullDivHidden_nl] = f_findDivs(wt2, 0, 0, false) wtBearDivHidden_ = showHiddenDiv_nl ? wtBearDivHidden_nl : wtBearDivHidden wtBullDivHidden_ = showHiddenDiv_nl ? wtBullDivHidden_nl : wtBullDivHidden wtBearDivColor = (wtShowDiv and wtBearDiv) or (wtShowHiddenDiv and wtBearDivHidden_) ? colorRed : na wtBullDivColor = (wtShowDiv and wtBullDiv) or (wtShowHiddenDiv and wtBullDivHidden_) ? colorGreen : na wtBearDivColor_add = (wtShowDiv and (wtDivOBLevel_addshow and wtBearDiv_add)) or (wtShowHiddenDiv and (wtDivOBLevel_addshow and wtBearDivHidden_add)) ? #9a0202 : na wtBullDivColor_add = (wtShowDiv and (wtDivOBLevel_addshow and wtBullDiv_add)) or (wtShowHiddenDiv and (wtDivOBLevel_addshow and wtBullDivHidden_add)) ? #1b5e20 : na // RSI Divergences [rsiFractalTop, rsiFractalBot, rsiLow_prev, rsiBearDiv, rsiBullDiv, rsiBearDivHidden, rsiBullDivHidden] = f_findDivs(rsi, rsiDivOBLevel, rsiDivOSLevel, true) [rsiFractalTop_nl, rsiFractalBot_nl, rsiLow_prev_nl, rsiBearDiv_nl, rsiBullDiv_nl, rsiBearDivHidden_nl, rsiBullDivHidden_nl] = f_findDivs(rsi, 0, 0, false) rsiBearDivHidden_ = showHiddenDiv_nl ? rsiBearDivHidden_nl : rsiBearDivHidden rsiBullDivHidden_ = showHiddenDiv_nl ? rsiBullDivHidden_nl : rsiBullDivHidden rsiBearDivColor = (rsiShowDiv and rsiBearDiv) or (rsiShowHiddenDiv and rsiBearDivHidden_) ? colorRed : na rsiBullDivColor = (rsiShowDiv and rsiBullDiv) or (rsiShowHiddenDiv and rsiBullDivHidden_) ? colorGreen : na // Stoch Divergences [stochFractalTop, stochFractalBot, stochLow_prev, stochBearDiv, stochBullDiv, stochBearDivHidden, stochBullDivHidden] = f_findDivs(stochK, 0, 0, false) stochBearDivColor = (stochShowDiv and stochBearDiv) or (stochShowHiddenDiv and stochBearDivHidden) ? colorRed : na stochBullDivColor = (stochShowDiv and stochBullDiv) or (stochShowHiddenDiv and stochBullDivHidden) ? colorGreen : na // Small Circles WT Cross signalColor = wt2 - wt1 > 0 ? color.red : color.lime //LA WT BUY/SELL wtBuy = wt2 <=0 and wt1 <=0 and rsiMFI >0 and emaLong wtSell = wt2 >=0 and wt1 >=0 and rsiMFI <0 and emaShort // Buy signal. buySignal = wtCross and wtCrossUp and wtOversold and wtBuy buySignalDiv = (wtShowDiv and wtBullDiv) or (wtShowDiv and wtBullDiv_add) or (stochShowDiv and stochBullDiv) or (rsiShowDiv and rsiBullDiv) buySignalDiv_color = wtBullDiv ? colorGreen : wtBullDiv_add ? color.new(colorGreen, 60) : rsiShowDiv ? colorGreen : na // Sell signal sellSignal = wtCross and wtCrossDown and wtOverbought and wtSell sellSignalDiv = (wtShowDiv and wtBearDiv) or (wtShowDiv and wtBearDiv_add) or (stochShowDiv and stochBearDiv) or (rsiShowDiv and rsiBearDiv) sellSignalDiv_color = wtBearDiv ? colorRed : wtBearDiv_add ? color.new(colorRed, 60) : rsiBearDiv ? colorRed : na // Gold Buy lastRsi = valuewhen(wtFractalBot, rsi[2], 0)[2] wtGoldBuy = ((wtShowDiv and wtBullDiv) or (rsiShowDiv and rsiBullDiv)) and wtLow_prev <= osLevel3 and wt2 > osLevel3 and wtLow_prev - wt2 <= -5 and lastRsi < 30 // } CALCULATE INDICATORS // DRAW { bgcolor(darkMode ? color.new(#000000, 80) : na) zLine = plot(0, color = color.new(colorWhite, 50)) // MFI BAR rsiMfiBarTopLine = plot(rsiMFIShow ? -95 : na, title = 'MFI Bar TOP Line', transp = 100) rsiMfiBarBottomLine = plot(rsiMFIShow ? -99 : na, title = 'MFI Bar BOTTOM Line', transp = 100) fill(rsiMfiBarTopLine, rsiMfiBarBottomLine, title = 'MFI Bar Colors', color = rsiMFIColor, transp = 75) // WT Areas plot(wtShow ? wt1 : na, style = plot.style_area, title = 'WT Wave 1', color = macdWTColorsShow ? macdWT1Color : colorWT1, transp = 0) plot(wtShow ? wt2 : na, style = plot.style_area, title = 'WT Wave 2', color = macdWTColorsShow ? macdWT2Color : darkMode ? colorWT2_ : colorWT2 , transp = 20) // VWAP plot(vwapShow ? wtVwap : na, title = 'VWAP', color = colorYellow, style = plot.style_area, linewidth = 2, transp = 45) // MFI AREA rsiMFIplot = plot(rsiMFIShow ? rsiMFI: na, title = 'RSI+MFI Area', color = rsiMFIColor, transp = 20) fill(rsiMFIplot, zLine, rsiMFIColor, transp = 40) // WT Div plot(series = wtFractalTop ? wt2[2] : na, title = 'WT Bearish Divergence', color = wtBearDivColor, linewidth = 2, offset = -2) plot(series = wtFractalBot ? wt2[2] : na, title = 'WT Bullish Divergence', color = wtBullDivColor, linewidth = 2, offset = -2) // WT 2nd Div plot(series = wtFractalTop_add ? wt2[2] : na, title = 'WT 2nd Bearish Divergence', color = wtBearDivColor_add, linewidth = 2, offset = -2) plot(series = wtFractalBot_add ? wt2[2] : na, title = 'WT 2nd Bullish Divergence', color = wtBullDivColor_add, linewidth = 2, offset = -2) // RSI plot(rsiShow ? rsi : na, title = 'RSI', color = rsiColor, linewidth = 2, transp = 25) // RSI Div plot(series = rsiFractalTop ? rsi[2] : na, title='RSI Bearish Divergence', color = rsiBearDivColor, linewidth = 1, offset = -2) plot(series = rsiFractalBot ? rsi[2] : na, title='RSI Bullish Divergence', color = rsiBullDivColor, linewidth = 1, offset = -2) // Stochastic RSI stochKplot = plot(stochShow ? stochK : na, title = 'Stoch K', color = color.new(#21baf3, 0), linewidth = 2) stochDplot = plot(stochShow ? stochD : na, title = 'Stoch D', color = color.new(#673ab7, 60), linewidth = 1) stochFillColor = stochK >= stochD ? color.new(#21baf3, 75) : color.new(#673ab7, 60) fill(stochKplot, stochDplot, title='KD Fill', color=stochFillColor) // Stoch Div plot(series = stochFractalTop ? stochK[2] : na, title='Stoch Bearish Divergence', color = stochBearDivColor, linewidth = 1, offset = -2) plot(series = stochFractalBot ? stochK[2] : na, title='Stoch Bullish Divergence', color = stochBullDivColor, linewidth = 1, offset = -2) // Schaff Trend Cycle plot(tcLine ? tcVal : na, color = color.new(#673ab7, 25), linewidth = 2, title = "Schaff Trend Cycle 1") plot(tcLine ? tcVal : na, color = color.new(colorWhite, 50), linewidth = 1, title = "Schaff Trend Cycle 2") // Draw Overbought & Oversold lines //plot(obLevel, title = 'Over Bought Level 1', color = colorWhite, linewidth = 1, style = plot.style_circles, transp = 85) plot(obLevel2, title = 'Over Bought Level 2', color = colorWhite, linewidth = 1, style = plot.style_stepline, transp = 85) plot(obLevel3, title = 'Over Bought Level 3', color = colorWhite, linewidth = 1, style = plot.style_circles, transp = 95) //plot(osLevel, title = 'Over Sold Level 1', color = colorWhite, linewidth = 1, style = plot.style_circles, transp = 85) plot(osLevel2, title = 'Over Sold Level 2', color = colorWhite, linewidth = 1, style = plot.style_stepline, transp = 85) // Sommi flag plotchar(sommiFlagShow and sommiBearish ? 108 : na, title = 'Sommi bearish flag', char='⚑', color = colorPink, location = location.absolute, size = size.tiny, transp = 0) plotchar(sommiFlagShow and sommiBullish ? -108 : na, title = 'Sommi bullish flag', char='⚑', color = colorBluelight, location = location.absolute, size = size.tiny, transp = 0) plot(sommiShowVwap ? ema(hvwap, 3) : na, title = 'Sommi higher VWAP', color = colorYellow, linewidth = 2, style = plot.style_line, transp = 15) // Sommi diamond plotchar(sommiDiamondShow and sommiBearishDiamond ? 108 : na, title = 'Sommi bearish diamond', char='◆', color = colorPink, location = location.absolute, size = size.tiny, transp = 0) plotchar(sommiDiamondShow and sommiBullishDiamond ? -108 : na, title = 'Sommi bullish diamond', char='◆', color = colorBluelight, location = location.absolute, size = size.tiny, transp = 0) // Circles //plot(wtCross ? wt2 : na, title = 'Buy and sell circle', color = signalColor, style = plot.style_circles, linewidth = 3, transp = 15) plot(buySignal ? wt2 : na, title = 'Buy circle', color = signalColor, style = plot.style_circles, linewidth = 3, transp = 15) plot(sellSignal ? wt2 : na, title = 'sell circle', color = signalColor, style = plot.style_circles, linewidth = 3, transp = 15) //plotchar(wtBuyShow and buySignal ? -107 : na, title = 'Buy arrow', char='·', color = colorGreen, location = location.absolute, size = size.small, transp = 50) //plotchar(wtSellShow and sellSignal ? 105 : na , title = 'Sell arrow', char='·', color = colorRed, location = location.absolute, size = size.small, transp = 50) plotshape(buySignal ? -107 : na, title="Buy", text="Buy", style=shape.labelup, location=location.bottom, color=color.green, textcolor=color.white, size=size.tiny, transp=0) plotshape(sellSignal ? 105 : na, title="Sell", text="Sell",style=shape.labeldown, location=location.top, color=color.red, textcolor=color.white, size=size.tiny, transp=0) plotchar(wtDivShow and buySignalDiv ? -106 : na, title = 'Divergence buy circle', char='•', text='Buy', color = buySignalDiv_color, location = location.absolute, size = size.small, offset = -2, transp = 15) plotchar(wtDivShow and sellSignalDiv ? 106 : na, title = 'Divergence sell circle', char='•', color = sellSignalDiv_color, location = location.absolute, size = size.small, offset = -2, transp = 15) plotchar(wtGoldBuy and wtGoldShow ? -106 : na, title = 'Gold buy gold circle', char='•', color = colorOrange, location = location.absolute, size = size.small, offset = -2, transp = 15) // } DRAW // ALERTS { // BUY alertcondition(buySignal, 'Buy Signal', 'Buy, WaveTrend Oversold') //alertcondition(buySignalDiv and wtBuy, 'Buy (Big green circle + Div)', 'Buy & WT Bullish Divergence & WT Overbought') //alertcondition(wtGoldBuy and wtBuy, 'GOLD Buy (Big GOLDEN circle)', 'Green & GOLD circle WaveTrend Overbought') //alertcondition(sommiBullish or sommiBullishDiamond and wtBuy, 'Sommi bullish flag/diamond', 'Blue flag/diamond') //alertcondition(wtCross and wtCrossUp and wtBuy, 'Buy (Small green dot)', 'Buy small circle') // SELL //alertcondition(sommiBearish or sommiBearishDiamond and wtSell, 'Sommi bearish flag/diamond', 'Purple flag/diamond') alertcondition(sellSignal and wtSell, 'Sell Signal', 'Sell, WaveTrend Overbought') //alertcondition(sellSignalDiv and wtSell, 'Sell (Big red circle + Div)', 'Buy & WT Bearish Divergence & WT Overbought') //alertcondition(wtCross and wtCrossDown and wtSell, 'Sell (Small red dot)', 'Sell small circle') // } ALERTS
RSI & Stoch MultiTime
https://www.tradingview.com/script/FBLSWwKl-RSI-Stoch-MultiTime/
JoshuaDanford
https://www.tradingview.com/u/JoshuaDanford/
90
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © JoshuaDanford //@version=5 indicator("MultiTime Indicator Panel", overlay=false) rsiPeriod = input(14, "Rsi Period") stochPeriod = input(14, "Stoch Period") atrPeriod = input(3, "ATR Period") supertrendFactor = input(4, "Supertrend Factor") smaPeriod = input(20, "SMA Period") tableAlignment = input.string(position.bottom_center, "Table Alignment", options = [position.bottom_center, position.bottom_left, position.bottom_right, position.middle_center, position.middle_left, position.middle_right, position.top_center, position.top_left, position.top_right]) getValueForTime(timeStr, expr) => request.security(syminfo.ticker, timeStr, expr) getColor(value) => color.from_gradient(value, 0, 100, color.rgb(0, 255, 0), color.rgb(255, 0, 0)) var indicatorTable = table.new(position = tableAlignment, columns = 8, rows = 5, bgcolor = color.rgb(0,0,0, 50), border_width = 1) table.cell(table_id = indicatorTable, column = 0, row = 1, text = "RSI", text_color = color.white) table.cell(table_id = indicatorTable, column = 0, row = 2, text = "Stoch", text_color = color.white) table.cell(table_id = indicatorTable, column = 0, row = 3, text = "Supertrend", text_color = color.white) table.cell(table_id = indicatorTable, column = 0, row = 4, text = "SMA (" + str.tostring(smaPeriod) + ")", text_color = color.white) table.cell(table_id = indicatorTable, column = 1, row = 0, text = "1m", text_color = color.white) table.cell(table_id = indicatorTable, column = 2, row = 0, text = "5m", text_color = color.white) table.cell(table_id = indicatorTable, column = 3, row = 0, text = "15m", text_color = color.white) table.cell(table_id = indicatorTable, column = 4, row = 0, text = "30m", text_color = color.white) table.cell(table_id = indicatorTable, column = 5, row = 0, text = "1H", text_color = color.white) table.cell(table_id = indicatorTable, column = 6, row = 0, text = "4H", text_color = color.white) table.cell(table_id = indicatorTable, column = 7, row = 0, text = "1D", text_color = color.white) makeTableCell(column, row, bgColor, cellText) => table.cell(table_id = indicatorTable, column = column, row = row, text = cellText, bgcolor = bgColor, text_color = color.white) makeRow(row, bgcolors, cellTexts) => for int i = 0 to 6 makeTableCell(1 + i, row, array.get(bgcolors, i), array.get(cellTexts, i)) fillArrayWithTime(timeStr, expr, mode, cellTexts, bgColors) => value = getValueForTime(timeStr, expr) if (mode == "float") array.push(bgColors, getColor(value)) array.push(cellTexts, str.tostring(math.round(value, 2))) else if (mode == "signal") array.push(bgColors, getColor(value == 1 ? 100 : value == -1 ? 0 : 50)) array.push(cellTexts, value == -1 ? "Buy" : value == 1 ? "Sell" : "Neutral") [cellTexts, bgColors] makeMultitimeIndicatorArray(expr, mode) => cellTexts = array.new_string(0, "") bgColors = array.new_color(0, color.black) fillArrayWithTime("1", expr, mode, cellTexts, bgColors) fillArrayWithTime("5", expr, mode, cellTexts, bgColors) fillArrayWithTime("15", expr, mode, cellTexts, bgColors) fillArrayWithTime("30", expr, mode, cellTexts, bgColors) fillArrayWithTime("60", expr, mode, cellTexts, bgColors) fillArrayWithTime("240", expr, mode, cellTexts, bgColors) fillArrayWithTime("1D", expr, mode, cellTexts, bgColors) [cellTexts, bgColors] supertrendDirection() => [supertrend, direction] = ta.supertrend(supertrendFactor, atrPeriod) direction [rsiCellTexts, rsiBgColors] = makeMultitimeIndicatorArray(ta.rsi(close, rsiPeriod), "float") [stochCellTexts, stochBgColors] = makeMultitimeIndicatorArray(ta.stoch(close, high, low, stochPeriod), "float") [supertrendTexts, supertrendBgColors] = makeMultitimeIndicatorArray(supertrendDirection(), "signal") [maTrendTexts, maTrendBgColors] = makeMultitimeIndicatorArray(ta.sma(close, 20) > close ? 1 : -1, "signal") makeRow(1, rsiBgColors, rsiCellTexts) makeRow(2, stochBgColors, stochCellTexts) makeRow(3, supertrendBgColors, supertrendTexts) makeRow(4, maTrendBgColors, maTrendTexts)
High Volume Price Levels x3
https://www.tradingview.com/script/ZNd6HbpD-High-Volume-Price-Levels-x3/
noop-noop
https://www.tradingview.com/u/noop-noop/
670
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © noop42 //@version=5 indicator("High Volumes Price Levels", "HVPL", overlay=true) vol_per_trigger = input.float(99.9, title="Volume level trigger (0.1 - 100.0)", minval=0.1, maxval=100.0) period1 = input.int(100, title="Period #1", minval=1) period2 = input.int(200, title="Period #2", minval=1) period3 = input.int(500, title="Period #3", minval=1) show_p1 = input.bool(true, "Show period #1") show_p2 = input.bool(true, "Show period #2") show_p3 = input.bool(true, "Show period #3") lvl1_color = input.color(color.green, "Period #1 color") lvl2_color = input.color(color.orange, "Period #2 color") lvl3_color = input.color(color.red, "Period #3 color") show_ghost_lines = input.bool(true, "Show 3rd period ghost lines") current_levels_only = input.bool(false, "Show current levels only") extend_level = input.string("Both", title="Extend last level", options=["Right", "Left", "Both", "None"]) find_last_high_volume(data, n) => r = 0 for i=0 to n if data[i] > vol_per_trigger r := i break r get_price_data(period) => v = 100 * (volume / ta.highest(volume, period)) f = find_last_high_volume(v, period) src = open[f] > close[f] ? low : high [v, f, src] ext = extend_level == "Right" ? extend.right : extend_level == "Left" ? extend.left : extend_level == "Both" ? extend.both : extend.none var line l1 = na var line l2 = na var line l3 = na if show_p1 [v1, f1, src1] = get_price_data(period1) if v1 > vol_per_trigger line.set_extend(l1, extend.none) line.set_color(l1, #a1a1a170) l1 := line.new(bar_index[1], src1[f1], bar_index, src1[f1], color=lvl1_color, style=line.style_solid, width=3, extend=ext) if show_p2 [v2, f2, src2] = get_price_data(period2) if v2 > vol_per_trigger line.set_extend(l2, extend.none) line.set_color(l2, #a1a1a170) l2 := line.new(bar_index[1], src2[f2], bar_index, src2[f2], color=lvl2_color, style=line.style_solid, width=3, extend=ext) if show_p3 [v3, f3, src3] = get_price_data(period3) if v3 > vol_per_trigger line.set_extend(l3, extend.none) if show_ghost_lines and not current_levels_only line.set_extend(l3, extend=extend.both) line.set_color(l3, #a1a1a170) l3 := line.new(bar_index[1], src3[f3], bar_index, src3[f3], color=lvl3_color, style=line.style_solid, width=3, extend=ext) if not current_levels_only line.set_x2(l1, bar_index) line.set_x2(l2, bar_index) line.set_x2(l3, bar_index)
Trading sessions, Ichimoku and Classic Pivots
https://www.tradingview.com/script/UHnIN0ib-Trading-sessions-Ichimoku-and-Classic-Pivots/
Rain5369
https://www.tradingview.com/u/Rain5369/
327
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Rain5369 //@version=5 indicator('Trading sessions', overlay=true) //plot(timestamp(syminfo.timezone,year(timenow),month(timenow),dayofmonth(timenow), hour(timenow), minute(timenow)),color=color.blue) maxBoxCount = input(title='Maximum box count', defval=21) lineWidth = input(title='Line width', defval=1) ExtendLine = input(false, 'Extend bars') Extend50 = input(false, 'Display session 50%(eq)') MaxLookbackDays = input.int(7, 'Maximum lookback days', minval=0) defaultEuropeColor = color.new(#D64142, 65) defaultUSAColor = color.new(#D4AA28, 65) defaultAsiaColor = color.new(#D9739A, 65) defaultEODColor = color.new(color.olive, 65) day_start_bool = input.bool(title='IB box', defval=true, group='Day IB') IB_BorderColor = input.color(title='IB : border', defval=color.new(color.white, 65), inline='IB_BorderColor', group='Day IB') IB_BackgroundColor = input.color(title=': background', defval=color.new(color.white,65), inline='IB_BorderColor', group='Day IB') day_start = '0000-0100' ExtendIB = input(false, 'Display IB Bars', inline='ExtendIB', group='Day IB') IB_low_color = input.color(title=': Low', defval=color.new(color.red, 0), inline='ExtendIB', group='Day IB') IB_high_color = input.color(title=': high', defval=color.new(color.green, 0), inline='ExtendIB', group='Day IB') FillIB = input(false,'Fill IB', inline='FillIB', group='Day IB') FillIBcolor = input.color(title=' ', defval=color.new(color.white, 85), inline='FillIB', group='Day IB') AsiaBorderColor = input.color(title='Asia : border', defval=color.new(#D9739A, 65), inline='AsiaBorderColor', group='Asia') AsiaBackgroundColor = input.color(title=': background', defval=defaultAsiaColor, inline='AsiaBorderColor', group='Asia') AsiaExtendedbar = input.color(title=': Extension', defval=color.new(#D9739A, 0), inline='AsiaBorderColor', group='Asia') Asia50Color = input.color(title=': 50%(EQ)', defval=color.new(color.white, 65), inline='AsiaBorderColor', group='Asia') asia = input.bool(title='Asia Session box', defval=true, group='Asia') Asia = '1700-2030:1234567' EuropeBorderColor = input.color(title='London : border', defval=color.new(#D64142, 65), inline='EuropeBorderColor', group='London') EuropeBackgroundColor = input.color(title=': Background', defval=defaultEuropeColor, inline='EuropeBorderColor', group='London') EuropeExtendedbar = input.color(title=': Extension', defval=color.new(#D64142, 0), inline='EuropeBorderColor', group='London') Europe50Color = input.color(title=': 50%(EQ)', defval=color.new(color.white, 65), inline='EuropeBorderColor', group='London') europe = input.bool(title='London Session box', defval=true, group='London') Europe = '0000-0400:1234567' USABorderColor = input.color(title='NY : border', defval=color.new(#D4AA28, 65), inline='USABorderColor', group='New York') USABackgroundColor = input.color(title=': background', defval=defaultUSAColor, inline='USABorderColor', group='New York') USAExtendedbar = input.color(title=': Extension', defval=color.new(#D4AA28, 0), inline='USABorderColor', group='New York') USA50Color = input.color(title=': 50%(EQ)', defval=color.new(color.white, 65), inline='USABorderColor', group='New York') usa = input.bool(title='New York Session box', defval=true, group='New York') USA = '0630-1000:1234567' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Bars is_newbar(sess) => t = time('D', sess, 'America/New_York') na(t[1]) and not na(t) or t[1] < t is_session(sess) => not na(time('D', sess, 'America/New_York')) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////---------------------------------------------------------------------------------- //London //---------------------------------------------------------------------------------- europeNewbar = is_newbar(Europe) europeSession = is_session(Europe) //europeBox = box.new(na,na,na,na,border_width=2,xloc=xloc.bar_time,border_style=line.style_solid, border_color=EuropeBorderColor, bgcolor=EuropeBackgroundColor) //plotshape(europeNewbar,"eu new",style=shape.xcross) if europe and europeSession float europeLow = na europeLow := if europeSession if europeNewbar low else math.min(europeLow[1], low) else europeLow[1] float europeHigh = na europeHigh := if europeSession if europeNewbar high else math.max(europeHigh[1], high) else europeHigh[1] int europeStart = na europeStart := if europeSession if europeNewbar time else math.min(europeStart[1], time) else na int europeEnd = na europeEnd := if europeSession if europeNewbar time_close else math.max(europeEnd[1], time_close) else na europeBox = if europeNewbar box.new(left=europeStart, bottom=europeLow, right=europeEnd, top=europeHigh, border_width=lineWidth, xloc=xloc.bar_time, border_style=line.style_solid, border_color=EuropeBorderColor, bgcolor=EuropeBackgroundColor) if not europeNewbar box.set_right(europeBox[1], europeEnd) box.set_top(europeBox[1], europeHigh) box.set_bottom(europeBox[1], europeLow) if timeframe.period == '240' box.delete(europeBox[maxBoxCount]) in_session_London = time(timeframe.period, Europe, 'America/New_York') is_new_session(res, sess) => t = time(res, sess, 'America/New_York') na(t[1]) and not na(t) or t[1] < t new_session_London = is_new_session('0400', Europe) is_newbar_bar(res, sess) => t = time(res, sess, 'America/New_York') not na(t) and (na(t[1]) or t > t[1]) new_Lodon = is_newbar_bar('0001', Europe) ? 1 : 0 var float _low_London = close var float _high_London = close _low_London := new_session_London ? low : in_session_London ? math.min(low, _low_London[1]) : na _high_London := new_session_London ? high : in_session_London ? math.max(high, _high_London[1]) : na start_of_session_London = ta.valuewhen(new_Lodon == 1, high, 0) end_session_condition_London = start_of_session_London != start_of_session_London[1] ? 0 : in_session_London ? 1 : 0 end_session_London = end_session_condition_London == 0 and end_session_condition_London[1] == 1 ? color.orange : na v_extend_low_London = ta.valuewhen(_low_London == low, low, 0) col_v_extend_low_London = end_session_condition_London == 0 and v_extend_low_London == v_extend_low_London[1] and ExtendLine ? EuropeExtendedbar : na plot(v_extend_low_London, color=col_v_extend_low_London, linewidth=lineWidth, title='London Low', editable=false) v_extend_high_London = ta.valuewhen(_high_London == high, high, 0) col_v_extend_high_London = end_session_condition_London == 0 and v_extend_high_London == v_extend_high_London[1] and ExtendLine ? EuropeExtendedbar : na plot(v_extend_high_London, color=col_v_extend_high_London, linewidth=lineWidth, title='London High', editable=false) col_v_extend_50_London = end_session_condition_London == 0 and v_extend_high_London == v_extend_high_London[1] and Extend50 ? EuropeExtendedbar : na L50 = (v_extend_low_London + v_extend_high_London)*0.5 plot(L50, color = col_v_extend_50_London, title = 'London 50%', editable=false) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////---------------------------------------------------------------------------------- //NY //---------------------------------------------------------------------------------- usaNewbar = is_newbar(USA) usaSession = is_session(USA) if usa and usaSession float usaLow = na usaLow := if usaSession if usaNewbar low else math.min(usaLow[1], low) else usaLow[1] float usaHigh = na usaHigh := if usaSession if usaNewbar high else math.max(usaHigh[1], high) else usaHigh[1] int usaStart = na usaStart := if usaSession if usaNewbar time else math.min(usaStart[1], time) else na int usaEnd = na usaEnd := if usaSession if usaNewbar time_close else math.max(usaEnd[1], time_close) else na usaBox = if usaNewbar usaBox = box.new(left=usaStart, bottom=usaLow, right=usaEnd, top=usaHigh, border_width=lineWidth, xloc=xloc.bar_time, border_style=line.style_solid, border_color=USABorderColor, bgcolor=USABackgroundColor) if not usaNewbar box.set_right(usaBox[1], usaEnd) box.set_top(usaBox[1], usaHigh) box.set_bottom(usaBox[1], usaLow) if timeframe.period == '60' box.delete(usaBox[maxBoxCount]) in_session_NY = time(timeframe.period, USA, 'America/New_York') new_session_NY = is_new_session('1000', USA) new_NY = is_newbar_bar('0630', USA) ? 1 : 0 var float _low_NY = close var float _high_NY = close _low_NY := new_session_NY ? low : in_session_NY ? math.min(low, _low_NY[1]) : na _high_NY := new_session_NY ? high : in_session_NY ? math.max(high, _high_NY[1]) : na start_of_session_value_NY = ta.valuewhen(new_NY == 1, high, 0) end_session_condition_NY = start_of_session_value_NY != start_of_session_value_NY[1] ? 0 : in_session_NY ? 1 : 0 end_session_NY = end_session_condition_NY == 0 and end_session_condition_NY[1] == 1 ? color.orange : na v_extend_low_NY = ta.valuewhen(_low_NY == low, low, 0) col_v_extend_low_NY = end_session_condition_NY == 0 and v_extend_low_NY == v_extend_low_NY[1] and ExtendLine ? USAExtendedbar : na plot(v_extend_low_NY, color=col_v_extend_low_NY, linewidth=lineWidth, title='New York Low', editable=false) v_extend_high_NY = ta.valuewhen(_high_NY == high, high, 0) col_v_extend_high_NY = end_session_condition_NY == 0 and v_extend_high_NY == v_extend_high_NY[1] and ExtendLine ? USAExtendedbar : na plot(v_extend_high_NY, color=col_v_extend_high_NY, linewidth=lineWidth, title='New York High', editable=false) col_v_extend_50_NY = end_session_condition_NY == 0 and v_extend_low_NY == v_extend_low_NY[1] and Extend50 ? USAExtendedbar : na NY50 = (v_extend_low_NY + v_extend_high_NY)*0.5 plot(NY50, color = col_v_extend_50_NY, title = 'New York 50%', editable=false) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////---------------------------------------------------------------------------------- //Asia //---------------------------------------------------------------------------------- asiaNewbar = is_newbar(Asia) asiaSession = is_session(Asia) if asia and asiaSession float asiaLow = na asiaLow := if asiaSession if asiaNewbar low else math.min(asiaLow[1], low) else asiaLow[1] float asiaHigh = na asiaHigh := if asiaSession if asiaNewbar high else math.max(asiaHigh[1], high) else asiaHigh[1] int asiaStart = na asiaStart := if asiaSession if asiaNewbar time else math.min(asiaStart[1], time) else na int asiaEnd = na asiaEnd := if asiaSession if asiaNewbar time_close else math.max(asiaEnd[1], time_close) else na asiaBox = if asiaNewbar box.new(left=asiaStart, bottom=asiaLow, right=asiaEnd, top=asiaHigh, border_width=lineWidth, xloc=xloc.bar_time, border_style=line.style_solid, border_color=AsiaBorderColor, bgcolor=AsiaBackgroundColor) if not asiaNewbar box.set_right(asiaBox[1], asiaEnd) box.set_top(asiaBox[1], asiaHigh) box.set_bottom(asiaBox[1], asiaLow) if timeframe.period == '60' box.delete(asiaBox[maxBoxCount]) in_session = time(timeframe.period, Asia, 'America/New_York') new_session = is_new_session('2030', Asia) new = is_newbar_bar('1700', Asia) ? 1 : 0 var float _low = close var float _high = close _low := new_session ? low : in_session ? math.min(low, _low[1]) : na _high := new_session ? high : in_session ? math.max(high, _high[1]) : na start_of_session_value = ta.valuewhen(new == 1, high, 0) end_session_condition = start_of_session_value != start_of_session_value[1] ? 0 : in_session ? 1 : 0 end_session = end_session_condition == 0 and end_session_condition[1] == 1 ? color.orange : na v_extend_low = ta.valuewhen(_low == low, low, 0) col_v_extend_low = end_session_condition == 0 and v_extend_low == v_extend_low[1] and ExtendLine ? AsiaExtendedbar : na plot(v_extend_low, color=col_v_extend_low, linewidth=lineWidth, title='Asia Low', editable=false) v_extend_high = ta.valuewhen(_high == high, high, 0) col_v_extend_high = end_session_condition == 0 and v_extend_high == v_extend_high[1] and ExtendLine ? AsiaExtendedbar : na plot(v_extend_high, color=col_v_extend_high, linewidth=lineWidth, title='Asia High', editable=false) col_v_extend_50 = end_session_condition == 0 and v_extend_low == v_extend_low[1] and Extend50 ? AsiaExtendedbar : na A50 = (v_extend_low + v_extend_high)*0.5 plot(A50, color = col_v_extend_50, title = 'Asia 50%', editable=false) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// day_start_Newbar = is_newbar(day_start) day_start_Session = is_session(day_start) if day_start_bool and day_start_Session float day_start_Low = na day_start_Low := if day_start_Session if day_start_Newbar low else math.min(day_start_Low[1], low) else day_start_Low[1] float day_start_High = na day_start_High := if day_start_Session if day_start_Newbar high else math.max(day_start_High[1], high) else day_start_High[1] int day_start_Start = na day_start_Start := if day_start_Session if day_start_Newbar time else math.min(day_start_Start[1], time) else na int day_start_End = na day_start_End := if day_start_Session if day_start_Newbar time_close else math.max(day_start_End[1], time_close) else na day_start_Box = if day_start_Newbar box.new(left=day_start_Start, bottom=day_start_Low, right=day_start_End, top=day_start_High, border_width=lineWidth, xloc=xloc.bar_time, border_style=line.style_solid, border_color=IB_BorderColor, bgcolor=IB_BackgroundColor) if not day_start_Newbar box.set_right(day_start_Box[1], day_start_End) box.set_top(day_start_Box[1], day_start_High) box.set_bottom(day_start_Box[1], day_start_Low) if timeframe.period == '60' box.delete(day_start_Box[maxBoxCount]) IB_session = time(timeframe.period, day_start, 'America/New_York') IB_new_session = is_new_session('0100', day_start) IB_new = is_newbar_bar('0001', day_start) ? 1 : 0 var float IB_low = close var float IB_high = close IB_low := IB_new_session ? low : IB_session ? math.min(low, IB_low[1]) : na IB_high := IB_new_session ? high : IB_session ? math.max(high, IB_high[1]) : na start_of_IB_value = ta.valuewhen(IB_new == 1, high, 0) end_IB_condition = start_of_IB_value != start_of_IB_value[1] ? 0 : IB_session ? 1 : 0 end_IB = end_IB_condition == 0 and end_IB_condition[1] == 1 ? color.orange : na IB_extend_low = ta.valuewhen(IB_low == low, low, 0) col_IB_extend_low = end_IB_condition == 0 and IB_extend_low == IB_extend_low[1] and ExtendIB ? IB_low_color : na IBL = plot(IB_extend_low, color=col_IB_extend_low, linewidth=lineWidth, title='IB Low', editable=false) IB_extend_high = ta.valuewhen(IB_high == high, high, 0) col_IB_extend_high = end_IB_condition == 0 and IB_extend_high == IB_extend_high[1] and ExtendIB ? IB_high_color : na IBH = plot(IB_extend_high, color=col_IB_extend_high, linewidth=lineWidth, title='IB High', editable=false) fill(IBL,IBH, title = 'inblance fill', color = FillIB ? FillIBcolor : na, editable = false) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// mon = input(title='Week Days', defval=true) plotshape(mon == true and time(timeframe.period, '0000-0001:2', 'UTC') and timeframe.isintraday, textcolor=color.new(color.white, 0), style=shape.labeldown, title='Monday', text='Monday', color=color.new(color.green, 0), location=location.bottom, editable=false) plotshape(mon == true and time(timeframe.period, '0000-0001:3', 'UTC') and timeframe.isintraday, textcolor=color.new(color.white, 0), style=shape.labeldown, title='Tuesday', text='Tuesday', color=color.new(color.green, 0), location=location.bottom, editable=false) plotshape(mon == true and time(timeframe.period, '0000-0001:4', 'UTC') and timeframe.isintraday, textcolor=color.new(color.black, 0), style=shape.labeldown, title='Wednesday', text='Wednesday', color=color.new(color.red, 0), location=location.bottom, editable=false) plotshape(mon == true and time(timeframe.period, '0000-0001:5', 'UTC') and timeframe.isintraday, textcolor=color.new(color.white, 0), style=shape.labeldown, title='Thursday', text='Thursday', color=color.new(color.green, 0), location=location.bottom, editable=false) plotshape(mon == true and time(timeframe.period, '0000-0001:6', 'UTC') and timeframe.isintraday, textcolor=color.new(color.black, 0), style=shape.labeldown, title='Friday', text='Friday', color=color.new(color.red, 0), location=location.bottom, editable=false) plotshape(mon == true and time(timeframe.period, '0000-0001:7', 'UTC') and timeframe.isintraday, textcolor=color.new(color.white, 0), style=shape.labeldown, title='Saturday', text='Saturday', color=color.new(color.black, 0), location=location.bottom, editable=false) plotshape(mon == true and time(timeframe.period, '0000-0001:1', 'UTC') and timeframe.isintraday, textcolor=color.new(color.white, 0), style=shape.labeldown, title='Sunday', text='Sunday', color=color.new(color.black, 0), location=location.bottom, editable=false) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Ten = input.int(9, minval=1, title='Tenkan', group = 'ichimoku') Kij = input.int(26, minval=1, title='Kijun', group = 'ichimoku') LeadSpan = input.int(52, minval=1, title='Senkou B', group = 'ichimoku') Displace = input.int(26, minval=1, title='Senkou A', group = 'ichimoku') SpanOffset = input.int(26, minval=1, title='Span Offset', group = 'ichimoku') sts = input(false, title='Show Tenkan', group = 'ichimoku') sks = input(false, title='Show Kijun', group = 'ichimoku') scs = input(false, title='Show Chikou', group = 'ichimoku') ssa = input(true, title='Show Span A', group = 'ichimoku') ssb = input(true, title='Show Span B', group = 'ichimoku') source = close //Script for Ichimoku Indicator donchian(len) => math.avg(ta.lowest(len), ta.highest(len)) TS = donchian(Ten) KS = donchian(Kij) SpanA = math.avg(TS, KS) SpanB = donchian(LeadSpan) Chikou = source[Displace] SpanAA = math.avg(TS, KS)[SpanOffset] SpanBB = donchian(LeadSpan)[SpanOffset] //Kumo Breakout (Long) SpanA_Top = SpanAA >= SpanBB ? 1 : 0 SpanB_Top = SpanBB >= SpanAA ? 1 : 0 SpanA_Top2 = SpanA >= SpanB ? 1 : 0 SpanB_Top2 = SpanB >= SpanA ? 1 : 0 SpanA1 = SpanA_Top2 ? SpanA : na SpanA2 = SpanA_Top2 ? SpanB : na SpanB1 = SpanB_Top2 ? SpanA : na SpanB2 = SpanB_Top2 ? SpanB : na //plot for Tenkan and Kijun (Current Timeframe) p1 = plot(sts and TS ? TS : na, title='Tenkan', linewidth=2, color=color.new(color.blue, 0)) p2 = plot(sks and KS ? KS : na, title='Kijun', linewidth=2, color=color.new(color.purple, 0)) p5 = plot(sks ? close : na, title='Chikou', linewidth=2, offset=-Displace, color=color.new(color.black, 0)) //Plot for Kumo Cloud (Dynamic Color) p3 = plot(ssa and SpanA ? SpanA : na, title='SpanA', linewidth=2, offset=Displace, color=color.new(color.green, 0)) p4 = plot(ssb and SpanB ? SpanB : na, title='SpanB', linewidth=2, offset=Displace, color=color.new(color.red, 0)) p8 = plot(ssa and SpanA1 ? SpanA1 : na, title='Span A1 above', style=plot.style_linebr, linewidth=1, offset=Displace, color=color.new(color.green, 0)) p9 = plot(ssa and SpanA2 ? SpanA2 : na, title='Span A2 above', style=plot.style_linebr, linewidth=1, offset=Displace, color=color.new(color.green, 0)) p10 = plot(ssb and SpanB1 ? SpanB1 : na, title='Span B1 above', style=plot.style_linebr, linewidth=1, offset=Displace, color=color.new(color.red, 0)) p11 = plot(ssb and SpanB2 ? SpanB2 : na, title='Span B2 above', style=plot.style_linebr, linewidth=1, offset=Displace, color=color.new(color.red, 0)) fill(p8, p9, color=color.new(color.lime, 90), title='Kumo Cloud Up') fill(p10, p11, color=color.new(color.red, 90), title='Kumo Cloud Down') LongSpan = SpanA_Top and source[1] < SpanAA[1] and source > SpanAA or SpanB_Top and source[1] < SpanBB[1] and source > SpanBB ? 1 : 0 cupSpan = LongSpan == 1 ? LongSpan : 0 /////////////////////////////////////////////////////////////// //---------------------------------------------------------------------------------- //Vwap Pivot //---------------------------------------------------------------------------------- interval_type = input.string('Weekly', options=['Daily', 'Weekly', 'Monthly', 'Yearly'], title='Pivot Interval', group = 'pivots') disp_p_extend = input(true, title='Extend pivot lines', group = 'pivots') disp_p_labels = input(true, title='Display pivot labels', group = 'pivots') label_size = input.string('small', options=['auto', 'tiny', 'small', 'normal', 'large', 'huge'], title='Label size', group = 'pivots') off_mult = input(15, title='label offset adjustment', group = 'pivots') Label_color = input.color(title='Color : Label', defval=color.new(color.black, 0), inline='Label_color', group='pivots') Pivot_color = input.color(title=' : Pivot', defval=color.new(color.blue, 0), inline='Label_color', group='pivots') R1_color = input.color(title=' : R1', defval=color.new(color.orange, 0), inline='Label_color', group='pivots') R2_color = input.color(title=' : R2', defval=color.new(color.orange, 0), inline='Label_color', group='pivots') R3_color = input.color(title=' : R3', defval=color.new(color.red, 0), inline='Label_color', group='pivots') R4_color = input.color(title=' : R4', defval=color.new(color.red, 0), inline='Label_color', group='pivots') S1_color = input.color(title=' : S1', defval=color.new(color.green, 0), inline='Label_color', group='pivots') S2_color = input.color(title=' : S2', defval=color.new(color.green, 0), inline='Label_color', group='pivots') S3_color = input.color(title=' : S3', defval=color.new(color.lime, 0), inline='Label_color', group='pivots') S4_color = input.color(title=' : S4', defval=color.new(color.lime, 0), inline='Label_color', group='pivots') l_size = label_size == 'auto' ? size.auto : label_size == 'tiny' ? size.tiny : label_size == 'small' ? size.small : label_size == 'normal' ? size.normal : label_size == 'large' ? size.large : size.huge new_year = ta.change(time('12M')) != 0 new_month = ta.change(time('M')) != 0 new_week = ta.change(time('W')) != 0 new_day = ta.change(time('D')) != 0 new_interval = interval_type == 'Daily' ? new_day : interval_type == 'Weekly' ? new_week : interval_type == 'Monthly' ? new_month : new_year f_vwap(newint) => float pvsum = na float vsum = na pvsum := newint ? hlc3 * volume : pvsum[1] + hlc3 * volume vsum := newint ? volume : vsum[1] + volume v = pvsum / vsum v p_vwap = f_vwap(new_interval) p_current_vwap_high = 0.0 p_current_vwap_high := new_interval ? p_vwap : math.max(p_current_vwap_high[1], p_vwap) p_current_vwap_low = 0.0 p_current_vwap_low := new_interval ? p_vwap : math.min(p_current_vwap_low[1], p_vwap) p_vwap_high = ta.valuewhen(new_interval, p_current_vwap_high[1], 0) p_vwap_low = ta.valuewhen(new_interval, p_current_vwap_low[1], 0) p_vwap_close = ta.valuewhen(new_interval, p_vwap[1], 0) p_vwap_open = ta.valuewhen(new_interval, hlc3, 0) v_range = p_vwap_high - p_vwap_low pivot = (p_vwap_high + p_vwap_low + p_vwap_close) / 3 R1 = 2 * pivot - p_vwap_low R2 = pivot + v_range R3 = R2 + v_range R4 = R3 + v_range S1 = 2 * pivot - p_vwap_high S2 = pivot - v_range S3 = S2 - v_range S4 = S3 - v_range ll_offset = timenow + math.round(ta.change(time) * off_mult) pivot_line = disp_p_extend ? line.new(x1=timenow, x2=ll_offset, y1=pivot, y2=pivot, xloc=xloc.bar_time, extend=extend.right, color=Pivot_color, width=1, style=line.style_solid) : na line.delete(pivot_line[1]) R1_line = disp_p_extend ? line.new(x1=timenow, x2=ll_offset, y1=R1, y2=R1, xloc=xloc.bar_time, extend=extend.right, color=R1_color, width=1, style=line.style_solid) : na line.delete(R1_line[1]) R2_line = disp_p_extend ? line.new(x1=timenow, x2=ll_offset, y1=R2, y2=R2, xloc=xloc.bar_time, extend=extend.right, color=R2_color, width=2, style=line.style_solid) : na line.delete(R2_line[1]) R3_line = disp_p_extend ? line.new(x1=timenow, x2=ll_offset, y1=R3, y2=R3, xloc=xloc.bar_time, extend=extend.right, color=R3_color, width=1, style=line.style_solid) : na line.delete(R3_line[1]) R4_line = disp_p_extend ? line.new(x1=timenow, x2=ll_offset, y1=R4, y2=R4, xloc=xloc.bar_time, extend=extend.right, color=R4_color, width=2, style=line.style_solid) : na line.delete(R4_line[1]) S1_line = disp_p_extend ? line.new(x1=timenow, x2=ll_offset, y1=S1, y2=S1, xloc=xloc.bar_time, extend=extend.right, color=S1_color, width=1, style=line.style_solid) : na line.delete(S1_line[1]) S2_line = disp_p_extend ? line.new(x1=timenow, x2=ll_offset, y1=S2, y2=S2, xloc=xloc.bar_time, extend=extend.right, color=S2_color, width=2, style=line.style_solid) : na line.delete(S2_line[1]) S3_line = disp_p_extend ? line.new(x1=timenow, x2=ll_offset, y1=S3, y2=S3, xloc=xloc.bar_time, extend=extend.right, color=S3_color, width=1, style=line.style_solid) : na line.delete(S3_line[1]) S4_line = disp_p_extend ? line.new(x1=timenow, x2=ll_offset, y1=S4, y2=S4, xloc=xloc.bar_time, extend=extend.right, color=S4_color, width=2, style=line.style_solid) : na line.delete(S4_line[1]) pivot_label = disp_p_labels ? label.new(x=ll_offset, y=pivot, xloc=xloc.bar_time, yloc=yloc.price, textcolor=Pivot_color, text='pivot', style=label.style_label_down, color=Label_color, size=l_size) : na label.delete(pivot_label[1]) R1_label = disp_p_labels ? label.new(x=ll_offset, y=R1, xloc=xloc.bar_time, yloc=yloc.price, textcolor=R1_color, text='R1', style=label.style_label_down, color=Label_color, size=l_size) : na label.delete(R1_label[1]) R2_label = disp_p_labels ? label.new(x=ll_offset, y=R2, xloc=xloc.bar_time, yloc=yloc.price, textcolor=R2_color, text='R2', style=label.style_label_down, color=Label_color, size=l_size) : na label.delete(R2_label[1]) R3_label = disp_p_labels ? label.new(x=ll_offset, y=R3, xloc=xloc.bar_time, yloc=yloc.price, textcolor=R3_color, text='R3', style=label.style_label_down, color=Label_color, size=l_size) : na label.delete(R3_label[1]) R4_label = disp_p_labels ? label.new(x=ll_offset, y=R4, xloc=xloc.bar_time, yloc=yloc.price, textcolor=R4_color, text='R4', style=label.style_label_down, color=Label_color, size=l_size) : na label.delete(R4_label[1]) S1_label = disp_p_labels ? label.new(x=ll_offset, y=S1, xloc=xloc.bar_time, yloc=yloc.price, textcolor=S1_color, text='S1', style=label.style_label_down, color=Label_color, size=l_size) : na label.delete(S1_label[1]) S2_label = disp_p_labels ? label.new(x=ll_offset, y=S2, xloc=xloc.bar_time, yloc=yloc.price, textcolor=S2_color, text='S2', style=label.style_label_down, color=Label_color, size=l_size) : na label.delete(S2_label[1]) S3_label = disp_p_labels ? label.new(x=ll_offset, y=S3, xloc=xloc.bar_time, yloc=yloc.price, textcolor=S3_color, text='S3', style=label.style_label_down, color=Label_color, size=l_size) : na label.delete(S3_label[1]) S4_label = disp_p_labels ? label.new(x=ll_offset, y=S4, xloc=xloc.bar_time, yloc=yloc.price, textcolor=S4_color, text='S4', style=label.style_label_down, color=Label_color, size=l_size) : na label.delete(S4_label[1])
Higher Time Frame Chart Overlay
https://www.tradingview.com/script/uPbOxSyo-Higher-Time-Frame-Chart-Overlay/
LonesomeTheBlue
https://www.tradingview.com/u/LonesomeTheBlue/
3,210
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © LonesomeTheBlue //@version=5 indicator("Higher Time Frame Chart Overlay", overlay = true) HTF = input.timeframe(defval = "1D", title = "Higher Time Frame", group = "Higher Time Frame") symbolu = input.string(defval = "", title = "Symbol", tooltip = "If you leave the Symbol empty then current symbol is used") bodycolorup = input.color(defval = color.rgb(0, 255, 0, 0), title = "Body", inline = "bodycol", group = "Candles") bodycolordn = input.color(defval = color.rgb(255, 0, 0, 0), title = "", inline = "bodycol", group = "Candles") topwickcolor = input.color(defval = #b5b5b8, title = "Wick", inline = "wickcol", group = "Candles") bottomwickcolor = input.color(defval = #b5b5b8, title = "", inline = "wickcol", group = "Candles") cellwidthbody = input.float(defval = 1.0, title = "Body Width", minval = 0.001, step = 0.1, group = "Candles") cellwidthwick = input.float(defval = 0.15, title = "Wick Width", minval = 0.001, step = 0.05, group = "Candles") cellheight = input.float(defval = 0.6, title = "Cell Height", minval = 0.001, step = 0.1, group = "Candles") backgcolor = input.color(defval = #20073e, title = "Background Color", group = "Chart") frmcolor = input.color(defval = #1848cc, title = "Frame Color", group = "Chart") showstatus = input.bool(defval = true, title = "Show Status Panel", group = "Chart") statustextcolor = input.color(defval = color.white, title = " Text Color", group = "Chart") textsize = input.string(defval = size.small, title =" Text Size", options = [size.tiny, size.small, size.normal, size.large, size.huge], group = "Chart") statusbackgcolor = input.color(defval = #3e1c7a, title = " Background", group = "Chart") tableposy = input.string(defval='bottom', title='Chart Location', options=['bottom', 'middle', 'top'], inline='chartpos', group = "Chart") tableposx = input.string(defval='left', title='', options=['left', 'center', 'right'], inline='chartpos', group = "Chart") var symbol = symbolu == "" ? syminfo.tickerid : symbolu float highest = request.security(symbol, HTF, ta.highest(10)) float lowest = request.security(symbol, HTF, ta.lowest(10)) bool highest_or_lowest_changed = highest != highest[1] or lowest != lowest[1] float mintick = (highest - lowest) / 50 get_ohlc(int [] ohcl_array, int index, float highest, float lowest)=> [o, h, l, c] = request.security(symbol, HTF, [open[index], high[index], low[index], close[index]]) array.push(ohcl_array, 5 + math.ceil((highest - o) / mintick) - 1) // open array.push(ohcl_array, 5 + math.ceil((highest - h) / mintick) - 1) // high array.push(ohcl_array, 5 + math.ceil((highest - l) / mintick) - 1) // low array.push(ohcl_array, 5 + math.ceil((highest - c) / mintick) - 1) // close draw_candle_part(table mychart, int index, int up, int down, int left, int right, color colour)=> if up <= down for y = up to down for x = left to right table.cell(table_id = mychart, column = 39 - index * 4 - x, row = y, width = (x % 2) == 0 ? cellwidthbody : cellwidthwick, height = cellheight, bgcolor = colour) draw_candle(int [] ohcl_array, table mychart, int index)=> colour = array.get(ohcl_array, index * 4 + 3) <= array.get(ohcl_array, index * 4) ? bodycolorup : bodycolordn // top wick draw_candle_part(mychart, index, array.get(ohcl_array, index * 4 + 1), math.min(array.get(ohcl_array, index * 4 + 0), array.get(ohcl_array, index * 4 + 3)) - 1, 1, 1, topwickcolor) // bottom wick draw_candle_part(mychart, index, math.max(array.get(ohcl_array, index * 4 + 0), array.get(ohcl_array, index * 4 + 3)) + 1, array.get(ohcl_array, index * 4 + 2), 1, 1, bottomwickcolor) // body draw_candle_part(mychart, index, math.min(array.get(ohcl_array, index * 4 + 0), array.get(ohcl_array, index * 4 + 3)), math.max(array.get(ohcl_array, index * 4 + 0), array.get(ohcl_array, index * 4 + 3)), 0, 2, colour) draw_rt_candle(int [] ohcl_array, table mychart)=> // clean candle for x = 37 to 39 for y = 0 to 59 table.cell(table_id = mychart, column = x, row = y, width = (x % 2) == 1 ? cellwidthbody : cellwidthwick, height = cellheight, bgcolor = backgcolor) // draw candle draw_candle(ohcl_array, mychart, 0) ohcl_array = array.new_int(0) get_ohlc(ohcl_array, 0, highest, lowest) get_ohlc(ohcl_array, 1, highest, lowest) get_ohlc(ohcl_array, 2, highest, lowest) get_ohlc(ohcl_array, 3, highest, lowest) get_ohlc(ohcl_array, 4, highest, lowest) get_ohlc(ohcl_array, 5, highest, lowest) get_ohlc(ohcl_array, 6, highest, lowest) get_ohlc(ohcl_array, 7, highest, lowest) get_ohlc(ohcl_array, 8, highest, lowest) get_ohlc(ohcl_array, 9, highest, lowest) symbolclose = str.tostring(request.security(symbol, HTF, math.round_to_mintick(close))) symbolhighest = str.tostring(request.security(symbol, HTF, math.round_to_mintick(highest))) symbollowest = str.tostring(request.security(symbol, HTF, math.round_to_mintick(lowest))) newbar = ta.change(time(HTF)) != 0 var mychart = table.new(position = tableposy + '_' + tableposx, columns = 43, rows= 60, frame_width = 3, frame_color = frmcolor, border_width = 0) if barstate.islast var isfirst = true if isfirst or newbar or highest_or_lowest_changed isfirst := false //redraw table for x = 0 to 40 for y = 0 to 59 table.cell(table_id = mychart, column = x, row = y, width = (x % 2) == 1 ? cellwidthbody : cellwidthwick, height = cellheight, bgcolor = backgcolor) if showstatus for y = 0 to 59 table.cell(table_id = mychart, column = 41, row = y, width = cellwidthwick, height = cellheight, bgcolor = frmcolor) table.cell(table_id = mychart, column = 42, row = y, width = cellwidthbody, height = cellheight, bgcolor = statusbackgcolor) table.cell(table_id = mychart, column = 42, row = 0, text = symbol + "/" + HTF, text_halign = text.align_left, text_size = textsize, text_color = statustextcolor, bgcolor = statusbackgcolor) table.cell(table_id = mychart, column = 42, row = 3, text = "Highest :" + symbolhighest, text_halign = text.align_left, text_size = textsize, text_color = statustextcolor, bgcolor = statusbackgcolor) table.cell(table_id = mychart, column = 42, row = 55, text = "Lowest :" + symbollowest, text_halign = text.align_left, text_size = textsize, text_color = statustextcolor, bgcolor = statusbackgcolor) colour = array.get(ohcl_array, 3) <= array.get(ohcl_array, 0) ? bodycolorup : bodycolordn table.cell(table_id = mychart, column = 42, row = 1, text = "Close :" + symbolclose, text_halign = text.align_left, text_size = textsize, text_color = colour, bgcolor = statusbackgcolor) for x = 0 to 9 draw_candle(ohcl_array, mychart, x) else if not isfirst draw_rt_candle(ohcl_array, mychart) if showstatus colour = array.get(ohcl_array, 3) <= array.get(ohcl_array, 0) ? bodycolorup : bodycolordn table.cell(table_id = mychart, column = 42, row = 1, text = "Close :" + symbolclose, text_halign = text.align_left, text_size = textsize, text_color = colour, bgcolor = statusbackgcolor)
IIP
https://www.tradingview.com/script/Ml2tpHF9/
isitporn
https://www.tradingview.com/u/isitporn/
8
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © isitporn //@version=5 indicator('IIP', overlay=true) //Define each MA term ma1 = ta.sma(close, input(1, 'Close')) ma3 = ta.sma(close, input(3, 'MA(3:Shortest term)')) ma5 = ta.sma(close, input(5, 'MA(5:More Shorter term)')) ma7 = ta.sma(close, input(7, 'MA(7:Shorter term)')) ma9 = ta.sma(close, input(9, 'MA(9:Short term)')) ma20 = ta.sma(close, input(20, 'MA(20:Middium term')) ma60 = ta.sma(close, input(60, 'MA(60:Long term')) ma100 = ta.sma(close, input(100, 'MA(100:Longer term)')) ma300 = ta.sma(close, input(300, 'MA(300:Longest term)')) //Plot each MA no chart plot(ma1, color=color.new(color.gray, 0), title='close', linewidth=1) plot(ma3, color=color.new(color.fuchsia, 0), title='MA(3:shortest term)', linewidth=2) plot(ma5, color=color.new(color.red, 0), title='MA(5:More Shorter term)', linewidth=4) plot(ma7, color=color.new(color.black, 0), title='MA(7:Shorter term)', linewidth=3) plot(ma9, color=color.new(color.olive, 0), title='MA(9:short term)', linewidth=3) plot(ma20, color=color.new(color.green, 0), title='MA(20:Middium term)', linewidth=4) plot(ma60, color=color.new(color.blue, 0), title='MA(60:Long term)', linewidth=3) plot(ma100, color=color.new(color.purple, 0), title='MA(100:Longer term)', linewidth=3) plot(ma300, color=color.new(color.orange, 0), title='MA(300:Longest term)', linewidth=2) //Definition of Perfect Order and Reverse Perfect Order stagePO = ma5 > ma20 and ma20 > ma60 stageRPO = ma5 < ma20 and ma20 < ma60 //Decide back round colour in each stage // stagePO=1 ? bgcolor(color=color.blue, transp=90, title="PPP Background Colour") // : stageRPO=1 ? bgcolor(color=color.red, transp=90, title="GPPP Background Colour") // : na bgcolor(color=stagePO ? color.blue : stageRPO ? color.red : na, title='PO or RPO BackGroundColour', transp=90) //Put labels on 5 days, 20 days, 60 days and 100 days before today on chart l = label.new(bar_index[4], na, '-5', color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar) label.delete(l[1]) m = label.new(bar_index[19], na, '-20', color=color.green, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar) label.delete(m[1]) n = label.new(bar_index[59], na, '-60', color=color.blue, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar) label.delete(n[1]) o = label.new(bar_index[99], na, '-100', color=color.purple, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar) label.delete(o[1]) // close price is over or under MA100? (Stron or Weak?) //S = close > ma100 ? true : na //W = close < ma100 ? true : na //bar_index > ma100 ? strong = true : bar index < ma100 ? weak = : na //plotshape(S, title="Strong_Term",location=location.bottom, style=shape.labelup, color=color.purple, size=size.tiny) //plotshape(W, title="Weak_Term", location=location.top, style=shape.labeldown, color=color.purple, size=size.tiny) // Crossover and crossunder MA5 and MA20 sma_goldencross = ta.crossover(ma5, ma20) sma_deadcross = ta.crossunder(ma5, ma20) plotshape(sma_goldencross, title='GC Point', location=location.abovebar, style=shape.triangleup, color=color.new(color.green, 0), size=size.small) plotshape(sma_deadcross, title='DC Point', location=location.belowbar, style=shape.triangledown, color=color.new(color.red, 0), size=size.small) //Draw line on first bar_index in every month chosenColor(c_) => c_ == 'aqua' ? color.aqua : c_ == 'black' ? color.black : c_ == 'blue' ? color.blue : c_ == 'fuchsia' ? color.fuchsia : c_ == 'gray' ? color.gray : c_ == 'green' ? color.green : c_ == 'lime' ? color.lime : c_ == 'maroon' ? color.maroon : c_ == 'navy' ? color.navy : c_ == 'olive' ? color.olive : c_ == 'orange' ? color.orange : c_ == 'purple' ? color.purple : c_ == 'red' ? color.red : c_ == 'silver' ? color.silver : c_ == 'teal' ? color.teal : c_ == 'white' ? color.white : c_ == 'yellow' ? color.yellow : color.black my_color_1 = input.string(title='Color', defval='navy', options=['aqua', 'black', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple', 'red', 'silver', 'teal', 'white', 'yellow']) p = timeframe.ismonthly ? '12M' : 'M' vline(BarIndex, Color, LineStyle, LineWidth) => return_1 = line.new(BarIndex, low - ta.tr, BarIndex, high + ta.tr, xloc.bar_index, extend.both, Color, LineStyle, LineWidth) return_1 if ta.change(time(p)) vline(bar_index, chosenColor(my_color_1), line.style_dotted, 1)
MA EMA apek
https://www.tradingview.com/script/AQE48r4D-MA-EMA-apek/
alexwin6726
https://www.tradingview.com/u/alexwin6726/
5
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/ // © alexwin6726 //@version=4 study("MA EMA", overlay=true) ma5=sma(close,5) ma20=sma(close,20) ma50=sma(close,50) ma240=sma(close,240) ema24=ema(close,24) ema52=ema(close,52) plot(ma5,title="ma5") plot(ma20,title="ma20") plot(ma50,title="ma50") plot(ma240,title="ma240") plot(ema24,title="ema24") plot(ema52,title="ema52")
Lowest Close
https://www.tradingview.com/script/KLYTwEdM-Lowest-Close/
kokocok
https://www.tradingview.com/u/kokocok/
5
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/ // © kokocok //@version=4 study(title="Lowest Close", overlay=true) days = input(title="Days", defval = 61) //find lowest close in last 61 days lowest = close for i = 1 to days-1 if (close[i]<lowest) lowest := close[i] plot(lowest, "Lowest", color=#8E1599)
MA EMA apek
https://www.tradingview.com/script/SL0QniU3-MA-EMA-apek/
alexwin6726
https://www.tradingview.com/u/alexwin6726/
8
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © alexwin6726 //@version=4 study("MA EMA apek", overlay=true) ma5=sma(close,5) ma20=sma(close,20) ma50=sma(close,50) ma240=sma(close,240) ema24=ema(close,24) ema52=ema(close,52) plot(ma5,title="ma5") plot(ma20,title="ma20") plot(ma50,title="ma50") plot(ma240,title="ma240") plot(ema24,title="ema24") plot(ema52,title="ema52")
Stochastic RSI Heat Candles Overlay
https://www.tradingview.com/script/eY98QpgB-Stochastic-RSI-Heat-Candles-Overlay/
noop-noop
https://www.tradingview.com/u/noop-noop/
145
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © noop42 //@version=5 indicator("Stochastic RSI Heat Candles Overlay", shorttitle="SRSI Heat Candles", overlay=true) invert_colors = input.bool(title="Invert colors", defval=false, group='Color options') color_style = input.string("R/G", options=["R/G", "G/B", "B/R"], title="Shading colors", group='Color options') z_color = input.int(0, "Third Color", minval=0, maxval=255, group='Color options') trans = input.int(0, "Transparency", minval=0, maxval=100, group='Color options') color_value(value, transp=0) => step = (255/100.0) d = value * step x = 0.0 y = 0.0 z = z_color if invert_colors x := value < 50 ? d : 127 y := value < 50 ? 127: 255 - d else y := value < 50 ? d : 127 x := value < 50 ? 127: 255 - d col = color.rgb(math.round(x), math.round(y), math.round(z), transp) if color_style == "B/R" col := color.rgb(math.round(y), math.round(z), math.round(x), transp) if color_style == "G/B" col := color.rgb(math.round(z), math.round(x), math.round(y), transp) col show_side = input.bool(false, "Show candle side", group='Options') bullish_color = input.color(#10a9eb50, "Bullish Candle Mark", group='Color options') bearish_color = input.color(#e0692850, "bearish Candle Mark", group='Color options') mode = input.string("Color candles", options=["Color candles", "Border only"], title="Overlay style", group='Color options') smoothK = input.int(3, "K", minval=1, group='Stochastic RSI') smoothD = input.int(3, "D", minval=1, group='Stochastic RSI') lengthRSI = input.int(14, "RSI Length", minval=1, group='Stochastic RSI') lengthStoch = input.int(14, "Stochastic Length", minval=1, group='Stochastic RSI') srsi_src = input(close, title="RSI Source", group='Stochastic RSI') // Calculations SRSI rsi = ta.rsi(srsi_src, lengthRSI) k = ta.sma(ta.stoch(rsi, rsi, rsi, lengthRSI), smoothK) d = ta.sma(k, smoothD) a = (k + d) / 2 ob = a > 80 os = a < 20 col = color_value(a, trans) body_color = mode == "Border only" or mode == "Shape only"? #00000000 : col plotcandle(open, high, low, close, color=body_color, wickcolor=col, bordercolor=col) plotshape(ob or os ? 1 : 0, location=location.top, color=col, style=shape.circle) plotshape(show_side and open < close ? 1 : 0, location=location.belowbar, color=bullish_color, style=shape.circle) plotshape(show_side and open > close ? 1 : 0, location=location.abovebar, color=bearish_color, style=shape.circle)
No Duplicates Interval Range & EQ
https://www.tradingview.com/script/JpKfECGC-No-Duplicates-Interval-Range-EQ/
rumpypumpydumpy
https://www.tradingview.com/u/rumpypumpydumpy/
1,294
study
5
MPL-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("No duplicates interval rangee & eq", overlay = true, max_lines_count = 56, max_labels_count = 56) // Create Level Function { // ----------------------------------------------------------------------------- f_create_level(_type, _start_condition, _active_condition, _global_level_array, _color, _line_width, _line_ext, _line_style, _label_size, _title, _iter, _is_enabled) => // _type [ string ] : Determines level type to manage. Available options : "open", "high", "low", "eq" // _start_condition [ bool ] : Determines when to obtain initial value // _active_condition [ bool ] : Determines when to continue updated value if applicable // _global_level_array [ float[] ] : global array where other of same type of levels are stored to find duplicates // _color [ color ] : color of line/text // _line_ext [ int ] : Distance to extend line to the right // _line_style [ const string ] : line style type // _label_size [ const string ] : label size used to set text size // _title [ string ] : Prefix for level's text // _iter [ int ] : How many previous iterations to retrieve level from // _is_enabled : Override for disabling level var float _price = na var int _start_time = na var float _hh = na var float _ll = na var line _price_line = line.new(x1 = na, y1 = na, x2 = na, y2 = na, xloc = xloc.bar_time, color = _color, width = _line_width, style = _line_style) var label _price_label = label.new(x = na, y = na, xloc = xloc.bar_time, style = label.style_label_left, color = #00000000, size = _label_size, textcolor = _color) _end_time = int(time + _line_ext * ta.change(time)) if _type == "open" if _start_condition _price := open _start_time := time else if _type == "high" if _start_condition _price := high _start_time := time else if _active_condition _price := math.max(_price, high) else if _type == "low" if _start_condition _price := low _start_time := time else if _active_condition _price := math.min(_price, low) else if _type == "eq" if _start_condition _hh := high _ll := low _price := math.avg(_hh, _ll) _start_time := time else if _active_condition _hh := math.max(_hh, high) _ll := math.min(_ll, low) _price := math.avg(_hh, _ll) float _price_val = _iter == 0 ? _price : ta.valuewhen(_start_condition, _price[1], _iter - 1) int _start_time_val = _iter == 0 ? _start_time : ta.valuewhen(_start_condition, _start_time[1], _iter - 1) _found_existing = array.indexof(_global_level_array, _price_val) > -1 if _is_enabled if _found_existing line.set_xy1(_price_line, x = na, y = na) line.set_xy2(_price_line, x = na, y = na) label.set_xy(_price_label, x = na, y = na) else array.push(_global_level_array, _price_val) line.set_xy1(_price_line, x = _start_time_val, y = _price_val) line.set_xy2(_price_line, x = _end_time, y = _price_val) label.set_text(_price_label, text = _title + " : " + str.tostring(_price_val)) label.set_xy(_price_label, x = _end_time, y = _price_val) // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // } // Necessary Variables { // ----------------------------------------------------------------------------- // Global arrays used to detect duplicate levels. // Duplication is detected implicitly by execution order and whether the level has already been placed in the global array. float[] global_open_array = array.new_float() float[] global_high_array = array.new_float() float[] global_low_array = array.new_float() float[] global_eq_array = array.new_float() new_H4 = ta.change(time("240")) != 0 new_day = ta.change(time("D")) != 0 new_week = ta.change(time("W")) != 0 new_month = ta.change(time("M")) != 0 new_quarter = ta.change(time("3M")) != 0 new_year = ta.change(time("12M")) != 0 is_monday = dayofweek == dayofweek.monday // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // } // Global settings { // ----------------------------------------------------------------------------- inp_open_line_style = input.string("Dotted", options = ["Solid", "Dotted", "Dashed"], title = "Open Line Style", group = "Global Settings") inp_high_line_style = input.string("Solid", options = ["Solid", "Dotted", "Dashed"], title = "High Line Style", group = "Global Settings") inp_low_line_style = input.string("Solid", options = ["Solid", "Dotted", "Dashed"], title = "Low Line Style", group = "Global Settings") inp_eq_line_style = input.string("Dashed", options = ["Solid", "Dotted", "Dashed"], title = "EQ Line Style", group = "Global Settings") inp_text_size = input.string("Small", options = ["Small", "Normal", "Large"], title = "Text Size", group = "Global Settings") inp_ext = input.int(30, title = "Line Extension", group = "Global Settings") text_size = inp_text_size == "Small" ? size.small : inp_text_size == "Normal" ? size.normal : size.large open_line_style = inp_open_line_style == "Solid" ? line.style_solid : inp_open_line_style == "Dotted" ? line.style_dotted : line.style_dashed high_line_style = inp_high_line_style == "Solid" ? line.style_solid : inp_high_line_style == "Dotted" ? line.style_dotted : line.style_dashed low_line_style = inp_low_line_style == "Solid" ? line.style_solid : inp_low_line_style == "Dotted" ? line.style_dotted : line.style_dashed eq_line_style = inp_eq_line_style == "Solid" ? line.style_solid : inp_eq_line_style == "Dotted" ? line.style_dotted : line.style_dashed // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // } // Yearly & Prev Yearly // ----------------------------------------------------------------------------- inp_show_yearly_open = input.bool(true, title = "OPEN", group = "Yearly Levels", inline = "1") inp_show_yearly_high = input.bool(true, title = "HIGH", group = "Yearly Levels", inline = "1") inp_show_yearly_low = input.bool(true, title = "LOW", group = "Yearly Levels", inline = "1") inp_show_yearly_eq = input.bool(true, title = "EQ", group = "Yearly Levels", inline = "1") inp_yearly_col = input.color(color.red, title = "color", group = "Yearly Levels", inline = "2") inp_yearly_line_width = input.int(5, title = "Line width", minval = 1, group = "Yearly Levels", inline = "2") yearly_ok = timeframe.isintraday or timeframe.isdaily or timeframe.isweekly or (timeframe.ismonthly and timeframe.multiplier < 12) f_create_level("open", new_year, not new_year, global_open_array, inp_yearly_col, inp_yearly_line_width, inp_ext, open_line_style, text_size, "Yearly OPEN", 0, inp_show_yearly_open and yearly_ok) f_create_level("high", new_year, not new_year, global_high_array, inp_yearly_col, inp_yearly_line_width, inp_ext, high_line_style, text_size, "Yearly HIGH", 0, inp_show_yearly_high and yearly_ok) f_create_level("low", new_year, not new_year, global_low_array, inp_yearly_col, inp_yearly_line_width, inp_ext, low_line_style, text_size, "Yearly LOW", 0, inp_show_yearly_low and yearly_ok) f_create_level("eq", new_year, not new_year, global_eq_array, inp_yearly_col, inp_yearly_line_width, inp_ext, eq_line_style, text_size, "Yearly EQ", 0, inp_show_yearly_eq and yearly_ok) inp_show_prev_yearly_open = input.bool(true, title = "OPEN", group = "Prev Yearly Levels", inline = "1") inp_show_prev_yearly_high = input.bool(true, title = "HIGH", group = "Prev Yearly Levels", inline = "1") inp_show_prev_yearly_low = input.bool(true, title = "LOW", group = "Prev Yearly Levels", inline = "1") inp_show_prev_yearly_eq = input.bool(true, title = "EQ", group = "Prev Yearly Levels", inline = "1") inp_prev_yearly_col = input.color(color.maroon, title = "color", group = "Prev Yearly Levels", inline = "2") inp_prev_yearly_line_width = input.int(5, title = "Line width", minval = 1, group = "Prev Yearly Levels", inline = "2") f_create_level("open", new_year, not new_year, global_open_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, open_line_style, text_size, "Prev Yearly OPEN", 1, inp_show_prev_yearly_open and yearly_ok) f_create_level("high", new_year, not new_year, global_high_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, high_line_style, text_size, "Prev Yearly HIGH", 1, inp_show_prev_yearly_high and yearly_ok) f_create_level("low", new_year, not new_year, global_low_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, low_line_style, text_size, "Prev Yearly LOW", 1, inp_show_prev_yearly_low and yearly_ok) f_create_level("eq", new_year, not new_year, global_eq_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, eq_line_style, text_size, "Prev Yearly EQ", 1, inp_show_prev_yearly_eq and yearly_ok) // ----------------------------------------------------------------------------- // Quarterly and Prev Quarterly // ----------------------------------------------------------------------------- inp_show_quarterly_open = input.bool(true, title = "OPEN", group = "Quarterly Levels", inline = "1") inp_show_quarterly_high = input.bool(true, title = "HIGH", group = "Quarterly Levels", inline = "1") inp_show_quarterly_low = input.bool(true, title = "LOW", group = "Quarterly Levels", inline = "1") inp_show_quarterly_eq = input.bool(true, title = "EQ", group = "Quarterly Levels", inline = "1") inp_quarterly_col = input.color(color.orange, title = "color", group = "Quarterly Levels", inline = "2") inp_quarterly_line_width = input.int(4, title = "Line width", minval = 1, group = "Quarterly Levels", inline = "2") quarterly_ok = timeframe.isintraday or timeframe.isdaily or timeframe.isweekly f_create_level("open", new_quarter, not new_quarter, global_open_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, open_line_style, text_size, "Quarterly OPEN", 0, inp_show_quarterly_open and quarterly_ok) f_create_level("high", new_quarter, not new_quarter, global_high_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, high_line_style, text_size, "Quarterly HIGH", 0, inp_show_quarterly_high and quarterly_ok) f_create_level("low", new_quarter, not new_quarter, global_low_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, low_line_style, text_size, "Quarterly LOW", 0, inp_show_quarterly_low and quarterly_ok) f_create_level("eq", new_quarter, not new_quarter, global_eq_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, eq_line_style, text_size, "Quarterly EQ", 0, inp_show_quarterly_eq and quarterly_ok) inp_show_prev_quarterly_open = input.bool(true, title = "OPEN", group = "Prev Quarterly Levels", inline = "1") inp_show_prev_quarterly_high = input.bool(true, title = "HIGH", group = "Prev Quarterly Levels", inline = "1") inp_show_prev_quarterly_low = input.bool(true, title = "LOW", group = "Prev Quarterly Levels", inline = "1") inp_show_prev_quarterly_eq = input.bool(true, title = "EQ", group = "Prev Quarterly Levels", inline = "1") inp_prev_quarterly_col = input.color(color.yellow, title = "color", group = "Prev Quarterly Levels", inline = "2") inp_prev_quarterly_line_width = input.int(4, title = "Line width", minval = 1, group = "Prev Quarterly Levels", inline = "2") f_create_level("open", new_quarter, not new_quarter, global_open_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, open_line_style, text_size, "Prev Quarterly OPEN", 1, inp_show_prev_quarterly_open and quarterly_ok) f_create_level("high", new_quarter, not new_quarter, global_high_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, high_line_style, text_size, "Prev Quarterly HIGH", 1, inp_show_prev_quarterly_high and quarterly_ok) f_create_level("low", new_quarter, not new_quarter, global_low_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, low_line_style, text_size, "Prev Quarterly LOW", 1, inp_show_prev_quarterly_low and quarterly_ok) f_create_level("eq", new_quarter, not new_quarter, global_eq_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, eq_line_style, text_size, "Prev Quarterly EQ", 1, inp_show_prev_quarterly_eq and quarterly_ok) // ----------------------------------------------------------------------------- // Monthly and Prev Monthly // ----------------------------------------------------------------------------- inp_show_monthly_open = input.bool(true, title = "OPEN", group = "Monthly Levels", inline = "1") inp_show_monthly_high = input.bool(true, title = "HIGH", group = "Monthly Levels", inline = "1") inp_show_monthly_low = input.bool(true, title = "LOW", group = "Monthly Levels", inline = "1") inp_show_monthly_eq = input.bool(true, title = "EQ", group = "Monthly Levels", inline = "1") inp_monthly_col = input.color(color.lime, title = "color", group = "Monthly Levels", inline = "2") inp_monthly_line_width = input.int(3, title = "Line width", minval = 1, group = "Monthly Levels", inline = "2") monthly_ok = timeframe.isintraday or timeframe.isdaily f_create_level("open", new_month, not new_month, global_open_array, inp_monthly_col, inp_monthly_line_width, inp_ext, open_line_style, text_size, "Monthly OPEN", 0, inp_show_monthly_open and monthly_ok) f_create_level("high", new_month, not new_month, global_high_array, inp_monthly_col, inp_monthly_line_width, inp_ext, high_line_style, text_size, "Monthly HIGH", 0, inp_show_monthly_high and monthly_ok) f_create_level("low", new_month, not new_month, global_low_array, inp_monthly_col, inp_monthly_line_width, inp_ext, low_line_style, text_size, "Monthly LOW", 0, inp_show_monthly_low and monthly_ok) f_create_level("eq", new_month, not new_month, global_eq_array, inp_monthly_col, inp_monthly_line_width, inp_ext, eq_line_style, text_size, "Monthly EQ", 0, inp_show_monthly_eq and monthly_ok) inp_show_prev_monthly_open = input.bool(true, title = "OPEN", group = "Prev Monthly Levels", inline = "1") inp_show_prev_monthly_high = input.bool(true, title = "HIGH", group = "Prev Monthly Levels", inline = "1") inp_show_prev_monthly_low = input.bool(true, title = "LOW", group = "Prev Monthly Levels", inline = "1") inp_show_prev_monthly_eq = input.bool(true, title = "EQ", group = "Prev Monthly Levels", inline = "1") inp_prev_monthly_col = input.color(color.green, title = "color", group = "Prev Monthly Levels", inline = "2") inp_prev_monthly_line_width = input.int(3, title = "Line width", minval = 1, group = "Prev Monthly Levels", inline = "2") f_create_level("open", new_month, not new_month, global_open_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, open_line_style, text_size, "Prev Monthly OPEN", 1, inp_show_prev_monthly_open and monthly_ok) f_create_level("high", new_month, not new_month, global_high_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, high_line_style, text_size, "Prev Monthly HIGH", 1, inp_show_prev_monthly_high and monthly_ok) f_create_level("low", new_month, not new_month, global_low_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, low_line_style, text_size, "Prev Monthly LOW", 1, inp_show_prev_monthly_low and monthly_ok) f_create_level("eq", new_month, not new_month, global_eq_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, eq_line_style, text_size, "Prev Monthly EQ", 1, inp_show_prev_monthly_eq and monthly_ok) // ----------------------------------------------------------------------------- // Weekly and Prev Weekly // ----------------------------------------------------------------------------- inp_show_weekly_open = input.bool(true, title = "OPEN", group = "Weekly Levels", inline = "1") inp_show_weekly_high = input.bool(true, title = "HIGH", group = "Weekly Levels", inline = "1") inp_show_weekly_low = input.bool(true, title = "LOW", group = "Weekly Levels", inline = "1") inp_show_weekly_eq = input.bool(true, title = "EQ", group = "Weekly Levels", inline = "1") inp_weekly_col = input.color(color.aqua, title = "color", group = "Weekly Levels", inline = "2") inp_weekly_line_width = input.int(2, title = "Line width", minval = 1, group = "Weekly Levels", inline = "2") weekly_ok = timeframe.isintraday or timeframe.isdaily f_create_level("open", new_week, not new_week, global_open_array, inp_weekly_col, inp_weekly_line_width, inp_ext, open_line_style, text_size, "Weekly OPEN", 0, inp_show_weekly_open and weekly_ok) f_create_level("high", new_week, not new_week, global_high_array, inp_weekly_col, inp_weekly_line_width, inp_ext, high_line_style, text_size, "Weekly HIGH", 0, inp_show_weekly_high and weekly_ok) f_create_level("low", new_week, not new_week, global_low_array, inp_weekly_col, inp_weekly_line_width, inp_ext, low_line_style, text_size, "Weekly LOW", 0, inp_show_weekly_low and weekly_ok) f_create_level("eq", new_week, not new_week, global_eq_array, inp_weekly_col, inp_weekly_line_width, inp_ext, eq_line_style, text_size, "Weekly EQ", 0, inp_show_weekly_eq and weekly_ok) inp_show_prev_weekly_open = input.bool(true, title = "OPEN", group = "Prev Weekly Levels", inline = "1") inp_show_prev_weekly_high = input.bool(true, title = "HIGH", group = "Prev Weekly Levels", inline = "1") inp_show_prev_weekly_low = input.bool(true, title = "LOW", group = "Prev Weekly Levels", inline = "1") inp_show_prev_weekly_eq = input.bool(true, title = "EQ", group = "Prev Weekly Levels", inline = "1") inp_prev_weekly_col = input.color(color.blue, title = "color", group = "Prev Weekly Levels", inline = "2") inp_prev_weekly_line_width = input.int(2, title = "Line width", minval = 1, group = "Prev Weekly Levels", inline = "2") f_create_level("open", new_week, not new_week, global_open_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, open_line_style, text_size, "Prev Weekly OPEN", 1, inp_show_prev_weekly_open and weekly_ok) f_create_level("high", new_week, not new_week, global_high_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, high_line_style, text_size, "Prev Weekly HIGH", 1, inp_show_prev_weekly_high and weekly_ok) f_create_level("low", new_week, not new_week, global_low_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, low_line_style, text_size, "Prev Weekly LOW", 1, inp_show_prev_weekly_low and weekly_ok) f_create_level("eq", new_week, not new_week, global_eq_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, eq_line_style, text_size, "Prev Weekly EQ", 1, inp_show_prev_weekly_eq and weekly_ok) // ----------------------------------------------------------------------------- // Daily and Prev Daily // ----------------------------------------------------------------------------- inp_show_daily_open = input.bool(true, title = "OPEN", group = "Daily Levels", inline = "1") inp_show_daily_high = input.bool(true, title = "HIGH", group = "Daily Levels", inline = "1") inp_show_daily_low = input.bool(true, title = "LOW", group = "Daily Levels", inline = "1") inp_show_daily_eq = input.bool(true, title = "EQ", group = "Daily Levels", inline = "1") inp_daily_col = input.color(color.white, title = "color", group = "Daily Levels", inline = "2") inp_daily_line_width = input.int(1, title = "Line width", minval = 1, group = "Daily Levels", inline = "2") daily_ok = timeframe.isintraday f_create_level("open", new_day, not new_day, global_open_array, inp_daily_col, inp_daily_line_width, inp_ext, open_line_style, text_size, "Daily OPEN", 0, inp_show_daily_open and daily_ok) f_create_level("high", new_day, not new_day, global_high_array, inp_daily_col, inp_daily_line_width, inp_ext, high_line_style, text_size, "Daily HIGH", 0, inp_show_daily_high and daily_ok) f_create_level("low", new_day, not new_day, global_low_array, inp_daily_col, inp_daily_line_width, inp_ext, low_line_style, text_size, "Daily LOW", 0, inp_show_daily_low and daily_ok) f_create_level("eq", new_day, not new_day, global_eq_array, inp_daily_col, inp_daily_line_width, inp_ext, eq_line_style, text_size, "Daily EQ", 0, inp_show_daily_eq and daily_ok) inp_show_prev_daily_open = input.bool(true, title = "OPEN", group = "Prev Daily Levels", inline = "1") inp_show_prev_daily_high = input.bool(true, title = "HIGH", group = "Prev Daily Levels", inline = "1") inp_show_prev_daily_low = input.bool(true, title = "LOW", group = "Prev Daily Levels", inline = "1") inp_show_prev_daily_eq = input.bool(true, title = "EQ", group = "Prev Daily Levels", inline = "1") inp_prev_daily_col = input.color(color.gray, title = "color", group = "Prev Daily Levels", inline = "2") inp_prev_daily_line_width = input.int(1, title = "Line width", minval = 1, group = "Prev Daily Levels", inline = "2") f_create_level("open", new_day, not new_day, global_open_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, open_line_style, text_size, "Prev Daily OPEN", 1, inp_show_prev_daily_open and daily_ok) f_create_level("high", new_day, not new_day, global_high_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, high_line_style, text_size, "Prev Daily HIGH", 1, inp_show_prev_daily_high and daily_ok) f_create_level("low", new_day, not new_day, global_low_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, low_line_style, text_size, "Prev Daily LOW", 1, inp_show_prev_daily_low and daily_ok) f_create_level("eq", new_day, not new_day, global_eq_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, eq_line_style, text_size, "Prev Daily EQ", 1, inp_show_prev_daily_eq and daily_ok) // ----------------------------------------------------------------------------- // Monday and Prev Monday // ----------------------------------------------------------------------------- // Note : Monday range is a special case and is why the _active_condition is implemented in the function. We only want start on Monday, and ONLY update levels during monday. inp_show_monday_open = input.bool(true, title = "OPEN", group = "Monday Levels", inline = "1") inp_show_monday_high = input.bool(true, title = "HIGH", group = "Monday Levels", inline = "1") inp_show_monday_low = input.bool(true, title = "LOW", group = "Monday Levels", inline = "1") inp_show_monday_eq = input.bool(true, title = "EQ", group = "Monday Levels", inline = "1") inp_monday_col = input.color(color.fuchsia, title = "color", group = "Monday Levels", inline = "2") inp_monday_line_width = input.int(1, title = "Line width", minval = 1, group = "Monday Levels", inline = "2") monday_ok = timeframe.isintraday f_create_level("open", new_week, is_monday, global_open_array, inp_monday_col, inp_monday_line_width, inp_ext, open_line_style, text_size, "Monday OPEN", 0, inp_show_monday_open and monday_ok) f_create_level("high", new_week, is_monday, global_high_array, inp_monday_col, inp_monday_line_width, inp_ext, high_line_style, text_size, "Monday HIGH", 0, inp_show_monday_high and monday_ok) f_create_level("low", new_week, is_monday, global_low_array, inp_monday_col, inp_monday_line_width, inp_ext, low_line_style, text_size, "Monday LOW", 0, inp_show_monday_low and monday_ok) f_create_level("eq", new_week, is_monday, global_eq_array, inp_monday_col, inp_monday_line_width, inp_ext, eq_line_style, text_size, "Monday EQ", 0, inp_show_monday_eq and monday_ok) inp_show_prev_monday_open = input.bool(true, title = "OPEN", group = "Prev Monday Levels", inline = "1") inp_show_prev_monday_high = input.bool(true, title = "HIGH", group = "Prev Monday Levels", inline = "1") inp_show_prev_monday_low = input.bool(true, title = "LOW", group = "Prev Monday Levels", inline = "1") inp_show_prev_monday_eq = input.bool(true, title = "EQ", group = "Prev Monday Levels", inline = "1") inp_prev_monday_col = input.color(color.purple, title = "color", group = "Prev Monday Levels", inline = "2") inp_prev_monday_line_width = input.int(1, title = "Line width", minval = 1, group = "Prev Monday Levels", inline = "2") f_create_level("open", new_week, is_monday, global_open_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, open_line_style, text_size, "Prev Monday OPEN", 1, inp_show_prev_monday_open and monday_ok) f_create_level("high", new_week, is_monday, global_high_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, high_line_style, text_size, "Prev Monday HIGH", 1, inp_show_prev_monday_high and monday_ok) f_create_level("low", new_week, is_monday, global_low_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, low_line_style, text_size, "Prev Monday LOW", 1, inp_show_prev_monday_low and monday_ok) f_create_level("eq", new_week, is_monday, global_eq_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, eq_line_style, text_size, "Prev Monday EQ", 1, inp_show_prev_monday_eq and monday_ok) // ----------------------------------------------------------------------------- // H4 and Prev H4 // ----------------------------------------------------------------------------- inp_show_H4_open = input.bool(true, title = "OPEN", group = "H4 Levels", inline = "1") inp_show_H4_high = input.bool(true, title = "HIGH", group = "H4 Levels", inline = "1") inp_show_H4_low = input.bool(true, title = "LOW", group = "H4 Levels", inline = "1") inp_show_H4_eq = input.bool(true, title = "EQ", group = "H4 Levels", inline = "1") inp_H4_col = input.color(color.teal, title = "color", group = "H4 Levels", inline = "2") inp_H4_line_width = input.int(1, title = "Line width", minval = 1, group = "H4 Levels", inline = "2") H4_ok = timeframe.isintraday and timeframe.multiplier < 240 f_create_level("open", new_H4, not new_H4, global_open_array, inp_H4_col, inp_H4_line_width, inp_ext, open_line_style, text_size, "H4 OPEN", 0, inp_show_H4_open and H4_ok) f_create_level("high", new_H4, not new_H4, global_high_array, inp_H4_col, inp_H4_line_width, inp_ext, high_line_style, text_size, "H4 HIGH", 0, inp_show_H4_high and H4_ok) f_create_level("low", new_H4, not new_H4, global_low_array, inp_H4_col, inp_H4_line_width, inp_ext, low_line_style, text_size, "H4 LOW", 0, inp_show_H4_low and H4_ok) f_create_level("eq", new_H4, not new_H4, global_eq_array, inp_H4_col, inp_H4_line_width, inp_ext, eq_line_style, text_size, "H4 EQ", 0, inp_show_H4_eq and H4_ok) inp_show_prev_H4_open = input.bool(true, title = "OPEN", group = "Prev H4 Levels", inline = "1") inp_show_prev_H4_high = input.bool(true, title = "HIGH", group = "Prev H4 Levels", inline = "1") inp_show_prev_H4_low = input.bool(true, title = "LOW", group = "Prev H4 Levels", inline = "1") inp_show_prev_H4_eq = input.bool(true, title = "EQ", group = "Prev H4 Levels", inline = "1") inp_prev_H4_col = input.color(color.olive, title = "color", group = "Prev H4 Levels", inline = "2") inp_prev_H4_line_width = input.int(1, title = "Line width", minval = 1, group = "Prev H4 Levels", inline = "2") f_create_level("open", new_H4, not new_H4, global_open_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, open_line_style, text_size, "Prev H4 OPEN", 1, inp_show_prev_H4_open and H4_ok) f_create_level("high", new_H4, not new_H4, global_high_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, high_line_style, text_size, "Prev H4 HIGH", 1, inp_show_prev_H4_high and H4_ok) f_create_level("low", new_H4, not new_H4, global_low_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, low_line_style, text_size, "Prev H4 LOW", 1, inp_show_prev_H4_low and H4_ok) f_create_level("eq", new_H4, not new_H4, global_eq_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, eq_line_style, text_size, "Prev H4 EQ", 1, inp_show_prev_H4_eq and H4_ok) // -----------------------------------------------------------------------------
RSI Multi TF strategy
https://www.tradingview.com/script/oJFnSCrC-RSI-Multi-TF-strategy/
anaryan
https://www.tradingview.com/u/anaryan/
47
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/ // © anaryan //@version=4 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © anaryan // ---------------------------------------------------------------------------- // RSI MultiTimeframe Indicator // ---------------------------------------------------------------------------- // Plots 3 RSI (Weekly, Daily, 4h) at the same time, regardless of the Chart Timeframe. // Highlights in green (or red) if all RSI are oversold (or overbought). // Can trigger custom oversold and overbought alerts. study(title="RSI Multi TF", shorttitle="RSI Multi TF (W, D, 4h)") source = close length = input(14, minval=1) HighlightBreaches = input(true, title="Highlight Oversold and Overbought?", type=input.bool) // RSI RSI_1 = security(syminfo.tickerid, "W", rsi(source, length)) RSI_2 = security(syminfo.tickerid, "D", rsi(source, length)) RSI_3 = security(syminfo.tickerid, "240", rsi(source, length)) plot(RSI_3, title="4h", color=color.gray, linewidth=1) plot(RSI_2, title="D", color=color.red, linewidth=2) plot(RSI_1, title="W", color=color.yellow, linewidth=3) UpperBand = input(70, title="Upper band") LowerBand = input(30, title="Lower band") b_color = RSI_3 > UpperBand and RSI_1 > UpperBand and RSI_2 > UpperBand ? color.red : RSI_3 < LowerBand and RSI_1 < LowerBand and RSI_2 < LowerBand ? color.green : na bgcolor(HighlightBreaches ? b_color : na, transp=50) h0 = hline(UpperBand, title="Upper band", linestyle=hline.style_dashed, linewidth=1, color=color.red) h1 = hline(LowerBand, title="Lower band", linestyle=hline.style_dashed, linewidth=1, color=color.green) fill(h0, h1) alertcondition(b_color == color.green, title='MultiOversold', message='Multi Oversold!') alertcondition(b_color == color.red, title='MultiOverbought', message='Multi Overbought!')
Array to SMA/EMA
https://www.tradingview.com/script/qnxT5jke-Array-to-SMA-EMA/
antondmt
https://www.tradingview.com/u/antondmt/
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/ // © antondmt // @version=5 indicator("Array to SMA/EMA") // SMA FUNCTION { // Returns an array of SMA values from a given array array_sma(input_array, int sma_length = 2) => array_size = array.size(input_array) output_array = array.new_float(array_size, na) if(array_size >= sma_length and sma_length > 0) // Period length has to be same or shorter than array length and above 0 to calculate for index = 0 to array_size - 1 sum = 0.0 if index < sma_length - 1 for i = 0 to index sum := sum + array.get(input_array, i) else for i = index - sma_length + 1 to index sum := sum + array.get(input_array, i) array.set(output_array, index, sum / sma_length) output_array // } // EMA FUNCTION { // Returns an array of EMA values from a given array array_ema(input_array, int ema_length = 2, bool sma_seed = true) => // SMA seed: True for first value being SMA. False for first value being used and unchanged array_size = array.size(input_array) output_array = array.new_float(array_size, na) if(array_size >= ema_length and ema_length > 0) // Avoids bugs where period length is longer than the array for index = 0 to array_size - 1 alpha = 2 / (ema_length + 1) sum = 0.0 if(index == 0) if(sma_seed) array.set(output_array, index, array.get(input_array, index) / ema_length) else array.set(output_array, index, array.get(input_array, index)) else array.set(output_array, index, (alpha * array.get(input_array, index)) + (1 - alpha) * array.get(output_array, index - 1)) output_array // } // TEST SPACE test_array = array.new_float(0) array.push(test_array, 1) array.push(test_array, 2) array.push(test_array, 3) array.push(test_array, 4) array.push(test_array, 5) test_array := array_sma(test_array, 4) // test_array := array_sma(test_array, 0) // test_array := array_sma(test_array) // test_array := array_ema(test_array, 3) // test_array := array_ema(test_array, 3, false) // PRINT SPACE { lab = " | " for i = 0 to array.size(test_array) - 1 lab := lab + str.tostring(array.get(test_array, i)) + " | " l = label.new(bar_index, close, lab) label.delete(l[1]) // }
Rolling largest Impulse Murreys Lines
https://www.tradingview.com/script/iJpIEMfW-Rolling-largest-Impulse-Murreys-Lines/
RicardoSantos
https://www.tradingview.com/u/RicardoSantos/
3,012
study
5
MPL-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='Rolling largest Impulse Murreys Lines', overlay=true, max_bars_back=500) import RicardoSantos/FunctionArrayMaxSubKadanesAlgorithm/1 as msub import RicardoSantos/ColorExtension/4 as colore // helpers: line_style_switch (string _style) => switch (_style) ('dashed') => line.style_dashed ('dotted') => line.style_dotted ('solid') => line.style_solid line_extend_switch (string _extend) => switch (_extend) ('left') => extend.left ('right') => extend.right ('both') => extend.both ('none') => extend.none label_textsize(string _size) => switch (_size) ('auto') => size.auto ('huge') => size.huge ('large') => size.large ('normal') => size.normal ('small') => size.small ('tiny') => size.tiny // inputs: g_param = 'Parameters' int window_size = input.int(defval=250, title='Window Size', minval=1, maxval=500, tooltip='size of data to search for largest impulse swing.', group=g_param) bool direction = 'Bull' == input.string(defval='Bull', title='Direction of impulse', options=['Bull', 'Bear'], tooltip='prefered direction of impulse.', group=g_param) float i_inversion_rate = input.float(defval=1.0, title='Inversion Rate', minval=0.0, maxval=1.0, tooltip='Inversion rate used to mirror the base line.', group=g_param) g_style = 'Line Options' i_base_color = input.color(defval=color.silver, title='Base', inline='b', group=g_style) i_base_extend = line_extend_switch(input.string(defval='none', options=['left', 'right', 'both', 'none'], title='', inline='b', group=g_style)) i_base_style = line_style_switch(input.string(defval='solid', options=['dashed', 'dotted', 'solid'], title='', inline='b', group=g_style)) i_base_width = input.int(defval=1, minval=0, title='', tooltip='Base line properties.', inline='b', group=g_style) i_invr_color = input.color(defval=color.silver, title='Inverse', inline='i', group=g_style) i_invr_extend = line_extend_switch(input.string(defval='none', options=['left', 'right', 'both', 'none'], title='', inline='i', group=g_style)) i_invr_style = line_style_switch(input.string(defval='dashed', options=['dashed', 'dotted', 'solid'], title='', inline='i', group=g_style)) i_invr_width = input.int(defval=1, minval=0, title='', tooltip='Inverse line properties.', inline='i', group=g_style) i_extend = line_extend_switch(input.string(defval='left', options=['left', 'right', 'both', 'none'], title='MML Extend', inline='00', group=g_style)) i_labels = input.bool(defval=true, title='', inline='00', group=g_style) i_labels_textsize = input.string(defval='small', options=['auto', 'huge', 'large', 'normal', 'small', 'tiny'], title='Labels', inline='00', group=g_style) i_mm01_color = input.color(defval=color.gray, title='-2/8', inline='01', group=g_style) i_mm01_style = line_style_switch(input.string(defval='dotted', options=['dashed', 'dotted', 'solid'], title='', inline='01', group=g_style)) i_mm01_width = input.int(defval=1, minval=0, title='', tooltip='-2/8 line properties.', inline='01', group=g_style) i_mm02_color = input.color(defval=color.gray, title='-1/8', inline='02', group=g_style) i_mm02_style = line_style_switch(input.string(defval='dashed', options=['dashed', 'dotted', 'solid'], title='', inline='02', group=g_style)) i_mm02_width = input.int(defval=1, minval=0, title='', tooltip='-1/8 line properties.', inline='02', group=g_style) i_mm03_color = input.color(defval=color.aqua, title=' 0/8', inline='03', group=g_style) i_mm03_style = line_style_switch(input.string(defval='solid' , options=['dashed', 'dotted', 'solid'], title='', inline='03', group=g_style)) i_mm03_width = input.int(defval=2, minval=0, title='', tooltip=' 0/8 line properties.', inline='03', group=g_style) i_mm04_color = input.color(defval=color.gray, title=' 1/8', inline='04', group=g_style) i_mm04_style = line_style_switch(input.string(defval='dashed' , options=['dashed', 'dotted', 'solid'], title='', inline='04', group=g_style)) i_mm04_width = input.int(defval=1, minval=0, title='', tooltip=' 1/8 line properties.', inline='04', group=g_style) i_mm05_color = input.color(defval=color.gray, title=' 2/8', inline='05', group=g_style) i_mm05_style = line_style_switch(input.string(defval='solid' , options=['dashed', 'dotted', 'solid'], title='', inline='05', group=g_style)) i_mm05_width = input.int(defval=1, minval=0, title='', tooltip=' 2/8 line properties.', inline='05', group=g_style) i_mm06_color = input.color(defval=color.gray, title=' 3/8', inline='06', group=g_style) i_mm06_style = line_style_switch(input.string(defval='dashed' , options=['dashed', 'dotted', 'solid'], title='', inline='06', group=g_style)) i_mm06_width = input.int(defval=1, minval=0, title='', tooltip=' 3/8 line properties.', inline='06', group=g_style) i_mm07_color = input.color(defval=color.lime, title=' 4/8', inline='07', group=g_style) i_mm07_style = line_style_switch(input.string(defval='solid' , options=['dashed', 'dotted', 'solid'], title='', inline='07', group=g_style)) i_mm07_width = input.int(defval=2, minval=0, title='', tooltip=' 4/8 line properties.', inline='07', group=g_style) i_mm08_color = input.color(defval=color.gray, title=' 5/8', inline='08', group=g_style) i_mm08_style = line_style_switch(input.string(defval='dashed' , options=['dashed', 'dotted', 'solid'], title='', inline='08', group=g_style)) i_mm08_width = input.int(defval=1, minval=0, title='', tooltip=' 5/8 line properties.', inline='08', group=g_style) i_mm09_color = input.color(defval=color.gray, title=' 6/8', inline='09', group=g_style) i_mm09_style = line_style_switch(input.string(defval='solid' , options=['dashed', 'dotted', 'solid'], title='', inline='09', group=g_style)) i_mm09_width = input.int(defval=1, minval=0, title='', tooltip=' 6/8 line properties.', inline='09', group=g_style) i_mm10_color = input.color(defval=color.gray, title=' 7/8', inline='10', group=g_style) i_mm10_style = line_style_switch(input.string(defval='dashed' , options=['dashed', 'dotted', 'solid'], title='', inline='10', group=g_style)) i_mm10_width = input.int(defval=1, minval=0, title='', tooltip=' 7/8 line properties.', inline='10', group=g_style) i_mm11_color = input.color(defval=color.aqua, title=' 8/8', inline='11', group=g_style) i_mm11_style = line_style_switch(input.string(defval='solid' , options=['dashed', 'dotted', 'solid'], title='', inline='11', group=g_style)) i_mm11_width = input.int(defval=2, minval=0, title='', tooltip=' 8/8 line properties.', inline='11', group=g_style) i_mm12_color = input.color(defval=color.gray, title=' 9/8', inline='12', group=g_style) i_mm12_style = line_style_switch(input.string(defval='dashed' , options=['dashed', 'dotted', 'solid'], title='', inline='12', group=g_style)) i_mm12_width = input.int(defval=1, minval=0, title='', tooltip=' 9/8 line properties.', inline='12', group=g_style) i_mm13_color = input.color(defval=color.gray, title='10/8', inline='13', group=g_style) i_mm13_style = line_style_switch(input.string(defval='dotted' , options=['dashed', 'dotted', 'solid'], title='', inline='13', group=g_style)) i_mm13_width = input.int(defval=1, minval=0, title='', tooltip='10/8 line properties.', inline='13', group=g_style) // prepare data: float hl = (direction ? +1.0 : -1.0) * ta.change(high * low) var float[] samples = array.new_float(size=window_size, initial_value=0.0) array.unshift(samples, hl) array.pop(samples) // find the largest impulse in the data samples: [ki_max, ki_start, ki_end] = msub.indices(samples) bool is_new_impulse = ta.change(ki_start + ki_end) != 0 // initialize the lines: var line[] lines = array.new_line(15) var label[] labels = array.new_label(15) if barstate.isfirst // base line: array.set(lines, 0, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_base_extend, i_base_color, i_base_style, i_base_width)) array.set(lines, 1, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_invr_extend, i_invr_color, i_invr_style, i_invr_width)) //from lowest octave to highest: array.set(lines, 2, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm01_color, i_mm01_style, i_mm01_width)) array.set(lines, 3, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm02_color, i_mm02_style, i_mm02_width)) array.set(lines, 4, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm03_color, i_mm03_style, i_mm03_width)) array.set(lines, 5, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm04_color, i_mm04_style, i_mm04_width)) array.set(lines, 6, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm05_color, i_mm05_style, i_mm05_width)) array.set(lines, 7, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm06_color, i_mm06_style, i_mm06_width)) array.set(lines, 8, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm07_color, i_mm07_style, i_mm07_width)) array.set(lines, 9, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm08_color, i_mm08_style, i_mm08_width)) array.set(lines, 10, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm09_color, i_mm09_style, i_mm09_width)) array.set(lines, 11, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm10_color, i_mm10_style, i_mm10_width)) array.set(lines, 12, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm11_color, i_mm11_style, i_mm11_width)) array.set(lines, 13, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm12_color, i_mm12_style, i_mm12_width)) array.set(lines, 14, line.new(bar_index, 0.0, bar_index, 0.0, xloc.bar_index, i_extend, i_mm13_color, i_mm13_style, i_mm13_width)) //labels if i_labels array.set(labels, 2, label.new(bar_index, 0.0, '-2/8', color=i_mm01_color, style=label.style_label_right, textcolor=colore.invert(i_mm01_color), size=i_labels_textsize)) array.set(labels, 3, label.new(bar_index, 0.0, '-1/8', color=i_mm02_color, style=label.style_label_right, textcolor=colore.invert(i_mm02_color), size=i_labels_textsize)) array.set(labels, 4, label.new(bar_index, 0.0, ' 0/8', color=i_mm03_color, style=label.style_label_right, textcolor=colore.invert(i_mm03_color), size=i_labels_textsize)) array.set(labels, 5, label.new(bar_index, 0.0, ' 1/8', color=i_mm04_color, style=label.style_label_right, textcolor=colore.invert(i_mm04_color), size=i_labels_textsize)) array.set(labels, 6, label.new(bar_index, 0.0, ' 2/8', color=i_mm05_color, style=label.style_label_right, textcolor=colore.invert(i_mm05_color), size=i_labels_textsize)) array.set(labels, 7, label.new(bar_index, 0.0, ' 3/8', color=i_mm06_color, style=label.style_label_right, textcolor=colore.invert(i_mm06_color), size=i_labels_textsize)) array.set(labels, 8, label.new(bar_index, 0.0, ' 4/8', color=i_mm07_color, style=label.style_label_right, textcolor=colore.invert(i_mm07_color), size=i_labels_textsize)) array.set(labels, 9, label.new(bar_index, 0.0, ' 5/8', color=i_mm08_color, style=label.style_label_right, textcolor=colore.invert(i_mm08_color), size=i_labels_textsize)) array.set(labels, 10, label.new(bar_index, 0.0, ' 6/8', color=i_mm09_color, style=label.style_label_right, textcolor=colore.invert(i_mm09_color), size=i_labels_textsize)) array.set(labels, 11, label.new(bar_index, 0.0, ' 7/8', color=i_mm10_color, style=label.style_label_right, textcolor=colore.invert(i_mm10_color), size=i_labels_textsize)) array.set(labels, 12, label.new(bar_index, 0.0, ' 8/8', color=i_mm11_color, style=label.style_label_right, textcolor=colore.invert(i_mm11_color), size=i_labels_textsize)) array.set(labels, 13, label.new(bar_index, 0.0, ' 9/8', color=i_mm12_color, style=label.style_label_right, textcolor=colore.invert(i_mm12_color), size=i_labels_textsize)) array.set(labels, 14, label.new(bar_index, 0.0, '10/8', color=i_mm13_color, style=label.style_label_right, textcolor=colore.invert(i_mm13_color), size=i_labels_textsize)) update_label (int _n, int _x, float _y) => //{ label _label = array.get(labels, _n) label.set_xy(_label, _x, _y) //} update_bline (int _n, int _x1, float _y1, int _x2, float _y2) => //{ line _line = array.get(lines, _n) line.set_xy1(_line, _x1, _y1) line.set_xy2(_line, _x2, _y2) //} update_mline (int _n, int _x1, int _x2, float _y) => //{ line _line = array.get(lines, _n) line.set_xy1(_line, _x1, _y) line.set_xy2(_line, _x2, _y) if i_labels update_label(_n, _x2, _y) //} if is_new_impulse float _start_value = hl2[ki_start] float _end_value = hl2[ki_end] int _x1 = bar_index - ki_start int _x2 = bar_index - ki_end float _y1 = low[ki_start] float _y2 = high[ki_end] if _end_value < _start_value _y1 := high[ki_start] _y2 := low[ki_end] float _range = _y2 - _y1 update_bline(00, _x1, _y1, _x2, _y2) update_bline(01, _x1, _y1, _x1+(_x1-_x2), _y1+(_y2-_y1)*i_inversion_rate) update_mline(02, _x1, _x2, _y1 + _range * -0.250) update_mline(03, _x1, _x2, _y1 + _range * -0.125) update_mline(04, _x1, _x2, _y1) update_mline(05, _x1, _x2, _y1 + _range * 0.125) update_mline(06, _x1, _x2, _y1 + _range * 0.250) update_mline(07, _x1, _x2, _y1 + _range * 0.375) update_mline(08, _x1, _x2, _y1 + _range * 0.500) update_mline(09, _x1, _x2, _y1 + _range * 0.625) update_mline(10, _x1, _x2, _y1 + _range * 0.750) update_mline(11, _x1, _x2, _y1 + _range * 0.875) update_mline(12, _x1, _x2, _y1 + _range * 1.000) update_mline(13, _x1, _x2, _y1 + _range * 1.125) update_mline(14, _x1, _x2, _y1 + _range * 1.250)
SuperTrend+ Cleaned
https://www.tradingview.com/script/xZSptQM7-SuperTrend-Cleaned/
Electrified
https://www.tradingview.com/u/Electrified/
752
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Electrified (electrifiedtrading) //@version=5 indicator("SuperTrend+ Cleaned", overlay = true, format=format.price, precision=2) // v=4 import Electrified/MovingAverages/2 as MA import Electrified/SupportResitanceAndTrend/2 as SRT ATR = "Average True Range", CONFIRM = "Confirmation", DISPLAY = "Display" atrPeriod = input.int(120, "Period", group=ATR, tooltip="The number of bars to use in calculating the ATR value.") atrM = input.float(3.0, "Multiplier", step=0.5, group=ATR, tooltip="The multiplier used when defining the super trend limits.") maxDev = input.float(2, "Maximum Deviation", minval=0, group=ATR, tooltip="The maximum true range (volatility) before considered an outlier.") devM = input.float(1, "StdDev Multilplier", minval=0, group=ATR, tooltip="The amount of standard deviation added to the true range.") closeBars = input.int(2, "Closed Bars", minval = 0, group=CONFIRM, tooltip="The number of closed bars that have to exceed the super-trend value before the trend reversal is confirmed.") showsignals = input(false, title="Show Buy/Sell Signals ?", group=DISPLAY) highlighting = input(true, "Highlighter On/Off ?", group=DISPLAY) superTrend(m, p, closeBars) => [t, u, d, un, w, r] = SRT.superTrendCleaned(m, p, closeBars, devM, maxDev) [t, u, d, un] /// [trend, up, dn, unconfirmed] = superTrend(atrM, atrPeriod, closeBars) upPlot = plot(trend==1 ? up : na, title="Up Trend", style=plot.style_linebr, linewidth=2, color=unconfirmed==0?color.green:color.yellow) 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) 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) dnPlot = plot(trend==1 ? na : dn, title="Down Trend", style=plot.style_linebr, linewidth=2, color=unconfirmed==0?color.red:color.yellow) 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) 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) mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0) longFillColor = highlighting ? (trend == 1 ? color.green : color.white) : color.white shortFillColor = highlighting ? (trend == -1 ? color.red : color.white) : color.white fill(mPlot, upPlot, title="UpTrend Highligter", color=color.new(longFillColor, 80)) fill(mPlot, dnPlot, title="DownTrend Highligter", color=color.new(shortFillColor, 80)) changeCond = trend != trend[1] warnCond = unconfirmed[1]==0 and unconfirmed > 0 alertcondition(warnCond or changeCond, title="1) SuperTrend Warning", message="SuperTrend Warning ({{ticker}})") alertcondition(changeCond, title="2) SuperTrend Reversal", message="SuperTrend Reversal ({{ticker}})") alertcondition(buySignal, title="3) SuperTrend Up ▲ (+)", message="SuperTrend Up ▲ (+) ({{ticker}})") alertcondition(sellSignal, title="4) SuperTrend Down ▼ (-)", message="SuperTrend Down ▼ (-) ({{ticker}})")
Traders Reality Psy Levels/Daily Open GMT Aware
https://www.tradingview.com/script/ZCqmZOUy-Traders-Reality-Psy-Levels-Daily-Open-GMT-Aware/
Peshocore
https://www.tradingview.com/u/Peshocore/
2,521
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Original pattern formation by plasmapug, rise retrace continuation to the upside by infernix and peshocore // INSECURITY() from @JayRogers (enhanced for gmt offset) // Use at your own risk. Use at your own risk and your own responsibility. No guarantees are provided and no responsibility is assumed by the developers of this script. // Psy levels works only on exchanges that are open on the weekends. // The GMT offset puts the calculation in the correct place regardless of exchange timezone as long as the exchange provides 24x7 data. //@version=5 indicator('Psy Levels/Daily Open GMT Aware', overlay=true) // Config int chart_gmt = input.int(group='Day start hour offset', title='Offset hours (For exchanges that have weekend data - set to 3 for Sydney open in DST and set to 2 for Sydney open out of DST. Note: Sydney is in the southern hemisphere which means DST is on during the winter in the the northern hemisphere.) ', defval=3, minval=-12, maxval=14, step=1, tooltip='This allows you to move the daily open/Psy Levels to some desired time like for example the start of Sydney as oposed to exchange midnight. Negative values move line to the right, positive values move line to the left. For exchanges not using UTC+0 simply adjust the offset such that the daily open/psy level calculation start at some desired time. default is set to 3.') label_offset_input = input.int(group='Label Offsets', title='Label Offset', defval=5, inline='labeloffset') bool show_dly = timeframe.isminutes //and timeframe.multiplier < 240 bool show_rectangle9 = input.bool(group='Daily Open', defval=true, title='Show: line ?', inline='dopenconf') and show_dly bool show_label9 = input.bool(group='Daily Open', defval=true, title='Label?', inline='dopenconf') and show_rectangle9 and show_dly bool showallDly = input.bool(group='Daily Open', defval=false, title='Show historical daily opens?', inline='dopenconf') color sess9col = input.color(group='Daily Open', title='Daily Open Color', defval=color.new(color.orange, 0), inline='dopenconf1') bool showPsy = timeframe.isminutes and (timeframe.multiplier == 60 or timeframe.multiplier == 30 or timeframe.multiplier == 15 or timeframe.multiplier == 5 or timeframe.multiplier == 3 or timeframe.multiplier == 1) bool show_psylevels = input.bool(group='Weekly Psy Levels (valid tf 1h/30min/15min/5min/3min/1min)', defval=true, title='Show: Levels?', inline='psyconf') and showPsy bool show_psylabel = input.bool(group='Weekly Psy Levels (valid tf 1h/30min/15min/5min/3min/1min)', defval=true, title='Labels?', inline='psyconf') and show_psylevels bool showallPsy = input.bool(group='Weekly Psy Levels (valid tf 1h/30min/15min/5min/3min/1min)', defval=false, title='Show historical psy levels?', inline='psyconf', tooltip="The only valid timeframes where the Psy High/Low can show are 1h/30min/15min/5min/3min/1min. This is due to limitations of the data on other timeframes.") color psycolH = input.color(group='Weekly Psy Levels (valid tf 1h/30min/15min/5min/3min/1min)', title='Psy Hi Color', defval=color.new(color.orange, 30), inline='psyconf1') color psycolL = input.color(group='Weekly Psy Levels (valid tf 1h/30min/15min/5min/3min/1min)', title='Psy Low Color', defval=color.new(color.orange, 30), inline='psyconf1') calc_gmt_offset(gmtOffsetVar) => gmtVar = 'GMT+0' if gmtOffsetVar > -1 gmtVar := 'GMT+' + str.tostring(math.abs(gmtOffsetVar)) gmtVar else gmtVar := 'GMT-' + str.tostring(math.abs(gmtOffsetVar)) gmtVar gmtVar // Basic vars (needed in functions) // Only render intraday validTimeFrame = timeframe.isintraday == true label_x_offset = timenow + chart_gmt + label_offset_input * timeframe.multiplier * 60 * 1000 //Right_Label r_label(ry, rtext, rstyle, rcolor, valid) => if valid and barstate.isrealtime rLabel = label.new(x=label_x_offset, y=ry, text=rtext, xloc=xloc.bar_time, style=rstyle, textcolor=rcolor, textalign=text.align_right) label.delete(rLabel[1]) draw_linelabel_gmt_custSession(pivot_level, res, sessionString, tag, pivotColor, pivotStyle, pivotWidth, pivotExtend, isLabelValid, label_offset, sessStartAdjustMilis) => var line pivot_line = na gmtD = calc_gmt_offset(chart_gmt) current_session = time(res, sessionString, gmtD) - sessStartAdjustMilis if not na(current_session) pivot_line = line.new(current_session, pivot_level, timenow, pivot_level, xloc=xloc.bar_time, extend=pivotExtend, color=pivotColor, style=pivotStyle, width=pivotWidth) line.delete(pivot_line[1]) if isLabelValid pivot_label = label.new(label_offset, pivot_level, tag, xloc=xloc.bar_time, style=label.style_none, textcolor=pivotColor, textalign=text.align_right) label.delete(pivot_label[1]) pivot_line //TODO we can use defaults in pinescript version 5 so we will not need this function draw_linelabel_gmt(pivot_level, res, tag, pivotColor, pivotStyle, pivotWidth, pivotExtend, isLabelValid, label_offset) => pivot_line = draw_linelabel_gmt_custSession(pivot_level, res, '0000-0000:1234567', tag, pivotColor, pivotStyle, pivotWidth, pivotExtend, isLabelValid, label_offset, 0) pivot_line // INSECURITY() @JayRogers // // -- get all our HTF values with just a time() reference! f_insecurity(_resolution, _session, _timezone) => // init variables to carry our previous time reference window values. var float _priorOpen = na var float _priorHigh = na var float _priorLow = na var float _priorClose = na // init some variables to hold useful active reference window values. var float _activeOpen = na var float _activeHigh = na var float _activeLow = na // so do we have a time change event for our reference window? if ta.change(time(_resolution, _session, _timezone)) != 0 _priorOpen := _activeOpen[1] // transfer last open value. _priorHigh := _activeHigh[1] // get the last cumulative high value. _priorLow := _activeLow[1] // get the last cumulative low value. _priorClose := nz(close[1]) // get the very last close value. _activeOpen := open // very first open value of active window. _activeHigh := high // reset active high to first high value. _activeLow := low // reset active low to first low value. _activeLow else // if we do not have a time change event, then we need to do a bit of work. // if the new high|low is more significant than the previous high|low // then we use the new value, otherwise we keep current value using // self-referencing. _activeHigh := high > nz(_activeHigh) ? high : _activeHigh _activeLow := low < nz(_activeLow) ? low : _activeLow _activeLow // return all of our results. [_priorOpen, _priorHigh, _priorLow, _priorClose, _activeOpen, _activeHigh, _activeLow] dly_offset = calc_gmt_offset(chart_gmt) [_priorOpenDly, _priorHighDly, _priorLowDly, _priorCloseDly, _activeOpenDly, _activeHighDly, _activeLowDly] = f_insecurity('D', '0000-0000:1234567', dly_offset) //************// // Daily Open // //************// isDly = year(timenow, dly_offset) == year(time, dly_offset) and month(timenow, dly_offset) == month(time, dly_offset) and dayofmonth(timenow, dly_offset) == dayofmonth(time, dly_offset) ? true : false plot(show_rectangle9 and validTimeFrame and (showallDly ? true : isDly) ? _activeOpenDly : na, color=sess9col, style=plot.style_linebr, linewidth=1, editable=false) // Labels r_label(_activeOpenDly, 'Daily Open (offset)', label.style_none, sess9col, validTimeFrame and show_label9) //************// // Psy Levels // //************// calc_psy_hilo(gmtoffsetPsy) => //4 hour res based on how mt4 does it //so basically because the session is 8 hours and we are liiking at a 4 hour resolution we only need to take the highest high an lowest low of 2 bars //we use the gmt offset to adjust the 0000-0800 session to Sydney open which is at 2100 during dst and at 2000 otherwize. (dst - spring foward, fall back) in_session = time('240', '0000-0800:1', gmtoffsetPsy) new_session = in_session and not in_session[1] float psy_high = 0.0 float psy_low = 100000000000.0 psy_high := new_session ? high : in_session ? math.max(high, psy_high[1]) : psy_high[1] psy_low := new_session ? low : in_session ? math.min(low, psy_low[1]) : psy_low[1] [psy_high, psy_low] [psy_high, psy_low] = calc_psy_hilo(dly_offset) isThisWeekPsy = year(timenow, dly_offset) == year(time, dly_offset) and weekofyear(timenow, dly_offset) == weekofyear(time, dly_offset) plot(showPsy and show_psylevels and showallPsy ? psy_high : na, color=psycolH, style=plot.style_line, linewidth=1, editable=false) //, offset=psy_plot_offset) plot(showPsy and show_psylevels and showallPsy ? psy_low : na, color=psycolL, style=plot.style_line, linewidth=1, editable=false) //, offset=psy_plot_offset) if barstate.isnew psy_calc_start = timestamp(dly_offset, year, month, dayofweek.wednesday, 00, 00, 00) psy_calc_end = timestamp(dly_offset, year, month, dayofweek.wednesday, 08, 00, 00) time_now_gmt = time('D', '0000-0800:1', dly_offset) psy_calc_inProgress = not na(time_now_gmt - psy_calc_start >= 0) and not na(time_now_gmt - psy_calc_end <= 0) stylePsy = line.style_solid psy_hi_label = 'Psy-Hi' psy_lo_label = 'Psy-Lo' if psy_calc_inProgress //stylePsy := line.style_dashed //this does not work for style correctly but it does for the label which is odd psy_hi_label := 'Psy-Hi calculating...' psy_lo_label := 'Psy-Lo calculating...' psy_lo_label if showallPsy r_label(psy_high, psy_hi_label, label.style_none, psycolH, validTimeFrame and show_psylabel) r_label(psy_low, psy_lo_label, label.style_none, psycolL, validTimeFrame and show_psylabel) showallPsy //just here to trick if-else into working else if show_psylevels draw_linelabel_gmt_custSession(psy_high, 'D', '0000-0800:1', psy_hi_label, psycolH, stylePsy, 1, extend.none, show_psylabel and show_psylevels, label_x_offset, 0) draw_linelabel_gmt_custSession(psy_low, 'D', '0000-0800:1', psy_lo_label, psycolL, stylePsy, 1, extend.none, show_psylabel and show_psylevels, label_x_offset, 0) showallPsy //just here to trick if-else into working
GMT Offset, without using security fn - showcase
https://www.tradingview.com/script/l3PuP3DO-GMT-Offset-without-using-security-fn-showcase/
Peshocore
https://www.tradingview.com/u/Peshocore/
73
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // This script is a demo of how one can avoid the use of the request.security function and get values for a number of previous day's open/high/low/close // where the user can define a custom "tart of the day" using the GMT input. This allows the user to be independent of the exchange timezone // that the security function uses internally. // Implications of this include: // Suppose you want to treat the start of your day as the NZX market open which is at 2000 UTC+0 and base you indicator calculations // on the NZK market midnight as opposed to the chart exchange timezone. // The indicator purpose is to showcase how that can be achieved in code. // If security function in the future is modified to accept a timezone parameter - obviously this code will no longer be needed as such. // We do two things here: // We plot the values for open high low close using the calc_ohlc_daysback as circles // Then we use the f_security function to get the same values but using security and plot them using solid lines // We do this both on the daily and weekly values. // What we expect to see is the lines matching thus proving that the calc_ohlc_daysback works correctly as compared to security function. // Note - the chart gmt default value is set to 0 which means the comparison will work correctly out of the box on exchanges that have weekend data. // The script is designed to work on intraday timeframes highest being 4 hour and lowest being 3 min // (programmatically the script is no bounded as sich to the intraday timeframe however if not enough data is present at a particular timeframe // values needed to display the lines will be null and hence the lines will not print.) // You can get the same results on other exchanges but might need to change the value of chart gmt // Script does not work on exchanges that have gaps on the weekend at this time // Now all of this can obviously be done with the security function - why go through the trouble? Well with security function you are bound to // the timezone of the exchange you are on. Doing it this way you are no longer bound by the exchange timezone and you can effectively change // the time at which the day starts independent of any exchange. Go ahead - change the GMT offset in settings // Future enhancements: // a) Deal with exchanges where "bar merge" is required - if possible (detect that an exchange does not have weekend data basically) // b) Deal with lower timeframes if possible (on the minute timeframe there is usually not enough data in the series to calc values several weeks back) // c) Make a library for this functionality - this will be optimal so one does not need to copy paste code. // d) Expand library to add GMT auto adjust (specifically around DST in different countries). Today this is a challenge as no relizble way exists to // extract the UTC offset from an syminfo.timezone given that syminfo.timezone returns text such as "America/New York" // For example - one might have 3 session thst they want to work with. Tokio, London and New York. Tokio does not follow DST so the market session starts at the same time all year round. London observes DST but at a different time from New York. So in order to have all this in the same chart and have it auto adjust is a bit of a challenge. With the DST offset functions - this is possible to do. ( // Well, that is unless the awesome TV devs push out v6 where that is build in the security function (for it to accept a timezone offset other) in which case the code here will become useless. // Foot notes: // This script is inspired by Traders Reality indicator by @infernixx (developed by @plasmapug with additional modifications by @infernixx and @Peshocore) // Special thanks to @JayRogers for INSECURITY() which inspired the development of calc_ohlc_daysback //@version=5 indicator('GMT Offset, without using security fn - showcase', overlay=true) // Config int chartGmt = input.int(group='gmt offset ', title='GTM Offset hours', defval=0, minval=-12, maxval=14, step=1, tooltip='This allows you to move the start of session independent of the exchange timezone to some desired time like for example the start of Sydney as oposed to exchange midnight. Negative values move line to the right, positive values move line to the left.') showTable = input.bool(group='Show Table', title='Show Table', defval=true, inline='showT') choiceTable = input.string(group='Show Table', title='Table postion', inline='showT', defval='bottom_right', options=['top_right', 'top_left', 'bottom_right', 'bottom_left']) tableBgColor = input.color(group='Show Table', title='Table Background Color', inline='showT', defval=color.rgb(93, 96, 107, 70)) tableTxtColor = input.color(group='Show Table', title='Text Color', inline='showT', defval=color.rgb(31, 188, 211, 0)) showDOpenSec = input.bool(group="Using security fn", title="Show Yesterday's Daily Open using security fn", defval=true, inline='showDS') showDHighSec = input.bool(group="Using security fn", title="Show Yesterday's Daily High using security fn", defval=true, inline='showDS') showDLowSec = input.bool(group="Using security fn", title="Show Yesterday's Daily Low using security fn", defval=true, inline='showDS') showDCloseSec = input.bool(group="Using security fn", title="Show Yesterday's Daily Close using security fn", defval=true, inline='showDS') showWOpenSec = input.bool(group="Using security fn", title="Show Last Week Open using security fn", defval=true, inline='showDS') showWHighSec = input.bool(group="Using security fn", title="Show Last Week High using security fn", defval=true, inline='showDS') showWLowSec = input.bool(group="Using security fn", title="Show Last Week Low using security fn", defval=true, inline='showDS') showWCloseSec = input.bool(group="Using security fn", title="Show Lost Week Close using security fn", defval=true, inline='showDS') showDOpen = input.bool(group="Without Using security fn", title="Show Yesterday's Daily Open without security fn", defval=true, inline='showD') showDHigh = input.bool(group="Without Using security fn", title="Show Yesterday's Daily High without security fn", defval=true, inline='showD') showDLow = input.bool(group="Without Using security fn", title="Show Yesterday's Daily Low without security fn", defval=true, inline='showD') showDClose = input.bool(group="Without Using security fn", title="Show Yesterday's Daily Close without security fn", defval=true, inline='showD') showWOpen = input.bool(group="Without Using security fn", title="Show Last Week Open without security fn", defval=true, inline='showD') showWHigh = input.bool(group="Without Using security fn", title="Show Last Week High without security fn", defval=true, inline='showD') showWLow = input.bool(group="Without Using security fn", title="Show Last Week Low without security fn", defval=true, inline='showD') showWClose = input.bool(group="Without Using security fn", title="Show Lost Week Close without security fn", defval=true, inline='showD') // Only render intraday validTimeFrame = timeframe.isintraday == true and timeframe.isminutes == true validDHLTimeFrame = timeframe.isintraday == true and timeframe.isminutes == true validWHLTimeFrame = (timeframe.isintraday == true and timeframe.isminutes == true) or timeframe.isdaily == true calc_gmt_offset(gmtOffsetVar) => gmtVar = 'GMT+0' if gmtOffsetVar > -1 gmtVar := 'GMT+' + str.tostring(math.abs(gmtOffsetVar)) gmtVar else gmtVar := 'GMT-' + str.tostring(math.abs(gmtOffsetVar)) gmtVar gmtVar is_newbar(resX, sessionStringX, gmtX) => t = time(resX, sessionStringX, gmtX) ta.change(t) != 0 ? 1 : 0 calc_bars_back(int hours=24) => //TODO need to keep under 5000 bars - so this means it will not work on lower timeframes for weekly barsback = 0 if timeframe.isminutes //convert hours to minutes (as we are only looking for intraday sessions from 1min to 240min then devide by the period //example how many bars back in 24 hours at the 3 min res => 24*60/3 = 480 barsback := 60*hours/timeframe.multiplier barsback //When days back = 0 you get yesterday's values. When days back = 1 you get values from 2 days ago, etc. as long as there is enough data on the chart //Expected res "D" or "W". Expected session 24x7 calc_ohlc_daysback(res, session, gmt, daysback, hoursInResolution) => // Detect New Day new_day = is_newbar(res,session,gmt) //so basically - at the start of a new day, the the highest/lowest of the previous x number of bars and the offset by some number of days. //where x number of bars depends on the chart period and resolution requested where allowed values for resolution are "D" or "W" //the [1] is these because we need to leave out the last bar in a 24 hour session becuase that bar will belong to the next new day. last_high = ta.valuewhen(new_day,ta.highest(high, calc_bars_back(hoursInResolution))[1],daysback) last_low = ta.valuewhen(new_day,ta.lowest(low, calc_bars_back(hoursInResolution))[1],daysback) last_open = ta.valuewhen(new_day, open, daysback+1) last_close = ta.valuewhen(new_day, open, daysback) [last_high, last_low, last_open, last_close] [last_high, last_low, last_open, last_close] = calc_ohlc_daysback("D","24x7",calc_gmt_offset(chartGmt),0, 24) [last_highW, last_lowW, last_openW, last_closeW] = calc_ohlc_daysback("W","24x7",calc_gmt_offset(chartGmt),0, 7*24) //Two ways to get x days ago (replace x with 1,2,3,4,5 etc where 1 will get you 2 days back): //1) calc_ohlc_daysback("D","24x7",calc_gmt_offset(chartGmt),x) //2) last_high[calc_bars_back("D")*x] //if you are in a for loop you will need to use the latter plot(validDHLTimeFrame and showDHigh ? last_high : na, linewidth=2, color=color.white, style=plot.style_circles, title="Last Day High") if validDHLTimeFrame and showDHigh line_label = label.new(timenow+(timeframe.multiplier*25*60*1000), last_high, "Last Day High", xloc=xloc.bar_time, textcolor=color.white, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validDHLTimeFrame and showDLow ? last_low : na, linewidth=2, color=color.white, style=plot.style_circles, title="Last Day Low") if validDHLTimeFrame and showDLow line_label = label.new(timenow+(timeframe.multiplier*25*60*1000), last_low, "Last Day Low", xloc=xloc.bar_time, textcolor=color.white, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validDHLTimeFrame and showDOpen ? last_open : na, linewidth=2, color=color.white, style=plot.style_circles, title="Last Day Open") if validDHLTimeFrame and showDOpen line_label = label.new(timenow+(timeframe.multiplier*25*60*1000), last_open, "Last Day Open", xloc=xloc.bar_time, textcolor=color.white, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validDHLTimeFrame and showDClose ? last_close : na, linewidth=2, color=color.white, style=plot.style_circles, title="Last Day Close") if validDHLTimeFrame and showDClose line_label = label.new(timenow+(timeframe.multiplier*25*60*1000), last_close, "Last Day Close", xloc=xloc.bar_time, textcolor=color.white, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validWHLTimeFrame and showWHigh ? last_highW : na, linewidth=2, color=color.red, style=plot.style_circles, title="Last Weekly High") if validWHLTimeFrame and showWHigh line_label = label.new(timenow+(timeframe.multiplier*25*60*1000), last_highW, "Last Week High", xloc=xloc.bar_time, textcolor=color.red, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validWHLTimeFrame and showWLow ? last_lowW : na, linewidth=2, color=color.red, style=plot.style_circles, title="Last Weekly Low") if validWHLTimeFrame and showWLow line_label = label.new(timenow+(timeframe.multiplier*25*60*1000), last_lowW, "Last Week low", xloc=xloc.bar_time, textcolor=color.red, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validWHLTimeFrame and showWOpen ? last_openW : na, linewidth=2, color=color.red, style=plot.style_circles, title="Last Weekly Open") if validWHLTimeFrame and showWOpen line_label = label.new(timenow+(timeframe.multiplier*25*60*1000), last_openW, "Last Week Open", xloc=xloc.bar_time, textcolor=color.red, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validWHLTimeFrame and showWClose ? last_closeW: na, linewidth=2, color=color.red, style=plot.style_circles, title="Last Weekly Close") if validWHLTimeFrame and showWClose line_label = label.new(timenow+(timeframe.multiplier*25*60*1000), last_closeW, "Last Week Close", xloc=xloc.bar_time, textcolor=color.red, style=label.style_none, size=size.normal) label.delete(line_label[1]) // Get Daily price data dayHigh = request.security(syminfo.tickerid, "D", high[false ? 0 : barstate.isrealtime ? 1 : 0])[false ? 0 : barstate.isrealtime ? 0 : 1] dayLow = request.security(syminfo.tickerid, "D", low[false ? 0 : barstate.isrealtime ? 1 : 0])[false ? 0 : barstate.isrealtime ? 0 : 1] dayOpen = request.security(syminfo.tickerid, "D", open[false ? 0 : barstate.isrealtime ? 1 : 0])[false ? 0 : barstate.isrealtime ? 0 : 1] dayClose = request.security(syminfo.tickerid, "D", close[false ? 0 : barstate.isrealtime ? 1 : 0])[false ? 0 : barstate.isrealtime ? 0 : 1] plot(validDHLTimeFrame and showDHighSec ? dayHigh : na, linewidth=1, color=color.blue, style=plot.style_linebr, title="Last Day High (security)") if validDHLTimeFrame and showDHighSec line_label = label.new(timenow+(timeframe.multiplier*90*60*1000), dayHigh, "Last Day High (sec)", xloc=xloc.bar_time, textcolor=color.blue, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validDHLTimeFrame and showDLowSec ? dayLow : na, linewidth=1, color=color.blue, style=plot.style_linebr, title="Last Day Low (security)") if validDHLTimeFrame and showDLowSec line_label = label.new(timenow+(timeframe.multiplier*90*60*1000), dayLow, "Last Day Low (sec)", xloc=xloc.bar_time, textcolor=color.blue, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validDHLTimeFrame and showDOpenSec ? dayOpen : na, linewidth=1, color=color.blue, style=plot.style_linebr, title="Last Day Open (security)") if validDHLTimeFrame and showDOpenSec line_label = label.new(timenow+(timeframe.multiplier*90*60*1000), dayOpen, "Last Day Open (sec)", xloc=xloc.bar_time, textcolor=color.blue, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validDHLTimeFrame and showDCloseSec? dayClose : na, linewidth=1, color=color.blue, style=plot.style_linebr, title="Last Day Close (security)") if validDHLTimeFrame and showDCloseSec line_label = label.new(timenow+(timeframe.multiplier*90*60*1000), dayClose, "Last Day Close (sec)", xloc=xloc.bar_time, textcolor=color.blue, style=label.style_none, size=size.normal) label.delete(line_label[1]) // Weekly H/L weekHigh = request.security(syminfo.tickerid, "W", high[false ? 0 : barstate.isrealtime ? 1 : 0])[false ? 0 : barstate.isrealtime ? 0 : 1] weekLow = request.security(syminfo.tickerid, "W", low[false ? 0 : barstate.isrealtime ? 1 : 0])[false ? 0 : barstate.isrealtime ? 0 : 1] weekOpen = request.security(syminfo.tickerid, "W", open[false ? 0 : barstate.isrealtime ? 1 : 0])[false ? 0 : barstate.isrealtime ? 0 : 1] weekClose = request.security(syminfo.tickerid, "W", close[false ? 0 : barstate.isrealtime ? 1 : 0])[false ? 0 : barstate.isrealtime ? 0 : 1] plot(validWHLTimeFrame and showWHighSec ? weekHigh : na, linewidth=1, color=color.green, style=plot.style_linebr, title="Last Weekly High (security)") if validWHLTimeFrame and showWHighSec line_label = label.new(timenow+(timeframe.multiplier*90*60*1000), weekHigh, "Last Week High (sec)", xloc=xloc.bar_time, textcolor=color.green, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validWHLTimeFrame and showWLowSec ? weekLow : na, linewidth=1, color=color.green, style=plot.style_linebr, title="Last Weekly Low (security)") if validWHLTimeFrame and showWLowSec line_label = label.new(timenow+(timeframe.multiplier*90*60*1000), weekLow, "Last Week Low (sec)", xloc=xloc.bar_time, textcolor=color.green, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validWHLTimeFrame and showWOpenSec ? weekOpen : na, linewidth=1, color=color.green, style=plot.style_linebr, title="Last Weekly Open (security)") if validWHLTimeFrame and showWOpenSec line_label = label.new(timenow+(timeframe.multiplier*90*60*1000), weekOpen, "Last Week Open (sec)", xloc=xloc.bar_time, textcolor=color.green, style=label.style_none, size=size.normal) label.delete(line_label[1]) plot(validWHLTimeFrame and showWCloseSec ? weekClose: na, linewidth=1, color=color.green, style=plot.style_linebr, title="Last Weekly Close (security)") if validWHLTimeFrame and showWCloseSec line_label = label.new(timenow+(timeframe.multiplier*90*60*1000), weekClose, "Last Week Close (sec)", xloc=xloc.bar_time, textcolor=color.green, style=label.style_none, size=size.normal) label.delete(line_label[1]) if showTable var table panelx = table.new(choiceTable, 4, 8, bgcolor=tableBgColor) table.cell(panelx, 0, 0, str.tostring("Prior Day Open (security)"), text_color=tableTxtColor) table.cell(panelx, 1, 0, str.tostring("Prior Day High (security)"), text_color=tableTxtColor) table.cell(panelx, 2, 0, str.tostring("Prior Day Low (security)"), text_color=tableTxtColor) table.cell(panelx, 3, 0, str.tostring("Prior Day Close (security)"), text_color=tableTxtColor) table.cell(panelx, 0, 1, str.tostring(dayOpen), text_color=tableTxtColor) table.cell(panelx, 1, 1, str.tostring(dayHigh), text_color=tableTxtColor) table.cell(panelx, 2, 1, str.tostring(dayLow), text_color=tableTxtColor) table.cell(panelx, 3, 1, str.tostring(dayClose), text_color=tableTxtColor) table.cell(panelx, 0, 2, str.tostring("Prior Day Open (no security)"), text_color=tableTxtColor) table.cell(panelx, 1, 2, str.tostring("Prior Day High (no security)"), text_color=tableTxtColor) table.cell(panelx, 2, 2, str.tostring("Prior Day Low (no security)"), text_color=tableTxtColor) table.cell(panelx, 3, 2, str.tostring("Prior Day Close (no security)"), text_color=tableTxtColor) table.cell(panelx, 0, 3, str.tostring(last_open), text_color=tableTxtColor) table.cell(panelx, 1, 3, str.tostring(last_high), text_color=tableTxtColor) table.cell(panelx, 2, 3, str.tostring(last_low), text_color=tableTxtColor) table.cell(panelx, 3, 3, str.tostring(last_close), text_color=tableTxtColor) table.cell(panelx, 0, 4, str.tostring("Prior Week Open (security)"), text_color=tableTxtColor) table.cell(panelx, 1, 4, str.tostring("Prior Week High (security)"), text_color=tableTxtColor) table.cell(panelx, 2, 4, str.tostring("Prior Week Low (security)"), text_color=tableTxtColor) table.cell(panelx, 3, 4, str.tostring("Prior Week Close (security)"), text_color=tableTxtColor) table.cell(panelx, 0, 5, str.tostring(weekOpen), text_color=tableTxtColor) table.cell(panelx, 1, 5, str.tostring(weekHigh), text_color=tableTxtColor) table.cell(panelx, 2, 5, str.tostring(weekLow), text_color=tableTxtColor) table.cell(panelx, 3, 5, str.tostring(weekClose), text_color=tableTxtColor) table.cell(panelx, 0, 6, str.tostring("Prior Week Open (no security)"), text_color=tableTxtColor) table.cell(panelx, 1, 6, str.tostring("Prior Week High (no security)"), text_color=tableTxtColor) table.cell(panelx, 2, 6, str.tostring("Prior Week Low (no security)"), text_color=tableTxtColor) table.cell(panelx, 3, 6, str.tostring("Prior Week Close (no security)"), text_color=tableTxtColor) table.cell(panelx, 0, 7, str.tostring(last_openW), text_color=tableTxtColor) table.cell(panelx, 1, 7, str.tostring(last_highW), text_color=tableTxtColor) table.cell(panelx, 2, 7, str.tostring(last_lowW), text_color=tableTxtColor) table.cell(panelx, 3, 7, str.tostring(last_closeW), text_color=tableTxtColor)
Volkan KARAHAN
https://www.tradingview.com/script/qxWgdJKy/
Vlk55
https://www.tradingview.com/u/Vlk55/
24
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/ // © LonesomeTheBlue // //@version=4 study("Volkan KARAHAN", overlay=true, max_bars_back = 4000) lb = input(5, title="Sol Bar", minval=1) rb = input(5, title="Sağ Bar", minval=1) showhidden = input(false, title = "Grafik Çizgilerini Gizle") chcut = input(false, title = "Çizgileri Kalınlaştır") shownum = input(true, title="İndikatör Sayılarını Göster") showindis = input(false, title="İndikatör İsimleri Göster") showpivot = input(false, title="Kırılım Noktalarını Göster") chwidth = input(true, title = "Grafik Çizgilerini Derinleştir") showlimit = input(1, title="Minimum İndikatör Sayısı", minval = 1, maxval = 11) calcmacd = input(true, title="MACD") calcmacda = input(true, title="MACD Histogram") calcrsi = input(true, title="RSI") calcstoc = input(true, title="Stochastic") calccci = input(true, title="CCI") calcmom = input(true, title="Momentum") calcobv = input(true, title="OBV") calcdi = input(true, title="Diosc") calcvwmacd = input(true, title="VWmacd") calccmf = input(true, title="Chaikin Money Flow") calcmfi = input(true, title="Money Flow Index") // RSI rsi = rsi(close, 14) // MACD [macd, signal, deltamacd] = macd(close, 12, 26, 9) // Momentum moment = mom(close, 10) // CCI cci = cci(close, 10) // OBV Obv = obv // cum(change(close) > 0 ? volume : change(close) < 0 ? -volume : 0 * volume) // Stoch stk = sma(stoch(close, high, low, 14), 3) // DIOSC DI = change(high) - (-change(low)) trur = rma(tr, 14) diosc = fixnan(100 * rma(DI, 14) / trur) // volume weighted macd maFast = vwma(close, 12) maSlow = vwma(close, 26) vwmacd = maFast - maSlow // Chaikin money flow Cmfm = ((close-low) - (high-close)) / (high - low) Cmfv = Cmfm * volume cmf = sma(Cmfv, 21) / sma(volume,21) // Moneyt Flow Index Mfi = mfi(close, 14) float top = na float bot = na top := pivothigh(lb, rb) bot := pivotlow(lb, rb) plotshape(top and showpivot, text="[PH]", style=shape.labeldown, color=color.white, textcolor=color.black, location=location.abovebar, transp=0, offset = -rb) plotshape(bot and showpivot, text="[PL]", style=shape.labeldown, color=color.white, textcolor=color.black, location=location.belowbar, transp=0, offset = -rb) topc = 0, botc = 0 topc := top ? lb : nz(topc[1]) + 1 botc := bot ? lb : nz(botc[1]) + 1 // Negative Divergence or Hidden Positive Divergence newtop = pivothigh(lb, 0) // check only left side emptyh = true if not na(newtop) and ((newtop > high[topc] and not showhidden) or (newtop < high[topc] and showhidden)) // there must not close price higher than the line between last PH and current high diff = (newtop - high[topc]) / topc hline = newtop - diff // virtual line to check there is no close price higher than it for x = 1 to topc -1 if close[x] > hline emptyh := false break hline := hline - diff else emptyh := false // check cut-through in indicators nocut1(indi, len)=> _ret = true diff = (indi - nz(indi[len])) / len ln = indi - diff for x = 1 to len -1 if nz(indi[x]) > ln _ret := false break ln := ln - diff _ret rsiok = nocut1(rsi, topc) macdok = nocut1(macd, topc) deltamacdok = nocut1(deltamacd, topc) momentok = nocut1(moment, topc) cciok = nocut1(cci, topc) obvok = nocut1(obv, topc) stkok = nocut1(stk, topc) dioscok = nocut1(diosc, topc) vwmacdok = nocut1(vwmacd, topc) cmfok = nocut1(cmf, topc) mfiok = nocut1(Mfi, topc) negdivergence = 0 negdivtxt = "" if emptyh and not na(newtop) and not showhidden if calcrsi and rsi[topc] > rsi and (not chcut or rsiok) negdivergence := negdivergence + 1 negdivtxt := "RSI\n" if calcmacd and macd[topc] > macd and (not chcut or macdok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "MACD\n" if calcmacda and deltamacd[topc] > deltamacd and (not chcut or deltamacdok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "MACD Hist\n" if calcmom and moment[topc] > moment and (not chcut or momentok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "Momentum\n" if calccci and cci[topc] > cci and (not chcut or cciok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "CCI\n" if calcobv and Obv[topc] > Obv and (not chcut or obvok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "OBV\n" if calcstoc and stk[topc] > stk and (not chcut or stkok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "Stoch\n" if calcdi and diosc[topc] > diosc and (not chcut or dioscok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "Diosc\n" if calcvwmacd and vwmacd[topc] > vwmacd and (not chcut or vwmacdok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "VWMacd\n" if calccmf and cmf[topc] > cmf and (not chcut or cmfok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "CMF\n" if calcmfi and Mfi[topc] > Mfi and (not chcut or mfiok) negdivergence := negdivergence + 1 negdivtxt := negdivtxt + "MFI\n" // Hidden divergence hposdivergence = 0 hposdivtxt = "" if emptyh and not na(newtop) and showhidden if calcrsi and rsi[topc] < rsi and (not chcut or rsiok) hposdivergence := hposdivergence + 1 hposdivtxt := "RSI\n" if calcmacd and macd[topc] < macd and (not chcut or macdok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "MACD\n" if calcmacda and deltamacd[topc] < deltamacd and (not chcut or deltamacdok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "MACD Hist\n" if calcmom and moment[topc] < moment and (not chcut or momentok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "Momentum\n" if calccci and cci[topc] < cci and (not chcut or cciok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "CCI\n" if calcobv and Obv[topc] < Obv and (not chcut or obvok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "OBV\n" if calcstoc and stk[topc] < stk and (not chcut or stkok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "Stoch\n" if calcdi and diosc[topc] < diosc and (not chcut or dioscok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "Diosc\n" if calcvwmacd and vwmacd[topc] < vwmacd and (not chcut or vwmacdok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "VWMacd\n" if calccmf and cmf[topc] < cmf and (not chcut or cmfok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "CMF\n" if calcmfi and Mfi[topc] < Mfi and (not chcut or mfiok) hposdivergence := hposdivergence + 1 hposdivtxt := hposdivtxt + "MFI\n" newareah = false newareah := top ? false : nz(newareah[1], false) if negdivergence >= showlimit or hposdivergence >= showlimit var line divlh = na var label labh = na if newareah // we remove old line until It reaches new pivot point (like animation ;) line.delete(divlh) label.delete(labh) newwd = not showhidden ? (not chwidth ? 2 : negdivergence <= 2 ? 2 : negdivergence <= 5 ? 3 : negdivergence <= 8 ? 4 : 5) : (not chwidth ? 2 : hposdivergence <= 2 ? 2 : hposdivergence <= 5 ? 3 : hposdivergence <= 8 ? 4 : 5) divlh := line.new(bar_index - topc, high[topc], bar_index, high, color = color.red, width = newwd) if shownum or showindis txt = showindis ? showhidden ? hposdivtxt : negdivtxt : "" txt := txt + (shownum ? showhidden ? tostring(hposdivergence) : tostring(negdivergence) : "") labh := label.new(bar_index, na, text=txt, color= showhidden ? color.lime : color.red, textcolor = showhidden ? color.black : color.white, style= showhidden ? label.style_labelup : label.style_labeldown, yloc=yloc.abovebar) newareah := true // Positive or Hidden Negative Divergence newbot = pivotlow(lb, 0) // check only left side emptyl = true if not na(newbot) and ((newbot < low[botc] and not showhidden) or (newbot > low[botc] and showhidden)) // there must not close price lower than the line between last PL and current low diff = (newbot - low[botc]) / botc lline = newbot - diff // virtual line to check there is no close price lower than it for x = 1 to botc -1 if close[x] < lline emptyl := false break lline := lline - diff else emptyl := false // check cut-through in indicators nocut2(indi, len)=> _ret = true diff = (indi - nz(indi[len])) / len ln = indi - diff for x = 1 to len -1 if nz(indi[x]) < ln _ret := false break ln := ln - diff _ret rsiok := nocut2(rsi, botc) macdok := nocut2(macd, botc) deltamacdok := nocut2(deltamacd, botc) momentok := nocut2(moment, botc) cciok := nocut2(cci, botc) obvok := nocut2(obv, botc) stkok := nocut2(stk, botc) dioscok := nocut2(diosc, botc) vwmacdok := nocut2(vwmacd, botc) cmfok := nocut2(cmf, botc) mfiok := nocut2(Mfi, botc) posdivergence = 0 posdivtxt = "" if emptyl and not na(newbot) and not showhidden if calcrsi and rsi[botc] < rsi and (not chcut or rsiok) posdivergence := 1 posdivtxt := "RSI\n" if calcmacd and macd[botc] < macd and (not chcut or macdok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "MACD\n" if calcmacda and deltamacd[botc] < deltamacd and (not chcut or deltamacdok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "MACD Hist\n" if calcmom and moment[botc] < moment and (not chcut or momentok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "Momentum\n" if calccci and cci[botc] < cci and (not chcut or cciok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "CCI\n" if calcobv and Obv[botc] < Obv and (not chcut or obvok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "OBV\n" if calcstoc and stk[botc] < stk and (not chcut or stkok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "Stoch\n" if calcdi and diosc[botc] < diosc and (not chcut or dioscok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "Diosc\n" if calcvwmacd and vwmacd[botc] < vwmacd and (not chcut or vwmacdok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "VWMacd\n" if calccmf and cmf[botc] < cmf and (not chcut or cmfok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "CMF\n" if calcmfi and Mfi[botc] < Mfi and (not chcut or mfiok) posdivergence := posdivergence + 1 posdivtxt := posdivtxt + "MFI\n" // Hidden Divergences hnegdivergence = 0 hnegdivtxt = "" if emptyl and not na(newbot) and showhidden if calcrsi and rsi[botc] > rsi and (not chcut or rsiok) hnegdivergence := 1 hnegdivtxt := "RSI\n" if calcmacd and macd[botc] > macd and (not chcut or macdok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "MACD\n" if calcmacda and deltamacd[botc] < deltamacd and (not chcut or deltamacdok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "MACD Hist\n" if calcmom and moment[botc] > moment and (not chcut or momentok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "Momentum\n" if calccci and cci[botc] > cci and (not chcut or cciok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "CCI\n" if calcobv and Obv[botc] > Obv and (not chcut or obvok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "OBV\n" if calcstoc and stk[botc] > stk and (not chcut or stkok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "Stoch\n" if calcdi and diosc[botc] > diosc and (not chcut or dioscok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "Diosc\n" if calcvwmacd and vwmacd[botc] > vwmacd and (not chcut or vwmacdok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "VWMacd\n" if calccmf and cmf[botc] > cmf and (not chcut or cmfok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "CMF\n" if calcmfi and Mfi[botc] > Mfi and (not chcut or mfiok) hnegdivergence := hnegdivergence + 1 hnegdivtxt := hnegdivtxt + "MFI\n" newareal = false newareal := bot ? false : nz(newareal[1], false) if posdivergence >= showlimit or hnegdivergence >= showlimit var line divl = na var label lab = na if newareal // we remove old line until It reaches new pivot point (like animation ;) line.delete(divl) label.delete(lab) newwd = not showhidden ? (not chwidth ? 2 : posdivergence <= 2 ? 2 : posdivergence <= 5 ? 3 : posdivergence <= 8 ? 4 : 5) : (not chwidth ? 2 : hnegdivergence <= 2 ? 2 : hnegdivergence <= 5 ? 3 : hnegdivergence <= 8 ? 4 : 5) divl := line.new(bar_index - botc, low[botc], bar_index, low, color = color.lime, width = newwd) if shownum or showindis txt = showindis ? showhidden ? hnegdivtxt : posdivtxt : "" txt := txt + (shownum ? showhidden ? tostring(hnegdivergence) : tostring(posdivergence) : "") lab := label.new(bar_index, na, text=txt, color= showhidden ? color.olive : color.lime, textcolor = showhidden ? color.white : color.black, style = showhidden ? label.style_labeldown : label.style_labelup, yloc=yloc.belowbar) newareal := true alertcondition(posdivergence >= showlimit and not showhidden, title='Positive Divergence', message='Positive Divergence') alertcondition(negdivergence >= showlimit and not showhidden, title='Negative Divergence', message='Negative Divergence') alertcondition(hposdivergence >= showlimit and showhidden, title='Positive Hidden Divergence', message='Positive Hidden Divergence') alertcondition(hnegdivergence >= showlimit and showhidden, title='Negative Hidden Divergence', message='Negative Hidden Divergence')
BTC Dominance Trend
https://www.tradingview.com/script/WBE165gx-BTC-Dominance-Trend/
gi9opx
https://www.tradingview.com/u/gi9opx/
50
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/ // This simple script applies the DMI indicator to the BTC dominance chart (BTC.D). // © gi9opx //@version=4 study("BTC Dominance Trend", overlay=true) res = input("D", title="Timeframe", type=input.resolution) BTCDominance = security ("BTC.D", res, close) BTCDomHigh = security ("BTC.D", res, high) BTCDomLow = security ("BTC.D", res, low) BTCDomTr = security ("BTC.D", res, tr) //================================DMI adxlen = input(14, title="ADX Smoothing") dilen = input(14, title="DI Length") threshold = input(80, title="Threshold") //Script for Indicator dirmov(len) => up = change(BTCDomHigh) down = -change(BTCDomLow) truerange = rma(BTCDomTr, len) plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange) minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange) [plus, minus] adx(dilen, adxlen) => [plus, minus] = dirmov(dilen) sum = plus + minus adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) [adx, plus, minus] [sig, up, down] = adx(dilen, adxlen) uptrend = up>down downtrend = down>up trending = sig>threshold ranging = sig<threshold bgcolor(trending and downtrend? color.purple : na, transp = 90) bgcolor(trending and uptrend? color.olive : na, transp = 90)
Polynomial Regression Style Example
https://www.tradingview.com/script/IgLTWRKu-Polynomial-Regression-Style-Example/
RicardoSantos
https://www.tradingview.com/u/RicardoSantos/
375
study
5
MPL-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='Polynomial Regression Style Example', overlay=true) import RicardoSantos/FunctionPolynomialRegression/1 as poly int length = input(10) var float[] prices = array.new_float(size=length, initial_value=open) var int[] indices = array.new_int(size=length, initial_value=0) int fractal_size = input(2) if ta.pivothigh(fractal_size, fractal_size) e = array.pop(id=prices) i = array.pop(id=indices) array.insert(id=prices, index=0, value=high[fractal_size]) array.insert(id=indices, index=0, value=bar_index[fractal_size]) if ta.pivotlow(fractal_size, fractal_size) e = array.pop(id=prices) i = array.pop(id=indices) array.insert(id=prices, index=0, value=low[fractal_size]) array.insert(id=indices, index=0, value=bar_index[fractal_size]) [lines_mid, lines_max, lines_min, lines_upper, lines_lower] = poly.draw(indices, prices) // iterate over each line and adjust its properties: for _i = 0 to array.size(lines_mid)-1 //segment selection _mid = array.get(lines_mid, _i) line.set_width(_mid, 5) line.set_color(_mid, color.red)
Roberts Pi Cycle Top and Bottom Indicator BTC
https://www.tradingview.com/script/wQsz0LMQ-Roberts-Pi-Cycle-Top-and-Bottom-Indicator-BTC/
O618Crypto
https://www.tradingview.com/u/O618Crypto/
93
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/ // © 0618crypto //@version=4 study("Roberts Pi Cycle Top and Bottom Indicator BTC", overlay = true) // Moving averages ema1 = security("BTCUSD","D",sma(open, 350)*2) ema2 = security("BTCUSD","D",sma(open, 111)) ema3 = security("BTCUSD","D",sma(open, 350)) if crossover(ema2,ema1) // PLOT // vertical indicator l = line.new(bar_index, high, bar_index, ema2, width = 2, color=color.yellow, style=line.style_solid) // PLOT // moving averages plot(series=ema1, title="MA 350*2", color=color.green) plot(series=ema2, title="MA 111", color=color.red) plot(series=ema3, title="MA 350", color=color.white)
FARAZ.MATI20v
https://www.tradingview.com/script/OKkJAlI8-FARAZ-MATI20v/
faryarfaraz67
https://www.tradingview.com/u/faryarfaraz67/
85
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/ // © faryarfaraz67 //@version=4 study("FARAZ.MATI22v" , overlay=true) src = input(close, title="Source") len1 = input(5, minval=1, title="EMA1") len2 = input(20, minval=1, title="SMA2") len3 = input(50, minval=1, title="SMA3") len4 = input(100, minval=1, title="SMA4") len5 = input(200, minval=1, title="SMA5") ma1 = ema(close, len1) ma2 = sma(close, len2) ma3 = sma(close, len3) ma4 = sma(close, len4) ma5 = sma(close, len5) plot(ma1, title="EMA1", color=#ffeb3b,linewidth=1) plot(ma2, title="SMA2", color=#060cfe,linewidth=1) plot(ma3, title="SMA3", color=#f44336,linewidth=1) plot(ma4, title="SMA4", color=#9598a1,linewidth=1) plot(ma5, title="SMA5", color=#b2b5be,linewidth=3) func_hma(style, length)=> return = wma((2 * wma(style, length / 2)) - wma(style, length), round(sqrt(length))) shortPeriod = input(20, title="HMA") shortHMA = func_hma(close, shortPeriod) current = shortHMA[0] prev = shortHMA[1] plot(shortHMA, color=current > prev ? #368c3a : #770707, linewidth=3, title="HMA") length = input(20, minval=1, title=" HMA") hullma = wma(2*wma(src, length/2)-wma(src, length), floor(sqrt(length))) length1 = input(20, minval=1,title="HMA") hullma1 = wma(2*wma(src, length/2)-wma(src, length), floor(sqrt(length))) plot(hullma1,color=#ffffff,style=plot.style_circles,linewidth=2,title="HMA") start = input(title="Start", type=input.float, step=0.001, defval=0.044) increment = input(title="Increment", type=input.float, step=0.001, defval=0.02) maximum = input(title="Maximum", type=input.float, step=0.01, defval=0.2) psar = sar(start, increment, maximum) col = psar < close ? 1 : -1 psarColor = col == 1 ? #81c784 : #e57373 psarPlot = plot(psar, title="Parabolic SAR", style=plot.style_stepline, linewidth=1, color=psarColor, transp=0) conversionPeriods = input(9, minval=1, title="Conversion Line Length") basePeriods = input(26, minval=1, title="Base Line Length") laggingSpan2Periods = input(52, minval=1, title="Leading Span B Length") displacement = input(26, minval=1, title="Displacement") donchian(len) => avg(lowest(len), highest(len)) conversionLine = donchian(conversionPeriods) baseLine = donchian(basePeriods) leadLine1 = avg(conversionLine, baseLine) leadLine2 = donchian(laggingSpan2Periods) p1 = plot(leadLine1, offset = displacement - 1, color=#114813, title="Leading Span A") p2 = plot(leadLine2, offset = displacement - 1, color=#3e1515, title="Leading Span B") fill(p1, p2, color = leadLine1 > leadLine2 ? color.rgb(67, 160, 71, 90) : color.rgb(244, 67, 54, 90)) RSI_Period = input(14, title='RSI Length') SF = input(5, title='RSI Smoothing') QQE = input(4.238, title='Fast E Factor') ThreshHold = input(10, title="Thresh-hold") Wilders_Period = RSI_Period * 2 - 1 Rsi = rsi(src, RSI_Period) RsiMa = ema(Rsi, SF) AtrRsi = abs(RsiMa[1] - RsiMa) MaAtrRsi = ema(AtrRsi, Wilders_Period) dar = ema(MaAtrRsi, Wilders_Period) * QQE longband = 0.0 shortband = 0.0 trend = 0 // Alerts e = input(true, "Use Exponential MA" , group = "Elliott Wave Oscillator Settings") d = input(7 , "Signal : Delay" , minval=2, inline = "EWO", group = "Elliott Wave Oscillator Settings") t = input(13, "    Strength Threshold" , minval=1, inline = "EWO", group = "Elliott Wave Oscillator Settings") h = input(false, "Display Histogram (on Linear Scale)" , group = "Elliott Wave Oscillator Settings") p = input(233, "Plotting Length", group = "Display Settings") source = close ewo = e ? (ema(source, 5)/ema(source, 34) - 1) * 100 : (sma(source, 5)/sma(source, 34) - 1) * 100 ewoSignal = e ? ema(ewo,d) : sma(ewo,d) ewoHistogram = h and timeframe.isdwm ? e ? ema(source, 5) - ema(source, 34) : sma(source, 5) - sma(source, 34) : na ewoColor = h and timeframe.isdwm ? ewoHistogram >=0 ? (ewoHistogram[1] < ewoHistogram ? #006400 : color.green) : (ewoHistogram[1] < ewoHistogram ? color.red : #910000) : na plotshape(crossover (ewo, ewoSignal) and ewo < -t, title = "Strong Long" , color=#006400 , style=shape.arrowup , location=location.belowbar, size=size.large , show_last = p) //, text="↑", textcolor=color.white) plotshape(crossover (ewo, ewoSignal) and ewo > -t, title = "Long" , color=#1b5e20 , style=shape.arrowup , location=location.belowbar, size=size.large , show_last = p) plotshape(crossunder(ewo, ewoSignal) and ewo > t, title = "Strong Short", color=#910000 , style=shape.arrowdown , location=location.abovebar, size=size.large, show_last = p) //, text="↓", textcolor=color.white) plotshape(crossunder(ewo, ewoSignal) and ewo < t, title = "Short" , color=color.red , style=shape.arrowdown , location=location.abovebar, size=size.large ,show_last = p) if h and not timeframe.isdwm if barstate.islast label ewoLabel = label.new(bar_index, .97*low, text="warning ...", textcolor=color.white, textalign=text.align_left, style=label.style_label_up, tooltip="histogram plotting is supported for daily, weekly and monthly timeframe\nTo ged rid of this warning message disable hisrogram display") label.delete(ewoLabel[1]) longAlertCondition = crossover(ewo, ewoSignal) alertcondition(longAlertCondition , "Long : Early Warning" , "EWO-S - Not Confirmed Probable Long Trade Opportunity\n{{exchange}}:{{ticker}}->\nPrice = {{close}},\nTime = {{time}}") alertcondition(longAlertCondition[1], "Long : Trading Opportunity" , "EWO-S - Probable Long Trade Opportunity\n{{exchange}}:{{ticker}}->\nPrice = {{close}},\nTime = {{time}}") shortAlertCondition = crossunder(ewo, ewoSignal) alertcondition(shortAlertCondition , "Short : Early Warning" , "EWO-S - Not Confirmed Probable Short Trade Opportunity\n{{exchange}}:{{ticker}}->\nPrice = {{close}},\nTime = {{time}}") alertcondition(shortAlertCondition[1], "Short : Trading Opportunity", "EWO-S - Probable Short Trade Opportunity\n{{exchange}}:{{ticker}}->\nPrice = {{close}},\nTime = {{time}}")
Dogecoin vs DogToken Dominance %
https://www.tradingview.com/script/3dYJkXn4-Dogecoin-vs-DogToken-Dominance/
My_Ouzo
https://www.tradingview.com/u/My_Ouzo/
29
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © My_Ouzo //@version=4 study("Dogecoin vs DogToken Dominance %") doge = security("CRYPTOCAP:DOGE", timeframe.period, close) shib = security("CRYPTOCAP:SHIB", timeframe.period, close) akita = security("POLONIEX:AKITAUSDT", timeframe.period, close * 95000000000000) elon = security("POLONIEX:ELONUSDT", timeframe.period, close * 554838690094877) plot(doge / (akita + shib + elon + doge))
Augmented Dickey–Fuller (ADF) mean reversion test
https://www.tradingview.com/script/KjD8ByIQ-Augmented-Dickey-Fuller-ADF-mean-reversion-test/
tbiktag
https://www.tradingview.com/u/tbiktag/
1,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/ // © tbiktag // The augmented Dickey–Fuller (ADF) test is a test of the tendency of a price series sample to mean revert. // In this script, the ADF test is applied in a rolling window with a user-defined lookback length. // The computed values of the ADF test statistic are plotted as a time series. // If the calculated test statistic is smaller than the critical value calculated at the certain confidence // level (90%, 95% or 99%), then the hypothesis about the mean reversion is accepted (strictly speaking, // the opposite hypothesis is rejected). //@version=5 indicator('Augmented Dickey–Fuller (ADF) mean reversion test', shorttitle='ADF', overlay=false, max_bars_back=5000, max_lines_count=500) src = input.source(title='Source', defval=close) lookback = input.int(title='Length', defval=100, minval = 2, tooltip = 'The test is applied in a moving window. Length defines the number of points in the sample.') nLag = input.int(title='Maximum lag', defval=0, minval = 0, tooltip = 'Maximum lag which is included in test. Generally, lags allow taking into account serial correlation of price changes.') conf = input.string(title='Confidence Level', defval="90%", options = ['90%', '95%', '99%'], tooltip = 'Defines at which confidence level the critical value of the ADF test statistic is calculated. If the test statistic is below the critical value, the time series sample is concluded to be mean-reverting.') isInfobox = input.bool(title='Show infobox', defval=true) // --- functions --- // To-do: transfer some linear algebra to a separate library, or use public libraries matrix_get(A, i, j, nrows) => // @function: Get the value of the element of an implied 2d matrix // @parameters: // A :: float[] array: pseudo 2d matrix _A = [[column_0],[column_1],...,[column_(n-1)]] // i :: integer: row number // j :: integer: column number // nrows :: integer: number of rows in the implied 2d matrix array.get(A, i + nrows * j) matrix_set(A, value, i, j, nrows) => // @function: Set a value to the element of an implied 2d matrix // @parameters: // A :: float[] array, changed on output: pseudo 2d matrix _A = [[column_0],[column_1],...,[column_(n-1)]] // value :: float: the new value to be set // i :: integer: row number // j :: integer: column number // nrows :: integer: number of rows in the implied 2d matrix array.set(A, i + nrows * j, value) A transpose(A, nrows, ncolumns) => // @function: Transpose an implied 2d matrix // @parameters: // A :: float[] array: pseudo 2d matrix A = [[column_0],[column_1],...,[column_(n-1)]] // nrows :: integer: number of rows in A // ncolumns :: integer: number of columns in A // @returns: // AT :: float[] array: pseudo 2d matrix with implied dimensions: ncolums x nrows float[] AT = array.new_float(nrows * ncolumns, 0) for i = 0 to nrows - 1 for j = 0 to ncolumns - 1 matrix_set(AT, matrix_get(A, i, j, nrows), j, i, ncolumns) AT multiply(A, B, nrowsA, ncolumnsA, ncolumnsB) => // @function: Calculate scalar product of two matrices // @parameters: // A :: float[] array: pseudo 2d matrix // B :: float[] array: pseudo 2d matrix // nrowsA :: integer: number of rows in A // ncolumnsA :: integer: number of columns in A // ncolumnsB :: integer: number of columns in B // @returns: // C :: float[] array: pseudo 2d matrix with implied dimensions _nrowsA x _ncolumnsB float[] C = array.new_float(nrowsA * ncolumnsB, 0) int nrowsB = ncolumnsA float elementC = 0.0 for i = 0 to nrowsA - 1 for j = 0 to ncolumnsB - 1 elementC := 0 for k = 0 to ncolumnsA - 1 elementC += matrix_get(A, i, k, nrowsA) * matrix_get(B, k, j, nrowsB) matrix_set(C, elementC, i, j, nrowsA) C vnorm(X) => // @function: Square norm of vector X with size n // @parameters: // X :: float[] array, vector // @returns : // norm :: float, square norm of X int n = array.size(X) float norm = 0.0 for i = 0 to n - 1 norm += math.pow(array.get(X, i), 2) math.sqrt(norm) qr_diag(A, nrows, ncolumns) => // @function: QR Decomposition with Modified Gram-Schmidt Algorithm (Column-Oriented) // @parameters: // A :: float[] array: pseudo 2d matrix A = [[column_0],[column_1],...,[column_(n-1)]] // nrows :: integer: number of rows in A // ncolumns :: integer: number of columns in A // @returns: // Q :: float[] array, unitary matrix, implied dimenstions nrows x ncolumns // R :: float[] array, upper triangular matrix, implied dimansions ncolumns x ncolumns float[] Q = array.new_float(nrows * ncolumns, 0) float[] R = array.new_float(ncolumns * ncolumns, 0) float[] a = array.new_float(nrows, 0) float[] q = array.new_float(nrows, 0) float r = 0.0 float aux = 0.0 //get first column of _A and its norm: for i = 0 to nrows - 1 array.set(a, i, matrix_get(A, i, 0, nrows)) r := vnorm(a) //assign first diagonal element of R and first column of Q matrix_set(R, r, 0, 0, ncolumns) for i = 0 to nrows - 1 matrix_set(Q, array.get(a, i) / r, i, 0, nrows) if ncolumns != 1 //repeat for the rest of the columns for k = 1 to ncolumns - 1 for i = 0 to nrows - 1 array.set(a, i, matrix_get(A, i, k, nrows)) for j = 0 to k - 1 by 1 //get R_jk as scalar product of Q_j column and A_k column: r := 0 for i = 0 to nrows - 1 r += matrix_get(Q, i, j, nrows) * array.get(a, i) matrix_set(R, r, j, k, ncolumns) //update vector _a for i = 0 to nrows - 1 aux := array.get(a, i) - r * matrix_get(Q, i, j, nrows) array.set(a, i, aux) //get diagonal R_kk and Q_k column r := vnorm(a) matrix_set(R, r, k, k, ncolumns) for i = 0 to nrows - 1 matrix_set(Q, array.get(a, i) / r, i, k, nrows) [Q, R] pinv(A, nrows, ncolumns) => // @function: Pseudoinverse of matrix A calculated using QR decomposition // @parameters: // A :: float[] array: implied as a (nrows x ncolumns) matrix A = [[column_0],[column_1],...,[column_(_ncolumns-1)]] // nrows :: integer: number of rows in A // ncolumns :: integer: number of columns in A // @returns: // Ainv :: float[] array implied as a (ncolumns x nrows) matrix A = [[row_0],[row_1],...,[row_(_nrows-1)]] // // First find the QR factorization of A: A = QR, where R is upper triangular matrix. Then do Ainv = R^-1*Q^T. [Q, R] = qr_diag(A, nrows, ncolumns) float[] QT = transpose(Q, nrows, ncolumns) // Calculate Rinv: var Rinv = array.new_float(ncolumns * ncolumns, 0) float r = 0.0 matrix_set(Rinv, 1 / matrix_get(R, 0, 0, ncolumns), 0, 0, ncolumns) if ncolumns != 1 for j = 1 to ncolumns - 1 for i = 0 to j - 1 r := 0.0 for k = i to j - 1 r += matrix_get(Rinv, i, k, ncolumns) * matrix_get(R, k, j, ncolumns) matrix_set(Rinv, r, i, j, ncolumns) for k = 0 to j - 1 matrix_set(Rinv, -matrix_get(Rinv, k, j, ncolumns) / matrix_get(R, j, j, ncolumns), k, j, ncolumns) matrix_set(Rinv, 1 / matrix_get(R, j, j, ncolumns), j, j, ncolumns) // float[] Ainv = multiply(Rinv, QT, ncolumns, ncolumns, nrows) Ainv adftest(a, nLag, conf) => // @function: Augmented Dickey-Fuller unit root test. // @parameters: // a :: float[], array containing the data series to test // Lag :: int, maximum lag included in test // @returns: // adf :: float, the test statistic // crit :: float, critical value for the test statistic at the 10 % levels // nobs :: int, the number of observations used for the ADF regression and calculation of the critical values if nLag >= array.size(a)/2 - 2 runtime.error("ADF: Maximum lag must be less than (Length/2 - 2)") int nobs = array.size(a)-nLag-1 // float[] y = array.new_float(na) float[] x = array.new_float(na) float[] x0 = array.new_float(na) // for i = 0 to nobs-1 array.push( y, array.get(a,i)-array.get(a,i+1)) // current difference, dependent variable array.push( x, array.get(a,i+1)) // previous-bar value, predictor (related to tauADF) array.push(x0, 1.0) // constant, predictor // float[] X = array.copy(x) int M = 2 X := array.concat(X, x0) // // introduce lags if nLag > 0 for n = 1 to nLag float[] xl = array.new_float(na) for i = 0 to nobs-1 array.push(xl, array.get(a,i+n)-array.get(a,i+n+1)) // lag-n difference, predictor X := array.concat(X, xl) M += 1 // // Regression float[] c = pinv(X, nobs, M) float[] coeff = multiply(c, y, M, nobs, 1) // // Standard error float[] Yhat = multiply(X,coeff,nobs,M,1) float meanX = array.avg(x) float sum1 = 0.0 // mean square error (MSE) of regression float sum2 = 0.0 // for i = 0 to nobs-1 sum1 += math.pow(array.get(y,i) - array.get(Yhat,i), 2)/(nobs-M) sum2 += math.pow(array.get(x,i) - meanX, 2) float SE = math.sqrt(sum1/sum2) // // The test statistic float adf = array.get(coeff,0) /SE // // Critical value of the ADF test statistic (90%, model1: constant, no trend) // MacKinnon, J.G. 2010. “Critical Values for Cointegration Tests.” Queen”s University, Dept of Economics, Working Papers. float crit = switch conf == "90%" => -2.56677 - 1.5384/nobs - 2.809/nobs/nobs conf == "95%" => -2.86154 - 2.8903/nobs - 4.234/nobs/nobs - 40.040/nobs/nobs/nobs conf == "99%" => -3.43035 - 6.5393/nobs - 16.786/nobs/nobs - 79.433/nobs/nobs/nobs // // output [adf, crit, nobs] // --- main --- // load data from a moving window into an array float[] a = array.new_float(na) for i = 0 to lookback-1 array.push(a,src[i]) // perform the ADF test [tauADF, crit, nobs] = adftest(a, nLag, conf) // plot color tauColor = switch tauADF < crit => #7AF54D tauADF > crit => color.from_gradient(math.abs(tauADF), 0.0, math.abs(crit), color.white, #F5DF4D)//#939597, #F5DF4D) bgcolor(#64416b) plot(0.0, color = #939597, title = "Zero") plot(crit, color = #c84df5, title = "Critical value") plot(tauADF, color = tauColor, title = "Test statistic", style = plot.style_cross, linewidth = 2) if barstate.islast and isInfobox infobox = table.new("bottom_left", 2, 3, bgcolor = #faedf5, frame_color = (tauADF < crit)?#7AF54D:#C84DF5, frame_width = 1) table.cell(infobox, 0, 0, text = "Test Statistic", text_color = color.black, text_size = size.small) table.cell(infobox, 0, 1, text = conf+" Critical Value", text_color = color.black, text_size = size.small) table.cell(infobox, 0, 2, text = "Mean Reverting?", text_color = color.black, text_size = size.small) table.cell(infobox, 1, 0, text = str.format("{0, number, #.####}",tauADF), text_color = color.black, text_size = size.small) table.cell(infobox, 1, 1, text = str.format("{0, number, #.####}",crit), text_color = color.black, text_size = size.small) table.cell(infobox, 1, 2, text = (tauADF < crit)?"Yes":"No", text_color = color.black, text_size = size.small)
alerts++
https://www.tradingview.com/script/Znfatcva-alerts/
claireablani
https://www.tradingview.com/u/claireablani/
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/ // © claireablani // simple script to easily add alerts for a trade setup // v.2 optional live P/L label // optional stop loss after 4h candle closes // v.3 moved use_timeframe_stoploss below more important inputs // v.3.1 fixing stoploss percentage rendering bug... missing onchart condition // v.4 - alerts for gradations of buy zone and sl zone, will use this to trade haas email bot //@version=5 indicator('alerts++', overlay=true) activechart = syminfo.tickerid show_ticker = input(false, title='show ticker label') // ticker = input.string('KUCOIN:XRPUSDT', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') // on_chart = activechart == ticker // COIN_1 ticker_1 = input.string('KUCOIN:BNBUSDT', title="", group='alert_1', inline='alert_1 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_1 = input.string('60', title="", group='alert_1', inline='alert_1 inline') coin_1 = request.security(ticker_1, timeframe_1, close) // plot(coin_1) choice_1 = input(title="", group='alert_1', inline='alert_1 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_1 = input(0.0, title="", group='alert_1', inline='alert_1 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_1, target_1) and (choice_1 == "over" or choice_1 == "either")) alert('Alert_1 ' + ticker_1 + ' ' + timeframe_1 + " crossed over " + str.tostring(target_1) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_1, target_1) and (choice_1 == "under" or choice_1 == "either")) alert('Alert_1 ' + ticker_1 + ' ' + timeframe_1 + " crossed under " + str.tostring(target_1) , alert.freq_once_per_bar) // COIN_2 ticker_2 = input.string('KUCOIN:BNBUSDT', title="", group='alert_2', inline='alert_2 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_2 = input.string('60', title="", group='alert_2', inline='alert_2 inline') coin_2 = request.security(ticker_2, timeframe_2, close) // plot(coin_2) choice_2 = input(title="", group='alert_2', inline='alert_2 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_2 = input(0.0, title="", group='alert_2', inline='alert_2 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_2, target_2) and (choice_2 == "over" or choice_2 == "either")) alert('Alert_2 ' + ticker_2 + ' ' + timeframe_2 + " crossed over " + str.tostring(target_2) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_2, target_2) and (choice_2 == "under" or choice_2 == "either")) alert('Alert_2 ' + ticker_2 + ' ' + timeframe_2 + " crossed under " + str.tostring(target_2) , alert.freq_once_per_bar) // COIN_3 ticker_3 = input.string('KUCOIN:BNBUSDT', title="", group='alert_3', inline='alert_3 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_3 = input.string('60', title="", group='alert_3', inline='alert_3 inline') coin_3 = request.security(ticker_3, timeframe_3, close) // plot(coin_3) choice_3 = input(title="", group='alert_3', inline='alert_3 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_3 = input(0.0, title="", group='alert_3', inline='alert_3 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_3, target_3) and (choice_3 == "over" or choice_3 == "either")) alert('Alert_3 ' + ticker_3 + ' ' + timeframe_3 + " crossed over " + str.tostring(target_3) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_3, target_3) and (choice_3 == "under" or choice_3 == "either")) alert('Alert_3 ' + ticker_3 + ' ' + timeframe_3 + " crossed under " + str.tostring(target_3) , alert.freq_once_per_bar) // COIN_4 ticker_4 = input.string('KUCOIN:BNBUSDT', title="", group='alert_4', inline='alert_4 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_4 = input.string('60', title="", group='alert_4', inline='alert_4 inline') coin_4 = request.security(ticker_4, timeframe_4, close) // plot(coin_4) choice_4 = input(title="", group='alert_4', inline='alert_4 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_4 = input(0.0, title="", group='alert_4', inline='alert_4 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_4, target_4) and (choice_4 == "over" or choice_4 == "either")) alert('Alert_4 ' + ticker_4 + ' ' + timeframe_4 + " crossed over " + str.tostring(target_4) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_4, target_4) and (choice_4 == "under" or choice_4 == "either")) alert('Alert_4 ' + ticker_4 + ' ' + timeframe_4 + " crossed under " + str.tostring(target_4) , alert.freq_once_per_bar) // COIN_5 ticker_5 = input.string('KUCOIN:BNBUSDT', title="", group='alert_5', inline='alert_5 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_5 = input.string('60', title="", group='alert_5', inline='alert_5 inline') coin_5 = request.security(ticker_5, timeframe_5, close) // plot(coin_5) choice_5 = input(title="", group='alert_5', inline='alert_5 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_5 = input(0.0, title="", group='alert_5', inline='alert_5 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_5, target_5) and (choice_5 == "over" or choice_5 == "either")) alert('Alert_5 ' + ticker_5 + ' ' + timeframe_5 + " crossed over " + str.tostring(target_5) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_5, target_5) and (choice_5 == "under" or choice_5 == "either")) alert('Alert_5 ' + ticker_5 + ' ' + timeframe_5 + " crossed under " + str.tostring(target_5) , alert.freq_once_per_bar) // COIN_6 ticker_6 = input.string('KUCOIN:BNBUSDT', title="", group='alert_6', inline='alert_6 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_6 = input.string('60', title="", group='alert_6', inline='alert_6 inline') coin_6 = request.security(ticker_6, timeframe_6, close) // plot(coin_6) choice_6 = input(title="", group='alert_6', inline='alert_6 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_6 = input(0.0, title="", group='alert_6', inline='alert_6 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_6, target_6) and (choice_6 == "over" or choice_6 == "either")) alert('Alert_6 ' + ticker_6 + ' ' + timeframe_6 + " crossed over " + str.tostring(target_6) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_6, target_6) and (choice_6 == "under" or choice_6 == "either")) alert('Alert_6 ' + ticker_6 + ' ' + timeframe_6 + " crossed under " + str.tostring(target_6) , alert.freq_once_per_bar) // COIN_7 ticker_7 = input.string('KUCOIN:BNBUSDT', title="", group='alert_7', inline='alert_7 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_7 = input.string('60', title="", group='alert_7', inline='alert_7 inline') coin_7 = request.security(ticker_7, timeframe_7, close) // plot(coin_7) choice_7 = input(title="", group='alert_7', inline='alert_7 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_7 = input(0.0, title="", group='alert_7', inline='alert_7 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_7, target_7) and (choice_7 == "over" or choice_7 == "either")) alert('Alert_7 ' + ticker_7 + ' ' + timeframe_7 + " crossed over " + str.tostring(target_7) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_7, target_7) and (choice_7 == "under" or choice_7 == "either")) alert('Alert_7 ' + ticker_7 + ' ' + timeframe_7 + " crossed under " + str.tostring(target_7) , alert.freq_once_per_bar) // COIN_8 ticker_8 = input.string('KUCOIN:BNBUSDT', title="", group='alert_8', inline='alert_8 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_8 = input.string('60', title="", group='alert_8', inline='alert_8 inline') coin_8 = request.security(ticker_8, timeframe_8, close) // plot(coin_8) choice_8 = input(title="", group='alert_8', inline='alert_8 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_8 = input(0.0, title="", group='alert_8', inline='alert_8 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_8, target_8) and (choice_8 == "over" or choice_8 == "either")) alert('Alert_8 ' + ticker_8 + ' ' + timeframe_8 + " crossed over " + str.tostring(target_8) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_8, target_8) and (choice_8 == "under" or choice_8 == "either")) alert('Alert_8 ' + ticker_8 + ' ' + timeframe_8 + " crossed under " + str.tostring(target_8) , alert.freq_once_per_bar) // COIN_9 ticker_9 = input.string('KUCOIN:BNBUSDT', title="", group='alert_9', inline='alert_9 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_9 = input.string('60', title="", group='alert_9', inline='alert_9 inline') coin_9 = request.security(ticker_9, timeframe_9, close) // plot(coin_9) choice_9 = input(title="", group='alert_9', inline='alert_9 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_9 = input(0.0, title="", group='alert_9', inline='alert_9 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_9, target_9) and (choice_9 == "over" or choice_9 == "either")) alert('Alert_9 ' + ticker_9 + ' ' + timeframe_9 + " crossed over " + str.tostring(target_9) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_9, target_9) and (choice_9 == "under" or choice_9 == "either")) alert('Alert_9 ' + ticker_9 + ' ' + timeframe_9 + " crossed under " + str.tostring(target_9) , alert.freq_once_per_bar) // COIN_10 ticker_10 = input.string('KUCOIN:BNBUSDT', title="", group='alert_10', inline='alert_10 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_10 = input.string('60', title="", group='alert_10', inline='alert_10 inline') coin_10 = request.security(ticker_10, timeframe_10, close) // plot(coin_10) choice_10 = input(title="", group='alert_10', inline='alert_10 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_10 = input(0.0, title="", group='alert_10', inline='alert_10 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_10, target_10) and (choice_10 == "over" or choice_10 == "either")) alert('Alert_10 ' + ticker_10 + ' ' + timeframe_10 + " crossed over " + str.tostring(target_10) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_10, target_10) and (choice_10 == "under" or choice_10 == "either")) alert('Alert_10 ' + ticker_10 + ' ' + timeframe_10 + " crossed under " + str.tostring(target_10) , alert.freq_once_per_bar) // COIN_11 ticker_11 = input.string('KUCOIN:BNBUSDT', title="", group='alert_11', inline='alert_11 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_11 = input.string('60', title="", group='alert_11', inline='alert_11 inline') coin_11 = request.security(ticker_11, timeframe_11, close) // plot(coin_11) choice_11 = input(title="", group='alert_11', inline='alert_11 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_11 = input(0.0, title="", group='alert_11', inline='alert_11 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_11, target_11) and (choice_11 == "over" or choice_11 == "either")) alert('Alert_11 ' + ticker_11 + ' ' + timeframe_11 + " crossed over " + str.tostring(target_11) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_11, target_11) and (choice_11 == "under" or choice_11 == "either")) alert('Alert_11 ' + ticker_11 + ' ' + timeframe_11 + " crossed under " + str.tostring(target_11) , alert.freq_once_per_bar) // COIN_12 ticker_12 = input.string('KUCOIN:BNBUSDT', title="", group='alert_12', inline='alert_12 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_12 = input.string('60', title="", group='alert_12', inline='alert_12 inline') coin_12 = request.security(ticker_12, timeframe_12, close) // plot(coin_12) choice_12 = input(title="", group='alert_12', inline='alert_12 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_12 = input(0.0, title="", group='alert_12', inline='alert_12 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_12, target_12) and (choice_12 == "over" or choice_12 == "either")) alert('Alert_12 ' + ticker_12 + ' ' + timeframe_12 + " crossed over " + str.tostring(target_12) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_12, target_12) and (choice_12 == "under" or choice_12 == "either")) alert('Alert_12 ' + ticker_12 + ' ' + timeframe_12 + " crossed under " + str.tostring(target_12) , alert.freq_once_per_bar) // COIN_13 ticker_13 = input.string('KUCOIN:BNBUSDT', title="", group='alert_13', inline='alert_13 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_13 = input.string('60', title="", group='alert_13', inline='alert_13 inline') coin_13 = request.security(ticker_13, timeframe_13, close) // plot(coin_13) choice_13 = input(title="", group='alert_13', inline='alert_13 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_13 = input(0.0, title="", group='alert_13', inline='alert_13 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_13, target_13) and (choice_13 == "over" or choice_13 == "either")) alert('Alert_13 ' + ticker_13 + ' ' + timeframe_13 + " crossed over " + str.tostring(target_13) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_13, target_13) and (choice_13 == "under" or choice_13 == "either")) alert('Alert_13 ' + ticker_13 + ' ' + timeframe_13 + " crossed under " + str.tostring(target_13) , alert.freq_once_per_bar) // COIN_14 ticker_14 = input.string('KUCOIN:BNBUSDT', title="", group='alert_14', inline='alert_14 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_14 = input.string('60', title="", group='alert_14', inline='alert_14 inline') coin_14 = request.security(ticker_14, timeframe_14, close) // plot(coin_14) choice_14 = input(title="", group='alert_14', inline='alert_14 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_14 = input(0.0, title="", group='alert_14', inline='alert_14 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_14, target_14) and (choice_14 == "over" or choice_14 == "either")) alert('Alert_14 ' + ticker_14 + ' ' + timeframe_14 + " crossed over " + str.tostring(target_14) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_14, target_14) and (choice_14 == "under" or choice_14 == "either")) alert('Alert_14 ' + ticker_14 + ' ' + timeframe_14 + " crossed under " + str.tostring(target_14) , alert.freq_once_per_bar) // COIN_15 ticker_15 = input.string('KUCOIN:BNBUSDT', title="", group='alert_15', inline='alert_15 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_15 = input.string('60', title="", group='alert_15', inline='alert_15 inline') coin_15 = request.security(ticker_15, timeframe_15, close) // plot(coin_15) choice_15 = input(title="", group='alert_15', inline='alert_15 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_15 = input(0.0, title="", group='alert_15', inline='alert_15 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_15, target_15) and (choice_15 == "over" or choice_15 == "either")) alert('Alert_15 ' + ticker_15 + ' ' + timeframe_15 + " crossed over " + str.tostring(target_15) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_15, target_15) and (choice_15 == "under" or choice_15 == "either")) alert('Alert_15 ' + ticker_15 + ' ' + timeframe_15 + " crossed under " + str.tostring(target_15) , alert.freq_once_per_bar) // COIN_16 ticker_16 = input.string('KUCOIN:BNBUSDT', title="", group='alert_16', inline='alert_16 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_16 = input.string('60', title="", group='alert_16', inline='alert_16 inline') coin_16 = request.security(ticker_16, timeframe_16, close) // plot(coin_16) choice_16 = input(title="", group='alert_16', inline='alert_16 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_16 = input(0.0, title="", group='alert_16', inline='alert_16 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_16, target_16) and (choice_16 == "over" or choice_16 == "either")) alert('Alert_16 ' + ticker_16 + ' ' + timeframe_16 + " crossed over " + str.tostring(target_16) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_16, target_16) and (choice_16 == "under" or choice_16 == "either")) alert('Alert_16 ' + ticker_16 + ' ' + timeframe_16 + " crossed under " + str.tostring(target_16) , alert.freq_once_per_bar) // COIN_17 ticker_17 = input.string('KUCOIN:BNBUSDT', title="", group='alert_17', inline='alert_17 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_17 = input.string('60', title="", group='alert_17', inline='alert_17 inline') coin_17 = request.security(ticker_17, timeframe_17, close) // plot(coin_17) choice_17 = input(title="", group='alert_17', inline='alert_17 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_17 = input(0.0, title="", group='alert_17', inline='alert_17 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_17, target_17) and (choice_17 == "over" or choice_17 == "either")) alert('Alert_17 ' + ticker_17 + ' ' + timeframe_17 + " crossed over " + str.tostring(target_17) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_17, target_17) and (choice_17 == "under" or choice_17 == "either")) alert('Alert_17 ' + ticker_17 + ' ' + timeframe_17 + " crossed under " + str.tostring(target_17) , alert.freq_once_per_bar) // COIN_18 ticker_18 = input.string('KUCOIN:BNBUSDT', title="", group='alert_18', inline='alert_18 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_18 = input.string('60', title="", group='alert_18', inline='alert_18 inline') coin_18 = request.security(ticker_18, timeframe_18, close) // plot(coin_18) choice_18 = input(title="", group='alert_18', inline='alert_18 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_18 = input(0.0, title="", group='alert_18', inline='alert_18 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_18, target_18) and (choice_18 == "over" or choice_18 == "either")) alert('Alert_18 ' + ticker_18 + ' ' + timeframe_18 + " crossed over " + str.tostring(target_18) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_18, target_18) and (choice_18 == "under" or choice_18 == "either")) alert('Alert_18 ' + ticker_18 + ' ' + timeframe_18 + " crossed under " + str.tostring(target_18) , alert.freq_once_per_bar) // COIN_19 ticker_19 = input.string('KUCOIN:BNBUSDT', title="", group='alert_19', inline='alert_19 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_19 = input.string('60', title="", group='alert_19', inline='alert_19 inline') coin_19 = request.security(ticker_19, timeframe_19, close) // plot(coin_19) choice_19 = input(title="", group='alert_19', inline='alert_19 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_19 = input(0.0, title="", group='alert_19', inline='alert_19 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_19, target_19) and (choice_19 == "over" or choice_19 == "either")) alert('Alert_19 ' + ticker_19 + ' ' + timeframe_19 + " crossed over " + str.tostring(target_19) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_19, target_19) and (choice_19 == "under" or choice_19 == "either")) alert('Alert_19 ' + ticker_19 + ' ' + timeframe_19 + " crossed under " + str.tostring(target_19) , alert.freq_once_per_bar) // COIN_20 ticker_20 = input.string('KUCOIN:BNBUSDT', title="", group='alert_20', inline='alert_20 inline', tooltip='In the format of EXCHANGE:BASEQUOTE, i.e. KUCOIN:BTCUSDT. Use \'Show Ticker Label\' checkbox to display the ticker on a label. Make sure to uncheck it afterwards.') timeframe_20 = input.string('60', title="", group='alert_20', inline='alert_20 inline') coin_20 = request.security(ticker_20, timeframe_20, close) // plot(coin_20) choice_20 = input(title="", group='alert_20', inline='alert_20 inline', defval="over", tooltip='Write in "over", "under", or "either"') // options=["cross up"]) target_20 = input(0.0, title="", group='alert_20', inline='alert_20 inline', tooltip="ticker__timeframe__over/under/either__target price") // cross over or either if(ta.crossover(coin_20, target_20) and (choice_20 == "over" or choice_20 == "either")) alert('Alert_20 ' + ticker_20 + ' ' + timeframe_20 + " crossed over " + str.tostring(target_20) , alert.freq_once_per_bar) // cross under or either if(ta.crossunder(coin_20, target_20) and (choice_20 == "under" or choice_20 == "either")) alert('Alert_20 ' + ticker_20 + ' ' + timeframe_20 + " crossed under " + str.tostring(target_20) , alert.freq_once_per_bar) // label for debug var label debug_label = na label.delete(debug_label) // delete previous labels debug_label_text = syminfo.tickerid // debug_label_text := tostring(array.size(buy_levels)) debug_label := label.new(x=time, xloc=xloc.bar_time, y=close, size=size.normal, text=debug_label_text, color=color.new(color.blue, 50), textcolor=color.new(color.white, show_ticker ? 0 : 100), style=show_ticker ? label.style_label_up : label.style_none)
Bollinger bands and Keltner bands
https://www.tradingview.com/script/jRypetcx-Bollinger-bands-and-Keltner-bands/
Rain5369
https://www.tradingview.com/u/Rain5369/
337
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Rain5369 //@version=5 indicator(title='Bollinger bands and ATR bands', shorttitle='BB', overlay=true, timeframe= '', timeframe_gaps = false ) length = input.int(20, title='length', minval=1) source = input(close, title='Source') Vol = ta.vwma(source, length) basis = input.string(title='Basis', defval='sma', options=['sma', 'ema', 'wma', 'vwma', 'Rma', 'alma', 'hull ma']) maType(source) => switch basis 'sma' => ta.sma(source, length) 'ema' => ta.ema(source, length) 'wma' => ta.wma(source, length) 'vwma' => ta.vwma(source, length) 'Rma' => ta.rma(source, length) 'alma' => ta.alma(source,length, 0.85, 6) 'hull ma' => ta.hma(source,length) pivot = plot(maType(source), color=color.new(color.white, 0), title='mean line', linewidth=2) dev = ta.stdev(source, length) alen = input.int(14, minval=1, title='ATR', group='ATR') // ATR lines ATop1 = (maType(source)) + 1 * ta.atr(alen) ABot1 = (maType(source)) - 1 * ta.atr(alen) ATop2 = (maType(source)) + 2 * ta.atr(alen) ABot2 = (maType(source)) - 2 * ta.atr(alen) ATop3 = (maType(source)) + 3 * ta.atr(alen) ABot3 = (maType(source)) - 3 * ta.atr(alen) //Bolliner lines Top1 = (maType(source)) + 3 * dev Top2 = (maType(source)) + 2.6 * dev Top3 = (maType(source)) + 2.2 * dev Top4 = (maType(source)) + 2 * dev Top5 = (maType(source)) + 0.1 * dev Bot1 = (maType(source)) - 3 * dev Bot2 = (maType(source)) - 2.6 * dev Bot3 = (maType(source)) - 2.2 * dev Bot4 = (maType(source)) - 2 * dev Bot5 = (maType(source)) - 0.1 * dev f_weighted_sd_from_arrays(_a_src, _a_weight, _n) => //{ float _mean = na float _variance = na float _dev = na float _mse = na float _rmse = na float _sqerror_sum = na float _sum_weight = na float[] _a_xw = array.new_float(_n) int _nonzero_n = 0 if array.size(_a_src) >= _n _sum_weight := 0 _sqerror_sum := 0 for _i = 0 to _n - 1 by 1 array.set(_a_xw, _i, array.get(_a_src, _i) * array.get(_a_weight, _i)) _sum_weight := _sum_weight + array.get(_a_weight, _i) _nonzero_n := array.get(_a_weight, _i) != 0 ? _nonzero_n + 1 : _nonzero_n _nonzero_n _mean := array.sum(_a_xw) / _sum_weight for _j = 0 to _n - 1 by 1 _sqerror_sum := _sqerror_sum + math.pow(_mean - array.get(_a_src, _j), 2) * array.get(_a_weight, _j) _sqerror_sum _variance := _sqerror_sum / ((_nonzero_n - 1) * _sum_weight / _nonzero_n) _dev := math.sqrt(_variance) _mse := _sqerror_sum / _sum_weight _rmse := math.sqrt(_mse) _rmse [_mean, _variance, _dev, _mse, _rmse] //} // ----------------------------------------------------------------------------- // From arrays : // ----------------------------------------------------------------------------- var float[] a_src = array.new_float() var float[] a_weight = array.new_float() if barstate.isfirst for i = 1 to length by 1 array.unshift(a_weight, i) array.unshift(a_src, close) if array.size(a_src) > length array.pop(a_src) [a_m, a_v, a_d, a_mse, a_rmse] = f_weighted_sd_from_arrays(a_src, a_weight, length) // ATR lines //ATR color options Theme = input.string(title='Theme', options=['Default', 'All White', 'All Black'], defval='All White', group='ATR') colour1 = color.new(#9700FF, 35) colour2 = color.new(#00FF2A, 35) colour3 = color.new(#F0FF00, 35) colour4 = color.new(#FFFFFF, 35) colour5 = color.new(#000000, 35) c1 = Theme == 'Default' ? colour1 : Theme == 'All White' ? colour4 : Theme == 'All Black' ? colour5 : na c2 = Theme == 'Default' ? colour2 : Theme == 'All White' ? colour4 : Theme == 'All Black' ? colour5 : na c3 = Theme == 'Default' ? colour3 : Theme == 'All White' ? colour4 : Theme == 'All Black' ? colour5 : na // ATR plots plot(ATop1, color=c1, title='Middle higher ATR', display=display.none) plot(ABot1, color=c1, title='Middle lower ATR', display=display.none) plot(ATop2, color=c2, title='Innear higher ATR', display=display.none) plot(ABot2, color=c2, title='Innear lower ATR', display=display.none) plot(ATop3, color=c3, title='Top ATR', display=display.none) plot(ABot3, color=c3, title='Bottom ATR', display=display.none) // bollinger plots l1 = plot(Top1, color=color.new(color.blue, 0), editable=false, display=display.none, title='+ 3 dev') l2 = plot(Top2, color=color.new(color.blue, 0), editable=false, display=display.none, title='+ 2.8 dev') l3 = plot(Top3, color=color.new(color.blue, 0), editable=false, display=display.none, title='+ 2.2 dev') l4 = plot(Top4, color=color.new(color.blue, 0), editable=false, display=display.none, title='+ 2 dev') //2dev l5 = plot(Top5, color=color.new(color.blue, 0), editable=false, display=display.none, title='+ 0.2 dev') l6 = plot(Bot5, color=color.new(color.blue, 0), editable=false, display=display.none, title='- 0.2 dev') l7 = plot(Bot4, color=color.new(color.blue, 0), editable=false, display=display.none, title='- 2 dev') //2dev l8 = plot(Bot3, color=color.new(color.blue, 0), editable=false, display=display.none, title='- 2.2 dev') l9 = plot(Bot2, color=color.new(color.blue, 0), editable=false, display=display.none, title='- 2.4 dev') l10 = plot(Bot1, color=color.new(color.blue, 0), editable=false, display=display.none, title='- 3 dev') aupper5 = plot(Vol + a_d * 2, color=color.new(color.orange, 0), display=display.none, editable=false, title='exp + 2 dev') alower5 = plot(Vol - a_d * 2, color=color.new(color.orange, 0), display=display.none, editable=false, title='exp - 2 dev') // Bollinger fill plots fill(l1, l2, color=color.new(#FFFFFF20, 85), editable=false) fill(l2, l3, color=color.new(#FFFFFF20, 85), editable=false) fill(l3, l4, color=color.new(#FFFFFF20, 85), editable=false) fill(l7, l8, color=color.new(#FFFFFF20, 85), editable=false) fill(l8, l9, color=color.new(#FFFFFF20, 85), editable=false) fill(l9, l10, color=color.new(#FFFFFF20, 85), editable=false) fill(aupper5, l1, color=color.new(#CE000D25, 80), title='weighted cloud - Resistance') fill(alower5, l10, color=color.new(#8BBBB225, 80), title='weighted cloud - Support')
Bollinger bands dynamic alerts
https://www.tradingview.com/script/cOOCimjI-Bollinger-bands-dynamic-alerts/
RajeevNaik
https://www.tradingview.com/u/RajeevNaik/
85
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © RajeevNaik //@version=5 indicator('Bollinger bands dynamic alerts', shorttitle='BBx3', overlay=true) //input length = input.int(20, minval=1) //1 sigma [middlea, uppera, lowera] = ta.bb(close, length, 1) plot(middlea, color=color.new(color.purple, 0)) a = plot(uppera, color=color.new(color.blue, 0)) b = plot(lowera, color=color.new(color.blue, 0)) fill(a, b, title='Congestion', color=color.new(color.blue, 90)) //2 sigma [middleb, upperb, lowerb] = ta.bb(close, length, 2) //plot(middle1, color=color.orange) a1 = plot(upperb, color=color.new(color.orange, 0)) b1 = plot(lowerb, color=color.new(color.orange, 0)) fill(a1, b1, title='Trend', color=color.new(color.orange, 90)) //3 sigma [middlec, upperc, lowerc] = ta.bb(close, length, 3) //plot(middle1, color=color.orange) a2u = close > upperc b2l = lowerc > close a2 = plot(upperc, color=color.new(color.red, 0)) b2 = plot(lowerc, color=color.new(color.red, 0)) fill(a2, b2, title='Blowout', color=color.new(color.red, 90)) //for alerts //BB1 src = input(close, title='Source') mult = input.float(1.0, minval=0.001, maxval=50, title='StdDev') basis = ta.sma(src, length) dev = mult * ta.stdev(src, length) upper = basis + dev lower = basis - dev //BB2 mult2 = input.float(2.0, minval=0.001, maxval=50, title='StdDev') dev2 = mult2 * ta.stdev(src, length) upper2 = basis + dev2 lower2 = basis - dev2 mult3 = input.float(3.0, minval=0.001, maxval=50, title='StdDev') dev3 = mult3 * ta.stdev(src, length) upper3 = basis + dev3 lower3 = basis - dev3 // dynamic alerts //BB1 f_triggerBBU() => _s = basis + dev _co = ta.crossover(close, _s) _cu = ta.crossunder(close, _s) if _co alert('Price (' + str.tostring(close) + ') crossing up congestion BB1 (' + str.tostring(_s) + ')', alert.freq_once_per_bar) f_triggerBBL() => _s = basis - dev _co = ta.crossover(close, _s) _cu = ta.crossunder(close, _s) if _cu alert('Price (' + str.tostring(close) + ') crossing down congestion BB 1(' + str.tostring(_s) + ')', alert.freq_once_per_bar) f_triggerBBU() f_triggerBBL() //BB2 f_triggerBBU2() => _s = basis + dev2 _co = ta.crossover(close, _s) _cu = ta.crossunder(close, _s) if _co alert('Price (' + str.tostring(close) + ') crossing up BB2 trend (' + str.tostring(_s) + ')', alert.freq_once_per_bar) f_triggerBBL2() => _s = basis - dev2 _co = ta.crossover(close, _s) _cu = ta.crossunder(close, _s) if _cu alert('Price (' + str.tostring(close) + ') crossing down BB2 trend (' + str.tostring(_s) + ')', alert.freq_once_per_bar) f_triggerBBU2() f_triggerBBL2() //BB3 f_triggerBBU3() => _s = basis + dev3 _co = ta.crossover(close, _s) _cu = ta.crossunder(close, _s) if _co alert('Price (' + str.tostring(close) + ') crossing up BB3 Blowout (' + str.tostring(_s) + ')', alert.freq_once_per_bar) f_triggerBBL3() => _s = basis - dev3 _co = ta.crossover(close, _s) _cu = ta.crossunder(close, _s) if _cu alert('Price (' + str.tostring(close) + ') crossing down BB3 Blowout (' + str.tostring(_s) + ')', alert.freq_once_per_bar) f_triggerBBU3() f_triggerBBL3()
Stochastic RSI Heat Bollinger Bands
https://www.tradingview.com/script/Q3nG7mGI-Stochastic-RSI-Heat-Bollinger-Bands/
noop-noop
https://www.tradingview.com/u/noop-noop/
212
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © noop42 //@version=5 indicator("Stochastic RSI Heat Bollinger Bands", shorttitle="SRSI Heat BB", overlay=true) // Functions ma(source, length, type) => type == "SMA" ? ta.sma(source, length) : type == "EMA" ? ta.ema(source, length) : type == "SMMA (RMA)" ? ta.rma(source, length) : type == "WMA" ? ta.wma(source, length) : type == "VWMA" ? ta.vwma(source, length) : na invert_colors = input.bool(title="Invert colors", defval=false, group='Options') color_value(value, transp=0) => step = (255/100.0) d = value * step r = 0.0 g = 0.0 if invert_colors r := value < 50 ? d : 127 g := value < 50 ? 127: 255 - d else g := value < 50 ? d : 127 r := value < 50 ? 127: 255 - d color.rgb(math.round(r), math.round(g), 0, transp) // Inputs show_screener = input.bool(title='Show Screener', defval=true, group='Options') color_src = input.string(title="Color Source", options=["Stochastic RSI", "RSI"], defval="Stochastic RSI", group='Options') fill_bb_heat = input.bool(title="Fill Bollinger bands with heat", defval=true, group='Options') show_bb = input.bool(title="Show upper and lower lines", defval=true, group='Options') show_bb_heat = input.bool(title="Color upper and lower bands with heat", defval=true, group='Options') show_basis_heat = input.bool(title="Color basis line with heat", defval=true, group='Options') length = input.int(20, minval=1, group="Bollinger Bands") bb_src = input(close, title="Source", group="Bollinger Bands") mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands") offset = input.int(0, "Offset", minval = -500, maxval = 500, group="Bollinger Bands") ma_type = input.string("SMA", title="Moving average type", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Bollinger Bands") show_over_signals = input.bool(true, "Show overbought/oversold diamonds", group='Stochastic RSI') smoothK = input.int(3, "K", minval=1, group='Stochastic RSI') smoothD = input.int(3, "D", minval=1, group='Stochastic RSI') lengthRSI = input.int(14, "RSI Length", minval=1, group='Stochastic RSI') lengthStoch = input.int(14, "Stochastic Length", minval=1, group='Stochastic RSI') srsi_src = input(close, title="RSI Source", group='Stochastic RSI') // Calculations BB basis = ma(bb_src, length, ma_type) dev = mult * ta.stdev(bb_src, length) upper = basis + dev lower = basis - dev // Calculations SRSI rsi = ta.rsi(srsi_src, lengthRSI) k = ta.sma(ta.stoch(rsi, rsi, rsi, lengthRSI), smoothK) d = ta.sma(k, smoothD) a = (k + d) / 2 // Plots col = color_value(color_src == "RSI" ? rsi : a) bands_col = show_bb ? (show_bb_heat ? col : color.green) : #00000000 basis_col = show_basis_heat ? col : color.blue bg_col = color_value(color_src == "RSI" ? rsi : a, transp=(fill_bb_heat ? 70: 100)) plot(basis, "Basis", color=basis_col, offset = offset, linewidth=1) p1 = plot(upper, "Upper", color=bands_col, offset = offset) p2 = plot(lower, "Lower", color=bands_col, offset = offset) fill(p1, p2, title = "Background", color=bg_col) // Screener sr_ob = a > 80 sr_os = a < 20 rsi_ob = a > 70 rsi_os = a < 30 srsi_status = sr_ob ? "Overbought" : sr_os ? "Oversold" : "OK" rsi_status = rsi_ob ? "Overbought" : rsi_os ? "Oversold" : "OK" ob = color_src == "RSI" ? rsi_ob : sr_ob os = color_src == "RSI" ? rsi_os : sr_os plotshape(show_over_signals and (ob or os) ? 1 : 0, style=shape.diamond, location=location.top, color=bg_col) default_bg = #cccccc var tbl = table.new(position.top_right, 6, 2) if show_screener if barstate.islast table.cell(tbl, 0, 0, 'K', bgcolor=default_bg) table.cell(tbl, 1, 0, 'D', bgcolor=default_bg) table.cell(tbl, 2, 0, 'RSI', bgcolor=default_bg) table.cell(tbl, 3, 0, 'SR Status', bgcolor=default_bg) table.cell(tbl, 4, 0, 'RSI Status', bgcolor=default_bg) table.cell(tbl, 0, 1, str.tostring(k, '#.##'), bgcolor=col, text_color=color.white) table.cell(tbl, 1, 1, str.tostring(d, '#.##'), bgcolor=col, text_color=color.white) table.cell(tbl, 2, 1, str.tostring(rsi, '#.##'), bgcolor=col, text_color=color.white) table.cell(tbl, 3, 1, srsi_status, bgcolor=col, text_color=color.white) table.cell(tbl, 4, 1, rsi_status, bgcolor=col, text_color=color.white)
Automatic Moving Average
https://www.tradingview.com/script/WOde1llr-Automatic-Moving-Average/
fondDealer96636
https://www.tradingview.com/u/fondDealer96636/
131
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © fondDealer96636 //@version=5 indicator('Automatic Moving Average', overlay=true, max_bars_back=201) // input start = 20 lookback = input(20, "Sensitivity", tooltip="Low (High Sensitivity), High (Low Sensitivity).\n\nAdjust according to timeframe and asset.") resp = 1 smoothing = input(5, "Smoothing") source = input(close, "Source") // global var ix = -1 var mal = array.new_int(0) // functions avg(source, len) => sum = 0.0 for i = 0 to len-1 sum += source[i] sum/len bull = close > open wick_touch(x) => bull ? ((close <= x and x <= high) or (low <= x and x <= open)) : ((open <= x and x <= high) or (low <= x and x <= close)) body_touch(x) => bull ? (open < x and x < close) : (close < x and x < open) touches(t) => touches = 0 for i = 0 to lookback-1 touches += t[i] ? 1 : 0 touches // local ix := ix+1 prev_mal = ix >= 1 ? array.get(mal, ix-1) : start cma = avg(source, prev_mal) cma_p1 = avg(source, prev_mal+1) cma_m1 = avg(source, prev_mal-1) d = touches(wick_touch(cma)) d_p1 = touches(wick_touch(cma_p1)) d_m1 = touches(wick_touch(cma_m1)) d_b = touches(body_touch(cma)) d_p1_b = touches(body_touch(cma_p1)) d_m1_b = touches(body_touch(cma_m1)) any_body_touch = d_b > 0 or d_p1_b > 0 or d_m1_b > 0 no_wick_touch = d <= 0 and d_p1 <= 0 and d_m1 <= 0 wick_maximized = d >= d_p1 and d >= d_m1 ? prev_mal : (d_p1 >= d and d_p1 >= d_m1 ? prev_mal+resp : (d_m1 >= d and d_m1 >= d_p1 ? prev_mal-resp : na)) uptrend = cma > cma[1] downtrend = cma < cma[1] against_trend = (uptrend and close < cma) or (downtrend and close > cma) new_mal = no_wick_touch or against_trend ? prev_mal-resp : (any_body_touch ? prev_mal+resp : wick_maximized) next_mal = na(new_mal) ? prev_mal : new_mal array.push(mal, next_mal < 2 ? 2 : (next_mal > 200 ? 200 : next_mal)) // graph scma = ta.ema(cma, smoothing) plot(scma, "Automatic MA")
Isolated Pivots
https://www.tradingview.com/script/86kARojD-Isolated-Pivots/
patrickws
https://www.tradingview.com/u/patrickws/
125
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © patrickws //@version=5 indicator("Isolated Pivots", overlay=true) pivotHigh() => (high[1] > math.max(high[2], high[0])) and (low[1] > math.max(low[2], low[0])) pivotLow() => (low[1] < math.min(low[2], low[0])) and (high[1] < math.min(high[2], high[0])) plotshape(pivotHigh(), text = "H", style = shape.labeldown, location = location.abovebar, color = color.red, textcolor = color.white, offset=-1) plotshape(pivotLow(), text = "L", style = shape.labelup, location = location.belowbar, color = color.green, textcolor = color.white, offset=-1)
Hx MTF Moving Average
https://www.tradingview.com/script/R7pJAFqf-Hx-MTF-Moving-Average/
HDrbx
https://www.tradingview.com/u/HDrbx/
42
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © HDrbx //@version=5 indicator(title="Hx MTF Moving Average", shorttitle = "Hx MTF MA", overlay=true) ma1Type = input.string(title='MA Type', defval='Smma', options=['Sma', 'Ema', 'VWma', 'Wma', 'Rma', 'Hull', 'Smma'], inline='1') ma1Length = input.int(title='Length', defval=50, inline='1') ma1Source = input.source(title='Source', defval=close, inline='1') ma1Show = input.bool(title='', defval=true, inline='2') tf1Input = input.timeframe(title="TF1", defval="15", inline = '2') ma1Color = input.color(title='  Color', defval=color.red, inline='2') ma1Width = input.int(title='  Width', defval = 2, inline = '2') ma2Show = input.bool(title='', defval=true, inline='3') tf2Input = input.timeframe(title="TF2", defval="60", inline = '3') ma2Color = input.color(title='  Color', defval=color.yellow, inline='3') ma2Width = input.int(title='  Width', defval = 2, inline = '3') ma3Show = input.bool(title='', defval=true, inline='4') tf3Input = input.timeframe(title="TF3", defval="240", inline = '4') ma3Color = input.color(title='  Color', defval=color.lime, inline='4') ma3Width = input.int(title='  Width', defval = 2, inline = '4') ma4Show = input.bool(title='', defval=true, inline='5') tf4Input = input.timeframe(title="TF4", defval="D", inline = '5') ma4Color = input.color(title='  Color', defval=color.blue, inline='5') ma4Width = input.int(title='  Width', defval = 2, inline = '5') currentTfIfDifferent = input.bool(title = 'current Timeframe if different', defval=false, inline = '6') ma0Color = input.color(title=' Color', defval=color.gray, inline='6') ma0Width = input.int(title='  Width', defval = 2, inline = '6') tfInMinutes(simple string tf = "") => //{ float chartTf = 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) float result = tf == "" ? chartTf : request.security(syminfo.tickerid, tf, chartTf) //} smma(_src, _length) => //{ float _smma = 0.0 float _sma = ta.sma(_src, _length) _smma := na(_smma[1]) ? _sma : (_smma[1] * (_length - 1) + _src) / _length _smma //} maSelect(_src, _length, _type) => //{ float _ma = _type == 'Sma' ? ta.sma(_src, _length) : _type == 'Ema' ? ta.ema(_src, _length) : _type == 'VWma' ? ta.vwma(_src, _length) : _type == 'Hull' ? ta.hma(_src, _length) : _type == 'Wma' ? ta.wma(_src, _length) : _type == 'Rma' ? ta.rma(_src, _length) : _type == 'Smma' ? smma(_src, _length) : na _ma //} float chartTfInMinutes = tfInMinutes() float inputTf1InMinutes = tfInMinutes(tf1Input) float inputTf2InMinutes = tfInMinutes(tf2Input) float inputTf3InMinutes = tfInMinutes(tf3Input) float inputTf4InMinutes = tfInMinutes(tf4Input) ma0 = maSelect(ma1Source, ma1Length, ma1Type) ma1 = request.security(syminfo.tickerid, tf1Input, maSelect(ma1Source, ma1Length, ma1Type),barmerge.gaps_on) ma2 = request.security(syminfo.tickerid, tf2Input, maSelect(ma1Source, ma1Length, ma1Type),barmerge.gaps_on) ma3 = request.security(syminfo.tickerid, tf3Input, maSelect(ma1Source, ma1Length, ma1Type),barmerge.gaps_on) ma4 = request.security(syminfo.tickerid, tf4Input, maSelect(ma1Source, ma1Length, ma1Type),barmerge.gaps_on) ma0Display = currentTfIfDifferent and chartTfInMinutes != inputTf1InMinutes and chartTfInMinutes != inputTf2InMinutes and chartTfInMinutes != inputTf3InMinutes and chartTfInMinutes != inputTf4InMinutes ma1Display = ma1Show and chartTfInMinutes <= inputTf1InMinutes ma2Display = ma2Show and chartTfInMinutes <= inputTf2InMinutes ma3Display = ma3Show and chartTfInMinutes <= inputTf3InMinutes ma4Display = ma4Show and chartTfInMinutes <= inputTf4InMinutes plot(ma0Display ? ma0 : na, color=ma0Color, linewidth=ma0Width) plot(ma1Display ? ma1 : na, title='MA 1', color=ma1Color, linewidth=ma1Width) plot(ma2Display ? ma2 : na, title='MA 2', color=ma2Color, linewidth=ma2Width) plot(ma3Display ? ma3 : na, title='MA 3', color=ma3Color, linewidth=ma3Width) plot(ma4Display ? ma4 : na, title='MA 4', color=ma4Color, linewidth=ma4Width)
9Week_Candle
https://www.tradingview.com/script/S4ZGSqww/
yasujiy
https://www.tradingview.com/u/yasujiy/
36
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © yasujiy //@version=5 indicator(title = 'nPeriod_Candle', overlay=false) Length = input.int(9, minval = 2, title = "Length") Len = Length - 1 donchianLow(Len) => ta.lowest(Len) donchianHigh(Len) => ta.highest(Len) m_close = close m_open = open[Len] m_high = donchianHigh(Len) m_low = donchianLow(Len) plotcandle(m_open, m_high, m_low, m_close, title='', color=m_open < m_close ? color.white : color.blue, wickcolor=color.black)
Fr3d0's Volume Profile Visible Range
https://www.tradingview.com/script/Sdowdtp7/
Fr3d0C0rl30n3
https://www.tradingview.com/u/Fr3d0C0rl30n3/
1,013
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/ // © Fr3d0C0rl30n3 //@version=4 study("Fr3d0's Volume Profile Visible Range", "VPVR", overlay=true, max_boxes_count=500) LINE_COLOR = color.new(color.gray, 25) BORDER_COLOR = color.new(color.black, 80) BUY_COLOR = color.new(color.green, 25) SELL_COLOR = color.new(color.red, 25) TIME_UNIT = time - time[1] MAX_BARS = 365 topBottomLineColor = input(LINE_COLOR, "Top/bottom Line Color", type = input.color) buyBarColor = input(BUY_COLOR, "Buy Bar Color", type = input.color) sellBarColor = input(SELL_COLOR, "Sell Bar Color", type = input.color) numOfBars = input(90, 'Number of bars', minval=14, maxval=MAX_BARS) distLastCandle = input(2, 'Distance from last candle', minval=2, maxval=20) rangeHigh = highest(high, numOfBars) rangeLow = lowest(low, numOfBars) rangeHeight = rangeHigh - rangeLow numOfHistograms = input(50, 'Number of histograms', minval=10, maxval=200) widestHistogramWidth = input(50, 'Width of the PoC', minval=20, maxval=100) histogramHeight = rangeHeight / numOfHistograms histogramLowList = array.new_float(numOfHistograms, na) histogramHighList = array.new_float(numOfHistograms, na) histogramPriceList = array.new_float(numOfHistograms, 0.0) histogramBuyVolumeList = array.new_float(numOfHistograms, 0.0) histogramSellVolumeList = array.new_float(numOfHistograms, 0.0) histogramVolumePercentageList = array.new_float(numOfHistograms, 0.0) // Clean up drawings every tick var buyBars = array.new_box(MAX_BARS, na) for i=0 to MAX_BARS-1 box.delete(array.get(buyBars, i)) var sellBars = array.new_box(MAX_BARS, na) for i=0 to MAX_BARS-1 box.delete(array.get(sellBars, i)) var line topLine = na line.delete(topLine) var line bottomLine = na line.delete(bottomLine) if barstate.islast // Define lows and highs of the histograms for i = 0 to numOfHistograms - 1 histogramLow = rangeLow + histogramHeight * i histogramHigh = rangeLow + histogramHeight * (i + 1) array.set(histogramLowList, i, histogramLow) array.set(histogramHighList, i, histogramHigh) array.set(histogramPriceList, i, (histogramLow + histogramHigh) / 2) // Assign bar's volumes to histograms for i = 0 to numOfBars - 1 currentBarHeight = high[i] - low[i] currentBuyVolume = iff((high[i] == low[i]), 0, volume[i] * (close[i] - low[i]) / currentBarHeight) currentSellVolume = iff((high[i] == low[i]), 0, volume[i] * (high[i] - close[i]) / currentBarHeight) // Define the percentages of the current volume to give to histograms for j = 0 to numOfHistograms - 1 histogramLow = array.get(histogramLowList, j) histogramHigh = array.get(histogramHighList, j) target = max(histogramHigh, high[i]) - min(histogramLow, low[i]) - (max(histogramHigh, high[i]) - min(histogramHigh, high[i])) - (max(histogramLow, low[i]) - min(histogramLow, low[i])) histogramVolumePercentage = target / currentBarHeight histogramBuyVolume = array.get(histogramBuyVolumeList, j) histogramSellVolume = array.get(histogramSellVolumeList, j) // If there is at least one histogram affected // then divide the current volume by the number of histograms affected if histogramVolumePercentage > 0 array.set(histogramBuyVolumeList, j, histogramBuyVolume + currentBuyVolume * histogramVolumePercentage) array.set(histogramSellVolumeList, j, histogramSellVolume + currentSellVolume * histogramVolumePercentage) // Find the histogram with the highest volume highestHistogramVolume = 0.0 for i = 0 to numOfHistograms - 1 histogramBuyVolume = array.get(histogramBuyVolumeList, i) histogramSellVolume = array.get(histogramSellVolumeList, i) histogramVolume = histogramBuyVolume + histogramSellVolume highestHistogramVolume := max(highestHistogramVolume, histogramVolume) timeUnit = time - time[1] // Draw top and bottom of the range considered topLine := line.new(time[numOfBars], rangeHigh, time_close + distLastCandle * timeUnit, rangeHigh, xloc=xloc.bar_time, color=topBottomLineColor, width = 2) bottomLine := line.new(time[numOfBars], rangeLow, time_close + distLastCandle * timeUnit, rangeLow, xloc=xloc.bar_time, color=topBottomLineColor, width = 2) // Draw histograms and highlight the Point of Control for i = 0 to numOfHistograms - 1 histogramLow = array.get(histogramLowList, i) histogramHigh = array.get(histogramHighList, i) histogramBuyVolume = array.get(histogramBuyVolumeList, i) histogramSellVolume = array.get(histogramSellVolumeList, i) histogramVolume = histogramBuyVolume + histogramSellVolume histogramWidth = widestHistogramWidth * histogramVolume / highestHistogramVolume histogramBuyWidth = floor(histogramWidth * histogramBuyVolume / histogramVolume) histogramSellWidth = floor(histogramWidth * histogramSellVolume / histogramVolume) // Draw buy and sell histograms array.set(buyBars, i, box.new(left=bar_index + distLastCandle, top=histogramHigh, right=bar_index + distLastCandle + histogramBuyWidth, bottom=histogramLow, bgcolor=buyBarColor, border_color=BORDER_COLOR)) array.set(sellBars, i, box.new(left=bar_index + distLastCandle + histogramBuyWidth, top=histogramHigh, right=bar_index + distLastCandle + histogramBuyWidth + histogramSellWidth, bottom=histogramLow, bgcolor=sellBarColor, border_color=BORDER_COLOR))
RSI Crayons
https://www.tradingview.com/script/kWNdpI26-RSI-Crayons/
animecummer
https://www.tradingview.com/u/animecummer/
43
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 indicator(title='RSI Crayons', shorttitle='RSI Crayons', overlay=true, timeframe="", timeframe_gaps=true) //INPUT almaoffset = input.float(title='ALMA Offset', defval=0.85, step=0.01, group='Special MA Settings', inline='03') almasigma = input.float(title='Sigma', defval=6, group='Special MA Settings', inline='03') a1 = input.float(title='Tillson T3 Volume Factor', defval=0.7, group='Special MA Settings', inline='5', step=0.001) f_t3(_source, _length, _a1) => _output = (-_a1 * _a1 * _a1) * (ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(_source, _length), _length), _length), _length), _length), _length)) + (3 * _a1 * _a1 + 3 * _a1 * _a1 * _a1) * (ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(_source, _length), _length), _length), _length), _length)) + (-6 * _a1 * _a1 - 3 * _a1 - 3 * _a1 * _a1 * _a1) * (ta.ema(ta.ema(ta.ema(ta.ema(_source, _length), _length), _length), _length)) + (1 + 3 * _a1 + _a1 * _a1 * _a1 + 3 * _a1 * _a1) * (ta.ema(ta.ema(ta.ema(_source, _length), _length), _length)) _output MA(source, length, type) => type == 'SMA' ? ta.sma(source, length) : type == 'EMA' ? ta.ema(source, length) : type == 'SMMA (RMA)' ? ta.rma(source, length) : type == 'WMA' ? ta.wma(source, length) : type == 'VWMA' ? ta.vwma(source, length) : type == 'ALMA' ? ta.alma(source, length, almaoffset, almasigma) : type == 'Tillson T3' ? f_t3(source, length, a1) : na //MOVING AVERAGE FUNCTION MA1_type = input.string('SMMA (RMA)', '', inline='FAST MA', options=['SMA', 'EMA', 'SMMA (RMA)', 'WMA', 'VWMA', 'ALMA', 'Tillson T3'], group='Moving Average          Source          Length') MA1_Source = input.source(close, '', inline='FAST MA', group='Moving Average          Source          Length') MA1_length = input.int(14, '', inline='FAST MA', minval=1, group='Moving Average          Source          Length') rsima = MA(MA1_Source, MA1_length, MA1_type) //COLORS dump = input.int(30, minval=1, maxval=49, title='RSI => Oversold Threshold', group='Moving Average          Source          Length', inline='15') backoversold = input.color(color.new(color.aqua, 90), 'Fill', group='Moving Average          Source          Length', inline='15') fomo = input.int(70, minval=51, title='RSI Overheated Threshold', group='Moving Average          Source          Length', inline='16') backoverheated = input.color(color.new(color.purple, 90), 'Fill', group='Moving Average          Source          Length', inline='16') colorback = input.bool(defval=true, title='Fill Background When Overheated/Oversold?', group='Moving Average          Source          Length', inline='17') plotbasis = input.bool(defval=false, title='Plot Basis?', group='Moving Average          Source          Length', inline='27') colorbasis = input.bool(defval=false, title='Color Basis With Trend?', group='Moving Average          Source          Length', inline='27') basisreg = input.color(color.blue, '', group='Moving Average          Source          Length', inline='27') //CALCS up = MA(math.max(ta.change(MA1_Source), 0), MA1_length, MA1_type) down = MA(-math.min(ta.change(MA1_Source), 0), MA1_length, MA1_type) rsival = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down) overheated = rsival >= fomo and close > open oversold = rsival <= dump and close < open var grad = array.new_color(na) if barstate.isfirst array.push(grad, #ffffff) array.push(grad, #ff00ff) array.push(grad, #ff00e8) array.push(grad, #ff00d2) array.push(grad, #ff00bd) array.push(grad, #ff00aa) array.push(grad, #ff0097) array.push(grad, #ff0086) array.push(grad, #ff2277) array.push(grad, #ff3669) array.push(grad, #ff455d) array.push(grad, #ff5252) array.push(grad, #ff594c) array.push(grad, #ff6146) array.push(grad, #ff6940) array.push(grad, #ff703a) array.push(grad, #ff7833) array.push(grad, #ff802c) array.push(grad, #ff8824) array.push(grad, #ff901b) array.push(grad, #ff9810) array.push(grad, #ffa000) array.push(grad, #ffb300) array.push(grad, #ffc500) array.push(grad, #ffd800) array.push(grad, #ffec00) array.push(grad, #ffff00) array.push(grad, #e3ff00) array.push(grad, #c3ff00) array.push(grad, #9eff00) array.push(grad, #6fff00) array.push(grad, #00ff00) array.push(grad, #00f83c) array.push(grad, #00f057) array.push(grad, #00e86a) array.push(grad, #00df79) array.push(grad, #00d686) array.push(grad, #00cd8f) array.push(grad, #00c496) array.push(grad, #00ba9a) array.push(grad, #00b09b) array.push(grad, #26a69a) array.push(grad, #00a5a6) array.push(grad, #00a3b4) array.push(grad, #00a1c4) array.push(grad, #009dd4) array.push(grad, #0099e3) array.push(grad, #0094f1) array.push(grad, #008cfa) array.push(grad, #0083ff) array.push(grad, #0077ff) rsivalfinal = math.floor(rsival / 2) //color logic fix candleup = close > open candledn = open > close colorup = math.round(math.avg(50,rsivalfinal)) colordn = math.round(math.avg(0,rsivalfinal)) //color adjustment adjustedcolor = if candleup array.get(grad, colorup) else array.get(grad, colordn) barcolor(color.new(adjustedcolor, 100 - math.floor(rsival)), title='RSI Crayons') //EXTRA BACKGROUND HIGHLIGHTING iff_8 = oversold ? backoversold : na iff_9 = overheated ? backoverheated : iff_8 bgcolor(colorback == false ? na : iff_9) basecolor = colorbasis ? array.get(grad, rsivalfinal) : basisreg p0 = plot(plotbasis ? rsima : na, title='MA Line', color=basecolor, linewidth=4) //ALERTS alertcondition(overheated != 0, 'RSI Above Overheated Threshold Value', 'RSI Above Overheated Threshold Value') alertcondition(oversold != 0, 'RSI Below Oversold Threshold Value', 'RSI Below Oversold Threshold Value')
Standard Deviations Levels
https://www.tradingview.com/script/MyIZT9WD-Standard-Deviations-Levels/
ramstox
https://www.tradingview.com/u/ramstox/
133
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ramstox //@version=5 indicator("@SD LEVELS", overlay=true) // f = input.float(defval=0, title="Volatility", minval=0, maxval=100, step=1) c = input.float(defval=0, title="Close Price", minval=0, maxval=1000000, step=1) p = input.float(defval=7, title="Period", minval=0, maxval=1000000, step=1) request.security(syminfo.tickerid, 'W', close[1]) Volatility = f/100 PERIOD = p CLOSE = c r = Volatility * (math.sqrt(PERIOD)/math.sqrt(365)) * CLOSE //Resistance hline(CLOSE+(r*0.236), title="R1", color=color.red, linestyle=hline.style_solid) hline(CLOSE+(r*0.382), title="R2", color=color.red, linestyle=hline.style_solid) hline(CLOSE+(r*0.5), title="R3", color=color.red, linestyle=hline.style_solid) hline(CLOSE+(r*0.618), title="R4", color=color.red, linestyle=hline.style_solid) hline(CLOSE+(r*0.786), title="R5", color=color.red, linestyle=hline.style_solid) hline(CLOSE+(r*1), title="R6", color=color.red, linestyle=hline.style_solid) hline(CLOSE+(r*1.236), title="R7", color=color.red, linestyle=hline.style_solid) hline(CLOSE+(r*1.382), title="R8", color=color.red, linestyle=hline.style_solid) hline(CLOSE+(r*1.5), title="R9", color=color.red, linestyle=hline.style_solid) // //Support hline(CLOSE-(r*0.236), title="S1", color=color.green, linestyle=hline.style_solid) hline(CLOSE-(r*0.382), title="S2", color=color.green, linestyle=hline.style_solid) hline(CLOSE-(r*0.5), title="S3", color=color.green, linestyle=hline.style_solid) hline(CLOSE-(r*0.618), title="S4", color=color.green, linestyle=hline.style_solid) hline(CLOSE-(r*0.786), title="S5", color=color.green, linestyle=hline.style_solid) hline(CLOSE-(r*1), title="S6", color=color.green, linestyle=hline.style_solid) // //for i=0 to 7 //sq = math.round(math.sqrt(CLOSE),0) //Label for horizontal line // myLabel = label.new(x=bar_index, y=high, // color=color.orange, textcolor=color.orange, // style=label.style_none) // label.set_text(id=myLabel, text="("+ str.tostring(math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(45.0/180.0),2),0))+")") // label.set_xy(myLabel,bar_index[0]+5,math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(45.0/180.0),2),0)) // label.delete(myLabel[1]) //GANN LEVELS // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(45.0/180.0),2),0), title="GR1", color=color.purple, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(90.0/180.0),2),0), title="GR2", color=color.purple, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(135.0/180.0),2),0), title="GR3", color=color.purple, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(180.0/180.0),2),0), title="GR4", color=color.purple, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(225.0/180.0),2),0), title="GR5", color=color.purple, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(270.0/180.0),2),0), title="GR6", color=color.purple, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(315.0/180.0),2),0), title="GR7", color=color.purple, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)+(360.0/180.0),2),0), title="GR8", color=color.purple, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)-(45.0/180.0),2),0), title="GS1", color=color.orange, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)-(90.0/180.0),2),0), title="GS2", color=color.orange, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)-(135.0/180.0),2),0), title="GS3", color=color.orange, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)-(180.0/180.0),2),0), title="GS4", color=color.orange, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)-(225.0/180.0),2),0), title="GS5", color=color.orange, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)-(270.0/180.0),2),0), title="GS6", color=color.orange, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)-(315.0/180.0),2),0), title="GS7", color=color.orange, linestyle=hline.style_solid) // hline(math.round(math.pow(math.round(math.sqrt(CLOSE),0)-(360.0/180.0),2),0), title="GS8", color=color.orange, linestyle=hline.style_solid) plot(close,display = display.none)
TradingGroundhog - Fundamental Analysis - Multiple RSI Ema
https://www.tradingview.com/script/tHQlRHpX/
UnknownUnicorn27666852
https://www.tradingview.com/u/UnknownUnicorn27666852/
42
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TradingGroundhog //@version=5 indicator("TradingGroundhog - Fundamental Analysis - Multiple RSI Ema", overlay = false) // Price ID_1 = input.symbol(title='USDT Market', defval='BINANCE:EURUSDT', group='Basic Settings') ID_2 = input.symbol(title='BUSD Market', defval='BINANCE:EURBUSD', group='Basic Settings') ID_3 = input.symbol(title='SHIB Market', defval='BINANCE:SHIBEUR', group='Basic Settings') ID_4 = input.symbol(title='SOL Market', defval='BINANCE:SOLEUR', group='Basic Settings') ID_5 = input.symbol(title='DOT Market', defval='BINANCE:DOTEUR', group='Basic Settings') ID_6 = input.symbol(title='BTC Market', defval='BINANCE:BTCEUR', group='Basic Settings') ID_7 = input.symbol(title='XRP Market', defval='BINANCE:XRPEUR', group='Basic Settings') ID_8 = input.symbol(title='ETH Market', defval='BINANCE:ETHEUR', group='Basic Settings') ID_9 = input.symbol(title='ADA Market', defval='BINANCE:ADAEUR', group='Basic Settings') ID_10 = input.symbol(title='LUNA Market', defval='BINANCE:LUNAEUR', group='Basic Settings') ID_11 = input.symbol(title='AVAX Market', defval='BINANCE:AVAXEUR', group='Basic Settings') ID_12 = input.symbol(title='VET Market', defval='BINANCE:VETEUR', group='Basic Settings') ID_13 = input.symbol(title='BNB Market', defval='BINANCE:BNBEUR', group='Basic Settings') ID_14 = input.symbol(title='DOGE Market', defval='BINANCE:DOGEEUR', group='Basic Settings') ID_15 = input.symbol(title='EGLD Market', defval='BINANCE:EGLDEUR', group='Basic Settings') ID_16 = input.symbol(title='GRT Market', defval='BINANCE:GRTEUR', group='Basic Settings') ID_17 = input.symbol(title='MATIC Market', defval='BINANCE:MATICEUR',group='Basic Settings') ID_18 = input.symbol(title='HOT Market', defval='BINANCE:HOTEUR', group='Basic Settings') ID_19 = input.symbol(title='LINK Market', defval='BINANCE:LINKEUR', group='Basic Settings') ID_20 = input.symbol(title='ICP Market', defval='BINANCE:ICPEUR', group='Basic Settings') // Plot Settings int Decreasing_shade = input.int(85, 'Decreasing RSI Transparence', group='Plot Settings') int RSI_filter_min = input.int(10, 'RSI Limitation', group='Plot Settings') int hhigh_RSI = input.int(60, 'High D RSI', group='Plot Settings') int mid_RSI = input.int(55, 'Avarage RSI', group='Plot Settings') int hlow_RSI = input.int(50, 'Low RSI', group='Plot Settings') // RSI Settings Source_Market = input(title="Source_Market", defval=close, group='Advance Settings') int RSI_Ema_Input = input.int(22, 'RSI EMA Length', group='Advance Settings') int RSI_Input = input.int(14, 'RSI Length', group='Advance Settings') int Max = 100 int Min = 0 I_1 = request.security(ID_1 , timeframe=timeframe.period, expression=Source_Market) I_2 = request.security(ID_2 , timeframe=timeframe.period, expression=Source_Market) I_3 = request.security(ID_3 , timeframe=timeframe.period, expression=Source_Market) I_4 = request.security(ID_4 , timeframe=timeframe.period, expression=Source_Market) I_5 = request.security(ID_5 , timeframe=timeframe.period, expression=Source_Market) I_6 = request.security(ID_6 , timeframe=timeframe.period, expression=Source_Market) I_7 = request.security(ID_7 , timeframe=timeframe.period, expression=Source_Market) I_8 = request.security(ID_8 , timeframe=timeframe.period, expression=Source_Market) I_9 = request.security(ID_9 , timeframe=timeframe.period, expression=Source_Market) I_10 = request.security(ID_10, timeframe=timeframe.period, expression=Source_Market) I_11 = request.security(ID_11, timeframe=timeframe.period, expression=Source_Market) I_12 = request.security(ID_12, timeframe=timeframe.period, expression=Source_Market) I_13 = request.security(ID_13, timeframe=timeframe.period, expression=Source_Market) I_14 = request.security(ID_14, timeframe=timeframe.period, expression=Source_Market) I_15 = request.security(ID_15, timeframe=timeframe.period, expression=Source_Market) I_16 = request.security(ID_16, timeframe=timeframe.period, expression=Source_Market) I_17 = request.security(ID_17, timeframe=timeframe.period, expression=Source_Market) I_18 = request.security(ID_18, timeframe=timeframe.period, expression=Source_Market) I_19 = request.security(ID_19, timeframe=timeframe.period, expression=Source_Market) I_20 = request.security(ID_20, timeframe=timeframe.period, expression=Source_Market) // Draw line MAX_rsi = hline(Max, title='Max', linewidth=2) HIGH_rsi= hline(hhigh_RSI, title='High', linewidth=2) MID_rsi = hline(mid_RSI, title='Mid', linewidth=2) LOW_rsi = hline(hlow_RSI, title='Low', linewidth=2) MIN_rsi = hline(Min, title='Min', linewidth=2) fill(HIGH_rsi, MAX_rsi, color=color.rgb(152, 255, 152,80)) fill(MID_rsi, HIGH_rsi, color=color.rgb(208, 240, 192,80)) fill(LOW_rsi, MID_rsi, color=color.rgb(253, 188, 180,80)) fill(MIN_rsi, LOW_rsi, color=color.rgb(255, 153, 153,80)) // RSI RSI_1 = ta.rsi(I_1 ,RSI_Input) RSI_2 = ta.rsi(I_2 ,RSI_Input) RSI_3 = ta.rsi(I_3 ,RSI_Input) RSI_4 = ta.rsi(I_4 ,RSI_Input) RSI_5 = ta.rsi(I_5 ,RSI_Input) RSI_6 = ta.rsi(I_6 ,RSI_Input) RSI_7 = ta.rsi(I_7 ,RSI_Input) RSI_8 = ta.rsi(I_8 ,RSI_Input) RSI_9 = ta.rsi(I_9 ,RSI_Input) RSI_10 = ta.rsi(I_10,RSI_Input) RSI_11 = ta.rsi(I_11,RSI_Input) RSI_12 = ta.rsi(I_12,RSI_Input) RSI_13 = ta.rsi(I_13,RSI_Input) RSI_14 = ta.rsi(I_14,RSI_Input) RSI_15 = ta.rsi(I_15,RSI_Input) RSI_16 = ta.rsi(I_16,RSI_Input) RSI_17 = ta.rsi(I_17,RSI_Input) RSI_18 = ta.rsi(I_18,RSI_Input) RSI_19 = ta.rsi(I_19,RSI_Input) RSI_20 = ta.rsi(I_20,RSI_Input) // Ema_RSI RSI_Ema_1 = ta.ema(RSI_1 ,RSI_Ema_Input) RSI_Ema_2 = ta.ema(RSI_2 ,RSI_Ema_Input) RSI_Ema_3 = ta.ema(RSI_3 ,RSI_Ema_Input) RSI_Ema_4 = ta.ema(RSI_4 ,RSI_Ema_Input) RSI_Ema_5 = ta.ema(RSI_5 ,RSI_Ema_Input) RSI_Ema_6 = ta.ema(RSI_6 ,RSI_Ema_Input) RSI_Ema_7 = ta.ema(RSI_7 ,RSI_Ema_Input) RSI_Ema_8 = ta.ema(RSI_8 ,RSI_Ema_Input) RSI_Ema_9 = ta.ema(RSI_9 ,RSI_Ema_Input) RSI_Ema_10 = ta.ema(RSI_10,RSI_Ema_Input) RSI_Ema_11 = ta.ema(RSI_11,RSI_Ema_Input) RSI_Ema_12 = ta.ema(RSI_12,RSI_Ema_Input) RSI_Ema_13 = ta.ema(RSI_13,RSI_Ema_Input) RSI_Ema_14 = ta.ema(RSI_14,RSI_Ema_Input) RSI_Ema_15 = ta.ema(RSI_15,RSI_Ema_Input) RSI_Ema_16 = ta.ema(RSI_16,RSI_Ema_Input) RSI_Ema_17 = ta.ema(RSI_17,RSI_Ema_Input) RSI_Ema_18 = ta.ema(RSI_18,RSI_Ema_Input) RSI_Ema_19 = ta.ema(RSI_19,RSI_Ema_Input) RSI_Ema_20 = ta.ema(RSI_20,RSI_Ema_Input) // Label Var var L_1 = label.new(bar_index, I_1 , ID_1 , style=label.style_label_lower_left, color =color.rgb(239, 154, 154), size=size.small) var L_2 = label.new(bar_index, I_2 , ID_2 , style=label.style_label_lower_left, color =color.rgb(244, 143, 177), size=size.small) var L_3 = label.new(bar_index, I_3 , ID_3 , style=label.style_label_lower_left, color =color.rgb(206, 147, 216), size=size.small) var L_4 = label.new(bar_index, I_4 , ID_4 , style=label.style_label_lower_left, color =color.rgb(179, 157, 219) , size=size.small) var L_5 = label.new(bar_index, I_5 , ID_5 , style=label.style_label_lower_left, color =color.rgb(159, 168, 218) , size=size.small) var L_6 = label.new(bar_index, I_6 , ID_6 , style=label.style_label_lower_left, color =color.rgb(144, 202, 249) , size=size.small) var L_7 = label.new(bar_index, I_7 , ID_7 , style=label.style_label_lower_left, color =color.rgb(129, 212, 250), size=size.small) var L_8 = label.new(bar_index, I_8 , ID_8 , style=label.style_label_lower_left, color =color.rgb(128, 222, 234), size=size.small) var L_9 = label.new(bar_index, I_9 , ID_9 , style=label.style_label_lower_left, color =color.rgb(128, 203, 196), size=size.small) var L_10 = label.new(bar_index, I_10, ID_10, style=label.style_label_lower_left,color = color.rgb(165, 214, 167), size=size.small) var L_11 = label.new(bar_index, I_11, ID_11, style=label.style_label_lower_left,color = color.rgb(197, 225, 165), size=size.small) var L_12 = label.new(bar_index, I_12, ID_12, style=label.style_label_lower_left,color = color.rgb(230, 238, 156) , size=size.small) var L_13 = label.new(bar_index, I_13, ID_13, style=label.style_label_lower_left,color = color.rgb(255, 245, 157), size=size.small) var L_14 = label.new(bar_index, I_14, ID_14, style=label.style_label_lower_left,color = color.rgb(255, 224, 130), size=size.small) var L_15 = label.new(bar_index, I_15, ID_15, style=label.style_label_lower_left,color = color.rgb(255, 204, 128), size=size.small) var L_16 = label.new(bar_index, I_16, ID_16, style=label.style_label_lower_left,color = color.rgb(255, 171, 145) , size=size.small) var L_17 = label.new(bar_index, I_17, ID_17, style=label.style_label_lower_left,color = color.rgb(188, 170, 164) , size=size.small) var L_18 = label.new(bar_index, I_18, ID_18, style=label.style_label_lower_left,color = color.rgb(238, 238, 238) , size=size.small) var L_19 = label.new(bar_index, I_19, ID_19, style=label.style_label_lower_left,color = color.rgb(176, 190, 197) , size=size.small) var L_20 = label.new(bar_index, I_20, ID_20, style=label.style_label_lower_left,color = color.rgb(117, 117, 117), size=size.small) // Label Location if RSI_filter_min <= RSI_Ema_1 label.set_xy(L_1 , bar_index, RSI_Ema_1 ) if RSI_filter_min <= RSI_Ema_2 label.set_xy(L_2 , bar_index, RSI_Ema_2 ) if RSI_filter_min <= RSI_Ema_3 label.set_xy(L_3 , bar_index, RSI_Ema_3 ) if RSI_filter_min <= RSI_Ema_4 label.set_xy(L_4 , bar_index, RSI_Ema_4 ) if RSI_filter_min <= RSI_Ema_5 label.set_xy(L_5 , bar_index, RSI_Ema_5 ) if RSI_filter_min <= RSI_Ema_6 label.set_xy(L_6 , bar_index, RSI_Ema_6 ) if RSI_filter_min <= RSI_Ema_7 label.set_xy(L_7 , bar_index, RSI_Ema_7 ) if RSI_filter_min <= RSI_Ema_8 label.set_xy(L_8 , bar_index, RSI_Ema_8 ) if RSI_filter_min <= RSI_Ema_9 label.set_xy(L_9 , bar_index, RSI_Ema_9 ) if RSI_filter_min <= RSI_Ema_10 label.set_xy(L_10, bar_index, RSI_Ema_10) if RSI_filter_min <= RSI_Ema_11 label.set_xy(L_11, bar_index, RSI_Ema_11) if RSI_filter_min <= RSI_Ema_12 label.set_xy(L_12, bar_index, RSI_Ema_12) if RSI_filter_min <= RSI_Ema_13 label.set_xy(L_13, bar_index, RSI_Ema_13) if RSI_filter_min <= RSI_Ema_14 label.set_xy(L_14, bar_index, RSI_Ema_14) if RSI_filter_min <= RSI_Ema_15 label.set_xy(L_15, bar_index, RSI_Ema_15) if RSI_filter_min <= RSI_Ema_16 label.set_xy(L_16, bar_index, RSI_Ema_16) if RSI_filter_min <= RSI_Ema_17 label.set_xy(L_17, bar_index, RSI_Ema_17) if RSI_filter_min <= RSI_Ema_18 label.set_xy(L_18, bar_index, RSI_Ema_18) if RSI_filter_min <= RSI_Ema_19 label.set_xy(L_19, bar_index, RSI_Ema_19) if RSI_filter_min <= RSI_Ema_20 label.set_xy(L_20, bar_index, RSI_Ema_20) // Plot RSI plot(RSI_Ema_1, linewidth= 2 ,color=RSI_Ema_1 > RSI_Ema_1[1] ? color.rgb(239, 154, 154, RSI_filter_min <= RSI_Ema_1 ? 0:100):color.rgb(239, 154, 154, RSI_filter_min <= RSI_Ema_1 ? Decreasing_shade:100)) plot(RSI_Ema_2, linewidth= 2 ,color=RSI_Ema_2 > RSI_Ema_2[1] ? color.rgb(244, 143, 177, RSI_filter_min <= RSI_Ema_2 ? 0:100) :color.rgb(244, 143, 177, RSI_filter_min <= RSI_Ema_2 ? Decreasing_shade:100)) plot(RSI_Ema_3, linewidth= 2 ,color=RSI_Ema_3 > RSI_Ema_3[1] ? color.rgb(206, 147, 216, RSI_filter_min <= RSI_Ema_3 ? 0:100) :color.rgb(206, 147, 216, RSI_filter_min <= RSI_Ema_3 ? Decreasing_shade:100)) plot(RSI_Ema_4, linewidth= 2 ,color=RSI_Ema_4 > RSI_Ema_4[1] ? color.rgb(179, 157, 219, RSI_filter_min <= RSI_Ema_4 ? 0:100):color.rgb(179, 157, 219, RSI_filter_min <= RSI_Ema_4 ? Decreasing_shade:100)) plot(RSI_Ema_5, linewidth= 2 ,color=RSI_Ema_5 > RSI_Ema_5[1] ? color.rgb(159, 168, 218, RSI_filter_min <= RSI_Ema_5 ? 0:100) :color.rgb(159, 168, 218, RSI_filter_min <= RSI_Ema_5 ? Decreasing_shade:100)) plot(RSI_Ema_6, linewidth= 2 ,color=RSI_Ema_6 > RSI_Ema_6[1] ? color.rgb(144, 202, 249, RSI_filter_min <= RSI_Ema_6 ? 0:100):color.rgb(144, 202, 249, RSI_filter_min <= RSI_Ema_6 ? Decreasing_shade:100)) plot(RSI_Ema_7, linewidth= 2 ,color=RSI_Ema_7 > RSI_Ema_7[1] ? color.rgb(129, 212, 250, RSI_filter_min <= RSI_Ema_7 ? 0:100) :color.rgb(129, 212, 250, RSI_filter_min <= RSI_Ema_7 ? Decreasing_shade:100)) plot(RSI_Ema_8, linewidth= 2 ,color=RSI_Ema_8 > RSI_Ema_8[1] ? color.rgb(128, 222, 234, RSI_filter_min <= RSI_Ema_8 ? 0:100) :color.rgb(128, 222, 234, RSI_filter_min <= RSI_Ema_8 ? Decreasing_shade:100)) plot(RSI_Ema_9, linewidth= 2 ,color=RSI_Ema_9 > RSI_Ema_9[1] ? color.rgb(128, 203, 196, RSI_filter_min <= RSI_Ema_9 ? 0:100) :color.rgb(128, 203, 196, RSI_filter_min <= RSI_Ema_9 ? Decreasing_shade:100)) plot(RSI_Ema_10, linewidth=2 ,color=RSI_Ema_10 > RSI_Ema_10[1] ? color.rgb(165, 214, 167, RSI_filter_min <= RSI_Ema_10 ?0:100) :color.rgb(165, 214, 167, RSI_filter_min <= RSI_Ema_10? Decreasing_shade:100)) plot(RSI_Ema_11, linewidth=2 ,color=RSI_Ema_11 > RSI_Ema_11[1] ? color.rgb(197, 225, 165, RSI_filter_min <= RSI_Ema_11? 0:100) :color.rgb(197, 225, 165, RSI_filter_min <= RSI_Ema_11? Decreasing_shade:100)) plot(RSI_Ema_12, linewidth=2 ,color=RSI_Ema_12 > RSI_Ema_12[1] ? color.rgb(230, 238, 156, RSI_filter_min <= RSI_Ema_12? 0:100) :color.rgb(230, 238, 156, RSI_filter_min <= RSI_Ema_12? Decreasing_shade:100)) plot(RSI_Ema_13, linewidth=2 ,color=RSI_Ema_13 > RSI_Ema_13[1] ? color.rgb(255, 245, 157, RSI_filter_min <= RSI_Ema_13? 0:100) :color.rgb(255, 245, 157, RSI_filter_min <= RSI_Ema_13? Decreasing_shade:100)) plot(RSI_Ema_14, linewidth=2 ,color=RSI_Ema_14 > RSI_Ema_14[1] ? color.rgb(255, 224, 130, RSI_filter_min <= RSI_Ema_14? 0:100) :color.rgb(255, 224, 130, RSI_filter_min <= RSI_Ema_14? Decreasing_shade:100)) plot(RSI_Ema_15, linewidth=2 ,color=RSI_Ema_15 > RSI_Ema_15[1] ? color.rgb(255, 204, 128, RSI_filter_min <= RSI_Ema_15? 0:100) :color.rgb(255, 204, 128, RSI_filter_min <= RSI_Ema_15? Decreasing_shade:100)) plot(RSI_Ema_16, linewidth=2 ,color=RSI_Ema_16 > RSI_Ema_16[1] ? color.rgb(255, 171, 145, RSI_filter_min <= RSI_Ema_16? 0:100) :color.rgb(255, 171, 145, RSI_filter_min <= RSI_Ema_16? Decreasing_shade:100)) plot(RSI_Ema_17, linewidth=2 ,color=RSI_Ema_17 > RSI_Ema_17[1] ? color.rgb(188, 170, 164, RSI_filter_min <= RSI_Ema_17? 0:100) :color.rgb(188, 170, 164, RSI_filter_min <= RSI_Ema_17? Decreasing_shade:100)) plot(RSI_Ema_18, linewidth=2 ,color=RSI_Ema_18 > RSI_Ema_18[1] ? color.rgb(238, 238, 238, RSI_filter_min <= RSI_Ema_18? 0:100) :color.rgb(238, 238, 238, RSI_filter_min <= RSI_Ema_18? Decreasing_shade:100)) plot(RSI_Ema_19, linewidth=2 ,color=RSI_Ema_19 > RSI_Ema_19[1] ? color.rgb(176, 190, 197, RSI_filter_min <= RSI_Ema_19? 0:100) :color.rgb(176, 190, 197, RSI_filter_min <= RSI_Ema_19? Decreasing_shade:100)) plot(RSI_Ema_20, linewidth=2 ,color=RSI_Ema_20 > RSI_Ema_20[1] ? color.rgb(117, 117, 117, RSI_filter_min <= RSI_Ema_20? 0:100) :color.rgb(117, 117, 117, RSI_filter_min <= RSI_Ema_20? Decreasing_shade:100))
ATRSLTP
https://www.tradingview.com/script/W2drIC9a-ATRSLTP/
samoke
https://www.tradingview.com/u/samoke/
9
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © samoke //@version=4 //study("Benim Komutum") study(title="ATRSLTP", shorttitle="ATRSLTP", overlay=true) lengthATR = input(title="Length", defval=14, minval=1) multiplierATR = input(1.5, minval=1, title="multiplierATR") multiplierATR2 = input(2.5, minval=1, title="multiplierATR2") sourceATR = input(close, title="sourceATR") smoothingATR = input(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"]) ma_function(source, lengthATR) => if smoothingATR == "RMA" rma(source, lengthATR) else if smoothingATR == "SMA" sma(source, lengthATR) else if smoothingATR == "EMA" ema(source, lengthATR) else wma(source, lengthATR) plot(rma(sourceATR, 1)-multiplierATR*ma_function(tr(true), lengthATR),"ATR",color=color.red,trackprice=true) plot(rma(sourceATR, 1)-multiplierATR2*ma_function(tr(true), lengthATR),"ATR2",color=color.red,trackprice=true) plot(rma(sourceATR, 1)+5*ma_function(tr(true), lengthATR),"TargetATR",color=color.green,trackprice=true)
MAD indicator Enchanced (MADH, inspired by J.Ehlers)
https://www.tradingview.com/script/cA7tip1s-MAD-indicator-Enchanced-MADH-inspired-by-J-Ehlers/
vsov
https://www.tradingview.com/u/vsov/
48
study
5
MPL-2.0
// This source code is not the subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © vsov //@version=5 FIR(_src, _len) => float fir = 0.0 float coef = 0.0 for count=1 to _len-1 c = (1 - math.cos(2*math.pi*count / (_len +1))) coef:=coef+c fir:=fir+c*_src[count-1] if coef != 0 fir := fir / coef fir indicator("MAD indicator Enchanced (inspired by J.Ehlers)", shorttitle="MADH") slen = input(8, title="Short length") dc = input(27, title="Dom Cycle Length") llen = math.avg(slen, dc) src_ = input(close, title="Source") pvtp = input(true, title="PVT?") src = pvtp ? ta.cum(fixnan(10000 * ta.change(hl2) * (high - low) / volume)) : src_ sfir = FIR(src, slen) lfir = FIR(src, llen) MADH = lfir !=0 ? 100*(sfir-lfir)/lfir : 0.0 ROC = (slen /4*math.pi) * ta.change(MADH) hline(0.0, color=color.gray) plot(MADH, color=MADH>0 and ROC>0 ?color.green: MADH < 0 and ROC <0 ? color.red : MADH >0 and ROC <0 ? color.maroon : MADH <0 and ROC >0 ? color.teal : color.gray, style=plot.style_histogram, linewidth=3) plot(ROC, color=color.orange)
[Mad] L4 Entryboxes
https://www.tradingview.com/script/jRvhWS7X-Mad-L4-Entryboxes/
djmad
https://www.tradingview.com/u/djmad/
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/ // © djmad //@version=5 indicator("[Mad] L4 Entryboxes", overlay = true) int OFFSET = input.int(10,"OFFSET TIME")*1000000 bool Shortbox_2_Active = input.bool(true,"Shortbox 2 Active") int Shortbox_2_Time_L = input.time(timestamp("2020-02-20"), "Shortbox 2 Left", inline="Short_2_Left_Top", confirm = true)+OFFSET float Shortbox_2_Price_T = input.price(100, "Shortbox 1 Top", inline="Short_2_Left_Top", confirm=true) int Shortbox_2_Time_R = input.time(timestamp("2020-02-19"), "Shortbox 2 Right", inline="Short_2_Right_Bottom", confirm = true)+OFFSET float Shortbox_2_Price_B = input.price(100, "Shortbox 2 Bottom", inline="Short_2_Right_Bottom", confirm=true) bool Shortbox_1_Active = input.bool(true,"Shortbox 1 Active") int Shortbox_1_Time_L = input.time(timestamp("2020-02-20"), "Shortbox 1 Left", inline="Short_1_Left_Top", confirm = true)+OFFSET float Shortbox_1_Price_T = input.price(100, "Shortbox 1 Top", inline="Short_1_Left_Top", confirm=true) int Shortbox_1_Time_R = input.time(timestamp("2020-02-19"), "Shortbox 1 Right", inline="Short_1_Right_Bottom", confirm = true)+OFFSET float Shortbox_1_Price_B = input.price(100, "Shortbox 1 Bottom", inline="Short_1_Right_Bottom", confirm=true) bool Longbox_1_Active = input.bool(true,"Longbox 1 Active") int Longbox_1_Time_L = input.time(timestamp("2020-02-20"), "Longbox 1 Left", inline="Long_1_Left_Top", confirm = true)+OFFSET float Longbox_1_Price_T = input.price(100, "Longbox 1 Top", inline="Long_1_Left_Top", confirm=true) int Longbox_1_Time_R = input.time(timestamp("2020-02-19"), "Longbox 1 Right", inline="Long_1_Right_Bottom", confirm = true)+OFFSET float Longbox_1_Price_B = input.price(100, "Longbox 1 Bottom", inline="Long_1_Right_Bottom", confirm=true) bool Longbox_2_Active = input.bool(true,"Longbox 2 Active") int Longbox_2_Time_L = input.time(timestamp("2020-02-20"), "Longbox 2 Left", inline="Long_2_Left_Top", confirm = true)+OFFSET float Longbox_2_Price_T = input.price(100, "Longbox 1 Top", inline="Long_2_Left_Top", confirm=true) int Longbox_2_Time_R = input.time(timestamp("2020-02-19"), "Longbox 2 Right", inline="Long_2_Right_Bottom", confirm = true)+OFFSET float Longbox_2_Price_B = input.price(100, "Longbox 2 Bottom", inline="Long_2_Right_Bottom", confirm=true) int transparency = input.int(50, "Transparency of Boxes", minval = 0, maxval = 100) f_drawbox(Left, Top, Right, Bottom, Color_given,src,src2) => Box1 = box.new(Left,Top,Right,Bottom, xloc=xloc.bar_time, border_style=line.style_dashed, border_width=2, bgcolor=src>Bottom and src<Top and src2>Left and src2<Right?color.new(color.yellow,transparency):Color_given ,border_color=(Left>Right) or (Bottom>Top)?color.yellow:na) box.delete(Box1[1]) f_drawtext(Left, Top, Right, Bottom, Text1,src,src2) => Label1 = label.new(Left, Top, text=Text1, xloc=xloc.bar_time, style=label.style_xcross, textcolor=color.yellow) label.delete(Label1[1]) f_filtersignal(Left, Top, Right, Bottom, src,src2) => Filter = (src>Bottom and src<Top and src2>Left and src2<Right)?true:false f_drawbox(Longbox_1_Time_L,Longbox_1_Price_T,Longbox_1_Time_R,Longbox_1_Price_B,color.new(color.green,transparency),close,time) f_drawtext(Longbox_1_Time_L,Longbox_1_Price_T,Longbox_1_Time_R,Longbox_1_Price_B,"Longbox 1",close,time) f_drawbox(Longbox_2_Time_L,Longbox_2_Price_T,Longbox_2_Time_R,Longbox_2_Price_B,color.new(color.green,transparency),close,time) f_drawtext(Longbox_2_Time_L,Longbox_2_Price_T,Longbox_2_Time_R,Longbox_2_Price_B,"Longbox 2",close,time) f_drawbox(Shortbox_1_Time_L,Shortbox_1_Price_T,Shortbox_1_Time_R,Shortbox_1_Price_B,color.new(color.red,transparency),close,time) f_drawtext(Shortbox_1_Time_L,Shortbox_1_Price_T,Shortbox_1_Time_R,Shortbox_1_Price_B,"Shortbox1",close,time) f_drawbox(Shortbox_2_Time_L,Shortbox_2_Price_T,Shortbox_2_Time_R,Shortbox_2_Price_B,color.new(color.red,transparency),close,time) f_drawtext(Shortbox_2_Time_L,Shortbox_2_Price_T,Shortbox_2_Time_R,Shortbox_2_Price_B,"Shortbox2",close,time) Long_1_enabled = Longbox_1_Active ? f_filtersignal(Longbox_1_Time_L,Longbox_1_Price_T,Longbox_1_Time_R,Longbox_1_Price_B,close,time):false Long_2_enabled = Longbox_2_Active ? f_filtersignal(Longbox_2_Time_L,Longbox_2_Price_T,Longbox_2_Time_R,Longbox_2_Price_B,close,time):false Short_1_enabled = Shortbox_1_Active ? f_filtersignal(Shortbox_1_Time_L,Shortbox_1_Price_T,Shortbox_1_Time_R,Shortbox_1_Price_B,close,time):false Short_2_enabled = Shortbox_2_Active ? f_filtersignal(Shortbox_2_Time_L,Shortbox_2_Price_T,Shortbox_2_Time_R,Shortbox_2_Price_B,close,time):false var bool outputSignal_long = na var bool outputSignal_short = na if (Long_1_enabled or Long_2_enabled) outputSignal_long := true else outputSignal_long := false if (Short_1_enabled or Short_2_enabled) outputSignal_short := true else outputSignal_short := false // SIGNAL Daisychain { string inputtype = input.string("NoInput" , title="Signal Type", group='Multibit signal config', options=["MultiBit", "MultiBit_pass", "NoInput"], tooltip='Multibit Daisychain with and without infusing\nMutlibit is the Signal-Type used in my Backtestsystem',inline='3a') float inputModule = input(title='Select L1 Indicator Signal', group='Multibit signal config', defval=close, inline='3a') Signal_Channel_Line1= input.int(-1, "L1 long channel", minval=-1, maxval=15,group='Multibit',inline='1a') Signal_Channel_Line2= input.int(-1, "L1 short channel", minval=-1, maxval=15,group='Multibit',inline='1a') //*********** Simplesignal Implementation signalout = 0 signalout := outputSignal_long ? 1 : outputSignal_short ? -1 : 0 BM_color_signal = outputSignal_long ? #4C9900 : outputSignal_short ? #CC0000 : color.black L_digital_signal = plot(signalout, title='Digitalsignal', color=BM_color_signal, style=plot.style_columns, display=display.none) //*********** MULTIBIT Implementation import djmad/Signal_transcoder_library/7 as transcode bool [] Multibit = array.new<bool>(16,false) if inputtype == "MultiBit" or inputtype == "MultiBit_pass" Multibit := transcode._16bit_decode(inputModule) if inputtype != "MultiBit_pass" transcode.f_infuse_signal(Signal_Channel_Line1, outputSignal_long, Signal_Channel_Line2, outputSignal_short, Multibit) float plot_output = transcode._16bit_encode(Multibit) plot(plot_output,title='MultiBit Signal',display=display.none) //}
Rebalance Oscillator
https://www.tradingview.com/script/5vN6zG9h-Rebalance-Oscillator/
hugodanielcom
https://www.tradingview.com/u/hugodanielcom/
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/ // © hugodanielcom //@version=5 import hugodanielcom/TradingPortfolio/1 as portfolio import hugodanielcom/PureRebalance/3 as rebalancer indicator("Rebalance Locations") float percentage = input.float(defval = 60, title = "Rebalance Token %", minval = 0.01, maxval = 100.0, tooltip="Percentage of Token / Money.\n60 means the targeted balance is 60% token and 40% money") float capital = input.float(defval = 10000, title = "Initial capital", minval = 1, tooltip="The total portfolio value to start with. A higher value makes the rebalancer more sensitive to peaks/bottoms and act more often") float precision = input.float(defval = 10, title = "Action Threshold", tooltip="Bigger values make the rebalance hold more and become less sensitive to peaks/bottoms and act less often.") int from_month = input.int(defval = 10, title = "From Month", minval = 1, maxval = 12) int from_day = input.int(defval = 1, title = "From Day", minval = 1, maxval = 31) int from_year = input.int(defval = 2021, title = "From Year", minval = 2000) bool show_date = input.bool(defval = true, title = "Show Date Range") // Backtest start window start = timestamp(from_year, from_month, from_day) // Function returns true when the current bar time is // "within the window of time" for this indicator window() => time >= start var float[] portfolio = portfolio.init() // Initialization starts by doing a rebalance at the first bar within // the window var bool init1 = true if window() and init1 // Only do this once, for the first bar, set init1 to false to disallow // this block from running again init1 := false first_rebalance_amount = rebalancer.rebalance(close, 0.0, capital, percentage / 100.0) portfolio.set_balance(portfolio, first_rebalance_amount, capital - (first_rebalance_amount * close)) // This is where the rebalance gets done float amount = rebalancer.rebalance(close, portfolio.crypto(portfolio), portfolio.fiat(portfolio), percentage / 100) // Adjust the precision to the current token value, // This way the amount to rebalance is adjusted to be meaningful in very high // value tokens, or very low value tokens float token_adjustment = 2000 / (capital / close) bool is_rebalance_buying = amount * token_adjustment > precision bool is_rebalance_selling = amount * token_adjustment < -precision // Update the rebalance portfolio, this will allow it to work properly in // the next bar if window() if is_rebalance_buying portfolio.buy(portfolio, amount, close) if is_rebalance_selling portfolio.sell(portfolio, math.abs(amount), close) // Paint the bg color if this bar is within the window and the amount to // rebalance fits within the precision color rebalance_buy_color = color.new(color.blue, 70) color rebalance_sell_color = color.new(color.red, 70) bgcolor(window() and is_rebalance_buying ? rebalance_buy_color : na, title="Buy Bar") bgcolor(window() and is_rebalance_selling ? rebalance_sell_color : na, title="Sell Bar") // Plot the signal plot(-amount * token_adjustment, "Signal", color=color.teal) // Plot the precision bands band1 = hline(precision, "Upper Band", color=#787B86) bandm = hline(0, "Middle Band", color=color.new(#787B86, 50)) band0 = hline(-precision, "Lower Band", color=#787B86) fill(band1, band0, color=color.rgb(126, 87, 194, 90), title="Background")
Volume Trends
https://www.tradingview.com/script/AoZNJ5x7-Volume-Trends/
imbes2
https://www.tradingview.com/u/imbes2/
197
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/ // © imbes //@version=4 study(title="Volume Trends", shorttitle="VolTrends", resolution="", precision=3) barcolor=input(type=input.bool, title="Match Candle and Bar Color?", defval=false) ltfL=input(type=input.integer, title="Long Time Frame Length", defval=100) stfL=input(type=input.integer, title="Short Time Frame Length", defval=12) voldevthresh=input(type=input.float, title="Volume Deviation Threshold", defval=1.00, tooltip ="Deviation threshold against the long time frame volume average to plot a volume bar") ltfvol=sma(volume, ltfL) stfvol=sma(volume, stfL) voltrend= stfvol>ltfvol plotvol= volume>ltfvol and volume>stfvol ? volume : na sdev =(stdev(volume, ltfL)) zscore= (stfvol-ltfvol)/sdev voldev=(volume-ltfvol)/sdev devthresh= voldev>voldevthresh colorswitch1 = voltrend ? color.new(#00bcd4, 70) : color.new(#FF510D, 70) colorswitch2 = plotvol and open>close ? color.new(#FF510D, 0) : plotvol and close>open ? color.new(#e57373, 0) : na zscoreplot=plot(zscore, title="Short Vol", color=colorswitch1, style= plot.style_area) plot(plotvol and devthresh ? voldev : na, title="Big Volume Bars", color=barcolor ? colorswitch2 : color.new(color.white, 70), style=plot.style_columns)
watermark
https://www.tradingview.com/script/M34NZEfK-watermark/
ashkanpower
https://www.tradingview.com/u/ashkanpower/
224
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ashezpow //@version=5 indicator("watermark", overlay=true) showTF = input.bool(true, "show time frame", inline = "24") showpf = input.bool(true, "show prefix", inline = "24") showchange = input.bool(false, "show change %", inline = "24") string i_tableYpos = input.string("bottom", "Position", inline = "12", options = ["top", "middle", "bottom"]) string i_tableXpos = input.string("right", "", inline = "12", options = ["left", "center", "right"]) size1 = input.string("huge", "title", inline = "14", options = ["tiny", "small", "normal", "large", "huge", "auto"]) size3 = input.string("large", "change", inline = "14", options = ["tiny", "small", "normal", "large", "huge", "auto"]) size2 = input.string("small", "signature", inline = "14", options = ["tiny", "small", "normal", "large", "huge", "auto"]) color = input.color(#ffffff77, "color") string = input.string("by you", "your signature") seperator = input.string("/", "seperator") cahngeClose = request.security(syminfo.tickerid, timeframe.period, close) cur = syminfo.currency base = syminfo.basecurrency exchange = syminfo.prefix getTimeFrame() => tf = timeframe.multiplier tfstr = "" if timeframe.isseconds tfstr := "s" if timeframe.isminutes if tf >= 60 tf := tf / 60 tfstr := "h" else tfstr := "m" if timeframe.isdaily tfstr := "D" if timeframe.isweekly tfstr := "W" if timeframe.ismonthly tfstr := "M" [tfstr, str.tostring(tf)] var table table1 = table.new(i_tableYpos + "_" + i_tableXpos , 4, 1) if barstate.islast str1 = base != "" ? base + seperator + cur : syminfo.ticker [tf, period] = getTimeFrame() change = math.round(((cahngeClose[0] / cahngeClose[1]) - 1) * 100, 2) changeStr = "" if change > 0 changeStr := "▲" + str.tostring(math.abs(change)) + "%" else changeStr := "▼" + str.tostring(math.abs(change)) + "%" table.cell(table1, 0, 0, showpf ? exchange : "", text_color = color, width=0, text_size=size2) table.cell(table1, 1, 0, str1 + (showTF ? (" " + period + tf) : ""), width=0, text_color = color, text_size=size1) table.cell(table1, 2, 0, showchange ? changeStr : "", width=0, text_color = change > 0 ? color.green : color.red, text_size=size3) table.cell(table1, 3, 0, string, text_color = color, width=0, text_size=size2)
Auto TrendLines [HeWhoMustNotBeNamed]
https://www.tradingview.com/script/JZZObGme-Auto-TrendLines-HeWhoMustNotBeNamed/
Trendoscope
https://www.tradingview.com/u/Trendoscope/
3,032
study
5
MPL-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("Auto TrendLines [HeWhoMustNotBeNamed]", overlay=true, max_bars_back=300*5, max_lines_count=500, max_labels_count=500, max_boxes_count=500) import HeWhoMustNotBeNamed/zigzag/5 as zg import HeWhoMustNotBeNamed/customcandles/2 as ca ohlcSource = input.string("regular", "OHLC Source", options=["regular", "ha", "ma"], group="Candles") matype = input.string("sma", title="Moving Average", group="Candles", options=["sma", "ema", "hma", "rma", "wma", "vwma", "swma", "linreg", "median"], inline="m") malength = input.int(10, step=5, title="", group="Candles", inline="m") highSource = high lowSource = low closeSource = close openSource = open if(ohlcSource == "ma") [maOpen, maHigh, maLow, maClose] = ca.macandles(matype, malength) openSource := maOpen highSource := maHigh lowSource := maLow closeSource := maClose if(ohlcSource == "ha") [haOpen, haHigh, haLow, haClose] = ca.hacandles() openSource := haOpen highSource := haHigh lowSource := haLow closeSource := haClose zigzagLength = input.int(5, step=5, minval=3, title="Zigzag Length", group="Pattern Detection Settings") depth = input.int(34, "Search Depth", group="Pattern Detection Settings") showHistorical = input.bool(true, "Historical Trail", group="Pattern Detection Settings", inline="b") uptrendHigh = input.bool(true, "Upper", group="Uptrend", inline="uh") uptrendHighColor = input.color(color.orange, "", group="Uptrend", inline="uh") uptrendHighStyle = input.string(line.style_dashed, "", group="Uptrend", inline="uh", options=[line.style_solid, line.style_dashed, line.style_dotted]) uptrendLow = input.bool(true, "Lower", group="Uptrend", inline="ul") uptrendLowColor = input.color(color.green, "", group="Uptrend", inline="ul") uptrendLowStyle = input.string(line.style_solid, "", group="Uptrend", inline="ul", options=[line.style_solid, line.style_dashed, line.style_dotted]) downtrendHigh = input.bool(true, "Upper", group="Downtrend", inline="uh") downtrendHighColor = input.color(color.red, "", group="Downtrend", inline="uh") downtrendHighStyle = input.string(line.style_solid, "", group="Downtrend", inline="uh", options=[line.style_solid, line.style_dashed, line.style_dotted]) downtrendLow = input.bool(true, "Lower", group="Downtrend", inline="ul") downtrendLowColor = input.color(color.lime, "", group="Downtrend", inline="ul") downtrendLowStyle = input.string(line.style_dashed, "", group="Downtrend", inline="ul", options=[line.style_solid, line.style_dashed, line.style_dotted]) showWatermark = input.bool(true, "Transparency", group="Watermark", inline = "w") transparency = input.int(80, "", minval=75, maxval=100, step=5, group="Watermark", inline = "w") getTrendLineScore(trendLine, barArray, highLow)=> score = 0 minBar = array.min(barArray) for bar = minBar to bar_index linePrice = line.get_price(trendLine, bar) highLowTarget = highLow > 0? lowSource[bar_index-bar] : highSource[bar_index-bar] if(highSource[bar_index-bar] > linePrice and lowSource[bar_index-bar] < linePrice) wickStart = highLow > 0? math.max(openSource[bar_index-bar], closeSource[bar_index-bar]) : math.min(openSource[bar_index-bar], closeSource[bar_index-bar]) if(wickStart*highLow < linePrice*highLow) score+=2 if(highLowTarget*highLow > linePrice*highLow) score-=1 score scanTrendPoints(enable, indexArray, startIndex, highLow, trend)=> trendIndexes = array.new_int() endLength = array.size(indexArray) startLength = startIndex while(endLength>startLength and enable) oTrend = trend*highLow pivots = array.slice(indexArray, startLength, endLength) peak = highLow == 1? array.max(pivots) : array.min(pivots) peakIndex = oTrend == 1? array.indexof(pivots, peak) : array.lastindexof(pivots, peak) if oTrend == 1 array.unshift(trendIndexes, startLength+peakIndex) else array.push(trendIndexes, peakIndex) if(oTrend == 1? startLength+peakIndex == endLength : peakIndex == 0) break if oTrend == 1 startLength := startLength+peakIndex+1 else endLength := peakIndex trendIndexes updateTrendLine(pivotArray, pivotBarArray, trendIndexes, highLow, lineColor, lineStyle)=> var line trendLine = na trendScore = getTrendLineScore(trendLine, pivotBarArray, highLow) updated = false historical = true if(array.size(trendIndexes) >= 3) for i=0 to array.size(trendIndexes)-2 for j=i+1 to array.size(trendIndexes)-1 x1Index = array.get(trendIndexes, j) x1 = array.get(pivotArray, x1Index) x1Bar = array.get(pivotBarArray, x1Index) x2Index = array.get(trendIndexes, i) x2 = array.get(pivotArray, x2Index) x2Bar = array.get(pivotBarArray, x2Index) tl = line.new(x1Bar, x1, x2Bar, x2, color=lineColor, width=1, style=lineStyle, extend=extend.both) score = getTrendLineScore(tl, pivotBarArray, highLow) if(score <= 0 or score < trendScore) line.delete(tl) trendLine else trendScore := score updated := true if(historical and showHistorical) y1 = line.get_price(trendLine, x1Bar) y2 = line.get_price(trendLine, x2Bar) line.set_x1(trendLine, x1Bar) line.set_y1(trendLine, y1) line.set_x2(trendLine, x2Bar) line.set_y2(trendLine, y2) line.set_extend(trendLine, extend.none) line.set_style(trendLine, line.style_dotted) line.set_width(trendLine, 0) line.set_color(trendLine, color.new(lineColor, 90)) historical = false true else line.delete(trendLine) true trendLine := tl [updated, trendLine] scan(startIndex, newPivot, zigzagpivots, zigzagpivotbars, zigzagpivotdirs, lastD)=> newD = lastD d = array.size(zigzagpivots) > 0 ? array.get(zigzagpivots,0) : lastD var uptrendHighIndexesCount = 0 var uptrendLowIndexesCount = 0 var downtrendHighIndexesCount = 0 var downtrendLowIndexesCount = 0 var line uptrendHighLine = na var line uptrendLowLine = na var line downtrendHighLine = na var line downtrendLowLine = na var uptrendHighBar = bar_index var downtrendHighBar = bar_index var uptrendLowBar = bar_index var downtrendLowBar = bar_index if(d!=lastD and array.size(zigzagpivots) >=6) newD := d highArray = array.new_float() highBarArray = array.new_int() lowArray = array.new_float() lowBarArray = array.new_int() for i=startIndex to array.size(zigzagpivots)-1 dir = array.get(zigzagpivotdirs, i) if(dir > 0) array.push(highArray, array.get(zigzagpivots, i)) array.push(highBarArray, array.get(zigzagpivotbars, i)) else array.push(lowArray, array.get(zigzagpivots, i)) array.push(lowBarArray, array.get(zigzagpivotbars, i)) uptrendHighIndexes = scanTrendPoints(uptrendHigh, highArray, startIndex, 1, 1) uptrendLowIndexes = scanTrendPoints(uptrendLow, lowArray, startIndex, -1, 1) downtrendHighIndexes = scanTrendPoints(downtrendHigh, highArray, startIndex, 1, -1) downtrendLowIndexes = scanTrendPoints(downtrendLow, lowArray, startIndex, -1, -1) [updatedUptrendHigh, _uptrendHighLine] = updateTrendLine(highArray, highBarArray, uptrendHighIndexes, 1, uptrendHighColor, uptrendHighStyle) [updatedUptrendLow, _uptrendLowLine] = updateTrendLine(lowArray, lowBarArray, uptrendLowIndexes, -1, uptrendLowColor, uptrendLowStyle) [updatedDowntrendHigh, _downtrendHighLine] = updateTrendLine(highArray, highBarArray, downtrendHighIndexes, 1, downtrendHighColor, downtrendHighStyle) [updatedDowntrendLow, _downtrendLowLine] = updateTrendLine(lowArray, lowBarArray, downtrendLowIndexes, -1, downtrendLowColor, downtrendLowStyle) uptrendHighIndexesCount := array.size(uptrendHighIndexes) uptrendLowIndexesCount := array.size(uptrendLowIndexes) downtrendHighIndexesCount := array.size(downtrendHighIndexes) downtrendLowIndexesCount := array.size(downtrendLowIndexes) uptrendHighBar := updatedUptrendHigh? bar_index : uptrendHighBar downtrendHighBar := updatedDowntrendHigh? bar_index : downtrendHighBar uptrendLowBar := updatedUptrendLow? bar_index : uptrendLowBar downtrendLowBar := updatedDowntrendLow? bar_index : downtrendLowBar uptrendHighLine := _uptrendHighLine uptrendLowLine := _uptrendLowLine downtrendHighLine := _downtrendHighLine downtrendLowLine := _downtrendLowLine [newD, uptrendHighIndexesCount, uptrendLowIndexesCount, downtrendHighIndexesCount, downtrendLowIndexesCount, uptrendHighBar, uptrendLowBar, downtrendHighBar, downtrendLowBar, uptrendHighLine, uptrendLowLine, downtrendHighLine, downtrendLowLine] [zigzagpivots, zigzagpivotbars, zigzagpivotdirs, zigzagpivotratios, zigzagoscillators, zigzagoscillatordirs, zigzagtrendbias, zigzagdivergence, newPivot, doublePivot] = zg.czigzag(zigzagLength, depth, highSource, lowSource) TlSrStatsPosition = position.top_center label_size = size.small var d = 0.0 [newD, uptrendHighIndexesCount, uptrendLowIndexesCount, downtrendHighIndexesCount, downtrendLowIndexesCount, uptrendHighBar, uptrendLowBar, downtrendHighBar, downtrendLowBar, uptrendHighLine, uptrendLowLine, downtrendHighLine, downtrendLowLine] = scan(1, newPivot, zigzagpivots, zigzagpivotbars, zigzagpivotdirs, d) d := newD uptrendHighPrice = line.get_price(uptrendHighLine, bar_index) uptrendLowPrice = line.get_price(uptrendLowLine, bar_index) downtrendHighPrice = line.get_price(downtrendHighLine, bar_index) downtrendLowPrice = line.get_price(downtrendLowLine, bar_index) _uptrendHighPrice = line.get_price(uptrendHighLine, bar_index-20) _uptrendLowPrice = line.get_price(uptrendLowLine, bar_index-20) _downtrendHighPrice = line.get_price(downtrendHighLine, bar_index-20) _downtrendLowPrice = line.get_price(downtrendLowLine, bar_index-20) uptrendHighDirection = uptrendHighPrice > _uptrendHighPrice? "⇈" : uptrendHighPrice < _uptrendHighPrice? "⇊" : "▣" uptrendLowDirection = uptrendLowPrice > _uptrendLowPrice? "⇈" : uptrendLowPrice < _uptrendLowPrice? "⇊" : "▣" downtrendHighDirection = downtrendHighPrice > _downtrendHighPrice? "⇈" : downtrendHighPrice < _downtrendHighPrice? "⇊" : "▣" downtrendLowDirection = downtrendLowPrice > _downtrendLowPrice? "⇈" : downtrendLowPrice < _downtrendLowPrice? "⇊" : "▣" uptrendHighDistance = math.abs(close - uptrendHighPrice) uptrendLowDistance = math.abs(close - uptrendLowPrice) downtrendHighDistance = math.abs(close - downtrendHighPrice) downtrendLowDistance = math.abs(close - downtrendLowPrice) distanceArray = array.from(uptrendHighDistance, uptrendLowDistance, downtrendHighDistance, downtrendLowDistance) array.sort(distanceArray) uptrendHighRow = array.indexof(distanceArray, uptrendHighDistance)+1 uptrendLowRow = array.indexof(distanceArray, uptrendLowDistance)+1 downtrendHighRow = array.indexof(distanceArray, downtrendHighDistance)+1 downtrendLowRow = array.indexof(distanceArray, downtrendLowDistance)+1 rangeDistance = math.min(uptrendHighDistance, downtrendHighDistance) + math.min(uptrendLowDistance, downtrendLowDistance) uptrendHighBgColor = uptrendHighDistance < downtrendHighDistance ? (close < uptrendHighPrice ? color.orange : color.green) : color.silver uptrendLowBgColor = uptrendLowDistance < downtrendLowDistance ? (close > uptrendLowPrice ? color.lime : color.red) : color.silver downtrendHighBgColor = uptrendHighDistance > downtrendHighDistance ? (close < downtrendHighPrice ? color.orange : color.orange) : color.silver downtrendLowBgColor = uptrendLowDistance > downtrendLowDistance ? (close > downtrendLowPrice ? color.lime : color.red) : color.silver isUptrendHigh = uptrendHighDistance < downtrendHighDistance? true : false isUptrendLow = uptrendLowDistance < downtrendLowDistance? true : false highDirection = isUptrendHigh ? uptrendHighDirection : downtrendHighDirection lowDirection = isUptrendLow ? uptrendLowDirection : downtrendLowDirection if barstate.islast stats = table.new(position=TlSrStatsPosition, columns=6, rows=5, border_width=1) table.cell(table_id=stats, column=0, row=0, text="TrendLine", bgcolor=color.teal, text_color=color.white, text_size=label_size) table.cell(table_id=stats, column=1, row=0, text="Direction", bgcolor=color.teal, text_color=color.white, text_size=label_size) table.cell(table_id=stats, column=2, row=0, text="Strength", bgcolor=color.teal, text_color=color.white, text_size=label_size) table.cell(table_id=stats, column=3, row=0, text="LastUpdate", bgcolor=color.teal, text_color=color.white, text_size=label_size) table.cell(table_id=stats, column=4, row=0, text="Price", bgcolor=color.teal, text_color=color.white, text_size=label_size) table.cell(table_id=stats, column=5, row=0, text="Distance", bgcolor=color.teal, text_color=color.white, text_size=label_size) table.clear(stats, 0, 1, 5, 4) if(isUptrendHigh) table.cell(table_id=stats, column=0, row=uptrendHighRow, text="Up/High", bgcolor=uptrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=1, row=uptrendHighRow, text=uptrendHighDirection, bgcolor=uptrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=2, row=uptrendHighRow, text=str.tostring(uptrendHighIndexesCount), bgcolor=uptrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=3, row=uptrendHighRow, text=str.tostring(bar_index-uptrendHighBar), bgcolor=uptrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=4, row=uptrendHighRow, text=str.tostring(math.round_to_mintick(uptrendHighPrice)), bgcolor=uptrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=5, row=uptrendHighRow, text=str.tostring(math.round_to_mintick(close-uptrendHighPrice)), bgcolor=uptrendHighBgColor, text_color=color.black, text_size=label_size) if(isUptrendLow) table.cell(table_id=stats, column=0, row=uptrendLowRow, text="Up/Low", bgcolor=uptrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=1, row=uptrendLowRow, text=uptrendLowDirection, bgcolor=uptrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=2, row=uptrendLowRow, text=str.tostring(uptrendLowIndexesCount), bgcolor=uptrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=3, row=uptrendLowRow, text=str.tostring(bar_index-uptrendLowBar), bgcolor=uptrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=4, row=uptrendLowRow, text=str.tostring(math.round_to_mintick(uptrendLowPrice)), bgcolor=uptrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=5, row=uptrendLowRow, text=str.tostring(math.round_to_mintick(close-uptrendLowPrice)), bgcolor=uptrendLowBgColor, text_color=color.black, text_size=label_size) if(not isUptrendHigh) table.cell(table_id=stats, column=0, row=downtrendHighRow, text="Down/High", bgcolor=downtrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=1, row=downtrendHighRow, text=downtrendHighDirection, bgcolor=downtrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=2, row=downtrendHighRow, text=str.tostring(downtrendHighIndexesCount), bgcolor=downtrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=3, row=downtrendHighRow, text=str.tostring(bar_index-downtrendHighBar), bgcolor=downtrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=4, row=downtrendHighRow, text=str.tostring(math.round_to_mintick(downtrendHighPrice)), bgcolor=downtrendHighBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=5, row=downtrendHighRow, text=str.tostring(math.round_to_mintick(close-downtrendHighPrice)), bgcolor=downtrendHighBgColor, text_color=color.black, text_size=label_size) if(not isUptrendLow) table.cell(table_id=stats, column=0, row=downtrendLowRow, text="Down/Low", bgcolor=downtrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=1, row=downtrendLowRow, text=downtrendLowDirection, bgcolor=downtrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=2, row=downtrendLowRow, text=str.tostring(downtrendLowIndexesCount), bgcolor=downtrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=3, row=downtrendLowRow, text=str.tostring(bar_index-downtrendLowBar), bgcolor=downtrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=4, row=downtrendLowRow, text=str.tostring(math.round_to_mintick(downtrendLowPrice)), bgcolor=downtrendLowBgColor, text_color=color.black, text_size=label_size) table.cell(table_id=stats, column=5, row=downtrendLowRow, text=str.tostring(math.round_to_mintick(close-downtrendLowPrice)), bgcolor=downtrendLowBgColor, text_color=color.black, text_size=label_size) if(showWatermark) highSlope = highDirection == "⇈" ? 1 : highDirection == "⇊"? -1 : 0 lowSlope = lowDirection == "⇈" ? 1 : lowDirection == "⇊"? -1 : 0 trend = highSlope == 1 and lowSlope == 1 ? "Uptrend" : highSlope == 1 and lowSlope == -1 ? "Diverging Triangle" : highSlope == 1 and lowSlope == 0 ? "diverging-ascending-triangle" : highSlope == -1 and lowSlope == 1 ? "Converging Triangle" : highSlope == -1 and lowSlope == -1 ? "Downtrend" : highSlope == -1 and lowSlope == 0 ? "converging-descending-triangle" : highSlope == 0 and lowSlope == 1 ? "converging-ascending-triangle" : highSlope == 0 and lowSlope == -1 ? "diverging-descending-triangle" : highSlope == 0 and lowSlope == 0 ? "range" : "none" watermark = table.new(position=position.middle_center, columns=1, rows=1, border_width=0) table.cell(table_id=watermark, column=0, row=0, text=trend, text_color=color.new(color.aqua, transparency), text_size=size.huge)
GSI (Gap Size Indicator)
https://www.tradingview.com/script/dtSdvM0J-GSI-Gap-Size-Indicator/
noop-noop
https://www.tradingview.com/u/noop-noop/
95
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © noop42 //@version=5 indicator('GSI (Gap Size Indicator)', overlay=false) // Options mode = input.string("%", "Mode", options=["%", "Price"]) trig_value = input.float(1.0, "Variation trigger", minval=0.001, maxval=100.0) show_lines = input.bool(true, "Show trigger lines") color_signals_only = input.bool(false, "Color signals only") signals_only = input.bool(false, "Show signals only") // Gap calculation gap_side = close[1] > open ? -1 : close[1] < open ? 1 : 0 gap_pct = (1 - (close[1] / open)) * 100 gap_price = (open - close[1]) gap_value = mode == "%" ? gap_pct : gap_price // Signal triggered = (gap_side * gap_value) >= trig_value // plots lineCol = (color_signals_only and triggered) or (color_signals_only == false) ? (gap_side == 1 ? color.blue : gap_side == -1 ? color.red : na) : color.gray gap = (signals_only and triggered) or (signals_only == false) ? gap_value : na hline(show_lines ? trig_value : na, color=color.blue, title="Positive trigger") hline(show_lines ? trig_value * -1 : na, color=color.red, title="Negative trigger") plot(gap, color=lineCol, style=plot.style_columns, title="Gap value") // Alerts alertcondition(triggered, title="Any Gap", message="Gap detected") alertcondition(triggered and gap_side == 1, title="Bullish Gap", message="Bullish gap") alertcondition(triggered and gap_side == -1, title="Bearish Gap", message="Bearish gap")
How To Calculate Symbol's UTC Number
https://www.tradingview.com/script/xT6uyOGc-How-To-Calculate-Symbol-s-UTC-Number/
allanster
https://www.tradingview.com/u/allanster/
32
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © allanster //@version=5 indicator("How To Calculate Symbol's UTC Number", overlay = true) // Various methods to calculate a symbol's timezone offset as a numerical value in hours and decimal minutes. This value // may be useful to script authors in certain situations where timezone information needs to be available in a numerical // format while using intraday charts. Special thanks to @LucF and TradingView Support for their efficiency advisements! tickerID = input.symbol('NSE:CESC') // === EXAMPLE SINGLE SECURITY REQUEST === f_UTC(_tickerID) => // returns called symbol's UTC+/-Hour.Minutes request.security(_tickerID, timeframe.period, dayofweek <= dayofweek(time_tradingday, syminfo.timezone) ? hour(time_tradingday, syminfo.timezone) + minute(time_tradingday, syminfo.timezone) / 60 : hour(time_tradingday, syminfo.timezone) - 24 - minute(time_tradingday, syminfo.timezone) / 60) UTC = f_UTC(tickerID) // === EXAMPLE SINGLE SECURITY REQUEST USING TUPLES === f_requestVars() => // specify variables to request from called symbol's [dayofweek, dayofweek(time_tradingday, syminfo.timezone), hour (time_tradingday, syminfo.timezone), minute (time_tradingday, syminfo.timezone)] [utc0_day, utcN_day, utcN_hrs, utcN_min] = request.security(tickerID, timeframe.period, f_requestVars()) utcN = utc0_day > utcN_day ? utcN_hrs - 24 - utcN_min / 60 : utcN_hrs + utcN_min / 60 // symbol UTC+/-N // === EXAMPLE USING MAIN CHART SYMBOL === f_UTCn(_tickerID) => // returns main chart symbol's UTC+/-n UTC0_day = dayofweek UTCn_day = dayofweek(time_tradingday, syminfo.timezone) UTCn_hrs = hour (time_tradingday, syminfo.timezone) UTCn_min = minute (time_tradingday, syminfo.timezone) UTC0_day > UTCn_day ? UTCn_hrs - 24 - UTCn_min / 60 : UTCn_hrs + UTCn_min / 60 UTCn = f_UTCn(tickerID) // === TABLE OF EACH METHOD ABOVE === info = timeframe.isintraday ? syminfo.tickerid + ' is UTC ' + str.tostring(UTCn) + '\n' + tickerID + ' is UTC ' + str.tostring(UTC) + '\n' + tickerID + ' is UTC ' + str.tostring(utcN) : 'Please Set Chart Period Lower Than "D"' colr = timeframe.isintraday ? color.black : color.red printTable(txt) => var table t = table.new(position.top_right, 1, 1), table.cell(t, 0, 0, txt, text_color = color.white, text_halign = text.align_right, bgcolor = colr) printTable(info) // table showing timezone UTC offsets in hours & decimal minutes for example methods above // Example Behind UTC-5 // tickerID day: Saturday 7 Sunday 1 Sunday 1 Monday 2 // tickerID hrs: 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 // baseLine hrs: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 // baseLine day: Sunday 1 Sunday 1 Monday 2 Monday 2 // Example Ahead UTC+5 // tickerID day: Sunday 1 Sunday 1 Monday 2 Monday 2 // tickerID hrs: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 // baseLine hrs: 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 // baseLine day: Saturday 7 Sunday 1 Sunday 1 Monday 2
[LanZhu] - Bias With Divergence
https://www.tradingview.com/script/elpMWGyB-LanZhu-Bias-With-Divergence/
Lanzhu0506
https://www.tradingview.com/u/Lanzhu0506/
52
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Lanzhu0506 //@version=5 indicator("[LanZhu] - Bias With Divergence", overlay=false) /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /// Input & Setting /// ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// // ========== // ===Bias=== // ========== biasGroup = '===Bias Setting===' defaultBiasMA = input.int(defval=6, title="Default Bias MA Length", inline="defaultBias", group=biasGroup, tooltip='Will be used for divergence detection') isShowBias2 = input.bool(defval=true, title="Show Bias 2", inline="bias2", group=biasGroup) biasMA2 = input.int(defval=12, title="Bias 2 MA Length", inline="bias2", group=biasGroup) isShowBias3 = input.bool(defval=true, title="Show Bias 3", inline="bias3", group=biasGroup) biasMA3 = input.int(defval=24, title="Bias 3 MA Length", inline="bias3", group=biasGroup) isShowBias4 = input.bool(defval=true, title="Show Bias 4", inline="bias4", group=biasGroup) biasMA4 = input.int(defval=72, title="Bias 4 MA Length", inline="bias4", group=biasGroup) extremeOB= input.int(defval=10, title="Extreme Overbought", group=biasGroup) OB= input.int(defval=5, title="Overbought", group=biasGroup) OS= input.int(defval=-5, title="Oversold", group=biasGroup) extremeOS= input.int(defval=-10, title="Extreme Oversold", group=biasGroup) // ========================== // ===Divergence Detection=== // ========================== divergenceGroup = '===Default Bias Divergence Setting===' lbR = input.int( defval=5, title="Pivot Lookback Right", group=divergenceGroup) lbL = input(defval=5, title="Pivot Lookback Left", group=divergenceGroup) rangeUpper = input(defval=100, title="Max of Lookback Range", group=divergenceGroup) rangeLower = input(defval=5, title="Min of Lookback Range", group=divergenceGroup) plotBull = input(defval=true, title="Plot Bullish", group=divergenceGroup) plotHiddenBull = input(defval=true, title="Plot Hidden Bullish", group=divergenceGroup) plotBear = input(defval=true, title="Plot Bearish", group=divergenceGroup) plotHiddenBear = input(defval=true, title="Plot Hidden Bearish", group=divergenceGroup) /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /// Calculation & Plotting & Alert /// ////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // ========== // ===Bias=== // ========== defaultBias = ((close - ta.ema(close, defaultBiasMA)) / ta.ema(close, defaultBiasMA)) * 100 bias2 = ((close - ta.ema(close, biasMA2)) / ta.ema(close, biasMA2)) * 100 bias3 = ((close - ta.ema(close, biasMA3)) / ta.ema(close, biasMA3)) * 100 bias4 = ((close - ta.ema(close, biasMA4)) / ta.ema(close, biasMA4)) * 100 plot(defaultBias, title="Default Bias", color=color.blue) plot(isShowBias2 ? bias2 : na, title="Bias 2", color=color.orange) plot(isShowBias3 ? bias3 : na, title="Bias 3", color=color.red) plot(isShowBias4 ? bias4 : na, title="Bias 4", color=color.green) defaultBiasSell = ta.crossover(defaultBias, OB) defaultBiasbuy = ta.crossunder(defaultBias, OS) bias1Sell = ta.crossover(bias2, OB) bias1Buy = ta.crossunder(bias2, OS) bias2Sell = ta.crossover(bias3, OB) bias2Buy = ta.crossunder(bias3, OS) hline(extremeOB, title="Extreme Overbought", color=color.red, linestyle=hline.style_dashed) hline(OB, title="Overbought", color=color.orange, linestyle=hline.style_dashed) hline(0, title="Neutral", color=color.gray, linestyle=hline.style_dashed) hline(OS, title="Oversold", color=color.blue, linestyle=hline.style_dashed) hline(extremeOS, title="Extreme Oversold", color=color.green, linestyle=hline.style_dashed) // ========================== // ===Divergence Detection=== // ========================== bearColor = color.red bullColor = color.green hiddenBullColor = color.blue hiddenBearColor = color.purple textColor = color.white noneColor = color.new(color.white, 100) plFound = na(ta.pivotlow(defaultBias, lbL, lbR)) ? false : true phFound = na(ta.pivothigh(defaultBias, lbL, lbR)) ? false : true _inRange(cond) => bars = ta.barssince(cond == true) rangeLower <= bars and bars <= rangeUpper //------------------------------------------------------------------------------ // Regular Bullish // defaultBias: Higher Low defaultBiasHL = defaultBias[lbR] > ta.valuewhen(plFound, defaultBias[lbR], 1) and _inRange(plFound[1]) // Price: Lower Low priceLL = low[lbR] < ta.valuewhen(plFound, low[lbR], 1) bullCond = plotBull and priceLL and defaultBiasHL and plFound plot( plFound ? defaultBias[lbR] : na, offset=-lbR, title="Regular Bullish", linewidth=2, color=(bullCond ? bullColor : noneColor) ) plotshape( bullCond ? defaultBias[lbR] : na, offset=-lbR, title="Regular Bullish Label", text=" Bull ", style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor ) //------------------------------------------------------------------------------ // Hidden Bullish // defaultBias: Lower Low defaultBiasLL = defaultBias[lbR] < ta.valuewhen(plFound, defaultBias[lbR], 1) and _inRange(plFound[1]) // Price: Higher Low priceHL = low[lbR] > ta.valuewhen(plFound, low[lbR], 1) hiddenBullCond = plotHiddenBull and priceHL and defaultBiasLL and plFound plot( plFound ? defaultBias[lbR] : na, offset=-lbR, title="Hidden Bullish", linewidth=2, color=(hiddenBullCond ? hiddenBullColor : noneColor) ) plotshape( hiddenBullCond ? defaultBias[lbR] : na, offset=-lbR, title="Hidden Bullish Label", text=" H Bull ", style=shape.labelup, location=location.absolute, color=hiddenBullColor, textcolor=textColor ) //------------------------------------------------------------------------------ // Regular Bearish // defaultBias: Lower High defaultBiasLH = defaultBias[lbR] < ta.valuewhen(phFound, defaultBias[lbR], 1) and _inRange(phFound[1]) // Price: Higher High priceHH = high[lbR] > ta.valuewhen(phFound, high[lbR], 1) bearCond = plotBear and priceHH and defaultBiasLH and phFound plot( phFound ? defaultBias[lbR] : na, offset=-lbR, title="Regular Bearish", linewidth=2, color=(bearCond ? bearColor : noneColor) ) plotshape( bearCond ? defaultBias[lbR] : na, offset=-lbR, title="Regular Bearish Label", text=" Bear ", style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor ) //------------------------------------------------------------------------------ // Hidden Bearish // defaultBias: Higher High defaultBiasHH = defaultBias[lbR] > ta.valuewhen(phFound, defaultBias[lbR], 1) and _inRange(phFound[1]) // Price: Lower High priceLH = high[lbR] < ta.valuewhen(phFound, high[lbR], 1) hiddenBearCond = plotHiddenBear and priceLH and defaultBiasHH and phFound plot( phFound ? defaultBias[lbR] : na, offset=-lbR, title="Hidden Bearish", linewidth=2, color=(hiddenBearCond ? hiddenBearColor : noneColor) ) plotshape( hiddenBearCond ? defaultBias[lbR] : na, offset=-lbR, title="Hidden Bearish Label", text=" H Bear ", style=shape.labeldown, location=location.absolute, color=hiddenBearColor, textcolor=textColor )
OmegaDelta
https://www.tradingview.com/script/VUKjrD4g-OmegaDelta/
RicardoSantos
https://www.tradingview.com/u/RicardoSantos/
286
study
5
MPL-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='OmegaDelta', shorttitle='ΩΔ') string display = input.string(defval='absolute', options=['absolute', 'relative']) var float[] trajectories = array.new_float(1, 0.0) float difference = close - open float alpha = (1.0 / bar_index) * difference for _i = 0 to array.size(trajectories)-1 float _y = array.get(trajectories, _i) * alpha array.set(trajectories, _i, _y) array.unshift(trajectories, difference) float od = switch (display) ('absolute') => array.sum(trajectories) ('relative') => array.sum(trajectories) / close plot(series=od, title='ΩΔ', color=color.blue) hline(0)
ZigZag reSampled
https://www.tradingview.com/script/787pltFE-ZigZag-reSampled/
dy6m1
https://www.tradingview.com/u/dy6m1/
189
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/ // © dy6m1 //@version=4 study("ZigZag reSampled", overlay = true) depth = input(15 , title = "Depth") length = input(7, title = "Backsteps") var bool upward = true var float lastlow = low var float lasthigh = high var int timelow = 1 var int timehigh = 1 var line trendline = na h = highest(high , depth) l = lowest(low , depth) if (upward) if (low[length] < lastlow) and (l == low[length]) lastlow := low[length] timelow := bar_index //delete line line.delete(trendline) //draw new line trendline := line.new(timehigh - length , lasthigh , timelow - length, lastlow , xloc.bar_index, color = color.purple , width = 2) if (high[length] > lastlow) and (h == high[length]) lasthigh := high[length] timehigh := bar_index upward := false //draw line trendline := line.new(timehigh - length , lasthigh , timelow - length, lastlow , xloc.bar_index , color = color.purple , width = 2) if (not upward) if (high[length] > lasthigh) and (h == high[length]) lasthigh := high[length] timehigh := bar_index //delete line line.delete(trendline) //draw new line trendline := line.new(timehigh - length , lasthigh , timelow - length, lastlow , xloc.bar_index, color = color.purple , width = 2) if (low[length] < lasthigh) and (l == low[length]) lastlow := low[length] timelow := bar_index upward := true //draw new line trendline := line.new(timehigh - length , lasthigh , timelow - length, lastlow , xloc.bar_index, color = color.purple , width = 2) // plot(upward ? 1.0 : 0.0 , color = color.blue) // plot(h , color = color.green) // plot(l , color = color.red)
EFI_Moving_avg
https://www.tradingview.com/script/1HLGtxFE-EFI-Moving-avg/
keymaker67
https://www.tradingview.com/u/keymaker67/
45
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © keymaker67 //@version=5 indicator("EFI_Moving_avg", overlay= false, format=format.volume) length = input.int(defval=10 ,step=5) efi = ta.ema(ta.change(close) * volume, 14) ema = ta.ema(ta.ema(ta.ema(efi, length), length), length) plot(efi, color=efi > ema ? color.aqua : color.gray, title="Elders Force Index") plot(ema, color=ema > 0 ? color.lime : #F44336, title="Elders Force Index") hline(0, color=#787B86, title="Zero")
CH-I: Trend - Higher Timeframe Body
https://www.tradingview.com/script/E3lia7HU-CH-I-Trend-Higher-Timeframe-Body/
Coffeehouse-Analytics
https://www.tradingview.com/u/Coffeehouse-Analytics/
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/ // © Coffeehouse-Analytics //@version=5 indicator("CH-I: Trend - Higher Timeframe Bars", "CH-I High TF Bars", overlay=true, max_lines_count = 500, max_boxes_count=500) AUTO_TIMEFRAME_TOOLTIP = "When the Auto option is selected, the timeframe of the indicator is chosen automatically based on the chart timeframe. The Timeframe dropdown is ignored. The automated timeframes are: \n '1 day' for any chart timeframes below '1 day' \n '1 week' for any timeframes starting from '1 day' up to '1 week' \n '1 month' for any timeframes starting from '1 week' up to '1 month' \n '3 months' for any timeframes starting from '1 month' up to '3 months' \n '12 months' for any timeframes above '3 months'" HLR = "High/Low Range" TR = "True Range" HAR = "Heikin Ashi Range" txtBorderSolid = "Solid" txtBorderDashed = "Dashed" txtBorderDotted = "Dotted" txtUseHighLow = "High/Low" txtUseOpenClose = "Open/Close" txtWickTranspLight = "Transparent" txtWickTranspDark = "Not Transparent" txtWickStyleSolid = "Solid" txtWickStyleDotted = "Dotted" txtWickStyleDashed = "Dashed" txtWickStyleArrowLeft = "Arrow Left" txtWickStyleArrowRight = "Arrow Right" txtWickStyleArrowBoth = "Arrow Both" DEFAULT_RESOLUTION = "1M" DEFAULT_COLOR_GROWTH = color.rgb(0, 150, 136, 80) DEFAULT_COLOR_FALL = color.rgb(244, 67, 54, 80) DEFAULT_BORDER_WIDTH = 0 DEFAULT_BORDER_STYLE = txtBorderSolid DEFAULT_CANDLE_USAGE = txtUseHighLow DEFAULT_WICK_TRANSP = 0 DEFAULT_WICK_STYLE = txtWickStyleSolid DEFAULT_WICK_WIDTH = 1 DEFAULT_CALCULATION_METHOD = HLR DEFAULT_AUTO_RESOLUTION = true var prev_bar_index = bar_index draw_box(left, right, topBody, bottomBody, diff, color_growth, color_fall, border_growth, border_fall, width_border, style_border) => drawed_box = box.new(left, topBody, right, bottomBody, border_width = width_border, border_style = style_border) if diff < 0 box.set_border_color(drawed_box, border_fall) box.set_bgcolor(drawed_box, color_fall) else box.set_border_color(drawed_box, border_growth) box.set_bgcolor(drawed_box, color_growth) drawed_box draw_line(left, right, topWick, bottomWick, diff, color_growth, color_fall, style_line, width_line) => drawed_line = line.new(left, topWick, right, bottomWick, style = style_line, width = width_line) if diff < 0 line.set_color(drawed_line, color_fall) else line.set_color(drawed_line, color_growth) drawed_line select_auto_resolution() => timeframe.isseconds ? '120': timeframe.isminutes ? '1440': timeframe.isdaily ? 'W': timeframe.isweekly ? 'M': timeframe.ismonthly and timeframe.multiplier < 3 ? '3M': '12M' auto_resolution = input(DEFAULT_AUTO_RESOLUTION, title="AutoTimeframe", tooltip=AUTO_TIMEFRAME_TOOLTIP, group = "General") resolution_input = input.timeframe(DEFAULT_RESOLUTION, title="Timeframe", group = "General") resolution = auto_resolution == true ? select_auto_resolution() : resolution_input color_growth = input(DEFAULT_COLOR_GROWTH, title="Color Growth / Fall", inline = "Colors", group = "General") color_fall = input(DEFAULT_COLOR_FALL, title="", inline = "Colors", group = "General") calculation_method = input.string(DEFAULT_CALCULATION_METHOD, "Bar Style", options = [HLR, TR, HAR], group = "Bar Body") ohlc_Usage = input.string(DEFAULT_CANDLE_USAGE, "Calculation From", options = [txtUseHighLow, txtUseOpenClose], group = "Bar Body") width_border = input.int(DEFAULT_BORDER_WIDTH, "Width", minval = 0, group = "Bar Border") style_border = input.string(DEFAULT_BORDER_STYLE, "Style", options = [txtBorderSolid, txtBorderDashed, txtBorderDotted], group = "Bar Border") width_Wicks = input.int(DEFAULT_WICK_WIDTH, "Width", minval = 0, maxval = 9, group = "Bar Wick") style_Wicks = input.string(DEFAULT_WICK_STYLE, "Style", options = [txtWickStyleSolid, txtWickStyleDotted], group = "Bar Wick") transp_Wicks = input.int(DEFAULT_WICK_TRANSP, "Transparency", minval = 0, maxval = 100, group = "Bar Wick") show_Wicks = width_Wicks != 0 use_OpenClose = ohlc_Usage == txtUseOpenClose style_Wick = switch style_Wicks txtWickStyleSolid => line.style_solid txtWickStyleDotted => line.style_dotted txtWickStyleDashed => line.style_dashed txtWickStyleArrowLeft => line.style_arrow_left txtWickStyleArrowRight => line.style_arrow_right txtWickStyleArrowBoth => line.style_arrow_both border_styl = style_border == txtBorderSolid ? line.style_solid : style_border == txtBorderDashed ? line.style_dashed : line.style_dotted color_border_growth = color.rgb(color.r(color_growth), color.g(color_growth), color.b(color_growth), 0) color_border_fall = color.rgb(color.r(color_fall), color.g(color_fall), color.b(color_fall), 0) color_wick_growth = color.rgb(color.r(color_growth), color.g(color_growth), color.b(color_growth), transp_Wicks) color_wick_fall = color.rgb(color.r(color_fall), color.g(color_fall), color.b(color_fall), transp_Wicks) [previous_high, previous_low, previous_close, previous_open, previous_prev_close] = request.security(syminfo.tickerid, resolution, [high[1], low[1], close[1], open[1], close[2]], lookahead=barmerge.lookahead_on) [current_high, current_low, current_close, current_open, prev_close] = request.security(syminfo.tickerid, resolution, [high, low, close, open, close[1]]) sec_open = barstate.islast ? current_open : previous_open sec_close = barstate.islast ? current_close : previous_close sec_high = barstate.islast ? current_high : previous_high sec_prev_close = barstate.islast ? prev_close : previous_prev_close sec_low = barstate.islast ? current_low : previous_low sec_ocMax = math.max(sec_open, sec_close) sec_ocMin = math.min(sec_open, sec_close) diff = barstate.islast ? current_close - current_open : previous_close - previous_open left = prev_bar_index right = barstate.islast ? bar_index : bar_index[1] [ashi_open, ashi_high, ashi_low, ashi_close] = request.security(ticker.heikinashi(syminfo.tickerid), resolution, [open, high, low, close]) float topBody = na float bottomBody = na float topWick = na float bottomWick = na if calculation_method == HLR topBody := use_OpenClose ? sec_ocMax : sec_high bottomBody := use_OpenClose ? sec_ocMin : sec_low topWick := sec_high bottomWick := sec_low else if calculation_method == TR topBody := use_OpenClose ? math.max(sec_ocMax, sec_prev_close) : math.max(sec_high, sec_prev_close) bottomBody := use_OpenClose ? math.min(sec_ocMin, sec_prev_close) : math.min(sec_low, sec_prev_close) topWick := math.max(sec_high, sec_prev_close) bottomWick := math.min(sec_low, sec_prev_close) else if calculation_method == HAR topBody := use_OpenClose ? math.max(ashi_open, ashi_close) : ashi_high bottomBody := use_OpenClose ? math.min(ashi_open, ashi_close) : ashi_low topWick := ashi_high bottomWick := ashi_low is_new_period = ta.change(time(resolution)) if is_new_period prev_bar_index := bar_index var box prev_box = na var line prev_topWick = na var line prev_bottomWick = na bar_Line = left + math.floor((right - left) / 2) if is_new_period and not barstate.isrealtime draw_box(left, right, topBody, bottomBody, diff, color_growth, color_fall, color_border_growth, color_border_fall, width_border, border_styl) if show_Wicks draw_line(bar_Line, bar_Line, topBody, topWick, diff, color_wick_growth, color_wick_fall, style_Wick, width_Wicks) draw_line(bar_Line, bar_Line, bottomBody, bottomWick, diff, color_wick_growth, color_wick_fall, style_Wick, width_Wicks) if barstate.islast if is_new_period prev_box := na prev_topWick := na prev_bottomWick := na else box.delete(prev_box) line.delete(prev_topWick) line.delete(prev_bottomWick) prev_box := draw_box(left, right, topBody, bottomBody, diff, color_growth, color_fall, color_border_growth, color_border_fall, width_border, border_styl) if show_Wicks prev_topWick := draw_line(bar_Line, bar_Line, topBody, topWick, diff, color_wick_growth, color_wick_fall, style_Wick, width_Wicks) prev_bottomWick := draw_line(bar_Line, bar_Line, bottomBody, bottomWick, diff, color_wick_growth, color_wick_fall, style_Wick, width_Wicks)
OS AO (P-unity MACD)
https://www.tradingview.com/script/KX8TkjfT-OS-AO-P-unity-MACD/
ownsov
https://www.tradingview.com/u/ownsov/
104
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/ // © ownsov //@version=4 study("OS AO (P-unity MACD)") SlowLenght = input(34, minval=1, title="Slow Lenght") FastLenght = input(5, minval=1, title="Fast Lenght") FastSMA = sma(hl2, FastLenght) SlowSMA = sma(hl2, SlowLenght) AO = FastSMA - SlowSMA AOSMA = sma(AO, FastLenght) AOcolor = AO > AO [1] ? color.lime : color.red plot(AO, color=AOcolor, linewidth=4, style=plot.style_histogram) plot(AOSMA)
Lowest Close indicator
https://www.tradingview.com/script/c9nlPDN5-Lowest-Close-indicator/
onatski
https://www.tradingview.com/u/onatski/
63
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © onatski //@version=5 indicator("Lowest Close indicator", overlay=true) days = input(title="Days", defval = 40) //find lowest close in last 40 days lowest = close for i = 1 to days-1 if (close[i]<lowest) lowest := close[i] plot(lowest, "Lowest", color=#8E1599)
Keats_Indicator
https://www.tradingview.com/script/mXa1zzoY-Keats-Indicator/
tlak
https://www.tradingview.com/u/tlak/
21
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © tlak //@version=5 indicator("Keats_Indicator",overlay=true) len1=input(50,"First average") len2=input(150,"First average") len3=input(200,"First average") a1 = ta.sma(close, len1) a2 = ta.sma(close, len2) a3 = ta.sma(close, len3) a4=ta.sma(close,200)[22] a5= ta.lowest(close,365) a6=ta.highest(close,365) a7=ta.sma(volume,50) three_month_rs = 0.4*(close/close[13]) six_month_rs = 0.2*(close/(close[26]*2)) nine_month_rs = 0.2*(close/(close[39]*3)) twelve_month_rs = 0.2*(close/(close[52]*4)) rs = (three_month_rs + six_month_rs + nine_month_rs + twelve_month_rs) * 100 plotshape(close>a2 and close>a3 and a2>a3 and a3>a3[22] and a1>a2 and a1>a3 and close>a1 and close>(1.25*a5) and close>(0.75*a6) and rs> 70?low:na,style=shape.triangleup,location=location.belowbar,text="Buy",size=size.small)
Onats ADR
https://www.tradingview.com/script/b3u5vLNM-Onats-ADR/
onatski
https://www.tradingview.com/u/onatski/
3
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © onatski //@version=4 study("Onats ADR",precision=2) len = input(title="Daily Length", type=input.integer, defval = 7) mult = input(title="Multiplier", defval = 1.0) sum = 0.0 //calculate average daily range for i = 0 to len-1 sum := sum + high[i] - low[i] truncate(number, decimals) => factor = pow(10, decimals) int(number * factor) / factor adr = truncate((sum/len) * mult,2) plot(adr)
Volume Difference Indicator
https://www.tradingview.com/script/rhOpQqR1-Volume-Difference-Indicator/
tathal
https://www.tradingview.com/u/tathal/
68
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/ // © tathal // special thanks to oakwhiz for helping convert from another programming language //@version=4 study("OBV minus PVT") src = close float change_src = change(src) float i_obv = cum(change_src > 0 ? volume : change_src < 0 ? -volume : 0*volume) float i_pvt = pvt float result = i_obv - i_pvt plot(result, "OBV-PVT", color.red)
Circular Candlestick Chart
https://www.tradingview.com/script/3BjFD0A2-Circular-Candlestick-Chart/
alexgrover
https://www.tradingview.com/u/alexgrover/
442
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © alexgrover //@version=5 indicator("Circular Candlestick Chart",max_lines_count=500) length = input(25) width = input(200) spacing = input(7) precision = input(10) //---- upper = ta.highest(length) lower = ta.lowest(length) q75 = ta.percentile_linear_interpolation(close,length,75) q25 = ta.percentile_linear_interpolation(close,length,25) //---- n = bar_index if barstate.islast for element in line.all l = element line.delete(l[0]) for i = 0 to length-1 float prev_y = na int prev_x = na float prev_cy = na int prev_cx = na o = (open[i] - lower)/(upper - lower)*360 h = (high[i] - lower)/(upper - lower)*360 l = (low[i] - lower)/(upper - lower)*360 c = (close[i] - lower)/(upper - lower)*360 for j = l to h by precision x = (width-i*spacing)*math.sin(math.toradians(j)) y = (width-i*spacing)*math.cos(math.toradians(j)) line.new(prev_x,prev_y,n+math.round(x),y,color=color.gray) prev_y := y prev_x := n+math.round(x) for k = o to c by precision x = (width-i*spacing)*math.sin(math.toradians(k)) y = (width-i*spacing)*math.cos(math.toradians(k)) css = close[i] > open[i] ? #26a69a : #ef5350 line.new(prev_cx,prev_cy,n+math.round(x),y,color=css,width=2) prev_cy := y prev_cx := n+math.round(x) q75_deg = (q75 - lower)/(upper - lower)*360 q25_deg = (q25 - lower)/(upper - lower)*360 line.new(n,0,n+math.round(width*math.sin(math.toradians(q75_deg))),width*math.cos(math.toradians(q75_deg)) ,color=#2157f3,width=1,style=line.style_dotted) line.new(n,0,n+math.round(width*math.sin(math.toradians(q25_deg))),width*math.cos(math.toradians(q25_deg)) ,color=#ff5d00,width=1,style=line.style_dotted)
Compression support&resistance [LM]
https://www.tradingview.com/script/JgllZX2G-Compression-support-resistance-LM/
lmatl
https://www.tradingview.com/u/lmatl/
297
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © lmatl //@version=5 indicator('Compression support&resistance [LM]', shorttitle='Compression S/R [LM]', overlay=true, max_bars_back=4990) i_offsetVal = input.int(0, 'Label Offset', group='General settings') i_showLabels = input.bool(true, 'Show Labels', group='General settings') i_volumeFilter = input.bool(true, 'Volume filter', group='General settings') i_volatilityFilter = input.bool(false, 'Volatility filter', group='General settings') i_volatilityPercentage = input.int(5, 'Volatility percentage', group='General settings') i_volatilityLookBackPeriod = input.int(5, 'volatility lookback period', group='General settings') i_hideLines = input.bool(false, 'hide lines', group='current resolution S/R setting') i_lineCount = input.int(10, 'line count', group='current resolution S/R setting') i_candleHighColor = input.color(color.lime, 'candle high color', group='current resolutionS/R setting') i_candleLowColor = input.color(color.maroon, 'candle low color', group='current resolutionS/R setting') i_candleExtendLines = input.bool(true, 'extend lines', group='current resolutionS/R setting') i_candleLineWidth = input.int(2, 'line width', minval=1, maxval=4, group='current resolutionS/R setting') i_secondTimeFrame = input.timeframe('M', 'resolution', group='second S/R setting') i_secondCandleHighColor = input.color(color.aqua, 'candle high color', group='second S/R setting') i_secondCandleLowColor = input.color(color.blue, 'candle low color', group='second S/R setting') i_secondCandleLineWidth = input.int(2, 'line width', minval=1, maxval=4, group='second S/R setting') i_showSecondSR1 = input.bool(true, 'Show S/R 1', group='second S/R setting') i_showSecondSR2 = input.bool(true, 'Show S/R 2', group='second S/R setting') i_showSecondSR3 = input.bool(false, 'Show S/R 3', group='second S/R setting') i_showSecondSR4 = input.bool(false, 'Show S/R 4', group='second S/R setting') i_thirdTimeFrame = input.timeframe('W', 'resolution', group='third S/R setting') i_thirdCandleHighColor = input.color(color.red, 'candle high color', group='third S/R setting') i_thirdCandleLowColor = input.color(color.maroon, 'candle low color', group='third S/R setting') i_thirdCandleLineWidth = input.int(2, 'line width', minval=1, maxval=4, group='third S/R setting') i_showThirdSR1 = input.bool(true, 'Show S/R 1', group='third S/R setting') i_showThirdSR2 = input.bool(true, 'Show S/R 2', group='third S/R setting') i_showThirdSR3 = input.bool(false, 'Show S/R 3', group='third S/R setting') i_showThirdSR4 = input.bool(false, 'Show S/R 4', group='third S/R setting') i_fourthTimeFrame = input.timeframe('D', 'resolution', group='fourth S/R setting') i_fourthCandleHighColor = input.color(color.lime, 'candle high color', group='fourth S/R setting') i_fourthCandleLowColor = input.color(color.olive, 'candle low color', group='fourth S/R setting') i_fourthCandleLineWidth = input.int(2, 'line width', minval=1, maxval=4, group='fourth S/R setting') i_showFourthSR1 = input.bool(false, 'Show S/R 1', group='fourth S/R setting') i_showFourthSR2 = input.bool(false, 'Show S/R 2', group='fourth S/R setting') i_showFourthSR3 = input.bool(false, 'Show S/R 3', group='fourth S/R setting') i_showFourthSR4 = input.bool(false, 'Show S/R 4', group='fourth S/R setting') // functions f_drawLine(_x1, _x2, _yValue, _lineColor, _style, _width) => line.new(x1=_x1, y1=_yValue, x2=_x2, y2=_yValue, color=_lineColor, style=_style, width=_width) f_extendArray(_lineArray, _extendLines) => if array.size(_lineArray) > 0 for _i = array.size(_lineArray) - 1 to 0 by 1 x2 = line.get_x2(array.get(_lineArray, _i)) yValue = line.get_y1(array.get(_lineArray, _i)) if _extendLines or bar_index - 1 == x2 and not(high >= yValue and low <= yValue) line.set_x2(array.get(_lineArray, _i), bar_index) f_barssince(_cond, _count) => _barssince = bar_index - ta.valuewhen(_cond, bar_index, _count) _barssince f_compressionCondition(_isVolumeFilter) => c1 = high[2] >= high[1] and low[2] <= low[1] c2 = high[1] >= high and low[1] <= low volumeCond = volume[2] > volume[1] and volume[1] > volume isPercentageChangeEnough = false for i = 0 to i_volatilityLookBackPeriod - 1 by 1 if (low[i] - close) / close >= i_volatilityPercentage / 100 or (high[i] - close) / close >= i_volatilityPercentage / 100 isPercentageChangeEnough := true break isCond = c1 and c2 and (_isVolumeFilter ? volumeCond : true) and (i_volatilityFilter ? isPercentageChangeEnough : true) isCond f_mutitimeframeCompressionCondition(_isVolumeFilter, _occurence) => c1 = high[2] >= high[1] and low[2] <= low[1] c2 = high[1] >= high and low[1] <= low volumeCond = volume[2] > volume[1] and volume[1] > volume isPercentageChangeEnough = false for i = 0 to i_volatilityLookBackPeriod - 1 by 1 if (low[i] - close) / close >= i_volatilityPercentage / 100 or (high[i] - close) / close >= i_volatilityPercentage / 100 isPercentageChangeEnough := true break isCond = c1 and c2 and (_isVolumeFilter ? volumeCond : true) and (i_volatilityFilter ? isPercentageChangeEnough : true) index = f_barssince(isCond, _occurence) compressionHigh = na(index) ? na : high[index + 1] compressionLow = na(index) ? na : low[index + 1] [compressionHigh, compressionLow] f_drawLabel(_yValue, _xValue, _labelColor, _text, _showLabels) => var label lb = na label.delete(lb) if _showLabels and not na(_yValue) lb := label.new(x=_xValue, y=_yValue, text=_text, textcolor=_labelColor, style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price) lb lb isCond = f_compressionCondition(i_volumeFilter) // array init var lineArray = array.new_line() float yValue = na int x1 = na int x2 = na line l = na // current timeframe if isCond and not i_hideLines yValue := high[1] x1 := bar_index[1] x2 := bar_index l := f_drawLine(x1, x2, yValue, i_candleHighColor, line.style_dotted, i_candleLineWidth) if array.size(lineArray) == i_lineCount line.delete(array.shift(lineArray)) array.push(lineArray, l) yValue := low[1] l := f_drawLine(x1, x2, yValue, i_candleLowColor, line.style_dotted, i_candleLineWidth) if array.size(lineArray) == i_lineCount line.delete(array.shift(lineArray)) array.push(lineArray, l) f_extendArray(lineArray, i_candleExtendLines) // other time frames diffTime = na(time[1]) ? time : math.min(time, time - time[1]) firstValue = time + diffTime * (i_offsetVal + 30) secondValue = time + diffTime * (i_offsetVal + 60) thirdValue = time + diffTime * (i_offsetVal + 90) // Second timeframe [secondH1, secondL1] = request.security(syminfo.tickerid, i_secondTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 0)) [secondH2, secondL2] = request.security(syminfo.tickerid, i_secondTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 1)) [secondH3, secondL3] = request.security(syminfo.tickerid, i_secondTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 2)) [secondH4, secondL4] = request.security(syminfo.tickerid, i_secondTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 3)) plot(i_showSecondSR1 ? secondH1 : na, title='Second High 1', linewidth=2, color=i_secondCandleHighColor, show_last=1, trackprice=true) plot(i_showSecondSR1 ? secondL1 : na, title='Second Low 1', linewidth=2, color=i_secondCandleLowColor, show_last=1, trackprice=true) plot(i_showSecondSR2 ? secondH2 : na, title='Second High 2', linewidth=2, color=i_secondCandleHighColor, show_last=1, trackprice=true) plot(i_showSecondSR2 ? secondL2 : na, title='Second Low 2', linewidth=2, color=i_secondCandleLowColor, show_last=1, trackprice=true) plot(i_showSecondSR3 ? secondH3 : na, title='Second High 3', linewidth=2, color=i_secondCandleHighColor, show_last=1, trackprice=true) plot(i_showSecondSR3 ? secondL3 : na, title='Second Low 3', linewidth=2, color=i_secondCandleLowColor, show_last=1, trackprice=true) plot(i_showSecondSR4 ? secondH4 : na, title='Second High 4', linewidth=2, color=i_secondCandleHighColor, show_last=1, trackprice=true) plot(i_showSecondSR4 ? secondL4 : na, title='Second Low 4', linewidth=2, color=i_secondCandleLowColor, show_last=1, trackprice=true) f_drawLabel(secondH1, firstValue, i_secondCandleHighColor, i_secondTimeFrame + ' High 1', i_showSecondSR1 and i_showLabels) f_drawLabel(secondL1, firstValue, i_secondCandleLowColor, i_secondTimeFrame + ' Low 1', i_showSecondSR1 and i_showLabels) f_drawLabel(secondH2, firstValue, i_secondCandleHighColor, i_secondTimeFrame + ' High 2', i_showSecondSR2 and i_showLabels) f_drawLabel(secondL2, firstValue, i_secondCandleLowColor, i_secondTimeFrame + ' Low 2', i_showSecondSR2 and i_showLabels) f_drawLabel(secondH3, firstValue, i_secondCandleHighColor, i_secondTimeFrame + ' High 3', i_showSecondSR3 and i_showLabels) f_drawLabel(secondL3, firstValue, i_secondCandleLowColor, i_secondTimeFrame + ' Low 3', i_showSecondSR3 and i_showLabels) f_drawLabel(secondH4, firstValue, i_secondCandleHighColor, i_secondTimeFrame + ' High 4', i_showSecondSR4 and i_showLabels) f_drawLabel(secondL4, firstValue, i_secondCandleLowColor, i_secondTimeFrame + 'Low 4', i_showSecondSR4 and i_showLabels) // Third timeframe [thirdH1, thirdL1] = request.security(syminfo.tickerid, i_thirdTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 0)) [thirdH2, thirdL2] = request.security(syminfo.tickerid, i_thirdTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 1)) [thirdH3, thirdL3] = request.security(syminfo.tickerid, i_thirdTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 2)) [thirdH4, thirdL4] = request.security(syminfo.tickerid, i_thirdTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 3)) plot(i_showThirdSR1 ? thirdH1 : na, title='Third High 1', linewidth=i_thirdCandleLineWidth, color=i_thirdCandleHighColor, show_last=1, trackprice=true) plot(i_showThirdSR1 ? thirdL1 : na, title='Third Low 1', linewidth=i_thirdCandleLineWidth, color=i_thirdCandleLowColor, show_last=1, trackprice=true) plot(i_showThirdSR2 ? thirdH2 : na, title='Third High 2', linewidth=i_thirdCandleLineWidth, color=i_thirdCandleHighColor, show_last=1, trackprice=true) plot(i_showThirdSR2 ? thirdL2 : na, title='Third Low 2', linewidth=i_thirdCandleLineWidth, color=i_thirdCandleLowColor, show_last=1, trackprice=true) plot(i_showThirdSR3 ? thirdH3 : na, title='Third High 3', linewidth=i_thirdCandleLineWidth, color=i_thirdCandleHighColor, show_last=1, trackprice=true) plot(i_showThirdSR3 ? thirdL3 : na, title='Third Low 3', linewidth=i_thirdCandleLineWidth, color=i_thirdCandleLowColor, show_last=1, trackprice=true) plot(i_showThirdSR4 ? thirdH4 : na, title='Third High 4', linewidth=i_thirdCandleLineWidth, color=i_thirdCandleHighColor, show_last=1, trackprice=true) plot(i_showThirdSR4 ? thirdL4 : na, title='Third Low 4', linewidth=i_thirdCandleLineWidth, color=i_thirdCandleLowColor, show_last=1, trackprice=true) f_drawLabel(thirdH1, secondValue, i_thirdCandleHighColor, i_thirdTimeFrame + ' High 1', i_showThirdSR1 and i_showLabels) f_drawLabel(thirdL1, secondValue, i_thirdCandleLowColor, i_thirdTimeFrame + ' Low 1', i_showThirdSR1 and i_showLabels) f_drawLabel(thirdH2, secondValue, i_thirdCandleHighColor, i_thirdTimeFrame + ' High 2', i_showThirdSR2 and i_showLabels) f_drawLabel(thirdL2, secondValue, i_thirdCandleLowColor, i_thirdTimeFrame + ' Low 2', i_showThirdSR2 and i_showLabels) f_drawLabel(thirdH3, secondValue, i_thirdCandleHighColor, i_thirdTimeFrame + ' High 3', i_showThirdSR3 and i_showLabels) f_drawLabel(thirdL3, secondValue, i_thirdCandleLowColor, i_thirdTimeFrame + ' Low 3', i_showThirdSR3 and i_showLabels) f_drawLabel(thirdH4, secondValue, i_thirdCandleHighColor, i_thirdTimeFrame + ' High 4', i_showThirdSR4 and i_showLabels) f_drawLabel(thirdL4, secondValue, i_thirdCandleLowColor, i_thirdTimeFrame + ' Low 4', i_showThirdSR4 and i_showLabels) // Fourth timeframe [fourthH1, fourthL1] = request.security(syminfo.tickerid, i_fourthTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 0)) [fourthH2, fourthL2] = request.security(syminfo.tickerid, i_fourthTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 1)) [fourthH3, fourthL3] = request.security(syminfo.tickerid, i_fourthTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 2)) [fourthH4, fourthL4] = request.security(syminfo.tickerid, i_fourthTimeFrame, f_mutitimeframeCompressionCondition(i_volumeFilter, 3)) plot(i_showFourthSR1 ? fourthH1 : na, title='Fourth High 1', linewidth=i_fourthCandleLineWidth, color=i_fourthCandleHighColor, show_last=1, trackprice=true) plot(i_showFourthSR1 ? fourthL1 : na, title='Fourth Low 1', linewidth=i_fourthCandleLineWidth, color=i_fourthCandleLowColor, show_last=1, trackprice=true) plot(i_showFourthSR2 ? fourthH2 : na, title='Fourth High 2', linewidth=i_fourthCandleLineWidth, color=i_fourthCandleHighColor, show_last=1, trackprice=true) plot(i_showFourthSR2 ? fourthL2 : na, title='Fourth Low 2', linewidth=i_fourthCandleLineWidth, color=i_fourthCandleLowColor, show_last=1, trackprice=true) plot(i_showFourthSR3 ? fourthH3 : na, title='Fourth High 3', linewidth=i_fourthCandleLineWidth, color=i_fourthCandleHighColor, show_last=1, trackprice=true) plot(i_showFourthSR3 ? fourthL3 : na, title='Fourth Low 3', linewidth=i_fourthCandleLineWidth, color=i_fourthCandleLowColor, show_last=1, trackprice=true) plot(i_showFourthSR4 ? fourthH4 : na, title='Fourth High 4', linewidth=i_fourthCandleLineWidth, color=i_fourthCandleHighColor, show_last=1, trackprice=true) plot(i_showFourthSR4 ? fourthL4 : na, title='Fourth Low 4', linewidth=i_fourthCandleLineWidth, color=i_fourthCandleLowColor, show_last=1, trackprice=true) f_drawLabel(fourthH1, thirdValue, i_fourthCandleHighColor, i_fourthTimeFrame + ' High 1', i_showFourthSR1 and i_showLabels) f_drawLabel(fourthL1, thirdValue, i_fourthCandleLowColor, i_fourthTimeFrame + ' Low 1', i_showFourthSR1 and i_showLabels) f_drawLabel(fourthH2, thirdValue, i_fourthCandleHighColor, i_fourthTimeFrame + ' High 2', i_showFourthSR2 and i_showLabels) f_drawLabel(fourthL2, thirdValue, i_fourthCandleLowColor, i_fourthTimeFrame + ' Low 2', i_showFourthSR2 and i_showLabels) f_drawLabel(fourthH3, thirdValue, i_fourthCandleHighColor, i_fourthTimeFrame + ' High 3', i_showFourthSR3 and i_showLabels) f_drawLabel(fourthL3, thirdValue, i_fourthCandleLowColor, i_fourthTimeFrame + ' Low 3', i_showFourthSR3 and i_showLabels) f_drawLabel(fourthH4, thirdValue, i_fourthCandleHighColor, i_fourthTimeFrame + ' High 4', i_showFourthSR4 and i_showLabels) f_drawLabel(fourthL4, thirdValue, i_fourthCandleLowColor, i_fourthTimeFrame + ' Low 4', i_showFourthSR4 and i_showLabels)
OWRS Volatililility
https://www.tradingview.com/script/HRlUPLSB-OWRS-Volatililility/
Eliza123123
https://www.tradingview.com/u/Eliza123123/
66
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Eliza123123 //@version=5 indicator('The Ocean makes Waves which turn to Ripples which wash onto the Sand', overlay=false) referenceOCEAN = input('BINANCE:OCEANUSDTPERP', 'Reference market') referenceWAVES = input('BINANCE:WAVESUSDTPERP', 'Reference market') referenceXRP = input('BINANCE:XRPUSDTPERP', 'Reference market') referenceSAND = input('BINANCE:SANDUSDTPERP', 'Reference market') a = math.abs(high-low) - (math.abs(high-low))[1] rdOCEAN = request.security(symbol=referenceOCEAN, timeframe=timeframe.period, expression=a*27) rdWAVES = request.security(symbol=referenceWAVES, timeframe=timeframe.period, expression=a) rdXRP = request.security(symbol=referenceXRP, timeframe=timeframe.period, expression=a*27) rdSAND = request.security(symbol=referenceSAND, timeframe=timeframe.period, expression=a*27) rdOCEANChaos = (rdOCEAN + rdOCEAN[1] + rdOCEAN[2] + rdOCEAN[3]) rdWAVESChaos = (rdWAVES + rdWAVES[1] + rdWAVES[2] + rdWAVES[3]) rdXRPChaos = (rdXRP + rdXRP[1] + rdXRP[2] + rdXRP[3]) rdSANDChaos = (rdSAND + rdSAND[1] + rdSAND[2] + rdSAND[3]) ANP = (rdOCEANChaos + rdWAVESChaos + rdXRPChaos + rdSANDChaos) / 4 stdevANP = ta.stdev(ANP, 27) plot(ANP + stdevANP, color = color.new(color.fuchsia, 0)) plot(ANP + (2*stdevANP), color = color.new(#FF0051, 0)) plot(ANP + (3*stdevANP), color = color.new(#FF00BB, 0)) plot(ANP + (4*stdevANP), color = color.new(color.lime, 0)) plot(ANP - stdevANP, color = color.new(color.fuchsia, 0)) plot(ANP - (2*stdevANP), color = color.new(#FF0051, 0)) plot(ANP - (3*stdevANP), color = color.new(#FF00BB, 0)) plot(ANP - (4*stdevANP), color = color.new(color.lime, 0)) plot(rdOCEANChaos, color = (rdOCEANChaos > ANP + (4*stdevANP)) or (rdOCEANChaos < ANP - (4*stdevANP))? color.new(color.yellow, 0) : color.new(#0000FF, 0), style = plot.style_stepline_diamond) plot(rdWAVESChaos, color = (rdWAVESChaos > ANP + (4*stdevANP)) or (rdWAVESChaos < ANP - (4*stdevANP))? color.new(color.yellow, 0) : color.new(color.white, 0), style = plot.style_stepline_diamond) plot(rdXRPChaos, color = (rdXRPChaos > ANP + (4*stdevANP)) or (rdXRPChaos < ANP - (4*stdevANP))? color.new(color.yellow, 0) : color.new(#00FFFB, 0), style = plot.style_stepline_diamond) plot(rdSANDChaos, color = (rdSANDChaos > ANP + (4*stdevANP)) or (rdSANDChaos < ANP - (4*stdevANP))? color.new(color.yellow, 0) : color.new(#E1AA80, 0), style = plot.style_stepline_diamond) yellowbg = 0 if (rdOCEANChaos > ANP + (4*stdevANP)) or (rdOCEANChaos < ANP - (4*stdevANP)) or (rdWAVESChaos > ANP + (4*stdevANP)) or (rdWAVESChaos < ANP - (4*stdevANP)) or (rdXRPChaos > ANP + (4*stdevANP)) or (rdXRPChaos < ANP - (4*stdevANP)) or (rdSANDChaos > ANP + (4*stdevANP)) or (rdSANDChaos < ANP - (4*stdevANP)) yellowbg := 1 bgcolor(color = yellowbg == 1 ? color.yellow : color.blue, transp = 75)
Order Blocks
https://www.tradingview.com/script/WR5Gzsrs-Order-Blocks/
pmk07
https://www.tradingview.com/u/pmk07/
1,215
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © pmk07 // // Acknowledgements/Reference: // // @rumpypumpydumpy - Higher Order Pivots // https://www.tradingview.com/v/x2LlRvBe/ // // @MarkMiddleton2020 - Order Blocks // https://www.tradingview.com/v/GecN34Qq/ // //@version=5 indicator(title='Order Blocks', overlay=true) string bos_type = input.string ("High and Low", title='MSB trigger', options=["High and Low", "Close and Open"]) bool pv2_sv = input.bool (true, title='Display 2nd order pivots') bool bos_sv = input.bool (true, title='Highlight candles that broke structure') bool msb_sv = input.bool (true, title='Plot market structure broke lines') bool box_sv = input.bool (true, title='Plot demand boxes') int box_test_delay = input.int (3, title='Delay to count test of demand box') int box_fill_delay = input.int (3, title='Delay to count fill of demand box') bool box_test_sv = input.bool (true, title='Dim tested demand boxes') bool box_stop_sv = input.bool (true, title='Stop plotting filled demand boxes') var float[] pvh1_price = array.new_float (1000, na) // high var int[] pvh1_time = array.new_int (1000, na) var float[] pvl1_price = array.new_float (1000, na) // low var int[] pvl1_time = array.new_int (1000, na) var float[] pvh2_price = array.new_float (1000, na) // higher high var int[] pvh2_time = array.new_int (1000, na) var float[] pvl2_price = array.new_float (1000, na) // lower low var int[] pvl2_time = array.new_int (1000, na) var float htcmrll_price = na // high that created most recent ll var int htcmrll_time = na var float ltcmrhh_price = na // low that created most recent hh var int ltcmrhh_time = na var box[] long_boxes = array.new_box() var box[] short_boxes = array.new_box() var box[] oldlong_boxes = array.new_box() var box[] oldshort_boxes = array.new_box() var line[] bull_bos_lines = array.new_line() var line[] bear_bos_lines = array.new_line() var label[] la_ph2 = array.new_label (1000, na) var label[] la_pl2 = array.new_label (1000, na) var float temp_pv_0 = na var float temp_pv_1 = na var float temp_pv_2 = na bool pvh = high < high[1] and high[1] > high[2] bool pvl = low > low[1] and low[1] < low[2] int pv1_time = bar_index[1] float pv1_high = high[1] float pv1_low = low[1] float trigger_high = bos_type=="High and Low" ? high : math.max(open, close) float trigger_low = bos_type=="High and Low" ? low : math.min(open, close) bool bos_candle = false bool new_ph_2nd = false bool new_pl_2nd = false if barstate.isconfirmed if pvh array.pop(pvh1_price) array.pop(pvh1_time) array.unshift(pvh1_price, pv1_high) array.unshift(pvh1_time, pv1_time) if array.size(pvh1_price) > 2 temp_pv_0 := array.get(pvh1_price, 0) temp_pv_1 := array.get(pvh1_price, 1) temp_pv_2 := array.get(pvh1_price, 2) if temp_pv_0 > temp_pv_1 for i = 0 to array.size(pvl1_time) - 1 by 1 temp_ltcmrhh_time = array.get(pvl1_time, i) if temp_ltcmrhh_time < array.get(pvh1_time, 0) ltcmrhh_price := array.get(pvl1_price, i) ltcmrhh_time := temp_ltcmrhh_time break if temp_pv_0 < temp_pv_1 and temp_pv_1 > temp_pv_2 array.pop(pvh2_price) array.pop(pvh2_time) array.unshift(pvh2_price, temp_pv_1) array.unshift(pvh2_time, array.get(pvh1_time, 1)) new_ph_2nd := true if pvl array.pop(pvl1_price) array.pop(pvl1_time) array.unshift(pvl1_price, pv1_low) array.unshift(pvl1_time, pv1_time) if array.size(pvl1_price) > 2 temp_pv_0 := array.get(pvl1_price, 0) temp_pv_1 := array.get(pvl1_price, 1) temp_pv_2 := array.get(pvl1_price, 2) if temp_pv_0 < temp_pv_1 for i = 0 to array.size(pvh1_time) - 1 by 1 temp_htcmrll_time = array.get(pvh1_time, i) if temp_htcmrll_time < array.get(pvl1_time, 0) htcmrll_price := array.get(pvh1_price, i) htcmrll_time := temp_htcmrll_time break if temp_pv_0 > temp_pv_1 and temp_pv_1 < temp_pv_2 array.pop(pvl2_price) array.pop(pvl2_time) array.unshift(pvl2_price, temp_pv_1) array.unshift(pvl2_time, array.get(pvl1_time, 1)) new_pl_2nd := true if trigger_high > htcmrll_price if msb_sv array.push(bull_bos_lines, line.new(x1=htcmrll_time, y1=htcmrll_price, x2=bar_index, y2=htcmrll_price, color=color.red, width=2)) if box_sv array.push(long_boxes, box.new(left=array.get(pvl1_time, 0), top=math.min(high[bar_index - array.get(pvl1_time, 0)], high[bar_index - array.get(pvl1_time, 0) + 1]), right=bar_index, bottom=array.get(pvl1_price, 0), bgcolor=color.rgb(0, 255, 0, 80), border_color=color.rgb(0, 255, 0, 80), extend=extend.right)) bos_candle := true htcmrll_price := na htcmrll_price if trigger_low < ltcmrhh_price if msb_sv array.push(bear_bos_lines, line.new(x1=ltcmrhh_time, y1=ltcmrhh_price, x2=bar_index, y2=ltcmrhh_price, color=color.green, width=2)) if box_sv array.push(short_boxes, box.new(left=array.get(pvh1_time, 0), top=array.get(pvh1_price, 0), right=bar_index, bottom=math.max(low[bar_index - array.get(pvh1_time, 0)], low[bar_index - array.get(pvh1_time, 0) + 1]), bgcolor=color.rgb(255, 0, 0, 80), border_color=color.rgb(255, 0, 0, 80), extend=extend.right)) bos_candle := true ltcmrhh_price := na ltcmrhh_price if array.size(short_boxes) > 0 for i = array.size(short_boxes) - 1 to 0 by 1 tbox = array.get(short_boxes, i) top = box.get_top(tbox) bottom = box.get_bottom(tbox) if trigger_high > bottom and box.get_left(tbox) + box_test_delay < bar_index and box_test_sv box.set_bgcolor(tbox, color.rgb(192, 192, 192, 80)) box.set_border_color(tbox, color.rgb(192, 192, 192, 80)) if trigger_high > top and box.get_left(tbox) + box_fill_delay < bar_index if box_stop_sv box.set_right(tbox, bar_index) box.set_extend(tbox, extend.none) array.unshift(oldshort_boxes, tbox) array.remove(short_boxes, i) if array.size(long_boxes) > 0 for i = array.size(long_boxes) - 1 to 0 by 1 lbox = array.get(long_boxes, i) top = box.get_top(lbox) bottom = box.get_bottom(lbox) if trigger_low < top and box.get_left(lbox) + box_test_delay < bar_index and box_test_sv box.set_bgcolor(lbox, color.rgb(192, 192, 192, 80)) box.set_border_color(lbox, color.rgb(192, 192, 192, 80)) if trigger_low < bottom and box.get_left(lbox) + box_fill_delay < bar_index if box_stop_sv box.set_right(lbox, bar_index) box.set_extend(lbox, extend.none) array.unshift(oldlong_boxes, lbox) array.remove(long_boxes, i) if pv2_sv if new_ph_2nd array.pop(la_ph2) array.unshift(la_ph2, label.new(x = array.get(pvh2_time, 0), y = array.get(pvh2_price, 0), xloc = xloc.bar_index, style = label.style_label_down, color = #770000FF, size = size.tiny)) if new_pl_2nd array.pop(la_pl2) array.unshift(la_pl2, label.new(x = array.get(pvl2_time, 0), y = array.get(pvl2_price, 0), xloc = xloc.bar_index, style = label.style_label_up, color = #007700FF, size = size.tiny)) barcolor(bos_candle and bos_sv ? color.yellow : na)
Confluence Candles
https://www.tradingview.com/script/rhE9Itaw-Confluence-Candles/
TheTradeEngine
https://www.tradingview.com/u/TheTradeEngine/
172
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/ // © TheTradeEngine //@version=4 study("Confluence Candles", overlay=true) includeSymbol1 = input(true, "Include Symbol 1?", group = "Symbols") useCurrentChartAsSymbol1 = input(true, "Use current chart's symbol as Symbol 1", group = "Symbols") symbol1 = input("", "Symbol 1", group = "Symbols") includeSymbol2 = input(false, "Include Symbol 2?", group = "Symbols") symbol2 = input("", "Symbol 2", group = "Symbols") includeSymbol3 = input(false, "Include Symbol 3?", group = "Symbols") symbol3 = input("", "Symbol 3", group = "Symbols") includeSymbol4 = input(false, "Include Symbol 4?", group = "Symbols") symbol4 = input("", "Symbol 4", group = "Symbols") // Kill Switch for if no instruments were selected killSwitch = not includeSymbol1 and not includeSymbol2 and not includeSymbol3 and not includeSymbol4 includeRsi = input(true, "Include RSI", group = "RSI") rsiLength = input(7, "RSI Length", group = "RSI") rsiBullThreshold = input(50, "RSI Bull Threshold", group = "RSI") rsiBearThreshold = input(50, "RSI Bear Threshold", group = "RSI") includeStoch = input(true, "Include Stochastic", group = "Stochastic") periodK = input(14, title="%K Length", minval=1, group = "Stochastic") smoothK = input(1, title="%K Smoothing", minval=1, group = "Stochastic") periodD = input(3, title="%D Smoothing", minval=1, group = "Stochastic") useStochD = input(false, "Use Stochastic D instead of K", group = "Stochastic") stochBullThreshold = input(50, "Stochastic Bull Threshold", group = "Stochastic") stochBearThreshold = input(50, "Stochastic Bear Threshold", group = "Stochastic") includeMacdHist = input(true, "Include MACD Histogram", group = "MACD") macdFastLength = input(12, "MACD Fast Length", group = "MACD") macdSlowLength = input(26, "MACD Slow Length", group = "MACD") macdSignalLength = input(9, "MACD Signal Length", group = "MACD") // Kill Switch for if no indicators are selected confluenceKillSwitch = not includeMacdHist and not includeRsi and not includeStoch stochastic(periodK, smoothK, periodD) => k = sma(stoch(close, high, low, periodK), smoothK) d = sma(k, periodD) output = useStochD ? d : k confluence() => [_, _, histLine] = macd(close, macdFastLength, macdSlowLength, macdSignalLength) rsiLine = rsi(close, rsiLength) stochLine = stochastic(periodK, smoothK, periodD) histBull = includeMacdHist ? histLine > 0 : true histBear = includeMacdHist ? histLine <= 0 : true rsiBull = includeRsi ? rsiLine > rsiBullThreshold : true rsiBear = includeRsi ? rsiLine < rsiBearThreshold : true stochBull = includeStoch ? stochLine > stochBullThreshold : true stochBear = includeStoch ? stochLine < stochBearThreshold : true signal = histBull and rsiBull and stochBull and not confluenceKillSwitch ? 1 : histBear and rsiBear and stochBear and not confluenceKillSwitch ? -1 : 0 confluenceSymbol1 = useCurrentChartAsSymbol1 ? confluence() : security(symbol1, "", confluence()) confluenceSymbol2 = security(symbol2, "", confluence()) confluenceSymbol3 = security(symbol3, "", confluence()) confluenceSymbol4 = security(symbol4, "", confluence()) symbol1BullFilter = includeSymbol1 ? confluenceSymbol1 == 1 : true symbol1BearFilter = includeSymbol1 ? confluenceSymbol1 == -1 : true symbol2BullFilter = includeSymbol2 ? confluenceSymbol2 == 1 : true symbol2BearFilter = includeSymbol2 ? confluenceSymbol2 == -1 : true symbol3BullFilter = includeSymbol3 ? confluenceSymbol3 == 1 : true symbol3BearFilter = includeSymbol3 ? confluenceSymbol3 == -1 : true symbol4BullFilter = includeSymbol4 ? confluenceSymbol4 == 1 : true symbol4BearFilter = includeSymbol4 ? confluenceSymbol4 == -1 : true bullish = symbol1BullFilter and symbol2BullFilter and symbol3BullFilter and symbol4BullFilter and not killSwitch bearish = symbol1BearFilter and symbol2BearFilter and symbol3BearFilter and symbol4BearFilter and not killSwitch barcolor(bullish ? #00FF00 : bearish ? #FF0000 : color.gray) // Alerts greenCandleAlerts = input(true, "Alerts for candle color changing to GREEN", group="Alerts") redCandleAlerts = input(true, "Alerts for candle color changing to RED", group="Alerts") grayCandleAlerts = input(true, "Alerts for candle color changing to GRAY", group="Alerts") if (greenCandleAlerts and bullish and not bullish[1]) alert("Candle color changed to GREEN", alert.freq_once_per_bar_close) if (redCandleAlerts and bearish and not bearish[1]) alert("Candle color changed to RED", alert.freq_once_per_bar_close) if (grayCandleAlerts and not bullish and not bearish and (bullish[1] or bearish[1])) alert("Candle color changed to GRAY", alert.freq_once_per_bar_close)
HLC Trend multi tester
https://www.tradingview.com/script/QpW3dMz0-HLC-Trend-multi-tester/
cmartin81
https://www.tradingview.com/u/cmartin81/
5
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © cmartin81 //@version=5 indicator("HLC Trend tester",timeframe="", timeframe_gaps=true) startDate = input.time(timestamp("01 Jan 2021 00:00 +0000"), "Start", group="Dates") endDate = input.time(timestamp("22 Oct 2099 00:00 +0000"), "end", group="Dates") dateRange() => time >= startDate and time <= endDate ? true : false // specify where date range is true //lowType = input.string(title="Low moving average type", defval="EMA", options=["SMA", "EMA", "DEMA", "HMA", "TEMA", "WMA", "VWMA", "SMMA"], group="low") lowLength = input(5, group="low") closeType = input.string(title="Close moving average type", defval="EMA", options=["SMA", "EMA", "DEMA", "HMA", "TEMA", "WMA", "VWMA", "SMMA"], group="close") closeLength = input(4, group="close") //highType = input.string(title="High moving average type", defval="EMA", options=["SMA", "EMA", "DEMA", "HMA", "TEMA", "WMA", "VWMA", "SMMA"], group="high") highLength = input(36, group="high") color_1 = color.aqua // #00BCD4 color_2 = color.blue // #2196F3 color_3 = color.teal // #00897B color_4 = color.green // #4CAF50 color_5 = color.olive // #808000 color_6 = color.lime // #00E676 color_7 = color.yellow // #FFEB3B color_8 = color.orange // #FF9800 color_9 = color.maroon // #880E4F color_10 = color.red // #FF5252 color_11 = color.fuchsia // #E040FB color_12 = color.purple // #9C27B0 color_13 = color.navy // #311B92 color_14 = color.black // #363A45 color_15 = color.gray // #787B86 color_16 = color.silver // #B2B5BE color_17 = color.white // #FFFFFF // Indicator based on article found on TrendXplorer.com _smma(src, length) => smma = 0.0 smma := na(smma[1]) ? ta.sma(src, length) : (smma[1] * (length - 1) + src) / length smma _dema(src, length) => e1 = ta.ema(src, length) e2 = ta.ema(e1, length) 2 * e1 - e2 _tema(src, length) => ema1 = ta.ema(src, length) ema2 = ta.ema(ema1, length) ema3 = ta.ema(ema2, length) 3 * (ema1 - ema2) + ema3 _em(type, src, maLength) => switch type "SMA" => ta.sma(src, maLength) "EMA" => ta.ema(src, maLength) "DEMA" => _dema(src, maLength) "HMA" => ta.hma(src, maLength) "TEMA" => _tema(src, maLength) "WMA" => ta.wma(src, maLength) "VWMA" => ta.vwma(src, maLength) "SMMA" => _smma(src, maLength) => runtime.error(type) float(na) hlcTrend(highType, closeType, lowType) => maLow = _em(lowType, low, lowLength) maClose = _em(closeType, close, closeLength) maHigh = _em(highType, high, highLength) bullLine = maClose-maHigh bearLine = maLow-maClose buy = ta.crossover(bullLine, bearLine) sell = ta.crossover(bearLine, bullLine) [buy, sell] // SMA - SMA var lastBuyPrice1 = 0.0 var result1 = 100.0 [buy1,sell1] = hlcTrend('SMA', closeType, 'SMA') if dateRange() and buy1 and lastBuyPrice1 == 0 lastBuyPrice1 := close else if dateRange() and sell1 and lastBuyPrice1 != 0 result1 := close/lastBuyPrice1 * result1 lastBuyPrice1 := 0.0 plot(result1 - 100, title="SMA-SMA", color=color.new(color_1, 0)) // SMA - EMA var lastBuyPrice2 = 0.0 var result2 = 100.0 [buy2,sell2] = hlcTrend('SMA', closeType, 'EMA') if dateRange() and buy2 and lastBuyPrice2 == 0 lastBuyPrice2 := close else if dateRange() and sell2 and lastBuyPrice2 != 0 result2 := close/lastBuyPrice2 * result2 lastBuyPrice2 := 0.0 plot(result2 - 100, title="SMA-EMA", color=color.new(color_2, 0)) // SMA - DEMA var lastBuyPrice3 = 0.0 var result3 = 100.0 [buy3,sell3] = hlcTrend('SMA', closeType, 'DEMA') if dateRange() and buy3 and lastBuyPrice3 == 0 lastBuyPrice3 := close else if dateRange() and sell3 and lastBuyPrice3 != 0 result3 := close/lastBuyPrice3 * result3 lastBuyPrice3 := 0.0 plot(result3 - 100, title="SMA-DEMA", color=color.new(color_3, 0)) // SMA - HMA var lastBuyPrice4 = 0.0 var result4 = 100.0 [buy4,sell4] = hlcTrend('SMA', closeType, 'HMA') if dateRange() and buy4 and lastBuyPrice4 == 0 lastBuyPrice4 := close else if dateRange() and sell4 and lastBuyPrice4 != 0 result4 := close/lastBuyPrice4 * result4 lastBuyPrice4 := 0.0 plot(result4 - 100, title="SMA-HMA", color=color.new(color_4, 0)) // SMA - TEMA var lastBuyPrice5 = 0.0 var result5 = 100.0 [buy5,sell5] = hlcTrend('SMA', closeType, 'TEMA') if dateRange() and buy5 and lastBuyPrice5 == 0 lastBuyPrice5 := close else if dateRange() and sell5 and lastBuyPrice5 != 0 result5 := close/lastBuyPrice5 * result5 lastBuyPrice5 := 0.0 plot(result5 - 100, title="SMA-TEMA", color=color.new(color_5, 0)) // SMA - WMA var lastBuyPrice6 = 0.0 var result6 = 100.0 [buy6,sell6] = hlcTrend('SMA', closeType, 'WMA') if dateRange() and buy6 and lastBuyPrice6 == 0 lastBuyPrice6 := close else if dateRange() and sell6 and lastBuyPrice6 != 0 result6 := close/lastBuyPrice6 * result6 lastBuyPrice6 := 0.0 plot(result6 - 100, title="SMA-WMA", color=color.new(color_6, 0)) // SMA - VWMA var lastBuyPrice7 = 0.0 var result7 = 100.0 [buy7,sell7] = hlcTrend('SMA', closeType, 'VWMA') if dateRange() and buy7 and lastBuyPrice7 == 0 lastBuyPrice7 := close else if dateRange() and sell7 and lastBuyPrice7 != 0 result7 := close/lastBuyPrice7 * result7 lastBuyPrice7 := 0.0 plot(result7 - 100, title="SMA-VWMA", color=color.new(color_12, 0)) // SMA - SMMA var lastBuyPrice8 = 0.0 var result8 = 100.0 [buy8,sell8] = hlcTrend('SMA', closeType, 'SMMA') if dateRange() and buy8 and lastBuyPrice8 == 0 lastBuyPrice8 := close else if dateRange() and sell8 and lastBuyPrice8 != 0 result8 := close/lastBuyPrice8 * result8 lastBuyPrice8 := 0.0 plot(result8 - 100, title="SMA-SMMA", color=color.new(color_7, 0)) // EMA - SMA var lastBuyPrice9 = 0.0 var result9 = 100.0 [buy9,sell9] = hlcTrend('EMA', closeType, 'SMA') if dateRange() and buy9 and lastBuyPrice9 == 0 lastBuyPrice9 := close else if dateRange() and sell9 and lastBuyPrice9 != 0 result9 := close/lastBuyPrice9 * result9 lastBuyPrice9 := 0.0 plot(result9 - 100, title="EMA-SMA", color=color.new(color_8, 0)) // EMA - EMA var lastBuyPrice10 = 0.0 var result10 = 100.0 [buy10,sell10] = hlcTrend('EMA', closeType, 'EMA') if dateRange() and buy10 and lastBuyPrice10 == 0 lastBuyPrice10 := close else if dateRange() and sell10 and lastBuyPrice10 != 0 result10 := close/lastBuyPrice10 * result10 lastBuyPrice10 := 0.0 plot(result10 - 100, title="EMA-EMA", color=color.new(color_9, 0)) // EMA - DEMA var lastBuyPrice11 = 0.0 var result11 = 100.0 [buy11,sell11] = hlcTrend('EMA', closeType, 'DEMA') if dateRange() and buy11 and lastBuyPrice11 == 0 lastBuyPrice11 := close else if dateRange() and sell11 and lastBuyPrice11 != 0 result11 := close/lastBuyPrice11 * result11 lastBuyPrice11 := 0.0 plot(result11 - 100, title="EMA-DEMA", color=color.new(color_10, 0)) // EMA - HMA var lastBuyPrice12 = 0.0 var result12 = 100.0 [buy12,sell12] = hlcTrend('EMA', closeType, 'HMA') if dateRange() and buy12 and lastBuyPrice12 == 0 lastBuyPrice12 := close else if dateRange() and sell12 and lastBuyPrice12 != 0 result12 := close/lastBuyPrice12 * result12 lastBuyPrice12 := 0.0 plot(result12 - 100, title="EMA-HMA", color=color.new(color_11, 0)) // EMA - TEMA var lastBuyPrice13 = 0.0 var result13 = 100.0 [buy13,sell13] = hlcTrend('EMA', closeType, 'TEMA') if dateRange() and buy13 and lastBuyPrice13 == 0 lastBuyPrice13 := close else if dateRange() and sell13 and lastBuyPrice13 != 0 result13 := close/lastBuyPrice13 * result13 lastBuyPrice13 := 0.0 plot(result13 - 100, title="EMA-TEMA", color=color.new(color_12, 0)) // EMA - WMA var lastBuyPrice14 = 0.0 var result14 = 100.0 [buy14,sell14] = hlcTrend('EMA', closeType, 'WMA') if dateRange() and buy14 and lastBuyPrice14 == 0 lastBuyPrice14 := close else if dateRange() and sell14 and lastBuyPrice14 != 0 result14 := close/lastBuyPrice14 * result14 lastBuyPrice14 := 0.0 plot(result14 - 100, title="EMA-WMA", color=color.new(color_13, 0)) // EMA - VWMA var lastBuyPrice15 = 0.0 var result15 = 100.0 [buy15,sell15] = hlcTrend('EMA', closeType, 'VWMA') if dateRange() and buy15 and lastBuyPrice15 == 0 lastBuyPrice15 := close else if dateRange() and sell15 and lastBuyPrice15 != 0 result15 := close/lastBuyPrice15 * result15 lastBuyPrice15 := 0.0 plot(result15 - 100, title="EMA-VWMA", color=color.new(color_14, 0)) // EMA - SMMA var lastBuyPrice16 = 0.0 var result16 = 100.0 [buy16,sell16] = hlcTrend('EMA', closeType, 'SMMA') if dateRange() and buy16 and lastBuyPrice16 == 0 lastBuyPrice16 := close else if dateRange() and sell16 and lastBuyPrice16 != 0 result16 := close/lastBuyPrice16 * result16 lastBuyPrice16 := 0.0 plot(result16 - 100, title="EMA-SMMA", color=color.new(color_15, 0)) // DEMA - SMA var lastBuyPrice17 = 0.0 var result17 = 100.0 [buy17,sell17] = hlcTrend('DEMA', closeType, 'SMA') if dateRange() and buy17 and lastBuyPrice17 == 0 lastBuyPrice17 := close else if dateRange() and sell17 and lastBuyPrice17 != 0 result17 := close/lastBuyPrice17 * result17 lastBuyPrice17 := 0.0 plot(result17 - 100, title="DEMA-SMA", color=color.new(color_16, 0)) // DEMA - EMA var lastBuyPrice18 = 0.0 var result18 = 100.0 [buy18,sell18] = hlcTrend('DEMA', closeType, 'EMA') if dateRange() and buy18 and lastBuyPrice18 == 0 lastBuyPrice18 := close else if dateRange() and sell18 and lastBuyPrice18 != 0 result18 := close/lastBuyPrice18 * result18 lastBuyPrice18 := 0.0 plot(result18 - 100, title="DEMA-EMA", color=color.new(color_17, 0)) // DEMA - DEMA var lastBuyPrice19 = 0.0 var result19 = 100.0 [buy19,sell19] = hlcTrend('DEMA', closeType, 'DEMA') if dateRange() and buy19 and lastBuyPrice19 == 0 lastBuyPrice19 := close else if dateRange() and sell19 and lastBuyPrice19 != 0 result19 := close/lastBuyPrice19 * result19 lastBuyPrice19 := 0.0 plot(result19 - 100, title="DEMA-DEMA", color=color.new(color_1, 30)) // DEMA - HMA var lastBuyPrice20 = 0.0 var result20 = 100.0 [buy20,sell20] = hlcTrend('DEMA', closeType, 'HMA') if dateRange() and buy20 and lastBuyPrice20 == 0 lastBuyPrice20 := close else if dateRange() and sell20 and lastBuyPrice20 != 0 result20 := close/lastBuyPrice20 * result20 lastBuyPrice20 := 0.0 plot(result20 - 100, title="DEMA-HMA", color=color.new(color_2, 30)) // DEMA - TEMA var lastBuyPrice21 = 0.0 var result21 = 100.0 [buy21,sell21] = hlcTrend('DEMA', closeType, 'TEMA') if dateRange() and buy21 and lastBuyPrice21 == 0 lastBuyPrice21 := close else if dateRange() and sell21 and lastBuyPrice21 != 0 result21 := close/lastBuyPrice21 * result21 lastBuyPrice21 := 0.0 plot(result21 - 100, title="DEMA-TEMA", color=color.new(color_3, 30)) // DEMA - WMA var lastBuyPrice22 = 0.0 var result22 = 100.0 [buy22,sell22] = hlcTrend('DEMA', closeType, 'WMA') if dateRange() and buy22 and lastBuyPrice22 == 0 lastBuyPrice22 := close else if dateRange() and sell22 and lastBuyPrice22 != 0 result22 := close/lastBuyPrice22 * result22 lastBuyPrice22 := 0.0 plot(result22 - 100, title="DEMA-WMA", color=color.new(color_4, 30)) // DEMA - VWMA var lastBuyPrice23 = 0.0 var result23 = 100.0 [buy23,sell23] = hlcTrend('DEMA', closeType, 'VWMA') if dateRange() and buy23 and lastBuyPrice23 == 0 lastBuyPrice23 := close else if dateRange() and sell23 and lastBuyPrice23 != 0 result23 := close/lastBuyPrice23 * result23 lastBuyPrice23 := 0.0 plot(result23 - 100, title="DEMA-VWMA", color=color.new(color_5, 30)) // DEMA - SMMA var lastBuyPrice24 = 0.0 var result24 = 100.0 [buy24,sell24] = hlcTrend('DEMA', closeType, 'SMMA') if dateRange() and buy24 and lastBuyPrice24 == 0 lastBuyPrice24 := close else if dateRange() and sell24 and lastBuyPrice24 != 0 result24 := close/lastBuyPrice24 * result24 lastBuyPrice24 := 0.0 plot(result24 - 100, title="DEMA-SMMA", color=color.new(color_6, 30)) // HMA - SMA var lastBuyPrice25 = 0.0 var result25 = 100.0 [buy25,sell25] = hlcTrend('HMA', closeType, 'SMA') if dateRange() and buy25 and lastBuyPrice25 == 0 lastBuyPrice25 := close else if dateRange() and sell25 and lastBuyPrice25 != 0 result25 := close/lastBuyPrice25 * result25 lastBuyPrice25 := 0.0 plot(result25 - 100, title="HMA-SMA", color=color.new(color_13, 30)) // HMA - EMA var lastBuyPrice26 = 0.0 var result26 = 100.0 [buy26,sell26] = hlcTrend('HMA', closeType, 'EMA') if dateRange() and buy26 and lastBuyPrice26 == 0 lastBuyPrice26 := close else if dateRange() and sell26 and lastBuyPrice26 != 0 result26 := close/lastBuyPrice26 * result26 lastBuyPrice26 := 0.0 plot(result26 - 100, title="HMA-EMA", color=color.new(color_7, 30)) // HMA - DEMA var lastBuyPrice27 = 0.0 var result27 = 100.0 [buy27,sell27] = hlcTrend('HMA', closeType, 'DEMA') if dateRange() and buy27 and lastBuyPrice27 == 0 lastBuyPrice27 := close else if dateRange() and sell27 and lastBuyPrice27 != 0 result27 := close/lastBuyPrice27 * result27 lastBuyPrice27 := 0.0 plot(result27 - 100, title="HMA-DEMA", color=color.new(color_8, 30)) // HMA - HMA var lastBuyPrice28 = 0.0 var result28 = 100.0 [buy28,sell28] = hlcTrend('HMA', closeType, 'HMA') if dateRange() and buy28 and lastBuyPrice28 == 0 lastBuyPrice28 := close else if dateRange() and sell28 and lastBuyPrice28 != 0 result28 := close/lastBuyPrice28 * result28 lastBuyPrice28 := 0.0 plot(result28 - 100, title="HMA-HMA", color=color.new(color_9, 30)) // HMA - TEMA var lastBuyPrice29 = 0.0 var result29 = 100.0 [buy29,sell29] = hlcTrend('HMA', closeType, 'TEMA') if dateRange() and buy29 and lastBuyPrice29 == 0 lastBuyPrice29 := close else if dateRange() and sell29 and lastBuyPrice29 != 0 result29 := close/lastBuyPrice29 * result29 lastBuyPrice29 := 0.0 plot(result29 - 100, title="HMA-TEMA", color=color.new(color_10, 30)) // HMA - WMA var lastBuyPrice30 = 0.0 var result30 = 100.0 [buy30,sell30] = hlcTrend('HMA', closeType, 'WMA') if dateRange() and buy30 and lastBuyPrice30 == 0 lastBuyPrice30 := close else if dateRange() and sell30 and lastBuyPrice30 != 0 result30 := close/lastBuyPrice30 * result30 lastBuyPrice30 := 0.0 plot(result30 - 100, title="HMA-WMA", color=color.new(color_11, 30)) // HMA - VWMA var lastBuyPrice31 = 0.0 var result31 = 100.0 [buy31,sell31] = hlcTrend('HMA', closeType, 'VWMA') if dateRange() and buy31 and lastBuyPrice31 == 0 lastBuyPrice31 := close else if dateRange() and sell31 and lastBuyPrice31 != 0 result31 := close/lastBuyPrice31 * result31 lastBuyPrice31 := 0.0 plot(result31 - 100, title="HMA-VWMA", color=color.new(color_12, 30)) // HMA - SMMA var lastBuyPrice32 = 0.0 var result32 = 100.0 [buy32,sell32] = hlcTrend('HMA', closeType, 'SMMA') if dateRange() and buy32 and lastBuyPrice32 == 0 lastBuyPrice32 := close else if dateRange() and sell32 and lastBuyPrice32 != 0 result32 := close/lastBuyPrice32 * result32 lastBuyPrice32 := 0.0 plot(result32 - 100, title="HMA-SMMA", color=color.new(color_13, 30)) // TEMA - SMA var lastBuyPrice33 = 0.0 var result33 = 100.0 [buy33,sell33] = hlcTrend('TEMA', closeType, 'SMA') if dateRange() and buy33 and lastBuyPrice33 == 0 lastBuyPrice33 := close else if dateRange() and sell33 and lastBuyPrice33 != 0 result33 := close/lastBuyPrice33 * result33 lastBuyPrice33 := 0.0 plot(result33 - 100, title="TEMA-SMA", color=color.new(color_14, 30)) // TEMA - EMA var lastBuyPrice34 = 0.0 var result34 = 100.0 [buy34,sell34] = hlcTrend('TEMA', closeType, 'EMA') if dateRange() and buy34 and lastBuyPrice34 == 0 lastBuyPrice34 := close else if dateRange() and sell34 and lastBuyPrice34 != 0 result34 := close/lastBuyPrice34 * result34 lastBuyPrice34 := 0.0 plot(result34 - 100, title="TEMA-EMA", color=color.new(color_15, 30)) // TEMA - DEMA var lastBuyPrice35 = 0.0 var result35 = 100.0 [buy35,sell35] = hlcTrend('TEMA', closeType, 'DEMA') if dateRange() and buy35 and lastBuyPrice35 == 0 lastBuyPrice35 := close else if dateRange() and sell35 and lastBuyPrice35 != 0 result35 := close/lastBuyPrice35 * result35 lastBuyPrice35 := 0.0 plot(result35 - 100, title="TEMA-DEMA", color=color.new(color_16, 30)) // TEMA - HMA var lastBuyPrice36 = 0.0 var result36 = 100.0 [buy36,sell36] = hlcTrend('TEMA', closeType, 'HMA') if dateRange() and buy36 and lastBuyPrice36 == 0 lastBuyPrice36 := close else if dateRange() and sell36 and lastBuyPrice36 != 0 result36 := close/lastBuyPrice36 * result36 lastBuyPrice36 := 0.0 plot(result36 - 100, title="TEMA-HMA", color=color.new(color_17, 30)) // TEMA - TEMA var lastBuyPrice37 = 0.0 var result37 = 100.0 [buy37,sell37] = hlcTrend('TEMA', closeType, 'TEMA') if dateRange() and buy37 and lastBuyPrice37 == 0 lastBuyPrice37 := close else if dateRange() and sell37 and lastBuyPrice37 != 0 result37 := close/lastBuyPrice37 * result37 lastBuyPrice37 := 0.0 plot(result37 - 100, title="TEMA-TEMA", color=color.new(color_1, 60)) // TEMA - WMA var lastBuyPrice38 = 0.0 var result38 = 100.0 [buy38,sell38] = hlcTrend('TEMA', closeType, 'WMA') if dateRange() and buy38 and lastBuyPrice38 == 0 lastBuyPrice38 := close else if dateRange() and sell38 and lastBuyPrice38 != 0 result38 := close/lastBuyPrice38 * result38 lastBuyPrice38 := 0.0 plot(result38 - 100, title="TEMA-WMA", color=color.new(color_2, 60)) // TEMA - VWMA var lastBuyPrice39 = 0.0 var result39 = 100.0 [buy39,sell39] = hlcTrend('TEMA', closeType, 'VWMA') if dateRange() and buy39 and lastBuyPrice39 == 0 lastBuyPrice39 := close else if dateRange() and sell39 and lastBuyPrice39 != 0 result39 := close/lastBuyPrice39 * result39 lastBuyPrice39 := 0.0 plot(result39 - 100, title="TEMA-VWMA", color=color.new(color_3, 60)) // TEMA - SMMA var lastBuyPrice40 = 0.0 var result40 = 100.0 [buy40,sell40] = hlcTrend('TEMA', closeType, 'SMMA') if dateRange() and buy40 and lastBuyPrice40 == 0 lastBuyPrice40 := close else if dateRange() and sell40 and lastBuyPrice40 != 0 result40 := close/lastBuyPrice40 * result40 lastBuyPrice40 := 0.0 plot(result40 - 100, title="TEMA-SMMA", color=color.new(color_4, 60)) // WMA - SMA var lastBuyPrice41 = 0.0 var result41 = 100.0 [buy41,sell41] = hlcTrend('WMA', closeType, 'SMA') if dateRange() and buy41 and lastBuyPrice41 == 0 lastBuyPrice41 := close else if dateRange() and sell41 and lastBuyPrice41 != 0 result41 := close/lastBuyPrice41 * result41 lastBuyPrice41 := 0.0 plot(result41 - 100, title="WMA-SMA", color=color.new(color_5, 60)) // WMA - EMA var lastBuyPrice42 = 0.0 var result42 = 100.0 [buy42,sell42] = hlcTrend('WMA', closeType, 'EMA') if dateRange() and buy42 and lastBuyPrice42 == 0 lastBuyPrice42 := close else if dateRange() and sell42 and lastBuyPrice42 != 0 result42 := close/lastBuyPrice42 * result42 lastBuyPrice42 := 0.0 plot(result42 - 100, title="WMA-EMA", color=color.new(color_6, 60)) // WMA - DEMA var lastBuyPrice43 = 0.0 var result43 = 100.0 [buy43,sell43] = hlcTrend('WMA', closeType, 'DEMA') if dateRange() and buy43 and lastBuyPrice43 == 0 lastBuyPrice43 := close else if dateRange() and sell43 and lastBuyPrice43 != 0 result43 := close/lastBuyPrice43 * result43 lastBuyPrice43 := 0.0 plot(result43 - 100, title="WMA-DEMA", color=color.new(color_7, 60)) // WMA - HMA var lastBuyPrice44 = 0.0 var result44 = 100.0 [buy44,sell44] = hlcTrend('WMA', closeType, 'HMA') if dateRange() and buy44 and lastBuyPrice44 == 0 lastBuyPrice44 := close else if dateRange() and sell44 and lastBuyPrice44 != 0 result44 := close/lastBuyPrice44 * result44 lastBuyPrice44 := 0.0 plot(result44 - 100, title="WMA-HMA", color=color.new(color_8, 60)) // WMA - TEMA var lastBuyPrice45 = 0.0 var result45 = 100.0 [buy45,sell45] = hlcTrend('WMA', closeType, 'TEMA') if dateRange() and buy45 and lastBuyPrice45 == 0 lastBuyPrice45 := close else if dateRange() and sell45 and lastBuyPrice45 != 0 result45 := close/lastBuyPrice45 * result45 lastBuyPrice45 := 0.0 plot(result45 - 100, title="WMA-TEMA", color=color.new(color_9, 60)) // WMA - WMA var lastBuyPrice46 = 0.0 var result46 = 100.0 [buy46,sell46] = hlcTrend('WMA', closeType, 'WMA') if dateRange() and buy46 and lastBuyPrice46 == 0 lastBuyPrice46 := close else if dateRange() and sell46 and lastBuyPrice46 != 0 result46 := close/lastBuyPrice46 * result46 lastBuyPrice46 := 0.0 plot(result46 - 100, title="WMA-WMA", color=color.new(color_10, 60)) // WMA - VWMA var lastBuyPrice47 = 0.0 var result47 = 100.0 [buy47,sell47] = hlcTrend('WMA', closeType, 'VWMA') if dateRange() and buy47 and lastBuyPrice47 == 0 lastBuyPrice47 := close else if dateRange() and sell47 and lastBuyPrice47 != 0 result47 := close/lastBuyPrice47 * result47 lastBuyPrice47 := 0.0 plot(result47 - 100, title="WMA-VWMA", color=color.new(color_11, 60)) // WMA - SMMA var lastBuyPrice48 = 0.0 var result48 = 100.0 [buy48,sell48] = hlcTrend('WMA', closeType, 'SMMA') if dateRange() and buy48 and lastBuyPrice48 == 0 lastBuyPrice48 := close else if dateRange() and sell48 and lastBuyPrice48 != 0 result48 := close/lastBuyPrice48 * result48 lastBuyPrice48 := 0.0 plot(result48 - 100, title="WMA-SMMA", color=color.new(color_12, 60)) // VWMA - SMA var lastBuyPrice49 = 0.0 var result49 = 100.0 [buy49,sell49] = hlcTrend('VWMA', closeType, 'SMA') if dateRange() and buy49 and lastBuyPrice49 == 0 lastBuyPrice49 := close else if dateRange() and sell49 and lastBuyPrice49 != 0 result49 := close/lastBuyPrice49 * result49 lastBuyPrice49 := 0.0 plot(result49 - 100, title="VWMA-SMA", color=color.new(color_13, 60)) // VWMA - EMA var lastBuyPrice50 = 0.0 var result50 = 100.0 [buy50,sell50] = hlcTrend('VWMA', closeType, 'EMA') if dateRange() and buy50 and lastBuyPrice50 == 0 lastBuyPrice50 := close else if dateRange() and sell50 and lastBuyPrice50 != 0 result50 := close/lastBuyPrice50 * result50 lastBuyPrice50 := 0.0 plot(result50 - 100, title="VWMA-EMA", color=color.new(color_14, 60)) // VWMA - DEMA var lastBuyPrice51 = 0.0 var result51 = 100.0 [buy51,sell51] = hlcTrend('VWMA', closeType, 'DEMA') if dateRange() and buy51 and lastBuyPrice51 == 0 lastBuyPrice51 := close else if dateRange() and sell51 and lastBuyPrice51 != 0 result51 := close/lastBuyPrice51 * result51 lastBuyPrice51 := 0.0 plot(result51 - 100, title="VWMA-DEMA", color=color.new(color_15, 60)) // VWMA - HMA var lastBuyPrice52 = 0.0 var result52 = 100.0 [buy52,sell52] = hlcTrend('VWMA', closeType, 'HMA') if dateRange() and buy52 and lastBuyPrice52 == 0 lastBuyPrice52 := close else if dateRange() and sell52 and lastBuyPrice52 != 0 result52 := close/lastBuyPrice52 * result52 lastBuyPrice52 := 0.0 plot(result52 - 100, title="VWMA-HMA", color=color.new(color_16, 60)) // VWMA - TEMA var lastBuyPrice53 = 0.0 var result53 = 100.0 [buy53,sell53] = hlcTrend('VWMA', closeType, 'TEMA') if dateRange() and buy53 and lastBuyPrice53 == 0 lastBuyPrice53 := close else if dateRange() and sell53 and lastBuyPrice53 != 0 result53 := close/lastBuyPrice53 * result53 lastBuyPrice53 := 0.0 plot(result53 - 100, title="VWMA-TEMA", color=color.new(color_17, 60)) // VWMA - WMA var lastBuyPrice54 = 0.0 var result54 = 100.0 [buy54,sell54] = hlcTrend('VWMA', closeType, 'WMA') if dateRange() and buy54 and lastBuyPrice54 == 0 lastBuyPrice54 := close else if dateRange() and sell54 and lastBuyPrice54 != 0 result54 := close/lastBuyPrice54 * result54 lastBuyPrice54 := 0.0 plot(result54 - 100, title="VWMA-WMA", color=color.new(color_1, 80)) // VWMA - VWMA var lastBuyPrice55 = 0.0 var result55 = 100.0 [buy55,sell55] = hlcTrend('VWMA', closeType, 'VWMA') if dateRange() and buy55 and lastBuyPrice55 == 0 lastBuyPrice55 := close else if dateRange() and sell55 and lastBuyPrice55 != 0 result55 := close/lastBuyPrice55 * result55 lastBuyPrice55 := 0.0 plot(result55 - 100, title="VWMA-VWMA", color=color.new(color_2, 80)) // VWMA - SMMA var lastBuyPrice56 = 0.0 var result56 = 100.0 [buy56,sell56] = hlcTrend('VWMA', closeType, 'SMMA') if dateRange() and buy56 and lastBuyPrice56 == 0 lastBuyPrice56 := close else if dateRange() and sell56 and lastBuyPrice56 != 0 result56 := close/lastBuyPrice56 * result56 lastBuyPrice56 := 0.0 plot(result56 - 100, title="VWMA-SMMA", color=color.new(color_3, 80)) // SMMA - SMA var lastBuyPrice57 = 0.0 var result57 = 100.0 [buy57,sell57] = hlcTrend('SMMA', closeType, 'SMA') if dateRange() and buy57 and lastBuyPrice57 == 0 lastBuyPrice57 := close else if dateRange() and sell57 and lastBuyPrice57 != 0 result57 := close/lastBuyPrice57 * result57 lastBuyPrice57 := 0.0 plot(result57 - 100, title="SMMA-SMA", color=color.new(color_4, 80)) // SMMA - EMA var lastBuyPrice58 = 0.0 var result58 = 100.0 [buy58,sell58] = hlcTrend('SMMA', closeType, 'EMA') if dateRange() and buy58 and lastBuyPrice58 == 0 lastBuyPrice58 := close else if dateRange() and sell58 and lastBuyPrice58 != 0 result58 := close/lastBuyPrice58 * result58 lastBuyPrice58 := 0.0 plot(result58 - 100, title="SMMA-EMA", color=color.new(color_5, 80)) // SMMA - DEMA var lastBuyPrice59 = 0.0 var result59 = 100.0 [buy59,sell59] = hlcTrend('SMMA', closeType, 'DEMA') if dateRange() and buy59 and lastBuyPrice59 == 0 lastBuyPrice59 := close else if dateRange() and sell59 and lastBuyPrice59 != 0 result59 := close/lastBuyPrice59 * result59 lastBuyPrice59 := 0.0 plot(result59 - 100, title="SMMA-DEMA", color=color.new(color_6, 80)) // SMMA - HMA var lastBuyPrice60 = 0.0 var result60 = 100.0 [buy60,sell60] = hlcTrend('SMMA', closeType, 'HMA') if dateRange() and buy60 and lastBuyPrice60 == 0 lastBuyPrice60 := close else if dateRange() and sell60 and lastBuyPrice60 != 0 result60 := close/lastBuyPrice60 * result60 lastBuyPrice60 := 0.0 plot(result60 - 100, title="SMMA-HMA", color=color.new(color_7, 80)) // SMMA - TEMA var lastBuyPrice61 = 0.0 var result61 = 100.0 [buy61,sell61] = hlcTrend('SMMA', closeType, 'TEMA') if dateRange() and buy61 and lastBuyPrice61 == 0 lastBuyPrice61 := close else if dateRange() and sell61 and lastBuyPrice61 != 0 result61 := close/lastBuyPrice61 * result61 lastBuyPrice61 := 0.0 plot(result61 - 100, title="SMMA-TEMA", color=color.new(color_8, 80)) // SMMA - WMA var lastBuyPrice62 = 0.0 var result62 = 100.0 [buy62,sell62] = hlcTrend('SMMA', closeType, 'WMA') if dateRange() and buy62 and lastBuyPrice62 == 0 lastBuyPrice62 := close else if dateRange() and sell62 and lastBuyPrice62 != 0 result62 := close/lastBuyPrice62 * result62 lastBuyPrice62 := 0.0 plot(result62 - 100, title="SMMA-WMA", color=color.new(color_9, 80)) // SMMA - VWMA var lastBuyPrice63 = 0.0 var result63 = 100.0 [buy63,sell63] = hlcTrend('SMMA', closeType, 'VWMA') if dateRange() and buy63 and lastBuyPrice63 == 0 lastBuyPrice63 := close else if dateRange() and sell63 and lastBuyPrice63 != 0 result63 := close/lastBuyPrice63 * result63 lastBuyPrice63 := 0.0 plot(result63 - 100, title="SMMA-VWMA", color=color.new(color_10, 80)) // SMMA - SMMA var lastBuyPrice64 = 0.0 var result64 = 100.0 [buy64,sell64] = hlcTrend('SMMA', closeType, 'SMMA') if dateRange() and buy64 and lastBuyPrice64 == 0 lastBuyPrice64 := close else if dateRange() and sell64 and lastBuyPrice64 != 0 result64 := close/lastBuyPrice64 * result64 lastBuyPrice64 := 0.0 plot(result64 - 100, title="SMMA-SMMA", color=color.new(color_11, 80))
Average Proportional Capital
https://www.tradingview.com/script/QU7xKsvt/
AlexanderRios
https://www.tradingview.com/u/AlexanderRios/
85
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © AlexanderRios //@version=5 indicator(title='Capital Proporcial Medio', shorttitle='CPM', format=format.price, precision=2, timeframe='') //indicator("CPM") len1 = input.int(52, minval=1) CPM = close * volume volmax = ta.highest(CPM, len1) v = CPM * 100 / volmax * 4 / 5 volpmed = ta.ema(v, len1) CPM2 = v - volpmed sma5 = ta.sma(CPM2, 5) sma20 = ta.sma(CPM2, 20) // plot(close) plot(CPM2, title='CPM', style=plot.style_histogram, color=CPM2 > 0 ? color.green : color.red) plot(sma5, title='SMA5', color=color.new(color.gray, 0)) plot(sma20, title='SMA20', color=color.new(color.orange, 0))
Kitti-Playbook Fibonacci retracement GAGE R0.00
https://www.tradingview.com/script/xUGvzvLY-Kitti-Playbook-Fibonacci-retracement-GAGE-R0-00/
Kittimasak_S
https://www.tradingview.com/u/Kittimasak_S/
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/ // © Kittimasak_S //@version=5 indicator("Kitti-Playbook Fibonacci retracement GAGE R0.042",overlay=true) // Date Jul 24 2023 // 1 Change Setting Menu of Fibonacci color Zone // 2 The color of background of label is change follow setting of Fibonacci zone color seting // 3 Able to Adjust Label Text Size // Date Apr 12 2023 R0.041 // Debug label 61.,8% --> 61.8% // Date Apr 11 2023 R4 // 1) Addition Setting TEXT size menu for display Fibonacci Value and currency // 2) Addition Unit of Currency for display Fibonacci Value and currency // 3) Debug for small digit currency display for 2 digit to Mintick // 4) Debug Source of Price for calculate fibonacci //Date Feb 28 2023 R3 // Color of Label // If last Price is lower than 61.8% of the New highest price - color Orange // Date Feb 28 2023 // Color of Label // If last Price is lower than the New highest price - color gray // If last Price is lower than 61.8% of the New highest price - color Bule // If last Price is lower than 78.6% of the New highest price - color Green // If last Price is lower than 94.2% of the New highest price - color Yellow // Date Dec 20 2022 // Jan 7 2023 Label layout adjust // Addition 12 26 EMS cross Indicator // // Date Oct 25 2021 // OVERVIEW :Kitti-Playbook Fibonacci retracement GAGE R0.00 // Easy for visualize Fibonacci retracement level // CONCEPTS // 1)Minimum Line = Lowest level of Source form start // 2)Maximum Line = Highest level of Source form New Low // 3)Calculation // a) Fibonacci Retracement of 61.8% form Maximum level // b) Fibonacci Retracement of 78.6% form Maximum level // c) Fibonacci Retracement of 88.7% form Maximum level // d) Fibonacci Retracement of 94.2% form Maximum level // 4)Information Display // a) Information Bar show Number of New Low , Max level , Min Level , Last Bar No, Current Pricel // b) GAGE Scale Number // c) New Low // ==> 1)Minimum Line = Lowest level of Source form start i_astart= 0 i_aend= 1 i_aSource=input.source(close, "Source Min",group="Source" , inline= "A",display=display.data_window) a = array.new_float(0) for i = i_astart to i_aend array.push(a, i_aSource[i]) aMin0 = array.min(a) float x=na x :=aMin0 if x > x[1] x := x[1] else x := x aMin = ( x ) //---------- Check and count Minimum Points //HL=close>aMin[1] and close[1]==aMin HL=i_aSource>aMin[1] and i_aSource[1]==aMin HLC=HL==true?1:0 Count_HL=ta.cum(HLC) //Count Minimum Points BSLL=ta.barssince(HL) *0.001 //plot(BSLL) // ==> 2)Maximum Line = Highest level of Source form New Low i_bstart= 0 i_bend= 1 i_bSource=input.source(close, "Source Max",group="Source",inline= "A",display=display.data_window) b = array.new_float(0) for i = i_bstart to i_bend array.push(b, i_bSource[i]) bMax0 = math.round_to_mintick(array.max(b)) float y=na //y :=bMax0 y :=bMax0 // Confirm New Low for Set New HHV if y < y[1] and BSLL > 0 y := y[1] else y := y bMax = y // ==> 3)Calculation // a) Fibonacci Retracement of 61.8% form Maximum level // b) Fibonacci Retracement of 78.6% form Maximum level // c) Fibonacci Retracement of 88.7% form Maximum level // d) Fibonacci Retracement of 94.2% form Maximum level Range=bMax-aMin L618= math.round_to_mintick( bMax-Range*0.618 ) L786= math.round_to_mintick( bMax-Range*0.786 ) L887= math.round_to_mintick( bMax-Range*0.887 ) L942= math.round_to_mintick( bMax-Range*0.942 ) // Calculate Current price % SPercent = ( bMax- i_aSource )/ Range // Plot Min Max Line Lmin=plot(aMin,"Lowest",color=color.new(color.red,50)) Lmax=plot(bMax,"Highest*",color=color.new(color.yellow,50)) // Plot Color_Line=color.new(#888888,50) L6 =plot(L618 , "61.8", color=Color_Line) L7=plot(L786 , "78.6", color=Color_Line) L8=plot(L887 , "88.7", color=Color_Line) L9=plot(L942,"94.2", color=Color_Line) i_ColRangeH00 = color.new(#6d1818, 100) i_ColRangeH67 = i_ColRangeH00 // color.new(#6d1818, 100) // input.color(color.new(#6d1818, 100), "Waiting Zone",group="61.8-88.7 Zone", inline="Line 1", display=display.none,group="Fibinacci Zone color Setting") i_ColRangeL67 = input.color(color.new(#29b968, 55), "61.8% ~ 78.6%", inline="Line 1", display=display.none,group="Fibinacci Zone color Setting") i_ColRangeH78 = i_ColRangeH00 //color.new(#6d1818, 100) //input.color(color.new(#6d1818, 100), "Waiting Zone",group="78.6-88.7 Zone", inline="Line 2", display=display.none,group="Fibinacci Zone color Setting") i_ColRangeL78 = input.color(color.new(#29b968, 35), "78.6% ~ 88.7%", inline="Line 2", display=display.none,group="Fibinacci Zone color Setting") i_ColRangeH89 = i_ColRangeH00 // color.new(#6d1818, 100)// input.color(color.new(#6d1818, 100), "Waiting Zone",group="88.7-94.2 Zone", inline="Line 3", display=display.none,group="Fibinacci Zone color Setting") i_ColRangeL89 = input.color(color.new(#29b968, 55),"88.7% ~ 94.2%" , inline="Line 3", display=display.none,group="Fibinacci Zone color Setting") i_ColRangeH90 = i_ColRangeH00 // color.new(#6d1818, 100) //input.color(color.new(#6d1818, 100), "Waiting Zone",group="94.2-100 Zone", inline="Line 4", display=display.none,group="Fibinacci Zone color Setting") i_ColRangeL90 = input.color(color.new(#b92989, 75), "94.2% ~ 100%", inline="Line 4", display=display.none,group="Fibinacci Zone color Setting") ColorFill67=color.from_gradient(close,aMin,bMax-Range*.618,i_ColRangeL67,i_ColRangeH67) ColorFill78=color.from_gradient(close,aMin,bMax-Range*.786,i_ColRangeL78,i_ColRangeH78) ColorFill89=color.from_gradient(close,aMin,bMax-Range*.887,i_ColRangeL89,i_ColRangeH89) ColorFill90=color.from_gradient(close,aMin,bMax-Range*.942,i_ColRangeL90,i_ColRangeH90) fill(L6,L7,color=ColorFill67) fill(L7,L8,color=ColorFill78) fill(L8,L9,color=ColorFill89) fill(L9,Lmin,color=ColorFill90) // ==> 4)Information Display // a) Information Bar show Number of New Low , Max level , Min Level , Last Bar No, Current Pricel // b) GAGE Scale Number // c) New Low // // a) Information Bar show Number of New Low , Max level , Min Level , Last Bar No, Current Pricel LabelSW= input.bool(title="Fibonacci value On/Off", defval=true,group='Fibinacci Display Setting',display=display.none) Front0=input.string(size.normal,"Fibonacci Text Size",options= [ size.tiny, size.small, size.normal, size.large, size.huge], group='Fibinacci Display Setting', display=display.none) tColor1 = #aaaaaa // Text Color plot(SPercent,"Spercent",color.green, display=display.data_window) // bColor0 = SPercent >= 0.942 ? color.new(color.yellow,80) : // SPercent >= 0.786 ? color.new(color.green,80) : // SPercent >= 0.618 ? color.new(color.orange,80) : color.new(color.gray,90) bColor0 = SPercent >= 0.942 ? i_ColRangeL90: SPercent >= 0.887 ? i_ColRangeL89: SPercent >= 0.786 ? i_ColRangeL78: SPercent >= 0.618 ? i_ColRangeL67: color.new(color.gray,90) ShowInfoTab = input.bool(title='Show Infomation Bar ', defval=true, group='Information Bar Display Setting',display=display.none,tooltip = "The color of the background changes according to the Fibonacci level at that time.") // Show Tab Tab_Width = input.int(16, "Information Bar's Width", minval=10, maxval=200, step=5,group='Information Bar Display Setting',display=display.none) table_position = input.string(position.top_right, 'Information Bar position', options= [position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right, position.top_center, position.top_right], group='Information Bar Display Setting', display=display.none ) Front1=input.string(size.normal,"Label Text Size",options= [ size.tiny, size.small, size.normal, size.large, size.huge], group='Information Bar Display Setting', display=display.none) var table Signal_table = table.new(position=table_position, columns=1, rows=1, border_width=2) _TEXT_DisplayA0 =" Last (-" +str.format("{0,number,percent}",SPercent ) + ") = " + str.tostring(math.round_to_mintick(close )) +" " + syminfo.currency + " \n 100% = " + str.tostring(math.round_to_mintick(bMax)) +" " + syminfo.currency + " \n 0.0% = " + str.tostring(math.round_to_mintick(aMin)) +" " + syminfo.currency + " \n No.of Bar = " +str.tostring(bar_index) + " bars" + " \n No.of New Low " + " = " + str.tostring(Count_HL) + " Times" if ShowInfoTab == true table.cell(Signal_table, 0, 0, _TEXT_DisplayA0, bgcolor=bColor0, text_color=tColor1,text_halign=text.align_left,text_size = Front1, width=Tab_Width) // b) GAGE Scale Number bc= #88888888 styleUpDwn= label.style_none ylocatPrice = yloc.price //------------ Max ,61.8 78.6 88.7 94.2 min ) lMax = label.new(bar_index, bMax, text= "0.00% = " +str.tostring(bMax ) + " "+syminfo.currency , color=bc, style= styleUpDwn, textcolor=color.new(#888888,20),size=Front0 , yloc=ylocatPrice ) label.delete(LabelSW? lMax[1] : lMax) l618 = label.new(bar_index, L618, text= "61.8% = " +str.tostring(L618 )+ " "+syminfo.currency, color=bc, style= styleUpDwn, textcolor=color.new(#888888,20), size=Front0 ,yloc=ylocatPrice ) label.delete(LabelSW? l618[1] : l618) l786 = label.new(bar_index, L786, text= "78.6% = " +str.tostring(L786 )+ " "+syminfo.currency, color=bc, style= styleUpDwn, textcolor=color.new(#888888,20), size=Front0 ,yloc=ylocatPrice ) label.delete(LabelSW? l786[1] : l786) l887 = label.new(bar_index, L887, text= "88.7% = " +str.tostring(L887 )+ " "+syminfo.currency, color=bc, style= styleUpDwn, textcolor=color.new(#888888,20), size=Front0 ,yloc=ylocatPrice ) label.delete(LabelSW? l887[1] : l887) l942 = label.new(bar_index, L942, text= "94.2% = " +str.tostring(L942 )+ " "+syminfo.currency, color=bc, style= styleUpDwn, textcolor=color.new(#888888,20), size=Front0 ,yloc=ylocatPrice ) label.delete(LabelSW? l942[1] : l942) laMin = label.new(bar_index, aMin, text= " 100% = " +str.tostring(math.round_to_mintick(aMin))+ " "+syminfo.currency, color=bc, style= styleUpDwn, textcolor=color.new(#888888,20), size=Front0 ,yloc=ylocatPrice ) label.delete(LabelSW? laMin[1] : laMin) // c) New Low bgcolor(HL == true ? color.new(#888888,50) : color.new(#888888,100)) /////////////////////////// END of Fibo Retracement ////////////////////////////////////// // ------- EMA 12 26 Cross Indicator ----------------- ////// xsrc = close xprd1 = 12 xprd2 = 26 xsmooth = 1 fillSW = input.bool(title='Paint Bar Colors', defval=false ,group= "EMA 12 26 Cross Indicator" , inline = "line1",display=display.none) labelSwitch = input.bool(title='Turn on assistive text', defval=false,group= "EMA 12 26 Cross Indicator" , inline = "line1",display=display.none) fastSW = input.bool(title='Show 12 EMA line', defval=false , group= "EMA 12 26 Cross Indicator" , inline = "line2",display=display.none) slowSW = input.bool(title='Show 26 EMA line', defval=false ,group= "EMA 12 26 Cross Indicator" , inline = "line2",display=display.none) plotSigsw = input.bool(title='Plot Buy/Sell Signals? ', defval=false ,group= "EMA 12 26 Cross Indicator" , inline = "line3",display=display.none) plotRibsw = input.bool(title='Plot Buy/Sell Ribbon', defval=true,group= "EMA 12 26 Cross Indicator" , inline = "line3",display=display.none) plotRibbonPos = input.string(title='Ribbon Position', options=['Top', 'Bottom'], defval='Bottom',group= "EMA 12 26 Cross Indicator" , inline = "line4",display=display.none) //****************************************************************************// //Calculate Indicators f_secureSecurity(_symbol, _res, _src) => request.security(_symbol, _res, _src[1], lookahead = barmerge.lookahead_on) // Using f_secureSecurity to avoid repainting xPrice = ta.ema(xsrc, xsmooth) FastMA = ta.ema(xPrice, xprd1) SlowMA = ta.ema(xPrice, xprd2) Bull = FastMA > SlowMA Bear = FastMA < SlowMA //****************************************************************************// // Define Color Zones Green = Bull and xPrice > FastMA // Buy Blue = Bear and xPrice > FastMA and xPrice > SlowMA //Pre Buy 2 LBlue = Bear and xPrice > FastMA and xPrice < SlowMA //Pre Buy 1 Red = Bear and xPrice < FastMA // Sell Orange = Bull and xPrice < FastMA and xPrice < SlowMA // Pre Sell 2 Yellow = Bull and xPrice < FastMA and xPrice > SlowMA // Pre Sell 1 //****************************************************************************// // Display color on chart bColor = Green ? color.green : Blue ? color.blue : LBlue ? color.aqua : Red ? color.red : Orange ? color.orange : Yellow ? color.yellow : color.black barcolor(color=fillSW ? bColor : na) //****************************************************************************// // Display MA lines FastL = plot(fastSW ? FastMA : na, 'Fast EMA', color=color.new(color.red, 0), style = plot.style_line) SlowL = plot(slowSW ? SlowMA : na, 'Slow EMA', color=color.new(color.blue, 0), style = plot.style_line) fillcolor = Bull ? color.new(color.green,90) : Bear ? color.new(color.red,90) : color.new(color.black,90) // fillcolor = Bull ? color.green : Bear ? color.red : color.black fill(FastL, SlowL, fillcolor) // fill(FastL, SlowL, fillcolor, transp=90) //****************************************************************************// // Define Buy and Sell condition // This is only for thebasic usage of CDC Actionzone (EMA Crossover) // ie. Buy on first green bar and sell on first red bar buycond = Green and Green[1] == 0 sellcond = Red and Red[1] == 0 LARGE_INT = 50000 bullish = nz(ta.barssince(buycond), LARGE_INT) < nz(ta.barssince(sellcond), LARGE_INT) bearish = nz(ta.barssince(buycond), LARGE_INT) > nz(ta.barssince(sellcond), LARGE_INT) buy = bearish[1] and buycond sell = bullish[1] and sellcond bColor_BullBear = bullish ? color.green : bearish ? color.red : color.black //****************************************************************************// // Plot Buy and Sell point on chart plotshape(plotSigsw ? buy : na, style=shape.circle, title='Buy Signal', location=location.belowbar, color=color.new(color.green, 0)) plotshape(plotSigsw ? sell : na, style=shape.circle, title='Sell Signal', location=location.abovebar, color=color.new(color.red, 0)) // Display Buy/Sell Ribbon plotshape(plotRibsw ? plotRibbonPos == 'Top' ? close : na : na, style=shape.diamond, title='Buy/Sell Ribbon', location=location.top, color=bColor_BullBear) plotshape(plotRibsw ? plotRibbonPos == 'Bottom' ? close : na : na, style=shape.diamond, title='Buy/Sell Ribbon', location=location.bottom, color=bColor_BullBear) //****************************************************************************// // Label labelstyle = close > SlowMA ? label.style_label_down : label.style_label_up labelyloc = close > SlowMA ? yloc.abovebar : yloc.belowbar labeltcolor = buy ? color.black : sell ? color.white : close > close[1] ? color.green : color.red labelbgcolor = buy ? color.green : sell ? color.red : color.silver labeltext = buy ? 'BUY next bar\n' : sell ? 'SELL next bar\n' : ' ' trendText = bullish ? 'bullish' : bearish ? 'bearish' : 'sideways' l1 = label.new(bar_index, na, text=labeltext + syminfo.ticker + ' ' + str.tostring(close) + ' ' + syminfo.currency + '\n currently in a ' + trendText + ' trend \n', color=labelbgcolor, textcolor=labeltcolor, yloc=labelyloc, style=labelstyle) label.delete(labelSwitch ? l1[1] : l1) //****************** End 12 26 EMA Indicator **********************************************************// //****************** End **********************************************************//
Pivot Point Oscillator by Algotrdr
https://www.tradingview.com/script/xtZETNTe-Pivot-Point-Oscillator-by-Algotrdr/
algotrdr_
https://www.tradingview.com/u/algotrdr_/
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/ // © algotrdr_ //@version=4 study("Pivot Point Oscillator by Algotrdr", shorttitle="Pivot Point Oscillator by Algotrdr") Length = input(20, minval=1) pivchoice = input(title="Pivot Timeframe", defval="Daily", options=["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]) f_secureSecurity(_symbol, _res, _src) => security(_symbol, _res, _src[1], lookahead = barmerge.lookahead_on) lastclose = pivchoice == "Daily" ? f_secureSecurity(syminfo.tickerid, "D", close) : pivchoice == "Weekly" ? f_secureSecurity(syminfo.tickerid, "W", close) : pivchoice == "Monthly" ? f_secureSecurity(syminfo.tickerid, "M", close) : pivchoice == "Yearly" ? f_secureSecurity(syminfo.tickerid, "12M", close) : pivchoice == "Quarterly" ? f_secureSecurity(syminfo.tickerid, "3M", close) : na lastopen = pivchoice == "Daily" ? f_secureSecurity(syminfo.tickerid, "D", open) : pivchoice == "Weekly" ? f_secureSecurity(syminfo.tickerid, "W", open) : pivchoice == "Monthly" ? f_secureSecurity(syminfo.tickerid, "M", open) : pivchoice == "Yearly" ? f_secureSecurity(syminfo.tickerid, "12M", open) : pivchoice == "Quarterly" ? f_secureSecurity(syminfo.tickerid, "3M", open) : na lasthigh = pivchoice == "Daily" ? f_secureSecurity(syminfo.tickerid, "D", high) : pivchoice == "Weekly" ? f_secureSecurity(syminfo.tickerid, "W", high) : pivchoice == "Monthly" ? f_secureSecurity(syminfo.tickerid, "M", high) : pivchoice == "Yearly" ? f_secureSecurity(syminfo.tickerid, "12M", high) : pivchoice == "Quarterly" ? f_secureSecurity(syminfo.tickerid, "3M", high) : na lastlow = pivchoice == "Daily" ? f_secureSecurity(syminfo.tickerid, "D", low) : pivchoice == "Weekly" ? f_secureSecurity(syminfo.tickerid, "W", low) : pivchoice == "Monthly" ? f_secureSecurity(syminfo.tickerid, "M", low) : pivchoice == "Yearly" ? f_secureSecurity(syminfo.tickerid, "12M", low) : pivchoice == "Quarterly" ? f_secureSecurity(syminfo.tickerid, "3M", low) : na pivbase = (lasthigh + lastlow + lastclose) / 3 HL = lasthigh - lastlow TR5 = pivbase * 4 + (lasthigh - 4 * lastlow) TR4 = pivbase * 3 + (lasthigh - 3 * lastlow) TR3 = pivbase * 2 + (lasthigh - 2 * lastlow) TR2 = pivbase + 1 * (lasthigh - lastlow) TR1 = pivbase * 2 - lastlow TS1 = pivbase * 2 - lasthigh TS2 = pivbase - 1 * (lasthigh - lastlow) TS3 = pivbase * 2 - (2 * lasthigh - lastlow) TS4 = pivbase * 3 - (3 * lasthigh - lastlow) TS5 = pivbase * 4 - (4 * lasthigh - lastlow) R5 = pivbase + (HL * 2.618) R4 = pivbase + (HL * 1.618) R3 = pivbase + (HL * 1.000) R2 = pivbase + (HL * 0.618) R1 = pivbase + (HL * 0.382) S1 = pivbase - (HL * 0.382) S2 = pivbase - (HL * 0.618) S3 = pivbase - (HL * 1.000) S4 = pivbase - (HL * 1.618) S5 = pivbase - (HL * 2.618) woodiebase = (lasthigh + lastlow + lastopen * 2)/4 WR3 = lasthigh + 2 * (woodiebase - lastlow) WR2 = woodiebase + 1 * HL WR1 = woodiebase * 2 - lastlow WS1 = woodiebase * 2 - lasthigh WS2 = woodiebase - 1 * HL WS3 = lastlow - 2 * (lasthigh - woodiebase) WS4 = WS3 - HL WR4 = WR3 + HL longmoments = (open < R1 and close > R1) or (open < R2 and close > R2) or (open < R3 and close > R3) or (open < R4 and close > R4) or (open < R5 and close > R5) or (open < pivbase and close > pivbase) or (open < S1 and close > S1) or (open < S2 and close > S2) or (open < S3 and close > S3) or (open < S4 and close > S4) or (open < S5 and close > S5) shortmoments = (open > R1 and close < R1) or (open > R2 and close < R2) or (open > R3 and close < R3) or (open > R4 and close < R4) or (open > R5 and close < R5) or (open > pivbase and close < pivbase) or (open > S1 and close < S1) or (open > S2 and close < S2) or (open > S3 and close < S3) or (open > S4 and close < S4) or (open > S5 and close < S5) Tlongmoments = (open < TR1 and close > TR1) or (open < TR2 and close > TR2) or (open < TR3 and close > TR3) or (open < TR4 and close > TR4) or (open < TR5 and close > TR5) or (open < pivbase and close > pivbase) or (open < TS1 and close > TS1) or (open < TS2 and close > TS2) or (open < TS3 and close > TS3) or (open < TS4 and close > TS4) or (open < TS5 and close > TS5) Tshortmoments = (open > TR1 and close < TR1) or (open > TR2 and close < TR2) or (open > TR3 and close < TR3) or (open > TR4 and close < TR4) or (open > TR5 and close < TR5) or (open > pivbase and close < pivbase) or (open > TS1 and close < TS1) or (open > TS2 and close < TS2) or (open > TS3 and close < TS3) or (open > TS4 and close < TS4) or (open > TS5 and close < TS5) Wlongmoments = (open < WR1 and close > WR1) or (open < WR2 and close > WR2) or (open < WR3 and close > WR3) or (open < pivbase and close > pivbase) or (open < WS1 and close > WS1) or (open < WS2 and close > WS2) or (open < WS3 and close > WS3) Wshortmoments = (open > WR1 and close < WR1) or (open > WR2 and close < WR2) or (open > WR3 and close < WR3) or (open > pivbase and close < pivbase) or (open > WS1 and close < WS1) or (open > WS2 and close < WS2) or (open > WS3 and close < WS3) float FL = 0.0 FL := longmoments ? 1 : 0 float FS = 0.0 FS := shortmoments ? 1 : 0 float TL = 0.0 TL := Tlongmoments ? 1 : 0 float TS = 0.0 TS := Tshortmoments ? 1 : 0 float WL = 0.0 WL := Wlongmoments ? 1 : 0 float WS = 0.0 WS := Wshortmoments ? 1 : 0 x= FL + TL + WL x2= FS + TS + WS ema = ema((sum(x,Length)), Length) - ema((sum(x2,Length)), Length) hline(0) colorset = (ema >= 0 and ema > ema[1]) ? #388e3c : (ema >= 0 and ema < ema[1]) ? #a5d6a7 : (ema < 0 and ema < ema[1]) ? #d32f2f : (ema < 0 and ema > ema[1]) ? #ef9a9a : na plot(ema, style=plot.style_columns, color=colorset)
Linear Regression Histogram [LuxAlgo]
https://www.tradingview.com/script/1nJPItpz-Linear-Regression-Histogram-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
2,782
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("Linear Regression Histogram [LuxAlgo]",overlay=true,max_lines_count=500,max_bars_back=500) length = input.int(100,maxval=500) bins = input.int(10,'Bins Number') mult = input.float(2.) src = input(close) show_hist = input(true,'Show Histogram',group='Style') dn_col = input.color(#ff1100,'Channel Color',group='Style',inline='channel') up_col = input.color(#2157f3,'',group='Style',inline='channel') hist_col = input.color(#ff5d00,'Histogram Bins Color',group='Style') //---- var l_reg = array.new_line(0) var l_hist = array.new_line(0) lset(l,x1,y1,x2,y2,col)=> line.set_xy1(l,x1,y1) line.set_xy2(l,x2,y2) line.set_color(l,col) if barstate.isfirst for i = 1 to bins array.push(l_reg,line.new(na,na,na,na)) array.push(l_hist,line.new(na,na,na,na)) //---- n = bar_index v = ta.variance(src,length) r = ta.correlation(src,n,length) alpha = r*(math.sqrt(v)/ta.stdev(n,length)) beta = ta.sma(src,length) - alpha*ta.sma(n,length) mad = math.sqrt(v - v*math.pow(r,2))*mult //---- if barstate.islast a = alpha*(n-length+1) + beta - mad b = alpha*n + beta - mad for i = 0 to bins-2 k = i/(bins-1) wmad = k*mad*2 css = color.from_gradient(k,0,1,dn_col,up_col) lset(array.get(l_reg,i),n-length+1,a+wmad,n,b+wmad,css) if show_hist sum = 0. for j = 0 to length-1 K = (i+1)/(bins-1) upper = alpha*(n-j) + beta - mad + (K*mad*2) lower = alpha*(n-j) + beta - mad + wmad sum := src[j] > lower and src[j] < upper ? sum + 1 : sum lset(array.get(l_hist,i),n,b+wmad,n+int(sum),b+wmad,hist_col) lset(array.get(l_reg,bins-1),n-length+1,a+mad*2,n,b+mad*2,up_col)
All-Time High/Low Widget
https://www.tradingview.com/script/1UW4IRTx-All-Time-High-Low-Widget/
QuantNomad
https://www.tradingview.com/u/QuantNomad/
854
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © QuantNomad //@version=5 indicator('All-Time High/Low', shorttitle='ATH/ATL', overlay=true) //////////// // INPUTS // show_ath = input(true, "Show All Time High?") show_atl = input(false, "Show All Time Low?") show_table = input(true, "Show table with stats?") /////////////// // FUNCTIONS // // all-time high function get_all_time_high() => h = 0.0 t = 0 h := bar_index == 0 ? high : high > h[1] ? high : h[1] t := bar_index == 0 ? time : high > h[1] ? time : t[1] [h, t] // all-time low function get_all_time_low() => l = 0.0 t = 0 l := bar_index == 0 ? low : low < l[1] ? low : l[1] t := bar_index == 0 ? time : low < l[1] ? time : t[1] [l, t] // getting all-time high/low [ath, ath_dt] = request.security(syminfo.tickerid, 'D', get_all_time_high()) [atl, atl_dt] = request.security(syminfo.tickerid, 'D', get_all_time_low()) ath_days = math.round((timenow - ath_dt) / 86400000) atl_days = math.round((timenow - atl_dt) / 86400000) // plotting if show_ath lATH=line.new(bar_index - 1, ath, bar_index, ath, extend = extend.both, color = color.green) line.delete(lATH[1]) if show_atl lATL=line.new(bar_index - 1, atl, bar_index, atl, extend = extend.both, color = color.red) line.delete(lATL[1]) if show_table var table ATHtable = table.new(position.bottom_right, 6, 3, frame_color = color.gray, bgcolor = color.gray, border_width = 1, frame_width = 1, border_color = color.white) ath_time = str.tostring(year(ath_dt)) + "-" + str.tostring(month(ath_dt)) + "-" + str.tostring(dayofmonth(ath_dt)) atl_time = str.tostring(year(atl_dt)) + "-" + str.tostring(month(atl_dt)) + "-" + str.tostring(dayofmonth(atl_dt)) // Header table.cell(ATHtable, 0, 0, "", bgcolor = #cccccc) table.cell(ATHtable, 1, 0, "When?", bgcolor = #cccccc) table.cell(ATHtable, 2, 0, "Days ago", bgcolor = #cccccc) table.cell(ATHtable, 3, 0, "Price", bgcolor = #cccccc) table.cell(ATHtable, 4, 0, "% away", bgcolor = #cccccc) table.cell(ATHtable, 5, 0, "$ away", bgcolor = #cccccc) if (show_ath) // ATH table.cell(ATHtable, 0, 1, "ATH", bgcolor = #cccccc) table.cell(ATHtable, 1, 1, ath_time, bgcolor = color.new(color.green, transp = 50)) table.cell(ATHtable, 2, 1, str.tostring(ath_days), bgcolor = color.new(color.green, transp = 50)) table.cell(ATHtable, 3, 1, str.tostring(ath, format.mintick), bgcolor = color.new(color.green, transp = 50)) table.cell(ATHtable, 4, 1, str.tostring(((ath / close) - 1) * 100 , "#.##") + "%", bgcolor = color.new(color.green, transp = 50)) table.cell(ATHtable, 5, 1, str.tostring(ath - close , format.mintick), bgcolor = color.new(color.green, transp = 50)) if (show_atl) // ATL table.cell(ATHtable, 0, 2, "ATL", bgcolor = #cccccc) table.cell(ATHtable, 1, 2, atl_time, bgcolor = color.new(color.red, transp = 50)) table.cell(ATHtable, 2, 2, str.tostring(atl_days), bgcolor = color.new(color.red, transp = 50)) table.cell(ATHtable, 3, 2, str.tostring(atl, format.mintick), bgcolor = color.new(color.red, transp = 50)) table.cell(ATHtable, 4, 2, str.tostring(((atl / close) - 1) * 100 , "#.##") + "%", bgcolor = color.new(color.red, transp = 50)) table.cell(ATHtable, 5, 2, str.tostring(atl - close, format.mintick), bgcolor = color.new(color.red, transp = 50)) // alerts alertcondition(ta.crossover(high, ath), 'All-time High!', 'All-time High!') alertcondition(ta.crossunder(low, atl), 'All-time Low!', 'All-time Low!')
BTCUSD Risk Oscillator
https://www.tradingview.com/script/jutgFTAr-BTCUSD-Risk-Oscillator/
Skywalking2874
https://www.tradingview.com/u/Skywalking2874/
235
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Skywalking2874 //@version=5 // Bitcoin Market Cycles (Taken from the Bitcoin All Time History Index): // 1. Bottom: 2010-07-17 : $0.05 (first recorded candle) // Top: 2011-06-08 : $29.60 // 2. Bottom: 2011-11-18 : $2.05 // Top: 2013-12-04 : $1237.96 // 3. Bottom: 2015-01-14 : $182.00 // Top: 2017-12-16 : $19423.67 // 4. Bottom: 2018-12-15 : $3181.68 // Top: TBD (Presumed local top @ 2021-04-13 : $63589.92) // Bitcoin Halving Dates: // 1. 2012-11-28 : 50BTC/block - 7200 BTC/Day // 2. 2016-07-09 : 25BTC/block - 3600 BTC/Day // 3. 2020-05-11 : 12.5BTC/block - 1800 BTC/Day indicator("Risk", overlay = false, max_bars_back=5000) find_ath(_src) => // Returns a series of the ATH value var ath = 0.0 if _src > ath ath := _src ath find_atl(_src) => // Returns a series of the ATL value var atl = 2.5 if _src < atl atl := _src atl normalize(_src, min, max) => // Normalizes series from 0 to 1 (_src - min) / (max - min) //Halving Dates halving1 = timestamp("2012-11-28") halving2 = timestamp("2016-07-09") halving3 = timestamp("2020-05-11") //Normalization Dates Note: data from pre bottom2 will not be used start = timestamp("2010-07-17") bottom2 = timestamp("2011-11-18") bottom3 = timestamp("2015-01-14") bottom4 = timestamp("2018-12-15") //*********************************************** 50Day/50Week ***********************************************// fastslow_ratio_min_cycle1 = 0.79 fastslow_ratio_max_cycle1 = 5.92 fastslow_ratio_min_cycle2 = 0.71 fastslow_ratio_max_cycle2 = 3.47 fastslow_ratio_min_cycle3 = 0.64 fastslow_ratio_max_cycle3 = 2.6 // fastslow_ratio_min_cycle4 = input.float(0.64, "Fast/Slow Ratio Minimum Value", 0, 1000, 0.01, "Input the minimum value displayed by the Fast/Slow Ratio") // fastslow_ratio_max_cycle4 = input.float(2.11, "Fast/Slow Ratio Maximum Value", 0, 1000, 0.01, "Input the maximum value displayed by the Fast/Slow Ratio") fastslow_ratio_min_cycle4 = 0.64 fastslow_ratio_max_cycle4 = 2.11 fiftyday = ta.ema(close, 50) fiftyweek = request.security(syminfo.tickerid, "W", fiftyday) fastslow_ratio = fiftyday / fiftyweek fastslow_ratio_normalized = close //create a dummy series if time >= bottom4 fastslow_ratio_normalized := normalize(fastslow_ratio, fastslow_ratio_min_cycle4, fastslow_ratio_max_cycle4) if time >= bottom3 and time < bottom4 fastslow_ratio_normalized := normalize(fastslow_ratio, fastslow_ratio_min_cycle3, fastslow_ratio_max_cycle3) if time >= bottom2 and time < bottom3 fastslow_ratio_normalized := normalize(fastslow_ratio, fastslow_ratio_min_cycle2, fastslow_ratio_max_cycle2) if time >= start and time < bottom2 fastslow_ratio_normalized := normalize(fastslow_ratio, fastslow_ratio_min_cycle1, fastslow_ratio_max_cycle1) // plot(fastslow_ratio_normalized, color = color.orange, title = "Normalized 50Day/50Week") //*********************************************** Price/52W EMA ***********************************************// pricebyfiftytwo_min_cycle1 = 0.49 pricebyfiftytwo_max_cycle1 = 5.08 pricebyfiftytwo_min_cycle2 = 0.47 pricebyfiftytwo_max_cycle2 = 8.91 pricebyfiftytwo_min_cycle3 = 0.43 pricebyfiftytwo_max_cycle3 = 4.70 pricebyfiftytwo_min_cycle4 = 0.48 pricebyfiftytwo_max_cycle4 = 3.09 fiftytwoweek_ema = request.security(syminfo.tickerid, "W", ta.ema(close, 52)) pricebyfiftytwo = close/fiftytwoweek_ema pricebyfiftytwo_normalized = close //create a dummy series if time >= bottom4 pricebyfiftytwo_normalized := normalize(pricebyfiftytwo, pricebyfiftytwo_min_cycle4, pricebyfiftytwo_max_cycle4) if time >= bottom3 and time < bottom4 pricebyfiftytwo_normalized := normalize(pricebyfiftytwo, pricebyfiftytwo_min_cycle3, pricebyfiftytwo_max_cycle3) if time >= bottom2 and time < bottom3 pricebyfiftytwo_normalized := normalize(pricebyfiftytwo, pricebyfiftytwo_min_cycle2, pricebyfiftytwo_max_cycle2) if time >= start and time < bottom2 pricebyfiftytwo_normalized := normalize(pricebyfiftytwo, pricebyfiftytwo_min_cycle1, pricebyfiftytwo_max_cycle1) // plot(pricebyfiftytwo_normalized, color = color.green, title = "Normalized Price/52W EMA") //*********************************************** Price/400D SMA ***********************************************// pricebyfourhundredday_min_cycle1 = 0.52 pricebyfourhundredday_max_cycle1 = 2.49 pricebyfourhundredday_min_cycle2 = 0.45 pricebyfourhundredday_max_cycle2 = 13.20 pricebyfourhundredday_min_cycle3 = 0.34 pricebyfourhundredday_max_cycle3 = 6.15 pricebyfourhundredday_min_cycle4 = 0.38 pricebyfourhundredday_max_cycle4 = 3.86 fourhundredday = ta.sma(close, 400) pricebyfourhundredday = close/fourhundredday pricebyfourhundredday_normalized = close //create a dummy series if time >= bottom4 pricebyfourhundredday_normalized := normalize(pricebyfourhundredday, pricebyfourhundredday_min_cycle4, pricebyfourhundredday_max_cycle4) if time >= bottom3 and time < bottom4 pricebyfourhundredday_normalized := normalize(pricebyfourhundredday, pricebyfourhundredday_min_cycle3, pricebyfourhundredday_max_cycle3) if time >= bottom2 and time < bottom3 pricebyfourhundredday_normalized := normalize(pricebyfourhundredday, pricebyfourhundredday_min_cycle2, pricebyfourhundredday_max_cycle2) if time >= start and time < bottom2 pricebyfourhundredday_normalized := normalize(pricebyfourhundredday, pricebyfourhundredday_min_cycle1, pricebyfourhundredday_max_cycle1) // plot(pricebyfourhundredday_normalized, color = color.purple, title = "Normalized Price/52W EMA") //*********************************************** Mayer Multiple ***********************************************// mayer_multiple_min_cycle1 = 0.26 mayer_multiple_max_cycle1 = 13.26 mayer_multiple_min_cycle2 = 0.24 mayer_multiple_max_cycle2 = 8.25 mayer_multiple_min_cycle3 = 0.42 mayer_multiple_max_cycle3 = 3.74 // mayer_multiple_min_cycle4 = input.float(0.51, "Mayer Multiple Minimum Value", 0, 1000, 0.01, "Input the minimum value displayed by the Mayer Multiple") // mayer_multiple_max_cycle4 = input.float(2.82, "Mayer Multiple Maximum Value", 0, 1000, 0.01, "Input the maximum value displayed by the Mayer Multiple") mayer_multiple_min_cycle4 = 0.51 mayer_multiple_max_cycle4 = 2.82 mayer_multiple = close/ta.sma(close, 200) mayer_multiple_normalized = close //create a dummy series if time >= bottom4 mayer_multiple_normalized := normalize(mayer_multiple, mayer_multiple_min_cycle4, mayer_multiple_max_cycle4) if time >= bottom3 and time < bottom4 mayer_multiple_normalized := normalize(mayer_multiple, mayer_multiple_min_cycle3, mayer_multiple_max_cycle3) if time >= bottom2 and time < bottom3 mayer_multiple_normalized := normalize(mayer_multiple, mayer_multiple_min_cycle2, mayer_multiple_max_cycle2) if time >= start and time < bottom2 mayer_multiple_normalized := normalize(mayer_multiple, mayer_multiple_min_cycle1, mayer_multiple_max_cycle1) // plot(mayer_multiple_normalized, color = color.yellow, title = "Normalized Mayer Multiple") //*********************************************** Puell Multiple ***********************************************// puell_multiple_min_cycle1 = 0.45 puell_multiple_max_cycle1 = 4.74 puell_multiple_min_cycle2 = 0.41 puell_multiple_max_cycle2 = 12.35 puell_multiple_min_cycle3 = 0.36 puell_multiple_max_cycle3 = 5.73 // puell_multiple_min_cycle4 = input.float(0.4, "Puell Multiple Value", 0, 1000, 0.01, "Input the minimum value displayed by the Puell Multiple") // puell_multiple_max_cycle4 = input.float(3.38, "Puell Multiple Value", 0, 1000, 0.01, "Input the maximum value displayed by the Puell Multiple") puell_multiple_min_cycle4 = 0.4 puell_multiple_max_cycle4 = 3.38 btc_issuance = 7200*close if time >= halving3 btc_issuance := 1800*close if time >= halving2 and time < halving3 btc_issuance := 3600*close btc_issuance_ma = ta.sma(btc_issuance, 365) puell_multiple = btc_issuance/btc_issuance_ma puell_multiple_normalized = close //create a dummy series if time >= bottom4 puell_multiple_normalized := normalize(puell_multiple, puell_multiple_min_cycle4, puell_multiple_max_cycle4) if time >= bottom3 and time < bottom4 puell_multiple_normalized := normalize(puell_multiple, puell_multiple_min_cycle3, puell_multiple_max_cycle3) if time >= bottom2 and time < bottom3 puell_multiple_normalized := normalize(puell_multiple, puell_multiple_min_cycle2, puell_multiple_max_cycle2) if time >= start and time < bottom2 puell_multiple_normalized := normalize(puell_multiple, puell_multiple_min_cycle1, puell_multiple_max_cycle1) // plot(puell_multiple_normalized, color = color.blue, title = "Normalized Puell Multiple") //*********************************************** Sharpe Ratio ***********************************************// sharpe_ratio_min_cycle1 = -1.29 sharpe_ratio_max_cycle1 = 0.53 sharpe_ratio_min_cycle2 = -6.8 sharpe_ratio_max_cycle2 = 3.32 sharpe_ratio_min_cycle3 = -13.73 sharpe_ratio_max_cycle3 = 3.21 // sharpe_ratio_min_cycle4 = input.float(-10.51, "Sharpe Ratio Minimum Value", -1000, 1000, 0.01, "Input the minimum value displayed by the Sharpe Ratio") // sharpe_ratio_max_cycle4 = input.float(0.39, "Sharpe Ratio Maximum Value", 0, 1000, 0.01, "Input the maximum value displayed by the Sharpe Ratio") sharpe_ratio_min_cycle4 = -10.51 sharpe_ratio_max_cycle4 = 0.39 pct_change = ((close - close[1])/close[1])*100 pct_change_mean = ta.ema(pct_change, 200) pct_change_stdev = ta.stdev(pct_change_mean, 200) sharpe_ratio = (pct_change_mean-1)/pct_change_stdev sharpe_ratio_normalized = close //create a dummy series if time >= bottom4 sharpe_ratio_normalized := normalize(sharpe_ratio, sharpe_ratio_min_cycle4, sharpe_ratio_max_cycle4) if time >= bottom3 and time < bottom4 sharpe_ratio_normalized := normalize(sharpe_ratio, sharpe_ratio_min_cycle3, sharpe_ratio_max_cycle3) if time >= bottom2 and time < bottom3 sharpe_ratio_normalized := normalize(sharpe_ratio, sharpe_ratio_min_cycle2, sharpe_ratio_max_cycle2) if time >= start and time < bottom2 sharpe_ratio_normalized := normalize(sharpe_ratio, sharpe_ratio_min_cycle1, sharpe_ratio_max_cycle1) // plot(sharpe_ratio_normalized, color = color.white, title = "Normalozed Sharpe Ratio") //*********************************************** Power Law Corridor ***********************************************// // Days X-Axis Value days = ta.barssince(time <= start) offset = (start - timestamp("2009-01-03"))/86400000 // days between gensis block and start of data d = days + offset // Fair Value // a1 = input(-16.9859613,'FV a') // b1 = input(5.8854167, 'FV b') a1 = -16.9859613 b1 = 5.8854167 e1 = a1 + b1*math.log10(d) y1 = math.pow(10,e1) // Upper Band // a2 = input(-13.2938766,'UB a') // b2 = input(5.0123459,'UB b') a2 = -13.2938766 b2 = 5.0123459 e2 = a2 + b2*math.log10(d) y2 = math.pow(10,e2) // Lower Band // a3 = input(-17.3101322,'LB a') // b3 = input(5.8621456,'LB b') a3 = -17.3101322 b3 = 5.8621456 e3 = a3 + b3*math.log10(d) y3 = math.pow(10,e3) delta = close - y3 delta_normalized = delta/(y2-y3) // plot(delta_normalized, color = color.red) //*********************************************** Overall Risk ***********************************************// overall_risk = input.float(0, "50D/50W Indicator Weight", 0, 1, 0.01)*fastslow_ratio_normalized + input.float(0.1666667, "Price/52W EMA", 0, 1, 0.01)*pricebyfiftytwo_normalized + input.float(0.1666667, "Price/400D SMA", 0, 1, 0.01)*pricebyfourhundredday_normalized + input.float(0.1666667, "Mayer Multiple Weight", 0, 1, 0.01)*mayer_multiple_normalized + input.float(0.1666667, "Puell Multiple Weight", 0, 1, 0.01)*puell_multiple_normalized + input.float(0.1666667, "Sharpe Ratio Weight", 0, 1, 0.01)*sharpe_ratio_normalized + input.float(0.1666667, "Power Law Weight", 0, 1, 0.01)*delta_normalized //*********************************************** Plot ***********************************************// green0 = color.new(color.green, 61) green1 = color.new(color.green, 69) green2 = color.new(color.green, 76) green3 = color.new(color.green, 83) green4 = color.new(color.green, 90) red0 = color.new(color.red, 90) red1 = color.new(color.red, 83) red2 = color.new(color.red, 76) red3 = color.new(color.red, 69) red4 = color.new(color.red, 61) transparant = color.rgb(0, 0, 0, 100) buy0 = hline(0.0, color=transparant) buy1 = hline(0.1, color=transparant) buy2 = hline(0.2, color=transparant) buy3 = hline(0.3, color=transparant) buy4 = hline(0.4, color=transparant) buy5 = hline(0.5, color=transparant) sell0 = hline(0.6, color=transparant) sell1 = hline(0.7, color=transparant) sell2 = hline(0.8, color=transparant) sell3 = hline(0.9, color=transparant) sell4 = hline(1.0, color=transparant) fill(buy0, buy1, green0, "DCA 5x") fill(buy1, buy2, green1, "DCA 4x") fill(buy2, buy3, green2, "DCA 3x") fill(buy3, buy4, green3, "DCA 2x") fill(buy4, buy5, green4, "DCA 1x") fill(sell0, sell1, red0, "DCA 1y") fill(sell1, sell2, red1, "DCA 2y") fill(sell2, sell3, red2, "DCA 3y") fill(sell3, sell4, red3, "DCA 4y") plot(overall_risk, color=color.rgb(0, 128, 255), title = "Normalized Risk")
[DS]Bitcoin BTC ETH and others cryptos
https://www.tradingview.com/script/NxeVBbuf/
DalmarSantos
https://www.tradingview.com/u/DalmarSantos/
522
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/ // © DalmarSantos - Tadingview //@version=4 //[DS]Bitcoin BTC ETH and others cryptos - any kind of cryptcoin // //================== English version //The script was based on the setup of the average 8 on the weekly chart // Price above average 8 on weekly market in UP trend, below market in DOWN trend // RSI greater than 60% : BULL Market // RSI greater than 40% and lower 60% : ACCUMULATION // RSI less than 40% BEAR Market // FUNCTIONS used //(1) Average 8, 21 and 56 on Weekly - show the avarage 8, 21, 56 weekly on graphic //(2) Crossing of averages 8 and 21 Weekly - is not active but you can activate //(3) RSI Calculation //(4) barcolor() - mark the candles with the green color (High market) and red color (Dow market) //(5) alertcondition() - you can activite this alert on Tadingview //NOTE: This indicator is not a buy and sell recommendation, it indicates the most likely buy and sell points. Every purchase and sale decision is your responsibility //++++++++++++++++++ Versão em Portugues //O script foi baseado no setup da média 8 no gráfico semanal - qualquer tipo de cryptomoeda // Preço acima da média 8 no semanal mercado em tendência de ALTA, abaixo mercado em tendência de BAIXA // RSI maior que 60% o mercado esta em ALTA // RSI maior que 40% e menor 60% o mercado esta em ACUMULAçÃO // RSI menor que 40% o mercado esta em BAIXA // Funções utilizadas //(1) Média 8, 21 e 56 no Semanal - mosta a média 8, 21, e 56 no gráfico //(2) Cruzamento das médias 8 e 21 Semanal - não está ativo mas você pode ativá-lo //(3) Cálculo do RSI //(4) barcolor() - marca a vela (Candle) com a cor verde (Mercado em Alta) e a cor vermelha (Mercado em Baixa) //(5) alertcondition () - you can activite this alert on Tadingview //NOTA: Este indicador não é recomendação de compra e venda ele indica os pontos mais prováveis de compra e venda. Toda decisão de compra e venda é de sua responsabilidade study(title="[DS]Bitcoin BTC ETH and others cryptos", overlay=true) _ZIGZAG = input(title = "═════ Mostrar no Gráfico ══════════", type = input.bool, defval = false) show_media8W = input(true, title="Média 8 semanal ?") //weekly 8 show_media21W = input(true, title="Média 21 semanal ?") //weekly 21 show_media56W = input(true, title="Média 56 semanal ?") //weekly 56 show_Dados = input(true, title="Texto do RSI?") // RSI text show_Tendencia = input(true, title="Pontos de Tendência de ALTA e Baixa?") //High and Low Trend Points show_Cruzamento = input(false, title="Cruzamentos da Média 8w e 21w semanais?") //crossovers weekly 8w and 21w show_LinhaTendecia = input(false, title="Linha de Tendencia?") //crossovers weekly 8w and 21w // //************************************************************************ //Function==> Função | Média 8, 21 e 56 no Semanal == EMA 8, 21, 56 weekly //Reference: Pine Script Manual //************************************************************************ //**** EMA Semanal == EMA weekly //** EMA 8W _ema8W = input(title = "═══ Média 8 semanal ══════════", type = input.bool, defval = false) len_8W = input(8, minval=1, title="Tamanho") src_8W = input(close, title="Fonte") out_8W =ema(src_8W, len_8W) res_8W = input(title="Resolução", type=input.resolution, defval="1W") ema8W= security(syminfo.tickerid, res_8W, out_8W, gaps=true) //** EMA 21W _ema21W = input(title = "═══ Média 21 semanal ══════════", type = input.bool, defval = false) len_21W = input(21, minval=1, title="Tamanho") src_21W = input(close, title="Fonte") out_21W =ema(src_21W, len_21W) res_21W = input(title="Resolução", type=input.resolution, defval="1W") ema21W= security(syminfo.tickerid, res_21W, out_21W, gaps=true) //** EMA 56W _ema56 = input(title = "═══ Média 56 semanal ══════════", type = input.bool, defval = false) len_56W = input(56, minval=1, title="Tamanho") src_56W = input(close, title="Fonte") out_56W =ema(src_56W, len_56W) res_56W = input(title="Resolução", type=input.resolution, defval="1W") ema56W= security(syminfo.tickerid, res_56W, out_56W, gaps=true) // //********************************************************************************************** //Function==> Função | Cruzamento das médias 8 e 21 Semanal == Crossing 8 and 21 wekkly averages //Reference: Pine Script Manual //********************************************************************************************** //Identifica os locais de cruzamento entre as médias 8 e 21 semanais //==Identifies the crossing places between the 8 and 21 weekly averages sinal = 0 sinal_Tendencia=0 if crossover(ema8W, ema21W) sinal := 1 sinal_Tendencia := 1 if crossunder(ema8W, ema21W) sinal := -1 sinal_Tendencia := -1 sinal := sinal==0 ? sinal[1] : sinal corsinal = sinal[1]==1 ? color.green : sinal[1]==-1 ? color.red : color.black // //******************************************************* //Function==> Função | Cálculo do RSI == RSI Calculation //Reference: Pine Script Manual //******************************************************* _RSI = input(title = "═════ Dados para RSI ══════════", type = input.bool, defval = false) nVelas = input(17, minval=1, title="Número de Velas") Fonte = input(close, "Fonte", type = input.source) //clseo [fechamento] pCima = rma(max(change(Fonte), 0), nVelas) pBaixo = rma(-min(change(Fonte), 0), nVelas) rsi_Overbought = input(60, minval=51, title="RSI-SobreCompra") rsi_OverSold = input(40, minval=51, title="RSI-Sobre-Venda") rsi = pBaixo == 0 ? 100 : pCima == 0 ? 0 : 100 - (100 / (1 + pCima / pBaixo)) // Mostra cor do indicador de acordo com a tendência corTest=color.white colorText = color.white estilo = label.style_label_up offset = 0.0 colorRSI = color.blue espessuraRSI = 2 testa_cor=0 //*************************************************************************************** //*** Identifica a cor da linha do RSI - Uso na coloração da média 8 semanal == Color RSI //*************************************************************************************** //Mercado em ALTA == BULL MARKET if rsi>=rsi_Overbought //linha dos 60% - ALTA corTest := color.new(color.green,0) colorText := color.white estilo := label.style_label_down colorRSI := color.green testa_cor := 1 //Mercado tendência de ALTA == Uptrend if rsi>50 and rsi<=rsi_Overbought //linha entre 50% e 60% - Tendência de ALTA corTest := color.new(color.green,50) colorText := color.black estilo := label.style_label_up //colorRSI := color.purple colorRSI := color.new(color.green,50) testa_cor := 1 //Mercado tendência de BAIXA == Downtrend if rsi<50 and rsi>rsi_OverSold //linha entre 50% e 40% - Tendência de BAIXA corTest := color.new(color.red,50) colorText := color.black estilo := label.style_label_down //colorRSI := color.blue colorRSI := color.new(color.red,50) testa_cor := -1 //Mercado em BAIXA == BEAR MARKET if rsi<rsi_OverSold //linha dos 460% - BAIXA corTest := color.new(color.red,0) // verde escuro colorText := color.white estilo := label.style_label_up colorRSI := color.red testa_cor := -1 //*************************************************************************** //********** Mostra informações no Gráfico == Show the information on graphic //*************************************************************************** //** Cruzamento de Medias 8 e 21 no Diário == crossing 8 and 21 weekly average plot(show_Cruzamento==true and crossover(ema8W, ema21W) ? ema8W : na, color=color.green, style = plot.style_circles, linewidth = 7) //cruzamento ALTA ema8W X ema21W plot(show_Cruzamento==true and crossunder(ema8W, ema21W) ? ema8W : na, color=color.red, style = plot.style_circles, linewidth = 7) //cruzamento BAIXA ema8W X ema21W // Plota a EMA 8 e 21 e 56 Semanal (1W) em qualquer tempo gráfico == Weekly avarage 8, 21 and 56 //*** Plotar EMAs plot(show_media8W==false ? na : ema8W, color=colorRSI, title="EMA8W", linewidth=6) plot(show_media21W==false ? na : ema21W, color=color.new(color.orange,80), title="EMA21W", linewidth=3) plot(show_media56W==false ? na : ema56W, color=color.new(color.purple,80), title="EMA56W", linewidth=3) //*** Monstra pontos de Tendência de Alta e Baxia - market TREND //plotarrow(show_Tendencia==true and testa_cor[1]==-1 and testa_cor==1? testa_cor : na, title="Tendência de Alta", colorup=color.new(color.green,50), maxheight=40, minheight=40) //plotarrow(show_Tendencia==true and testa_cor[1]==1 and testa_cor==-1? testa_cor : na, title="Tendência de Baixa", colordown=color.new(color.red,50), maxheight=-40, minheight=-40) //Buy point ==> pontos de compra plotshape(show_Tendencia==true and testa_cor[1]==-1 and testa_cor==1? high : na, style=shape.labelup, location=location.belowbar, text="Buy", transp=0, textcolor = color.white, color=color.green, editable=false) //Sell points ==> pontos de venda plotshape(show_Tendencia==true and testa_cor[1]==1 and testa_cor==-1? low : na, style=shape.labeldown, location=location.abovebar, text="Sell", transp=0, textcolor = color.white, color=color.red, editable=false) //Cross Point ==> pontos de cruzamento crossUP= testa_cor[1]==-1 and testa_cor==1? high : na crossDN=testa_cor[1]==1 and testa_cor==-1? low : na //Show de Buy and Sell points ==> mostra pontos de compra e venda tradeColor=crossUP ? color.red : crossDN ? color.green : na //line buy or sell ==> linha de compra ou venda plot(show_LinhaTendecia==true and crossUP ? low : show_LinhaTendecia==true and crossDN ? high : na, color=tradeColor, style=plot.style_line, linewidth=4, editable=false) //******************************* //Function==> Função | Barcolor() //******************************* //Plota as cores ds candels em função das cores do RSI barcolor(color=colorRSI, title="EMA Diaria") //** Mostra o texto do RSI == RSI Text corADX=color.white colorTxtADX = color.white estilo_DADOS = label.style_label_upper_left //** Mercado em ALTA : RSI>=60 : Caixa do texto do RSI em VERDE if rsi>=60 estilo_DADOS := label.style_label_upper_left corADX:=color.new(color.green,0) //** Mercado em ACUMULUAÇÃO : RSI<40 e RSI<60 - Intervalo 40x60 : Caixa do texto do RSI em CINZA if rsi>40 and rsi<60 estilo_DADOS := label.style_label_upper_left corADX:=color.new(color.gray,0) //**Mercado em BAIXA : RSI<=40 : Caixa do texto do RSI em VERMELHO if rsi<=40 estilo_DADOS := label.style_label_lower_left corADX:=color.new(color.red,0) if show_Dados ////indica o valor do rsi como texto myLabel = label.new(x=bar_index, y=close, style= estilo_DADOS, color=corADX, textcolor=colorTxtADX, text="RSI=" + tostring(rsi,"###.#") +"%") // Get the label text labelText = label.get_text(id=myLabel) // Then set the label's text to a new string that // includes its current text label.set_text(id=myLabel, text=labelText) label.delete(myLabel[1]) //ALERTA de COMPRA E VENDA na Tendência alertcondition(testa_cor[1]==-1 and testa_cor==1, title="COMPRAR", message="COMPRA FORTE {{close}} {{ticker}}") //alerta COMPRA FORTE alertcondition(testa_cor[1]==1 and testa_cor==-1, title="VENDER", message="VENDER FORTE {{close}} {{ticker}}") //alerta COMPRA FORTE
Pip Value
https://www.tradingview.com/script/OdV2qkiW-Pip-Value/
ashkanpower
https://www.tradingview.com/u/ashkanpower/
337
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ashkanpower :) //@version=5 indicator("Pip Value", overlay=true) compact = input.bool(title="compact mode",defval=false) pips = input.int(title="Pips",defval=10, minval=1) lots = input.int(title="Micro Lots",defval=1, minval=1) loss = input.float(title="Find Loss $", defval=5, minval=1) ratio = input.float(title="1:x", defval=2, minval=1, maxval=100) cur = syminfo.currency base = syminfo.basecurrency baseusd = nz(request.security(base + "USD", timeframe.period, close, ignore_invalid_symbol=true), 1) jpyFixer = base == "JPY" or cur == "JPY" ? 100 : 1 profit = math.round(pips * (0.1 * lots) / close * baseusd * jpyFixer, 2) theLoss = 0.0 foundPips = 0 for p = 1 to 1000 prof = p * (0.1 * lots) / close * baseusd * jpyFixer if prof > theLoss and prof <= loss theLoss := prof foundPips := p var lab = label.new(0 ,0, "") var table riskTable = table.new(position.bottom_right , 1, 3, bgcolor = color.white, frame_width = 4, border_width = 0) if barstate.islast str1 = "" str2 = "" str1 := str.tostring(profit) + "$ per " + str.tostring(pips) + " pip,s" str2 := "Use " + str.tostring(foundPips) + ":" + str.tostring(foundPips * ratio) + " pips for " + str.tostring(math.round(theLoss, 2)) + "$" table.cell(riskTable, 0, 0, str.tostring(lots / 100) + " lot,s", text_color = color.black, text_halign = text.align_left) table.cell(riskTable, 0, 1, str1, text_color = color.black, text_halign = text.align_left) table.cell(riskTable, 0, 2, str2, text_color = color.black, text_halign = text.align_left) // if barstate.islast // label.delete(lab) // if compact == false // lab := label.new(bar_index + 30, low, , textcolor=color.black, style=label.style_label_center) // else // lab := label.new(bar_index + 30, low, str.tostring(profit) + "$ " + str.tostring(pips) + "p " + str.tostring(lots / 100) + " l\n\n " + str.tostring(foundPips) + ":" + str.tostring(foundPips * ratio) + " " + str.tostring(math.round(theLoss, 2)) + "$ R:R", textcolor=color.black, style=label.style_label_center) // label.set_color(lab, color.white)
RSI c/w MA, ADX and ATR data
https://www.tradingview.com/script/wwAXLnOG-RSI-c-w-MA-ADX-and-ATR-data/
Phantom_007
https://www.tradingview.com/u/Phantom_007/
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/ //@version=5 indicator('RSI c/w ADX and ATR data', overlay=false, max_bars_back=4000) Src = input(defval=close, title='Source') rsilen = input.int(defval=14, title='RSI Length', minval=1) length = input.int(defval=20, title='CMF Length', minval=1) ad = close == high and close == low or high == low ? 0 : (2 * close - low - high) / (high - low) * volume mf = math.sum(ad, length) / math.sum(volume, length) //-------- ADX ---- showadx = input(defval=false, title='Show ADX') adxlen = input(14, title='ADX Smoothing') dilen = input(14, title='DI Length') dirmov(len) => up = ta.change(high) down = -ta.change(low) plusDM = na(up) ? na : up > down and up > 0 ? up : 0 minusDM = na(down) ? na : down > up and down > 0 ? down : 0 truerange = ta.rma(ta.tr, len) plus = fixnan(100 * ta.rma(plusDM, len) / truerange) minus = fixnan(100 * ta.rma(minusDM, len) / truerange) [plus, minus] adx(dilen, adxlen) => [plus, minus] = dirmov(dilen) sum = plus + minus adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) adx adxcol = color.gray sig = adx(dilen, adxlen) plot(showadx ? sig : na, linewidth=1, transp=20) Rsi = ta.rsi(Src, rsilen) //src = Rsi h3 = hline(70, color=color.red, linewidth=2, linestyle=hline.style_solid) h4 = hline(30, color=color.green, linewidth=2, linestyle=hline.style_solid) h1 = hline(55, color=#9915ff) h2 = hline(45, color=#9915ff) hline(50, color=color.gray) fill(h1, h2, color=color.new(#9915ff, 95), title='Background') plot(Rsi, linewidth=2, transp=20) attt = ta.atr(14) showrsma = input(defval=false, title='Show RSI MA') malen = input.int(defval=20, title='RSI SMA Length', minval=2) rsma = ta.sma(Rsi, malen) plot(showrsma ? rsma : na, linewidth=1, color=color.new(color.orange, 10)) var testTable = table.new(position = position.bottom_right, columns = 1, rows = 3, bgcolor = color.red, border_width = 1) if barstate.islast table.cell(table_id = testTable, column = 0, row = 0, text = "RSI is " + str.tostring(math.round(Rsi,1)), text_color=color.white) table.cell(table_id = testTable, column = 0, row = 1, text = "ADX is " + str.tostring(math.round(sig,1)), text_color=color.white) table.cell(table_id = testTable, column = 0, row = 2, text = "ATR is " + str.tostring(math.round(attt,2)), text_color=color.white)
RVI Relative Volume Intraday
https://www.tradingview.com/script/c8f0PLaC-RVI-Relative-Volume-Intraday/
Mkas
https://www.tradingview.com/u/Mkas/
60
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/ // © Mkas //@version=4 study("Relative Volume Intraday", overlay=true) yearNow = year(timenow) monthNow = month(timenow) dateNow = dayofmonth(timenow) hourNow = hour(timenow) minuteNow = minute(timenow) timeinrange(res, sess) => not na(time(res, sess, "America/New_York")) ? 1 : 0 isNewbar(res) => t = time(res) not na(t) and (na(t[1]) or t > t[1]) isToday() => year == yearNow and month == monthNow and dayofmonth == dateNow cumVol = 0.0 cumVol := nz(cumVol[1]) if (timeinrange("1", "0930-1600")) if (hour < hourNow or (hour == hourNow and minute <= minuteNow)) cumVol := cumVol + volume else cumVol := 0 else cumVol := 0 var cumVolD = array.new_float(6) if (isNewbar("D")) array.unshift(cumVolD, cumVol) array.pop(cumVolD) bool(na) else if (cumVol > 0) array.set(cumVolD, 0, cumVol) bool(na) avgVol = array.avg(array.slice(cumVolD, 1, 6)) relVol = isToday() ? round(cumVol / avgVol * 100) : 0 if timeframe.isminutes and timeframe.period != "60" l = label.new(bar_index, na, style=label.style_label_left, size=size.small, tooltip="Volume compared to the same intraday period for the previous 5 days") label.set_xy(l, bar_index + 1, close) label.set_text(l, "RV: " + tostring(relVol) + "%") label.set_textcolor(l, color.black) label.delete(l[1]) clr = color.new(color.gray, 80) if (relVol > 100) clr := color.new(color.green, 80) if (relVol > 200) clr := color.new(color.green, 60) if (relVol > 300) clr := color.new(color.green, 40) if (relVol > 400) clr := color.new(color.green, 20) label.set_textcolor(l, color.white) if (relVol > 500) clr := color.new(color.green, 0) label.set_textcolor(l, color.white) label.set_color(l, clr)
RSI MACD Same Ratio
https://www.tradingview.com/script/zFXnpDet/
dkndkn
https://www.tradingview.com/u/dkndkn/
45
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © dkndkn //@version=5 indicator("RSI MACD Same Ratio", overlay=false) // ---------------------------------------------------------------------------------------------------- // INPUT // ---------------------------------------------------------------------------------------------------- // 共通 float src = input.source(close, title="source") // RSI int period_rsi = input.int(14, title="RSI period") // MACD int period_macd_fast = input.int(12, title="MACD fast period") int period_macd_slow = input.int(26, title="MACD slow period") int period_macd_signal = input.int(9, title="MACD signal period") int macd_coef = input.int(20, title="adjustment ratio") // ---------------------------------------------------------------------------------------------------- // LOGIC // ---------------------------------------------------------------------------------------------------- // RSI float rsi = ta.rsi(src, period_rsi) // MACD [macd_line, signal_line, hist_line] = ta.macd(src, period_macd_fast, period_macd_slow, period_macd_signal) // RSIの最大値を50とし、最小値を-50とする float w_rsi = rsi - 50 // MACDの比率をRSIに合わせる float w_macd_line = macd_line * macd_coef float w_signal_line = signal_line * macd_coef float w_hist_line = hist_line * macd_coef // ---------------------------------------------------------------------------------------------------- // PLOT // ---------------------------------------------------------------------------------------------------- // RSI plot(w_rsi, title="RSI", color=color.green, linewidth=1, style=plot.style_line) // MACD plot(w_macd_line, title="MACD", color=color.red, linewidth=1, style=plot.style_line) plot(w_signal_line, title="MACD signal", color=color.blue, linewidth=1, style=plot.style_line) plot(w_hist_line, title="MACD hist", color=color.new(color.gray, 60), linewidth=1, style=plot.style_histogram) // EOF
RVM Relative Volume Momentum
https://www.tradingview.com/script/yeyhfppH-RVM-Relative-Volume-Momentum/
Mkas
https://www.tradingview.com/u/Mkas/
35
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/ // © Mkas //@version=4 study("Relative Volume Momentum") var dayStarts = array.new_int(6, 0) if (hour(time, "America/New_York") == 9 and minute(time, "America/New_York") == 30) array.unshift(dayStarts, bar_index) array.pop(dayStarts) e = ema(volume, 5) offsetToday = bar_index - array.get(dayStarts, 0) idx1 = bar_index - (array.get(dayStarts, 1) + offsetToday) idx2 = bar_index - (array.get(dayStarts, 2) + offsetToday) idx3 = bar_index - (array.get(dayStarts, 3) + offsetToday) idx4 = bar_index - (array.get(dayStarts, 4) + offsetToday) idx5 = bar_index - (array.get(dayStarts, 5) + offsetToday) max_bars_back(e, 5000) a = avg(e[idx1], e[idx2], e[idx3]) relVol = e / a * 100 clr = color.new(color.gray, 80) if (relVol > 100) clr := color.new(color.green, 80) if (relVol > 200) clr := color.new(color.green, 60) if (relVol > 300) clr := color.new(color.green, 40) if (relVol > 400) clr := color.new(color.green, 20) if (relVol > 500) clr := color.new(color.green, 0) plot(relVol, color=clr, style=plot.style_area)
Price Movement Trend By Alireza Phoenix (Logarithmic)
https://www.tradingview.com/script/8ILZKB4d-Price-Movement-Trend-By-Alireza-Phoenix-Logarithmic/
AlirezaPhoenix
https://www.tradingview.com/u/AlirezaPhoenix/
91
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 // © AlirezaPhoenix // ══════════════════════════════════════════════════════════════════════════════════════════════════ // //# * ══════════════════════════════════════════════════════════════════════════════════════════════ //# * //# * Study : Price Movement Trend By Alireza Phoenix (Logarithmic) //# * Author : Alireza Phoenix //# * //# * Version : 1.1 //# * Release : Oct 10, 2021 //# * //# * //# * ══════════════════════════════════════════════════════════════════════════════════════════════ // ══════════════════════════════════════════════════════════════════════════════════════════════════ // indicator("Price Movement Trend By Alireza Phoenix (Logarithmic)" , shorttitle="PMT By Alireza Phoenix" , overlay=false ) len = 60 len2 = 90 len3 = 1 src1 = high src2 = low src3 = ( src1 + src2 ) / 2 src = close out = ta.rma(src, len) out2 = ta.ema(src, len2) out3 = ta.sma(src, len3) out4 = ta.sma(src3 , 1) t = math.log(out) t2 = math.log(out2) t3 = math.log(out3) t4 = math.log(out4) offset = 20 offset1 = 0 RMAplot = plot(t, color=color.red, title="Leading Line" , offset=offset ) EMAplot = plot(t2, color=color.green, title="Signal Line" , offset = offset1) plot(t3 , color=color.blue , title="PRICE line") plot(t4 , color=color.new(color.maroon , 20) , title = "PRICE Average Line" , display=display.none ) fill(RMAplot, EMAplot, t2[offset1]>t[offset] ? color.new(color.green, 70) : color.new(color.red, 70) , title= "Price Movement Trend Cloud" )
Moving Average Convergence Divergence
https://www.tradingview.com/script/iM9sf49i-Moving-Average-Convergence-Divergence/
kevindcarr
https://www.tradingview.com/u/kevindcarr/
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/ // © kevindcarr //@version=5 indicator(title='Moving Average Convergence Divergence', shorttitle='MACD') var table conditions = table.new(position=position.top_right, columns=1, rows=3) log = input.string(title="Scale", options=['Logarithmic', 'Regular'], defval='Logarithmic') signal = input(title='Signal', defval=9) long = input(title='Long', defval=26) short = input(title='Short', defval=12) source = input(title='Source', defval=close) shortEma = ta.ema(source, short) longEma = ta.ema(source, long) macd = (log == 'Logarithmic' ? math.log(shortEma) - math.log(longEma) : shortEma - longEma) sig = ta.ema(macd, signal) hist = macd - sig macdPlot = plot(series=macd, title='MACD', color=color.new(color.blue, 50)) sigPlot = plot(series=sig, title='Signal', color=color.new(color.silver, 50)) fill(macdPlot, sigPlot, transp=90) highlightHistogram(hist) => chg = ta.change(hist) if hist >= 0 chg / hist > 0 ? color.green : color.new(color.green, 50) else chg / hist > 0 ? color.red : color.new(color.red, 50) plot(hist, title='Histogram', style=plot.style_columns, color=highlightHistogram(hist)) bullSigX = ta.crossover(hist, 0) bearSigX = ta.crossunder(hist, 0) bull0X = ta.crossover(macd, 0) bear0X = ta.crossunder(macd, 0) if bullSigX table.cell(conditions, 0, 0, str.tostring('Signal Cross'), bgcolor=color.green) if bearSigX table.cell(conditions, 0, 0, str.tostring('Signal Cross'), bgcolor=color.red) if ta.change(source) > 0 and ta.change(macd) < 0 table.cell(conditions, 0, 2, str.tostring('Divergence'), bgcolor=color.red) else if ta.change(source) < 0 and ta.change(macd) > 0 table.cell(conditions, 0, 2, str.tostring('Divergence'), bgcolor=color.green) else table.clear(conditions, 0, 2)
vol_premia
https://www.tradingview.com/script/eQYyJpVT-vol-premia/
voided
https://www.tradingview.com/u/voided/
80
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © voided //@version=4 study("vol_premia", overlay = true) len = 252 rv20(x) => r = log(x / x[1]) stdev(r, 20) * sqrt(252) * 100 es = security("ES1!", "D", close) nq = security("NQ1!", "D", close) rty = security("RTY1!", "D", close) ym = security("YM1!", "D", close) tlt = security("TLT", "D", close) fxi = security("FXI", "D", close) efa = security("EFA", "D", close) eem = security("EEM", "D", close) ewz = security("EWZ", "D", close) uso = security("USO", "D", close) gc = security("GC", "D", close) gdx = security("GDX", "D", close) slv = security("SLV", "D", close) fxe = security("FXE", "D", close) aapl = security("AAPL", "D", close) amzn = security("AMZN", "D", close) goog = security("GOOG", "D", close) gs = security("GS", "D", close) ibm = security("IBM", "D", close) vix = security("VIX", "D", close) vxn = security("VXN", "D", close) rvx = security("RVX", "D", close) vxd = security("VXD", "D", close) vxtlt = security("VXTLT", "D", close) vxfxi = security("VXFXI", "D", close) vxefa = security("VXEFA", "D", close) vxeem = security("VXEEM", "D", close) vxewz = security("VXEWZ", "D", close) ovx = security("OVX", "D", close) gvz = security("GVZ", "D", close) vxgdx = security("VXGDX", "D", close) vxslv = security("VXSLV", "D", close) evz = security("EVZ", "D", close) vxapl = security("VXAPL", "D", close) vxazn = security("VXAZN", "D", close) vxgog = security("VXGOG", "D", close) vxgs = security("VXGS", "D", close) vxibm = security("VXIBM", "D", close) es_rv = rv20(es) nq_rv = rv20(nq) rty_rv = rv20(rty) ym_rv = rv20(ym) tlt_rv = rv20(tlt) fxi_rv = rv20(fxi) efa_rv = rv20(efa) eem_rv = rv20(eem) ewz_rv = rv20(ewz) uso_rv = rv20(uso) gc_rv = rv20(gc) gdx_rv = rv20(gdx) slv_rv = rv20(slv) fxe_rv = rv20(fxe) aapl_rv = rv20(aapl) amzn_rv = rv20(amzn) goog_rv = rv20(goog) gs_rv = rv20(gs) ibm_rv = rv20(ibm) es_rp = vix - es_rv nq_rp = vxn - nq_rv rty_rp = rvx - rty_rv ym_rp = vxd - ym_rv tlt_rp = vxtlt - tlt_rv fxi_rp = vxfxi - fxi_rv efa_rp = vxefa - efa_rv eem_rp = vxeem - eem_rv ewz_rp = vxewz - ewz_rv uso_rp = ovx - uso_rv gc_rp = gvz - gc_rv gdx_rp = vxgdx - gdx_rv slv_rp = vxslv - slv_rv fxe_rp = evz - fxe_rv aapl_rp = vxapl - aapl_rv amzn_rp = vxazn - amzn_rv goog_rp = vxgog - goog_rv gs_rp = vxgs - gs_rv ibm_rp = vxibm - ibm_rv es_rp_pct = percentrank(es_rp, len) nq_rp_pct = percentrank(nq_rp, len) rty_rp_pct = percentrank(rty_rp, len) ym_rp_pct = percentrank(ym_rp, len) tlt_rp_pct = percentrank(tlt_rp, len) fxi_rp_pct = percentrank(fxi_rp, len) efa_rp_pct = percentrank(efa_rp, len) eem_rp_pct = percentrank(eem_rp, len) ewz_rp_pct = percentrank(ewz_rp, len) uso_rp_pct = percentrank(uso_rp, len) gc_rp_pct = percentrank(gc_rp, len) gdx_rp_pct = percentrank(gdx_rp, len) slv_rp_pct = percentrank(slv_rp, len) fxe_rp_pct = percentrank(fxe_rp, len) aapl_rp_pct = percentrank(aapl_rp, len) amzn_rp_pct = percentrank(amzn_rp, len) goog_rp_pct = percentrank(goog_rp, len) gs_rp_pct = percentrank(gs_rp, len) ibm_rp_pct = percentrank(ibm_rp, len) if barstate.islast var ot = table.new(position.middle_right, 3, 20, bgcolor = color.white) fmt = "#.##" r = 0 lbl_clr = color.new(color.blue, 70) idx_clr = color.new(color.green, 70) bnd_clr = color.new(color.orange, 70) for_clr = color.new(color.fuchsia, 70) oil_clr = color.new(color.black, 70) gld_clr = color.new(color.yellow, 70) slv_clr = color.new(color.gray, 70) crn_clr = color.new(color.navy, 70) stk_clr = color.new(color.aqua, 70) table.cell(ot, 0, r, "instrument", bgcolor = lbl_clr) table.cell(ot, 1, r, "risk premium", bgcolor = lbl_clr) table.cell(ot, 2, r, "percentile", bgcolor = lbl_clr) r := r + 1 table.cell(ot, 0, r, "ES", bgcolor = idx_clr) table.cell(ot, 1, r, tostring(es_rp, fmt), bgcolor = idx_clr) table.cell(ot, 2, r, tostring(es_rp_pct, fmt), bgcolor = idx_clr) r := r + 1 table.cell(ot, 0, r, "NQ", bgcolor = idx_clr) table.cell(ot, 1, r, tostring(nq_rp, fmt), bgcolor = idx_clr) table.cell(ot, 2, r, tostring(nq_rp_pct, fmt), bgcolor = idx_clr) r := r + 1 table.cell(ot, 0, r, "RTY", bgcolor = idx_clr) table.cell(ot, 1, r, tostring(rty_rp, fmt), bgcolor = idx_clr) table.cell(ot, 2, r, tostring(rty_rp_pct, fmt), bgcolor = idx_clr) r := r + 1 table.cell(ot, 0, r, "YM", bgcolor = idx_clr) table.cell(ot, 1, r, tostring(ym_rp, fmt), bgcolor = idx_clr) table.cell(ot, 2, r, tostring(ym_rp_pct, fmt), bgcolor = idx_clr) r := r + 1 table.cell(ot, 0, r, "TLT", bgcolor = bnd_clr) table.cell(ot, 1, r, tostring(tlt_rp, fmt), bgcolor = bnd_clr) table.cell(ot, 2, r, tostring(tlt_rp_pct, fmt), bgcolor = bnd_clr) r := r + 1 table.cell(ot, 0, r, "FXI", bgcolor = for_clr) table.cell(ot, 1, r, tostring(fxi_rp, fmt), bgcolor = for_clr) table.cell(ot, 2, r, tostring(fxi_rp_pct, fmt), bgcolor = for_clr) r := r + 1 table.cell(ot, 0, r, "EFA", bgcolor = for_clr) table.cell(ot, 1, r, tostring(efa_rp, fmt), bgcolor = for_clr) table.cell(ot, 2, r, tostring(efa_rp_pct, fmt), bgcolor = for_clr) r := r + 1 table.cell(ot, 0, r, "EEM", bgcolor = for_clr) table.cell(ot, 1, r, tostring(eem_rp, fmt), bgcolor = for_clr) table.cell(ot, 2, r, tostring(eem_rp_pct, fmt), bgcolor = for_clr) r := r + 1 table.cell(ot, 0, r, "EWZ", bgcolor = for_clr) table.cell(ot, 1, r, tostring(ewz_rp, fmt), bgcolor = for_clr) table.cell(ot, 2, r, tostring(ewz_rp_pct, fmt), bgcolor = for_clr) r := r + 1 table.cell(ot, 0, r, "USO", bgcolor = oil_clr) table.cell(ot, 1, r, tostring(uso_rp, fmt), bgcolor = oil_clr) table.cell(ot, 2, r, tostring(uso_rp_pct, fmt), bgcolor = oil_clr) r := r + 1 table.cell(ot, 0, r, "GC", bgcolor = gld_clr) table.cell(ot, 1, r, tostring(gc_rp, fmt), bgcolor = gld_clr) table.cell(ot, 2, r, tostring(gc_rp_pct, fmt), bgcolor = gld_clr) r := r + 1 table.cell(ot, 0, r, "GDX", bgcolor = gld_clr) table.cell(ot, 1, r, tostring(gdx_rp, fmt), bgcolor = gld_clr) table.cell(ot, 2, r, tostring(gdx_rp_pct, fmt), bgcolor = gld_clr) r := r + 1 table.cell(ot, 0, r, "SLV", bgcolor = slv_clr) table.cell(ot, 1, r, tostring(slv_rp, fmt), bgcolor = slv_clr) table.cell(ot, 2, r, tostring(slv_rp_pct, fmt), bgcolor = slv_clr) r := r + 1 table.cell(ot, 0, r, "FXE", bgcolor = crn_clr) table.cell(ot, 1, r, tostring(fxe_rp, fmt), bgcolor = crn_clr) table.cell(ot, 2, r, tostring(fxe_rp_pct, fmt), bgcolor = crn_clr) r := r + 1 table.cell(ot, 0, r, "AAPL", bgcolor = stk_clr) table.cell(ot, 1, r, tostring(aapl_rp, fmt), bgcolor = stk_clr) table.cell(ot, 2, r, tostring(aapl_rp_pct, fmt), bgcolor = stk_clr) r := r + 1 table.cell(ot, 0, r, "AMZN", bgcolor = stk_clr) table.cell(ot, 1, r, tostring(amzn_rp, fmt), bgcolor = stk_clr) table.cell(ot, 2, r, tostring(amzn_rp_pct, fmt), bgcolor = stk_clr) r := r + 1 table.cell(ot, 0, r, "GOOG", bgcolor = stk_clr) table.cell(ot, 1, r, tostring(goog_rp, fmt), bgcolor = stk_clr) table.cell(ot, 2, r, tostring(goog_rp_pct, fmt), bgcolor = stk_clr) r := r + 1 table.cell(ot, 0, r, "GS", bgcolor = stk_clr) table.cell(ot, 1, r, tostring(gs_rp, fmt), bgcolor = stk_clr) table.cell(ot, 2, r, tostring(gs_rp_pct, fmt), bgcolor = stk_clr) r := r + 1 table.cell(ot, 0, r, "IBM", bgcolor = stk_clr) table.cell(ot, 1, r, tostring(ibm_rp, fmt), bgcolor = stk_clr) table.cell(ot, 2, r, tostring(ibm_rp_pct, fmt), bgcolor = stk_clr)
Binary Combo
https://www.tradingview.com/script/FqtwDZvG-Binary-Combo/
UnknownUnicorn28067390
https://www.tradingview.com/u/UnknownUnicorn28067390/
537
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/ // © ZacVaughn //@version=4 study("𝐁𝐈𝐍𝐀𝐑𝐘 𝐂𝐎𝐌𝐁𝐎") //WAVETREND CROSS▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ hline(110, color=color.new(#ffffff, 75)) hline(-90, color=color.new(#ffffff, 75)) n1 = 9 n2 = 12 ap = hlc3 esa = ema(ap, n1) d1 = ema(abs(ap - esa), n1) ci = (ap - esa) / (0.015 * d1) tci = ema(ci, n2) hline = 0 wt1 = tci wt2 = sma(wt1, 4) wt1color = wt1 > 0 ? #00bcd4 : #e91e63 wtcrossuppre = wt1 > wt2 and wt1[1] < wt2[1] and wt2 < -10 wtcrossdownpre = wt1 < wt2 and wt1[1] > wt2[1] and wt2 > 10 wtcrossup = wtcrossuppre or wtcrossuppre[1] or wtcrossuppre[2] wtcrossdown = wtcrossdownpre or wtcrossdownpre[1] or wtcrossdownpre[2] plot(wt1, style=plot.style_areabr, color=wt1color) plot(wt2, style=plot.style_areabr, color=color.new(#5d606b, 50)) plot(wt2, color=color.new(#000000, 50), linewidth=2) plot(wtcrossuppre ? wt2 : na, title="Cross Up Circles", color=#00bcd4, style=plot.style_circles, linewidth=3) plot(wtcrossdownpre ? wt2 : na, title="Cross down Circles", color=#e91e63, style=plot.style_circles, linewidth=3) //STOCH DIVERGENCE▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ periodK14 = 14 smoothK14 = 3 periodD14 = 3 k14 = sma(stoch(close, high, low, periodK14), smoothK14) d14 = sma(k14, periodD14) plot(k14, title="%K", linewidth=2, color=#ffeb3b) plot(d14, title="%D", linewidth=1, color=#ffffff) h0 = hline(80, "Upper Band", linestyle=hline.style_solid, color=color.new(#787B86, 50)) h1 = hline(20, "Lower Band", linestyle=hline.style_solid, color=color.new(#787B86, 50)) fill(h0, h1, color=color.new(#00bcd4, 90), title="Background") //Divergence lbR14 = 2 lbL14 = 6 rangeUpper14 = 60 rangeLower14 = 5 plotBull14 = true plotHiddenBull14 = false plotBear14 = true plotHiddenBear14 = false bearColor14 = #e91e63 bullColor14 = #00bcd4 hiddenBullColor14 = #00bcd4 hiddenBearColor14 = #e91e63 textColor14 = color.white noneColor14 = color.new(color.white, 100) osc14 = k14 plFound14 = na(pivotlow(osc14, lbL14, lbR14)) ? false : true phFound14 = na(pivothigh(osc14, lbL14, lbR14)) ? false : true _inRange14(cond) => bars14 = barssince(cond == true) rangeLower14 <= bars14 and bars14 <= rangeUpper14 //Regular Bullish //Osc: Higher Low oscHL14 = osc14[lbR14] > valuewhen(plFound14, osc14[lbR14], 1) and _inRange14(plFound14[1]) //Price: Lower Low priceLL14 = low[lbR14] < valuewhen(plFound14, low[lbR14], 1) bullCond14 = plotBull14 and priceLL14 and oscHL14 and plFound14 plot(plFound14 ? osc14[lbR14] : na, offset=-lbR14, title="Regular Bullish", linewidth=2, color=(bullCond14 ? bullColor14 : noneColor14)) plotshape(bullCond14 ? osc14[lbR14] : na, offset=-lbR14, title="Regular Bullish Label", text="𝐁𝐔𝐋𝐋", style=shape.labelup, location=location.absolute, color=bullColor14, textcolor=textColor14) //Hidden Bullish //Osc: Lower Low oscLL14 = osc14[lbR14] < valuewhen(plFound14, osc14[lbR14], 1) and _inRange14(plFound14[1]) //Price: Higher Low priceHL14 = low[lbR14] > valuewhen(plFound14, low[lbR14], 1) hiddenBullCond14 = plotHiddenBull14 and priceHL14 and oscLL14 and plFound14 plot(plFound14 ? osc14[lbR14] : na, offset=-lbR14, title="Hidden Bullish", linewidth=2, color=(hiddenBullCond14 ? hiddenBullColor14 : noneColor14)) plotshape(hiddenBullCond14 ? osc14[lbR14] : na, offset=-lbR14, title="Hidden Bullish Label", text=" H Bull ", style=shape.labelup, location=location.absolute, color=bullColor14, textcolor=textColor14) //Regular Bearish //Osc: Lower High oscLH14 = osc14[lbR14] < valuewhen(phFound14, osc14[lbR14], 1) and _inRange14(phFound14[1]) //Price: Higher High priceHH14 = high[lbR14] > valuewhen(phFound14, high[lbR14], 1) bearCond14 = plotBear14 and priceHH14 and oscLH14 and phFound14 plot(phFound14 ? osc14[lbR14] : na, offset=-lbR14, title="Regular Bearish", linewidth=2, color=(bearCond14 ? bearColor14 : noneColor14)) plotshape(bearCond14 ? osc14[lbR14] : na, offset=-lbR14, title="Regular Bearish Label", text="𝐁𝐄𝐀𝐑", style=shape.labeldown, location=location.absolute, color=bearColor14, textcolor=textColor14) //Hidden Bearish //Osc: Higher High oscHH14 = osc14[lbR14] > valuewhen(phFound14, osc14[lbR14], 1) and _inRange14(phFound14[1]) //Price: Lower High priceLH14 = high[lbR14] < valuewhen(phFound14, high[lbR14], 1) hiddenBearCond14 = plotHiddenBear14 and priceLH14 and oscHH14 and phFound14 plot(phFound14 ? osc14[lbR14] : na, offset=-lbR14, title="Hidden Bearish", linewidth=2, color=(hiddenBearCond14 ? hiddenBearColor14 : noneColor14)) plotshape(hiddenBearCond14 ? osc14[lbR14] : na, offset=-lbR14, title="Hidden Bearish Label", text=" H Bear ", style=shape.labeldown, location=location.absolute, color=bearColor14, textcolor=textColor14) bulldiv = bullCond14 or bullCond14[1] or bullCond14[2] beardiv = bearCond14 or bearCond14[1] or bearCond14[2] //PLOT STARS▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ plot(wtcrossup and bulldiv ? -90 : na, style=plot.style_circles, color=color.new(#ffeb3b, 50), linewidth=6) plot(wtcrossup and bulldiv ? -90 : na, style=plot.style_circles, color=color.new(#ffffff, 0), linewidth=2) plot(wtcrossdown and beardiv ? 110 : na, style=plot.style_circles, color=color.new(#ffeb3b, 50), linewidth=6) plot(wtcrossdown and beardiv ? 110 : na, style=plot.style_circles, color=color.new(#ffffff, 0), linewidth=2)
Baekdoo golden diamond signal
https://www.tradingview.com/script/ZLk6Yeur-Baekdoo-golden-diamond-signal/
traderbaekdoosan
https://www.tradingview.com/u/traderbaekdoosan/
108
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © traderbaekdoosan //@version=5 indicator("Baekdoo golden diamond signal", overlay=true) //cumulative volume period=input(250) VV=ta.highest(volume[1], period) sumV=math.sum(volume[1], period) //highest volume count=ta.barssince(volume>=VV and close>open) plot(count>0 and count <20 ? close*2:na, color=color.new(color.blue, 20), style=plot.style_areabr, display=display.none) //higher than 10% of 1 year volume ratio=input(0.1) count2=ta.barssince(volume>=sumV*ratio and close>open) plot(count2>0 and count2 <20 ? close : na, color=color.new(color.green, 20), style=plot.style_areabr, display=display.none) //drops without volume ratio2=input(0.5) count3=ta.barssince((volume>=VV or volume>=sumV*ratio) and close>open) plot(count3>0 and count3 <20 and volume<=ta.ema(volume[1], 5)*ratio2 and close<=ta.lowest(close[1], 5) ? close*1.5 : na, color=color.new(color.red, 20), style=plot.style_areabr, display=display.none) //crossover 5 days resistance after dropping without volume count4=ta.barssince(count3>0 and count3 <20 and volume<=ta.ema(volume[1], 5)*ratio2 and close<=ta.lowest(close[1], 5)) plotshape(count4>0 and count4 <10 and close>ta.highest(close[1], 5) ? close : na, color=color.new(color.yellow, 0), style=shape.diamond, display=display.all, size=size.normal)
Asian Session Bollinger Bands
https://www.tradingview.com/script/JSpM7Khx-Asian-Session-Bollinger-Bands/
OrcChieftain
https://www.tradingview.com/u/OrcChieftain/
56
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/ // © greenmask9 //@version=4 study("Asian Session Bollinger Bands", shorttitle = "ASBB", overlay = true) i_frank_ny = input(defval = "0100-1400", title = "Frankfurt Open -> New York Close", type = input.session, group = "Time") tradeRange = input("1400-0100", "Asian Session", input.session, group = "Time") timeinrange(res, sess) => time(res, sess) != 0 frank_ny = timeinrange(timeframe.period, i_frank_ny) Asian = timeinrange(timeframe.period, tradeRange) //BB hide = input(false, title = "Hide Lines?") hide_2 = input(true, title = "Plot only between 20-00 and Frankfurt?") hide_3 = input(true, title = "Plot only in Asian") invisible_color = hide ? color.new(color.blue, 100) : color.navy disappearer = hide_2 ? not frank_ny ? true : false : true disappearer_2 = hide_3 ? Asian ? true : false : true c_disappearers = disappearer and disappearer_2 length = input(20, title = "Length") mult = 2.0 basis = sma(close, length) dev = mult * stdev(close, length) upper = basis + dev lower = basis - dev p1 = plot(c_disappearers ? upper : na, "Upper", color=invisible_color, style = plot.style_linebr) p2 = plot(c_disappearers ? lower : na, "Lower", color=invisible_color, style = plot.style_linebr) p3 = plot(c_disappearers ? basis : na, "Lower", color=invisible_color, style = plot.style_linebr) fill(p1, p2, title = "Background", color=color.rgb(33, 150, 243, 94))
Williams %R & RSI with Multiple Periods
https://www.tradingview.com/script/POQCZJFV-Williams-R-RSI-with-Multiple-Periods/
insideandup
https://www.tradingview.com/u/insideandup/
32
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Nathan J. Hart (insideandup) // @version=5 // // DESCRIPTION // 1. Calculates %R and RSI with multiple period lengths. // 1 period length value is defined by User. // 8 period length values follow User's selection of classic number sequences, e.g. Fibonacci, Leonardo, Lucas, Narayana, etc. // 2. User selects which indicator and periods to display or hide. // // DEFAULTS // %R default custom period: 10. // RSI default custom period: 14. // %R & RSI default number sequence periods: Lucas numbers 11, 18, 29, 47, 76, 123, 199, 322. // // CALCULATIONS // %R = (period high - most recent period's close price)/(period high - period low) // RSI = 100 - 1 / (100 + RS), where RS = SMMA(up, period) / SMMA(down, period) // // PURPOSE // 1. Identify price trends. // // CREDITS // 1. Williams %R technical analysis momentum oscillator by Larry Williams. // 2. Wilder's Relative Strength Index technical analysis momentum oscillator by J. Welles Wilder. // 3. "Solarized" color scheme by Ethan Schoonover. // // CREATED: 31 Dec 2021. // LAST EDITED: 31 Dec 2021. indicator("Williams %R & RSI by 3iau", shorttitle="%R & RSI", format=format.price, precision=2, timeframe="", timeframe_gaps=true) // VARIABLES // Tillson's Moving Average a = 0.618033989 // Tillson applied a = 0.7, here applying the Golden ratio conjugate = |(1-√5)/2| = 0.618033989 a1 = -1*math.pow(a, 3) a2 = 3*math.pow(a, 2) + 3*math.pow(a, 3) a3 = -6*math.pow(a, 2) - 3*a - 3*math.pow(a, 3) a4 = 1 + 3*a + math.pow(a, 3) + 3*math.pow(a, 2) // moving average type selection ma(source, length, type) => type == "SMA" ? ta.sma(source, length) : type == "EMA" ? ta.ema(source, length) : type == "DEMA" ? 2 * ta.ema(source, length) - ta.ema(ta.ema(source, length), length) : type == "TEMA" ? 3 * ta.ema(source, length) - 3 * ta.ema(ta.ema(source, length), length) + ta.ema(ta.ema(ta.ema(source, length), length), length) : type == "QEMA" ? 5 * ta.ema(source, length) - 10 * ta.ema(ta.ema(source, length), length) + 10 * ta.ema(ta.ema(ta.ema(source, length), length), length) - 5 * ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length) + ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length) : type == "PEMA" ? 8 * ta.ema(source, length) - 28 * ta.ema(ta.ema(source, length), length) + 56 * ta.ema(ta.ema(ta.ema(source, length), length), length) - 70 * ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length) + 56 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length) - 28 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length), length) + 8 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length), length), length) - ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length), length), length), length) : type == "ZLEMA" ? ta.ema(source + (source - source[math.round((length - 1) / 2)]), length) : type == "T3" ? a1 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length), length) + a2 * ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length), length) + a3 * ta.ema(ta.ema(ta.ema(ta.ema(source, length), length), length), length) + a4 * ta.ema(ta.ema(ta.ema(source, length), length), length) : type == "HMA" ? ta.hma(source, length) : type == "SMMA" ? ta.rma(source, length) : type == "WMA" ? ta.wma(source, length) : type == "VWMA" ? ta.vwma(source, length) : na // numbers sequences // Select the number sequence that defines period lengths for moving averages ("short" 11 periods 0-10, "mid" 14 periods 0-13, and "long" 16 periods 0-15 sets). // // position: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // // Fibonacci: X, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987. // Leonardo: X, 15, 25, 41, 67, 109, 177, 287, 465, -, 753. // Lucas: X, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843. // Pell: X, 12, 29, 70, 169, 408, 985, 2378, -, -, -. // Padovan: X, 12, 16, 21, 28, 37, 49, 65, 86, 114, 151, 200, 265, 351, 465, 616. // Perrin: X, 12, 17, 22, 29, 39, 51, 68, 90, 119, 158, 209, 277, 367, 486, 644. // Jacobsthal: X, 11, 21, 43, 85, 171, 341, 683, 1365, 2731 -. // Catalan: X, 14, 42, 132, 429, 1430, 4862, -, -, -, -. // Narayana: X, 13, 19, 28, 41, 60, 88, 129, 189, 277, 406. // Magic: X, 15, 34, 65, 111, 175, 260, 369, 505, 671, 870. // Tetrahedral: X, 20, 35, 56, 84, 120, 165, 220, 286, 364, 455. // Mersenne: X, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607. // // sub %R lengths defined by selected number sequence wr_sequence = input.string("Lucas Numbers", "Period Lengths", inline = "Period Lengths", options = ["Fibonacci Numbers", "Leonardo Numbers", "Lucas Numbers", "Padovan Numbers", "Perrin Numbers", "Jacobsthal Numbers", "Narayana Numbers", "Magic Constants", "Tetrahedral Numbers", "Mersenne Exponents"], group = "Select the Number Sequence from which Calculations' Period Lengths are Defined.") wr_1_length = 0 wr_2_length = 0 wr_3_length = 0 wr_4_length = 0 wr_5_length = 0 wr_6_length = 0 wr_7_length = 0 wr_8_length = 0 if (wr_sequence == "Fibonacci Numbers") wr_1_length := 13 wr_2_length := 21 wr_3_length := 34 wr_4_length := 55 wr_5_length := 89 wr_6_length := 144 wr_7_length := 233 wr_8_length := 377 else if (wr_sequence == "Leonardo Numbers") wr_1_length := 15 wr_2_length := 25 wr_3_length := 41 wr_4_length := 67 wr_5_length := 109 wr_6_length := 177 wr_7_length := 287 wr_8_length := 465 else if (wr_sequence == "Lucas Numbers") wr_1_length := 11 wr_2_length := 18 wr_3_length := 29 wr_4_length := 47 wr_5_length := 76 wr_6_length := 123 wr_7_length := 199 wr_8_length := 322 else if (wr_sequence == "Padovan Numbers") wr_1_length := 12 wr_2_length := 16 wr_3_length := 21 wr_4_length := 28 wr_5_length := 37 wr_6_length := 49 wr_7_length := 65 wr_8_length := 86 else if (wr_sequence == "Perrin Numbers") wr_1_length := 12 wr_2_length := 17 wr_3_length := 22 wr_4_length := 29 wr_5_length := 39 wr_6_length := 51 wr_7_length := 68 wr_8_length := 90 else if (wr_sequence == "Jacobsthal Numbers") wr_1_length := 11 wr_2_length := 21 wr_3_length := 43 wr_4_length := 85 wr_5_length := 171 wr_6_length := 341 wr_7_length := 683 wr_8_length := 1365 else if (wr_sequence == "Narayana Numbers") wr_1_length := 13 wr_2_length := 19 wr_3_length := 28 wr_4_length := 41 wr_5_length := 60 wr_6_length := 88 wr_7_length := 129 wr_8_length := 189 else if (wr_sequence == "Magic Constants") wr_1_length := 15 wr_2_length := 34 wr_3_length := 65 wr_4_length := 111 wr_5_length := 175 wr_6_length := 260 wr_7_length := 369 wr_8_length := 505 else if (wr_sequence == "Tetrahedral Numbers") wr_1_length := 20 wr_2_length := 35 wr_3_length := 56 wr_4_length := 84 wr_5_length := 120 wr_6_length := 165 wr_7_length := 220 wr_8_length := 286 else if (wr_sequence == "Mersenne Exponents") wr_1_length := 13 wr_2_length := 17 wr_3_length := 19 wr_4_length := 31 wr_5_length := 61 wr_6_length := 89 wr_7_length := 107 wr_8_length := 127 // Williams %R // define first/fastest %R length, default length = 10 show_wr0 = input(true, "", inline="WR0", group = "Display Williams %R and its Moving Average") length0 = input(10, "Length", inline = "WR0", group = "Display Williams %R and its Moving Average") wr_aveprice = input.string("Close", title = "", options = ["Open", "High", "Low", "Close", "Median HL/2", "Typical HLC/3", "OHLC/4", "Body Median OC/2", "Weighted Close HL2C/4", "Biased HC/2 if Close > Open, else LC/2", "Biased High if Close > HL/2, else Low", "Biased High if Close > Open, else Low"], inline = "WR0", group = "Display Williams %R and its Moving Average") src0 = 1.0 if (wr_aveprice == "Open") src0 := open else if (wr_aveprice == "High") src0 := high else if (wr_aveprice == "Low") src0 := low else if (wr_aveprice == "Close") src0 := close else if (wr_aveprice == "Median HL/2") src0 := hl2 else if (wr_aveprice == "Typical HLC/3") src0 := hlc3 else if (wr_aveprice == "OHLC/4") src0 := ohlc4 else if (wr_aveprice == "Body Median OC/2") src0 := (open + close)/2 else if (wr_aveprice == "Weighted Close HL2C/4") src0 := (high + low + 2 * close) / 4 else if (wr_aveprice == "Biased HC/2 if Close > Open, else LC/2") src0 := close > open ? (high + close) / 2 : (low + close) / 2 else if (wr_aveprice == "Biased High if Close > HL/2, else Low") src0 := close > hl2 ? high : low else if (wr_aveprice == "Biased High if Close > Open, else Low") src0 := close > open ? high : low _wr0(length0) => max0 = ta.highest(length0) min0 = ta.lowest(length0) 100 * (src0 - max0) / (max0 - min0) percentR0 = _wr0(length0) + 50 show_wr0_ma = input(false, "", inline="MA", group = "Display Williams %R and its Moving Average") wr0_ma_length = input.int(50, "Length", inline = "MA", group="Display Williams %R and its Moving Average") wr0_ma_type = input.string("HMA", "", inline = "MA", options = ["SMA", "EMA", "DEMA", "TEMA", "QEMA", "PEMA", "ZLEMA", "T3", "HMA", "SMMA", "WMA", "VWMA"], group = "Display Williams %R and its Moving Average") wr0_ma = ma(percentR0, wr0_ma_length, wr0_ma_type) p_wr0 = plot(show_wr0_ma ? wr0_ma : na, title="%R0 MA", color=color.rgb(211, 54, 130, 60), linewidth=1) // magenta 211, 54, 130 or brwhite 253, 246, 227 // remaining %R length1 = wr_1_length src1 = src0 _wr1(length1) => max1 = ta.highest(length1) min1 = ta.lowest(length1) 100 * (src1 - max1) / (max1 - min1) percentR1 = _wr1(length1) + 50 length2 = wr_2_length src2 = src0 _wr2(length2) => max2 = ta.highest(length2) min2 = ta.lowest(length2) 100 * (src2 - max2) / (max2 - min2) percentR2 = _wr2(length2) + 50 length3 = wr_3_length src3 = src0 _wr3(length3) => max3 = ta.highest(length3) min3 = ta.lowest(length3) 100 * (src3 - max3) / (max3 - min3) percentR3 = _wr3(length3) + 50 length4 = wr_4_length src4 = src0 _wr4(length4) => max4 = ta.highest(length4) min4 = ta.lowest(length4) 100 * (src4 - max4) / (max4 - min4) percentR4 = _wr4(length4) + 50 length5 = wr_5_length src5 = src0 _wr5(length5) => max5 = ta.highest(length5) min5 = ta.lowest(length5) 100 * (src5 - max5) / (max5 - min5) percentR5 = _wr5(length5) + 50 length6 = wr_6_length src6 = src0 _wr6(length6) => max6 = ta.highest(length6) min6 = ta.lowest(length6) 100 * (src6 - max6) / (max6 - min6) percentR6 = _wr6(length6) + 50 length7 = wr_7_length src7 = src0 _wr7(length7) => max7 = ta.highest(length7) min7 = ta.lowest(length7) 100 * (src7 - max7) / (max7 - min7) percentR7 = _wr7(length7) + 50 length8 = wr_8_length src8 = src0 _wr8(length8) => max8 = ta.highest(length8) min8 = ta.lowest(length8) 100 * (src8 - max8) / (max8 - min8) percentR8 = _wr8(length8) + 50 show_wr_all = input(true, "%R 01-08", inline="", group = "Display %R calculated with the number sequence selected above, where %R 01 is calculated with the faster period and %R 08 the slower.") show_wr1 = input(true, "%R 01", inline="WR1", group = "Display %R calculated with the number sequence selected above, where %R 01 is calculated with the faster period and %R 08 the slower.") show_wr2 = input(true, "%R 02", inline="WR1", group = "Display %R calculated with the number sequence selected above, where %R 01 is calculated with the faster period and %R 08 the slower.") show_wr3 = input(true, "%R 03", inline="WR1", group = "Display %R calculated with the number sequence selected above, where %R 01 is calculated with the faster period and %R 08 the slower.") show_wr4 = input(true, "%R 04", inline="WR1", group = "Display %R calculated with the number sequence selected above, where %R 01 is calculated with the faster period and %R 08 the slower.") show_wr5 = input(true, "%R 05", inline="WR2", group = "Display %R calculated with the number sequence selected above, where %R 01 is calculated with the faster period and %R 08 the slower.") show_wr6 = input(true, "%R 06", inline="WR2", group = "Display %R calculated with the number sequence selected above, where %R 01 is calculated with the faster period and %R 08 the slower.") show_wr7 = input(true, "%R 07", inline="WR2", group = "Display %R calculated with the number sequence selected above, where %R 01 is calculated with the faster period and %R 08 the slower.") show_wr8 = input(true, "%R 08", inline="WR2", group = "Display %R calculated with the number sequence selected above, where %R 01 is calculated with the faster period and %R 08 the slower.") p0 = plot(show_wr0 ? percentR0 : na, title="%R0", color = show_wr_all ? color.rgb(253, 246, 227, 20) : color.rgb(253, 246, 227, 70), linewidth=1) // brwhite p1 = plot(show_wr1 ? show_wr_all ? percentR1 : na : na, title="%R1", color=color.rgb(253, 246, 227, 0), linewidth=1) // brwhite p2 = plot(show_wr2 ? show_wr_all ? percentR2 : na : na, title="%R2", color=color.rgb(42, 161, 152, 20), linewidth=1) // cyan p3 = plot(show_wr3 ? show_wr_all ? percentR3 : na : na, title="%R3", color=color.rgb(38, 139, 210, 30), linewidth=1) // blue p4 = plot(show_wr4 ? show_wr_all ? percentR4 : na : na, title="%R4", color=color.rgb(108, 113, 196, 40), linewidth=1) // brmagenta p5 = plot(show_wr5 ? show_wr_all ? percentR5 : na : na, title="%R5", color=color.rgb(211, 54, 130, 50), linewidth=1) // magenta p6 = plot(show_wr6 ? show_wr_all ? percentR6 : na : na, title="%R6", color=color.rgb(220, 50, 47, 60), linewidth=1) // red p7 = plot(show_wr7 ? show_wr_all ? percentR7 : na : na, title="%R7", color=color.rgb(181, 137, 0, 70), linewidth=1) // yellow p8 = plot(show_wr8 ? show_wr_all ? percentR8 : na : na, title="%R8", color=color.rgb(253, 246, 227, 70), linewidth=1) // cyan 42, 161, 152 or brwhite 253, 246, 227 fill(p0, p1, title="R0 R1 Fill", color=color.rgb(42, 161, 152, 50)) // cyan fill(p0, p_wr0, title="R0 R0MA Fill", color = show_wr_all ? na : percentR0 > wr0_ma ? color.rgb(253, 246, 227, 90) : color.rgb(211, 54, 130, 90)) // cyan fill(p1, p2, title="R1 R2 Fill", color=color.rgb(38, 139, 210, 50)) // blue fill(p2, p3, title="R2 R3 Fill", color=color.rgb(108, 113, 196, 55)) // brmagenta fill(p3, p4, title="R3 R4 Fill", color=color.rgb(211, 54, 130, 60)) // magenta fill(p4, p5, title="R4 R5 Fill", color=color.rgb(220, 50, 47, 65)) // red fill(p5, p6, title="R5 R6 Fill", color=color.rgb(181, 137, 0, 70)) // yellow fill(p6, p7, title="R6 R7 Fill", color=color.rgb(42, 161, 152, 80)) // cyan fill(p7, p8, title="R7 R8 Fill", color=color.rgb(38, 139, 210, 80)) // blue // RSI // define first/fastest RSI length, default length = 14 show_rsi0 = input(true, "", inline = "RSI", group = "Display RSI and its Moving Average") rsi_length0 = input.int(14, minval = 1, title = "Length", inline = "RSI", group = "Display RSI and its Moving Average") rsi_aveprice = input.string("Close", title = "", options = ["Open", "High", "Low", "Close", "Median HL/2", "Typical HLC/3", "OHLC/4", "Body Median OC/2", "Weighted Close HL2C/4", "Biased HC/2 if Close > Open, else LC/2", "Biased High if Close > HL/2, else Low", "Biased High if Close > Open, else Low"], inline = "RSI", group="Display RSI and its Moving Average") rsi_source0 = 1.0 if (rsi_aveprice == "Open") rsi_source0 := open else if (rsi_aveprice == "High") rsi_source0 := high else if (rsi_aveprice == "Low") rsi_source0 := low else if (rsi_aveprice == "Close") rsi_source0 := close else if (rsi_aveprice == "Median HL/2") rsi_source0 := hl2 else if (rsi_aveprice == "Typical HLC/3") rsi_source0 := hlc3 else if (rsi_aveprice == "OHLC/4") rsi_source0 := ohlc4 else if (rsi_aveprice == "Body Median OC/2") rsi_source0 := (open + close)/2 else if (rsi_aveprice == "Weighted Close HL2C/4") rsi_source0 := (high + low + 2 * close) / 4 else if (rsi_aveprice == "Biased HC/2 if Close > Open, else LC/2") rsi_source0 := close > open ? (high + close) / 2 : (low + close) / 2 else if (rsi_aveprice == "Biased High if Close > HL/2, else Low") rsi_source0 := close > hl2 ? high : low else if (rsi_aveprice == "Biased High if Close > Open, else Low") rsi_source0 := close > open ? high : low up0 = ta.rma(math.max(ta.change(rsi_source0), 0), rsi_length0) down0 = ta.rma(-math.min(ta.change(rsi_source0), 0), rsi_length0) rsi0 = down0 == 0 ? 100 : up0 == 0 ? 0 : ((100 - (100 / (1 + up0 / down0))) - 50) show_rsi0_ma = input(false, "", inline="MA", group = "Display RSI and its Moving Average") rsi0_ma_length = input.int(50, "Length", inline = "MA", group="Display RSI and its Moving Average") rsi0_ma_type = input.string("HMA", "", inline = "MA", options = ["SMA", "EMA", "DEMA", "TEMA", "QEMA", "PEMA", "ZLEMA", "T3", "HMA", "SMMA", "WMA", "VWMA"], group = "Display RSI and its Moving Average") rsi0_ma = ma(rsi0, rsi0_ma_length, rsi0_ma_type) r0_ma = plot(show_rsi0_ma ? rsi0_ma : na, title="RSI0 MA", color=color.rgb(42, 161, 152, 60), linewidth=1) // brwhite 253, 246, 227 // remaining RSI rsi_length1 = wr_1_length rsi_source1 = rsi_source0 up1 = ta.rma(math.max(ta.change(rsi_source1), 0), rsi_length1) down1 = ta.rma(-math.min(ta.change(rsi_source1), 0), rsi_length1) rsi1 = down1 == 0 ? 100 : up1 == 0 ? 0 : ((100 - (100 / (1 + up1 / down1))) - 50) rsi_length2 = wr_2_length rsi_source2 = rsi_source0 up2 = ta.rma(math.max(ta.change(rsi_source2), 0), rsi_length2) down2 = ta.rma(-math.min(ta.change(rsi_source2), 0), rsi_length2) rsi2 = down2 == 0 ? 100 : up2 == 0 ? 0 : ((100 - (100 / (1 + up2 / down2))) - 50) rsi_length3 = wr_3_length rsi_source3 = rsi_source0 up3 = ta.rma(math.max(ta.change(rsi_source3), 0), rsi_length3) down3 = ta.rma(-math.min(ta.change(rsi_source3), 0), rsi_length3) rsi3 = down3 == 0 ? 100 : up3 == 0 ? 0 : ((100 - (100 / (1 + up3 / down3))) - 50) rsi_length4 = wr_4_length rsi_source4 = rsi_source0 up4 = ta.rma(math.max(ta.change(rsi_source4), 0), rsi_length4) down4 = ta.rma(-math.min(ta.change(rsi_source4), 0), rsi_length4) rsi4 = down4 == 0 ? 100 : up4 == 0 ? 0 : ((100 - (100 / (1 + up4 / down4))) - 50) rsi_length5 = wr_5_length rsi_source5 = rsi_source0 up5 = ta.rma(math.max(ta.change(rsi_source5), 0), rsi_length5) down5 = ta.rma(-math.min(ta.change(rsi_source5), 0), rsi_length5) rsi5 = down5 == 0 ? 100 : up5 == 0 ? 0 : ((100 - (100 / (1 + up5 / down5))) - 50) rsi_length6 = wr_6_length rsi_source6 = rsi_source0 up6 = ta.rma(math.max(ta.change(rsi_source6), 0), rsi_length6) down6 = ta.rma(-math.min(ta.change(rsi_source6), 0), rsi_length6) rsi6 = down6 == 0 ? 100 : up6 == 0 ? 0 : ((100 - (100 / (1 + up6 / down6))) - 50) rsi_length7 = wr_7_length rsi_source7 = rsi_source0 up7 = ta.rma(math.max(ta.change(rsi_source7), 0), rsi_length7) down7 = ta.rma(-math.min(ta.change(rsi_source7), 0), rsi_length7) rsi7 = down7 == 0 ? 100 : up7 == 0 ? 0 : ((100 - (100 / (1 + up7 / down7))) - 50) rsi_length8 = wr_8_length rsi_source8 = rsi_source0 up8 = ta.rma(math.max(ta.change(rsi_source8), 0), rsi_length8) down8 = ta.rma(-math.min(ta.change(rsi_source8), 0), rsi_length8) rsi8 = down8 == 0 ? 100 : up8 == 0 ? 0 : ((100 - (100 / (1 + up8 / down8))) - 50) show_rsi_all = input(false, "RSI 01-08", inline="", group = "Display RSI calculated with the number sequence selected above, where RSI 01 is calculated with the faster period and RSI 08 the slower.") show_rsi1 = input(true, "RSI 01", inline="WR1", group = "Display RSI calculated with the number sequence selected above, where RSI 01 is calculated with the faster period and RSI 08 the slower.") show_rsi2 = input(true, "RSI 02", inline="WR1", group = "Display RSI calculated with the number sequence selected above, where RSI 01 is calculated with the faster period and RSI 08 the slower.") show_rsi3 = input(true, "RSI 03", inline="WR1", group = "Display RSI calculated with the number sequence selected above, where RSI 01 is calculated with the faster period and RSI 08 the slower.") show_rsi4 = input(true, "RSI 04", inline="WR1", group = "Display RSI calculated with the number sequence selected above, where RSI 01 is calculated with the faster period and RSI 08 the slower.") show_rsi5 = input(true, "RSI 05", inline="WR2", group = "Display RSI calculated with the number sequence selected above, where RSI 01 is calculated with the faster period and RSI 08 the slower.") show_rsi6 = input(true, "RSI 06", inline="WR2", group = "Display RSI calculated with the number sequence selected above, where RSI 01 is calculated with the faster period and RSI 08 the slower.") show_rsi7 = input(true, "RSI 07", inline="WR2", group = "Display RSI calculated with the number sequence selected above, where RSI 01 is calculated with the faster period and RSI 08 the slower.") show_rsi8 = input(true, "RSI 08", inline="WR2", group = "Display RSI calculated with the number sequence selected above, where RSI 01 is calculated with the faster period and RSI 08 the slower.") r0 = plot(show_rsi0 ? rsi0 : na, title="RSI", color = show_rsi_all ? color.rgb(253, 246, 227, 20) : color.rgb(253, 246, 227, 70), linewidth=1) // brwhite r1 = plot(show_rsi1 ? show_rsi_all ? rsi1 : na : na, title="RSI1", color=color.rgb(253, 246, 227, 0), linewidth=1) // brwhite r2 = plot(show_rsi2 ? show_rsi_all ? rsi2 : na : na, title="RSI2", color=color.rgb(42, 161, 152, 20), linewidth=1) // cyan r3 = plot(show_rsi3 ? show_rsi_all ? rsi3 : na : na, title="RSI3", color=color.rgb(38, 139, 210, 30), linewidth=1) // blue r4 = plot(show_rsi4 ? show_rsi_all ? rsi4 : na : na, title="RSI4", color=color.rgb(108, 113, 196, 40), linewidth=1) // brmagenta r5 = plot(show_rsi5 ? show_rsi_all ? rsi5 : na : na, title="RSI5", color=color.rgb(211, 54, 130, 50), linewidth=1) // magenta r6 = plot(show_rsi6 ? show_rsi_all ? rsi6 : na : na, title="RSI6", color=color.rgb(220, 50, 47, 60), linewidth=1) // red r7 = plot(show_rsi7 ? show_rsi_all ? rsi7 : na : na, title="RSI7", color=color.rgb(181, 137, 0, 70), linewidth=1) // yellow r8 = plot(show_rsi8 ? show_rsi_all ? rsi8 : na : na, title="RSI8", color=color.rgb(253, 246, 227, 70), linewidth=1) // cyan 42, 161, 152 or brwhite 253, 246, 227 fill(r0, r1, title="RSI0 RSI1 Fill", color=color.rgb(42, 161, 152, 50)) // cyan fill(r0, r0_ma, title="RSI0 RSI0MA Fill", color = show_rsi_all ? na : rsi0 > rsi0_ma ? color.rgb(253, 246, 227, 90) : color.rgb(42, 161, 152, 90)) // cyan fill(r1, r2, title="RSI1 RSI2 Fill", color=color.rgb(38, 139, 210, 50)) // blue fill(r2, r3, title="RSI2 RSI3 Fill", color=color.rgb(108, 113, 196, 55)) // brmagenta fill(r3, r4, title="RSI3 RSI4 Fill", color=color.rgb(211, 54, 130, 60)) // magenta fill(r4, r5, title="RSI4 RSI5 Fill", color=color.rgb(220, 50, 47, 65)) // red fill(r5, r6, title="RSI5 RSI6 Fill", color=color.rgb(181, 137, 0, 70)) // yellow fill(r6, r7, title="RSI6 RSI7 Fill", color=color.rgb(42, 161, 152, 80)) // cyan fill(r7, r8, title="RSI7 RSI8 Fill", color=color.rgb(38, 139, 210, 80)) // blue // RMI by Roger Altman // define first/fastest RMI length, default length = 14, momentum = 3 show_rmi0 = input(false, "", inline = "RMI", group = "Display RMI and its Moving Average") rmi_length0 = input.int(title="Length", inline = "RMI", group = "Display RMI and its Moving Average", defval=14, minval=1, maxval=2000) rmi_momentum0 = input(3, title="", inline = "RMI", group = "Display RMI and its Moving Average") // if momentum = 1, RMI = RSI rmi_aveprice = input.string("Close", title = "", options = ["Open", "High", "Low", "Close", "Median HL/2", "Typical HLC/3", "OHLC/4", "Body Median OC/2", "Weighted Close HL2C/4", "Biased HC/2 if Close > Open, else LC/2", "Biased High if Close > HL/2, else Low", "Biased High if Close > Open, else Low"], inline = "RMI", group="Display RMI and its Moving Average") rmi_source0 = 1.0 if (rmi_aveprice == "Open") rmi_source0 := open else if (rmi_aveprice == "High") rmi_source0 := high else if (rmi_aveprice == "Low") rmi_source0 := low else if (rmi_aveprice == "Close") rmi_source0 := close else if (rmi_aveprice == "Median HL/2") rmi_source0 := hl2 else if (rmi_aveprice == "Typical HLC/3") rmi_source0 := hlc3 else if (rmi_aveprice == "OHLC/4") rmi_source0 := ohlc4 else if (rmi_aveprice == "Body Median OC/2") rmi_source0 := (open + close)/2 else if (rmi_aveprice == "Weighted Close HL2C/4") rmi_source0 := (high + low + 2 * close) / 4 else if (rmi_aveprice == "Biased HC/2 if Close > Open, else LC/2") rmi_source0 := close > open ? (high + close) / 2 : (low + close) / 2 else if (rmi_aveprice == "Biased High if Close > HL/2, else Low") rmi_source0 := close > hl2 ? high : low else if (rmi_aveprice == "Biased High if Close > Open, else Low") rmi_source0 := close > open ? high : low rmi_up0 = ta.rma(math.max(ta.change(rmi_source0, rmi_momentum0), 0), rmi_length0) rmi_down0 = ta.rma(-math.min(ta.change(rmi_source0, rmi_momentum0), 0), rmi_length0) rmi0 = (rmi_down0 == 0 ? 100 : rmi_up0 == 0 ? 0 : (100 - (100 / (1 + rmi_up0 / rmi_down0))) - 50) rmi0_p = plot(show_rmi0 ? rmi0 : na, title="RMI", color = color.rgb(253, 246, 227, 70), linewidth=1) // brwhite show_rmi0_ma = input(false, "", inline="MA", group = "Display RMI and its Moving Average") rmi0_ma_length = input.int(50, "Length", inline = "MA", group="Display RMI and its Moving Average") rmi0_ma_type = input.string("HMA", "", inline = "MA", options = ["SMA", "EMA", "DEMA", "TEMA", "QEMA", "PEMA", "ZLEMA", "T3", "HMA", "SMMA", "WMA", "VWMA"], group = "Display RMI and its Moving Average") rmi0_ma = ma(rmi0, rmi0_ma_length, rmi0_ma_type) rmi0_ma_p = plot(show_rmi0_ma ? rmi0_ma : na, title="RMI0 MA", color=color.rgb(42, 161, 152, 60), linewidth=1) // brwhite 253, 246, 227 fill(rmi0_p, rmi0_ma_p, title="RMI0 RMI0MA Fill", color = rmi0 > rmi0_ma ? color.rgb(253, 246, 227, 90) : color.rgb(42, 161, 152, 90)) // cyan // MFI show_mfi0 = input(false, "", inline = "MFI", group = "Display MFI and its Moving Average") mfi_length0 = input.int(title="Length", inline = "MFI", group = "Display MFI and its Moving Average", defval=14, minval=1, maxval=2000) mfi_aveprice = input.string("Typical HLC/3", title = "", options = ["Open", "High", "Low", "Close", "Median HL/2", "Typical HLC/3", "OHLC/4", "Body Median OC/2", "Weighted Close HL2C/4", "Biased HC/2 if Close > Open, else LC/2", "Biased High if Close > HL/2, else Low", "Biased High if Close > Open, else Low"], inline = "MFI", group="Display MFI and its Moving Average") mfi_source0 = 1.0 if (mfi_aveprice == "Open") mfi_source0 := open else if (mfi_aveprice == "High") mfi_source0 := high else if (mfi_aveprice == "Low") mfi_source0 := low else if (mfi_aveprice == "Close") mfi_source0 := close else if (mfi_aveprice == "Median HL/2") mfi_source0 := hl2 else if (mfi_aveprice == "Typical HLC/3") mfi_source0 := hlc3 else if (mfi_aveprice == "OHLC/4") mfi_source0 := ohlc4 else if (mfi_aveprice == "Body Median OC/2") mfi_source0 := (open + close)/2 else if (mfi_aveprice == "Weighted Close HL2C/4") mfi_source0 := (high + low + 2 * close) / 4 else if (mfi_aveprice == "Biased HC/2 if Close > Open, else LC/2") mfi_source0 := close > open ? (high + close) / 2 : (low + close) / 2 else if (mfi_aveprice == "Biased High if Close > HL/2, else Low") mfi_source0 := close > hl2 ? high : low else if (mfi_aveprice == "Biased High if Close > Open, else Low") mfi_source0 := close > open ? high : low mfi0 = ta.mfi(mfi_source0, mfi_length0) - 50 mfi0_p = plot(show_mfi0 ? mfi0 : na, title="MFI", color = color.rgb(253, 246, 227, 70), linewidth=1) // brwhite show_mfi0_ma = input(false, "", inline="MA", group = "Display MFI and its Moving Average") mfi0_ma_length = input.int(50, "Length", inline = "MA", group="Display MFI and its Moving Average") mfi0_ma_type = input.string("HMA", "", inline = "MA", options = ["SMA", "EMA", "DEMA", "TEMA", "QEMA", "PEMA", "ZLEMA", "T3", "HMA", "SMMA", "WMA", "VWMA"], group = "Display MFI and its Moving Average") mfi0_ma = ma(mfi0, mfi0_ma_length, mfi0_ma_type) mfi0_ma_p = plot(show_mfi0_ma ? mfi0_ma : na, title="MFI0 MA", color=color.rgb(42, 161, 152, 60), linewidth=1) // brwhite 253, 246, 227 fill(mfi0_p, mfi0_ma_p, title="MFI0 MFI0MA Fill", color = mfi0 > mfi0_ma ? color.rgb(253, 246, 227, 90) : color.rgb(42, 161, 152, 90)) // cyan // RSX by Mark Jurik show_rsx = input(false, "", inline = "RSX", group = "Display RSX and its Moving Average") rsx_length = input.int(title="Length", inline = "RSX", group = "Display RSX and its Moving Average", defval=14, minval=1, maxval=2000) rsx_aveprice = input.string("Close", title = "", options = ["Open", "High", "Low", "Close", "Median HL/2", "Typical HLC/3", "OHLC/4", "Body Median OC/2", "Weighted Close HL2C/4", "Biased HC/2 if Close > Open, else LC/2", "Biased High if Close > HL/2, else Low", "Biased High if Close > Open, else Low"], inline = "RSX", group="Display RSX and its Moving Average") rsx_source = 1.0 if (rsx_aveprice == "Open") rsx_source := open else if (rsx_aveprice == "High") rsx_source := high else if (rsx_aveprice == "Low") rsx_source := low else if (rsx_aveprice == "Close") rsx_source := close else if (rsx_aveprice == "Median HL/2") rsx_source := hl2 else if (rsx_aveprice == "Typical HLC/3") rsx_source := hlc3 else if (rsx_aveprice == "OHLC/4") rsx_source := ohlc4 else if (rsx_aveprice == "Body Median OC/2") rsx_source := (open + close)/2 else if (rsx_aveprice == "Weighted Close HL2C/4") rsx_source := (high + low + 2 * close) / 4 else if (rsx_aveprice == "Biased HC/2 if Close > Open, else LC/2") rsx_source := close > open ? (high + close) / 2 : (low + close) / 2 else if (rsx_aveprice == "Biased High if Close > HL/2, else Low") rsx_source := close > hl2 ? high : low else if (rsx_aveprice == "Biased High if Close > Open, else Low") rsx_source := close > open ? high : low f8 = 100 * rsx_source f10 = nz(f8[1]) v8 = f8 - f10 f18 = 3 / (rsx_length + 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 (rsx_length - 1 >= 5)) ? (rsx_length - 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 rsx = ((v4_ > 100) ? 100 : (v4_ < 0) ? 0 : v4_) - 50 rsx_p = plot(show_rsx ? rsx : na, title="RSX", color = color.rgb(253, 246, 227, 70), linewidth=1) // brwhite show_rsx_ma = input(false, "", inline="MA", group = "Display RSX and its Moving Average") rsx_ma_length = input.int(50, "Length", inline = "MA", group="Display RSX and its Moving Average") rsx_ma_type = input.string("HMA", "", inline = "MA", options = ["SMA", "EMA", "DEMA", "TEMA", "QEMA", "PEMA", "ZLEMA", "T3", "HMA", "SMMA", "WMA", "VWMA"], group = "Display RSX and its Moving Average") rsx_ma = ma(rsx, rsx_ma_length, rsx_ma_type) rsx_ma_p = plot(show_rsx_ma ? rsx_ma : na, title="RSX MA", color=color.rgb(42, 161, 152, 60), linewidth=1) // brwhite 253, 246, 227 fill(rsx_p, rsx_ma_p, title="RSX RSXMA Fill", color = rsx > rsx_ma ? color.rgb(253, 246, 227, 90) : color.rgb(42, 161, 152, 90)) // cyan // Upper and Lower Lines obPlot = hline(53, title="Upper Band", linestyle=hline.style_solid, color=color.rgb(253, 246, 227, 95), linewidth=1)//brwhite hline(50, title="100% Level", linestyle=hline.style_dotted, color=color.rgb(253, 246, 227, 80), linewidth=1)//brwhite hline(30, title="80% Level", linestyle=hline.style_dotted, color=color.rgb(253, 246, 227, 50), linewidth=1)//brwhite hline(20, title="70% Level", linestyle=hline.style_dotted, color=color.rgb(253, 246, 227, 40), linewidth=1)//brwhite hline(0, title="50% Level", linestyle=hline.style_dotted, color=color.rgb(253, 246, 227, 0), linewidth=1)//brwhite hline(-20, title="30% Level", linestyle=hline.style_dotted, color=color.rgb(253, 246, 227, 40), linewidth=1)//brwhite hline(-30, title="20% Level", linestyle=hline.style_dotted, color=color.rgb(253, 246, 227, 50), linewidth=1)//brwhite hline(-50, title="0% Level", linestyle=hline.style_dotted, color=color.rgb(253, 246, 227, 80), linewidth=1)//brwhite osPlot = hline(-53, title="Lower Band", linestyle=hline.style_solid, color=color.rgb(253, 246, 227, 95), linewidth=1)//brwhite fill(obPlot, osPlot, title="Background", color=color.rgb(253, 246, 227, 99))//brwhite //NOTES // //Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584... // //COLOR SCHEMES // //SOLARIZED by Ethan Schoonover at ethanschoonover.com //NAME HEX RGB //brblack #002b36 0, 43, 54 //black #073642 7, 54, 66 //brgreen #586e75 88, 110, 117 //bryellow #657b83 101, 123, 131 //brblue #839496 131, 148, 150 //brcyan #93a1a1 147, 161, 161 //white #eee8d5 238, 232, 213 //brwhite #fdf6e3 253, 246, 227 //yellow #b58900 181, 137, 0 //brred #cb4b16 203, 75, 22 //red #dc322f 220, 50, 47 //magenta #d33682 211, 54, 130 //brmagenta #6c71c4 108, 113, 196 //blue #268bd2 38, 139, 210 //cyan #2aa198 42, 161, 152 //green #859900 133, 153, 0 // //END
Rational Root Timeline
https://www.tradingview.com/script/hptQzPcO-Rational-Root-Timeline/
OrionAlgo
https://www.tradingview.com/u/OrionAlgo/
34
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © OrionAlgo //@version=5 indicator("Rational Root Timeline") push = input.int(2922, "Push") prediction = input.float(3.5,"Prediction") smoothing = input.int(20, "Smoothing") factor = input.float(0.9998) var bar = 1. bar:= bar*factor _c0 = timestamp(2009, 01, 01, 00, 00) c0_start = time >= _c0 _c1 = timestamp(2013, 01, 01, 00, 00) c1_start = time >= _c1 _c2 = timestamp(2017, 01, 01, 00, 00) c2_start = time >= _c2 _c3 = timestamp(2021, 01, 01, 00, 00) c3_start = time >= _c3 c0 = c0_start? math.log(close) : na c1 = c1_start? math.log(close) : na c2 = c2_start? math.log(close) : na c3 = c3_start? math.log(close) : na p0 = c0_start? math.log(close)+(prediction*bar) : na p1 = c1_start? math.log(close)+(prediction*bar) : na p2 = c2_start? math.log(close)+(prediction*bar) : na p3 = c3_start? math.log(close)+(prediction*bar) : na p0 := ta.ema(p0,smoothing) p1 := ta.ema(p1,smoothing) p2 := ta.ema(p2,smoothing) p3 := ta.ema(p3,smoothing) c0_offset = 0 + push c1_offset = -1461 + push c2_offset = -2922 + push c3_offset = -4383 + push plot(c0,"cycle 0", offset=c0_offset, color = color.rgb(255,255,255,50)) plot(c1,"cycle 1", offset=c1_offset, color = color.rgb(255,255,255,50)) plot(c2,"cycle 2", offset=c2_offset, color = color.rgb(255,255,255,50)) plot(c3,"cycle 3", offset=c3_offset, color = color.rgb(255,255,255,50)) plot(p0,"cycle 0", offset=c0_offset, color = color.rgb(255,0,0,80)) plot(p1,"cycle 1", offset=c1_offset, color = color.rgb(255,0,0,80)) plot(p2,"cycle 2", offset=c2_offset, color = color.rgb(255,0,0,80)) plot(p3,"cycle 3", offset=c3_offset, color = color.rgb(255,0,0,80)) plot(c0, offset=c0_offset, style=plot.style_circles, show_last=1, linewidth=2, color=color.rgb(255,255,255,20)) plot(c1, offset=c1_offset, style=plot.style_circles, show_last=1, linewidth=2, color=color.rgb(255,255,255,20)) plot(c2, offset=c2_offset, style=plot.style_circles, show_last=1, linewidth=2, color=color.rgb(255,255,255,20)) plot(c3, offset=c3_offset, style=plot.style_circles, show_last=1, linewidth=2, color=color.rgb(255,255,255,20))
Indicators Overlay
https://www.tradingview.com/script/uwUfCFF8-Indicators-Overlay/
LonesomeTheBlue
https://www.tradingview.com/u/LonesomeTheBlue/
3,924
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © LonesomeTheBlue indi1n = "Relative strength index", indi1sn = "RSI" indi2n ="Commodity Channel Index", indi2sn ="CCI" indi3n ="On Balance Volume", indi3sn ="OBV" indi4n ="Stochastic", indi4sn ="Stoch" indi5n ="Money Flow Index", indi5sn ="MFI" indi6n ="Average True Range", indi6sn ="ATR" indi7n ="Chande Momentum Oscillator", indi7sn ="CMO" indi8n ="Chaikin Money Flow", indi8sn ="CMF" indi9n ="Stochastic RSI", indi9sn ="StochRSI D" indi10n ="DMI", indi10sn ="+DI -DI ADX" getTN()=> int TN = 0 tick__ = syminfo.mintick while tick__ < 1 TN += 1 tick__ *= 10 TN //@version=5 indicator("Indicators Overlay", overlay = true, max_lines_count = 500, max_bars_back = 900) import LonesomeTheBlue/DrawIndicatorOnTheChart/6 as showindicator indi1 = input.bool(defval = true, title = indi1n, group = "Indicators", inline = "indi1") indi1s = input.source(defval = close, title = "", group = "Indicators", inline = "indi1") indi1l = input.int(defval = 14, title = "", group = "Indicators", inline = "indi1") indi2 = input.bool(defval = true, title = indi2n, group = "Indicators", inline = "indi2") indi2s = input.source(defval = close, title = "", group = "Indicators", inline = "indi2") indi2l = input.int(defval = 20, title = "", group = "Indicators", inline = "indi2") indi3 = input.bool(defval = false, title = indi3n, group = "Indicators") indi4 = input.bool(defval = false, title = indi4n, group = "Indicators", inline = "indi4") indi4s = input.source(defval = close, title = "", group = "Indicators", inline = "indi4") indi4l = input.int(defval = 14, title = "", group = "Indicators", inline = "indi4") indi5 = input.bool(defval = true, title = indi5n, group = "Indicators", inline = "indi5") indi5s = input.source(defval = hlc3, title = "", group = "Indicators", inline = "indi5") indi5l = input.int(defval = 14, title = "", group = "Indicators", inline = "indi5") indi6 = input.bool(defval = false, title = indi6n, group = "Indicators", inline = "indi6") indi6l = input.int(defval = 14, title = "", group = "Indicators", inline = "indi6") indi7 = input.bool(defval = false, title = indi7n, group = "Indicators", inline = "indi7") indi7s = input.source(defval = close, title = "", group = "Indicators", inline = "indi7") indi7l = input.int(defval = 9, title = "", group = "Indicators", inline = "indi7") indi8 = input.bool(defval = true, title = indi8n, group = "Indicators", inline = "indi8") indi8l = input.int(defval = 20, title = "", group = "Indicators", inline = "indi8") indi9 = input.bool(defval = true, title = indi9n, group = "Indicators", inline = "indi9") indi9l1 = input.int(defval = 14, title = "", group = "Indicators", inline = "indi9") indi9l2 = input.int(defval = 3, title = "| D", group = "Indicators", inline = "indi9") indi10 = input.bool(defval = false, title = indi10n, group = "Indicators", inline = "indi10") indi10l1 = input.int(defval = 14, title = " | ADX Smoothing", minval=1, maxval=50, group = "Indicators", inline = "indi10") indi10l2 = input.int(defval = 3, title = "DI Len", group = "Indicators", inline = "indi10") period = input.int(defval = 50, title = "Length for Each Window", minval = 20, maxval = 100, inline ="Ext") lnwidth = input.int(defval = 2, title = "Line Width", minval = 1, maxval = 3, inline ="Ext") differentcolors = input.bool(defval = false, title = "Different Colors for Indicators?", inline = "colors") color1 = input.color(defval = color.blue, title = " or These Colors", inline = "colors") color2 = input.color(defval = color.red, title = "", inline = "colors") color3 = input.color(defval = color.gray, title = "", inline = "colors") // get indicator values rsi = ta.rsi(indi1s, indi1l) cci = ta.cci(indi2s, indi2l) obv = ta.obv stoch = ta.stoch(indi4s, high, low, indi4l) mfi = ta.mfi(indi5s, indi5l) atr = ta.atr(indi6l) cmo = ta.cmo(indi7s, indi7l) ad = close==high and close==low or high==low ? 0 : ((2*close-low-high)/(high-low))*volume cmf = math.sum(ad, indi8l) / math.sum(volume, indi8l) srsi = ta.sma(ta.stoch(rsi, rsi, rsi, indi9l1), 3) srsid = ta.sma(srsi, indi10l2) [diplus, diminus, adx] = ta.dmi(indi10l2, indi10l1) // initialize variables/arrays var indicolors = differentcolors ? array.from(color.blue, color.olive, color.lime, color.teal, color.silver, color.green, color.yellow, color.orange, color.blue, color.olive, color.lime, color.teal, color.silver) : array.from(color1, color2, color3) var indinames = array.from(indi1sn, indi2sn, indi3sn, indi4sn, indi5sn, indi6sn, indi7sn, indi8sn, indi9sn, indi10sn) var indienabled = array.from(indi1, indi2, indi3, indi4, indi5, indi6, indi7, indi8, indi9, indi10) var precision = array.from(2, 2, 2, 2, 2, getTN(), 2, 2, 2, 2) var float naval = na var indimaxmin = array.from(100.0, 0.0, naval, naval, naval, naval, 100.0, 0.0, 100.0, 0.0, naval, naval, 100.0, -100.0, naval, naval, 102.0, -2.0, 70.0, -5.0) var indihorizontallevels = array.from(30.0, 50.0, 70.0, 0.0, 100.0, -100.0, naval, 20.0, 80.0, 20.0, 80.0, naval, 0.0, 0.0, 20.0, 80.0, 0.0, 20.0, 40.0, 60.0) var indihorizontallevelindex = array.from(0, 3, 3, 3, 6, 1, 7, 2, 9, 2, 11, 1, 12, 1, 13, 1, 14, 2, 16, 4) // get indicator values get_indi(x)=> [ret1, ret2, ret3] = switch x 0 => [rsi, naval, naval] 1 => [cci, naval, naval] 2 => [obv, naval, naval] 3 => [stoch, naval, naval] 4 => [mfi, naval, naval] 5 => [atr, naval, naval] 6 => [cmo, naval, naval] 7 => [cmf, naval, naval] 8 => [srsi, srsid, naval] 9 => [diplus, diminus, adx] [ret1, ret2, ret3] // get and show the indicator in a separate window get_the_indicator(numofindi, colnum)=> [indic1, indic2, indic3] = get_indi(numofindi) showindicator.drawIndicator(array.get(indienabled, numofindi), array.get(indinames, numofindi), indic1, indic2, indic3, (differentcolors ? array.from(array.get(indicolors, numofindi), array.get(indicolors, numofindi + 1), array.get(indicolors, numofindi + 2)) :indicolors), period, array.get(indimaxmin, numofindi * 2), array.get(indimaxmin, numofindi * 2 + 1), array.slice(indihorizontallevels, array.get(indihorizontallevelindex, numofindi * 2), array.get(indihorizontallevelindex, numofindi * 2) + array.get(indihorizontallevelindex, numofindi * 2 + 1)), array.get(precision, numofindi), colnum * (period + 2), lnwidth) (array.get(indienabled, numofindi) ? 1 : 0) // draw each indicator in separate window int colnum = 0 int numofindi = 0 colnum += (get_the_indicator(numofindi, colnum)), numofindi += 1 colnum += (get_the_indicator(numofindi, colnum)), numofindi += 1 colnum += (get_the_indicator(numofindi, colnum)), numofindi += 1 colnum += (get_the_indicator(numofindi, colnum)), numofindi += 1 colnum += (get_the_indicator(numofindi, colnum)), numofindi += 1 colnum += (get_the_indicator(numofindi, colnum)), numofindi += 1 colnum += (get_the_indicator(numofindi, colnum)), numofindi += 1 colnum += (get_the_indicator(numofindi, colnum)), numofindi += 1 colnum += (get_the_indicator(numofindi, colnum)), numofindi += 1 get_the_indicator(numofindi, colnum)
Manuel Trading Starter Script For Wunderbit
https://www.tradingview.com/script/kPoLpmfK-Manuel-Trading-Starter-Script-For-Wunderbit/
BasicTraderTolga
https://www.tradingview.com/u/BasicTraderTolga/
40
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © BasicTraderTolga //THIS CODE IS WRITTEN FOR WUNDERBIT TRADING //This script can be used for starting a position entry either it is long or short at any time by using alerts. //You need to setup your long and short alerts than pause them. When you decide to enter a position, //simply run the alert you are willing to open a trade either long or short from the alarms control panel. //The script immediately send the alert message to bot via webhook. //The close price must be greather than 0.0000000000001 to open a position. //Dont forget to turn off the alarm after entering the position. Or it will keep sending the alert message each candle. //@version=5 indicator("Manuel Trading Starter Script For Wunderbit", overlay=true) plot(close) longcondition= close >0.0000000000001 shortcondition= close >0.0000000000001 plotshape(longcondition, "Long", shape.triangleup, location.belowbar, color=color.green, size=size.normal) plotshape(shortcondition, "Short", shape.triangledown , location.abovebar, color=color.red, size=size.normal) golong = longcondition == 1 alertcondition(golong, title='GoLong', message='Your Enter Long Message') goshort = shortcondition == -1 alertcondition(goshort, title='GoShort', message='Your Enter Short Message')
Vertex EMA Strategy
https://www.tradingview.com/script/hi9Psduw-Vertex-EMA-Strategy/
OztheWoz
https://www.tradingview.com/u/OztheWoz/
56
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © OztheWoz //@version=5 indicator("Vertex EMA Strategy", overlay=true) // 1h Conditions barclronf = input(true, "Bar Color On/Off") triggeronf = input(true, "Trigger Signal On/off") emasrc = input(close, "EMA Source") h1emasrc = request.security(syminfo.tickerid, "60", emasrc) ema1len = input(8, "EMA 1 Length") ema3len = input(21, "EMA 2 Length") ema2len = input(13, "EMA 3 Length") h1perc = input(0.01, "1h EMA Apart Percentage") h4perc = input(0.382, "4h EMA Apart Percentage") dperc = input(0.382, "1D EMA Apart Percentage") h1ema1 = ta.ema(h1emasrc, ema1len) h1ema2 = ta.ema(h1emasrc, ema2len) h1ema3 = ta.ema(h1emasrc, ema3len) plot(h1ema1, color=color.red) plot(h1ema2, color=color.orange) plot(h1ema3, color=color.aqua) h1far = h1ema2 > (h1ema3 + (h1ema3 * h1perc/100)) h1above = h1ema1 > h1ema3 h1touch = (close[1] > h1ema1) and (open > (h1ema1 - (h1ema1 * 0.182/100))) h1crossdn = ta.crossunder(h1ema1, h1ema3) h1long = h1far and h1above // 4h Conditions h4emasrc = request.security(syminfo.tickerid, "240", emasrc) h4ema1 = ta.ema(h4emasrc, ema1len) h4ema2 = ta.ema(h4emasrc, ema2len) h4ema3 = ta.ema(h4emasrc, ema3len) h4far = h4ema2 > (h4ema3 + (h4ema3 * h4perc/100)) h4above = h4ema1 > h4ema3 h4long = h4far and h4above // 1d Conditions demasrc = request.security(syminfo.tickerid, "1D", emasrc) dema1 = ta.ema(demasrc, ema1len) dema2 = ta.ema(demasrc, ema2len) dema3 = ta.ema(demasrc, ema3len) dfar = dema2 > (dema3 + (dema3 * dperc/100)) dabove = dema1 > dema3 dlong = dfar and dabove trigger = h1long and h4long and dlong and h1touch hold = h1long and h4long and dlong barcolor(barclronf ? ((hold) ? #0003D8 : #AFC400) : na) plotshape(triggeronf ? (((trigger[1] == false)) ? trigger : na) : na, color=na, text="🚀") stoploss = ta.lowest(low, 5)[3] plot(stoploss, color=color.gray) plotshape((close < stoploss), style=shape.xcross, location=location.belowbar, color=color.gray) // plotshape(crossdn, text="Sell", textcolor=color.white, style=shape.labeldown, location=location.abovebar, color=color.red)
Volume MA * Fibo levels
https://www.tradingview.com/script/ml1w8Gxl-Volume-MA-Fibo-levels/
Khayrulloh
https://www.tradingview.com/u/Khayrulloh/
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/ // © Khayrulloh //@version=5 indicator(title="Volume MA * Fibo levels", shorttitle="Vol MA * Fibo", format=format.volume, timeframe="", timeframe_gaps=true) Length = input(title = "Length MA", defval = 40) Perc1 = input(title = "#1 percent", defval = 100) Perc2 = input(title = "#2 percent", defval = 61.8) Perc3 = input(title = "#3 percent", defval = -38.2) Perc4 = input(title = "#4 percent", defval = -50) ShowMA = input(true) MA = ta.sma(volume, Length) plot(volume, color = color.new(color.silver, 61.8), style = plot.style_columns, title = "Volume") plot(ShowMA ? MA : na, style=plot.style_line, linewidth = 2, color=color.new(color.orange, 32.8), title="Volume MA") ma1 = MA * (100 + Perc1) / 100 ma2 = MA * (100 + Perc2) / 100 ma3 = MA * (100 + Perc3) / 100 ma4 = MA * (100 + Perc4) / 100 vol_ma1 = plot(ShowMA ? ma1 : na, title = "#1", color = color.new(color.green, 32.8), linewidth = 1) vol_ma2 = plot(ShowMA ? ma2 : na, title = "#2", color = color.new(color.green, 32.8), linewidth = 1) vol_ma3 = plot(ShowMA ? ma3 : na, title = "#3", color = color.new(color.red, 32.8), linewidth = 1) vol_ma4 = plot(ShowMA ? ma4 : na, title = "#4", color = color.new(color.red, 32.8), linewidth = 1)
Litecoin Halving Events
https://www.tradingview.com/script/70z7nEoM-Litecoin-Halving-Events/
albertbr
https://www.tradingview.com/u/albertbr/
13
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/ // © dogebrother //@version=4 study(title="Litecoin Halving Events", shorttitle="Litecoin Halvings", overlay=true) isDate(y, m, d) => val = timestamp(y,m,d) if val <= time and val > time[1] true else false // First Halving if isDate(2015, 8, 25) line.new(bar_index, low, bar_index, high, xloc.bar_index, extend.both, color=color.orange) label.new(bar_index, low, text="Litecoin 1st Halving - Aug 25, 2015", style=label.style_label_upper_left, textcolor=color.black, color=color.orange, textalign=text.align_right) // Second Halving if isDate(2019, 8, 5) line.new(bar_index, low, bar_index, high, xloc.bar_index, extend.both, color=color.orange) label.new(bar_index, low, text="Litecoin 2nd Halving - Aug 5, 2019", style=label.style_label_upper_left, textcolor=color.black, color=color.orange, textalign=text.align_right) // Third Halving (Estimated) if isDate(2023, 8, 5) line.new(bar_index, low, bar_index, high, xloc.bar_index, extend.both, color=color.orange) label.new(bar_index, low, text="Litecoin 3rd Halving - Aug 5, 2023", style=label.style_label_upper_left, textcolor=color.black, color=color.orange, textalign=text.align_right) // Fourth Halving (Estimated) if isDate(2027, 8, 5) line.new(bar_index, low, bar_index, high, xloc.bar_index, extend.both, color=color.orange) label.new(bar_index, low, text="Litecoin 4th Halving - (approx) Aug 5, 2027", style=label.style_label_upper_left, textcolor=color.black, color=color.orange, textalign=text.align_right)
Baekdoo Golden Diamond signal
https://www.tradingview.com/script/AoMNNBvF-Baekdoo-Golden-Diamond-signal/
traderbaekdoosan
https://www.tradingview.com/u/traderbaekdoosan/
139
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © traderbaekdoosan //@version=5 indicator("Baekdoo golden diamond signal", overlay=true) //cumulative volume period=input(250) VV=ta.highest(volume[1], period) sumV=math.sum(volume[1], period) //highest volume count=ta.barssince(volume>=VV and close>open) plot(count>0 and count <20 ? close*2:na, color=color.new(color.blue, 20), style=plot.style_areabr, display=display.none) //higher than 10% of 1 year volume ratio=input(0.1) count2=ta.barssince(volume>=sumV*ratio and close>open) plot(count2>0 and count2 <20 ? close : na, color=color.new(color.green, 20), style=plot.style_areabr, display=display.none) //drops without volume ratio2=input(0.5) count3=ta.barssince((volume>=VV or volume>=sumV*ratio) and close>open) plot(count3>0 and count3 <20 and volume<=ta.ema(volume[1], 5)*ratio2 and close<=ta.lowest(close[1], 5) ? close*1.5 : na, color=color.new(color.red, 20), style=plot.style_areabr, display=display.none) //crossover 5 days resistance after dropping without volume count4=ta.barssince(count3>0 and count3 <20 and volume<=ta.ema(volume[1], 5)*ratio2 and close<=ta.lowest(close[1], 5)) plotshape(count4>0 and count4 <10 and close>ta.highest(close[1], 5) ? close : na, color=color.new(color.yellow, 0), style=shape.diamond, display=display.all, size=size.normal)
Combo 4+ KDJ STO RSI EMA3 Visual Trend Pine V5@RL
https://www.tradingview.com/script/kvCK24lx/
RegisL76
https://www.tradingview.com/u/RegisL76/
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/ // © RegisL76 // V 994 // *** PINE SCRIPT V5 *** // // *********************************************************************************** // // V 1 publiée 2021-10-20 V 7.6.4 @RL // V 2 publiée 2023-03-20 V 9.9.4 @RL //@version=5 indicator(title='Combo 4+ KDJ STO RSI EMA3 Visual Trend Pine V5@RL',format=format.inherit,shorttitle='Combo 4+ Visual Trend @RL',overlay=false) // *********************************************************************************** // // Implemented by @Regis_L // // *********************************** COMMON CODE *********************************** // // © RegisL76 // // *********************************************************************************** // ArrowUp =string('🔼') ArrowDown =string('🔽') ArrowRight =string('▶️') //************************************************************************************************************************** f_ExtLines(_NbVal,_ExtOffset,_Value1,_Value2,_Value3,_Color1,_Color2,_Color3,_style1,_style2,_style3,_width1,_width2,_width3)=> // Definition de fonction : trace une pseudo tangente (etendue à droite) pour 1 à 3 courbes // ! _NbVal== [1 to 3] // ! _NbVal==1 -> _Value2==float(na) & _Color2==color(na) & _Value3==float(na) & _Color3==color(na) // ! _NbVal==2 -> _Value3==float(na)) & _Color3==color(na) if _NbVal>=1 and _NbVal<4 _ExtLine1 = line.new(bar_index-_ExtOffset, _Value1[_ExtOffset], bar_index, _Value1, color=_Color1,style=_style1, width=_width1, extend=extend.right) line.delete(_ExtLine1[1]) // Extended line Fast if _NbVal>=2 and _NbVal<4 _ExtLine2 = line.new(bar_index-_ExtOffset, _Value2[_ExtOffset], bar_index, _Value2, color=_Color2,style=_style2, width=_width2, extend=extend.right) line.delete(_ExtLine2[1]) if _NbVal==3 _ExtLine3 = line.new(bar_index-_ExtOffset, _Value3[_ExtOffset], bar_index, _Value3, color=_Color3,style=_style3, width=_width3, extend=extend.right) line.delete(_ExtLine3[1]) // [na] //************************************************************************************************************************** //************************************************************************************************************************** f_Delta (_Value1, _Value2) => // Definition de fonction : Calcul de l'evolution et de la direction du delta entre 2 valeurs, en % (acceleration) _ArrowUp =string('🔼') _ArrowDown =string('🔽') _RedCross =string('❌') _Delta=math.abs((_Value1 - _Value2)) _DeltaPerCent = ((_Delta - _Delta[1]) / _Delta)*100 if math.abs(_DeltaPerCent)>=120 _DeltaPerCent:=na _DeltaRise=_Delta>_Delta[1] _DeltaFall=_Delta<_Delta[1] _DeltaDir= _DeltaRise and _DeltaPerCent!=na(_DeltaPerCent) ? _ArrowUp : _DeltaFall and _DeltaPerCent!=na(_DeltaPerCent) ? _ArrowDown : _RedCross [_DeltaPerCent, _DeltaRise, _DeltaFall, _DeltaDir] //************************************************************************************************************************** // *** Evolution Du Prix Actuel *** // // *** Current Price Evolution *** // priceuptemp = ta.rising(close, 1) pricedowntemp = ta.falling(close, 1) priceup = priceuptemp and not pricedowntemp pricedown = not priceuptemp and pricedowntemp high_up = ta.rising(high, 1) high_down = ta.falling(high, 1) low_up = ta.rising(low, 1) low_down = ta.falling(low, 1) open_up = ta.rising(open, 1) open_down = ta.falling(open, 1) show_ema = input.bool(false ,'Display : EMA Indicator', tooltip='!!! Settings : Choose Only One Of The 4 Indicators To Display !!! ') show_kdj = input.bool(false ,'Display : KDJ Indicator', tooltip='!!! Settings : Choose Only One Of The 4 Indicators To Display !!! ') show_rsi = input.bool(false ,'Display : RSI Indicator', tooltip='!!! Settings : Choose Only One Of The 4 Indicators To Display !!! ') show_sto = input.bool(true ,'Display : STO Indicator', tooltip='!!! Settings : Choose Only One Of The 4 Indicators To Display !!! ') display_combined_layouts = input.bool(true, 'Display Combined Layouts ', tooltip='Checked=Logical Result Of Each (4) Layout And [x] Combined Bkg (No Checked=Specific Indicator Layout And Bkg) ' , confirm=true) at_least_x_among_4_combined_bkg = input.int(3, title='At Least x Combined Bkg', minval=1, maxval=4,tooltip='[1 ; 4] Default=3', confirm=true) ExtOffset = input.int (3 ,title='offset Extend lines',minval = 1,maxval=26,step=1,tooltip ='Default=3') main_show_trend_label = input.bool(true, title ='Show Trend Label') main_show_stops_label = input.bool(true, title ='Show Signal Stop Label') main_show_infos_label = input.bool(false, title='Show Infos Label') full_label_info = input.bool(false, title='Full Infos Label', tooltip='Simple or Full Infos Label', confirm=true) // ********************************************************************************************************************************************************************** // // *********************************************************************************** // // Implemented by @Regis_L // // ************************** KDJ Indicator [Pine V5] @RL CODE *********************** // // © RegisL76 // // ************************ Based on KDJ Indicator [Pine V5] @RL ********************* // // *********************************************************************************** // kdj_ilong = input(26, title='KDJ period',tooltip='default=26') kdj_isig = input(5, title='KDJ signal',tooltip='default=5') kdj_high_threshold = input.int(115, title='KDJ High Threshold', minval=50, maxval=150,tooltip='default=115') kdj_low_threshold = input.int(-15, title='KDJ Low Threshold' , minval=-50, maxval=50,tooltip='default=-15') // *********************************************************************************** // kdj_m = 1 kdj_c = close kdj_h = ta.highest(high, kdj_ilong) kdj_l = ta.lowest(low, kdj_ilong) kdj_RSV = 100 * ((kdj_c - kdj_l) / (kdj_h - kdj_l)) kdj_pK = 0.0 kdj_pD = 0.0 kdj_pK := (kdj_m * kdj_RSV + (kdj_isig - kdj_m) * nz(kdj_pK[1])) / kdj_isig kdj_pD := (kdj_m * kdj_pK + (kdj_isig - kdj_m) * nz(kdj_pD[1])) / kdj_isig kdj_pJ = 3 * kdj_pK - 2 * kdj_pD // *********************************************************************************** // hline(show_kdj ? kdj_high_threshold : na, title='KDJ High Threshold', color=color.new(color.white, 0), linewidth=1, linestyle=hline.style_solid, editable=0) hline(show_kdj ? kdj_low_threshold : na, title='KDJ Low Threshold' , color=color.new(color.white, 0), linewidth=1, linestyle=hline.style_solid, editable=0) hline(show_kdj ? 50 : na, 'KDJ 50% Line', color=color.new(color.white, 0), linewidth=2, linestyle=hline.style_solid, editable=0) // *********************************************************************************** // plot(show_kdj ? kdj_pK : na, 'KDJ Pk', color=color.new(#ffffff, 0), linewidth=2, trackprice=0) plot(show_kdj ? kdj_pD : na, 'KDJ Pd', color=color.new(#ff0000, 0), linewidth=2, trackprice=0) plot(show_kdj ? kdj_pJ : na, 'KDJ Pj', color=color.new(#82fc00, 0), linewidth=2, trackprice=0) // Extended line kdj_pJ kdj_pD kdj_pK if show_kdj f_ExtLines(3,ExtOffset,kdj_pJ,kdj_pD,kdj_pK,color.new(#82fc00, 0),color.new(#ff0000, 0),color.new(#ffffff, 0),line.style_dotted,line.style_dotted,line.style_dashed,2,2,2) // *********************************************************************************** // // Calcule et affichage du delta kdj_pD-kdj_pJ en % if show_kdj // fonction : calcul de l'evolution et de la direction du delta kdj_pD kdj_pJ en % (acceleration) [DeltaPerCent, DeltaRise, DeltaFall, DeltaDir] = f_Delta(kdj_pD, kdj_pJ) DeltaText=string(na) if DeltaPerCent!=na(DeltaPerCent) DeltaText:='[D-J]\nAccel.\n' + DeltaDir + str.tostring(DeltaPerCent,'#.##') + ' %' else DeltaText:='[D-J]\nAccel.\n' + DeltaDir + 'Crossing ?' DeltaLabel = label.new(bar_index+41, kdj_pK, text=DeltaText, yloc=yloc.price, color=kdj_pJ>=kdj_pD and DeltaRise ? color.new(#00ff00, 0) : kdj_pJ<kdj_pD and DeltaRise ? color.new(#ff0000, 0) : kdj_pJ>=kdj_pD and DeltaFall ? color.new(#00ddff, 0) : kdj_pJ<kdj_pD and DeltaFall ? color.new(#ff6106, 0) : color.new(#ffffff,30), textcolor=color.black, style=label. style_label_left, size=size.normal) label.delete(DeltaLabel[1]) // **************************************************************************************************************************** BoxColorKdj=kdj_pJ>kdj_pD and DeltaRise ? color.new(#00ff00, 75) : kdj_pJ<kdj_pD and DeltaRise ? color.new(#ff0000, 75) : kdj_pJ>kdj_pD and DeltaFall ? color.new(#00ddff, 75) : kdj_pJ<kdj_pD and DeltaFall ? color.new(#ff9200, 75) : color.new(#ffffff, 75) DeltaKdjMult=5 BoxKdj=box(na) if kdj_pJ>=kdj_pD BoxKdj:=box.new(bar_index+50,kdj_pJ+(kdj_pJ*DeltaKdjMult/100),bar_index+70,kdj_pD-(kdj_pJ*DeltaKdjMult/100), border_color=color.new(BoxColorKdj,0),border_width=2,text='[pD-pJ] + ' + str.tostring(DeltaKdjMult*2) + ' %', text_size=size.small,text_color=#ffffff,text_halign=text.align_left,extend=extend.both, bgcolor=BoxColorKdj ) else BoxKdj:=box.new(bar_index+50,kdj_pJ-(kdj_pD*DeltaKdjMult/100),bar_index+70,kdj_pD+(kdj_pD*DeltaKdjMult/100), border_color=color.new(BoxColorKdj,0),border_width=2,text='[pD-pJ] + ' + str.tostring(DeltaKdjMult*2) + ' %', text_size=size.small,text_color=#ffffff,text_halign=text.align_left,extend=extend.both, bgcolor=BoxColorKdj ) box.delete(BoxKdj[1]) // *********************************************************************************** // // *** Signaux STOP Achat Ou Vente KDJ *** // // *** Stop Signals Buy Or Sell KDJ *** // kdj_stop_long_temp = kdj_pJ[1] >= kdj_pJ[2] and kdj_pJ[2] >= kdj_pJ[3] and ta.falling(kdj_pJ[0], 1) kdj_stop_short_temp = kdj_pJ[1] <= kdj_pJ[2] and kdj_pJ[2] <= kdj_pJ[3] and ta.rising(kdj_pJ[0], 1) kdj_signal_stop_long = kdj_stop_long_temp and not kdj_stop_short_temp kdj_signal_stop_short = kdj_stop_short_temp and not kdj_stop_long_temp plotshape(not display_combined_layouts and show_kdj ? 50 : na, title='KDJ Stop Long' , style=shape.square, location=location.absolute, color=kdj_signal_stop_long ? color.new(#82fc00, 0) : na, size=size.tiny) plotshape(not display_combined_layouts and show_kdj ? 50 : na, title='KDJ Stop Short', style=shape.square, location=location.absolute, color=kdj_signal_stop_short ? color.new(#ff00ff, 0) : na, size=size.tiny) // *********************************************************************************** // // *** Detection Des Signaux Achat Ou Vente KDJ *** // // *** KDJ Buy Or Sell Signals Detection *** // kdj_long_temp = ta.rising(kdj_pJ, 1) or kdj_pJ >= kdj_high_threshold kdj_short_temp = ta.falling(kdj_pJ, 1) or kdj_pJ <= kdj_low_threshold kdj_signal_long = kdj_long_temp and not kdj_short_temp and not kdj_signal_stop_long kdj_signal_short = kdj_short_temp and not kdj_long_temp and not kdj_signal_stop_short // *********************************************************************************** // bgcolor(show_kdj and not display_combined_layouts and kdj_signal_long ? color.new(#82fc00, 81) : na, title='KDJ BKG LONG') bgcolor(show_kdj and not display_combined_layouts and kdj_signal_short ? color.new(#ff0000, 81) : na, title='KDJ BKG SHORT') // *********************************************************************************** // // ************************ END KDJ Indicator [Pine V5] @RL CODE ********************* // // ************************ © RegisL76 ******************* // // *********************************************************************************** // // ********************************************************************************************************************************************************************** // // *********************************************************************************** // // Implemented by @Regis_L // // ******************************* RSI DIVERGENCE CODE ******************************* // // © RegisL76 // // **************************** Based on RSI DIVERGENCE @RL*************************** // // *********************************************************************************** // // *** Default Values RSI : [13, 21, 6, -6, 1.5] *** // rsi_src_fast = close rsi_len_fast = input.int(5, minval=1, title='RSI Length Fast',tooltip='Default=5') rsi_src_slow = close rsi_len_slow = input.int(26, minval=1, title='RSI Length Slow',tooltip='Default=26') rsi_overbought_threshold = input.int(6, minval=0, maxval=100, title='RSI OverBought Threshold',tooltip='Default=6') rsi_oversold_threshold = input.int(-6, minval=-100, maxval=0, title='RSI OverSold Threshold',tooltip='Default=-6') rsi_highfilter_threshold = input.float(1.5, minval=-15, maxval=15, title='RSI Filter +- Threshold', step=0.5,tooltip='Default=1.5') rsi_lowfilter_threshold = rsi_highfilter_threshold * -1 // *********************************************************************************** // // *** RSI DIVERGENCE *** // rsi_up_fast = ta.rma(math.max(ta.change(rsi_src_fast), 0), rsi_len_fast) rsi_down_fast = ta.rma(-math.min(ta.change(rsi_src_fast), 0), rsi_len_fast) rsi_fast = rsi_down_fast == 0 ? 100 : rsi_up_fast == 0 ? 0 : 100 - 100 / (1 + rsi_up_fast / rsi_down_fast) rsi_up_slow = ta.rma(math.max(ta.change(rsi_src_slow), 0), rsi_len_slow) rsi_down_slow = ta.rma(-math.min(ta.change(rsi_src_slow), 0), rsi_len_slow) rsi_slow = rsi_down_slow == 0 ? 100 : rsi_up_slow == 0 ? 0 : 100 - 100 / (1 + rsi_up_slow / rsi_down_slow) // *********************************************************************************** // // *** DIVERGENCE *** // rsi_divergence = rsi_fast - rsi_slow //****************************************************************************************************************************// // *** Bands Lines*** // rsi_linesup = hline(show_rsi ? rsi_overbought_threshold : na, title='RSI Sup % Line', color=color.green, linewidth=1, linestyle=hline.style_solid, editable=0) rsi_lineinf = hline(show_rsi ? rsi_oversold_threshold : na , title='RSI Inf % Line', color=color.red, linewidth=1, linestyle=hline.style_solid, editable=0) rsi_line0 = hline(show_rsi ? 0 : na, title='RSI 0% Line', color=color.new(#ffffff,0), linewidth=1, linestyle=hline.style_solid, editable=0) // *** Bands Plots *** // rsi_bandsup = plot(show_rsi ? rsi_overbought_threshold : na, title='RSI Band Sup %', color=na, linewidth=1, trackprice=1, editable=0) rsi_bandinf = plot(show_rsi ? rsi_oversold_threshold : na, title='RSI Band Inf %', color=na, linewidth=1, trackprice=1, editable=0) rsi_band0 = plot(show_rsi ? 0 : na, title='RSI Neutral Band 0%', color=na, linewidth=1, trackprice=1, editable=0) // rsi_plot_div = plot(show_rsi ? rsi_divergence : na, title='RSI Divergence', color=priceup ? color.new(#82fc00, 0) : color.new(#ff0000, 0), linewidth=2, trackprice=1, style=plot.style_line) //****************************************************************************************************************************// // *** Divergence + et Divergence - *** // rsi_div_pos = rsi_divergence rsi_div_neg = rsi_divergence * -1 // *** rsi_plot_div_neg *** // plot(show_rsi ? rsi_div_neg : na, title='RSI Mirror Divergence -', color=color.new(color.white, 85), style= plot.style_area, linewidth=2, trackprice=1) //****************************************************************************************************************************// // *** Background High Low Thresholds *** // rsi_overbandsup = rsi_div_pos > rsi_overbought_threshold rsi_underbandinf = rsi_div_pos < rsi_oversold_threshold fill(rsi_plot_div, rsi_bandsup, color=rsi_overbandsup and show_rsi ? color.new(#82fc00, 60) : na, title='RSI Bkg>= Band Sup') fill(rsi_plot_div, rsi_bandinf, color=rsi_underbandinf and show_rsi ? color.new(#ff0000, 60) : na, title='RSI Bkg <= Band inf') // *********************************************************************************** // // *** Signaux STOP Achat Ou Vente RSI DIVERGENCE *** Dépendant du RSI (Over Or Under) THRESHOLD // // *** STOP Signals Buy Or Sell RSI DIVERGENCE *** RSI (Over Or Under) Threshold dependent // rsi_stop_long_temp = rsi_divergence[1] >= rsi_overbought_threshold and rsi_divergence[0] <= rsi_overbought_threshold rsi_stop_short_temp = rsi_divergence[1] <= rsi_oversold_threshold and rsi_divergence[0] >= rsi_oversold_threshold rsi_signal_stop_long = rsi_stop_long_temp and not rsi_stop_short_temp rsi_signal_stop_short = rsi_stop_short_temp and not rsi_stop_long_temp // *********************************************************************************** // // *** Signaux RSI Signal STOP Long & Short *** // // *** Show RSI Signal STOPLong *** // plotshape(not display_combined_layouts and show_rsi ? 0 : na, style=shape.square, location=location.absolute, color=rsi_signal_stop_long ? color.new(#82fc00, 0) : na, title='RSI STOP Long Signal', size=size.tiny) // *** Show RSI Signal STOP Short *** // plotshape(not display_combined_layouts and show_rsi ? 0 : na, style=shape.square, location=location.absolute, color=rsi_signal_stop_short ? color.new(#ff00ff, 0) : na, title='RSI STOP Short Signal', size=size.tiny) //************************************************************************************ // // *** Detection Des Signaux Achat Ou Vente RSI *** Dépendant du RSI (High Or Low) THRESHOLD // // *** RSI Buy Or Sell Signal Detection *** RSI (High Or Low) Threshold dependent // rsi_long_temp = ta.rising(rsi_divergence, 1) or ta.falling(rsi_divergence, 1) and rsi_divergence >= rsi_highfilter_threshold rsi_short_temp = ta.falling(rsi_divergence, 1) or ta.rising(rsi_divergence, 1) and rsi_divergence <= rsi_lowfilter_threshold rsi_signal_long = rsi_long_temp and not rsi_short_temp and not rsi_signal_stop_long rsi_signal_short = not rsi_long_temp and rsi_short_temp and not rsi_signal_stop_short // *********************************************************************************** // // *** Background Long & Short Zones *** // rsi_bkg_gen_buy = rsi_signal_long rsi_bkg_gen_sell = rsi_signal_short //****************************************************************************************************************************// // *** Background Long & Short Zones *** // bgcolor(rsi_signal_long and not display_combined_layouts and show_rsi ? color.new(#82fc00, 81) : na, title='RSI:Bkg Buy Zone') bgcolor(rsi_signal_short and not display_combined_layouts and show_rsi ? color.new(#ff0000, 81) : na, title='RSI:Bkg Sell Zone') // *********************************************************************************** // // ****************************** END RSI DIVERGENCE CODE **************************** // // ****************************** © RegisL76 **************************** // // *********************************************************************************** // // ********************************************************************************************************************************************************************** // // ******************************** STOCHASTIQUE CODE ******************************** // // © RegisL76 // // ***************************** Based on STOCHASTIC @RL****************************** // // *********************************************************************************** // // *** Default Values STOCHASTIC : [21, 3, 3] *** // // *** Valeur par defaut : [21, 3, 3] *** // sto_periodK = input.int(26, title='STO K', minval=1,tooltip='Default=26') sto_periodD = input.int(5, title='STO D', minval=1,tooltip='Default=5') sto_smoothK = input.int(3, title='STO Smooth K', minval=1,tooltip='Default=3') sto_highzone = input.int(80 , title='STO High Zone', minval=50, maxval=100, step=1,tooltip='Default=80') sto_lowzone = input.int(20 , title='STO Low Zone' , minval=0, maxval=50 , step=1,tooltip='Default=20') sto_maxzone = input.int(100, title='STO Max Zone' , minval=50, maxval=100, step=1,tooltip='Default=100') sto_minzone = input.int(0 , title='STO Min Zone' , minval=0, maxval=050 , step=1,tooltip='Default=0') // *********************************************************************************** // // *** STOCHASTIC *** // sto_k = ta.sma(ta.stoch(close, high, low, sto_periodK), sto_smoothK) sto_d = ta.sma(sto_k, sto_periodD) // *********************************************************************************** // // *** Moyenne entre K et D *** // *** Detecte une eventuelle inversion de tendance si k et Moy en opposition *** // // *** Average between K and D *** // *** Detects a possible trend reversal if k and Moy in opposition *** // sto_moy = (sto_k + sto_d) / 2 // *********************************************************************************** // // *** Band High - Low - Neutral *** // sto_highline = hline(show_sto ? sto_highzone : na, title='STO Upper Band' , color=color.new(#82fc00, 0), linewidth=1, linestyle=hline.style_solid) sto_lowline = hline(show_sto ? sto_lowzone : na , title='STO Lower Band' , color=color.new(#ff0000, 0), linewidth=1, linestyle=hline.style_solid) sto_line50 = hline(show_sto ? 50 : na , title='STO Neutral Line', color=color.new(#ffffff, 0), linewidth=1, linestyle=hline.style_solid) sto_linemax = hline(show_sto ? sto_maxzone : na , title='STO Max Line' , color=color.new(#00ff00, 0), linewidth=1, linestyle=hline.style_solid) sto_linemin = hline(show_sto ? sto_minzone : na , title='STO Min Line' , color=color.new(#ff0000, 0), linewidth=1, linestyle=hline.style_solid) // *********************************************************************************** // // *** Plot Low - 50 % - High Lines ***// sto_plotlowline = plot(show_sto ? sto_lowzone : na, title='Low Line' , color=na, editable=0) sto_plothighline = plot(show_sto ? sto_highzone : na, title='High Line', color=na, editable=0) sto_plot50line = plot(show_sto ? 50 : na, title='50% Line' , color=na, editable=0) sto_plotmaxline = plot(show_sto ? sto_maxzone : na, title='95% Line' , color=na, editable=0) sto_plotminline = plot(show_sto ? sto_minzone : na, title='05% Line' , color=na, editable=0) // *********************************************************************************** // // Plot STOCHASTIC Curves *** // sto_k1 = plot(show_sto ? sto_k : na, title='STO %K', color=color.new(#82fc00, 0), linewidth=2, trackprice=0) sto_d1 = plot(show_sto ? sto_d : na, title='STO %D', color=color.new(#ff0000, 0), linewidth=2, trackprice=0) // Extended line sto_k sto_d if show_sto f_ExtLines(2,ExtOffset,sto_k,sto_d,float(na),color.new(#82fc00, 0),color.new(#ff0000, 0),color(na),line.style_dotted,line.style_dotted,string(na),2,2,int(na)) // *********************************************************************************** // // Calcule et affichage du delta sto_k-sto_d en % if show_sto // fonction : calcul de l'evolution et de la direction du delta sto_k sto_d en % (acceleration) [DeltaPerCent, DeltaRise, DeltaFall, DeltaDir] = f_Delta(sto_k, sto_d) DeltaText=string(na) if DeltaPerCent!=na(DeltaPerCent) DeltaText:='[K-D]\nAccel.\n' + DeltaDir + str.tostring(DeltaPerCent,'#.##') + ' %' else DeltaText:='[K-D]\nAccel.\n' + DeltaDir + 'Crossing ?' DeltaLabel = label.new(bar_index+41, (sto_k+sto_d)/2, text=DeltaText, yloc=yloc.price, color=sto_k>=sto_d and DeltaRise ? color.new(#00ff00, 0) : sto_k<sto_d and DeltaRise ? color.new(#ff0000, 0) : sto_k>=sto_d and DeltaFall ? color.new(#00ddff, 0) : sto_k<sto_d and DeltaFall ? color.new(#ff6106, 0) : color.new(#ffffff,30), textcolor=color.black, style=label. style_label_left, size=size.normal) label.delete(DeltaLabel[1]) // **************************************************************************************************************************** BoxColorSto=sto_k>sto_d and DeltaRise ? color.new(#00ff00, 75) : sto_k<sto_d and DeltaRise ? color.new(#ff0000, 75) : sto_k>sto_d and DeltaFall ? color.new(#00ddff, 75) : sto_k<sto_d and DeltaFall ? color.new(#ff9200, 75) : color.new(#ffffff, 75) DeltaStoMult=5 BoxSto=box(na) if sto_k>=sto_d BoxSto:=box.new(bar_index+50,sto_k+(sto_k*DeltaStoMult/100),bar_index+70,sto_d-(sto_k*DeltaStoMult/100), border_color=color.new(BoxColorSto,0),border_width=2,text='[K-D] + ' + str.tostring(DeltaStoMult*2) + ' %', text_size=size.small,text_color=#ffffff,text_halign=text.align_left,extend=extend.both, bgcolor=BoxColorSto ) else BoxSto:=box.new(bar_index+50,sto_d+(sto_d*DeltaStoMult/100),bar_index+70,sto_k-(sto_d*DeltaStoMult/100), border_color=color.new(BoxColorSto,0),border_width=2,text='[K-D] + ' + str.tostring(DeltaStoMult*2) + ' %', text_size=size.small,text_color=#ffffff,text_halign=text.align_left,extend=extend.both, bgcolor=BoxColorSto ) box.delete(BoxSto[1]) // *** Over Bought & Over Sold Zones *** // sto_overbought = sto_k >= sto_highzone sto_oversold = sto_k <= sto_lowzone fill(sto_plothighline, sto_k1, color=show_sto and sto_overbought ? color.new(#82fc00, 60) : na, title='STO: Bkg Over Bought Zone') fill(sto_plotlowline , sto_k1, color=show_sto and sto_oversold ? color.new(#ff0000, 60) : na, title='STO: Bkg Over Sold Zone') fill(sto_plothighline, sto_plotmaxline, color=show_sto and sto_overbought ? color.new(#ffffff, 70) : na, title='STO: Bkg Max Over Bought Zone') fill(sto_plotlowline , sto_plotminline, color=show_sto and sto_oversold ? color.new(#ffffff, 70) : na, title='STO: Bkg Max Over Sold Zone') // *********************************************************************************** // // *** STO : Signal STOP Achat Ou Vente STOCHASTIQUE Basé sur la Divergence entre K et Moyenne de K & D *** // // *** STO: STOCHASTIC Buy Or Sell STOP Signal Based on the K & D Divergence between K and Average *** // // *** STO : Conditions Signal STOP Long & Short *** // *** STO : Conditions Avertissement STOP Long & Short *** sto_signal_stop_long_temp = ta.rising(sto_moy, 1) and ta.falling(sto_k, 1) sto_signal_stop_short_temp = ta.falling(sto_moy, 1) and ta.rising(sto_k, 1) sto_signal_stop_long = sto_signal_stop_long_temp and not sto_signal_stop_short_temp sto_signal_stop_short = sto_signal_stop_short_temp and not sto_signal_stop_long_temp plotshape(not display_combined_layouts and show_sto ? 50 : na, title='STO Stop Long', style=shape.square, location=location.absolute, color=ta.rising(sto_moy, 1) and ta.falling(sto_k, 1) ? color.new(#82fc00, 0) : na, size=size.tiny) plotshape(not display_combined_layouts and show_sto ? 50 : na, title='STO Stop Short', style=shape.square, location=location.absolute, color=ta.falling(sto_moy, 1) and ta.rising(sto_k, 1) ? color.new(#ff00ff, 0) : na, size=size.tiny) // *********************************************************************************** // // *** Detection Des Signaux Achat Ou Vente STOCHASTIQUE *** // // *** STOCHASTIC Buy Or Sell Signals Detection *** // sto_long_temp = ta.rising(sto_moy, 1) and ta.rising(sto_k, 1) sto_short_temp = ta.falling(sto_moy, 1) and ta.falling(sto_k, 1) sto_signal_long = sto_long_temp and not sto_short_temp and not sto_signal_stop_long sto_signal_short = sto_short_temp and not sto_long_temp and not sto_signal_stop_short // *********************************************************************************** // // *** Background STOCH *** // bgcolor(sto_signal_long and not display_combined_layouts and show_sto ? color.new(#82fc00, 81) : na, title='STO:Bkg Long Zone') bgcolor(sto_signal_short and not display_combined_layouts and show_sto ? color.new(#ff0000, 81) : na, title='STO:Bkg Short Zone') // *********************************************************************************** // // ***background STO General trend conditions Long & Short Zone (and watch zone) *** // // *** background STO Conditions générales de tendance Zone Long & Short (et zone de veille) *** sto_bkg_gen_buy = sto_signal_long sto_bkg_gen_sell = sto_signal_short // *********************************************************************************** // // ******************************** END STOCHASTIQUE CODE **************************** // // ******************************** © RegisL76 **************************** // // *********************************************************************************** // // ********************************************************************************************************************************************************************** // // ************************************ EMA 3 CODE *********************************** // // © RegisL76 // // *********************************************************************************** // // *** INPUTS EMA's Slow - Middle - Fast *** ema_len_slow = input.int(5, minval=1, title='EMA Length Slow',tooltip='Default=5') ema_len_middle = input.int(14, minval=1, title='EMA Length Median',tooltip='Default=14') ema_len_fast = input.int(26, minval=1, title='EMA Length Fast',tooltip='Default=26') ema_len_high_low = input.int(31, minval=1, maxval=300, title='EMA Lenght High/Low Price',tooltip='Default=31') // *** Lenght Very SLOW : (Len Very Slow = Len Slow / Len Very Slow) ema_len_VSlow = input.int(2, minval=1, maxval=3, title='EMA Len V_Slow=Len Slow / x ? ->', step=1,tooltip='Default=2') ema_src_slow = input(close, title='EMA Source Slow' ,tooltip='Default=close') ema_src_median = input(close, title='EMA Source EMA_Median',tooltip='Default=close') ema_src_fast = input(close, title='EMA Source Fast' ,tooltip='Default=close') ema_src_VSlow = input(close, title='EMA Source Very Slow' ,tooltip='Default=close') ema_src_high = input(high , title='EMA Source High Price',tooltip='Default=high') ema_src_low = input(low , title='EMA Source Low Price' ,tooltip='Default=low') // *********************************************************************************** // // *** ZOOM Factors (Difference & Very Slow MA)*** ema_zoom_diff = input.float(1.7, title='EMA Zoom Difference Slow-Fast', minval=1 , maxval=3.0, step=0.1,tooltip='Default=1.7') ema_zoom_VSlow = input.float(3.4, title='EMA Zoom Very Slow' , minval=3.1, maxval=6 , step=0.1,tooltip='Default=3.4') // *** EMA's : Ema_Slow, Ema_Median, Ema_Fast *** ema_out_slow = ta.ema(ema_src_slow, ema_len_slow) ema_out_median = ta.ema(ema_src_median, ema_len_middle) ema_out_fast = ta.ema(ema_src_fast, ema_len_fast) // *********************************************************************************** // // *** 3 Curves EMA : Ema_Slow, Ema_Median, Ema_Fast *** ema_slow = plot(show_ema ? ema_out_slow : na, title='EMA Slow' , color=color.new(#00f6ff, 0), linewidth=1, trackprice=0) // 1-bleu clair = ema_slow = light Blue ema_median = plot(show_ema ? ema_out_median : na, title='EMA Median', color=color.new(#FFFFFF, 0), linewidth=2, trackprice=1) // 2-Blanc = ema_median = White ema_fast = plot(show_ema ? ema_out_fast : na, title='EMA Fast' , color=color.new(#ff0000, 0), linewidth=1, trackprice=0) // 3-rouge = ema_fast = Red // *********************************************************************************** // // *** Difference Ema_Slow-Ema_Fast *** ema_diff_sl_fa = ema_out_slow - ema_out_fast // *********************************************************************************** // // *** Amplified Deviation MA's Slow_Fast From The Ema_Median *** // // *** Déviation Amplifiée Par Rapport A La Courbe Mediane *** // ema_diff_zoom = ema_out_median + ema_diff_sl_fa * ema_zoom_diff // *** Moving Average VERY SLOW MA Amplified *** // ema_diff_VSlow = ta.ema(ema_src_VSlow, int(ema_len_slow / ema_len_VSlow)) - ema_out_median ema_out_VSlow_z = ema_zoom_VSlow * ema_diff_VSlow + ema_out_median // *** Plot Very Slow EMA Amplified *** // // *** Tracé Very Slow MA Amplifiée *** // ema_VSlow_z = plot(show_ema ? ema_out_VSlow_z : na, color=color.new(color.orange, 0), linewidth=2, title='EMA Very Slow Amplified', trackprice=1) // *********************************************************************************** // graph_text = 'Graph --> ERROR !' bkg_text = ' ERROR' // *** Vertical Center Layouts *** // v_center_layouts = ema_out_median if show_kdj graph_text := 'Graph --> KDJ' bkg_text := ' KDJ' v_center_layouts := 50 v_center_layouts else if show_rsi graph_text := 'Graph --> RSI' bkg_text := ' RSI' v_center_layouts := 0 v_center_layouts else if show_sto graph_text := 'Graph --> STO' bkg_text := ' STO' v_center_layouts := 50 v_center_layouts else if show_ema graph_text := 'Graph --> EMA' bkg_text := ' EMA' v_center_layouts := ema_out_median v_center_layouts if show_ema and (show_kdj or show_rsi or show_sto) or show_kdj and (show_ema or show_rsi or show_sto) or show_rsi and (show_ema or show_kdj or show_sto) or show_sto and (show_ema or show_kdj or show_rsi) graph_text := 'WARNING : Settings -->\nChoose Only One Of The\n4 Indicators To Display\n' bkg_text := ' ERROR !' bkg_text if not show_ema and not show_kdj and not show_rsi and not show_sto graph_text := 'Graph : Settings -->\nChoose At Least\nOne Indicator To Display\n' bkg_text := ' ERROR !' bkg_text // *********************************************************************************** // // HIGH - LOW Price & Middle High/Low Price (Not Ploted) ema_middlel_hl = (ta.ema(ema_src_high[0], ema_len_high_low) + ta.ema(ema_src_low[0], ema_len_high_low)) / 2 ema_hi = ta.ema(ema_src_high, ema_len_high_low) ema_lo = ta.ema(ema_src_low, ema_len_high_low) // *** Create Long & Short Thresholds *** // *** Creation Seuils Long & Short *** ema_threshold = (ema_out_VSlow_z + ema_diff_zoom) / 2 // *********************************************************************************** // // *** Conditions Warning STOP Long & Short *** // *** Conditions Avertissement STOP Long & Short *** ema_signal_stop_long_temp = ema_out_VSlow_z >= ema_threshold and ta.rising(ema_out_VSlow_z[1], 2) and pricedown ema_signal_stop_short_temp = ema_out_VSlow_z <= ema_threshold and ta.falling(ema_out_VSlow_z[1], 2) and priceup ema_signal_stop_long = ema_signal_stop_long_temp and not ema_signal_stop_short_temp ema_signal_stop_short = ema_signal_stop_short_temp and not ema_signal_stop_long_temp // *********************************************************************************** // // *** Layouts of the EMA Stop Long & Short Warnings *** // *** Tracés des Avertissements EMA STOP Long & Short *** plotshape(not display_combined_layouts and show_ema ? v_center_layouts : na, title='EMA Stop_Long Signal', style=shape.square, location=location.absolute, color=ema_signal_stop_long ? color.new(#82fc00, 0) : na, size=size.tiny) plotshape(not display_combined_layouts and show_ema ? v_center_layouts : na, title='EMA Stop_Short Signal', style=shape.square, location=location.absolute, color=ema_signal_stop_short ? color.new(#ff00ff, 0) : na, size=size.tiny) // ******************************************************************************** // // *** Long & Short Conditions *** // *** Conditions Vente ou Achat *** ema_condbuy_anda = priceup and ta.rising(ema_diff_zoom, 1) and not pricedown and ta.pvt > ta.pvt[1] ema_condsell_anda = pricedown and ta.falling(ema_diff_zoom, 1) and not priceup and ta.pvt < ta.pvt[1] ema_condbuy_andb = ta.rising(ema_out_VSlow_z, 1) ema_condsell_andb = ta.falling(ema_out_VSlow_z, 1) // *** Suite des conditions *** // // *** Continuation of conditions *** // ema_condbuytemp = ema_condbuy_anda and ema_condbuy_andb ema_condselltemp = ema_condsell_anda and ema_condsell_andb ema_condbuy_andg = not ema_condselltemp ema_condsell_andg = not ema_condbuytemp ema_signal_long = ema_condbuytemp and ema_condbuy_andg ema_signal_short = ema_condselltemp and ema_condsell_andg // *********************************************************************************** // // *** Background Zones Long & Short *** // *** Background Zones Long & Short *** ema_bkg_buy = ema_signal_long ema_bkg_sell = ema_signal_short // *********************************************************************************** // // *** Long & Short Zone Trend Conditions *** // *** Conditions De Tendance Zone Long & Short *** ema_condbkg_buy = ema_out_VSlow_z >= ema_out_slow and ema_out_VSlow_z > ema_threshold or ema_signal_long ema_condbkg_sell = ema_out_VSlow_z <= ema_out_fast and ema_out_VSlow_z < ema_threshold or ema_signal_short // *********************************************************************************** // // *** Background General EMA Trend Conditions Long & Short Zone (And Standbye Zone) *** // *** Background EMA Conditions Générales De Tendance Zone Long & Short (Et Zone De Veille) *** ema_condtempbuy = ema_bkg_buy and ema_condbkg_buy and not ema_signal_stop_long ema_condtempsell = ema_bkg_sell and ema_condbkg_sell and not ema_signal_stop_short ema_bkg_gen_buy = ema_condtempbuy and not ema_condtempsell ema_bkg_gen_sell = ema_condtempsell and not ema_condtempbuy // *** Background EMA *** // bgcolor(ema_bkg_gen_buy and not display_combined_layouts and show_ema ? color.new(#82fc00, 81) : na, title='EMA:Bkg Long Zone') bgcolor(ema_bkg_gen_sell and not display_combined_layouts and show_ema ? color.new(#ff0000, 81) : na, title='EMA:Bkg Short Zone') // ******************************************************************************** // // ********************************* END EMA's 3 CODE ***************************** // // ********************************* © RegisL76 ***************************** // // ******************************************************************************** // // ********************************************************************************************************************************************************************** // // ********************************* MAIN CODE ************************************ // // © RegisL76 // // ******************************************************************************** // main_offset_lab_trend = input.int(26, minval=-120, maxval=80, title='Main:Offset Trend Label', tooltip='[-120 ; 80] default=26') main_offset_lab_stop = input.int(41, minval=-105, maxval=105, title='Main:Offset Stop Label' , tooltip='[-105 ; 105] default=41') main_offset_lab_info = input.int(-44, minval=-160, maxval=-10, title='Main:Offset Infos Label', tooltip='[-160 ; -10] default=-44') // ************************************************************* // // *** General Conditions Warning STOP Long & Short *** // // *** Conditions Generales Avertissement STOP Long & Short *** main_signal_stop_long_temp = ema_signal_stop_long or sto_signal_stop_long or rsi_signal_stop_long or kdj_signal_stop_long main_signal_stop_short_temp = ema_signal_stop_short or sto_signal_stop_short or rsi_signal_stop_short or kdj_signal_stop_short main_signal_stop_long = main_signal_stop_long_temp and not main_signal_stop_short_temp main_signal_stop_short = main_signal_stop_short_temp and not main_signal_stop_long_temp // *** INIT *** // main_power_stop_long = 0 main_power_stop_short = 0 main_power_stop = 0 // stop_pow_text ="" color_text_stop = color.new(#ffffff, 0) if ema_signal_stop_long main_power_stop_long := main_power_stop_long + 1 main_power_stop_long if ema_signal_stop_short main_power_stop_short := main_power_stop_short + 1 main_power_stop_short if sto_signal_stop_long main_power_stop_long := main_power_stop_long + 1 main_power_stop_long if rsi_signal_stop_short main_power_stop_short := main_power_stop_short + 1 main_power_stop_short if rsi_signal_stop_long main_power_stop_long := main_power_stop_long + 1 main_power_stop_long if sto_signal_stop_short main_power_stop_short := main_power_stop_short + 1 main_power_stop_short if kdj_signal_stop_long main_power_stop_long := main_power_stop_long + 1 main_power_stop_long if kdj_signal_stop_short main_power_stop_short := main_power_stop_short + 1 main_power_stop_short // ************************************************************* // // *** Force Du Signal STOP Long & Short *** // // *** Signal Strength STOP Long & Short *** // stop_pow_text = '??' main_power_stop := math.abs(main_power_stop_long - main_power_stop_short) if main_power_stop_long > main_power_stop_short color_text_stop := color.new(#ff0000, 0) stop_pow_text := 'STOP LG: ' stop_pow_text else if main_power_stop_long < main_power_stop_short color_text_stop := color.new(#0aa01a, 0) stop_pow_text := 'STOP SH: ' stop_pow_text else if main_power_stop_long == main_power_stop_short color_text_stop := color.new(#000000, 0) stop_pow_text := 'NO STOP:' stop_pow_text // ******************************************************************************** // // *** Main LONG & SHORT Conditions *** // // *** Conditions Generales Vente & Achat *** // main_power = 0 main_power_long = 0 main_power_short = 0 // ******************************************************************************** // // *** 4 Conditions Sur 4 (Exclusif) *** // // *** 4 Out of 4 Conditions (Exclusive) *** // signal_long_temp4_4 = rsi_signal_long and sto_signal_long and ema_signal_long and kdj_signal_long signal_short_temp4_4 = rsi_signal_short and sto_signal_short and ema_signal_short and kdj_signal_short if signal_long_temp4_4 main_power_long := 4 main_power_long if signal_short_temp4_4 main_power_short := 4 main_power_short // **************************************** // // *** 3 Seules Conditions Sur 4 (Exclusif) *** // // *** Only 3 Conditions Out of 4 (Exclusive) *** // signal_long_temp3_4 = (sto_signal_long and rsi_signal_long and ema_signal_long or sto_signal_long and ema_signal_long and kdj_signal_long or sto_signal_long and rsi_signal_long and kdj_signal_long or rsi_signal_long and ema_signal_long and kdj_signal_long) and not signal_long_temp4_4 signal_short_temp3_4 = (sto_signal_short and rsi_signal_short and ema_signal_short or sto_signal_short and ema_signal_short and kdj_signal_short or sto_signal_short and rsi_signal_short and kdj_signal_short or rsi_signal_short and ema_signal_short and kdj_signal_short) and not signal_short_temp4_4 if signal_long_temp3_4 main_power_long := 3 main_power_long if signal_short_temp3_4 main_power_short := 3 main_power_short // **************************************** // // *** 2 Seules Conditions sur 4 (Exclusif) *** // // *** Only 2 Conditions out of 4 (Exclusive) *** // signal_long_temp2_4 = (rsi_signal_long and sto_signal_long or rsi_signal_long and ema_signal_long or rsi_signal_long and kdj_signal_long or sto_signal_long and ema_signal_long or sto_signal_long and kdj_signal_long or ema_signal_long and kdj_signal_long) and not signal_long_temp3_4 and not signal_long_temp4_4 signal_short_temp2_4 = (rsi_signal_short and sto_signal_short or rsi_signal_short and ema_signal_short or rsi_signal_short and kdj_signal_short or sto_signal_short and ema_signal_short or sto_signal_short and kdj_signal_short or ema_signal_short and kdj_signal_short) and not signal_short_temp3_4 and not signal_short_temp4_4 if signal_long_temp2_4 main_power_long := 2 main_power_long if signal_short_temp2_4 main_power_short := 2 main_power_short // **************************************** // // *** 1 Seule Condition Sur 4 (Exclusif) *** // // *** Only 1 Condition Out of 4 (Exclusive) *** // signal_long_temp1_4 = (rsi_signal_long or sto_signal_long or ema_signal_long or kdj_signal_long) and not signal_long_temp2_4 and not signal_long_temp3_4 and not signal_long_temp4_4 signal_short_temp1_4 = (rsi_signal_short or sto_signal_short or ema_signal_short or kdj_signal_short) and not signal_short_temp2_4 and not signal_short_temp3_4 and not signal_short_temp4_4 if signal_long_temp1_4 main_power_long := 1 main_power_long if signal_short_temp1_4 main_power_short := 1 main_power_short // **************************************** // main_power := math.abs(main_power_long - main_power_short) main_signal_long_temp = signal_long_temp1_4 and at_least_x_among_4_combined_bkg <= 1 or signal_long_temp2_4 and at_least_x_among_4_combined_bkg <= 2 or signal_long_temp3_4 and at_least_x_among_4_combined_bkg <= 3 or signal_long_temp4_4 and at_least_x_among_4_combined_bkg <= 4 main_signal_short_temp = signal_short_temp1_4 and at_least_x_among_4_combined_bkg <= 1 or signal_short_temp2_4 and at_least_x_among_4_combined_bkg <= 2 or signal_short_temp3_4 and at_least_x_among_4_combined_bkg <= 3 or signal_short_temp4_4 and at_least_x_among_4_combined_bkg <= 4 // ******************************************************************************** // // *** Force Du Signal Long & Short *** // // *** Signal Strength Long & Short *** // trend_pow_text = '' trend_color_long = color.new(#82fc00, 0) trend_color_short = color.new(#ff0000, 0) trend_color_text = color.new(na, 0) if main_power_long > main_power_short trend_pow_text := 'LG PWR :' trend_color_text := trend_color_long else if main_power_long < main_power_short trend_pow_text := 'SH PWR :' trend_color_text := trend_color_short trend_color_text else trend_pow_text := 'WAIT & SEE:' trend_color_text := color.new(#ffffff, 0) trend_color_text // ******************************************************************************** // // *** Main LONG & SHORT Conditions Finales *** // // *** Main LONG & SHORT Final Conditions *** // main_signal_long = main_signal_long_temp and not main_signal_stop_long and main_power_long > main_power_short main_signal_short = main_signal_short_temp and not main_signal_stop_short and main_power_long < main_power_short // ******************************************************************************** // // *** Layouts of the General Stop Long & Short Warnings *** // *** Tracés des Avertissements Generaux STOP Long & Short *** plotshape(display_combined_layouts ? v_center_layouts : na, title='MAIN Stop_Long Signal', style=shape.square, location=location.absolute, color=main_signal_stop_long ? color.new(#82fc00, 0) : na, size=size.tiny) plotshape(display_combined_layouts ? v_center_layouts : na, title='MAIN Stop_Short Signal', style=shape.square, location=location.absolute, color=main_signal_stop_short ? color.new(#ff00ff, 0) : na, size=size.tiny) // ******************************************************************************** // // *** Main Background : Trend Conditions Long & Short Zone (And Standbye Zone) *** // *** background général : Conditions De Tendance Zone Long & Short (Et Zone De Veille) *** bgcolor(display_combined_layouts and main_signal_long and not main_signal_short and main_power >= at_least_x_among_4_combined_bkg ? color.new(#82fc00, 65) : na, title='Main:Bkg Long Zone') bgcolor(display_combined_layouts and main_signal_short and not main_signal_long and main_power >= at_least_x_among_4_combined_bkg ? color.new(#ff0000, 65) : na, title='Main:Bkg Short Zone') // ******************************************************************************** // // *** Define F_print function To Show Infos *** // f_print(_offsetx, _offsety, _lab_styl, _bkg_color, _text, _color_text, _size) => // *** Create label *** //. var _label = label(na) label.delete(_label) _label := label.new(bar_index + _offsetx, _offsety, _text, xloc.bar_index, yloc.price, _bkg_color, _lab_styl, _color_text, _size, text.align_left) _label // ******************************************************************************** // // *** Init Texts & Colors *** // text_long_rsi = 'nul ' text_long_sto = 'nul ' text_long_ema = 'nul ' text_long_kdj = 'nul ' text_short_rsi = 'nul ' text_short_sto = 'nul ' text_short_ema = 'nul ' text_short_kdj = 'nul ' text_stop_long_rsi = 'nul ' text_stop_long_sto = 'nul ' text_stop_long_ema = 'nul ' text_stop_long_kdj = 'nul ' text_stop_short_rsi = 'nul ' text_stop_short_sto = 'nul ' text_stop_short_ema = 'nul ' text_stop_short_kdj = 'nul ' close_up_down_text = ' : ---- ' high_up_down_text = ' : ---- ' low_up_down_text = ' : ---- ' open_up_down_text = ' : ---- ' color_0 = color.new(#ffffff, 0) color_text = color.new(#ffffff, 0) bkg_color = color.new(#081156, 0) bkg_color_stop = color.new(#ffffff, 0) //0000ff // **************************** // if priceup close_up_down_text := ' : RISING ' close_up_down_text else if pricedown close_up_down_text := ' : FALLING ' close_up_down_text else close_up_down_text := ' : ??????? ' close_up_down_text // **************************** // if high_up high_up_down_text := ' : RISING ' high_up_down_text else if high_down high_up_down_text := ' : FALLING ' high_up_down_text else high_up_down_text := ' : ??????? ' high_up_down_text // **************************** // if low_up low_up_down_text := ' : RISING ' low_up_down_text else if low_down low_up_down_text := ' : FALLING ' low_up_down_text else low_up_down_text := ' : ??????? ' low_up_down_text // **************************** // if open_up open_up_down_text := ' : RISING ' open_up_down_text else if open_down open_up_down_text := ' : FALLING ' open_up_down_text else open_up_down_text := ' : ??????? ' open_up_down_text // **************************** // if rsi_signal_long text_long_rsi := 'RSI ' text_long_rsi else text_long_rsi := '000 ' text_long_rsi if sto_signal_long text_long_sto := 'STO ' text_long_sto else text_long_sto := '000 ' text_long_sto if ema_signal_long text_long_ema := 'EMA ' text_long_ema else text_long_ema := '000 ' text_long_ema if kdj_signal_long text_long_kdj := 'KDJ ' text_long_kdj else text_long_kdj := '000 ' text_long_kdj // **************************** // if rsi_signal_short text_short_rsi := 'RSI ' text_short_rsi else text_short_rsi := '000 ' text_short_rsi if sto_signal_short text_short_sto := 'STO ' text_short_sto else text_short_sto := '000 ' text_short_sto if ema_signal_short text_short_ema := 'EMA ' text_short_ema else text_short_ema := '000 ' text_short_ema if kdj_signal_short text_short_kdj := 'KDJ ' text_short_kdj else text_short_kdj := '000 ' text_short_kdj // **************************** // if rsi_signal_stop_long text_stop_long_rsi := 'RSI ' text_stop_long_rsi else text_stop_long_rsi := '000 ' text_stop_long_rsi if sto_signal_stop_long text_stop_long_sto := 'STO ' text_stop_long_sto else text_stop_long_sto := '000 ' text_stop_long_sto if ema_signal_stop_long text_stop_long_ema := 'EMA ' text_stop_long_ema else text_stop_long_ema := '000 ' text_stop_long_ema if kdj_signal_stop_long text_stop_long_kdj := 'KDJ ' text_stop_long_kdj else text_stop_long_kdj := '000 ' text_stop_long_kdj // **************************** // if rsi_signal_stop_short text_stop_short_rsi := 'RSI ' text_stop_short_rsi else text_stop_short_rsi := '000 ' text_stop_short_rsi if sto_signal_stop_short text_stop_short_sto := 'STO ' text_stop_short_sto else text_stop_short_sto := '000 ' text_stop_short_sto if ema_signal_stop_short text_stop_short_ema := 'EMA ' text_stop_short_ema else text_stop_short_ema := '000 ' text_stop_short_ema if kdj_signal_stop_short text_stop_short_kdj := 'KDJ ' text_stop_short_kdj else text_stop_short_kdj := '000 ' text_stop_short_kdj // ******************************************************************************** // if main_signal_long color_text := trend_color_long color_text else if main_signal_short color_text := trend_color_short color_text else color_text := color_0 color_text // ******************************************************************************** // main_bkg_zone_txt = 'BKG : ?' if display_combined_layouts main_bkg_zone_txt := ' ' + str.tostring(at_least_x_among_4_combined_bkg) + ' of 4' main_bkg_zone_txt else main_bkg_zone_txt := bkg_text main_bkg_zone_txt // *** Label Pour POWER Long ou Short **** // // *** Label For POWER Long or Short **** // // *** Ordre Des Parametres Pour F_Print : (_Offsetx,_Offsety,_Lab_styl,_Bkg_color,_Text,_Color_text,_Size) *** // // *** Order Of Parameters For F_Print: (_Offsetx, _Offsety, _Lab_styl, _Bkg_color, _Text, _Color_text, _Size) *** // if main_show_trend_label f_print(main_offset_lab_trend, v_center_layouts, label.style_label_right, bkg_color, trend_pow_text + str.tostring(main_power) + '/4' + '\nLONG :' + str.tostring(main_power_long) + ' SHORT :' + str.tostring(main_power_short) + '\n' + graph_text + '\nBKG -->' + main_bkg_zone_txt, trend_color_text, size.normal) // ******************************************************************************** // // *** Label Pour Signal STOP Long ou Short **** // // *** Label For Signal STOP Long or Short *** // // *** Ordre Des Parametres Pour F_Print : (_Offsetx,_Offsety,_Lab_styl,_Bkg_color,_Text,_Color_text,_Size) *** // // *** Order Of Parameters For F_Print: (_Offsetx, _Offsety, _Lab_styl, _Bkg_color, _Text, _Color_text, _Size) *** // if main_show_stops_label f_print(main_offset_lab_stop, v_center_layouts, label.style_label_right, bkg_color_stop, stop_pow_text + str.tostring(main_power_stop), color_text_stop, size.normal) // ******************************************************************************** // // *** Version Label Infos SIMPLIFIE *** // // *** Version Label Info SIMPLIFIED *** // // *** Ordre Des Parametres Pour F_Print : (_Offsetx,_Offsety,_Lab_styl,_Bkg_color,_Text,_Color_text,_Size) *** // // *** Order Of Parameters For F_Print: (_Offsetx, _Offsety, _Lab_styl, _Bkg_color, _Text, _Color_text, _Size) *** // if main_show_infos_label and not full_label_info f1 = f_print(main_offset_lab_info, v_center_layouts, label.style_label_right, bkg_color, 'LONG : ' + text_long_rsi + text_long_sto + text_long_ema + text_long_kdj + ' - SHORT : ' + text_short_rsi + text_short_sto + text_short_ema + text_short_kdj + '\nSTOP_Lg: ' + text_stop_long_rsi + text_stop_long_sto + text_stop_long_ema + text_stop_long_kdj + ' - STOP_Sh: ' + text_stop_short_rsi + text_stop_short_sto + text_stop_short_ema + text_stop_short_kdj, trend_color_text, size.normal) f1 // ******************************************************************************** // // *** Version Label Infos COMPLETE *** // // *** Version Label Info COMPLETE *** // // *** Ordre Des Parametres Pour F_Print : (_Offsetx,_Offsety,_Lab_styl,_Bkg_color,_Text,_Color_text,_Size) *** // // *** Order Of Parameters For F_Print: (_Offsetx, _Offsety, _Lab_styl, _Bkg_color, _Text, _Color_text, _Size) *** // if main_show_infos_label and full_label_info f1 = f_print(main_offset_lab_info, v_center_layouts, label.style_label_right, bkg_color, 'LONG : ' + text_long_rsi + text_long_sto + text_long_ema + text_long_kdj + ' - SHORT : ' + text_short_rsi + text_short_sto + text_short_ema + text_short_kdj + '\nSTOP_Lg: ' + text_stop_long_rsi + text_stop_long_sto + text_stop_long_ema + text_stop_long_kdj + ' - STOP_Sh: ' + text_stop_short_rsi + text_stop_short_sto + text_stop_short_ema + text_stop_short_kdj + '\nHIGH = ' + high_up_down_text + str.format('{0,number,#.########}', high) + ' - LOW = ' + low_up_down_text + str.format('{0,number,#.########}', low) + '\nOPEN = ' + open_up_down_text + str.format('{0,number,#.########}', open) + ' - CLOSE= ' + close_up_down_text + str.format('{0,number,#.########}', close), trend_color_text, size.normal) f1 // ******************************************************************************** // // ******************************************************************************** // // END // // ******************************************************************************** // //
cowen risk index
https://www.tradingview.com/script/CyyEQDhh-cowen-risk-index/
OrionAlgo
https://www.tradingview.com/u/OrionAlgo/
283
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © OrionAlgo //@version=5 indicator("cowen risk index", overlay=false, max_bars_back = 4999) maLen = input.int(400) increaseMABool = input.bool(false, "Increase MA until Length is met") factorBool = input.bool(false, "Custom Factor") factor = input.float(1.00042) var bar = 1. bar:= timeframe.period == "D" ? factorBool? bar*factor: bar*1.00042 : timeframe.period == "W" ? factorBool? bar*factor: bar*1.002 : 0 count = ta.cum(1+1==2 ? 1 : 0) ma = increaseMABool? ta.sma( close, count<maLen?math.round(count):maLen) : ta.sma(close,maLen) calc = (request.security(syminfo.tickerid, "D",(close/ma)))*bar signal = calc plot(signal,color=color.rgb(255,255,255,50)) var top = 0. if (signal>=top[1]) top := signal plot(0,color=color.rgb(0,255,0,50)) plot(top*0.1,color=color.rgb(0,255,0,60)) plot(top*0.2,color=color.rgb(0,255,0,70)) plot(top*0.3,color=color.rgb(0,255,0,80)) plot(top*0.4,color=color.rgb(0,255,0,90)) plot(top*0.5,color=color.rgb(255,255,255,90)) plot(top*0.6,color=color.rgb(255,0,0,90)) plot(top*0.7,color=color.rgb(255,0,0,80)) plot(top*0.8,color=color.rgb(255,0,0,70)) plot(top*0.9,color=color.rgb(255,0,0,60)) plot(top,color=color.rgb(255,0,0,50))
Profit Percentage Tracker
https://www.tradingview.com/script/p6NBsV48-Profit-Percentage-Tracker/
backslash-f
https://www.tradingview.com/u/backslash-f/
274
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // (C) backslash-f // // Pre-requirements: // - The chart's timezone has to be set to "Exchange" (this is required to support the alert's logic). // - https://kodify.net/tradingview/platform/exchange-time-zone/ // // This script (supports both long and short positions): // - Tracks how much profit one could take based on: // - The given "entry date" and "entry price". // - These are interactive inputs: // - https://www.tradingview.com/blog/en/pine-scripts-are-now-interactive-27147 // // - Displays the result in a label on top of the last candle. // // - Sends alerts based on the given "profit unit": // - That is: if "0.25" is given, then an alert is triggered every time the profit is raised by that number. // - For alerts to be displayed, a "script alert" must be configured beforehand: // - https://www.tradingview.com/support/solutions/43000597494-script-alerts/ // - Choose "PPT" as condition and "Any alert() function call" // // - Can add helper lines such as: // - Target percentage lines // - Entry, target, stop and liquidation lines // // - Can format the body of the alert as JSON, so you can send it to your server and automate your trading // - Inspired by "Part Time Larry": https://youtu.be/gMRee2srpe8 // // - Debug info is available and can be enabled / disabled. //@version=5 indicator("Profit Percentage Tracker", shorttitle="Profits", overlay=true, explicit_plot_zorder=true) // Input values. // POSITION targetSymbol = input.string(title="Symbol", group="POSITION", defval="BTCUSDT", tooltip="The symbol for which the indicator is being configured. This allows for switching to other symbols in the same tab without showing wrong profit data.\n\nIf you would like to add multiple profit indicators for different symbols, just insert another profit indicator that targets the new symbol.\n\nNotice: the entry must match the chart's symbol exactly. That is, for example: \"BTCUSDT\" (instead of just \"BTC\").") size = input.float(title="Size", group="POSITION", defval=0, minval=0, tooltip="The amount/quantity of the bought asset.") isLong = input(title="Long", group="POSITION", defval=true, tooltip="Indicates the side of the position. Default is \"long\".\n\nUncheck to indicate a \"short\" side.\n\nThe side is taken into consideration when calculating profit.") isKucoinSpot = input(title="Spot (Kucoin)", group="POSITION", defval=false, tooltip="Indicates the type of the position (Kucoin only). Default is unchecked (\"Futures\").\n\nCheck to indicate a \"spot\" type.\n\nThe type is taken into consideration when calling Kucoin APIs.") // PURCHASE entryDate = input.time(timestamp("2022-08-12"), title="Entry date / time", group="PURCHASE", inline="entry", confirm=true, tooltip="The date that the asset was acquired.") entryPrice = input.price(0, title="Entry price", inline="entry", group="PURCHASE", confirm=true, tooltip="The cost of the asset at the time of purchase.") shouldShowCurrencyProfit = input(title="Show currency profit", group="PURCHASE", defval=true, tooltip="When checked (default), displays the profit as currency, just below the profit percentage label.\nE.g.: \"135.79 USDT\".\n\nFor this to work, the \"size\" field must be greater than zero.\n\nDevelopment note: the currency is read from \"sysinfo.currency\".") // ALERT profitUnit = input(title="Percentage unit", defval=1.0, group="ALERT", tooltip="Every time that profit raises by this percentage unit *or more*, an alert is sent. The default is 1.5% (1.5). Remember to use dot -- 0.5, 0.75, 1.27, etc.\n\nExamples: the asset raises from 100 to 101 -- an alert is to be sent. When the same asset raises from 101 to 102 -- another alert is to be sent. So on and so forth.\n\nBe careful with low values. TradingView will stop an alert if it triggers too often.") alertPrefix = input(title="Custom alert prefix", group="ALERT", defval="", tooltip="Add a custom prefix to the first line of the alert to indicate whatever you like. E.g.: \"[FUTURES]\". (A trailing white space will be added automatically.)") // LINES shouldShowLines = input(title="Show lines", group="LINES", defval=true, tooltip="Adds a bunch of helper lines to the chart, such as target percentage lines and entry/target/stop/liquidation price lines.\n\nSome of the lines can be hidden by setting zero as their value.") shouldShowStopLimitLines = input(title="Show lines for current and next stop-limits", group="LINES", defval=false, tooltip="When checked, it displays:\n\n - A GRAY line that indicates where the NEXT stop-limit would be (based on the offset)\n\n - A YELLOW line that indicates where the CURRENT stop-limit is (based on the \"offset\" field + last alert)\n\nThe default is false. Notice that for this to work, the \"offset\" field under \"SERVER\" must be greater than zero. ") maxTargetPercentage = input.float(title="Maximum target (%)", group="LINES", defval=5, minval=0, step=1, tooltip="How much ideal/max profit is expected in percentage. The default is 8%.\n\nThe price shown in the target line is calculated based on this number.\n\nFor example: TARGET (127.58) (8%)") numberOfPercentageLines = input.int(title="Number of target lines", group="LINES", defval=4, minval=0, step=1, tooltip="Indicates how many target percentage lines should be added into the chart. The default is 3.\n\nThe lines are created based on the \"Percentage unit\".\n\nFor example: 1.5%, 3%, 4.5%, etc.") customLinePercentage = input.price(title="Custom percentage", group="LINES", defval=0.5, tooltip="Use this line to quickly check the entry price value based on the inserted percentage.\n\nFor example: CUSTOM (178.19) (0.25%).") stopPercentage = input.float(title="Stop loss (%)", group="LINES", defval=2, minval=0, step=1, tooltip="How much can you afford to lose in percentage. The default is 2%.\n\nThe price shown in the stop line is calculated based on this number.\n\nFor example: STOP (53.25) (2%).") liquidationPrice = input.price(title="Liquidation price", group="LINES", defval=0, tooltip="[FUTURES] In case the asset reaches the price indicated here, there will be a loss of 100%. The default is 0.\n\nThe price shown in the liquidation line is calculated based on this number.\n\nFor example: LIQ (22.17) (100%).") labelLeadingSpace = input.int(15, title="Label leading space", minval=0, group="LINES", tooltip="Moves the line labels to the right of the current bar by this unit.") // SERVER isWebhookPayload = input(title="JSON payload", group="SERVER", defval=false, tooltip="When checked, the alert body is formatted as JSON.\n\nThis supports a webhook-triggered trading bot scenario in which a server receives said body/payload as input.\n\nIt also displays a line (AQUA color) to represent the \"Percentage unit trigger\" (see the field below).") authorizationKey = input.string(title="Authorization key", group="SERVER", defval="", tooltip="Basic auth key.") exchangeName = input.string(title="Exchange name", group="SERVER", defval="Kucoin", tooltip="Kucoin, Binance, etc.\n\nNote: If this field is empty, the exchange name is retrieved by \"syminfo.prefix\".") profitPercentageTrigger = input(title="Percentage unit trigger", group="SERVER", defval=1.0, tooltip="\"Equals or greater than\" logic. If this value is the same as the \"Percentage unit\" (default), then every time an alert is sent, the server will act upon it. However, sometimes we want alerts (e.g. at 2%), but we only want to act when it reaches say 5% (or more). In this scenario, \"Profit Unit\" would be 2 and \"Profit Unit Trigger\" would be 5.") offset = input.string(title="Offset", group="SERVER", defval="0.5", tooltip="How far the target price of the stop order will be from the current price.\n\nFor example, suppose the profit percentage is 1.0% and the offset is 0.75%; the stop order to be placed will be 0.25% of the current price (1.0% - 0.75%).") cancelStopOrders = input(title="Cancel untriggered stop orders", group="SERVER", defval=true, tooltip="When checked, all the untriggered stop orders for the contract symbol will be cancelled before placing a new one. Default is \"true\".") // DEVELOPER shouldShowDebugInfo = input(title="Show debug info", group="DEVELOPER", defval=true, tooltip="Check this box to see the values of the main variables on the chart, below bars. This is for debugging purposes only.") // The current symbol name without exchange prefix. E.g.: "BTCUSDT". var currentSymbol = syminfo.ticker // The latest price of the symbol. currentPrice = close // The current profit, in percentage. profitCurrent = 0.0 // The value for which the last alert was sent. varip lastAlertAt = 0.0 // The value for which the next alert is to be sent. varip nextAlertAt = profitUnit // String array of metadata of the target symbol. // E.g.: [exchangeName, contractSymbol, tickerSize] metadata = array.new_string(0) // For debugging purposes: will an alert be sent? willAlert = false ////============================================================================ // This section supports server-side operations triggered by webhooks. // Ignore it if you don't plan to use this script for trading automation. ////============================================================================ // Initializes an array of String metadata of the target symbol. // // The array contains the following information: // - Exchange name (syminfo.prefix) // - Contract name (symbol contract) // - Minimum price increment (ticker size) // // Sources: // - https://futures.kucoin.com/contract/detail // Other exchanges/info are going to be added as needed. symbol_metadata() => // Exchange name. array.push(metadata, syminfo.prefix) ////======================================================================== // BINANCE ////======================================================================== if syminfo.prefix == "BINANCE" // LUNC if (targetSymbol == 'LUNCUSDT') array.push(metadata, "LUNCUSDT") array.push(metadata, "0.00000001") else array.push(metadata, "") array.push(metadata, "") ////======================================================================== // KUCOIN ////======================================================================== else if syminfo.prefix == "KUCOIN" // ADA if (targetSymbol == 'ADAUSDT') if isKucoinSpot array.push(metadata, "ADA-USDT") else array.push(metadata, "ADAUSDTM") array.push(metadata, "0.00001") // APT if (targetSymbol == 'APTUSDT') if isKucoinSpot array.push(metadata, "APT-USDT") else array.push(metadata, "APTUSDTM") array.push(metadata, "0.001") // AVAX if (targetSymbol == 'AVAXUSDT') if isKucoinSpot array.push(metadata, "AVAX-USDT") else array.push(metadata, "AVAXUSDTM") array.push(metadata, "0.01") // BTC if (targetSymbol == 'BTCUSDT') if isKucoinSpot array.push(metadata, "BTC-USDT") else array.push(metadata, "XBTUSDTM") array.push(metadata, "1") // BTC else if (targetSymbol == 'CAKEUSDT') if isKucoinSpot array.push(metadata, "CAKE-USDT") else array.push(metadata, "CAKEUSDTM") array.push(metadata, "0.01") // ETH else if (targetSymbol == 'ETHUSDT') if isKucoinSpot array.push(metadata, "ETH-USDT") else array.push(metadata, "ETHUSDTM") array.push(metadata, "0.05") // FTM else if (targetSymbol == 'FTMUSDT') if isKucoinSpot array.push(metadata, "FTM-USDT") else array.push(metadata, "FTMUSDTM") array.push(metadata, "0.0001") // GALA else if (targetSymbol == 'GALAUSDT') if isKucoinSpot array.push(metadata, "GALA-USDT") else array.push(metadata, "GALAUSDTM") array.push(metadata, "0.00001") // GAS else if (targetSymbol == 'GASUSDT') if isKucoinSpot array.push(metadata, "GAS-USDT") else array.push(metadata, "GASUSDTM") array.push(metadata, "0.01") // GMT else if (targetSymbol == 'GMTUSDT') if isKucoinSpot array.push(metadata, "GMT-USDT") else array.push(metadata, "GMTUSDTM") array.push(metadata, "0.0001") // LTC else if (targetSymbol == 'LTCUSDT') if isKucoinSpot array.push(metadata, "LTC-USDT") else array.push(metadata, "LTCUSDTM") array.push(metadata, "0.01") // LDO else if (targetSymbol == 'LDOUSDT') if isKucoinSpot array.push(metadata, "LDO-USDT") else array.push(metadata, "LDOUSDTM") array.push(metadata, "0.001") // LUNC else if (targetSymbol == 'LUNCUSDT') if isKucoinSpot array.push(metadata, "LUNC-USDT") else array.push(metadata, "LUNCUSDTM") array.push(metadata, "0.000000001") // MANA else if (targetSymbol == 'MANAUSDT') if isKucoinSpot array.push(metadata, "MANA-USDT") else array.push(metadata, "MANAUSDTM") array.push(metadata, "0.001") // NEAR else if (targetSymbol == 'NEARUSDT') if isKucoinSpot array.push(metadata, "NEAR-USDT") else array.push(metadata, "NEARUSDTM") array.push(metadata, "0.01") // PERP else if (targetSymbol == 'PERPUSDT') if isKucoinSpot array.push(metadata, "PERP-USDT") else array.push(metadata, "PERPUSDTM") array.push(metadata, "0.001") // OCEAN else if (targetSymbol == 'OCEANUSDT') if isKucoinSpot array.push(metadata, "OCEAN-USDT") else array.push(metadata, "OCEANUSDTM") array.push(metadata, "0.0001") // ONE else if (targetSymbol == 'ONEUSDT') if isKucoinSpot array.push(metadata, "ONE-USDT") else array.push(metadata, "ONEUSDTM") array.push(metadata, "0.00001") // STORJ else if (targetSymbol == 'STORJUSDT') if isKucoinSpot array.push(metadata, "STORJ-USDT") else array.push(metadata, "STORJUSDTM") array.push(metadata, "0.0001") // SOL else if (targetSymbol == 'SOLUSDT') if isKucoinSpot array.push(metadata, "SOL-USDT") else array.push(metadata, "SOLUSDTM") array.push(metadata, "0.001") // WAVES else if (targetSymbol == 'WAVESUSDT') if isKucoinSpot array.push(metadata, "WAVES-USDT") else array.push(metadata, "WAVESUSDTM") array.push(metadata, "0.001") // XMR else if (targetSymbol == 'XMRUSDT') if isKucoinSpot array.push(metadata, "XMR-USDT") else array.push(metadata, "XMRUSDTM") array.push(metadata, "0.01") else array.push(metadata, "") array.push(metadata, "") ////======================================================================== // UNKNOWN ////======================================================================== else // No available metadata for the current exchange. In this scenario, // populate the array with empty values, in order to avoid breaking up // the alert logic. (Pine would throw a "calculation error" and the // alert would be stopped -- so instead it's much better to gracefully // fail on the server side). array.push(metadata, "") array.push(metadata, "") symbol_metadata() ////============================================================================ // End of server-side support. ////============================================================================ // Consider only: // - The target symbol // - Positive entry prices // - Time *after* the purchase if (targetSymbol == currentSymbol) and (entryPrice > 0) and (time >= entryDate) // Current profit percentage logic. // Long: profit is *positive* when price goes *up* // Short: profit is *positive* when price goes *down* profitCurrent := isLong ? ((currentPrice * 100) / entryPrice) : ((entryPrice * 100) / currentPrice) profitCurrent := profitCurrent - 100 // Profit label creation. var profitLabel = label.new(na, na, color=color.white, textcolor=color.black, style=label.style_label_down, yloc=yloc.abovebar) entryPriceString = str.tostring(entryPrice, '#.########') currentPriceString = str.tostring(currentPrice, '#.########') emoji = (profitCurrent >= 0) ? "💰" : "💸" profitString = str.tostring(profitCurrent, '#.##') + "% " + emoji // Currency profit logic. currencyProfitJSON = "" // Goes into the JSON payload currentPriceJSON = "" // Goes into the JSON payload currencyProfitString = "" if shouldShowCurrencyProfit and size > 0 currencyPaidTotal = entryPrice * size currencyProfitTotal = currentPrice * size currencyProfit = isLong ? currencyProfitTotal - currencyPaidTotal : currencyPaidTotal - currencyProfitTotal currencyProfitJSON := str.tostring(currencyProfit, '#.##') + " " + syminfo.currency currentPriceJSON := currentPriceString + " " + syminfo.currency currencyProfitString := "\n↓\n" + currencyProfitJSON // Final string. profitPathString = (entryPriceString + "\n↓\n" + currentPriceString + "\n↓\n" + profitString + currencyProfitString) // Profit label update. label.set_text(profitLabel, profitPathString) label.set_x(profitLabel, bar_index) label.set_y(profitLabel, currentPrice) // Debugging label creation. var debuggingLabel = label.new(na, na, color=color.new(color.blue, transp=100), textcolor=color.white, textalign=text.align_left, style=label.style_label_up, yloc=yloc.belowbar) if shouldShowDebugInfo label.set_x(debuggingLabel, bar_index) label.set_y(debuggingLabel, currentPrice) // Alert logic. if (profitCurrent > lastAlertAt) and (((profitCurrent - lastAlertAt) > profitUnit) or ((profitCurrent > profitPercentageTrigger) and (lastAlertAt < profitPercentageTrigger))) lastAlertAt := profitCurrent // int(...) -> e.g. if thelast alert was say 2.73 and profit unit is 2, the next alert will be at 4 (not 4.73) nextAlertAt := int(lastAlertAt) + profitUnit // Alert creation. willAlert := true alertPrefixString = alertPrefix + " " profitPercentageString = str.tostring(profitCurrent, '#.##') totalProfitString = "Total profit so far: " + profitPercentageString + "% 💰" friendlyMessageString = alertPrefixString + totalProfitString if isWebhookPayload // This is where the JSON body that can be send to a server gets created. exchangeNameString = str.length(exchangeName) > 0 ? exchangeName : array.get(metadata, 0) alert("{\"profit\":\"" + currencyProfitJSON + "\", \"profitPercentage\":\"" + profitPercentageString + "\", \"profitPercentageTrigger\":\"" + str.tostring(profitPercentageTrigger) + "\", \"offset\":\"" + offset + "\", \"currentPrice\":\"" + currentPriceJSON + "\", \"entryPrice\":\"" + str.tostring(entryPrice) + "\", \"exchange\":\"" + exchangeNameString + "\", \"isLong\":\"" + str.tostring(isLong) + "\", \"size\":\"" + str.tostring(size) + "\", \"contractSymbol\":\"" + array.get(metadata, 1) + "\", \"ticker\":\"" + targetSymbol + "\", \"tickerSize\":\"" + array.get(metadata, 2) + "\", \"cancelStopOrders\":\"" + str.tostring(cancelStopOrders) + "\", \"isKucoinSpot\":\"" + str.tostring(isKucoinSpot) + "\", \"authorizationKey\":\"" + authorizationKey + "\"}", alert.freq_all) else // Friendly/simplified alert for regular users. alert(friendlyMessageString, alert.freq_all) // Lines logic. if shouldShowLines // Target line logic. if maxTargetPercentage > 0 targetPercentage = (maxTargetPercentage / 100) targetChange = (entryPrice * targetPercentage) targetPrice = isLong ? entryPrice + targetChange : entryPrice - targetChange targetLabelPercentageText = " (" + str.tostring(maxTargetPercentage, '#.##') + "%)" targetLabelText = "TARGET" + " (" + str.tostring(targetPrice, '#.########') + ")" + targetLabelPercentageText var targetLabel = label.new(x=last_bar_index + labelLeadingSpace, y=targetPrice, text=targetLabelText, textcolor=color.green, style=label.style_none) var targetLine = line.new(time, targetPrice, time_close, targetPrice, xloc=xloc.bar_time, extend=extend.both, color=color.green, width=1) // Target percentage lines logic. if numberOfPercentageLines > 0 var previousTargetPercentage = 0.0 // This seems to be required to avoid adding the same label/line multiple times. for i = 1 to numberOfPercentageLines targetPercentage = (profitUnit / 100) * i // E.g.: 0.015 if targetPercentage > previousTargetPercentage previousTargetPercentage := targetPercentage targetPrice = (entryPrice * targetPercentage) yPosition = isLong ? entryPrice + targetPrice : entryPrice - targetPrice targetPercentageLabelText = str.tostring(targetPercentage * 100, '#.##') + '%' + " (" + str.tostring(yPosition, '#.########') + ")" // E.g. "1.5% (41716.5)" label.new(x=last_bar_index + labelLeadingSpace, y=yPosition, text=targetPercentageLabelText, textcolor=color.orange, style=label.style_none) line.new(time, yPosition, time_close, yPosition, xloc=xloc.bar_time, extend=extend.both, color=color.orange, style=line.style_dashed, width=1) // Custom % line logic. if customLinePercentage != 0 customPercentage = (customLinePercentage / 100) customPercentageChange = (entryPrice * customPercentage) customPercentagePrice = isLong ? entryPrice + customPercentageChange : entryPrice - customPercentageChange customPercentageText = str.tostring(customLinePercentage, '#.##') + "%" customPercentageLabelText = customPercentageText + " (" + str.tostring(customPercentagePrice, '#.########') + ")" var customPercentageLabel = label.new(x=last_bar_index + labelLeadingSpace, y=customPercentagePrice, text=customPercentageLabelText, textcolor=color.aqua, style=label.style_none) var customPercentageLine = line.new(time, customPercentagePrice, time_close, customPercentagePrice, xloc=xloc.bar_time, extend=extend.both, color=color.aqua, width=1) // Entry line logic. var entryLabel = label.new(x=last_bar_index + labelLeadingSpace, y=entryPrice, text="ENTRY" + " (" + str.tostring(entryPrice, '#.########') + ")", textcolor=color.blue, style=label.style_none) var entryLine = line.new(time, entryPrice, time_close, entryPrice, xloc=xloc.bar_time, extend=extend.both, color=color.blue, width=1) // Stop line logic. if stopPercentage > 0 stop = (stopPercentage / 100) stopChange = (entryPrice * stop) stopPrice = isLong ? entryPrice - stopChange : entryPrice + stopChange stopLabelPercentageText = " (-" + str.tostring(stopPercentage, '#.##') + "%)" stopLabelText = "STOP" + " (" + str.tostring(stopPrice, '#.########') + ")" + stopLabelPercentageText var stopLabel = label.new(x=last_bar_index + labelLeadingSpace, y=stopPrice, text=stopLabelText, textcolor=color.red, style=label.style_none) var stopLine = line.new(time, stopPrice, time_close, stopPrice, xloc=xloc.bar_time, extend=extend.both, color=color.red, width=1) // Liquidation line logic. if liquidationPrice > 0 liquidationLabelText = "LIQ" + " (" + str.tostring(liquidationPrice, '#.########') + ")" + " (-100%)" var liquidationLabel = label.new(x=last_bar_index + labelLeadingSpace, y=liquidationPrice, text=liquidationLabelText, textcolor=color.white, style=label.style_none) var liquidationLine = line.new(time, liquidationPrice, time_close, liquidationPrice, xloc=xloc.bar_time, extend=extend.both, color=color.white, width=1) // Current stop-limit line logic. if lastAlertAt > 0 and lastAlertAt >= profitPercentageTrigger currentStopLimitPercentage = (lastAlertAt - str.tonumber(offset)) / 100 // E.g.: 0.0075 currentStopLimitPrice = (entryPrice * currentStopLimitPercentage) currentStopLimitYPosition = isLong ? entryPrice + currentStopLimitPrice : entryPrice - currentStopLimitPrice currentStopLimitPercentageLabelText = str.tostring(currentStopLimitPercentage * 100, '#.##') + '%' + " (" + str.tostring(currentStopLimitYPosition, '#.########') + ")" // E.g. "0.75% (31289.37)" // Create transparent label. var currentStopLimitLabel = label.new(x=last_bar_index + labelLeadingSpace, y=currentStopLimitYPosition, text=currentStopLimitPercentageLabelText, textcolor=color.new(color.yellow, transp=100), style=label.style_none) // Create transparent line. var currentStopLimitLine = line.new(time, currentStopLimitYPosition, time_close, currentStopLimitYPosition, xloc=xloc.bar_time, extend=extend.both, color=color.new(color.yellow, transp=100), style=line.style_dashed, width=1) if shouldShowStopLimitLines // Update/show label. label.set_text(currentStopLimitLabel, currentStopLimitPercentageLabelText) label.set_y(currentStopLimitLabel, currentStopLimitYPosition) label.set_textcolor(currentStopLimitLabel, color.new(color.yellow, transp=0)) // Update/show line. line.set_y1(currentStopLimitLine, currentStopLimitYPosition) line.set_y2(currentStopLimitLine, currentStopLimitYPosition) line.set_color(currentStopLimitLine, color.new(color.yellow, transp=0)) // Next stop-limit line logic. nextStopLimitRoot = (lastAlertAt < profitPercentageTrigger) ? profitPercentageTrigger : nextAlertAt nextStopLimitPercentage = (nextStopLimitRoot - str.tonumber(offset)) / 100 // E.g.: 0.0075 nextStopLimitPrice = (entryPrice * nextStopLimitPercentage) nextStopLimitYPosition = isLong ? entryPrice + nextStopLimitPrice : entryPrice - nextStopLimitPrice nextStopLimitPercentageLabelText = str.tostring(nextStopLimitPercentage * 100, '#.##') + '%' + " (" + str.tostring(nextStopLimitYPosition, '#.########') + ")" // E.g. "0.75% (31289.37)" // Create transparent label. var nextStopLimitLabel = label.new(x=last_bar_index + labelLeadingSpace, y=nextStopLimitYPosition, text=nextStopLimitPercentageLabelText, textcolor=color.new(color.gray, transp=100), style=label.style_none) // Create transparent line. var nextStopLimitLine = line.new(time, nextStopLimitYPosition, time_close, nextStopLimitYPosition, xloc=xloc.bar_time, extend=extend.both, color=color.new(color.gray, transp=100), style=line.style_dashed, width=1) if shouldShowStopLimitLines // Update/show label. label.set_text(nextStopLimitLabel, nextStopLimitPercentageLabelText) label.set_y(nextStopLimitLabel, nextStopLimitYPosition) label.set_textcolor(nextStopLimitLabel, color.new(color.gray, transp=0)) // Update/show line. line.set_y1(nextStopLimitLine, nextStopLimitYPosition) line.set_y2(nextStopLimitLine, nextStopLimitYPosition) line.set_color(nextStopLimitLine, color.new(color.gray, transp=0)) // Server-related-lines logic. if isWebhookPayload // Percentage-trigger line logic. percentageTriggerPercentage = (profitPercentageTrigger / 100) // E.g.: 0.015 percentageTriggerTargetPrice = (entryPrice * percentageTriggerPercentage) percentageTriggerLineYPosition = isLong ? entryPrice + percentageTriggerTargetPrice : entryPrice - percentageTriggerTargetPrice percentageTriggerLabelText = str.tostring(percentageTriggerPercentage * 100, '#.##') + '%' + " (" + str.tostring(percentageTriggerLineYPosition, '#.########') + ")" // E.g. "1.5% (41716.5)" var percentageTriggerLineLabel = label.new(x=last_bar_index + labelLeadingSpace, y=percentageTriggerLineYPosition, text=percentageTriggerLabelText, textcolor=color.lime, style=label.style_none) var percentageTriggerLine = line.new(time, percentageTriggerLineYPosition, time_close, percentageTriggerLineYPosition, xloc=xloc.bar_time, extend=extend.both, color=color.lime, style=line.style_dashed, width=1) // Debugging logic. profitUnitString = "Profit unit alert: " + str.tostring(profitUnit, '#.##') profitUnitTriggerString = "Profit unit trigger: " + str.tostring(profitPercentageTrigger, '#.##') offsetString = "Offset: " + offset lastAlertAtString = "Last alert at: " + str.tostring(lastAlertAt, '#.##') currentStopLimit = (lastAlertAt >= profitPercentageTrigger) ? (lastAlertAt - str.tonumber(offset)) : 0 currentStopLimitString = "Current stop-limit at: " + str.tostring(currentStopLimit, '#.##') nextAlertAtTriggerString = (nextAlertAt > profitPercentageTrigger) and (lastAlertAt < profitPercentageTrigger) ? " (and " + str.tostring(profitPercentageTrigger, '#.##') + ")" : "" nextAlertAtString = "Next alert at: " + str.tostring(nextAlertAt, '#.##') + nextAlertAtTriggerString nextStopLimitRoot = (lastAlertAt < profitPercentageTrigger) ? profitPercentageTrigger : nextAlertAt nextStopLimit = nextStopLimitRoot - str.tonumber(offset) nextStopLimitString = "Next stop-limit at: " + str.tostring(nextStopLimit, '#.##') willAlertString = "Will alert: " + str.tostring(willAlert) // Debugging logic - metadata. currentExchangeString = "Current exchange: " + str.upper(exchangeName) metadataExchangeString = str.length(array.get(metadata, 0)) > 0 ? array.get(metadata, 0) : "⚠️" isExchangeMatchingWarning = str.upper(exchangeName) == metadataExchangeString ? "" : " ⚠️" metadataIsKucoinSpotString = "Kucoin spot: " + str.upper(str.tostring(isKucoinSpot)) metadataExchangeFinalString = "Metadata exchange: " + (str.length(array.get(metadata, 0)) > 0 ? array.get(metadata, 0) : "⚠️") + isExchangeMatchingWarning metadataContractString = "Contract: " + (str.length(array.get(metadata, 1)) > 0 ? array.get(metadata, 1) : "⚠️") metadataTickerString = "Ticker: " + (str.length(array.get(metadata, 2)) > 0 ? array.get(metadata, 2) : "⚠️") metadataString = "\nMETADATA\n" + metadataIsKucoinSpotString + "\n" + currentExchangeString + "\n" + metadataExchangeFinalString + "\n" + metadataContractString + "\n" + metadataTickerString // Debugging logic - label. label.set_text(debuggingLabel, currentSymbol + "\n" + profitUnitString + "\n" + profitUnitTriggerString + "\n" + offsetString + "\n\n" + lastAlertAtString + "\n" + currentStopLimitString + "\n\n" + nextAlertAtString + "\n" + nextStopLimitString + "\n" + willAlertString + "\n" + metadataString) label.set_color(debuggingLabel, color=color.new(color.blue, transp=0)) willAlert := false // Adds the tracker on the chart. plot(na, color=color.new(color=color.white, transp=100))
RVC_DecisionPoints By Rishabh
https://www.tradingview.com/script/BbW29YlC-RVC-DecisionPoints-By-Rishabh/
Risshabhh
https://www.tradingview.com/u/Risshabhh/
23
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © rvc8280 //@version=4 study("RVC_DecisionPoints",shorttitle="EMA PDH/PDL", overlay = true) disp_dp = input(true, title="Display DP Lines?") disp_brn = input(true, title="Display BRN Lines?") firstbar(resolution) => ch = 0 if(resolution == 'Y') t = year(time('D')) ch := change(t) != 0 ? 1 : 0 else t = time(resolution) ch := change(t) != 0 ? 1 : 0 ch pp_res = 'D' bars_sinse = 0 bars_sinse := firstbar(pp_res) ? 0 : bars_sinse[1] + 1 phigh_d = security(syminfo.tickerid, "D", high[1], barmerge.gaps_off, barmerge.lookahead_on) plow_d = security(syminfo.tickerid, "D", low[1], barmerge.gaps_off, barmerge.lookahead_on) y_th = line.new(bar_index[min(bars_sinse, 300)], disp_dp?phigh_d :na, bar_index, disp_dp?phigh_d :na, color=color.navy, style = line.style_solid, width=1, extend = extend.none) y_tl = line.new(bar_index[min(bars_sinse, 300)], disp_dp?plow_d :na, bar_index, disp_dp?plow_d :na, color=color.navy, style = line.style_solid,width=1, extend = extend.none) line.delete(y_th[1]) line.delete(y_tl[1]) label_yh = label.new(bar_index, disp_dp?phigh_d : na, text="PDHigh", style= label.style_none) label_yl = label.new(bar_index, disp_dp?plow_d : na, text="PDLow", style= label.style_none) label.delete(label_yh[1]) label.delete(label_yl[1]) ema9 = ema(close, 8) ema20 = ema(close, 20) ema50 = ema(close, 50) ema200 = ema(close, 200) plot(ema9,title="EMA9", color = color.blue) plot(ema20,title="EMA20", color = color.green) plot(ema50,title="EMA50", color = color.red) plot(ema200,title="EMA200", color = color.aqua)