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
InsideBar3.0
https://www.tradingview.com/script/tdReTRCI-InsideBar3-0/
487551
https://www.tradingview.com/u/487551/
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/ // ยฉ AtulGoswami //@version=5 indicator("InsideBar3.0", overlay = true) var float h1=na var float l1 = na var int mindex=na var float target1 = na var float target2 = na var float target3 = na var float target4 = na insidebar()=> ( high<high[1] and low>low[1] ) //high<high[1] and low >low[1] ins=insidebar() if insidebar() // if high < high[1] and low >low[1] h1 := high[1] l1 := low[1] mindex:=bar_index[1] target1:= h1+(h1-l1) target2:=h1+2*(h1-l1) target3:=l1-(h1-l1) target4:=l1-(2*(h1-l1)) //if high <= high[1] and low >= low[1] barcolor(ins? color.yellow: close>open? color.green:color.red) hiline=line.new(mindex, h1, bar_index, h1, color=color.green, extend=extend.right, width = 2) line.delete(hiline[1]) loline=line.new(mindex, l1, bar_index, l1, color=color.red, extend=extend.right, width = 2) line.delete(loline[1]) linefill.new(hiline, loline, color=color.new(color.purple, 90)) targetline=close>h1?line.new(mindex, target1, bar_index, target1, color=color.aqua, extend=extend.right, width = 2, style=line.style_dotted):line.new(mindex, target3, bar_index, target3, color=color.aqua, extend=extend.right, width = 2, style=line.style_dotted) lable1=close>h1?label.new(mindex, target1, text="Target1", color=color.blue, textcolor = color.white, style=label.style_none):label.new(mindex, target3, text="Target1", color=color.blue, textcolor = color.white, style=label.style_none) label.delete(lable1[1]) line.delete(targetline[1]) targetline2=close>h1?line.new(mindex, target2, bar_index, target2, color=color.fuchsia, extend=extend.right, width = 2, style=line.style_dotted):line.new(mindex, target4, bar_index, target4, color=color.fuchsia, extend=extend.right, width = 2, style=line.style_dotted) line.delete(targetline2[1]) lable2=close>h1?label.new(mindex, target2, text="Target2", color=color.blue, textcolor = color.white, style=label.style_none):label.new(mindex, target4, text="Target2", color=color.blue, textcolor = color.white, style=label.style_none) label.delete(lable2[1])
Fundamental Metrics v1.2
https://www.tradingview.com/script/nAPvE3db-Fundamental-Metrics-v1-2/
thebearfib
https://www.tradingview.com/u/thebearfib/
16
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ thebearfib // //@version=5 indicator("Fundamental Metrics v1.0", shorttitle = 'Funda Bear', overlay = true) // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Time / Ticker / Source โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // res = timeframe.period s = syminfo.tickerid closeDa = request.security(s, res, close) source = close // // Day Closing range [dayOpen, dayHigh, dayLow, dayClose] = request.security(syminfo.tickerid, 'D',[open,high,low,close], lookahead = barmerge.lookahead_on) _dChg = (dayClose - dayLow) / (dayHigh - dayLow) // week Closing range [weekOpen, weekHigh, weekLow, weekClose] = request.security(syminfo.tickerid, 'W',[open,high,low,close], lookahead = barmerge.lookahead_on) _wkChg = (weekClose - weekLow) / (weekHigh - weekLow) // // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” sแด›แด€แด›s แด›แด€ส™สŸแด‡ Inputs โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // _Xxd = input(false,'โ•โ•โ•โ•โ•โ•โ• sแด›แด€แด›s แด›แด€ส™สŸแด‡ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•') showxE = input.bool(defval = true, title = "๐Ÿฆ Show Fundamentals: ") _fontSize1 = input.string("Normal","๐Ÿ—š - Font Size", options = [ "Auto", "Tiny", "Small", "Normal", "Large", "Huge"]) position3b = input.string("Bottom Right","- Table Position", options = ["Top Right", "Top Center", "Top Left", "Middle Right", "Middle Center", "Middle Left", "Bottom Right", "Bottom Center", "Bottom Left"]) // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Shares outstanding calcs โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // TSO = request.financial(s, 'TOTAL_SHARES_OUTSTANDING', 'FQ', ignore_invalid_symbol=true) MCap = TSO MCapCalc = MCap // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Float Calcs โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // FSO = request.financial(s, 'FLOAT_SHARES_OUTSTANDING', 'FY', ignore_invalid_symbol=true) FFMCap = FSO * closeDa floatPer = FFMCap/MCapCalc*100 _sN = syminfo.ticker _fso = request.financial(syminfo.tickerid, "FLOAT_SHARES_OUTSTANDING", "FY") institutionData = request.security(syminfo.tickerid, 'D', close) totalSharesOutstanding = _fso // Replace with the actual total shares outstanding for your symbol institutionPercent = ((institutionData / totalSharesOutstanding) * institutionData) arp = 100 * (ta.sma(high / low, 21) - 1) adrp = request.security(syminfo.tickerid, 'D', arp) MCapz = _fso*closeDa MCapCalcz = MCapz uMz = '' if(MCapz >= 1000 and MCapz < 1000000) MCapz := MCapz/1000 uMz := 'K' if(MCapz >= 1000000 and MCapz < 1000000000) MCapz := MCapz/1000000 uMz := 'M' if(MCapz >= 1000000000) MCapz := MCapz/1000000000 uMz := 'B' //Long term debt excl. lease liabilities FQ, FY LONG_TERM_DEBT_EXCL_CAPITAL_LEASE _LTD = request.financial(syminfo.tickerid, "LONG_TERM_DEBT_EXCL_CAPITAL_LEASE", "FQ") MCapz0 = _LTD MCapCalcz0 = MCapz0 uMz0 = '' if(MCapz0 >= 1000 and MCapz0 < 1000000) MCapz0 := MCapz0/1000 uMz0 := 'K' if(MCapz0 >= 1000000 and MCapz0 < 1000000000) MCapz0 := MCapz0/1000000 uMz0 := 'M' if(MCapz0 >= 1000000000) MCapz0 := MCapz0/1000000000 uMz0 := 'B' // Total assets FQ, FY TOTAL_ASSETS _TR = request.financial(syminfo.tickerid, "TOTAL_REVENUE", "FQ") MCapz1 = _TR MCapCalcz1 = MCapz1 uMz1 = '' if(MCapz1 >= 1000 and MCapz1 < 1000000) MCapz1 := MCapz1/1000 uMz1 := 'K' if(MCapz1 >= 1000000 and MCapz1 < 1000000000) MCapz1 := MCapz1/1000000 uMz1 := 'M' if(MCapz1 >= 1000000000) MCapz1 := MCapz1/1000000000 uMz1 := 'B' // Total equity FQ, FY TOTAL_EQUITY _TE = request.financial(syminfo.tickerid, "TOTAL_EQUITY", "FY")// MCapz2 = _TE MCapCalcz2 = MCapz2 uMz2 = '' if(MCapz2 >= 1000 and MCapz2 < 1000000) MCapz2 := MCapz2/1000 uMz2 := 'K' if(MCapz2 >= 1000000 and MCapz2 < 1000000000) MCapz2 := MCapz2/1000000 uMz2 := 'M' if(MCapz2 >= 1000000000) MCapz2 := MCapz2/1000000000 uMz2 := 'B' // Cash & equivalents FQ, FY CASH_N_EQUIVALENTS _CNE = request.financial(syminfo.tickerid, "CASH_N_EQUIVALENTS", "FY") MCapz3 = _CNE MCapCalcz3 = MCapz3 uMz3 = '' if(MCapz3 >= 1000 and MCapz3 < 1000000) MCapz3 := MCapz3/1000 uMz3 := 'K' if(MCapz3 >= 1000000 and MCapz3 < 1000000000) MCapz3 := MCapz3/1000000 uMz3 := 'M' if(MCapz3 >= 1000000000) MCapz3 := MCapz3/1000000000 uMz3 := 'B' // Revenue estimates FQ, FY SALES_ESTIMATES _RE = request.financial(syminfo.tickerid, "SALES_ESTIMATES", "FY") MCapz4 = _RE MCapCalcz4 = MCapz4 uMz4 = '' if(MCapz4 >= 1000 and MCapz4 < 1000000) MCapz4 := MCapz4/1000 uMz4 := 'K' if(MCapz4 >= 1000000 and MCapz4 < 1000000000) MCapz4 := MCapz4/1000000 uMz4 := 'M' if(MCapz4 >= 1000000000) MCapz4 := MCapz4/1000000000 uMz4 := 'B' // Free cash flow FQ, FY, TTM FREE_CASH_FLOW _FCF = request.financial(syminfo.tickerid, "FREE_CASH_FLOW", "FY") MCapz5 = _FCF MCapCalcz5 = MCapz5 uMz5 = '' if(MCapz5 >= 1000 and MCapz5 < 1000000) MCapz5 := MCapz5/1000 uMz5 := 'K' if(MCapz5 >= 1000000 and MCapz5 < 1000000000) MCapz5 := MCapz5/1000000 uMz5 := 'M' if(MCapz5 >= 1000000000) MCapz5 := MCapz5/1000000000 uMz5 := 'B' // EBITDA FQ, FY, TTM EBITDA _EB = request.financial(syminfo.tickerid, "EBITDA", "FY") MCapz6 = _EB MCapCalcz6 = MCapz6 uMz6 = '' if(MCapz6 >= 1000 and MCapz6 < 1000000) MCapz6 := MCapz6/1000 uMz6 := 'K' if(MCapz6 >= 1000000 and MCapz6 < 1000000000) MCapz6 := MCapz6/1000000 uMz6 := 'M' if(MCapz6 >= 1000000000) MCapz6 := MCapz6/1000000000 uMz6 := 'B' // MarketCa // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Table Layouts โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // _fontSize = switch _fontSize1 "Normal" => size.normal "Auto" => size.auto "Tiny" => size.tiny "Small" => size.small "Large" => size.large "Huge" => size.huge tableposGo2 = switch position3b "Top Right" => position.top_right "Top Center" => position.top_center "Top Left" => position.top_left "Middle Right" => position.middle_right "Middle Center" => position.middle_center "Middle Left" => position.middle_left "Bottom Right" => position.bottom_right "Bottom Center" => position.bottom_center "Bottom Left" => position.bottom_left if barstate.islast or barstate.islastconfirmedhistory var table tab = table.new(tableposGo2, 99, 99, bgcolor = color.rgb(255, 255, 255, 100), frame_color=color.rgb(255, 255, 255, 100), frame_width = 1, border_color =color.rgb(255, 255, 255, 100), border_width = 1) if showxE table.cell(tab, 1, 24, "สŸแดษดษขแด›แด‡ส€แด แด…แด‡ส™แด› \nแด‡x-แด„แด€แด˜ษชแด›แด€สŸ สŸแด‡แด€sแด‡ ~ า“วซ: ",text_halign = text.align_left, text_color = color.white, text_size = _fontSize) table.cell(tab, 2, 24, str.tostring(math.round(MCapz0,2),'0.000')+uMz0, text_color = color.rgb(255, 0, 0), bgcolor = color.rgb(24, 24, 24,100),text_halign = text.align_right,text_size = _fontSize) table.cell(tab, 1, 25, "แด›แดแด›แด€สŸ ส€แด‡แด แด‡ษดแดœแด‡ ~ า“วซ: ",text_halign = text.align_left, text_color = color.white,text_size = _fontSize) table.cell(tab, 2, 25, str.tostring(math.round(MCapz1,2),'0.000')+uMz1, text_color = color.rgb(9, 255, 0), bgcolor = color.rgb(24, 24, 24,100),text_halign = text.align_right,text_size = _fontSize) table.cell(tab, 1, 26, "แด›แดแด›แด€สŸ แด‡วซแดœษชแด›ส ~ า“ส: ",text_halign = text.align_left, text_color = color.white,text_size = _fontSize) table.cell(tab, 2, 26, str.tostring(math.round(MCapz2,2),'00.000')+uMz2, text_color = color.rgb(9, 255, 0), bgcolor = color.rgb(24, 24, 24,100),text_halign = text.align_right,text_size = _fontSize) table.cell(tab, 1, 27, "แด„แด€sสœ & แด‡วซแดœษชแด แด€สŸแด‡ษดแด›s ~ า“ส: ",text_halign = text.align_left, text_color = color.white,text_size = _fontSize) table.cell(tab, 2, 27, str.tostring(math.round(MCapz3,2),'0.000')+uMz3, text_color = color.rgb(9, 255, 0), bgcolor = color.rgb(24, 24, 24,100),text_halign = text.align_right,text_size = _fontSize) table.cell(tab, 1, 28, "ส€แด‡แด แด‡ษดแดœแด‡ แด‡sแด›ษชแดแด€แด›แด‡s ~ า“ส: ",text_halign = text.align_left, text_color = color.white,text_size = _fontSize) table.cell(tab, 2, 28, str.tostring(math.round(MCapz4,2),'00.000')+uMz4, text_color = color.rgb(9, 255, 0), bgcolor = color.rgb(24, 24, 24,100),text_halign = text.align_right,text_size = _fontSize) table.cell(tab, 1, 29, "า“ส€แด‡แด‡ แด„แด€sสœ า“สŸแดแดกs ~ า“ส: ",text_halign = text.align_left, text_color = color.white,text_size = _fontSize) table.cell(tab, 2, 29, str.tostring(math.round(MCapz5,2),'0.000')+uMz5, text_color = color.rgb(9, 255, 0), bgcolor = color.rgb(24, 24, 24,100),text_halign = text.align_right,text_size = _fontSize) table.cell(tab, 1, 30, "แด‡ส™ษชแด›แด…แด€ ~ า“ส: ",text_halign = text.align_left, text_color = color.white,text_size = _fontSize) table.cell(tab, 2, 30, str.tostring(math.round(MCapz6,3),'0.000')+uMz6, text_color = color.rgb(255, 145, 0), bgcolor = color.rgb(24, 24, 24,100),text_halign = text.align_right,text_size = _fontSize) table.cell(tab, 1, 31, "แดแด€ส€แด‹แด‡แด›แด„แด€แด˜: ",text_halign = text.align_left, text_color = color.white,text_size = _fontSize) table.cell(tab, 2, 31, str.tostring(math.round(MCapz,2),'00.000')+uMz, text_color = color.rgb(255, 145, 0), bgcolor = color.rgb(24, 24, 24,100),text_halign = text.align_right,text_size = _fontSize)
Earnings Levels
https://www.tradingview.com/script/BhRhVdV3-Earnings-Levels/
timwest
https://www.tradingview.com/u/timwest/
164
study
5
MPL-2.0
/// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ Vollchaot and Tim West //@version=5 //This script essentially handles 4 plots, that paint the KELs: //There is a counter that counts from 1 to 4 (for the 1st, 2nd, 3rd, 4th earnings report of the year) -> Each one has its own plot. //That particular plot gets invisible at least shortly before it's next value/earnings report. //In this way the script doesn't need to draw any "line.new"-items, which can only be drawn up to a limited number on the chart... //In the daily it draws the normal KELs (and marks the high and the low prices used by green points). //If weekly timeframe, it uses the midpoint of the weekly bar as a level -> that seems to be a not too bad approximation for the levels //In all other timeframes it makes the plots of the KELs invisible to not annoy on the chart... indicator('Earnings', '', overlay=true) ELines = input(title='Earnings Lines', defval=true) extend = input(title='Extend last 4 Lines', defval=true) numbers = input(title='Revenue and EPS YoY change on chart', defval=true) //earnings = security("ESD:" + syminfo.prefix + "_" + syminfo.ticker + "_EARNINGS", "1D", close[1], lookahead = barmerge.lookahead_on) earnings = syminfo.type == 'stock' or syminfo.type == 'dr' ? request.security('ESD:' + syminfo.prefix + ';' + syminfo.ticker + ';EARNINGS', 'D', close[1], gaps=barmerge.gaps_on, lookahead=barmerge.lookahead_on) : na //0, 1 und 2 Tage nach Earnings Date: // when Elines == false -> sind immer false (um Rechenpower zu sparen) earningsDate = not ELines ? false : ta.barssince(not na(earnings)) == 0 //earnings[2] != earnings[3] //earnings date war vorgestern preCalculations = not ELines ? false : ta.barssince(not na(earnings)) == 1 //earnings[1] != earnings[2] //earnings date war gestern -> linie auf na setzen calculationDate = not ELines ? false : ta.barssince(not na(earnings)) == 2 //earnings[2] != earnings[3] //earnings date war vorgestern Day3 = not ELines ? false : ta.barssince(not na(earnings)) == 3 //earnings date war vor 3 T Day4 = not ELines ? false : ta.barssince(not na(earnings)) == 4 //earnings date war vor 4 T Day5 = not ELines ? false : ta.barssince(not na(earnings)) == 5 //earnings date war vor 5 T Day6 = not ELines ? false : ta.barssince(not na(earnings)) == 6 //earnings date war vor 6 T //Inputs months = input.int(title='Earnings Line Months', defval=9, minval=0, maxval=12) //Variable Definitions linecol = color.new(color.green, 30) mid1 = 0.0 //Midprice Line 1 mid2 = 0.0 //Midprice Line 2 mid3 = 0.0 //Midprice Line 3 mid4 = 0.0 //Midprice Line 4 Nr = 1 //Nr of the current earnings bar (with 4 per year -> Nr from 1 to 4) ind1 = bar_index //for the length of the line ind2 = bar_index //for the length of the line ind3 = bar_index //for the length of the line ind4 = bar_index //for the length of the line //an earningsDate: Increase Nr (or break to 1 if >4). Else take yesterdays Nr. Nr := earningsDate ? Nr[1] + 1 > 4 ? 1 : Nr[1] + 1 : nz(Nr[1], 1) //Low and High for earnings date // only calculate them at calculations Date (to make script faster) L = not calculationDate ? 0 : math.min(low[1], math.min(low[2], math.min(low[3], close[4]))) H = not calculationDate ? 0 : math.max(high[1], math.max(high[2], math.max(high[3], close[4]))) Hbar = not calculationDate ? 0 : H == high[3] ? bar_index[3] : H == high[2] ? bar_index[2] : bar_index[1] Lbar = not calculationDate ? 0 : L == low[3] ? bar_index[3] : L == low[2] ? bar_index[2] : bar_index[1] //Define Midprice: If CalculationsDate of that line nr -> new Midprice-Line. Else: take yesterdays midprice Mid = (H + L) / 2 mid1 := calculationDate and Nr == 1 ? Mid : nz(mid1[1], 0) mid2 := calculationDate and Nr == 2 ? Mid : nz(mid2[1], 0) mid3 := calculationDate and Nr == 3 ? Mid : nz(mid3[1], 0) mid4 := calculationDate and Nr == 4 ? Mid : nz(mid4[1], 0) ind1 := calculationDate and Nr == 1 ? bar_index : ind1[1] //If CalculationsDate of Line Nr 1 -> set ind1 to current bar index ind2 := calculationDate and Nr == 2 ? bar_index : ind2[1] //If CalculationsDate of Line Nr 2 -> set ind2 to current bar index ind3 := calculationDate and Nr == 3 ? bar_index : ind3[1] //If CalculationsDate of Line Nr 3 -> set ind3 to current bar index ind4 := calculationDate and Nr == 4 ? bar_index : ind4[1] //If CalculationsDate of Line Nr 4 -> set ind4 to current bar index //Don't plot that line when not daily timeframe or preCalcDate or line already longer than months (with 22 days per trading Month) StopPlot1d = timeframe.period != 'D' or preCalculations and Nr == 1 or bar_index - ind1 > 22 * months StopPlot2d = timeframe.period != 'D' or preCalculations and Nr == 2 or bar_index - ind2 > 22 * months StopPlot3d = timeframe.period != 'D' or preCalculations and Nr == 3 or bar_index - ind3 > 22 * months StopPlot4d = timeframe.period != 'D' or preCalculations and Nr == 4 or bar_index - ind4 > 22 * months StopPlot1w = timeframe.period != 'W' or earningsDate and Nr == 1 // or ((bar_index - ind1) > 4*months) StopPlot2w = timeframe.period != 'W' or earningsDate and Nr == 2 // or ((bar_index - ind2) > 4*(months)) StopPlot3w = timeframe.period != 'W' or earningsDate and Nr == 3 // or ((bar_index - ind3) > 4*(months)) StopPlot4w = timeframe.period != 'W' or earningsDate and Nr == 4 // or ((bar_index - ind4) > 4*(months)) //Including triangles: //To draw a triangle at the earnings, one just needs to check, if it's daily timeframe and then: //Compare if low[1] == L or low[2] == L or low[3] == L -> then get the bar_index of that older bar. -> price and bar for highest triangle point //Same for high[1] == H or...and so on -> price and bar for lowest triangle point //current bar and Mid is bar and price for 3rd triangle point. if timeframe.isweekly //Overwriting position for weekly -> just using 50% of the earnings weeks true range MidW = (math.max(close[3], high[2]) + math.min(close[3], low[2])) / 2 //for weekly TF mid1 := preCalculations and Nr == 1 ? MidW : nz(mid1[1], 0) mid2 := preCalculations and Nr == 2 ? MidW : nz(mid2[1], 0) mid3 := preCalculations and Nr == 3 ? MidW : nz(mid3[1], 0) mid4 := preCalculations and Nr == 4 ? MidW : nz(mid4[1], 0) mid4 //plot them plot(StopPlot1d and StopPlot1w or not ELines or mid1 == 0 ? na : mid1, color=linecol, style=plot.style_linebr, linewidth=2) plot(StopPlot2d and StopPlot2w or not ELines or mid2 == 0 ? na : mid2, color=linecol, style=plot.style_linebr, linewidth=2) plot(StopPlot3d and StopPlot3w or not ELines or mid3 == 0 ? na : mid3, color=linecol, style=plot.style_linebr, linewidth=2) plot(StopPlot4d and StopPlot4w or not ELines or mid4 == 0 ? na : mid4, color=linecol, style=plot.style_linebr, linewidth=2) // check it we are within the last year drawlines = extend ? time > timenow - 1000 * 60 * 60 * 24 * 30 * 12 : false if drawlines and mid1 != mid1[1] line.new(x1=time, y1=mid1, x2=time + int(1000 * 60 * 60 * 24 * 30 * months), y2=mid1, color=linecol, xloc=xloc.bar_time, width=2) if drawlines and mid2 != mid2[1] line.new(x1=time, y1=mid2, x2=time + int(1000 * 60 * 60 * 24 * 30 * months), y2=mid2, color=linecol, xloc=xloc.bar_time, width=2) if drawlines and mid3 != mid3[1] line.new(x1=time, y1=mid3, x2=time + int(1000 * 60 * 60 * 24 * 30 * months), y2=mid3, color=linecol, xloc=xloc.bar_time, width=2) if drawlines and mid4 != mid4[1] line.new(x1=time, y1=mid4, x2=time + int(1000 * 60 * 60 * 24 * 30 * months), y2=mid4, color=linecol, xloc=xloc.bar_time, width=2) TrU = not ELines or timeframe.period != 'D' ? na : calculationDate ? L : Day3 ? (5 * L[1] + H[1]) / 6 : Day4 ? (4 * L[2] + 2 * H[2]) / 6 : Day5 ? (3 * L[3] + 3 * H[3]) / 6 : na TrL = not ELines or timeframe.period != 'D' ? na : calculationDate ? H : Day3 ? (5 * H[1] + L[1]) / 6 : Day4 ? (4 * H[2] + 2 * L[2]) / 6 : Day5 ? (3 * L[3] + 3 * H[3]) / 6 : na p1 = plot(TrU, style=plot.style_linebr, offset=-1, color=linecol, linewidth=3) p2 = plot(TrL, style=plot.style_linebr, offset=-1, color=linecol, linewidth=3) fill(p1, p2, color=color.new(linecol, 40)) // --------------- EPS number ----------------- // - Ideas - : Option to choose between basic EPS("EARNINGS_PER_SHARE_BASIC","EARNINGS_PER_SHARE_BASIC_ONE_YEAR_GROWTH") // diluted EPS ("EARNINGS_PER_SHARE", "EARNINGS_PER_SHARE_DILUTED_ONE_YEAR_GROWTH") // Difference to estimates ("EARNINGS_ESTIMATE") //eps_style = input(title="EPS number in", defval="YoY percent", options=["absolute","YoY percent"]) eps = request.financial(syminfo.tickerid, 'EARNINGS_PER_SHARE', 'TTM', ignore_invalid_symbol=true) epsg = request.financial(syminfo.tickerid, 'EARNINGS_PER_SHARE_DILUTED_ONE_YEAR_GROWTH', 'FQ', barmerge.gaps_off, ignore_invalid_symbol=true) revg = request.financial(syminfo.tickerid, 'REVENUE_ONE_YEAR_GROWTH', 'FQ', barmerge.gaps_off, ignore_invalid_symbol=true) shares = request.financial(syminfo.tickerid, 'TOTAL_SHARES_OUTSTANDING', 'FQ', barmerge.gaps_off, ignore_invalid_symbol=true)
Volume Profile Segment Difference ยซNoaTraderยป
https://www.tradingview.com/script/1ihqKwsP-Volume-Profile-Segment-Difference-NoaTrader/
NoaTrader
https://www.tradingview.com/u/NoaTrader/
83
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ NoaTrader //@version=5 indicator("Volume Profile Segment Difference ยซNoaTraderยป","VPSD",overlay = true,format = format.volume,max_lines_count = 500) var seg = input.float(1000,"Each Volume Profile's Range",tooltip = "For example 1000$ for BTCUSD, 50$ for XAUUSD, 0.01$ for EURUSD...",group = "Calculation") src = input.source(hlcc4,"Candle's calculation source",group = "Calculation") var start_time_input = input.time(timestamp("1990-01-01"),"Start of the segment",confirm = true) var end_time_input = input.time(timestamp("1990-01-01"),"End of the segment",confirm = true) var shape_width = input.int(200,"Width",tooltip = "Volume Profile Max Width on the chart",group = "Display") var plot_offset = input.int(300,"Offset",tooltip = "Distance of the plot from the last candle on the chart",group = "Display") var line_width = input.int(7,"Each Volume Profile line's Width",group = "Display") var min_color = input.color(color.yellow,"Minimum volume's color",group = "Display") var max_color = input.color(color.red,"Maximum volume's color",group = "Display") var selected_color = input.color(color.blue,"Selected segment's color",group = "Display") var selected_transp = input.int(90,"Selected segment transparency",group = "Display") var all = map.new<int,float>() var selected = map.new<int,float>() var selection_box = box.new(left= bar_index,top=high,right=bar_index+100,bottom=low,bgcolor = color.red) key = int(src/seg) the_vol = volume prev_vol = all.contains(key) ? all.get(key) : 0 all.put(key,the_vol + prev_vol) var box_max = high var box_min = low if time >= start_time_input and not (time[1] >= start_time_input) selection_box.set_left(bar_index) selection_box.set_right(bar_index) box_max := high box_min := low if not (time <= end_time_input) and time[1] <= end_time_input selection_box.set_right(bar_index) selection_box.set_top(box_max) selection_box.set_bottom(box_min) selection_box.set_bgcolor(color.new(selected_color,selected_transp)) if time >= start_time_input and time <= end_time_input if high > box_max box_max := high if low < box_min box_min := low selected_prev_vol = selected.contains(key) ? selected.get(key) : 0 selected.put(key,the_vol + selected_prev_vol) if bar_index == last_bar_index max_vol = array.max(all.values()) min_vol = array.min(all.values()) keys = all.keys() for i = 0 to keys.size() - 1 k = array.get(keys,i) v = all.get(k) if v != 0 v_len = int((v / max_vol) * shape_width) if selected.contains(k) s_v = selected.get(k) s_v_len = int((s_v/max_vol) * shape_width) line.new(x1=bar_index+plot_offset-s_v_len,y1=k*seg,x2=bar_index+plot_offset,y2=k*seg,color = selected_color,width=line_width) line.new(x1=bar_index+plot_offset-v_len,y1=k*seg,x2=bar_index+plot_offset-s_v_len,y2=k*seg,color = color.from_gradient(v,min_vol,max_vol,min_color,max_color),width=line_width) else line.new(x1=bar_index+plot_offset-v_len,y1=k*seg,x2=bar_index+plot_offset,y2=k*seg,color = color.from_gradient(v,min_vol,max_vol,min_color,max_color),width=line_width)
Number of Bars CheatSheet
https://www.tradingview.com/script/VrQKZe1E-Number-of-Bars-CheatSheet/
thebearfib
https://www.tradingview.com/u/thebearfib/
14
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ thebearfib //@version=5 indicator("Number of Bars CheatSheet", overlay = true) showxE = input.bool(defval = true, title = "๐Ÿฆ Show Bars CheatSheet: ") _fontSize1 = input.string("Normal","๐Ÿ—š - Font Size", options = [ "Auto", "Tiny", "Small", "Normal", "Large", "Huge"]) position3b = input.string("Top Right","- Table Position", options = ["Top Right", "Top Center", "Top Left", "Middle Right", "Middle Center", "Middle Left", "Bottom Right", "Bottom Center", "Bottom Left"]) // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Table Layouts โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // _fontSize = switch _fontSize1 "Normal" => size.normal "Auto" => size.auto "Tiny" => size.tiny "Small" => size.small "Large" => size.large "Huge" => size.huge tableposGo2 = switch position3b "Top Right" => position.top_right "Top Center" => position.top_center "Top Left" => position.top_left "Middle Right" => position.middle_right "Middle Center" => position.middle_center "Middle Left" => position.middle_left "Bottom Right" => position.bottom_right "Bottom Center" => position.bottom_center "Bottom Left" => position.bottom_left if barstate.islast or barstate.islastconfirmedhistory var table tab = table.new(tableposGo2, 99, 99, bgcolor = color.rgb(255, 255, 255, 100), frame_color=color.rgb(255, 255, 255, 100), frame_width = 1, border_color =color.rgb(255, 255, 255, 100), border_width = 1) if showxE table.cell(tab, 1, 1, "Chart \nTime ", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 1, "No. Bars \nin RTH", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 2, "1min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 2, "390", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 3, "2min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 3, "195", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 4, "3min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 4, "130", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 5, "5min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 5, "78", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 6, "7min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 6, "56", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 7, "10min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 7, "39", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 8, "15min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 8, "26", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 9, "30min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 9, "13", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 10, "45min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 10, "9", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 11, "65min ", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 11, "6", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 12, "1hr", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 12, "7", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 13, "2hr", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 13, "4", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 14, "4hr", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 14, "2", text_color = color.white,text_halign = text.align_left, text_size = _fontSize) table.cell(tab, 1, 15, "195min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize) table.cell(tab, 2, 15, "2", text_color = color.white,text_halign = text.align_left, text_size = _fontSize)
Kviateq - Session Opening Ranges
https://www.tradingview.com/script/N0Tiyd9a-Kviateq-Session-Opening-Ranges/
hundredtoamillion
https://www.tradingview.com/u/hundredtoamillion/
18
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ hundredtoamillion //@version=5 indicator("Kviateq - Session Opening Ranges", overlay= true) ref_res = "" tmzn = input(defval="GMT+7", title = "Timezone") bool showSydney = input.bool(true, "Show Sydney Opening Range?", group = "Opening Ranges ON/OFF") bool showTokyo = input.bool(true, "Show Tokyo Opening Range?", group = "Opening Ranges ON/OFF") bool showLondon = input.bool(true, "Show London Opening Range?", group = "Opening Ranges ON/OFF") bool showNewYork = input.bool(true, "Show New York Opening Range?", group = "Opening Ranges ON/OFF") sydney = input.session(defval = "0600-1300", title = "Sydney Session", group = "Session Times") tokyo = input.session(defval = "0700-1600", title = "Tokyo Session", group = "Session Times") london = input.session(defval = "1500-2340", title = "London Session", group = "Session Times") newyork = input.session(defval = "2030-0400", title = "New York Session", group = "Session Times") lor = input(20, title = "Opening Range Length in Minutes") ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SY = time(ref_res, sydney, tmzn) TK = time(ref_res, tokyo, tmzn) LD = time(ref_res, london, tmzn) NY = time(ref_res, newyork, tmzn) open_bar(t) => na(t[1]) and not na(t) or t[1] < t ? 1 : 0 ld_switch = ta.change(open_bar(LD)) > 0 ny_switch = ta.change(open_bar(NY)) > 0 tk_switch = ta.change(open_bar(TK)) > 0 sy_switch = ta.change(open_bar(SY)) > 0 get_ohlc(s) => // Assign persisting variables var float _open = na var float _high = na var float _low = na var float _close = na // Update variables if new bar _open := s ? open : nz(_open[1], open) _high := s or high > _high[1] ? high : nz(_high[1], high) _low := s or low < _low[1] ? low : nz(_low[1], low) _close := close // Return variables as a tuple [_open, _high, _low, _close] // Update the current session ohlc values [sy_o, sy_h, sy_l, sy_c] = get_ohlc(sy_switch) [tk_o, tk_h, tk_l, tk_c] = get_ohlc(tk_switch) [ld_o, ld_h, ld_l, ld_c] = get_ohlc(ld_switch) [ny_o, ny_h, ny_l, ny_c] = get_ohlc(ny_switch) get_minutes() => m = timeframe.isseconds ? timeframe.multiplier / 60 : timeframe.isintraday ? timeframe.multiplier : timeframe.isdaily ? timeframe.multiplier * 1440 : timeframe.isweekly ? timeframe.multiplier * 10080 : timeframe.ismonthly ? timeframe.multiplier * 42800 : na t = lor / get_minutes() var float ld_open_high = na var float ld_open_low = na var float ny_open_high = na var float ny_open_low = na var float tk_open_high = na var float tk_open_low = na var float sy_open_high = na var float sy_open_low = na if (ta.barssince(ta.change(open_bar(LD)) > 0) < t) ld_open_high := ld_h ld_open_low := ld_l if (ta.barssince(ta.change(open_bar(NY)) > 0) < t) ny_open_high := ny_h ny_open_low := ny_l if (ta.barssince(ta.change(open_bar(TK)) > 0) < t) tk_open_high := tk_h tk_open_low := tk_l if (ta.barssince(ta.change(open_bar(SY)) > 0) < t) sy_open_high := sy_h sy_open_low := sy_l // plorh = plot(showLondon and LD ? ld_open_high : na, color = color.new(color.blue,0), style = plot.style_circles, title = "London Opening Range High") plorl = plot(showLondon and LD ? ld_open_low :na, color = color.new(color.blue,0), style = plot.style_circles, title = "London Opening Range Low") fill(plorh, plorl, color = color.new(color.blue,55), title = "London Opening Range Fill") pnorh = plot(showNewYork and NY ? ny_open_high : na, color = color.new(color.red, 0), style = plot.style_circles, title = "New York Opening Range High") pnorl = plot(showNewYork and NY ? ny_open_low :na, color = color.new(color.red,0) , style = plot.style_circles, title = "New York Opening Range Low") fill(pnorh, pnorl, color = color.new(color.red,65), title = "New York Opening Range Fill") ptorh = plot(showTokyo and TK ? tk_open_high : na, color = color.new(color.yellow, 0), style = plot.style_circles, title = "Tokyo Opening Range High") ptorl = plot(showTokyo and TK ? tk_open_low :na, color = color.new(color.yellow, 0), style = plot.style_circles, title = "Tokyo Opening Range Low") fill(ptorh, ptorl, color = color.new(color.yellow,80), title = "Tokyo Opening Range Fill") psorh = plot(showSydney and SY ? sy_open_high : na, color = color.new(#8e8e8e, 0), style = plot.style_circles, title = "Tokyo Opening Range High") psorl = plot(showSydney and SY ? sy_open_low : na, color = color.new(#8e8e8e, 0), style = plot.style_circles, title = "Tokyo Opening Range High") fill(psorh, psorl, color = color.new(#8e8e8e,80), title = "Tokyo Opening Range Fill")
Bitcoin Aggregated Volume Profile ยซNoaTraderยป
https://www.tradingview.com/script/1wEqp8Qm-Bitcoin-Aggregated-Volume-Profile-NoaTrader/
NoaTrader
https://www.tradingview.com/u/NoaTrader/
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/ // ยฉ NoaTrader //@version=5 indicator("Bitcoin Aggregated Volume Profile ยซNoaTraderยป","BTC agg vp",overlay = true,format = format.volume,max_lines_count = 500) var seg = input.float(1000,"Each Volume Profile's Range",tooltip = "For example 1000$ for BTCUSD, 50$ for XAUUSD, 0.01$ for EURUSD...",group = "Calculation") src = input.source(hlcc4,"Candle's calculation source",group = "Calculation") var shape_width = input.int(200,"Width",tooltip = "Volume Profile Max Width on the chart",group = "Display") var plot_offset = input.int(300,"Offset",tooltip = "Distance of the plot from the last candle on the chart",group = "Display") var line_width = input.int(7,"Each Volume Profile line's Width",group = "Display") var min_color = input.color(color.yellow,"Minimum volume's color",group = "Display") var max_color = input.color(color.red,"Maximum volume's color",group = "Display") var use_agg = true//input.bool(true,"Use Aggregated Volume") var compare_bool = input.bool(false,"Compare This symbol's Volume to the Aggregated") var compare_color = input.color(color.purple,"Compare's color") var all = map.new<int,float>() var cur = map.new<int,float>() key = int(src/seg) // agg vol binance_btcusdt = nz(request.security("BINANCE:BTCUSDT","",volume)) binance_btctusd = nz(request.security("BINANCE:BTCTUSD","",volume)) binance_btcbusd = nz(request.security("BINANCE:BTCBUSD","",volume)) binance_btcfdusd = nz(request.security("BINANCE:BTCFDUSD","",volume)) binance_btcdai = nz(request.security("BINANCE:BTCDAI","",volume)) binance_btceur = nz(request.security("BINANCE:BTCEUR","",volume)) bitstamp_btcusdt = nz(request.security("BITSTAMP:BTCUSDT","",volume)) bitstamp_btcusd = nz(request.security("BITSTAMP:BTCUSD","",volume)) coinbase_btcusdt = nz(request.security("COINBASE:BTCUSDT","",volume)) coinbase_btcusd = nz(request.security("COINBASE:BTCUSD","",volume)) coinbase_btceur = nz(request.security("COINBASE:BTCEUR","",volume)) huobi_btcusdt = nz(request.security("HUOBI:BTCUSDT","",volume)) kucoin_btcusdt = nz(request.security("KUCOIN:BTCUSDT","",volume)) kraken_xbtusd = nz(request.security("KRAKEN:XBTUSD","",volume)) kraken_xbteur = nz(request.security("KRAKEN:XBTEUR","",volume)) bitfinex_btcusd = nz(request.security("BITFINEX:BTCUSD","",volume)) bybit_btcusdt = nz(request.security("BYBIT:BTCUSDT","",volume)) kraken_btcusd = nz(request.security("KRAKEN:BTCUSD","",volume)) okx_btcusdt = nz(request.security("OKX:BTCUSDT","",volume)) agg_vol = binance_btcusdt + binance_btctusd + binance_btcbusd + binance_btcdai + bitstamp_btcusdt + coinbase_btcusdt + huobi_btcusdt + kucoin_btcusdt + coinbase_btcusd + kraken_xbtusd + bitstamp_btcusd + bitfinex_btcusd + binance_btceur + bybit_btcusdt + kraken_btcusd + okx_btcusdt + coinbase_btceur + kraken_xbteur + binance_btcfdusd the_vol = use_agg ? agg_vol : volume prev_vol = all.contains(key) ? all.get(key) : 0 all.put(key,the_vol + prev_vol) prev_cur_vol = cur.contains(key) ? cur.get(key) : 0 cur.put(key,prev_cur_vol + volume) if bar_index == last_bar_index max_vol = array.max(all.values()) min_vol = array.min(all.values()) keys = all.keys() for i = 0 to keys.size() - 1 k = array.get(keys,i) v = all.get(k) if v != 0 v_len = int((v / max_vol) * shape_width) if compare_bool c_v = cur.get(k) c_v_len = int((c_v/max_vol) * shape_width) line.new(x1=bar_index+plot_offset-c_v_len,y1=k*seg,x2=bar_index+plot_offset,y2=k*seg,color = compare_color,width=line_width) line.new(x1=bar_index+plot_offset-v_len,y1=k*seg,x2=bar_index+plot_offset-c_v_len,y2=k*seg,color = color.from_gradient(v,min_vol,max_vol,min_color,max_color),width=line_width) else line.new(x1=bar_index+plot_offset-v_len,y1=k*seg,x2=bar_index+plot_offset,y2=k*seg,color = color.from_gradient(v,min_vol,max_vol,min_color,max_color),width=line_width)
Psychological Support/Resistence [StratifyTrade]
https://www.tradingview.com/script/om7XAE85-Psychological-Support-Resistence-StratifyTrade/
StratifyTrade
https://www.tradingview.com/u/StratifyTrade/
845
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/ // ยฉ HunterAlgos //@version=5 indicator("Psychological Support/Resistence [HunterAlgos]", shorttitle = "Psychological Support/Resistence [1.0.0]", overlay = true, max_boxes_count = 500, max_lines_count = 500) num = input.int (3 , "Box" , group = "Settings") thresh = input.int (2 , "Number of sequential candle" , group = "Settings") src = input.string("Avg", "Source" , options = ["Avg", "Open", "Close"], group = "Settings") stxt = input.bool(false , "Hide volume" , group = "Settings") cssbull = input.color(color.aqua , "Support" , group = "Colors") cssbear = input.color(color.red , "Resistence", group = "Colors") textcss = input.color(color.white, "Text" , group = "Colors") textcss := stxt ? color.new(color.white, 100) : textcss float _src = na switch src "Avg" => _src := math.avg(high[thresh - 1], low[thresh - 1]) "Close" => _src := close[thresh - 1] "Open" => _src := open[thresh - 1] type point float[] bl float[] bo int [] bt float[] sh float[] so int [] st string[] vu string[] vd type draw box [] bx line[] ln box [] sbx line[] sln line[] upext line[] dnext var p = point.new(array.new<float>(), array.new<float>(), array.new<int>(), array.new<float>(), array.new<float>(), array.new<int> (), array.new<string>(), array.new<string>()) var d = draw.new (array.new<box> (), array.new<line> (), array.new<box>(), array.new<line> (), array.new<line> (), array.new<line>()) up = close > open dn = close < open check(bool bull) => point = bull ? close > open : close < open var y = array.new<int>() y.clear() for i = 0 to thresh - 1 if point[i] y.push(1) y.sum() vol(bool bull) => var vol = array.new<float>() vol.clear() for i = 0 to thresh - 1 vol.push(volume[i]) out = str.tostring(math.abs(vol.sum())) if bull p.vu.push(out) if bull == false p.vd.push(out) if check(true) == thresh and dn[thresh] p.bl.unshift(low[thresh - 1]) p.bt.unshift(time - (time - time[1]) * thresh + 1) p.bo.unshift(_src) vol(true) if check(false) == thresh and up[thresh] p.sh.unshift(high[thresh - 1]) p.st.unshift(time - (time - time[1]) * thresh + 1) p.so.unshift(_src) vol(false) rm(bool bull) => if barstate.isconfirmed target = bull ? p.bl : p.sh for stuff in target idx = target.indexof(stuff) if bull if close < stuff p.bl.remove(idx) p.bo.remove(idx) p.bt.remove(idx) if bull == false if close > stuff p.sh.remove(idx) p.so.remove(idx) p.st.remove(idx) overlap(bool bull) => if bull for i = 0 to d.bx.size() - 1 gbox = d.bx.get(i) gline = d.ln.get(i) if d.ln.size() > 0 if line.get_y2(d.ln.first()) < gbox.get_top() p.bl.remove(i) p.bo.remove(i) p.bt.remove(i) create(bool bull,color css) => if barstate.isfirst if bull for i = 0 to num - 1 d.bx .unshift(box.new (na, na, na, na, xloc = xloc.bar_time, bgcolor = color.new(css, 80), border_color = color.new(color.white, 100))) d.ln .unshift(line.new(na, na, na, na, xloc = xloc.bar_time, color = color.new(css, 0), width = 2)) d.upext.unshift(line.new(na, na, na, na, xloc = xloc.bar_time, color = color.new(css, 0), width = 2, extend = extend.right, style = line.style_dashed)) if bull == false for i = 0 to num - 1 d.sbx.unshift(box.new (na, na, na, na, xloc = xloc.bar_time, bgcolor = color.new(css, 80), border_color = color.new(color.white, 100))) d.sln.unshift(line.new(na, na, na, na, xloc = xloc.bar_time, color = color.new(css, 0), width = 2)) d.dnext.unshift(line.new(na, na, na, na, xloc = xloc.bar_time, color = color.new(css, 0), width = 2, extend = extend.right, style = line.style_dashed)) get(bool bull) => if barstate.islast if bull if d.bx.size() > 0 for i = 0 to math.min(num - 1, d.bx.size() - 1) gbox = d.bx.get(i) gline = d.ln.get(i) ext = d.upext.get(i) gbox.set_left (p.bt.get(i)) gbox.set_right (time) gbox.set_top (p.bo.get(i)) gbox.set_bottom(p.bl.get(i)) gbox.set_text(p.vu.get(i)) gbox.set_text_color(textcss) top = gbox.get_top() bottom = gbox.get_bottom() gline.set_x1(p.bt.get(i)) gline.set_x2(time) gline.set_y1(p.bl.get(i)) gline.set_y2(p.bl.get(i)) ext.set_x1(time) ext.set_x2(time + (time - time[1])) ext.set_y1(p.bl.get(i)) ext.set_y2(p.bl.get(i)) if (open > bottom and open < top) or (low > bottom and low < top) p.bl.shift() p.bo.shift() p.bt.shift() if bull == false if d.sbx.size() > 0 for i = 0 to math.min(num - 1, d.sbx.size() - 1) gbox = d.sbx.get(i) gline = d.sln.get(i) ext = d.dnext.get(i) gbox.set_left (p.st.get(i)) gbox.set_right (time) gbox.set_top (p.sh.get(i)) gbox.set_bottom(p.so.get(i)) gbox.set_text(p.vd.get(i)) gbox.set_text_color(textcss) top = gbox.get_top() bottom = gbox.get_bottom() if open[1] < bottom and open[1] > top p.sh.shift() p.so.shift() p.st.shift() gline.set_x1(p.st.get(i)) gline.set_x2(time) gline.set_y1(p.sh.get(i)) gline.set_y2(p.sh.get(i)) ext.set_x1(time) ext.set_x2(time + (time - time[1])) ext.set_y1(p.sh.get(i)) ext.set_y2(p.sh.get(i)) rm(true) rm(false) create(true, cssbull) create(false, cssbear) get(true) get(false) overlap(true)
US Presidential Elections
https://www.tradingview.com/script/CbdSlFMn-US-Presidential-Elections/
NoaTrader
https://www.tradingview.com/u/NoaTrader/
11
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ NoaTrader //@version=5 indicator("US Presidential Elections",overlay = true,max_labels_count = 500) var show_elec = input.bool(true,"Show Election Lables") var show_inag = input.bool(true,"Show Inauguration Labels") is_election_year = (year - 1800) %4 == 0 is_election_month = month == 11 or (month == 12 and month[1] == 10) is_election_week = weekofyear == 45 is_election_dow = dayofweek == 2 // if month == 1 or month == 2 or month == 3 // label.new(bar_index,close,str.tostring(month),color = color.white) election_daily_cond = timeframe.isdaily and is_election_year and is_election_week and is_election_dow election_weekly_cond = timeframe.isweekly and is_election_year and is_election_week election_monthly_cond = timeframe.ismonthly and is_election_year and is_election_month and not is_election_month[1] if election_daily_cond or election_weekly_cond or election_monthly_cond if show_elec label.new(bar_index,high*1.02,"Election",textcolor = color.white) is_inauguration_year = (year - 1800) %4 == 1 is_inauguration_month = month == 1 is_inauguration_week = weekofyear == 3 is_inauguration_dow = dayofmonth == 20 inauguration_daily_cond = timeframe.isdaily and is_inauguration_year and is_inauguration_month and is_inauguration_dow inauguration_weekly_cond = timeframe.isweekly and is_inauguration_year and is_inauguration_week inauguration_monthly_cond = timeframe.ismonthly and is_inauguration_year and is_inauguration_month //and not is_election_month[1] if inauguration_daily_cond or inauguration_weekly_cond// or inauguration_monthly_cond if show_inag label.new(bar_index,high*1.02,"Inauguration",color=color.orange)
Equity Trade Risk Manager
https://www.tradingview.com/script/KQybMyEu-Equity-Trade-Risk-Manager/
Amphibiantrading
https://www.tradingview.com/u/Amphibiantrading/
266
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ Amphibiantrading //@version=5 indicator("Trade Risk Manager", overlay = true) //----------settings----------// var g0 = 'Account & Risk Settings' actSize = input.int(100000, 'Account Size', inline = '1', group = g0, confirm = true) portRisk = input.string('0.25%', 'Equity Risk', ['0.25%', '0.50%', '0.75%'], inline = '1', group = g0, confirm = true) customRisk = input.bool(false, 'Custom Equity Risk', inline = '2', group = g0, confirm = true) crNum = input.float(0.75, ' ', inline ='2', group = g0, tooltip = 'If using a custom portfolio risk amount, enter here. Must turn on this setting to use', confirm = true) useMax = input.bool(false, 'Max Position Size', inline = '3', group = g0, confirm = true) maxPos = input.float(10, ' ', inline = '3', group = g0, confirm = true, tooltip = 'If the recommended position size is greater than this % of the total portfolio when calculating the number of shares to buy, selecting this setting will cap the position size at fixed amount.' ) what = input.string('Shares to Buy', 'Calculate', ['Shares to Buy', 'Stop Loss'], group = g0, confirm = true) fract = input.bool(false, 'Use Fractional Shares', group = g0) var g1 = 'Price Levels' entryPrice = input.float(0.0, 'Entry Price', inline = '1', group = g1, confirm = true) currPrice = input.bool(false, 'or Use Current Price', inline = '1', group = g1, confirm = true) stopPrice = input.float(0.0, 'Stop Price', inline = '2', group = g1, confirm = true) useM = input.bool(false, 'or Use Major Level', inline = '2', group = g1, confirm = true) autoStop = input.string('Low of Day', 'Major Levels', ['Low of Day', 'Swing Low', '% ATR from LOD', 'High of Day', 'Swing High', '% ATR from HOD'], inline = '3', group = g1, confirm = true) owned = input.int(0, 'Shares Owned', group = g1, confirm = true) var g2 = 'Major Levels' swingLB = input.int(2, 'Pivot Lenth', group = g2, confirm = true) atrLen = input.int(14, 'ATR Length', inline = '1', group = g2, confirm = true) atrPer = input.float(1, 'Multiplier', inline = '1', group = g2, confirm = true) var g3 = 'Display Settings' showStop = input.bool(true, 'Show Stop Loss on Chart', group = g3) yPos = input.string('Top', 'Table Position ', options = ['Top', 'Middle', 'Bottom'], inline = '1', group= g3) xPos = input.string('Right', ' ', options = ['Right','Center', 'Left'], inline = '1', group = g3) txtSize = input.string('Normal', 'Text Size', options = ['Small','Normal','Large','Huge'], inline = '2', group = g3) txtCol = input.color(color.black, 'Text Color', inline = '2', group = g3) bgCol = input.color(color.white, 'Table Background Color', group = g3) //----------udt----------// type pivot float p int b //----------switch----------// numSwitch = switch portRisk '0.25%' => .0025 '0.50%' => .0050 '0.75%' => .0075 txtSizer = switch txtSize 'Small' => size.small 'Normal' => size.normal 'Large' => size.large 'Huge' => size.huge //----------variables----------// var table data = table.new(str.lower(yPos) + '_' + str.lower(xPos), 1,4, bgcolor = color.new(color.white,100)) line stopLine = na label stopLabel = na var swingLow = pivot.new(na,na) var swingHigh = pivot.new(na,na) //----------calculations----------// pl = ta.pivotlow(swingLB,swingLB) ph = ta.pivothigh(swingLB,swingLB) atr = ta.atr(atrLen) if pl swingLow.p := low[swingLB] swingLow.b := bar_index[swingLB] if ph swingHigh.p := high[swingLB] swingHigh.b := bar_index[swingLB] lod = request.security(syminfo.ticker, 'D', low) hod = request.security(syminfo.ticker, 'D', high) totalRisk = customRisk ? actSize * (crNum/100) : actSize * numSwitch pivot = currPrice ? close : entryPrice stop = useM ? autoStop == 'Low of Day' ? lod : autoStop == 'Swing Low' ? swingLow.p : autoStop == '% ATR from LOD' ? lod - (atr*atrPer) : autoStop == 'High of Day' ? hod : autoStop == 'Swing High' ? swingHigh.p : hod + (atr*atrPer) : stopPrice shares = fract ? math.round(totalRisk / (pivot - stop),2) : math.ceil(totalRisk / (pivot - stop)) sl = pivot - totalRisk / owned posSize = what == 'Shares to Buy' ? shares * pivot : owned * pivot if posSize > (actSize * (maxPos/100)) and useMax and what == 'Shares to Buy' shares := fract ? math.round((actSize * (maxPos/100)) / pivot,2) : math.ceil((actSize * (maxPos/100)) / pivot) posSize := what == 'Shares to Buy' ? shares * pivot : owned * pivot totalRisk := (pivot - stop) * shares else if posSize < 0 and posSize < (actSize * (maxPos/100) * -1) and useMax and what == 'Shares to Buy' shares := fract ? math.round((actSize * (maxPos/100)) / pivot * -1,2) : math.ceil((actSize * (maxPos/100)) / pivot * -1) posSize := what == 'Shares to Buy' ? shares * pivot : owned * pivot totalRisk := (pivot - stop) * shares //----------data table----------// if barstate.islast data.cell(0,0, ' ') data.cell(0,1, 'Dollar Risk: ' + str.tostring(totalRisk, '$#,###.##'), text_halign = text.align_left, bgcolor = bgCol, text_color = txtCol, text_size = txtSizer) data.cell(0,2, 'Position Size: ' + str.tostring(posSize, '$#,###.##'), text_halign = text.align_left, bgcolor = bgCol, text_color = txtCol, text_size = txtSizer) if what == 'Shares to Buy' data.cell(0,3, 'Shares to buy: ' + str.tostring(shares), text_halign = text.align_left, bgcolor = bgCol, text_color = txtCol, text_size = txtSizer) else data.cell(0,3, 'Stop Loss: $' + str.tostring(sl, format.mintick), text_halign = text.align_left, bgcolor = bgCol, text_color = txtCol, text_size = txtSizer) if what == 'Stop Loss' and showStop (stopLine[1]).delete(), (stopLabel[1]).delete() stopLabel := label.new(bar_index+6, sl, 'Stop: $' + str.tostring(sl, format.mintick), color = color.new(color.white,100), style = label.style_none, textcolor = txtCol) stopLine := line.new(bar_index, sl, bar_index+1, sl, extend = extend.right, color = color.red) else if what == 'Shares to Buy' and showStop (stopLine[1]).delete(), (stopLabel[1]).delete() stopLabel := label.new(bar_index+6, stop, 'Stop: $' + str.tostring(stop, format.mintick), color = color.new(color.white,100), style = label.style_none, textcolor = txtCol) stopLine := line.new(autoStop == 'Swing Low' ? swingLow.b : autoStop == 'Swing High' ? swingHigh.b : bar_index, stop , bar_index+1, stop, extend = extend.right, color = color.red)
Kviatek - Multi Day VWAP
https://www.tradingview.com/script/y8a9kHqj-Kviatek-Multi-Day-VWAP/
hundredtoamillion
https://www.tradingview.com/u/hundredtoamillion/
28
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ kviateq // @version=5 indicator('Kviatek - Multi Day VWAP', overlay=true, max_boxes_count = 500) showDOW = input(true, title="Show day of the week labels?") tmzn = input(defval="GMT+7", title = "Timezone") source = input.source(ohlc4, "Source for VWAPs") showMon = input.bool(true, "Show Monday VWAP?", inline = "Monday") showTue = input.bool(true, "Show Tuesday VWAP?", inline = "Tueday") showWed = input.bool(true, "Show Wednesday VWAP?", inline = "Wednesday") showThu = input.bool(true, "Show Thursdayy VWAP?", inline = "Thursday") showFri = input.bool(true, "Show Friday VWAP?", inline = "Friday") var datePrev = 0 var weekPrev = 0 var H = 0.0 var L = 0.0 date = time('D') datePrev := date newDay = date!=datePrev dow = dayofweek(date + 1) bcolor = dow == dayofweek.sunday ? color.gray : dow == dayofweek.monday ? color.rgb(12, 187, 236) : dow == dayofweek.tuesday ? color.rgb(68, 248, 59) : dow == dayofweek.wednesday ? color.rgb(247, 243, 59) : dow == dayofweek.thursday ? color.rgb(255, 162, 0) : dow == dayofweek.friday ? color.rgb(245, 10, 10) : color.silver Day_switch = timeframe.change("D") open_bar(t) => na(t[1]) and not na(t) or t[1] < t ? 1 : 0 mon = time("W", "0400-0400:3", tmzn) tue = time("W", "0400-0400:4", tmzn) wed = time("W", "0400-0400:5", tmzn) thu = time("W", "0400-0400:6", tmzn) fri = time("W", "0400-0400:7", tmzn) mon_switch = ta.change(open_bar(mon)) > 0 tue_switch = ta.change(open_bar(tue)) > 0 wed_switch = ta.change(open_bar(wed)) > 0 thu_switch = ta.change(open_bar(thu)) > 0 fri_switch = ta.change(open_bar(fri)) > 0 Monday_vwap = ta.vwap(source, mon_switch) Monday_vwapH = ta.vwap(high, mon_switch) Monday_vwapL = ta.vwap(low, mon_switch) Tuesday_vwap = ta.vwap(source, tue_switch) Tuesday_vwapH = ta.vwap(high, tue_switch) Tuesday_vwapL = ta.vwap(low, tue_switch) Wednesday_vwap = ta.vwap(source, wed_switch) Wednesday_vwapH = ta.vwap(high, wed_switch) Wednesday_vwapL = ta.vwap(low, wed_switch) Thursday_vwap = ta.vwap(source, thu_switch) Thursday_vwapH = ta.vwap(high, thu_switch) Thursday_vwapL = ta.vwap(low, thu_switch) Friday_vwap = ta.vwap(source, fri_switch) Friday_vwapH = ta.vwap(high, fri_switch) Friday_vwapL = ta.vwap(low, fri_switch) Mon = dayofweek == dayofweek.monday //? true : false Tue = dayofweek == dayofweek.tuesday //? true : false Wed = dayofweek == dayofweek.wednesday //? true : false Thu = dayofweek == dayofweek.thursday //? true : false Fri = dayofweek == dayofweek.friday //? true : false W_vwap = ta.vwap(source, timeframe.change("W")) M_vwap = ta.vwap(source, timeframe.change("M")) plot(W_vwap, "Weekly VWAP", color = #41ecbe, style = plot.style_cross, display = display.pane) plot(M_vwap, "Monthly VWAP", color = #f48fb1, style = plot.style_cross, display = display.pane) plot(Mon or Tue and not mon_switch ? Monday_vwap : na, "Monday VWAP", color = color.aqua, style = plot.style_linebr, linewidth = 2, display = display.pane) plot(Tue or Wed and not tue_switch ? Tuesday_vwap : na, "Tuesday VWAP", color = color.green, style = plot.style_linebr, linewidth = 2, display = display.pane) plot(Wed or Thu and not wed_switch ? Wednesday_vwap : na, "Wednesday VWAP", color = color.yellow, style = plot.style_linebr, linewidth = 2, display = display.pane) plot(Thu or Fri and not thu_switch ? Thursday_vwap : na, "Thursday VWAP", color = color.orange, style = plot.style_linebr, linewidth = 2, display = display.pane) plot(Fri or Mon and not fri_switch ? Friday_vwap : na, "Friday VWAP", color = color.red, style = plot.style_linebr, linewidth = 2, display = display.pane) plotshape(showDOW ? hour == 2 and minute == 0 and dayofweek == dayofweek.monday : false, offset=0, style=shape.diamond, text="Monday" , color=color.rgb(12, 187, 236), location = location.bottom, textcolor=color.rgb(12, 187, 236)) plotshape(showDOW ? hour == 2 and minute == 0 and dayofweek == dayofweek.tuesday : false, offset=0, style=shape.diamond, text="Tuesday" , color=color.rgb(70, 204, 61) , location = location.bottom, textcolor=color.rgb(70, 204, 61)) plotshape(showDOW ? hour == 2 and minute == 0 and dayofweek == dayofweek.wednesday : false, offset=0, style=shape.diamond, text="Wednesday", color=color.rgb(234, 223, 15), location = location.bottom, textcolor=color.rgb(234, 223, 15)) plotshape(showDOW ? hour == 2 and minute == 0 and dayofweek == dayofweek.thursday : false, offset=0, style=shape.diamond, text="Thursday" , color=color.rgb(243, 139, 13), location = location.bottom, textcolor=color.rgb(243, 139, 13)) plotshape(showDOW ? hour == 2 and minute == 0 and dayofweek == dayofweek.friday : false, offset=0, style=shape.diamond, text="Friday" , color=color.rgb(241, 69, 12) , location = location.bottom, textcolor=color.rgb(241, 69, 12)) plotshape(showDOW ? hour == 2 and minute == 0 and dayofweek == dayofweek.saturday : false, offset=0, style=shape.diamond, text="Saturday" , color=color.gray , location = location.bottom, textcolor=color.gray) plotshape(showDOW ? hour == 2 and minute == 0 and dayofweek == dayofweek.sunday : false, offset=0, style=shape.diamond, text="Sunday" , color=color.gray , location = location.bottom, textcolor=color.gray) bgcolor(Day_switch ? color.new(color.white,85) : na, title= "Start of a new day")
Sudden increase in volume [PINESCRIPTLABS]
https://www.tradingview.com/script/klwM1g6Z/
PINE_LABS
https://www.tradingview.com/u/PINE_LABS/
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/ // ยฉ PINE_LABS //@version=5 indicator("Sudden increase in volume and RSI on oversold or overbought PINESCRIPTLABS", shorttitle="Sudden up and down volume PINESCRIPTLABS", overlay=true) // Parรกmetros del indicador length = input.int(21, title="RSI Length", minval=1) rsi_overbought = input.int(80, title="RSI Overbought", minval=1) rsi_oversold = input.int(30, title="RSI Oversold", maxval=100) volume_threshold = input.int(2, title="Volume Threshold", minval=0) ema_length = input.int(200, title="EMA Length", minval=1) // Calcula el RSI rsi = ta.rsi(close, length) // Calcula el promedio mรณvil exponencial del volumen utilizando el valor actualizado de ema_length ema_volume = ta.ema(volume, ema_length) // Condiciones para el aumento brusco de volumen y RSI en sobreventa (compra) abrupt_volume_increase_buy = volume > ema_volume * volume_threshold rsi_oversold_condition_buy = rsi < rsi_oversold // Condiciones para la venta (contrario a la compra) abrupt_volume_increase_sell = volume > ema_volume * volume_threshold rsi_overbought_condition_sell = rsi > rsi_overbought // Dibuja un histograma para la compra plotbar(abrupt_volume_increase_buy and rsi_oversold_condition_buy ? 1 : na, 0, 0, 0, color=color.green, title="Aumento Brusco de Volumen y RSI en Sobreventa (Compra)") // Dibuja un histograma para la venta plotbar(abrupt_volume_increase_sell and rsi_overbought_condition_sell ? 1 : na, 0, 0, 0, color=color.red, title="Aumento Brusco de Volumen y RSI en Sobrecompra (Venta)") // Seรฑal de compra con triรกngulo grande plotshape(series=abrupt_volume_increase_buy and rsi_oversold_condition_buy, location=location.belowbar, color=color.green, style=shape.triangleup, title="Seรฑal de Compra", size=size.normal) // Seรฑal de venta con triรกngulo grande plotshape(series=abrupt_volume_increase_sell and rsi_overbought_condition_sell, location=location.abovebar, color=color.red, style=shape.triangledown, title="Seรฑal de Venta", size=size.normal)
Asset Performance
https://www.tradingview.com/script/VwteGUbh/
hisatomi
https://www.tradingview.com/u/hisatomi/
3
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ hisatomi //@version=5 indicator("Asset Performance", overlay = false, format = format.percent, explicit_plot_zorder = true) bars = input.int(200, "Bars", minval = 0, step = 100) GROUP_NAME = "Assets for comparison" a1_color = input.color(color.new(#0077FF, 20), "1.", inline = "1", group = GROUP_NAME) a2_color = input.color(color.new(#FF0000, 20), "2.", inline = "2", group = GROUP_NAME) a3_color = input.color(color.new(#00BB00, 20), "3.", inline = "3", group = GROUP_NAME) a4_color = input.color(color.new(#33BBFF, 20), "4.", inline = "4", group = GROUP_NAME) a5_color = input.color(color.new(#FF77FF, 20), "5.", inline = "5", group = GROUP_NAME) a6_color = input.color(color.new(#FFBB33, 20), "6.", inline = "6", group = GROUP_NAME) a1_input = input.string("", "", ["", "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", "BTC", "ETH"], inline = "1", group = GROUP_NAME) a2_input = input.string("", "", ["", "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", "BTC", "ETH"], inline = "2", group = GROUP_NAME) a3_input = input.string("", "", ["", "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", "BTC", "ETH"], inline = "3", group = GROUP_NAME) a4_input = input.symbol("", "", inline = "4", group = GROUP_NAME) a5_input = input.symbol("", "", inline = "5", group = GROUP_NAME) a6_input = input.symbol("", "", inline = "6", group = GROUP_NAME) currency_symbol(currency_name) => symbol = "" switch currency_name "USD" => symbol := "TVC:DXY" "EUR" => symbol := "FX_IDC:EURUSD" "JPY" => symbol := "FX_IDC:JPYUSD" "GBP" => symbol := "FX_IDC:GBPUSD" "AUD" => symbol := "FX_IDC:AUDUSD" "CAD" => symbol := "FX_IDC:CADUSD" "CHF" => symbol := "FX_IDC:CHFUSD" "NZD" => symbol := "FX_IDC:NZDUSD" "BTC" => symbol := "CRYPTO:BTCUSD" "ETH" => symbol := "CRYPTO:ETHUSD" symbol modify_symbol(symbol) => id = ticker.modify(symbol, session = session.extended) if str.contains(syminfo.tickerid, "dividends") id := ticker.modify(id, adjustment = adjustment.dividends) id a1_symbol = currency_symbol(a1_input) a2_symbol = currency_symbol(a2_input) a3_symbol = currency_symbol(a3_input) a4_symbol = modify_symbol(a4_input) a5_symbol = modify_symbol(a5_input) a6_symbol = modify_symbol(a6_input) symbol_value(symbol) => syminfo.ticker(symbol) == "DXY" ? 1.0 : close dxy = request.security("TVC:DXY", "", close) a1usd = request.security(a1_symbol, "", symbol_value(a1_symbol), ignore_invalid_symbol = true) a2usd = request.security(a2_symbol, "", symbol_value(a2_symbol), ignore_invalid_symbol = true) a3usd = request.security(a3_symbol, "", symbol_value(a3_symbol), ignore_invalid_symbol = true) a4usd = request.security(a4_symbol, "", symbol_value(a4_symbol), ignore_invalid_symbol = true, currency = currency.USD) a5usd = request.security(a5_symbol, "", symbol_value(a5_symbol), ignore_invalid_symbol = true, currency = currency.USD) a6usd = request.security(a6_symbol, "", symbol_value(a6_symbol), ignore_invalid_symbol = true, currency = currency.USD) csusd = request.security(syminfo.tickerid, "", syminfo.basecurrency == "USD" ? 1.0 : symbol_value(syminfo.tickerid), currency = syminfo.basecurrency == "USD" ? currency.NONE : currency.USD) var float dxy_start = na var float a1usd_start = na var float a2usd_start = na var float a3usd_start = na var float a4usd_start = na var float a5usd_start = na var float a6usd_start = na var float csusd_start = na if bar_index == last_bar_index - bars line.new(bar_index, 0.0001, bar_index, -0.0001, extend = extend.both, color = color.gray, style = line.style_dotted) dxy_start := dxy a1usd_start := a1usd a2usd_start := a2usd a3usd_start := a3usd a4usd_start := a4usd a5usd_start := a5usd a6usd_start := a6usd csusd_start := csusd usd_change = dxy / dxy_start a1 = a1_input == "" ? na : 100 * (usd_change * a1usd / a1usd_start - 1) a2 = a2_input == "" ? na : 100 * (usd_change * a2usd / a2usd_start - 1) a3 = a3_input == "" ? na : 100 * (usd_change * a3usd / a3usd_start - 1) a4 = a4_input == "" ? na : 100 * (usd_change * a4usd / a4usd_start - 1) a5 = a5_input == "" ? na : 100 * (usd_change * a5usd / a5usd_start - 1) a6 = a6_input == "" ? na : 100 * (usd_change * a6usd / a6usd_start - 1) cs = 100 * (usd_change * csusd / csusd_start - 1) hline(0, "Zero Line", color.new(color.gray, 50)) plot(a1, "Asset 1", a1_color, editable = false) plot(a2, "Asset 2", a2_color, editable = false) plot(a3, "Asset 3", a3_color, editable = false) plot(a4, "Asset 4", a4_color, editable = false) plot(a5, "Asset 5", a5_color, editable = false) plot(a6, "Asset 6", a6_color, editable = false) plot(cs, "Symbol", color.black) label_copy(template, labeltext, textcolor) => id = label.copy(template) label.set_text(id, labeltext) label.set_textcolor(id, textcolor) id var a1_label = label.new(na, na, a1_input, color = #00000000, style = label.style_label_left, textcolor = a1_color, size = size.small) var a2_label = label_copy(a1_label, a2_input, a2_color) var a3_label = label_copy(a1_label, a3_input, a3_color) var a4_label = label_copy(a1_label, syminfo.ticker(a4_symbol), a4_color) var a5_label = label_copy(a1_label, syminfo.ticker(a5_symbol), a5_color) var a6_label = label_copy(a1_label, syminfo.ticker(a6_symbol), a6_color) if barstate.islast label.set_xy(a1_label, bar_index, a1) label.set_xy(a2_label, bar_index, a2) label.set_xy(a3_label, bar_index, a3) label.set_xy(a4_label, bar_index, a4) label.set_xy(a5_label, bar_index, a5) label.set_xy(a6_label, bar_index, a6)
RSRS (Resistance Support Relative Strength)
https://www.tradingview.com/script/JOxeFQeX-RSRS-Resistance-Support-Relative-Strength/
algotraderdev
https://www.tradingview.com/u/algotraderdev/
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/ // ยฉ algotraderdev // @version=5 indicator('RSRS', max_bars_back = 600, explicit_plot_zorder = true) import voided/regress/1 as regress // Inputs and Constants. int OLS_WINDOW_SIZE = input.int( 18, 'Linear Regression Window Size', minval = 1, tooltip = 'The size of the rolling window to calculate the RSRS value via linear regression.') int Z_SCORE_WINDOW_SIZE = math.min(input.int( 600, 'Z-Score Window Size', minval = 50, step = 50, tooltip = 'The size of the rolling window to calculate the standard score of RSRS.'), bar_index + 1) float BUY_SELL_THRESHOLD = input.float( 0.7, 'Buy / Sell Threshold', minval = 0, step = 0.1, tooltip = 'If the RSRS Z-Score is above the threshold, trigger a buy signal. ' + 'If the RSRS Z-Score is below the negative threshold, trigger a sell signal.') color BUY_COLOR = input.color(color.green, 'Buy Color') color SELL_COLOR = input.color(color.red, 'Sell Color') color NEUTRAL_COLOR = #777777 // Use OLS (Ordinary Least Squares) to calculate the slope (beta) such that `high = alpha + beta * low`. [alpha, beta, r2] = regress.regress(low, high, OLS_WINDOW_SIZE) // The RSRS value is essentially the slope (beta). rsrs = nz(beta) // Calculate the standard score for RSRS. float mean = ta.sma(rsrs, Z_SCORE_WINDOW_SIZE) float sigma = ta.stdev(rsrs, Z_SCORE_WINDOW_SIZE) float zscore = (rsrs - mean) / sigma // Plot the graphs. plot(0, color = NEUTRAL_COLOR, style = plot.style_circles) plot(BUY_SELL_THRESHOLD, color = NEUTRAL_COLOR, style = plot.style_circles) plot(-BUY_SELL_THRESHOLD, color = NEUTRAL_COLOR, style = plot.style_circles) color c = switch zscore[1] >= BUY_SELL_THRESHOLD and zscore >= BUY_SELL_THRESHOLD => BUY_COLOR zscore[1] <= -BUY_SELL_THRESHOLD and zscore <= -BUY_SELL_THRESHOLD => SELL_COLOR => NEUTRAL_COLOR plot(zscore, color = c) alertcondition(ta.crossover(zscore, BUY_SELL_THRESHOLD), 'BUY', 'RSRS Z-Score crossed over buy threshold.') alertcondition(ta.crossunder(zscore, -BUY_SELL_THRESHOLD), 'SELL', 'RSRS Z-Score crossed under sell threshold.')
Math Neuron
https://www.tradingview.com/script/BZ8vGhuT/
flexer_frey
https://www.tradingview.com/u/flexer_frey/
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/ // ยฉ flexer_frey //@version=5 indicator("Math Neuron" , overlay=false) t0 = "search data from last pivots to predict in live candle" t1 = "number of candle in neuron's dataset" t2 = "number of iterations for the optimization of neuron" t3 = "the learning rate is a constant that serves to modify the weight by giving more or less value to the error (0.1 is recommended)" //input lenght = input.int(5, 'lenght pivot' , group='pivot' , tooltip = t0) //neural network input dataset_int = input.int(50, 'Number of dataset' , tooltip = t1 ,group='neural network' , minval = 10) iterazioni = input.int(5000 , 'Number of iterations', tooltip = t2 , group='neural network') learning_rate = input.float(0.1 , 'Learning rate', tooltip = t3 , minval = 0.01 , maxval = 1 , group='neural network') //pivot calculation ph1 = ta.pivothigh(lenght, lenght) pl1 = ta.pivotlow(lenght, lenght) ph = ph1 if na(ph1) ph := ph[1] pl = pl1 if na(pl1) pl := pl[1] //data cleaning //converto to 0 > x > 1(rsi 0 > x > 10) source_1= ta.rsi(close , 14)/10 source_2 = ta.rsi(volume , 14)/10 //bool results converted to 0 or 1 long = ta.change(pl) short = ta.change(ph) results_L = long ? 1 : 0 results_S = short ? 1 : 0 //data offset(pivot showed after lenght) offset_ = lenght //archive population // | 1| 2| 3| 4| 5| 6| 7| 8| dataset| // archivio_1 |__|__|__|__|__|__|__|__|........| // archivio_2 |__|__|__|__|__|__|__|__|........| // results_L |__|__|__|__|__|__|__|__|........| // results_S |__|__|__|__|__|__|__|__|........| //preparazione delle 4 righe con numero di celle dataset archivio_1 = array.new_float(dataset_int) archivio_2 = array.new_float(dataset_int) archivio_results_L = array.new_float(dataset_int) archivio_results_S = array.new_float(dataset_int) //dataset population for i = 0 to (dataset_int - 1) array.set(archivio_1 , i , source_1[i+offset_]) array.set(archivio_2 , i , source_2[i+offset_]) array.set(archivio_results_L , i , results_L[i]) array.set(archivio_results_S , i , results_S[i]) //function sigmoide(t) => 1/(1+math.exp(-t)) sigmoide_p(t) => sigmoide(t) * (1 - sigmoide(t)) Neuron(m1 , w1 , m2 , w2 , b) => t= m1 * w1 + m2 * w2 + b sigmoide(t) //weight calculation train(archivio_results) => w1 = math.random() w2 = math.random() b = math.random() for i = 0 to iterazioni int ri = int(math.random(0,dataset_int)) m1 = array.get(archivio_1 , ri) m2 = array.get(archivio_2 , ri) target = array.get(archivio_results , ri) z = m1 * w1 + m2 * w2 + b pred = sigmoide(z) //cost= math.pow(pred - target , 2) //derivate cost dcost_dpred = 2* (pred-target) dpred_dz = sigmoide_p(z) dz_dw1 = m1 dz_dw2 = m2 dz_db = 1 dcost_dz = dcost_dpred * dpred_dz dcost_dw1 = dcost_dz * dz_dw1 dcost_dw2 = dcost_dz * dz_dw2 dcost_db = dcost_dz * dz_db w1 := w1 - learning_rate * dcost_dw1 w2 := w2 - learning_rate * dcost_dw2 b := b - learning_rate * dcost_db [w1 , w2 , b] [w1_long , w2_long , b_long] = train(archivio_results_L) [w1_short , w2_short , b_short] = train(archivio_results_S) previsioneL = Neuron(source_1 ,w1_long , source_2 , w2_long , b_long) previsioneS = Neuron(source_1 ,w1_short , source_2 , w2_short , b_short) //plotting high tech |-|-| a = (previsioneL - previsioneS)*10 plot((-previsioneS)*10) plot(previsioneL*10) plot( a > 1 or a < -1 ? a : na, color=color.white , style=plot.style_circles , linewidth = 2) plot( a > 1 or a < -1 ? a : na, color=color.blue , style=plot.style_circles , linewidth = 1) long_prob_color = color.new(color.green , math.floor(100 - previsioneL * 100)) short_prob_color = color.new(color.red , math.floor(100 - previsioneS * 100)) bgcolor(previsioneL >= previsioneS ? long_prob_color : short_prob_color)
Day Trader's Anchored Moving Averages [wbburgin]
https://www.tradingview.com/script/XqWFNfGN-Day-Trader-s-Anchored-Moving-Averages-wbburgin/
wbburgin
https://www.tradingview.com/u/wbburgin/
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/ // ยฉ wbburgin //@version=5 indicator("Day Trader's Anchored Moving Averages [wbburgin]",overlay=true) source = input.source(close,"Source",group="General") highlighting = input.bool(true,"Highlighting",group="General") enable1 = input.bool(true,title="Moving Average #1",inline="A",group="General") length1 = input.int(50, title="", minval=1,inline="A",group="General") col1 = input.color(color.red,"",inline="A",group="General") enable2 = input.bool(true,title="Moving Average #2",inline="B",group="General") length2 = input.int(100, title="", minval=1,inline="B",group="General") col2 = input.color(color.yellow,"",inline="B",group="General") enable3 = input.bool(true,title="Moving Average #3",inline="C",group="General") length3 = input.int(200, title="", minval=1,inline="C",group="General") col3 = input.color(color.white,"",inline="C",group="General") period = input.string("Day",options=["Day","Month"],title="Anchor Change Period",group="General") anchor_reset = period == "Day" ? ta.change(dayofmonth) : ta.change(month) anchored_ma(source,length,anchor_reset_period) => sum = 0. ma = 0. if anchor_reset_period sum := 0.0 ma := source num = math.min(ta.barssince(anchor_reset_period),length) ma := num > 0 ? math.sum(source,num) / num : source ma ma1 = anchored_ma(source,length1,anchor_reset) ma2 = anchored_ma(source,length2,anchor_reset) ma3 = anchored_ma(source,length3,anchor_reset) map1=plot(not enable1 ? na : ma1,color=col1,title="Anchored MA 1") map2=plot(not enable2 ? na : ma2,color=col2,title="Anchored MA 2") map3=plot(not enable3 ? na : ma3,color=col3,title="Anchored MA 3") hl2p=plot(hl2,color=na,title="HL2 (for highlighting)") fill(map1,hl2p,color=not highlighting ? na : color.new(col1,88)) fill(map2,hl2p,color=not highlighting ? na : color.new(col2,88)) fill(map3,hl2p,color=not highlighting ? na : color.new(col3,88))
Fibonacci Structure & Trend Channel (Expo)
https://www.tradingview.com/script/EhJK1FZL-Fibonacci-Structure-Trend-Channel-Expo/
Zeiierman
https://www.tradingview.com/u/Zeiierman/
1,020
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/ // ยฉ Zeiierman { //@version=5 indicator("Fibonacci Structure Trend Channel (Expo)",overlay=true, max_labels_count=500) //~~} // ~~ Tooltips { t1 = "Determines the Fibonacci retracement level used for calculating the Trend Channel. The higher the value, the more significant the pullback before a reversal. Options include 0.236, 0.382, 0.50, 0.618, and 0.786." t2 = "Allows you to set a custom Fibonacci level. Enable this to override the default Fibonacci options. Value should be between 0.001 and 0.999. Higher values will mean more significant pullbacks before a reversal." t3 = "Enables or disables color-coding the price bars based on the current trend direction. Green for bullish and Red for bearish." t4 = "Determines the sensitivity of structure lines by setting the lookback period. A smaller value will produce more lines but might include noise. A larger value will be less sensitive but could miss shorter-term structures." t5 = "Enables or disables the Fibonacci Channel. This channel is calculated around the Fibonacci Trend and can provide additional insight into potential price action." t6 = "Controls the width of the Fibonacci Channel. The higher the value, the wider the channel. Width is based on the ATR (Average True Range)." //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Inputs { fibonacci = input.float(0.382,"Fibonacci Levelโ€„โ€„",options=[0.236,0.382,0.50,0.618,0.786], group="Fib Settings", tooltip=t1) custom = input.bool(false,"Custom Value",inline="custom", group="Fib Settings") customfib = input.float(0.5,"",.001,.999,.001,inline="custom", group="Fib Settings", tooltip=t2) bull = input.color(color.lime,"Bullish Color",inline="col", group="") bear = input.color(color.red,"Bearish Color",inline="col", group="") barcol = input.bool(false,"Barcolor",inline="col", group="", tooltip=t3) structure = input.bool(true,title="Structure",inline="Structure", group="Fibonacci Structure") sen = input.int(5,title="", minval=1, maxval=200, inline="Structure", group="Fibonacci Structure", tooltip=t4) s_bull = input.color(color.rgb(203, 68, 140),"",inline="Structure color", group="Fibonacci Structure") s_bear = input.color(color.rgb(95, 75, 188),"", inline="Structure color", group="Fibonacci Structure") Channel = input.bool(false, title="Fibonacci Channel",inline="", group="Fibonacci Channel", tooltip=t5) mult = input.float(3.5, minval=1, maxval=10, step=0.1, title="Fib Channel width",inline="", group="Fibonacci Channel", tooltip=t6) max_col = input.color(color.rgb(95, 75, 188),"Upper Channel",inline="max", group="Fibonacci Channel") min_col = input.color(color.rgb(203, 68, 140),"Lower Channel",inline="max", group="Fibonacci Channel") levels = input.bool(true,"Fibonacci Levels",inline="level", group="Show Levels") lvl_lab = input.bool(true,"Labels",inline="level", group="Show Levels") line_s = input.string("Dotted","",options=["Solid","Dotted","Dashed"],inline="style", group="Show Levels") width = input.int(1, title=" ", inline="style", group="Show Levels") info = input.bool(true,"Fib Trend Information", group="Show Levels") Level_0236 = input.color(#F44336,"0.236",inline="fibcol", group="Color Fib Levels") Level_0382 = input.color(#81C784,"0.382",inline="fibcol", group="Color Fib Levels") Level_050 = input.color(#4CAF50,"0.50",inline="fibcol", group="Color Fib Levels") Level_0618 = input.color(#009688,"0.618",inline="fibcol", group="Color Fib Levels") Level_0786 = input.color(#64B5F6,"0.786",inline="fibcol", group="Color Fib Levels") Level_0 = input.color(#5f5f5f,"",inline="fibcol", group="Color Fib Levels") line_style = switch line_s "Solid" => line.style_solid "Dotted"=> line.style_dotted "Dashed"=> line.style_dashed //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Variables { b = bar_index var pos = 0 var hi = high var lo = low var hloc = b var lloc = b var retrace = 0.0 var t = string(na) fib = custom?customfib:fibonacci //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Track high/low and calculate fibonacci level { if pos>=0 if high<retrace pos := -1 lo := low lloc := time retrace := lo+(hi-lo)*fib t := str.tostring(dayofmonth)+"/"+str.tostring(month)+"/"+str.tostring(year)+" " if structure label.new(math.round(math.avg(hloc,lloc)),retrace[1],"โ–ผ",xloc.bar_time, color=color(na),style=label.style_label_up,textcolor=bear) else if high>hi hi := high hloc := time retrace := hi-(hi-lo)*fib if structure and hi[1]==hi[sen] pos += 1 line.new(hloc[1],hi[1],hloc,hi[1],xloc.bar_time,color=s_bear) if pos<=0 if low>retrace pos := 1 hi := high hloc := time retrace := hi-(hi-lo)*fib t := str.tostring(dayofmonth)+"/"+str.tostring(month)+"/"+str.tostring(year)+" " if structure label.new(math.round(math.avg(hloc,lloc)),retrace[1],"โ–ฒ",xloc.bar_time, color=color(na),style=label.style_label_down,textcolor=bull) else if low<lo lo := low lloc := time retrace := lo+(hi-lo)*fib if structure and lo[1]==lo[sen] pos := pos-1 line.new(lloc[1],lo[1],lloc,lo[1],xloc.bar_time,color=s_bull) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Fibonacci Channel { ma = ta.wma(retrace,10) atr = ta.sma(ta.atr(500)*mult,20) max = (ma + atr) min = (ma - atr) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Plot & Barcolor { plot(retrace,"Fibonacci Trend",pos>0?bull:bear) plot(Channel?max:na,"Upper Fibonacci Channel",max_col) plot(Channel?min:na,"Lower Fibonacci Channel",min_col) barcolor(barcol?pos>0?bull:bear:na) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Levels { if levels or lvl_lab var lines = array.new<line>(7) var labels= array.new<label>(7) var lvls = array.from(0,0.236,0.382,0.50,0.618,0.786,1) var cols = array.from(Level_0,Level_0236,Level_0382,Level_050,Level_0618,Level_0786,Level_0) //Create fibonacci level lines if na(lines.get(0)) for [i,c] in cols lines.pop().delete() labels.pop().delete() lines.unshift(line.new(na,na,na,na,xloc.bar_time,color=c,style=line_style,width=width)) labels.unshift(label.new(na,na,str.tostring(lvls.get(i)*100,format.percent), color=color(na),style=label.style_label_left,textcolor=c)) lines.push(line.new(na,na,na,na,xloc.bar_time,color=cols.get(0),style=line_style,width=width)) //Update xy for [i,lvl] in lvls if levels lines.get(i).set_xy1(lvl==0?pos<0?hloc:lloc:pos>0?hloc:lloc,pos>0?lo+(hi-lo)*lvl:hi-(hi-lo)*lvl) lines.get(i).set_xy2(timenow,pos>0?lo+(hi-lo)*lvl:hi-(hi-lo)*lvl) if lvl_lab labels.get(i).set_xy(b,pos>0?lo+(hi-lo)*lvl:hi-(hi-lo)*lvl) if levels lines.get(7).set_xy1(pos<0?hloc:lloc,pos<0?hi:lo) lines.get(7).set_xy2(pos>0?hloc:lloc,pos<0?lo:hi) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Table { if barstate.islast and info var tbl = table.new(position.top_right,1,3,chart.bg_color,chart.fg_color,2) col = pos>0?color.new(bull,75):color.new(bear,75) tbl.cell(0,0,pos>0?"Bullish":"Bearish",bgcolor=col, text_color=chart.fg_color) tbl.cell(0,1,"Trend Level: "+str.tostring(retrace,format.mintick),bgcolor=col, text_color=chart.fg_color) tbl.cell(0,2,"Trend started: "+t,bgcolor=col, text_color=chart.fg_color) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
Contraction Box & Doji Lines
https://www.tradingview.com/script/4wjs61mH-Contraction-Box-Doji-Lines/
AleSaira
https://www.tradingview.com/u/AleSaira/
112
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ AleSaira //@version=5 indicator("Contraction Box & Doji Lines", shorttitle="Contraction Box & Doji Lines", overlay=true, max_lines_count = 200) // Set the length of horizontal lines from doji var int LineLongInput = input.int (25, title="Line Length") var color LineColorInput = input.color (color.rgb(8, 151, 132), title="Line Color") var int LineWidthInput = input.int (1, title="Line Width") var int HistoryLength = input.int (20, title="Historical Bars", minval=1) boxLineColor = input.color (color.blue, title="Box Line Border Color") boxLColor = input.color (color.rgb(61, 118, 204, 70), title="Box Background Color") lineWidth = input.int (2, title="Box Width", minval=1) // Added input for the number of historical bars drawHorizontalLineFromDoji(LineLong, lineColor, lineWidth) => // Calculate the size of the doji body dojiSize = math.abs(open - close) // Identify a doji if the body size is very small compared to the entire range isDoji = dojiSize < (high - low) * 0.1 // Calculate the index of the last doji candle var int lastDojiIndex = na var float lastDojiBodyMid = na if isDoji lastDojiIndex := bar_index lastDojiBodyMid := (open + close) / 2 // Draw a horizontal line starting from the middle of the doji body and extending for LineLong bars to the right line.new(x1=lastDojiIndex, y1=lastDojiBodyMid, x2=lastDojiIndex + LineLong, y2=lastDojiBodyMid, width=lineWidth, color=lineColor) //Call the function only once for each doji candle drawHorizontalLineFromDoji(HistoryLength, LineColorInput, LineWidthInput) // Calculate the lowest low of the last 5 candles lowestLow = ta.lowest(low, 5) // Calculate the highest high of the last 5 candles highestHigh = ta.highest(high, 5) // formula condition condition = high <= high[5] and low[5] <= low and low >= low[3] // Draw the rectangle only if the condition is true rectLeft = condition ? bar_index - 5 : na rectRight = bar_index rectTop = condition ? highestHigh : na rectBottom = condition ? lowestLow : na box.new(left = int(rectLeft), right = int(rectRight), top = rectTop, bottom = rectBottom, border_width = 1, border_color = boxLineColor, bgcolor = boxLColor)
Double Tops & Bottoms [QuantVue]
https://www.tradingview.com/script/77CirzdZ-Double-Tops-Bottoms-QuantVue/
QuantVue
https://www.tradingview.com/u/QuantVue/
313
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ QuantVue //@version=5 indicator("Double Tops & Bottoms [QuantVue]", overlay = true, max_lines_count = 500, max_labels_count = 500) //----------settings----------// lookback = input.int(9, 'Pivot lookback') maxLen = input.int(90, 'Maximum Length Between Tops/Bottoms') var g0 = 'Style Settings' dtCol = input.color(color.red, 'Double Top Color', group = g0) dbCol = input.color(color.green, 'Double Bottom Color', group = g0) shapeSize = input.string('Tiny', 'Shape Size', ['Auto', 'Tiny', 'Small', 'Normal', 'Large'], group = g0) lineStyle = input.string('Solid', 'Line Style', options = ['Dotted', 'Dashed', 'Solid'], group = g0) lineWidth = input.int(1, 'Line Thickness', minval = 1, maxval = 5, step = 1, group = g0) var g1 = 'Alerts' dbAlert = input.bool(true, 'Double Bottom', group = g1) dtAlert = input.bool(true, 'Double Top', group = g1) //----------udt----------// type pivot float p int b line l bool a = true bool h = true //----------methods----------// method sizer(string this)=> switch this 'Auto' => size.auto 'Tiny' => size.tiny 'Small' => size.small 'Normal' => size.normal 'Large' => size.large method switcher(string this)=> switch this 'Dashed' => line.style_dashed 'Dotted' => line.style_dotted 'Solid' => line.style_solid method run(array<pivot> this)=> for [idx,p] in this if p.a if bar_index - p.b > maxLen p.a := false p.l.delete() if (high < p.p and p.h) or (low > p.p and not p.h) p.l.set_x2(bar_index) else if (close > p.p and p.h) or (close < p.p and not p.h) p.l.delete() p.a := false if high > p.p and close < p.p and p.h p.l.set_x2(bar_index) label.new(bar_index, high, yloc = yloc.abovebar, style = label.style_triangledown, color = dtCol, size = shapeSize.sizer()) if dbAlert alert('Double Top', alert.freq_once_per_bar_close) p.a := false else if low < p.p and close > p.p and not p.h p.l.set_x2(bar_index) label.new(bar_index, high, yloc = yloc.belowbar, style=label.style_triangleup, color = dbCol, size = shapeSize.sizer()) if dtAlert alert('Double Bottom', alert.freq_once_per_bar_close) p.a := false //----------variables----------// var phArr = array.new<pivot>() var plArr = array.new<pivot>() //----------pivot points----------// ph = ta.pivothigh(lookback,lookback) pl = ta.pivotlow(lookback,lookback) if ph phArr.unshift(pivot.new(high[lookback], bar_index[lookback], line.new(bar_index[lookback], high[lookback], bar_index, high[lookback], color = dtCol, style = lineStyle.switcher(), width = lineWidth))) if pl plArr.unshift(pivot.new(low[lookback], bar_index[lookback], line.new(bar_index[lookback], low[lookback], bar_index, low[lookback], color = dbCol, style = lineStyle.switcher(), width = lineWidth), h = false)) //----------run methods----------// phArr.run() plArr.run()
TraderJoe Tick
https://www.tradingview.com/script/3h5z8meZ-TraderJoe-Tick/
thebearfib
https://www.tradingview.com/u/thebearfib/
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/ // @thebearfib // //@version=5 indicator('TheTraderJoe Tick', 'TTJ TICK', overlay = true, max_labels_count = 500) [h, l, c, o, firstbar_check, lastbar_check] = request.security('USI:TICK', timeframe.period, [high, low, close,open, session.isfirstbar, session.islastbar]) // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Defaults โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // var string d_ticker = 'USI:TICK' var int d_L1 = 600 var int d_L2 = 800 var int d_L3 = 1000 var int d_L4 = 1200 var color d_colorHi4 = color.rgb(0, 255, 8, 40) var color d_colorHi3 = color.rgb(0, 255, 8, 80) var color d_colorHi2 = color.rgb(255, 166, 0, 60) var color d_colorHi1 = color.rgb(255, 255, 0, 60) var color d_colorZero = color.rgb(114, 118, 120) var color d_colorLo1 = color.rgb(255, 255, 0, 60) var color d_colorLo2 = color.rgb(255, 166, 0, 60) var color d_colorLo3 = color.rgb(255, 0, 0, 80) var color d_colorLo4 = color.rgb(255, 0, 0, 40) // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Inputs for TICK Chart โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // var string i_ticker = input.symbol(d_ticker, 'Ticker', group='symbol', inline='ti') var Hi_levels = "Aligned" var bool i_showTickHi = input.bool(true, 'Positive Tick', group='Hi_levels', inline='5') var int i_tickHi1 = input.int(d_L1, '', minval=0, group='Hi_levels', inline='4') var int i_tickHi2 = input.int(d_L2, '', minval=0, group='Hi_levels', inline='3') var int i_tickHi3 = input.int(d_L3, '', minval=0, group='Hi_levels', inline='2') var int i_tickHi4 = input.int(d_L4, '', minval=0, group ='Hi_levels', inline='1') var color i_colorHi1 = input.color(d_colorHi1, '', group ='Hi_levels', inline='1') var color i_colorHi2 = input.color(d_colorHi2, '', group ='Hi_levels', inline='2') var color i_colorHi3 = input.color(d_colorHi3, '', group ='Hi_levels', inline='3') var color i_colorHi4 = input.color(d_colorHi4, '', group ='Hi_levels', inline='4') var ZeroLevel = "Aligned" var color i_colorZero = input.color(d_colorZero, '', group='ZeroLevel', inline='1') var bool i_showZero = input.bool(true, 'Zero', group='ZeroLevel', inline='1') var Lo_levels = "Aligned" var bool i_showTickLo = input.bool(true, 'Negative', group='Lo_levels', inline='5') var int i_tickLo1 = input.int(-d_L1, '', maxval=0, group='Lo_levels', inline='4') var int i_tickLo2 = input.int(-d_L2, '', maxval=0, group='Lo_levels', inline='3') var int i_tickLo3 = input.int(-d_L3, '', maxval=0, group='Lo_levels', inline='2') var int i_tickLo4 = input.int(-d_L4, '', maxval=0, group='Lo_levels', inline='1') var color i_colorLo1 = input.color(d_colorLo1, '', group='Lo_levels', inline='1') var color i_colorLo2 = input.color(d_colorLo2, '', group='Lo_levels', inline='2') var color i_colorLo3 = input.color(d_colorLo3, '', group='Lo_levels', inline='3') var color i_colorLo4 = input.color(d_colorLo4, '', group='Lo_levels', inline='4') // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Functions โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // f_showLevel(_show, _level) => _show ? _level ? _level : na : na // Hide level when value is zero. // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Horizontal Plot Levels โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // var int tickhi1 = f_showLevel(i_showTickHi, i_tickHi1) var int tickhi2 = f_showLevel(i_showTickHi, i_tickHi2) var int tickhi3 = f_showLevel(i_showTickHi, i_tickHi3) var int tickhi4 = f_showLevel(i_showTickHi, i_tickHi4) var int zero = i_showZero ? 0 : na var int ticklo1 = f_showLevel(i_showTickLo, i_tickLo1) var int ticklo2 = f_showLevel(i_showTickLo, i_tickLo2) var int ticklo3 = f_showLevel(i_showTickLo, i_tickLo3) var int ticklo4 = f_showLevel(i_showTickLo, i_tickLo4) hline(tickhi4, 'High4', i_colorHi4) hline(tickhi3, 'High3', i_colorHi3, linewidth = 3, linestyle=hline.style_solid) hline(tickhi2, 'High2', i_colorHi2) hline(tickhi1, 'High1', i_colorHi1, display = display.none) hline(zero, 'Zero', i_colorZero, linewidth = 1, linestyle=hline.style_dashed) hline(ticklo1, 'Low1', i_colorLo1, display = display.none) hline(ticklo2, 'Low2', i_colorLo2) hline(ticklo3, 'Low3', i_colorLo3, linewidth = 3, linestyle=hline.style_solid) hline(ticklo4, 'Low4', i_colorLo4) // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Tick Above/ Below Close bar โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // bool _tcA = c < 0 bool _tcB = c > 0 color _ZT1 = _tcA ? color.rgb(255, 0, 0, 60) : na color _ZT2 = _tcB ? color.rgb(47, 255, 0, 60) : na _labcol = switch c < 0 => color.rgb(255, 0, 0, 60) c > 0 => color.rgb(47, 255, 0, 60) => color.white bool ShowLab = input.bool(true, 'Show Tick Closes Above 0 Triangles') if ShowLab lbl = label.new(bar_index, -1200) if _tcA label.set_text (lbl, "โ–ณ") label.set_color(lbl, color.rgb(255, 0, 0, 48)) label.set_style(lbl, label.style_text_outline) label.set_size (lbl, size.tiny) else label.delete(lbl) if ShowLab lbl2 = label.new(bar_index, 1200) if _tcB label.set_text (lbl2, "โ–ฝ") label.set_color(lbl2, color.rgb(98, 255, 0, 49)) label.set_style(lbl2, label.style_text_outline) label.set_size (lbl2, size.tiny) else label.delete(lbl2) p1=plot(c, title='EMA Tick', color=_ZT2, linewidth = 3, display = display.none) p2=plot(c, title='EMA Tick', color=_ZT1, linewidth = 3, display = display.none) _lab = label.new(bar_index, na, 'Price ' + str.tostring(close), color=_labcol, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar) label.delete(_lab[1]) // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Inputs โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” VOL โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // showExch = input.bool(defval = true, title = "Show Exchanges") showRatio = input.bool(defval = true, title = "Show VOLD Ratio") format_text(str) => str + '\n' t = ticker.new(syminfo.prefix, syminfo.ticker, session.regular) realS (t) => request.security(t, timeframe.period, close) NYSEuvol = realS ("USI:UVOL") NYSEdvol = realS ("USI:DVOL") NASDAQuvol = realS ("USI:UVOLQ") NASDAQdvol = realS ("USI:DVOLQ") NYSEratio = (NYSEuvol >= NYSEdvol) ? (NYSEuvol/NYSEdvol) : -(NYSEdvol/NYSEuvol) NASDAQratio = (NASDAQuvol >= NASDAQdvol) ? (NASDAQuvol/NASDAQdvol) : -(NASDAQdvol/NASDAQuvol) final_nasdaqvold = format_text( str.tostring(math.round(NASDAQratio, 2)) + ":1") final_nysevold = format_text( str.tostring(math.round(NYSEratio, 2)) + ":1") // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” ADD โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // showADD = input.bool(defval = true, title = "๐š‚๐š‘๐š˜๐š  ADV/DECL") _addny = request.security('USI:ADD', '1', close) _addnq = request.security('USI:ADDQ', '1', close) // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Tick โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // showHLtick = input.bool(defval = true, title = "Show High/Low Tick of Session") nySession = input.session(defval='0630-1300', title='New York Session') //set for PST isInSession(session) => barSessionTime = time(timeframe.period, session) inSession = not na(barSessionTime) inSession var float nySessionHigh = na var float nySessionLow = na var float nySessionOpen = na var float nySessionClose = na var bool isNYSessionStart = false isInNYSession = isInSession(nySession) if (isInNYSession) if (not isInNYSession[1]) nySessionHigh := h nySessionLow := l isNYSessionStart := true nySessionOpen := o else nySessionHigh := math.max(h, nySessionHigh[1]) nySessionLow := math.min(l, nySessionLow[1]) nySessionClose := c // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Colors โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // _colors1 = switch _addnq > 1500 => color.rgb(0, 255, 8) _addnq < -1500 => color.rgb(255, 0, 0) => color.white _colors2 = switch _addny > 1500 => color.rgb(0, 255, 8) _addny < -1500 => color.rgb(255, 0, 0) => color.white _colors3 = switch nySessionHigh > 1000 => color.rgb(0, 255, 8) nySessionHigh < -1000 => color.rgb(255, 0, 0) => color.white _colors4 = switch nySessionLow > 1000 => color.rgb(0, 255, 8) nySessionLow < -1000 => color.rgb(255, 0, 0) => color.white riskON1 = switch NASDAQratio >= 3 => color.rgb(0, 255, 8) NASDAQratio <= -3 => color.rgb(255, 0, 0) => color.white riskON2 = switch NYSEratio >= 3 => color.rgb(0, 255, 8) NYSEratio <= -3 => color.rgb(255, 0, 0) => color.white // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Inputs โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // _fontSize1 = input.string("Normal","๐Ÿ—š - Font Size", options = [ "Auto", "Tiny", "Small", "Normal", "Large", "Huge"]) _fontSize = switch _fontSize1 "Normal" => size.normal "Auto" => size.auto "Tiny" => size.tiny "Small" => size.small "Large" => size.large "Huge" => size.huge positionGo = input.string("Top Right", " Market Conditions - Table Position", options = ["Top Right", "Top Center", "Top Left", "Middle Right", "Middle Center", "Middle Left", "Bottom Right", "Bottom Center", "Bottom Left"]) tableposGo = switch positionGo "Top Right" => position.top_right "Top Center" => position.top_center "Top Left" => position.top_left "Middle Right" => position.middle_right "Middle Center" => position.middle_center "Middle Left" => position.middle_left "Bottom Right" => position.bottom_right "Bottom Center" => position.bottom_center "Bottom Left" => position.bottom_left // //barstate.islast //barstate.islastconfirmedhistory //last_bar_index if last_bar_index var table Display3 = table.new(tableposGo, 99, 99, bgcolor = color.rgb(54, 58, 69, 100), frame_width = 1, frame_color = color.rgb(255, 255, 255, 100)) if showExch table.cell(Display3, 1, 1,'NASDAQ -', bgcolor=color.rgb(255, 255, 255, 100), text_halign=text.align_right, text_color=color.gray, text_size=_fontSize, text_font_family = font.family_monospace) table.cell(Display3, 1, 2,'NYSE -', bgcolor=color.rgb(255, 255, 255, 100), text_halign=text.align_right, text_color=color.gray, text_size=_fontSize, text_font_family = font.family_monospace) if showRatio table.cell(Display3, 2, 1,'$แด แดสŸแด…:',bgcolor=color.rgb(255, 255, 255, 100), text_halign=text.align_right, text_color=color.gray, text_size=_fontSize, text_font_family = font.family_monospace) table.cell(Display3, 3, 1,final_nasdaqvold, bgcolor=color.rgb(255, 255, 255, 100),text_halign=text.align_right, text_color=riskON1, text_size=_fontSize, text_font_family = font.family_monospace) table.cell(Display3, 2, 2,'$แด แดสŸแด…:', bgcolor=color.rgb(255, 255, 255, 100), text_halign=text.align_right, text_color=color.gray, text_size=_fontSize, text_font_family = font.family_monospace) table.cell(Display3, 3, 2,final_nysevold, bgcolor=color.rgb(255, 255, 255, 100),text_halign=text.align_right, text_color= riskON2, text_size=_fontSize, text_font_family = font.family_monospace) if showADD table.cell(Display3, 5, 2, "$แด€แด…แด…:",text_halign = text.align_left,text_color = color.gray,text_size = _fontSize) table.cell(Display3, 6, 2, str.tostring(_addny,'#,###') ,text_halign = text.align_right,text_color =_colors2, text_size = _fontSize, text_font_family=font.family_monospace) table.cell(Display3, 5, 1, '$แด€แด…แด…วซ:',text_halign = text.align_left,text_color = color.gray,text_size = _fontSize) table.cell(Display3, 6, 1, str.tostring(_addnq, '#,###'),text_halign = text.align_right,text_color =_colors1 ,text_size = _fontSize,text_font_family=font.family_monospace) if showHLtick table.cell(Display3, 7, 1, 'แด›ษชแด„แด‹ แด…แด€ส/สœษชษขสœ:',text_halign = text.align_left,text_color = color.gray,text_size = _fontSize) table.cell(Display3, 8, 1, str.tostring(nySessionHigh, '#,####'),text_halign = text.align_right,text_color =_colors3 ,text_size = _fontSize,text_font_family=font.family_monospace) table.cell(Display3, 7, 2, 'แด›ษชแด„แด‹ แด…แด€ส/สŸแดแดก:',text_halign = text.align_left,text_color = color.gray,text_size = _fontSize) table.cell(Display3, 8, 2, str.tostring(nySessionLow, '#,###'),text_halign = text.align_right,text_color =_colors4 ,text_size = _fontSize,text_font_family=font.family_monospace)
VWAP Divergence | Flux Charts
https://www.tradingview.com/script/bcLxWaDF-VWAP-Divergence-Flux-Charts/
fluxchart
https://www.tradingview.com/u/fluxchart/
317
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ fluxchart //@version=5 indicator(title="VWAP Divergence | Flux Charts", shorttitle="VWAP Divergence | Flux Charts", overlay=true) hideonDWM = input(false, title="Hide VWAP on 1D or Above", group="VWAP Settings") divergenceLookback = input(5, title="Lookback Period", group="Divergence Settings", tooltip = "How long the lookback period is to determine whether the increase/decrease is enough to trigger a divergence") divergenceATRmultiplier = input.float(3, title="ATR Multiplier", group="Divergence Settings", tooltip = "How much the ATR is multiplied by to determine whether the increase/decrease over the last {Lookback bars} is enough to trigger a divergence.", step=0.1) bearishColor = input.color(color.red, title="VWAP down color", group="Visual Settings", inline="Colors") bullishColor = input.color(color.lime, title="VWAP up color", group="Visual Settings", inline="Colors") alternateColor = input(true, title="Trend Coloring", group="Visual Settings", tooltip = "Determines whether the VWAP line will alternate between red (decreasing) and green (increasing).") showVWAP = input(true, title="Show VWAP", group="Visual Settings") divergence_plot_size_input = input.string(defval = "Normal", title = "Divergence Plot Size", options = ["Small", "Normal", "Large"], group="Visual Settings") divergence_plot_size = divergence_plot_size_input == "Small" ? 3 : divergence_plot_size_input == "Normal" ? 5 : 7 var lastBullishDivergence = bar_index var lastBearishDivergence = bar_index var anchor = input.string(defval = "Session", title="Anchor Period", options=["Session", "Week", "Month", "Quarter", "Year", "Decade", "Century", "Earnings", "Dividends", "Splits"], group="VWAP Settings") src = input(title = "Source", defval = hlc3, group="VWAP Settings") offset = input(0, title="Offset", group="VWAP Settings") // showAlerts = input(true, title="Alerts Enabled", group="Alert Settings") bearishAlertSignal = input(true, title="Bearish divergence alerts", group="Alert Settings", inline = "Alert Confirmations") bullishAlertSignal = input(true, title="Bullish divergence alerts", group="Alert Settings", inline = "Alert Confirmations") if barstate.islast and ta.cum(volume) == 0 runtime.error("No volume is provided by the data vendor.") new_earnings = request.earnings(syminfo.tickerid, earnings.actual, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true) new_dividends = request.dividends(syminfo.tickerid, dividends.gross, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true) new_split = request.splits(syminfo.tickerid, splits.denominator, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true) isNewPeriod = switch anchor "Earnings" => not na(new_earnings) "Dividends" => not na(new_dividends) "Splits" => not na(new_split) "Session" => timeframe.change("D") "Week" => timeframe.change("W") "Month" => timeframe.change("M") "Quarter" => timeframe.change("3M") "Year" => timeframe.change("12M") "Decade" => timeframe.change("12M") and year % 10 == 0 "Century" => timeframe.change("12M") and year % 100 == 0 => false isEsdAnchor = anchor == "Earnings" or anchor == "Dividends" or anchor == "Splits" if na(src[1]) and not isEsdAnchor isNewPeriod := true float vwapValue = na if not (hideonDWM and timeframe.isdwm) [_vwap, _stdevUpper, _] = ta.vwap(src, isNewPeriod, 1) vwapValue := _vwap stdevAbs = _stdevUpper - _vwap plot(vwapValue, title="VWAP", color=showVWAP?(alternateColor?vwapValue > vwapValue[1]?#00ff0d:#ff0000:#ffffff):na, offset=offset, linewidth = 2) last5gain = high-low[divergenceLookback] last5loss = high[divergenceLookback]-low atr = ta.atr(14) gaps = false for i = 0 to divergenceLookback if math.abs(open[i] - close[i+1]) > atr gaps := true bullishDivergenceBool = close>close[1] and vwapValue[0]<vwapValue[1] and last5gain > atr*divergenceATRmultiplier and (bar_index - lastBullishDivergence > 15 or (ta.highest(high, 20)-ta.lowest(low, 20)>atr*2 and bar_index - lastBullishDivergence > 10)) if gaps == true bullishDivergenceBool := false if bullishDivergenceBool and bullishAlertSignal alert(message = "Bullish VWAP Divergence", freq = alert.freq_once_per_bar_close) // bullish divergence plot(bullishDivergenceBool ? low - atr*0.5:na, style = plot.style_circles, color=bullishColor, linewidth = 7, title = "Bullish Divergence Dot") if bullishDivergenceBool lastBullishDivergence := bar_index bearishDivergenceBool = close<close[1] and vwapValue[0]>vwapValue[1] and last5loss > atr*divergenceATRmultiplier and (bar_index - lastBearishDivergence > 15 or (ta.highest(high, 20)-ta.lowest(low, 20)>atr*2 and bar_index - lastBearishDivergence > 10)) if gaps == true bearishDivergenceBool := false if bearishDivergenceBool and bearishAlertSignal alert(message = "Bearish VWAP Divergence", freq = alert.freq_once_per_bar_close) // bearish divergence plot(bearishDivergenceBool ? high + atr*0.5:na, style = plot.style_circles, color=bearishColor, linewidth = divergence_plot_size, title = "Bearish Divergence Dot") if bearishDivergenceBool lastBearishDivergence := bar_index
Paytience Distribution
https://www.tradingview.com/script/OmGKZzAQ-Paytience-Distribution/
PaytienceIO
https://www.tradingview.com/u/PaytienceIO/
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/ // ยฉ PaytienceIO //@version=5 indicator("Paytience Distribution", max_boxes_count = 500, max_lines_count = 500) type points float start float end sq(source) => math.pow(source, 2) sinc(source, bandwidth) => if source == 0 1 else math.sin(math.pi * source / bandwidth) / (math.pi * source / bandwidth) sinc_filter(source, length)=> src_size = array.size(source) estimate_array = array.new<float>(src_size) float current_price = na for i = 0 to src_size - 1 float sum = 0 float sumw = 0 for j = 0 to src_size - 1 diff = i - j weight = sinc(diff, length) sum += array.get(source, j) * weight sumw += weight current_price := sum / sumw array.set(estimate_array, i, current_price >= 0 ? current_price : 0) estimate_array window_size = input.int(0, "Window Size", minval = 0, tooltip = "A window size of 0 means it just uses all of the data", group = "Main") scale = input.int(100, "Scale", minval = 20, maxval = 499) sample_window = input.int(99, "Resample Resolution", minval = 10) round = input.int(1, "Round Source", minval = 0, group = "Main") src = math.round(input.source(close, "Source", group = "Main"), round) minimum = input.int(0, "Minimum Value", minval = 0, tooltip = "This dictates the minimum value you want to account for in the distribution. From 0 to 100, 0 being the lowest and 100 being the highest.", group = "Main") smoothing = input.int(3, "Smoothing", minval = 1, maxval = 20, group = "Main") include_0 = input.bool(false, "Include 0", group = "Main") stdev_enable = input.bool(true, "Standard Deviation", "This is really only good for a source that is vaguely gaussian.", group = "Main") high_color = input.color(#00ff00, "Color", group = "Main", inline = "Colour") low_color = input.color(#FF0000, "", group = "Main", inline = "Colour") dev_color = input.color(color.blue, "Standard Deviation Color", group = "Main") use_rsi = input.bool(true, "Example Usage RSI", group = "Example") length = input.int(14, "RSI Length", minval = 1, group = "Example") rsi = math.round(ta.rsi(close, length), 1) var source_distribution = array.new<int>() var source_values = array.new<float>() var float source = 0 flag = use_rsi ? not na(rsi) : not na(src) if flag and barstate.isconfirmed source := use_rsi ? rsi : src if array.includes(source_values, source) index = array.indexof(source_values, source) array.set(source_distribution, index, array.get(source_distribution, index) + 1) else array.push(source_values, source) array.push(source_distribution, 1) window = (window_size >= 3 ? window_size : 5000) if array.size(source_values) > window array.shift(source_values) array.shift(source_distribution) boxes = array.new<box>(sample_window + 1) lines = array.new<line>(2) if flag and barstate.islast sorted_source_distribution = array.new<int>() sorted_source_values = array.new<float>() for i = 0 to array.size(source_values) - 1 index = array.indexof(source_values, array.max(source_values, i)) array.push(sorted_source_values, array.get(source_values, index)) array.push(sorted_source_distribution, array.get(source_distribution, index)) resampled_source_distribution = array.new<int>(sample_window + 1, 0) resampled_source_values = array.new<points>(sample_window + 1, points.new(0, 0)) chunk_size = math.ceil((array.size(sorted_source_values) - 1) / (sample_window + 1)) for i = 0 to sample_window start_idx = i * chunk_size end_idx = math.min((i + 1) * chunk_size - 1, array.size(sorted_source_values) - 1) total_distribution = 0 for j = start_idx to end_idx total_distribution += array.get(sorted_source_distribution, j) if end_idx >= array.size(sorted_source_values) - 1 break array.set(resampled_source_distribution, i, total_distribution) array.set(resampled_source_values, i, points.new(array.get(sorted_source_values, start_idx), array.get(sorted_source_values, end_idx))) filtered_distribution = smoothing > 1 ? sinc_filter(resampled_source_distribution, smoothing) : resampled_source_distribution normalized_source_distribution = array.new<float>(sample_window) if not include_0 max_index = array.indexof(resampled_source_distribution, array.max(resampled_source_distribution)) if array.get(resampled_source_values, max_index).start == 0 or array.get(resampled_source_values, max_index).end == 0 array.remove(resampled_source_values, max_index) array.remove(resampled_source_distribution, max_index) max = array.max(filtered_distribution) min = array.min(filtered_distribution, minimum) for i = 0 to sample_window - 1 array.set(normalized_source_distribution, i, math.max(0, (array.get(filtered_distribution, i) - min) / (max - min))) float weighted_sum = 0 float total_weight = 0 for i = 0 to array.size(normalized_source_distribution) - 1 mid_point = (array.get(resampled_source_values, i).start + array.get(resampled_source_values, i).end) / 2 weight = array.get(normalized_source_distribution, i) min_weight = array.min(normalized_source_distribution, minimum) not_zero_condition = array.get(resampled_source_values, i).start != include_0 ? 4.0e120: 0 and array.get(resampled_source_values, i).end != include_0 ? 4.0e120: 0 if weight > min_weight and not_zero_condition weighted_sum += (mid_point * weight) total_weight += weight else continue float weighted_mean = weighted_sum / total_weight float squared_weighted_diff_sum = 0.0 for i = 0 to array.size(normalized_source_distribution) - 1 mid_val = math.avg(array.get(resampled_source_values, i).start, array.get(resampled_source_values, i).end) weight = array.get(normalized_source_distribution, i) min_weight = array.min(normalized_source_distribution, minimum) not_zero_condition = array.get(resampled_source_values, i).start != include_0 ? 4.0e120 : 0 or array.get(resampled_source_values, i).end != include_0 ? 4.0e120: 0 if weight > min_weight and not_zero_condition squared_weighted_diff_sum += (weight * sq(mid_val - weighted_mean)) else continue float weighted_standard_deviation = math.sqrt(squared_weighted_diff_sum / total_weight) for i = 0 to array.size(normalized_source_distribution) - 1 value = array.get(resampled_source_values, i) weight = scale - int(array.get(normalized_source_distribution, i) * scale) colour = color.from_gradient(weight, 0, scale, high_color, low_color) not_zero_condition = value.start != include_0 ? 4.0e120 : 0 or value.end != include_0 ? 4.0e120: 0 if weight < scale and not_zero_condition array.set(boxes, i, box.new(bar_index + weight, value.end, bar_index + scale, value.start, colour, bgcolor = colour) ) peek = array.get(resampled_source_values, array.indexof(normalized_source_distribution, array.max(normalized_source_distribution))) mid_point_peek = math.avg(peek.start, peek.end) if stdev_enable stdev_top = line.new(bar_index, weighted_mean + weighted_standard_deviation, bar_index + scale, weighted_mean + weighted_standard_deviation, color = dev_color, width = 1) stdev_bot = line.new(bar_index, weighted_mean - weighted_standard_deviation, bar_index + scale, weighted_mean - weighted_standard_deviation, color = dev_color, width = 1) array.push(lines, stdev_top) array.push(lines, stdev_bot) linefill.new(stdev_top, stdev_bot, color.new(dev_color, 95)) if barstate.isconfirmed and flag for i = array.size(boxes) - 1 to 0 box.delete(array.get(boxes, i)) array.remove(boxes, i) for i = array.size(lines) - 1 to 0 line.delete(array.get(lines, i)) array.remove(lines, i) plot(use_rsi ? rsi : na, "Example RSI", #7E57C2) rsi_top = plot(use_rsi ? 70 : na, "Example Hline Top", color.gray) rsi_bot = plot(use_rsi ? 30 : na, "Example Hline Bottom", color.gray) fill(rsi_top, rsi_bot, color.new(#7E57C2, 90))
Ichimoku MA Bands
https://www.tradingview.com/script/HhPrPvNf-Ichimoku-MA-Bands/
Degen_Crypto
https://www.tradingview.com/u/Degen_Crypto/
39
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 indicator("Ichimoku MA Bands", overlay = true) src = close thirteenEma = ta.ema(close, 13) tl_13ema = plot(thirteenEma, color=color.teal, title='13 EMA',linewidth = 1, display = display.none) twentyfiveEma = ta.ema(close, 25) tl_25ema = plot(twentyfiveEma, color=color.fuchsia, title='25 EMA',linewidth = 1, display = display.none) emaColorFill_1326 = thirteenEma > twentyfiveEma ? color.new(color.blue,65) : thirteenEma < twentyfiveEma ? color.new(color.white,80) : color.new(color.yellow,35) fill(tl_13ema, tl_25ema, title='Trend Cloud Colors', color= emaColorFill_1326) ma_ATR = ta.atr(5) nLoss = 3 * ma_ATR ma_ATRTrailingStop = 0.0 ma_ATRTrailingStop := src > nz(ma_ATRTrailingStop[1], 0) and src[1] > nz(ma_ATRTrailingStop[1], 0) ? math.max(nz(ma_ATRTrailingStop[1]), src - nLoss) : src < nz(ma_ATRTrailingStop[1], 0) and src[1] < nz(ma_ATRTrailingStop[1], 0) ? math.min(nz(ma_ATRTrailingStop[1]), src + nLoss) : src > nz(ma_ATRTrailingStop[1], 0) ? src - nLoss : src + nLoss ema = ta.ema(src,1) ma_ATR_above = ta.crossover(ema, ma_ATRTrailingStop) ma_ATR_below = ta.crossover(ma_ATRTrailingStop, ema) ema_above = ema > close ema_below = ema < close atr_buy = src > ma_ATRTrailingStop and ma_ATR_above atr_sell = src < ma_ATRTrailingStop and ma_ATR_below plotshape(atr_buy, title = "Buy Alert", text = 'LONG', style = shape.triangleup, location = location.belowbar, color= color.green, textcolor = color.white, size = size.tiny) plotshape(atr_sell, title = "Sell Alert", text = 'SHORT', style = shape.triangledown, location = location.abovebar, color= color.red, textcolor = color.white, size = size.tiny) cumu = 'Full Data' denom = 'Base Currency' binance = true binance2 = true binance3 = true chg_b = 50 mex = syminfo.basecurrency=='BTC' ? 'XBT' : string(syminfo.basecurrency) [oid1, oi1] = request.security('BINANCE' + ":" + string(syminfo.basecurrency) + 'USDT.P_OI', timeframe.period, [close-close[1], close], ignore_invalid_symbol = true) [oid2, oi2] = request.security('BINANCE' + ":" + string(syminfo.basecurrency) + 'USD.P_OI', timeframe.period, [close-close[1], close], ignore_invalid_symbol = true) [oid3, oi3] = request.security('BINANCE' + ":" + string(syminfo.basecurrency) + 'BUSD.P_OI', timeframe.period, [close-close[1], close], ignore_invalid_symbol = true) deltaOI = (binance ? nz(oid1,0) : 0) + (binance2 ? nz(oid2,0)/close : 0) + (binance3 ? nz(oid3,0) : 0) OI = (binance ? nz(oi1,0) : 0) + (binance2 ? nz(oi2,0)/close : 0) + (binance3 ? nz(oi3,0) : 0) // Conditions for positions entering and exiting priceUP = close>open priceDOWN = close<open oiUP = deltaOI>0 oiDOWN = deltaOI<0 newlongs = oiUP and priceUP rektlongs = oiDOWN and priceDOWN newshorts = oiUP and priceDOWN rektshorts = oiDOWN and priceUP vrc = cumu=='Visible Range' ? time > chart.left_visible_bar_time and time <= chart.right_visible_bar_time : true // Cumulation of positions entering and exiting longs_entering = ta.cum(newlongs and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0) longs_exiting = ta.cum(rektlongs and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0) shorts_entering = ta.cum(newshorts and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0) shorts_exiting = ta.cum(rektshorts and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0) //CVD HighLow = high-low low_close = close>open ? open-low : close-low up_close = close>open ? high-close : high-open candle_size = HighLow - (up_close + low_close) candle_size_perchentage = candle_size/HighLow low_close_perchentage = low_close/HighLow up_close_perchentage = up_close/HighLow bull_volume = close>open ? (candle_size_perchentage + (up_close_perchentage + low_close_perchentage)/2)*volume : ((up_close_perchentage + low_close_perchentage)/2)* volume bear_volume = close<open ? (candle_size_perchentage + (up_close_perchentage + low_close_perchentage)/2)*volume : ((up_close_perchentage + low_close_perchentage)/2)* volume //TIMEFRAME CALCULATIONS adding_bull_volume_1 = ta.ema(bull_volume,14) adding_bear_volume_1 = ta.ema(bear_volume,14) cvd_delta = adding_bull_volume_1 - adding_bear_volume_1 status = "" status_color = color.white if ((OI-OI[chg_b]) > 0) and (close > close[1]) and (cvd_delta > 0) status := "Longs Opening" status_color := color.green else if ((OI-OI[chg_b]) > 0) and (close < close[1]) and (cvd_delta < 0) status := "Shorts Opening" status_color := color.red else if((OI-OI[chg_b]) < 0) and (close < close[1]) and (cvd_delta < 0) status := "Longs Closing" status_color := color.red else if((OI-OI[chg_b]) < 0) and (close > close[1]) and (cvd_delta > 0) status := "Shorts Closing" status_color := color.green else if (close < close[1]) and (cvd_delta > 0) status := "Bearish Divergence" status_color := color.red else if (close > close[1]) and (cvd_delta < 0) status := "Bullish Divergence" status_color := color.green else if ((OI-OI[chg_b]) > 0) and (close > close[1]) status := "Longs Opening (Weak)" status_color := color.yellow else if ((OI-OI[chg_b]) > 0) and (close < close[1]) status := "Shorts Opening (Weak)" status_color := color.yellow else if((OI-OI[chg_b]) < 0) and (close < close[1]) status := "Longs Closing (Weak)" status_color := color.yellow else if((OI-OI[chg_b]) < 0) and (close > close[1]) status := "Shorts Closing (Weak)" status_color := color.yellow else status := "Neutral" //Generating tables for Stats var infoTable = table.new(position = position.top_right, columns = 4, rows = 5, bgcolor=color.new(#696969, 80),border_width = 1, border_color = color.black) if barstate.islast table.cell(table_id = infoTable, column = 0, row = 0, text = "Dynamic Stop Loss:", text_color = color.white, text_size=size.auto) table.cell(table_id = infoTable, column = 1, row = 0, text = "$ "+str.tostring(ma_ATRTrailingStop,"0.0000"), text_color = status_color, text_size=size.auto) table.cell(table_id = infoTable, column = 0, row = 1, text = str.tostring(status), text_color = status_color) table.merge_cells(infoTable, 0, 1, 1, 1) barcolor( (close > ma_ATRTrailingStop) and (close > twentyfiveEma) ? color.green : (close < ma_ATRTrailingStop) and (close < twentyfiveEma)? color.red : color.yellow , title = 'Candle Colors' ) if(atr_buy) alert("Long Alert for "+syminfo.tickerid, alert.freq_once_per_bar_close) if(atr_sell) alert("Short Alert for "+syminfo.tickerid, alert.freq_once_per_bar_close) if(ta.cross(close,ma_ATRTrailingStop)) alert("Dynamic Stop Level Reached", alert.freq_once_per_bar)
VWAP with signals
https://www.tradingview.com/script/6zrD1WlS-VWAP-with-signals/
qwertytehseen
https://www.tradingview.com/u/qwertytehseen/
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/ // ยฉ ZenAndTheArtOfTrading / www.PineScriptMastery.com // @version=5 indicator("VWAP & VWMA", overlay=true) // Import libraries import ZenAndTheArtOfTrading/ZenLibrary/2 as zen // Get user input vwapType = input.string(title="VWAP Type", defval="VWAP", options=["VWAP", "VWMA"]) vwmaLength = input.int(title="VWMA Length", defval=20) // Get VWAP vwapValue = vwapType == "VWAP" ? ta.vwap : ta.vwma(hlc3, vwmaLength) // Detect VWAP Filter bull_filter = close > vwapValue and close[1] > vwapValue bear_filter = close < vwapValue and close[1] < vwapValue // Prepare filters swingLow = low == ta.lowest(low, 4) or low[1] == ta.lowest(low, 4) swingHigh = high == ta.highest(high, 4) or high[1] == ta.highest(high, 4) // Detect engulfing candles bull_ec = zen.isBullishEC() and swingLow bear_ec = zen.isBearishEC() and swingHigh // Detect valid trading signals longSignal = bull_filter and bull_ec shortSignal = bear_filter and bear_ec // Draw signals to the chart plot(vwapValue, color=close > vwapValue ? color.green : color.red, linewidth=2) plotshape(longSignal, style=shape.triangleup, color=color.green, location=location.belowbar) plotshape(shortSignal, style=shape.triangledown, color=color.red, location=location.abovebar) // Trigger alerts alertcondition(longSignal or shortSignal, title="VWAP Alert!", message="VWAP Alert For {{ticker}}")
Supply and Demand Anchored [LuxAlgo]
https://www.tradingview.com/script/gYaSQVds-Supply-and-Demand-Anchored-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
1,948
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("Supply and Demand Anchored [LuxAlgo]", "LuxAlgo - Supply and Demand Anchored", overlay = true, max_boxes_count = 500, max_bars_back = 500) //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ per = input.float(10., 'Threshold %', minval = 0, maxval = 100) div = input.int(50, 'Resolution' , minval = 2, maxval = 500) tf = input.timeframe('', 'Intrabar TF') //Colors showSupply = input(true ,'Supplyย ย ย ย ย ย ย ย ', inline = 'supply', group = 'Style') supplyCss = input(#2157f3, '' , inline = 'supply', group = 'Style') supplyArea = input(true ,'Area' , inline = 'supply', group = 'Style') supplyAvg = input(true ,'Average' , inline = 'supply', group = 'Style') supplyWavg = input(true ,'Weighted' , inline = 'supply', group = 'Style') showEqui = input(true ,'Equilibrium' , inline = 'equi' , group = 'Style') equiCss = input(color.gray, '' , inline = 'equi' , group = 'Style') equiAvg = input(true ,'Average' , inline = 'equi' , group = 'Style') equiWavg = input(true ,'Weighted' , inline = 'equi' , group = 'Style') showDemand = input(true ,'Demandย ย ย ย ' , inline = 'demand', group = 'Style') demandCss = input(#ff5d00, '' , inline = 'demand', group = 'Style') demandArea = input(true ,'Area' , inline = 'demand', group = 'Style') demandAvg = input(true ,'Average' , inline = 'demand', group = 'Style') demandWavg = input(true ,'Weighted' , inline = 'demand', group = 'Style') //Anchors timeLeft = input.time(0, confirm = true) timeRight = input.time(0, confirm = true) //-----------------------------------------------------------------------------} //UDT's //-----------------------------------------------------------------------------{ type bin float lvl float prev float sum float prev_sum float csum float avg bool isreached type area box bx line avg line wavg //-----------------------------------------------------------------------------} //Functions //-----------------------------------------------------------------------------{ n = bar_index get_hlv()=> [high, low, volume] method set_area(area id, x1, top, btm, avg, wavg, showArea, showAvg, showWavg)=> if showArea id.bx.set_lefttop(x1, top) id.bx.set_rightbottom(n, btm) if showAvg id.avg.set_xy1(x1, avg) id.avg.set_xy2(n, avg) if showWavg id.wavg.set_xy1(x1, wavg) id.wavg.set_xy2(n, wavg) //-----------------------------------------------------------------------------} //Main variables //-----------------------------------------------------------------------------{ var max = 0. var min = 0. var x1 = 0 var csum = 0. //Intrabar data [h, l, v] = request.security_lower_tf(syminfo.tickerid, tf, get_hlv()) //Init on left bar if time == timeLeft max := high min := low csum := volume x1 := n else if time <= timeRight //Accumulate max := math.max(high, max) min := math.min(low, min) csum += volume //-----------------------------------------------------------------------------} //Set zones //-----------------------------------------------------------------------------{ var supply_area = area.new( box.new(na, na, na, na, na, bgcolor = color.new(supplyCss, 80), extend = extend.right) , line.new(na, na, na, na, color = supplyCss, extend = extend.right) , line.new(na, na, na, na, color = supplyCss, style = line.style_dashed, extend = extend.right)) var demand_area = area.new( box.new(na, na, na, na, na, bgcolor = color.new(demandCss, 80), extend = extend.right) , line.new(na, na, na, na, color = demandCss, extend = extend.right) , line.new(na, na, na, na, color = demandCss, style = line.style_dashed, extend = extend.right)) var equi = line.new(na, na, na, na, color = equiCss, extend = extend.right) var wequi = line.new(na, na, na, na, color = equiCss, style = line.style_dashed, extend = extend.right) var float supply_wavg = na var float demand_wavg = na if time == timeRight r = (max - min) / div supply = bin.new(max, max, 0, 0, 0, 0, false) demand = bin.new(min, min, 0, 0, 0, 0, false) //Loop trough intervals for i = 0 to div-1 supply.lvl -= r demand.lvl += r //Accumulated volume column if not supply.isreached and showSupply and supplyArea box.new(x1, supply.prev, x1 + int(supply.sum / csum * (n - x1)), supply.lvl, na , bgcolor = color.new(supplyCss, 50)) if not demand.isreached and showDemand and demandArea box.new(x1, demand.lvl, x1 + int(demand.sum / csum * (n - x1)), demand.prev, na , bgcolor = color.new(demandCss, 50)) //Loop trough bars for j = 0 to (n - x1)-1 //Loop trough intrabars for k = 0 to (v[j]).size()-1 //Accumulate if within upper internal supply.sum += (h[j]).get(k) > supply.lvl and (h[j]).get(k) < supply.prev ? (v[j]).get(k) : 0 supply.avg += supply.lvl * (supply.sum - supply.prev_sum) supply.csum += supply.sum - supply.prev_sum supply.prev_sum := supply.sum //Accumulate if within lower interval demand.sum += (l[j]).get(k) < demand.lvl and (l[j]).get(k) > demand.prev ? (v[j]).get(k) : 0 demand.avg += demand.lvl * (demand.sum - demand.prev_sum) demand.csum += demand.sum - demand.prev_sum demand.prev_sum := demand.sum //Test if supply accumulated volume exceed threshold and set box if supply.sum / csum * 100 > per and not supply.isreached avg = math.avg(max, supply.lvl) supply_wavg := supply.avg / supply.csum //Set Box/Level coordinates if showSupply supply_area.set_area(x1, max, supply.lvl, avg, supply_wavg, supplyArea, supplyAvg, supplyWavg) supply.isreached := true //Test if demand accumulated volume exceed threshold and set box if demand.sum / csum * 100 > per and not demand.isreached and showDemand avg = math.avg(min, demand.lvl) demand_wavg := demand.avg / demand.csum //Set Box/Level coordinates if showDemand demand_area.set_area(x1, demand.lvl, min, avg, demand_wavg, demandArea, demandAvg, demandWavg) demand.isreached := true if supply.isreached and demand.isreached break if supply.isreached and demand.isreached and showEqui //Set equilibrium if equiAvg avg = math.avg(max, min) equi.set_xy1(x1, avg) equi.set_xy2(n, avg) //Set weighted equilibrium if equiWavg wavg = math.avg(supply_wavg, demand_wavg) wequi.set_xy1(x1, wavg) wequi.set_xy2(n, wavg) break supply.prev := supply.lvl demand.prev := demand.lvl //-----------------------------------------------------------------------------}
TP-Plus Indicator
https://www.tradingview.com/script/WlqUOd1g/
nashuald
https://www.tradingview.com/u/nashuald/
24
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ nashuald //@version=5 indicator("TP-Plus Indicator", shorttitle = "TPI+", overlay = true ) period = input(20, "Fast Period") periodSlow = input(40, "Slow Period") priceSrc = input.source(hlcc4, "Source") // minTrendStrength = input(10, "Min Trend Strength") // minTrendLength = input(12, "Min trend length") emaPeriod = 18 // input(18, "EMA Period (Filter)") mult = 1.5 rangePercent = 95 // Calculates slope linearRegFunc(src, period) => float sumX = 0 float sumY = 0 float sumXY = 0 float sumXX = 0 float sumYY = 0 float yMax = ta.highest(src, period) float yMin = ta.lowest(src, period) float factor = 1.0 / (yMax[0] - yMin[0]) float y = 0 for i = 0 to period sumX += i y := (src[i] - yMin) * period * factor sumY += y sumXY += i * y sumXX += i * i float meanX = sumX / period float meanY = sumY / period float numerador = 0 float denominador = 0 for i = 0 to period y := (src[i] - yMin) * period * factor numerador += (i - meanX) * (y - meanY) denominador += math.pow(period - meanX, 2) float slope = numerador / denominador // float intercept = meanY - slope * meanX slope float[] vals = array.new_float() for i = 0 to period array.push(vals, open[i]) array.push(vals, high[i]) array.push(vals, low[i]) array.push(vals, close[i]) sma = vals.avg() stdev = vals.stdev() top = sma + mult * stdev bottom = sma - mult * stdev percent = (open > bottom and open < top ? 1 : 0) + (high > bottom and high < top ? 1 : 0) + (low > bottom and low < top ? 1 : 0) + (close > bottom and close < top ? 1 : 0) percent := 100 * percent / 4 float slopePrice = linearRegFunc(priceSrc, period) float rawAngle = -math.atan(slopePrice) * 180 / math.pi float angle = ta.sma(rawAngle, 5) float slopePriceSlow = linearRegFunc(priceSrc, periodSlow) float rawAngleSlow = -math.atan(slopePriceSlow) * 180 / math.pi float angleSlow = ta.sma(rawAngleSlow, 5) string labelText = "" int cont = 0 for i = 0 to period if angle[i] > angle[i+1] cont += 1 else if angle[i] <= angle[i+1] cont -= 1 ema = ta.ema(close, emaPeriod) createLine = false max = ta.highest(high, periodSlow)[0] min = ta.lowest(low, periodSlow)[0] float angleRange = 8 if math.abs(angleSlow[0] - angle[0]) < angleRange and angle[0] > -angleRange and angle[0] < angleRange and angleSlow[0] > -angleRange and angleSlow[0] < angleRange createLine := true // it draws top and bottom levels if createLine is true if createLine[0] and createLine[0] != createLine[1] line.new(bar_index-periodSlow, max, bar_index + periodSlow, max, color=color.white) line.new(bar_index-periodSlow, min, bar_index + periodSlow, min, color=color.white)
NumberOfVisibleBars
https://www.tradingview.com/script/52F31Y58-NumberOfVisibleBars/
mentalRock19315
https://www.tradingview.com/u/mentalRock19315/
9
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ mentalRock19315 //@version=5 // @description TODO: add library description here library("NumberOfVisibleBars",true) // @function Calculates the number of visible bars on the user screen // @param No paramters needed // @returns The numbers of visible bars on the user screen (int) export NumberOfVisibleBars() => start_time = chart.left_visible_bar_time // get unix time in milli seconds end_time = chart.right_visible_bar_time resolution = timeframe.period Visibles_bars = 0 second_divider = 0 if str.contains(resolution, "S") if str.length(resolution) == 1 second_divider := 1 else second_divider := int(str.tonumber(str.substring(resolution, 0,str.length(resolution)-1))) else if str.contains(resolution, "D") if str.length(resolution) == 1 second_divider := 60*60*24 else second_divider := int(str.tonumber(str.substring(resolution, 0,str.length(resolution)-1)))*60*60*24 else if str.contains(resolution, "W") if str.length(resolution) == 1 second_divider := 60*60*24*7 else second_divider := int(str.tonumber(str.substring(resolution, 0,str.length(resolution)-1)))*60*60*24*7 else if str.contains(resolution, "M") if str.length(resolution) == 1 second_divider := 60*60*24*365/12 else second_divider := int(str.tonumber(str.substring(resolution, 0,str.length(resolution)-1)))*60*60*24*365/12 else if str.length(resolution) == 1 second_divider := 60 else second_divider := int(str.tonumber(resolution)*60) if second_divider > 0 Visibles_bars := int((end_time-start_time)/1000/second_divider + 1) Visibles_bars
L.S.C : CF-SW ORG ORS ORI
https://www.tradingview.com/script/sbsUUmGk-L-S-C-CF-SW-ORG-ORS-ORI/
devilpretnd
https://www.tradingview.com/u/devilpretnd/
46
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ devilpretnd //@version=5 indicator("L.S.C : CF-SW ORG ORS ORI", overlay=true, max_boxes_count=500, max_labels_count=500) //////////////////////////////////////////////////////////// SETTING showORG = input(true,title="Show ORG [ Order Release Gap ]",group="ORG") bullORGColor = input.color(color.new(#244a8d, 47), title="Bullish ORG:",inline="i_1",group="ORG") bearORGColor = input.color(color.new(#df3535, 66),title="Bearish ORG:",inline="i_2",group="ORG") //////////////////////////////////////////////////////////// CFSW var bool inSwingLow = false var bool inSwingHigh = false var int EL = 0 var int EH = 0 destroyedHigh = close > high[1] destroyedLow = close < low[1] CFSWL = destroyedHigh and EH == 0 CFSWH = destroyedLow and EL == 0 if CFSWH EH := 0 EL := 1 inSwingLow := true inSwingHigh := false if CFSWL EH := 1 EL := 0 inSwingLow := false inSwingHigh := true //////////////////////////////////////////////////////////// ORG var box bullOrgBox = na var box bearOrgBox = na bullORG = high[2] < low bearORG = low[2] > high if bullORG and showORG bullOrgBox := box.new(bar_index-2, low,bar_index,high[2], bgcolor=bullORGColor, border_color=na) if bearORG and showORG bearOrgBox := box.new(bar_index-2, low[2],bar_index,high, bgcolor=bearORGColor, border_color=na) //////////////////////////////////////////////////////////// ORS var color ORScandleColor = na bullORS = low > low[1] and low[1] < low[2] bearORS = high < high[1] and high[1] > high[2] if inSwingHigh and bullORS ORScandleColor := bullORS ? color.rgb(86, 153, 240, 11) : na else ORScandleColor := na if inSwingLow and bearORS ORScandleColor := bearORS ? color.rgb(86, 153, 240, 11) : na //////////////////////////////////////////////////////////// ORI var color ORIcandleColor = na bullORI = high < high[1] and low > low[1] bearORI = low > low[1] and high < high[1] if inSwingHigh and bullORI ORIcandleColor := bullORI ? color.rgb(255, 255, 255) : na else ORIcandleColor := na if inSwingLow and bearORI ORIcandleColor := bearORI ? color.rgb(255, 255, 255) : na //////////////////////////////////////////////////////////// ORI & ORS //////////////////////////////////////////////////////////// PLOT barcolor(ORScandleColor, offset=-1, title = 'ORS [ Order Release Sweep ]') barcolor(ORIcandleColor, offset=-1, title = 'ORI [ Order Release Internal ]') plotshape(CFSWH, title='Show CF Swing High :', style=shape.cross, location=location.abovebar, color=color.rgb(76, 213, 255), size = size.tiny) plotshape(CFSWL, title='Show CF Swing Low :', style=shape.cross, location=location.belowbar, color=color.rgb(255, 244, 92), size = size.tiny)
Bpa
https://www.tradingview.com/script/n7VhN7EY-Bpa/
yohtza
https://www.tradingview.com/u/yohtza/
35
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ yohtza //@version=5 // @description library of Brooks Price Action concepts library("Bpa", overlay=true) // @function check if the bar is a breakout based on the specified conditions // @param atr atr value // @param high high price // @param low low price // @param close close price // @param open open price // @param tail decimal value for a percent that represent the size of the tail of the bar that cant be preceeded to be considered strong close // @param size decimal value for a percent that represents by how much the breakout bar should be bigger than others to be considered one // @returns boolean value, true if breakout bar, false otherwise export isBreakoutBar(float atr, float high, float low, float close, float open, float tail, float size) => open < close ? ((high - close) / (high - low)) < tail and (high - low) > size * atr : open > close ? ((close - low) / (high - low)) < tail and (high - low) > size * atr : false // @function check if bull microchannel // @returns boolean value, true if microchannel bar, false otherwise export bullMicrochannel() => low > low[1] and low[1] > low[2] // @function check if bear microchannel // @returns boolean value, true if microchannel, false otherwise export bearMicrochannel() => high < high[1] and high[1] < high[2] //@function check if the bar has a strong close based on the length of tail // @param tail decimal value representing the length of the tail // @returns boolean, true if strong close, false otherwise export isStrongClose(float tail) => open < close ? ((high - close) / (high - low)) < tail : open > close ? ((close - low) / (high - low)) < tail : false // @function check if the bar is a breakout based on the specified conditions // @param atr atr value // @param tail decimal value for a percent that represent the size of the tail of the bar that cant be preceeded to be considered strong close // @param size decimal value for a percent that represents by how much the breakout bar should be bigger than others to be considered one // @returns boolean value, true if breakout bar, false otherwise export isBreakoutBar2(float atr, float tail, float size) => open < close ? ((high - close) / (high - low)) < tail and (high - low) > size * atr : open > close ? ((close - low) / (high - low)) < tail and (high - low) > size * atr : false // @function check if the bar is breaking out above a specified number of previous bars // @param lookback number of previous bars to lookback // @returns boolean value export breakoutAbove(int lookback) => highestClose = ta.highest(close, lookback) highestHigh = ta.highest(high, lookback) close > highestHigh[1] and close == highestClose // @function check if the bar is breaking below a specified number of previous bars // @param lookback number of previous bars to lookback // @returns boolean value export breakoutBelow(int lookback) => lowestClose = ta.lowest(close, lookback) lowestLow = ta.lowest(low, lookback) close < lowestLow[1] and close == lowestClose // @function check if there's followthrough after a breakout // @param atr value for breakout bar // @param tail decimal value for a percent that represent the size of the tail of the bar that cant be preceeded to be considered strong close // @param size decimal value for a percent that represents by how much the breakout bar should be bigger than others to be considered one // @returns boolean value export breakoutFollowthrough(float atr, float tail, float size) => open[1] < close[1] ? ((high[1] - close[1]) / (high[1] - low[1])) < tail and (high[1] - low[1]) > size * atr and open < close : open[1] > close[1] ? ((close[1] - low[1]) / (high[1] - low[1])) < tail and (high[1] - low[1]) > size * atr and open > close : false // @function check for minimal followthrough needed after breakout // @returns boolean export minFollowthrough() => open[1] < close[1] ? open < close : open[1] > close[1] ? open > close : false // @function check if the bar is a trend bar // @returns boolean export isTrendBar()=> math.abs(open-close) / (high - low) > 0.5 // @function check if the bar is a doji bar // @returns boolean export isDoji() => math.abs(open-close) / (high - low) < 0.5 // @function check if the bar is a bull trend bar // @returns boolean export isBullTrendBar()=> math.abs(open-close) / (high - low) > 0.5 and open < close // @function check if the bar is a bear trend bar // @returns boolean export isBearTrendBar()=> math.abs(open-close) / (high - low) > 0.5 and open > close
GP - Long Short Scanner
https://www.tradingview.com/script/OT9xOPjC/
gokhanpirnal
https://www.tradingview.com/u/gokhanpirnal/
228
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ gokhanpirnal //@version=5 indicator("GP - Long Short Scanner",shorttitle = 'GP - Long Short Scanner', overlay = true, max_labels_count=500) long = input(title='TSI Long Length', defval=1) short = input(title='TSI Short Length', defval=1) signal = input(title='TSI Signal Length', defval=2) len = input.int(2, minval=1, title='RSI Length') priceopen = open double_smoothopen(srcopen, long, short) => fist_smoothopen = ta.ema(srcopen, long) ta.ema(fist_smoothopen, short) pcopen = ta.change(priceopen) double_smoothed_pcopen = double_smoothopen(pcopen, long, short) double_smoothed_abs_pcopen = double_smoothopen(math.abs(pcopen), long, short) tsi_valueopen = 100 * (double_smoothed_pcopen / double_smoothed_abs_pcopen) srcopen = input(open, 'Source') upopen = ta.rma(math.max(ta.change(srcopen), 0), len) downopen = ta.rma(-math.min(ta.change(srcopen), 0), len) rsiopen = downopen == 0 ? 100 : upopen == 0 ? 0 : 100 - 100 / (1 + upopen / downopen) totalopen = tsi_valueopen + ta.ema(tsi_valueopen, signal) + rsiopen pricehigh = high double_smoothhigh(srchigh, long, short) => fist_smoothhigh = ta.ema(srchigh, long) ta.ema(fist_smoothhigh, short) pchigh = ta.change(pricehigh) double_smoothed_pchigh = double_smoothhigh(pchigh, long, short) double_smoothed_abs_pchigh = double_smoothhigh(math.abs(pchigh), long, short) tsi_valuehigh = 100 * (double_smoothed_pchigh / double_smoothed_abs_pchigh) srchigh = input(high, 'Source') uphigh = ta.rma(math.max(ta.change(srchigh), 0), len) downhigh = ta.rma(-math.min(ta.change(srchigh), 0), len) rsihigh = downhigh == 0 ? 100 : uphigh == 0 ? 0 : 100 - 100 / (1 + uphigh / downhigh) totalhigh = tsi_valuehigh + ta.ema(tsi_valuehigh, signal) + rsihigh pricelow = low double_smoothlow(srclow, long, short) => fist_smoothlow = ta.ema(srclow, long) ta.ema(fist_smoothlow, short) pclow = ta.change(pricelow) double_smoothed_pclow = double_smoothlow(pclow, long, short) double_smoothed_abs_pclow = double_smoothlow(math.abs(pclow), long, short) tsi_valuelow = 100 * (double_smoothed_pclow / double_smoothed_abs_pclow) srclow = input(low, 'Source') uplow = ta.rma(math.max(ta.change(srclow), 0), len) downlow = ta.rma(-math.min(ta.change(srclow), 0), len) rsilow = downlow == 0 ? 100 : uplow == 0 ? 0 : 100 - 100 / (1 + uplow / downlow) totallow = tsi_valuelow + ta.ema(tsi_valuelow, signal) + rsilow priceclose = close double_smoothclose(srcclose, long, short) => fist_smoothclose = ta.ema(srcclose, long) ta.ema(fist_smoothclose, short) pcclose = ta.change(priceclose) double_smoothed_pcclose = double_smoothclose(pcclose, long, short) double_smoothed_abs_pcclose = double_smoothclose(math.abs(pcclose), long, short) tsi_valueclose = 100 * (double_smoothed_pcclose / double_smoothed_abs_pcclose) srcclose = input(close, 'Source') upclose = ta.rma(math.max(ta.change(srcclose), 0), len) downclose = ta.rma(-math.min(ta.change(srcclose), 0), len) rsiclose = downclose == 0 ? 100 : upclose == 0 ? 0 : 100 - 100 / (1 + upclose / downclose) totalclose = (tsi_valueclose + ta.ema(tsi_valueclose, signal) + rsiclose) //col1=(totalclose[0]>totalopen[0]?color.rgb(0,138,138,0):color.rgb(255,70,70,0)) // plotcandle(totalopen, totalhigh, totallow, totalclose, title='Title', color=col1,wickcolor=col1,bordercolor=col1) a = array.from(totalopen, totalhigh, totallow, totalclose) mindata = array.min(a, 0) maksdata = array.max(a, 0) totalmin=(mindata[0]+totalclose[0]) totalmaks=(maksdata[0]+totalclose[0]) longsart1=(totalmin[1]<=(-390)?1:0) longsart2=(mindata[1]==totalclose[1]?1:0) longsart3=(mindata[0]<totalclose[0]?1:0) shortsart1=(totalmaks[1]>=587?1:0) shortsart2=(maksdata[1]==totalclose[1]?1:0) shortsart3=(maksdata[0]>totalclose[0]?1:0) minplot=(longsart1+longsart2+longsart3) maksplot=(shortsart1+shortsart2+shortsart3) // plot(minplot[0],title ='Single Long Line',color=#00ff00 ) // plot(maksplot,title="Single Short Line",color=#00ff00,linewidth = 1) EnterLong=(minplot[0]>2.9) EnterShort=(maksplot[0]>2.9) plotshape(EnterLong, title='Long Alarm', text='Long', style=shape.labelup, location=location.belowbar, color=color.rgb(0,255,0,0), size=size.tiny, textcolor=color.new(#000000, 0)) plotshape(EnterShort, title='Short Alarm', text='Short', style=shape.labeldown, location=location.abovebar, color=color.rgb(255,0,0,0), size=size.tiny, textcolor=color.new(#ffffff, 0)) alertcondition(EnterShort, title="SHORT Alarm", message="SHORT Alarm") alertcondition(EnterLong , title="LONG Alarm" , message="LONG Alarm")
Price Band
https://www.tradingview.com/script/hwOlpH2l-Price-Band/
vikasrangkapoor
https://www.tradingview.com/u/vikasrangkapoor/
6
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ vikasrangkapoor //@version=5 indicator(title = "Price Band", shorttitle="VRKPB", overlay=true, timeframe="", timeframe_gaps=true) length = input(title="Length", defval=25) offset = input(title="Offset", defval=0) src = input(close, title="source") lsma = ta.linreg(src, length, offset) plot(lsma)
base16
https://www.tradingview.com/script/2s7AlPIW-base16/
kaigouthro
https://www.tradingview.com/u/kaigouthro/
12
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ kaigouthro //@version=5 // @description Base16 Syntax Theme Collection. dark/light Pairs placed into 2 matched groups. // included is tool for assembling your own themes, as well as all themes String names // to create your own Input menus / add to your own theme matrix, and theme selectors library('base16') // Base16 original syntax highlight usage: // @link https://github.com/chriskempson/base16 // base 00 - Default Background // base 01 - Lighter Background (Used for status bars, line number and folding marks) // base 02 - Selection Background // base 03 - Comments, Invisibles, Line Highlighting // base 04 - Dark Foreground (Used for status bars) // base 05 - Default Foreground, Caret, Delimiters, Operators // base 06 - Light Foreground (Not often used) // base 07 - Light Background (Not often used) // base 08 - Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted // base 09 - Integers, Boolean, Constants, XML Attributes, Markup Link Url // base 10 - Classes, Markup Bold, Search Text Background // base 11 - Strings, Inherited Class, Markup Code, Diff Inserted // base 12 - Support, Regular Expressions, Escape Characters, Markup Quotes // base 13 - Functions, Methods, Attribute IDs, Headings // base 14 - Keywords, Storage, Selector, Markup Italic, Diff Changed // base 15 - Deprecated, Opening/Closing Embedded Language Tags // titles varip _3024 = "3024" varip _APATHY = "Apathy" varip _APPRENTICE = "Apprentice" varip _ASHES = "Ashes" varip _ATELIER_CAVE_LIGHT = "Atelier Cave Light" varip _ATELIER_CAVE = "Atelier Cave" varip _ATELIER_DUNE_LIGHT = "Atelier Dune Light" varip _ATELIER_DUNE = "Atelier Dune" varip _ATELIER_ESTUARY_LIGHT = "Atelier Estuary Light" varip _ATELIER_ESTUARY = "Atelier Estuary" varip _ATELIER_FOREST_LIGHT = "Atelier Forest Light" varip _ATELIER_FOREST = "Atelier Forest" varip _ATELIER_HEATH_LIGHT = "Atelier Heath Light" varip _ATELIER_HEATH = "Atelier Heath" varip _ATELIER_LAKESIDE_LIGHT = "Atelier Lakeside Light" varip _ATELIER_LAKESIDE = "Atelier Lakeside" varip _ATELIER_PLATEAU_LIGHT = "Atelier Plateau Light" varip _ATELIER_PLATEAU = "Atelier Plateau" varip _ATELIER_SAVANNA_LIGHT = "Atelier Savanna Light" varip _ATELIER_SAVANNA = "Atelier Savanna" varip _ATELIER_SEASIDE_LIGHT = "Atelier Seaside Light" varip _ATELIER_SEASIDE = "Atelier Seaside" varip _ATELIER_SULPHURPOOL_LIGHT = "Atelier Sulphurpool Light" varip _ATELIER_SULPHURPOOL = "Atelier Sulphurpool" varip _ATLAS = "Atlas" varip _AYU_DARK = "Ayu Dark" varip _AYU_LIGHT = "Ayu Light" varip _AYU_MIRAGE = "Ayu Mirage" varip _BESPIN = "Bespin" varip _BLACK_METAL_BATHORY = "Black Metal (bathory)" varip _BLACK_METAL_BURZUM = "Black Metal (burzum)" varip _BLACK_METAL_DARK_FUNERAL = "Black Metal (dark Funeral)" varip _BLACK_METAL_GORGOROTH = "Black Metal (gorgoroth)" varip _BLACK_METAL_IMMORTAL = "Black Metal (immortal)" varip _BLACK_METAL_KHOLD = "Black Metal (khold)" varip _BLACK_METAL_MARDUK = "Black Metal (marduk)" varip _BLACK_METAL_MAYHEM = "Black Metal (mayhem)" varip _BLACK_METAL_NILE = "Black Metal (nile)" varip _BLACK_METAL_VENOM = "Black Metal (venom)" varip _BLACK_METAL = "Black Metal" varip _BLUE_FOREST = "Blue Forest" varip _BLUEISH = "Blueish" varip _BREWER = "Brewer" varip _BRIGHT = "Bright" varip _BROGRAMMER = "Brogrammer" varip _BRUSH_TREES_DARK = "Brush Trees Dark" varip _BRUSH_TREES = "Brush Trees" varip _CATPPUCCIN = "Catppuccin" varip _CHALK = "Chalk" varip _CIRCUS = "Circus" varip _CLASSIC_DARK = "Classic Dark" varip _CLASSIC_LIGHT = "Classic Light" varip _CODESCHOOL = "Codeschool" varip _CLRS = "Colors" varip _CUPCAKE = "Cupcake" varip _CUPERTINO = "Cupertino" varip _DA_ONE_BLACK = "Da One Black" varip _DA_ONE_GRAY = "Da One Gray" varip _DA_ONE_OCEAN = "Da One Ocean" varip _DA_ONE_PAPER = "Da One Paper" varip _DA_ONE_SEA = "Da One Sea" varip _DA_ONE_WHITE = "Da One White" varip _DANQING_LIGHT = "Danqing Light" varip _DANQING = "Danqing" varip _DARCULA = "Darcula" varip _DARKMOSS = "Darkmoss" varip _DARKTOOTH = "Darktooth" varip _DARK_VIOLET = "Dark Violet" varip _DECAF = "Decaf" varip _DEFAULT_DARK = "Default Dark" varip _DEFAULT_LIGHT = "Default Light" varip _DIRTYSEA = "Dirtysea" varip _DRACULA = "Dracula" varip _EDGE_DARK = "Edge Dark" varip _EDGE_LIGHT = "Edge Light" varip _EIGHTIES = "Eighties" varip _EMBERS = "Embers" varip _EMIL = "Emil" varip _EQUILIBRIUM_DARK = "Equilibrium Dark" varip _EQUILIBRIUM_GRAY_DARK = "Equilibrium Gray Dark" varip _EQUILIBRIUM_GRAY_LIGHT = "Equilibrium Gray Light" varip _EQUILIBRIUM_LIGHT = "Equilibrium Light" varip _ESPRESSO = "Espresso" varip _EVA_DIM = "Eva Dim" varip _EVA = "Eva" varip _EVERFOREST = "Everforest" varip _FLAT = "Flat" varip _FRAMER = "Framer" varip _FRUIT_SODA = "Fruit Soda" varip _GIGAVOLT = "Gigavolt" varip _GITHUB = "Github" varip _GOOGLE_DARK = "Google Dark" varip _GOOGLE_LIGHT = "Google Light" varip _GOTHAM = "Gotham" varip _GRAYSCALE_DARK = "Grayscale Dark" varip _GRAYSCALE_LIGHT = "Grayscale Light" varip _GREEN_SCREEN = "Green Screen" varip _GRUBER = "Gruber" varip _GRUVBOX_DARK_HARD = "Gruvbox Dark, Hard" varip _GRUVBOX_DARK_MEDIUM = "Gruvbox Dark, Medium" varip _GRUVBOX_DARK_PALE = "Gruvbox Dark, Pale" varip _GRUVBOX_DARK_SOFT = "Gruvbox Dark, Soft" varip _GRUVBOX_LIGHT_HARD = "Gruvbox Light, Hard" varip _GRUVBOX_LIGHT_MEDIUM = "Gruvbox Light, Medium" varip _GRUVBOX_LIGHT_SOFT = "Gruvbox Light, Soft" varip _GRUVBOX_MATERIAL_DARK_HARD = "Gruvbox Material Dark, Hard" varip _GRUVBOX_MATERIAL_DARK_MEDIUM = "Gruvbox Material Dark, Medium" varip _GRUVBOX_MATERIAL_DARK_SOFT = "Gruvbox Material Dark, Soft" varip _GRUVBOX_MATERIAL_LIGHT_HARD = "Gruvbox Material Light, Hard" varip _GRUVBOX_MATERIAL_LIGHT_MEDIUM = "Gruvbox Material Light, Medium" varip _GRUVBOX_MATERIAL_LIGHT_SOFT = "Gruvbox Material Light, Soft" varip _HARDCORE = "Hardcore" varip _HARMONIC16_DARK = "Harmonic16 Dark" varip _HARMONIC16_LIGHT = "Harmonic16 Light" varip _HEETCH_LIGHT = "Heetch Light" varip _HEETCH_DARK = "Heetch Dark" varip _HELIOS = "Helios" varip _HOPSCOTCH = "Hopscotch" varip _HORIZON_DARK = "Horizon Dark" varip _HORIZON_LIGHT = "Horizon Light" varip _HORIZON_TERMINAL_DARK = "Horizon Terminal Dark" varip _HORIZON_TERMINAL_LIGHT = "Horizon Terminal Light" varip _HUMANOID_DARK = "Humanoid Dark" varip _HUMANOID_LIGHT = "Humanoid Light" varip _IA_DARK = "Ia Dark" varip _IA_LIGHT = "Ia Light" varip _ICY_DARK = "Icy Dark" varip _IR_BLACK = "Ir Black" varip _ISOTOPE = "Isotope" varip _KANAGAWA = "Kanagawa" varip _KATY = "Katy" varip _KIMBER = "Kimber" varip _LIME = "Lime" varip _MACINTOSH = "Macintosh" varip _MARRAKESH = "Marrakesh" varip _MATERIA = "Materia" varip _MATERIAL_DARKER = "Material Darker" varip _MATERIAL_LIGHTER = "Material Lighter" varip _MATERIAL_PALENIGHT = "Material Palenight" varip _MATERIAL_VIVID = "Material Vivid" varip _MATERIAL = "Material" varip _MELLOW_PURPLE = "Mellow Purple" varip _MEXICO_LIGHT = "Mexico Light" varip _MOCHA = "Mocha" varip _MONOKAI = "Monokai" varip _NEBULA = "Nebula" varip _NORD = "Nord" varip _NOVA = "Nova" varip _OCEAN = "Ocean" varip _OCEANICNEXT = "Oceanicnext" varip _ONE_LIGHT = "One Light" varip _ONEDARK = "Onedark" varip _OUTRUN_DARK = "Outrun Dark" varip _PANDORA = "Pandora" varip _PAPERCOLOR_DARK = "Papercolor Dark" varip _PAPERCOLOR_LIGHT = "Papercolor Light" varip _PARAISO = "Paraiso" varip _PASQUE = "Pasque" varip _PHD = "Phd" varip _PICO = "Pico" varip _PINKY = "Pinky" varip _POP = "Pop" varip _PORPLE = "Porple" varip _PRIMER_DARK_DIMMED = "Primer Dark Dimmed" varip _PRIMER_DARK = "Primer Dark" varip _PRIMER_LIGHT = "Primer Light" varip _PURPLEDREAM = "Purpledream" varip _QUALIA = "Qualia" varip _RAILSCASTS = "Railscasts" varip _REBECCA = "Rebecca" varip _ROSE_PINE_DAWN = "Rosรฉ Pine Dawn" varip _ROSE_PINE_MOON = "Rosรฉ Pine Moon" varip _ROSE_PINE = "Rosรฉ Pine" varip _SAGELIGHT = "Sagelight" varip _SAKURA = "Sakura" varip _SANDCASTLE = "Sandcastle" varip _SETI_UI = "Seti Ui" varip _SHADES_OF_PURPLE = "Shades Of Purple" varip _SHADESMEAR_DARK = "Shadesmear Dark" varip _SHADESMEAR_LIGHT = "Shadesmear Light" varip _SHAPESHIFTER = "Shapeshifter" varip _SILK_DARK = "Silk Dark" varip _SILK_LIGHT = "Silk Light" varip _SNAZZY = "Snazzy" varip _SOLAR_FLARE_LIGHT = "Solar Flare Light" varip _SOLAR_FLARE = "Solar Flare" varip _SOLARIZED_DARK = "Solarized Dark" varip _SOLARIZED_LIGHT = "Solarized Light" varip _SPACEDUCK = "Spaceduck" varip _SPACEMACS = "Spacemacs" varip _STELLA = "Stella" varip _STILL_ALIVE = "Still Alive" varip _SUMMERCAMP = "Summercamp" varip _SUMMERFRUIT_DARK = "Summerfruit Dark" varip _SUMMERFRUIT_LIGHT = "Summerfruit Light" varip _SYNTH_MIDNIGHT_TERMINAL_DARK = "Synth Midnight Terminal Dark" varip _SYNTH_MIDNIGHT_TERMINAL_LIGHT = "Synth Midnight Terminal Light" varip _TANGO = "Tango" varip _TENDER = "Tender" varip _TOKYO_CITY_DARK = "Tokyo City Dark" varip _TOKYO_CITY_LIGHT = "Tokyo City Light" varip _TOKYO_CITY_TERMINAL_DARK = "Tokyo City Terminal Dark" varip _TOKYO_CITY_TERMINAL_LIGHT = "Tokyo City Terminal Light" varip _TOKYO_NIGHT_DARK = "Tokyo Night Dark" varip _TOKYO_NIGHT_LIGHT = "Tokyo Night Light" varip _TOKYO_NIGHT_STORM = "Tokyo Night Storm" varip _TOKYO_NIGHT_TERMINAL_DARK = "Tokyo Night Terminal Dark" varip _TOKYO_NIGHT_TERMINAL_LIGHT = "Tokyo Night Terminal Light" varip _TOKYO_NIGHT_TERMINAL_STORM = "Tokyo Night Terminal Storm" varip _TOKYODARK_TERMINAL = "Tokyodark Terminal" varip _TOKYODARK = "Tokyodark" varip _TOMORROW_NIGHT_EIGHTIES = "Tomorrow Night Eighties" varip _TOMORROW_NIGHT = "Tomorrow Night" varip _TOMORROW = "Tomorrow" varip _LONDON_TUBE = "London Tube" varip _TWILIGHT = "Twilight" varip _UNIKITTY_DARK = "Unikitty Dark" varip _UNIKITTY_LIGHT = "Unikitty Light" varip _UNIKITTY_REVERSIBLE = "Unikitty Reversible" varip _UWUNICORN = "Uwunicorn" varip _VICE = "Vice" varip _VULCAN = "Vulcan" varip _WINDOWS_10_LIGHT = "Windows 10 Light" varip _WINDOWS_10 = "Windows 10" varip _WINDOWS_95_LIGHT = "Windows 95 Light" varip _WINDOWS_95 = "Windows 95" varip _WINDOWS_HIGH_CONTRAST_LIGHT = "Windows High Contrast Light" varip _WINDOWS_HIGH_CONTRAST = "Windows High Contrast" varip _WINDOWS_NT_LIGHT = "Windows Nt Light" varip _WINDOWS_NT = "Windows Nt" varip _WOODLAND = "Woodland" varip _XCODE_DUSK = "Xcode Dusk" varip _ZENBURN = "Zenburn" // ============================================================================ // Name Author // โ•ผ "3024" โ•ผโ•ผ "Jan T. Sott (http://github.com/idleberg)" export _3024() => array.from( #090300 , #3a3432 , #4a4543 , #5c5855 , #807d7c , #a5a2a2 , #d6d5d4 , #f7f7f7 , #db2d20 , #e8bbd0 , #fded02 , #01a252 , #b5e4f4 , #01a0e4 , #a16a94 , #cdab53 ) // โ•ผ "Apathy" โ•ผโ•ผ "Jannik Siebert (https://github.com/janniks)" export apathy() => array.from( #031A16 , #0B342D , #184E45 , #2B685E , #5F9C92 , #81B5AC , #A7CEC8 , #D2E7E4 , #3E9688 , #3E7996 , #3E4C96 , #883E96 , #963E4C , #96883E , #4C963E , #3E965B ) // โ•ผ "Apprentice" โ•ผโ•ผ "romainl" export apprentice() => array.from( #262626 , #303030 , #333333 , #6C6C6C , #787878 , #BCBCBC , #C9C9C9 , #FFFFFF , #5F8787 , #FF8700 , #5F8787 , #87AF87 , #5F875F , #FFFFAF , #87AFD7 , #5F87AF ) // โ•ผ "Ashes" โ•ผโ•ผ "Jannik Siebert (https://github.com/janniks)" export ashes() => array.from( #1C2023 , #393F45 , #565E65 , #747C84 , #ADB3BA , #C7CCD1 , #DFE2E5 , #F3F4F5 , #C7AE95 , #C7C795 , #AEC795 , #95C7AE , #95AEC7 , #AE95C7 , #C795AE , #C79595 ) // โ•ผ "Atelier Cave Light" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_cave_light() => array.from( #efecf4 , #e2dfe7 , #8b8792 , #7e7887 , #655f6d , #585260 , #26232a , #19171c , #be4678 , #aa573c , #a06e3b , #2a9292 , #398bc6 , #576ddb , #955ae7 , #bf40bf ) // โ•ผ "Atelier Cave" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_cave() => array.from( #19171c , #26232a , #585260 , #655f6d , #7e7887 , #8b8792 , #e2dfe7 , #efecf4 , #be4678 , #aa573c , #a06e3b , #2a9292 , #398bc6 , #576ddb , #955ae7 , #bf40bf ) // โ•ผ "Atelier Dune Light" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_dune_light() => array.from( #fefbec , #e8e4cf , #a6a28c , #999580 , #7d7a68 , #6e6b5e , #292824 , #20201d , #d73737 , #b65611 , #ae9513 , #60ac39 , #1fad83 , #6684e1 , #b854d4 , #d43552 ) // โ•ผ "Atelier Dune" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_dune() => array.from( #20201d , #292824 , #6e6b5e , #7d7a68 , #999580 , #a6a28c , #e8e4cf , #fefbec , #d73737 , #b65611 , #ae9513 , #60ac39 , #1fad83 , #6684e1 , #b854d4 , #d43552 ) // โ•ผ "Atelier Estuary Light" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_estuary_light() => array.from( #f4f3ec , #e7e6df , #929181 , #878573 , #6c6b5a , #5f5e4e , #302f27 , #22221b , #ba6236 , #ae7313 , #a5980d , #7d9726 , #5b9d48 , #36a166 , #5f9182 , #9d6c7c ) // โ•ผ "Atelier Estuary" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_estuary() => array.from( #22221b , #302f27 , #5f5e4e , #6c6b5a , #878573 , #929181 , #e7e6df , #f4f3ec , #ba6236 , #ae7313 , #a5980d , #7d9726 , #5b9d48 , #36a166 , #5f9182 , #9d6c7c ) // โ•ผ "Atelier Forest Light" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_forest_light() => array.from( #f1efee , #e6e2e0 , #a8a19f , #9c9491 , #766e6b , #68615e , #2c2421 , #1b1918 , #f22c40 , #df5320 , #c38418 , #7b9726 , #3d97b8 , #407ee7 , #6666ea , #c33ff3 ) // โ•ผ "Atelier Forest" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_forest() => array.from( #1b1918 , #2c2421 , #68615e , #766e6b , #9c9491 , #a8a19f , #e6e2e0 , #f1efee , #f22c40 , #df5320 , #c38418 , #7b9726 , #3d97b8 , #407ee7 , #6666ea , #c33ff3 ) // โ•ผ "Atelier Heath Light" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_heath_light() => array.from( #f7f3f7 , #d8cad8 , #ab9bab , #9e8f9e , #776977 , #695d69 , #292329 , #1b181b , #ca402b , #a65926 , #bb8a35 , #918b3b , #159393 , #516aec , #7b59c0 , #cc33cc ) // โ•ผ "Atelier Heath" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_heath() => array.from( #1b181b , #292329 , #695d69 , #776977 , #9e8f9e , #ab9bab , #d8cad8 , #f7f3f7 , #ca402b , #a65926 , #bb8a35 , #918b3b , #159393 , #516aec , #7b59c0 , #cc33cc ) // โ•ผ "Atelier Lakeside Light" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_lakeside_light() => array.from( #ebf8ff , #c1e4f6 , #7ea2b4 , #7195a8 , #5a7b8c , #516d7b , #1f292e , #161b1d , #d22d72 , #935c25 , #8a8a0f , #568c3b , #2d8f6f , #257fad , #6b6bb8 , #b72dd2 ) // โ•ผ "Atelier Lakeside" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_lakeside() => array.from( #161b1d , #1f292e , #516d7b , #5a7b8c , #7195a8 , #7ea2b4 , #c1e4f6 , #ebf8ff , #d22d72 , #935c25 , #8a8a0f , #568c3b , #2d8f6f , #257fad , #6b6bb8 , #b72dd2 ) // โ•ผ "Atelier Plateau Light" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_plateau_light() => array.from( #f4ecec , #e7dfdf , #8a8585 , #7e7777 , #655d5d , #585050 , #292424 , #1b1818 , #ca4949 , #b45a3c , #a06e3b , #4b8b8b , #5485b6 , #7272ca , #8464c4 , #bd5187 ) // โ•ผ "Atelier Plateau" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_plateau() => array.from( #1b1818 , #292424 , #585050 , #655d5d , #7e7777 , #8a8585 , #e7dfdf , #f4ecec , #ca4949 , #b45a3c , #a06e3b , #4b8b8b , #5485b6 , #7272ca , #8464c4 , #bd5187 ) // โ•ผ "Atelier Savanna Light" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_savanna_light() => array.from( #ecf4ee , #dfe7e2 , #87928a , #78877d , #5f6d64 , #526057 , #232a25 , #171c19 , #b16139 , #9f713c , #a07e3b , #489963 , #1c9aa0 , #478c90 , #55859b , #867469 ) // โ•ผ "Atelier Savanna" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_savanna() => array.from( #171c19 , #232a25 , #526057 , #5f6d64 , #78877d , #87928a , #dfe7e2 , #ecf4ee , #b16139 , #9f713c , #a07e3b , #489963 , #1c9aa0 , #478c90 , #55859b , #867469 ) // โ•ผ "Atelier Seaside Light" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_seaside_light() => array.from( #f4fbf4 , #cfe8cf , #8ca68c , #809980 , #687d68 , #5e6e5e , #242924 , #131513 , #e6193c , #87711d , #98981b , #29a329 , #1999b3 , #3d62f5 , #ad2bee , #e619c3 ) // โ•ผ "Atelier Seaside" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_seaside() => array.from( #131513 , #242924 , #5e6e5e , #687d68 , #809980 , #8ca68c , #cfe8cf , #f4fbf4 , #e6193c , #87711d , #98981b , #29a329 , #1999b3 , #3d62f5 , #ad2bee , #e619c3 ) // โ•ผ "Atelier Sulphurpool Light โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_sulphurpool_light() => array.from( #f5f7ff , #dfe2f1 , #979db4 , #898ea4 , #6b7394 , #5e6687 , #293256 , #202746 , #c94922 , #c76b29 , #c08b30 , #ac9739 , #22a2c9 , #3d8fd1 , #6679cc , #9c637a ) // โ•ผ "Atelier Sulphurpool" โ•ผโ•ผ "Bram de Haan (http://atelierbramdehaan.nl)" export atelier_sulphurpool() => array.from( #202746 , #293256 , #5e6687 , #6b7394 , #898ea4 , #979db4 , #dfe2f1 , #f5f7ff , #c94922 , #c76b29 , #c08b30 , #ac9739 , #22a2c9 , #3d8fd1 , #6679cc , #9c637a ) // โ•ผ "Atlas" โ•ผโ•ผ "Alex Lende (https://ajlende.com)" export atlas() => array.from( #002635 , #00384d , #517F8D , #6C8B91 , #869696 , #a1a19a , #e6e6dc , #fafaf8 , #ff5a67 , #f08e48 , #ffcc1b , #7fc06e , #5dd7b9 , #14747e , #9a70a4 , #c43060 ) // โ•ผ "Ayu Dark" โ•ผโ•ผ "Khue Nguyen <[email protected]>" export ayu_dark() => array.from( #0F1419 , #131721 , #272D38 , #3E4B59 , #BFBDB6 , #E6E1CF , #E6E1CF , #F3F4F5 , #F07178 , #FF8F40 , #FFB454 , #B8CC52 , #95E6CB , #59C2FF , #D2A6FF , #E6B673 ) // โ•ผ "Ayu Light" โ•ผโ•ผ "Khue Nguyen <[email protected]>" export ayu_light() => array.from( #FAFAFA , #F3F4F5 , #F8F9FA , #ABB0B6 , #828C99 , #5C6773 , #242936 , #1A1F29 , #F07178 , #FA8D3E , #F2AE49 , #86B300 , #4CBF99 , #36A3D9 , #A37ACC , #E6BA7E ) // โ•ผ "Ayu Mirage" โ•ผโ•ผ "Khue Nguyen <[email protected]>" export ayu_mirage() => array.from( #171B24 , #1F2430 , #242936 , #707A8C , #8A9199 , #CCCAC2 , #D9D7CE , #F3F4F5 , #F28779 , #FFAD66 , #FFD173 , #D5FF80 , #95E6CB , #5CCFE6 , #D4BFFF , #F29E74 ) // โ•ผ "Bespin" โ•ผโ•ผ "Jan T. Sott" export bespin() => array.from( #28211c , #36312e , #5e5d5c , #666666 , #797977 , #8a8986 , #9d9b97 , #baae9e , #cf6a4c , #cf7d34 , #f9ee98 , #54be0d , #afc4db , #5ea6ea , #9b859d , #937121 ) // โ•ผ "Black Metal (Bathory)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_bathory() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #e78a53 , #fbcb97 , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal (Burzum)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_burzum() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #99bbaa , #ddeecc , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal (Funeral)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_dark_funeral() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #5f81a5 , #d0dfee , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal (Gorgoroth)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_gorgoroth() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #8c7f70 , #9b8d7f , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal (Immortal)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_immortal() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #556677 , #7799bb , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal (Khold)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_khold() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #974b46 , #eceee3 , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal (Marduk)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_marduk() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #626b67 , #a5aaa7 , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal (Mayhem)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_mayhem() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #eecc6c , #f3ecd4 , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal (Nile)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_nile() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #777755 , #aa9988 , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal (Venom)" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal_venom() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #79241f , #f8f7f2 , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Black Metal" โ•ผโ•ผ "metalelf0 (https://github.com/metalelf0)" export black_metal() => array.from( #000000 , #121212 , #222222 , #333333 , #999999 , #c1c1c1 , #999999 , #c1c1c1 , #5f8787 , #aaaaaa , #a06666 , #dd9999 , #aaaaaa , #888888 , #999999 , #444444 ) // โ•ผ "Blue Forest" โ•ผโ•ผ "alonsodomin (https://github.com/alonsodomin)" export blue_forest() => array.from( #141F2E , #1e5c1e , #273e5c , #a0ffa0 , #1e5c1e , #FFCC33 , #91CCFF , #375780 , #fffab1 , #FF8080 , #91CCFF , #80ff80 , #80ff80 , #a2cff5 , #0099FF , #e7e7e7 ) // โ•ผ "Blueish" โ•ผโ•ผ "Ben Mayoras" export blueish() => array.from( #182430 , #243C54 , #46290A , #616D78 , #74AFE7 , #C8E1F8 , #DDEAF6 , #8F98A0 , #4CE587 , #F6A85C , #82AAFF , #C3E88D , #5FD1FF , #82AAFF , #FF84DD , #BBD2E8 ) // โ•ผ "Brewer" โ•ผโ•ผ "Timothรฉe Poisot (http://github.com/tpoisot)" export brewer() => array.from( #0c0d0e , #2e2f30 , #515253 , #737475 , #959697 , #b7b8b9 , #dadbdc , #fcfdfe , #e31a1c , #e6550d , #dca060 , #31a354 , #80b1d3 , #3182bd , #756bb1 , #b15928 ) // โ•ผ "Bright" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export bright() => array.from( #000000 , #303030 , #505050 , #b0b0b0 , #d0d0d0 , #e0e0e0 , #f5f5f5 , #ffffff , #fb0120 , #fc6d24 , #fda331 , #a1c659 , #76c7b7 , #6fb3d2 , #d381c3 , #be643c ) // โ•ผ "Brogrammer" โ•ผโ•ผ "Vik Ramanujam (http://github.com/piggyslasher)" export brogrammer() => array.from( #1f1f1f , #f81118 , #2dc55e , #ecba0f , #2a84d2 , #4e5ab7 , #1081d6 , #d6dbe5 , #d6dbe5 , #de352e , #1dd361 , #f3bd09 , #1081d6 , #5350b9 , #0f7ddb , #ffffff ) // โ•ผ "Brush Trees Dark" โ•ผโ•ผ "Abraham White <[email protected]>" export brush_trees_dark() => array.from( #485867 , #5A6D7A , #6D828E , #8299A1 , #98AFB5 , #B0C5C8 , #C9DBDC , #E3EFEF , #b38686 , #d8bba2 , #aab386 , #87b386 , #86b3b3 , #868cb3 , #b386b2 , #b39f9f ) // โ•ผ "Brush Trees" โ•ผโ•ผ "Abraham White <[email protected]>" export brush_trees() => array.from( #E3EFEF , #C9DBDC , #B0C5C8 , #98AFB5 , #8299A1 , #6D828E , #5A6D7A , #485867 , #b38686 , #d8bba2 , #aab386 , #87b386 , #86b3b3 , #868cb3 , #b386b2 , #b39f9f ) // โ•ผ "Catppuccin" โ•ผโ•ผ "Pocco81 (https://github.com/pocco81)" export catppuccin() => array.from( #1E1E28 , #1A1826 , #302D41 , #575268 , #6E6C7C , #D7DAE0 , #F5E0DC , #C9CBFF , #F28FAD , #F8BD96 , #FAE3B0 , #ABE9B3 , #B5E8E0 , #96CDFB , #DDB6F2 , #F2CDCD ) // โ•ผ "Chalk" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export chalk() => array.from( #151515 , #202020 , #303030 , #505050 , #b0b0b0 , #d0d0d0 , #e0e0e0 , #f5f5f5 , #fb9fb1 , #eda987 , #ddb26f , #acc267 , #12cfc0 , #6fc2ef , #e1a3ee , #deaf8f ) // โ•ผ "Circus" โ•ผโ•ผ "Stephan Boyer (https://github.com/stepchowfun) and Esther Wang (https://github.com/ewang12)" export circus() => array.from( #191919 , #202020 , #303030 , #5f5a60 , #505050 , #a7a7a7 , #808080 , #ffffff , #dc657d , #4bb1a7 , #c3ba63 , #84b97c , #4bb1a7 , #639ee4 , #b888e2 , #b888e2 ) // โ•ผ "Classic Dark" โ•ผโ•ผ "Jason Heeris (http://heeris.id.au)" export classic_dark() => array.from( #151515 , #202020 , #303030 , #505050 , #B0B0B0 , #D0D0D0 , #E0E0E0 , #F5F5F5 , #AC4142 , #D28445 , #F4BF75 , #90A959 , #75B5AA , #6A9FB5 , #AA759F , #8F5536 ) // โ•ผ "Classic Light" โ•ผโ•ผ "Jason Heeris (http://heeris.id.au)" export classic_light() => array.from( #F5F5F5 , #E0E0E0 , #D0D0D0 , #B0B0B0 , #505050 , #303030 , #202020 , #151515 , #AC4142 , #D28445 , #F4BF75 , #90A959 , #75B5AA , #6A9FB5 , #AA759F , #8F5536 ) // โ•ผ "Codeschool" โ•ผโ•ผ "blockloop" export codeschool() => array.from( #232c31 , #1c3657 , #2a343a , #3f4944 , #84898c , #9ea7a6 , #a7cfa3 , #b5d8f6 , #2a5491 , #43820d , #a03b1e , #237986 , #b02f30 , #484d79 , #c59820 , #c98344 ) // โ•ผ "Colors" โ•ผโ•ผ "mrmrs (http://clrs.cc)" export clrs () => array.from( #111111 , #333333 , #555555 , #777777 , #999999 , #bbbbbb , #dddddd , #ffffff , #ff4136 , #ff851b , #ffdc00 , #2ecc40 , #7fdbff , #0074d9 , #b10dc9 , #85144b ) // โ•ผ "Cupcake" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export cupcake() => array.from( #fbf1f2 , #f2f1f4 , #d8d5dd , #bfb9c6 , #a59daf , #8b8198 , #72677E , #585062 , #D57E85 , #EBB790 , #DCB16C , #A3B367 , #69A9A7 , #7297B9 , #BB99B4 , #BAA58C ) // โ•ผ "Cupertino" โ•ผโ•ผ "Defman21" export cupertino() => array.from( #ffffff , #c0c0c0 , #c0c0c0 , #808080 , #808080 , #404040 , #404040 , #5e5e5e , #c41a15 , #eb8500 , #826b28 , #007400 , #318495 , #0000ff , #a90d91 , #826b28 ) // โ•ผ "Da One Black" โ•ผโ•ผ "NNB (https://github.com/NNBnh)" export da_one_black() => array.from( #000000 , #282828 , #585858 , #888888 , #c8c8c8 , #ffffff , #ffffff , #ffffff , #fa7883 , #ffc387 , #ff9470 , #98c379 , #8af5ff , #6bb8ff , #e799ff , #b3684f ) // โ•ผ "Da One Gray" โ•ผโ•ผ "NNB (https://github.com/NNBnh)" export da_one_gray() => array.from( #181818 , #282828 , #585858 , #888888 , #c8c8c8 , #ffffff , #ffffff , #ffffff , #fa7883 , #ffc387 , #ff9470 , #98c379 , #8af5ff , #6bb8ff , #e799ff , #b3684f ) // โ•ผ "Da One Ocean" โ•ผโ•ผ "NNB (https://github.com/NNBnh)" export da_one_ocean() => array.from( #171726 , #22273d , #525866 , #878d96 , #c8c8c8 , #ffffff , #ffffff , #ffffff , #fa7883 , #ffc387 , #ff9470 , #98c379 , #8af5ff , #6bb8ff , #e799ff , #b3684f ) // โ•ผ "Da One Paper" โ•ผโ•ผ "NNB (https://github.com/NNBnh)" export da_one_paper() => array.from( #faf0dc , #c8c8c8 , #888888 , #585858 , #282828 , #181818 , #000000 , #000000 , #de5d6e , #ff9470 , #b3684f , #76a85d , #64b5a7 , #5890f8 , #c173d1 , #b3684f ) // โ•ผ "Da One Sea" โ•ผโ•ผ "NNB (https://github.com/NNBnh)" export da_one_sea() => array.from( #22273d , #374059 , #525866 , #878d96 , #c8c8c8 , #ffffff , #ffffff , #ffffff , #fa7883 , #ffc387 , #ff9470 , #98c379 , #8af5ff , #6bb8ff , #e799ff , #b3684f ) // โ•ผ "Da One White" โ•ผโ•ผ "NNB (https://github.com/NNBnh)" export da_one_white() => array.from( #ffffff , #c8c8c8 , #888888 , #585858 , #282828 , #181818 , #000000 , #000000 , #de5d6e , #ff9470 , #b3684f , #76a85d , #64b5a7 , #5890f8 , #c173d1 , #b3684f ) // โ•ผ "DanQing Light" โ•ผโ•ผ "Wenhan Zhu (Cosmos) ([email protected])" export danqing_light() => array.from( #fcfefd , #ecf6f2 , #e0f0eF , #cad8d2 , #9da8a3 , #5a605d , #434846 , #2d302f , #F9906F , #B38A61 , #F0C239 , #8AB361 , #30DFF3 , #B0A4E3 , #CCA4E3 , #CA6924 ) // โ•ผ "DanQing" โ•ผโ•ผ "Wenhan Zhu (Cosmos) ([email protected])" export danqing() => array.from( #2d302f , #434846 , #5a605d , #9da8a3 , #cad8d2 , #e0f0eF , #ecf6f2 , #fcfefd , #F9906F , #B38A61 , #F0C239 , #8AB361 , #30DFF3 , #B0A4E3 , #CCA4E3 , #CA6924 ) // โ•ผ "Darcula" โ•ผโ•ผ "jetbrains" export darcula() => array.from( #2b2b2b , #323232 , #323232 , #606366 , #a4a3a3 , #a9b7c6 , #ffc66d , #ffffff , #4eade5 , #689757 , #bbb529 , #6a8759 , #629755 , #9876aa , #cc7832 , #808080 ) // โ•ผ "darkmoss" โ•ผโ•ผ "Gabriel Avanzi (https://github.com/avanzzzi)" export darkmoss() => array.from( #171e1f , #252c2d , #373c3d , #555e5f , #818f80 , #c7c7a5 , #e3e3c8 , #e1eaef , #ff4658 , #e6db74 , #fdb11f , #499180 , #66d9ef , #498091 , #9bc0c8 , #d27b53 ) // โ•ผ "Darktooth" โ•ผโ•ผ "Jason Milkins (https://github.com/jasonm23)" export darktooth() => array.from( #1D2021 , #32302F , #504945 , #665C54 , #928374 , #A89984 , #D5C4A1 , #FDF4C1 , #FB543F , #FE8625 , #FAC03B , #95C085 , #8BA59B , #0D6678 , #8F4673 , #A87322 ) // โ•ผ "Dark Violet" โ•ผโ•ผ "ruler501 (https://github.com/ruler501/base16-darkviolet)" export dark_violet() => array.from( #000000 , #231a40 , #432d59 , #593380 , #00ff00 , #b08ae6 , #9045e6 , #a366ff , #a82ee6 , #bb66cc , #f29df2 , #4595e6 , #40dfff , #4136d9 , #7e5ce6 , #a886bf ) // โ•ผ "Decaf" โ•ผโ•ผ "Alex Mirrington (https://github.com/alexmirrington)" export decaf() => array.from( #2d2d2d , #393939 , #515151 , #777777 , #b4b7b4 , #cccccc , #e0e0e0 , #ffffff , #ff7f7b , #ffbf70 , #ffd67c , #beda78 , #bed6ff , #90bee1 , #efb3f7 , #ff93b3 ) // โ•ผ "Default Dark" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export default_dark() => array.from( #181818 , #282828 , #383838 , #585858 , #b8b8b8 , #d8d8d8 , #e8e8e8 , #f8f8f8 , #ab4642 , #dc9656 , #f7ca88 , #a1b56c , #86c1b9 , #7cafc2 , #ba8baf , #a16946 ) // โ•ผ "Default Light" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export default_light() => array.from( #f8f8f8 , #e8e8e8 , #d8d8d8 , #b8b8b8 , #585858 , #383838 , #282828 , #181818 , #ab4642 , #dc9656 , #f7ca88 , #a1b56c , #86c1b9 , #7cafc2 , #ba8baf , #a16946 ) // โ•ผ "dirtysea" โ•ผโ•ผ "Kahlil (Kal) Hodgson" export dirtysea() => array.from( #e0e0e0 , #d0dad0 , #d0d0d0 , #707070 , #202020 , #000000 , #f8f8f8 , #c4d9c4 , #840000 , #006565 , #755B00 , #730073 , #755B00 , #007300 , #000090 , #755B00 ) // โ•ผ "Dracula" โ•ผโ•ผ "Mike Barkmin (http://github.com/mikebarkmin) based on Dracula Theme (http://github.com/dracula)" export dracula() => array.from( #282936 , #3a3c4e , #4d4f68 , #626483 , #62d6e8 , #e9e9f4 , #f1f2f8 , #f7f7fb , #ea51b2 , #b45bcf , #00f769 , #ebff87 , #a1efe4 , #62d6e8 , #b45bcf , #00f769 ) // โ•ผ "Edge Dark" โ•ผโ•ผ "cjayross (https://github.com/cjayross)" export edge_dark() => array.from( #262729 , #88909f , #b7bec9 , #3e4249 , #73b3e7 , #b7bec9 , #d390e7 , #3e4249 , #e77171 , #e77171 , #dbb774 , #a1bf78 , #5ebaa5 , #73b3e7 , #d390e7 , #5ebaa5 ) // โ•ผ "Edge Light" โ•ผโ•ผ "cjayross (https://github.com/cjayross)" export edge_light() => array.from( #fafafa , #7c9f4b , #d69822 , #5e646f , #6587bf , #5e646f , #b870ce , #5e646f , #db7070 , #db7070 , #d69822 , #7c9f4b , #509c93 , #6587bf , #b870ce , #509c93 ) // โ•ผ "Eighties" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export eighties() => array.from( #2d2d2d , #393939 , #515151 , #747369 , #a09f93 , #d3d0c8 , #e8e6df , #f2f0ec , #f2777a , #f99157 , #ffcc66 , #99cc99 , #66cccc , #6699cc , #cc99cc , #d27b53 ) // โ•ผ "Embers" โ•ผโ•ผ "Jannik Siebert (https://github.com/janniks)" export embers() => array.from( #16130F , #2C2620 , #433B32 , #5A5047 , #8A8075 , #A39A90 , #BEB6AE , #DBD6D1 , #826D57 , #828257 , #6D8257 , #57826D , #576D82 , #6D5782 , #82576D , #825757 ) // โ•ผ "emil" โ•ผโ•ผ "limelier" export emil() => array.from( #efefef , #bebed2 , #9e9eaf , #7c7c98 , #505063 , #313145 , #22223a , #1a1a2f , #f43979 , #d22a8b , #ff669b , #0073a8 , #2155d6 , #471397 , #6916b6 , #8d17a5 ) // โ•ผ "Equilibrium Dark" โ•ผโ•ผ "Carlo Abelli" export equilibrium_dark() => array.from( #0c1118 , #181c22 , #22262d , #7b776e , #949088 , #afaba2 , #cac6bd , #e7e2d9 , #f04339 , #df5923 , #bb8801 , #7f8b00 , #00948b , #008dd1 , #6a7fd2 , #e3488e ) // โ•ผ "Equilibrium Gray Dark" โ•ผโ•ผ "Carlo Abelli" export equilibrium_gray_dark() => array.from( #111111 , #1b1b1b , #262626 , #777777 , #919191 , #ababab , #c6c6c6 , #e2e2e2 , #f04339 , #df5923 , #bb8801 , #7f8b00 , #00948b , #008dd1 , #6a7fd2 , #e3488e ) // โ•ผ "Equilibrium Gray Light" โ•ผโ•ผ "Carlo Abelli" export equilibrium_gray_light() => array.from( #f1f1f1 , #e2e2e2 , #d4d4d4 , #777777 , #5e5e5e , #474747 , #303030 , #1b1b1b , #d02023 , #bf3e05 , #9d6f00 , #637200 , #007a72 , #0073b5 , #4e66b6 , #c42775 ) // โ•ผ "Equilibrium Light" โ•ผโ•ผ "Carlo Abelli" export equilibrium_light() => array.from( #f5f0e7 , #e7e2d9 , #d8d4cb , #73777f , #5a5f66 , #43474e , #2c3138 , #181c22 , #d02023 , #bf3e05 , #9d6f00 , #637200 , #007a72 , #0073b5 , #4e66b6 , #c42775 ) // โ•ผ "Espresso" โ•ผโ•ผ "Unknown. Maintained by Alex Mirrington (https://github.com/alexmirrington)" export espresso() => array.from( #2d2d2d , #393939 , #515151 , #777777 , #b4b7b4 , #cccccc , #e0e0e0 , #ffffff , #d25252 , #f9a959 , #ffc66d , #a5c261 , #bed6ff , #6c99bb , #d197d9 , #f97394 ) // โ•ผ "Eva Dim" โ•ผโ•ผ "kjakapat (https://github.com/kjakapat)" export eva_dim() => array.from( #2a3b4d , #3d566f , #4b6988 , #55799c , #7e90a3 , #9fa2a6 , #d6d7d9 , #ffffff , #c4676c , #ff9966 , #cfd05d , #5de561 , #4b8f77 , #1ae1dc , #9c6cd3 , #bb64a9 ) // โ•ผ "Eva" โ•ผโ•ผ "kjakapat (https://github.com/kjakapat)" export eva() => array.from( #2a3b4d , #3d566f , #4b6988 , #55799c , #7e90a3 , #9fa2a6 , #d6d7d9 , #ffffff , #c4676c , #ff9966 , #ffff66 , #66ff66 , #4b8f77 , #15f4ee , #9c6cd3 , #bb64a9 ) // โ•ผ "Everforest" โ•ผโ•ผ "Sainnhe Park (https://github.com/sainnhe)" export everforest() => array.from( #2f383e , #374247 , #4a555b , #859289 , #9da9a0 , #d3c6aa , #e4e1cd , #fdf6e3 , #7fbbb3 , #d699b6 , #dbbc7f , #83c092 , #e69875 , #a7c080 , #e67e80 , #eaedc8 ) // โ•ผ "Flat" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export flat() => array.from( #2C3E50 , #34495E , #7F8C8D , #95A5A6 , #BDC3C7 , #e0e0e0 , #f5f5f5 , #ECF0F1 , #E74C3C , #E67E22 , #F1C40F , #2ECC71 , #1ABC9C , #3498DB , #9B59B6 , #be643c ) // โ•ผ "Framer" โ•ผโ•ผ "Framer (Maintained by Jesse Hoyos)" export framer() => array.from( #181818 , #151515 , #464646 , #747474 , #B9B9B9 , #D0D0D0 , #E8E8E8 , #EEEEEE , #FD886B , #FC4769 , #FECB6E , #32CCDC , #ACDDFD , #20BCFC , #BA8CFC , #B15F4A ) // โ•ผ "Fruit Soda" โ•ผโ•ผ "jozip" export fruit_soda() => array.from( #f1ecf1 , #e0dee0 , #d8d5d5 , #b5b4b6 , #979598 , #515151 , #474545 , #2d2c2c , #fe3e31 , #fe6d08 , #f7e203 , #47f74c , #0f9cfd , #2931df , #611fce , #b16f40 ) // โ•ผ "Gigavolt" โ•ผโ•ผ "Aidan Swope (http://github.com/Whillikers)" export gigavolt() => array.from( #202126 , #2d303d , #5a576e , #a1d2e6 , #cad3ff , #e9e7e1 , #eff0f9 , #f2fbff , #ff661a , #19f988 , #ffdc2d , #f2e6a9 , #fb6acb , #40bfff , #ae94f9 , #6187ff ) // โ•ผ "Github" โ•ผโ•ผ "Defman21" export github() => array.from( #ffffff , #f5f5f5 , #c8c8fa , #969896 , #e8e8e8 , #333333 , #ffffff , #ffffff , #ed6a43 , #0086b3 , #795da3 , #183691 , #183691 , #795da3 , #a71d5d , #333333 ) // โ•ผ "Google Dark" โ•ผโ•ผ "Seth Wright (http://sethawright.com)" export google_dark() => array.from( #1d1f21 , #282a2e , #373b41 , #969896 , #b4b7b4 , #c5c8c6 , #e0e0e0 , #ffffff , #CC342B , #F96A38 , #FBA922 , #198844 , #3971ED , #3971ED , #A36AC7 , #3971ED ) // โ•ผ "Google Light" โ•ผโ•ผ "Seth Wright (http://sethawright.com)" export google_light() => array.from( #ffffff , #e0e0e0 , #c5c8c6 , #b4b7b4 , #969896 , #373b41 , #282a2e , #1d1f21 , #CC342B , #F96A38 , #FBA922 , #198844 , #3971ED , #3971ED , #A36AC7 , #3971ED ) // โ•ผ "Gotham" โ•ผโ•ผ "Andrea Leopardi (arranged by Brett Jones)" export gotham() => array.from( #0c1014 , #11151c , #091f2e , #0a3749 , #245361 , #599cab , #99d1ce , #d3ebe9 , #c23127 , #d26937 , #edb443 , #33859E , #2aa889 , #195466 , #888ca6 , #4e5166 ) // โ•ผ "Grayscale Dark" โ•ผโ•ผ "Alexandre Gavioli (https://github.com/Alexx2/)" export grayscale_dark() => array.from( #101010 , #252525 , #464646 , #525252 , #ababab , #b9b9b9 , #e3e3e3 , #f7f7f7 , #7c7c7c , #999999 , #a0a0a0 , #8e8e8e , #868686 , #686868 , #747474 , #5e5e5e ) // โ•ผ "Grayscale Light" โ•ผโ•ผ "Alexandre Gavioli (https://github.com/Alexx2/)" export grayscale_light() => array.from( #f7f7f7 , #e3e3e3 , #b9b9b9 , #ababab , #525252 , #464646 , #252525 , #101010 , #7c7c7c , #999999 , #a0a0a0 , #8e8e8e , #868686 , #686868 , #747474 , #5e5e5e ) // โ•ผ "Green Screen" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export green_screen() => array.from( #001100 , #003300 , #005500 , #007700 , #009900 , #00bb00 , #00dd00 , #00ff00 , #007700 , #009900 , #007700 , #00bb00 , #005500 , #009900 , #00bb00 , #005500 ) // โ•ผ "Gruber" โ•ผโ•ผ "Patel, Nimai <[email protected]>, colors from www.github.com/rexim/gruber-darker-theme" export gruber() => array.from( #181818 , #453d41 , #484848 , #52494e , #e4e4ef , #f4f4ff , #f5f5f5 , #e4e4ef , #f43841 , #c73c3f , #ffdd33 , #73c936 , #95a99f , #96a6c8 , #9e95c7 , #cc8c3c ) // โ•ผ "gruvbox dark, hard" โ•ผโ•ผ "Dawid Kurek ([email protected]), morhetz (https://github.com/morhetz/gruvbox)" export gruvbox_dark_hard() => array.from( #1d2021 , #3c3836 , #504945 , #665c54 , #bdae93 , #d5c4a1 , #ebdbb2 , #fbf1c7 , #fb4934 , #fe8019 , #fabd2f , #b8bb26 , #8ec07c , #83a598 , #d3869b , #d65d0e ) // โ•ผ "gruvbox dark, medium" โ•ผโ•ผ "Dawid Kurek ([email protected]), morhetz (https://github.com/morhetz/gruvbox)" export gruvbox_dark_medium() => array.from( #282828 , #3c3836 , #504945 , #665c54 , #bdae93 , #d5c4a1 , #ebdbb2 , #fbf1c7 , #fb4934 , #fe8019 , #fabd2f , #b8bb26 , #8ec07c , #83a598 , #d3869b , #d65d0e ) // โ•ผ "gruvbox dark, pale" โ•ผโ•ผ "Dawid Kurek ([email protected]), morhetz (https://github.com/morhetz/gruvbox)" export gruvbox_dark_pale() => array.from( #262626 , #3a3a3a , #4e4e4e , #8a8a8a , #949494 , #dab997 , #d5c4a1 , #ebdbb2 , #d75f5f , #ff8700 , #ffaf00 , #afaf00 , #85ad85 , #83adad , #d485ad , #d65d0e ) // โ•ผ "gruvbox dark, soft" โ•ผโ•ผ "Dawid Kurek ([email protected]), morhetz (https://github.com/morhetz/gruvbox)" export gruvbox_dark_soft() => array.from( #32302f , #3c3836 , #504945 , #665c54 , #bdae93 , #d5c4a1 , #ebdbb2 , #fbf1c7 , #fb4934 , #fe8019 , #fabd2f , #b8bb26 , #8ec07c , #83a598 , #d3869b , #d65d0e ) // โ•ผ "gruvbox light, hard" โ•ผโ•ผ "Dawid Kurek ([email protected]), morhetz (https://github.com/morhetz/gruvbox)" export gruvbox_light_hard() => array.from( #f9f5d7 , #ebdbb2 , #d5c4a1 , #bdae93 , #665c54 , #504945 , #3c3836 , #282828 , #9d0006 , #af3a03 , #b57614 , #79740e , #427b58 , #076678 , #8f3f71 , #d65d0e ) // โ•ผ "gruvbox light, medium" โ•ผโ•ผ "Dawid Kurek ([email protected]), morhetz (https://github.com/morhetz/gruvbox)" export gruvbox_light_medium() => array.from( #fbf1c7 , #ebdbb2 , #d5c4a1 , #bdae93 , #665c54 , #504945 , #3c3836 , #282828 , #9d0006 , #af3a03 , #b57614 , #79740e , #427b58 , #076678 , #8f3f71 , #d65d0e ) // โ•ผ "gruvbox light, soft" โ•ผโ•ผ "Dawid Kurek ([email protected]), morhetz (https://github.com/morhetz/gruvbox)" export gruvbox_light_soft() => array.from( #f2e5bc , #ebdbb2 , #d5c4a1 , #bdae93 , #665c54 , #504945 , #3c3836 , #282828 , #9d0006 , #af3a03 , #b57614 , #79740e , #427b58 , #076678 , #8f3f71 , #d65d0e ) // โ•ผ "gruvbox Material Dark, Ha โ•ผโ•ผ "Mayush Kumar (https://github.com/MayushKumar), sainnhe (https://github.com/sainnhe/gruvbox-material-vscode)" export gruvbox_material_dark_hard() => array.from( #202020 , #2a2827 , #504945 , #5a524c , #bdae93 , #ddc7a1 , #ebdbb2 , #fbf1c7 , #ea6962 , #e78a4e , #d8a657 , #a9b665 , #89b482 , #7daea3 , #d3869b , #bd6f3e ) // โ•ผ "gruvbox Material Dark, Me โ•ผโ•ผ "Mayush Kumar (https://github.com/MayushKumar), sainnhe (https://github.com/sainnhe/gruvbox-material-vscode)" export gruvbox_material_dark_medium() => array.from( #292828 , #32302f , #504945 , #665c54 , #bdae93 , #ddc7a1 , #ebdbb2 , #fbf1c7 , #ea6962 , #e78a4e , #d8a657 , #a9b665 , #89b482 , #7daea3 , #d3869b , #bd6f3e ) // โ•ผ "gruvbox Material Dark, So โ•ผโ•ผ "Mayush Kumar (https://github.com/MayushKumar), sainnhe (https://github.com/sainnhe/gruvbox-material-vscode)" export gruvbox_material_dark_soft() => array.from( #32302f , #3c3836 , #5a524c , #7c6f64 , #bdae93 , #ddc7a1 , #ebdbb2 , #fbf1c7 , #ea6962 , #e78a4e , #d8a657 , #a9b665 , #89b482 , #7daea3 , #d3869b , #bd6f3e ) // โ•ผ "gruvbox Material Light, H โ•ผโ•ผ "Mayush Kumar (https://github.com/MayushKumar), sainnhe (https://github.com/sainnhe/gruvbox-material-vscode)" export gruvbox_material_light_hard() => array.from( #f9f5d7 , #fbf1c7 , #e0cfa9 , #a89984 , #c9b99a , #654735 , #3c3836 , #282828 , #c14a4a , #c35e0a , #b47109 , #6c782e , #4c7a5d , #45707a , #945e80 , #e78a4e ) // โ•ผ "gruvbox Material Light, M โ•ผโ•ผ "Mayush Kumar (https://github.com/MayushKumar), sainnhe (https://github.com/sainnhe/gruvbox-material-vscode)" export gruvbox_material_light_medium() => array.from( #fbf1c7 , #f2e5bc , #d5c4a1 , #bdae93 , #665c54 , #654735 , #3c3836 , #282828 , #c14a4a , #c35e0a , #b47109 , #6c782e , #4c7a5d , #45707a , #945e80 , #e78a4e ) // โ•ผ "gruvbox Material Light, S โ•ผโ•ผ "Mayush Kumar (https://github.com/MayushKumar), sainnhe (https://github.com/sainnhe/gruvbox-material-vscode)" export gruvbox_material_light_soft() => array.from( #f2e5bc , #ebdbb2 , #c9b99a , #a89984 , #665c54 , #654735 , #3c3836 , #282828 , #c14a4a , #c35e0a , #b47109 , #6c782e , #4c7a5d , #45707a , #945e80 , #e78a4e ) // โ•ผ "Hardcore" โ•ผโ•ผ "Chris Caller" export hardcore() => array.from( #212121 , #303030 , #353535 , #4A4A4A , #707070 , #cdcdcd , #e5e5e5 , #ffffff , #f92672 , #fd971f , #e6db74 , #a6e22e , #708387 , #66d9ef , #9e6ffe , #e8b882 ) // โ•ผ "Harmonic16 Dark" โ•ผโ•ผ "Jannik Siebert (https://github.com/janniks)" export harmonic16_dark() => array.from( #0b1c2c , #223b54 , #405c79 , #627e99 , #aabcce , #cbd6e2 , #e5ebf1 , #f7f9fb , #bf8b56 , #bfbf56 , #8bbf56 , #56bf8b , #568bbf , #8b56bf , #bf568b , #bf5656 ) // โ•ผ "Harmonic16 Light" โ•ผโ•ผ "Jannik Siebert (https://github.com/janniks)" export harmonic16_light() => array.from( #f7f9fb , #e5ebf1 , #cbd6e2 , #aabcce , #627e99 , #405c79 , #223b54 , #0b1c2c , #bf8b56 , #bfbf56 , #8bbf56 , #56bf8b , #568bbf , #8b56bf , #bf568b , #bf5656 ) // โ•ผ "Heetch Light" โ•ผโ•ผ "Geoffrey Teale ([email protected])" export heetch_light() => array.from( #feffff , #392551 , #7b6d8b , #9c92a8 , #ddd6e5 , #5a496e , #470546 , #190134 , #27d9d5 , #bdb6c5 , #5ba2b6 , #f80059 , #c33678 , #47f9f5 , #bd0152 , #dedae2 ) // โ•ผ "Heetch Dark" โ•ผโ•ผ "Geoffrey Teale ([email protected])" export heetch_dark() => array.from( #190134 , #392551 , #5A496E , #7B6D8B , #9C92A8 , #BDB6C5 , #DEDAE2 , #FEFFFF , #27D9D5 , #5BA2B6 , #8F6C97 , #C33678 , #F80059 , #BD0152 , #82034C , #470546 ) // โ•ผ "Helios" โ•ผโ•ผ "Alex Meyer (https://github.com/reyemxela)" export helios() => array.from( #1d2021 , #383c3e , #53585b , #6f7579 , #cdcdcd , #d5d5d5 , #dddddd , #e5e5e5 , #d72638 , #eb8413 , #f19d1a , #88b92d , #1ba595 , #1e8bac , #be4264 , #c85e0d ) // โ•ผ "Hopscotch" โ•ผโ•ผ "Jan T. Sott" export hopscotch() => array.from( #322931 , #433b42 , #5c545b , #797379 , #989498 , #b9b5b8 , #d5d3d5 , #ffffff , #dd464c , #fd8b19 , #fdcc59 , #8fc13e , #149b93 , #1290bf , #c85e7c , #b33508 ) // โ•ผ "Horizon Dark" โ•ผโ•ผ "Michaรซl Ball (http://github.com/michael-ball/)" export horizon_dark() => array.from( #1C1E26 , #232530 , #2E303E , #6F6F70 , #9DA0A2 , #CBCED0 , #DCDFE4 , #E3E6EE , #E93C58 , #E58D7D , #EFB993 , #EFAF8E , #24A8B4 , #DF5273 , #B072D1 , #E4A382 ) // โ•ผ "Horizon Light" โ•ผโ•ผ "Michaรซl Ball (http://github.com/michael-ball/)" export horizon_light() => array.from( #FDF0ED , #FADAD1 , #F9CBBE , #BDB3B1 , #948C8A , #403C3D , #302C2D , #201C1D , #F7939B , #F6661E , #FBE0D9 , #94E1B0 , #DC3318 , #DA103F , #1D8991 , #E58C92 ) // โ•ผ "Horizon Terminal Dark" โ•ผโ•ผ "Michaรซl Ball (http://github.com/michael-ball/)" export horizon_terminal_dark() => array.from( #1C1E26 , #232530 , #2E303E , #6F6F70 , #9DA0A2 , #CBCED0 , #DCDFE4 , #E3E6EE , #E95678 , #FAB795 , #FAC29A , #29D398 , #59E1E3 , #26BBD9 , #EE64AC , #F09383 ) // โ•ผ "Horizon Terminal Light" โ•ผโ•ผ "Michaรซl Ball (http://github.com/michael-ball/)" export horizon_terminal_light() => array.from( #FDF0ED , #FADAD1 , #F9CBBE , #BDB3B1 , #948C8A , #403C3D , #302C2D , #201C1D , #E95678 , #F9CEC3 , #FADAD1 , #29D398 , #59E1E3 , #26BBD9 , #EE64AC , #F9CBBE ) // โ•ผ "Humanoid dark" โ•ผโ•ผ "Thomas (tasmo) Friese" export humanoid_dark() => array.from( #232629 , #333b3d , #484e54 , #60615d , #c0c0bd , #f8f8f2 , #fcfcf6 , #fcfcfc , #f11235 , #ff9505 , #ffb627 , #02d849 , #0dd9d6 , #00a6fb , #f15ee3 , #b27701 ) // โ•ผ "Humanoid light" โ•ผโ•ผ "Thomas (tasmo) Friese" export humanoid_light() => array.from( #f8f8f2 , #efefe9 , #deded8 , #c0c0bd , #60615d , #232629 , #2f3337 , #070708 , #b0151a , #ff3d00 , #ffb627 , #388e3c , #008e8e , #0082c9 , #700f98 , #b27701 ) // โ•ผ "iA Dark" โ•ผโ•ผ "iA Inc. (modified by aramisgithub)" export ia_dark() => array.from( #1a1a1a , #222222 , #1d414d , #767676 , #b8b8b8 , #cccccc , #e8e8e8 , #f8f8f8 , #d88568 , #d86868 , #b99353 , #83a471 , #7c9cae , #8eccdd , #b98eb2 , #8b6c37 ) // โ•ผ "iA Light" โ•ผโ•ผ "iA Inc. (modified by aramisgithub)" export ia_light() => array.from( #f6f6f6 , #dedede , #bde5f2 , #898989 , #767676 , #181818 , #e8e8e8 , #f8f8f8 , #9c5a02 , #c43e18 , #c48218 , #38781c , #2d6bb1 , #48bac2 , #a94598 , #8b6c37 ) // โ•ผ "Icy Dark" โ•ผโ•ผ "icyphox (https://icyphox.ga)" export icy_dark() => array.from( #021012 , #031619 , #041f23 , #052e34 , #064048 , #095b67 , #0c7c8c , #109cb0 , #16c1d9 , #b3ebf2 , #80deea , #4dd0e1 , #26c6da , #00bcd4 , #00acc1 , #0097a7 ) // โ•ผ "IR Black" โ•ผโ•ผ "Timothรฉe Poisot (http://timotheepoisot.fr)" export ir_black() => array.from( #000000 , #242422 , #484844 , #6c6c66 , #918f88 , #b5b3aa , #d9d7cc , #fdfbee , #ff6c60 , #e9c062 , #ffffb6 , #a8ff60 , #c6c5fe , #96cbfe , #ff73fd , #b18a3d ) // โ•ผ "Isotope" โ•ผโ•ผ "Jan T. Sott" export isotope() => array.from( #000000 , #404040 , #606060 , #808080 , #c0c0c0 , #d0d0d0 , #e0e0e0 , #ffffff , #ff0000 , #ff9900 , #ff0099 , #33ff00 , #00ffff , #0066ff , #cc00ff , #3300ff ) // โ•ผ "Kanagawa" โ•ผโ•ผ "Tommaso Laurenzi (https://github.com/rebelot)" export kanagawa() => array.from( #1F1F28 , #16161D , #223249 , #54546D , #727169 , #DCD7BA , #C8C093 , #717C7C , #C34043 , #FFA066 , #C0A36E , #76946A , #6A9589 , #7E9CD8 , #957FB8 , #D27E99 ) // โ•ผ "Katy" โ•ผโ•ผ "George Essig (https://github.com/gessig)" export katy() => array.from( #292d3e , #444267 , #5c598b , #676e95 , #8796b0 , #959dcb , #959dcb , #ffffff , #6e98e1 , #f78c6c , #e0a557 , #78c06e , #83b7e5 , #82aaff , #c792ea , #ff5370 ) // โ•ผ "Kimber" โ•ผโ•ผ "Mishka Nguyen (https://github.com/akhsiM)" export kimber() => array.from( #222222 , #313131 , #555D55 , #644646 , #5A5A5A , #DEDEE7 , #C3C3B4 , #FFFFE6 , #C88C8C , #476C88 , #D8B56D , #99C899 , #78B4B4 , #537C9C , #86CACD , #704F4F ) // โ•ผ "lime" โ•ผโ•ผ "limelier" export lime() => array.from( #1a1a2f , #202030 , #2a2a3f , #313140 , #515155 , #818175 , #fff2d1 , #fff8e1 , #ff662a , #ff773a , #ffd15e , #8cd97c , #4cad83 , #2b926f , #1b825f , #b4d97c ) // โ•ผ "Macintosh" โ•ผโ•ผ "Rebecca Bettencourt (http://www.kreativekorp.com)" export macintosh() => array.from( #000000 , #404040 , #404040 , #808080 , #808080 , #c0c0c0 , #c0c0c0 , #ffffff , #dd0907 , #ff6403 , #fbf305 , #1fb714 , #02abea , #0000d3 , #4700a5 , #90713a ) // โ•ผ "Marrakesh" โ•ผโ•ผ "Alexandre Gavioli (http://github.com/Alexx2/)" export marrakesh() => array.from( #201602 , #302e00 , #5f5b17 , #6c6823 , #86813b , #948e48 , #ccc37a , #faf0a5 , #c35359 , #b36144 , #a88339 , #18974e , #75a738 , #477ca1 , #8868b3 , #b3588e ) // โ•ผ "Materia" โ•ผโ•ผ "Defman21" export materia() => array.from( #263238 , #2C393F , #37474F , #707880 , #C9CCD3 , #CDD3DE , #D5DBE5 , #FFFFFF , #EC5F67 , #EA9560 , #FFCC00 , #8BD649 , #80CBC4 , #89DDFF , #82AAFF , #EC5F67 ) // โ•ผ "Material Darker" โ•ผโ•ผ "Nate Peterson" export material_darker() => array.from( #212121 , #303030 , #353535 , #4A4A4A , #B2CCD6 , #EEFFFF , #EEFFFF , #FFFFFF , #F07178 , #F78C6C , #FFCB6B , #C3E88D , #89DDFF , #82AAFF , #C792EA , #FF5370 ) // โ•ผ "Material Lighter" โ•ผโ•ผ "Nate Peterson" export material_lighter() => array.from( #FAFAFA , #E7EAEC , #CCEAE7 , #CCD7DA , #8796B0 , #80CBC4 , #80CBC4 , #FFFFFF , #FF5370 , #F76D47 , #FFB62C , #91B859 , #39ADB5 , #6182B8 , #7C4DFF , #E53935 ) // โ•ผ "Material Palenight" โ•ผโ•ผ "Nate Peterson" export material_palenight() => array.from( #292D3E , #444267 , #32374D , #676E95 , #8796B0 , #959DCB , #959DCB , #FFFFFF , #F07178 , #F78C6C , #FFCB6B , #C3E88D , #89DDFF , #82AAFF , #C792EA , #FF5370 ) // โ•ผ "Material Vivid" โ•ผโ•ผ "joshyrobot" export material_vivid() => array.from( #202124 , #27292c , #323639 , #44464d , #676c71 , #80868b , #9e9e9e , #ffffff , #f44336 , #ff9800 , #ffeb3b , #00e676 , #00bcd4 , #2196f3 , #673ab7 , #8d6e63 ) // โ•ผ "Material" โ•ผโ•ผ "Nate Peterson" export material() => array.from( #263238 , #2E3C43 , #314549 , #546E7A , #B2CCD6 , #EEFFFF , #EEFFFF , #FFFFFF , #F07178 , #F78C6C , #FFCB6B , #C3E88D , #89DDFF , #82AAFF , #C792EA , #FF5370 ) // โ•ผ "Mellow Purple" โ•ผโ•ผ "gidsi" export mellow_purple() => array.from( #1e0528 , #1A092D , #331354 , #320f55 , #873582 , #ffeeff , #ffeeff , #f8c0ff , #00d9e9 , #aa00a3 , #955ae7 , #05cb0d , #b900b1 , #550068 , #8991bb , #4d6fff ) // โ•ผ "Mexico Light" โ•ผโ•ผ "Sheldon Johnson" export mexico_light() => array.from( #f8f8f8 , #e8e8e8 , #d8d8d8 , #b8b8b8 , #585858 , #383838 , #282828 , #181818 , #ab4642 , #dc9656 , #f79a0e , #538947 , #4b8093 , #7cafc2 , #96609e , #a16946 ) // โ•ผ "Mocha" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export mocha() => array.from( #3B3228 , #534636 , #645240 , #7e705a , #b8afad , #d0c8c6 , #e9e1dd , #f5eeeb , #cb6077 , #d28b71 , #f4bc87 , #beb55b , #7bbda4 , #8ab3b5 , #a89bb9 , #bb9584 ) // โ•ผ "Monokai" โ•ผโ•ผ "Wimer Hazenberg (http://www.monokai.nl)" export monokai() => array.from( #272822 , #383830 , #49483e , #75715e , #a59f85 , #f8f8f2 , #f5f4f1 , #f9f8f5 , #f92672 , #fd971f , #f4bf75 , #a6e22e , #a1efe4 , #66d9ef , #ae81ff , #cc6633 ) // โ•ผ "Nebula" โ•ผโ•ผ "Gabriel Fontes (https://github.com/Misterio77)" export Nebula() => array.from( #22273b , #414f60 , #5a8380 , #6e6f72 , #87888b , #a4a6a9 , #c7c9cd , #8dbdaa , #777abc , #94929e , #4f9062 , #6562a8 , #226f68 , #4d6bb6 , #716cae , #8c70a7 ) // โ•ผ "Nord" โ•ผโ•ผ "arcticicestudio" export nord() => array.from( #2E3440 , #3B4252 , #434C5E , #4C566A , #D8DEE9 , #E5E9F0 , #ECEFF4 , #8FBCBB , #BF616A , #D08770 , #EBCB8B , #A3BE8C , #88C0D0 , #81A1C1 , #B48EAD , #5E81AC ) // โ•ผ "Nova" โ•ผโ•ผ "George Essig (https://github.com/gessig), Trevor D. Miller (https://trevordmiller.com)" export nova() => array.from( #3C4C55 , #556873 , #6A7D89 , #899BA6 , #899BA6 , #C5D4DD , #899BA6 , #556873 , #83AFE5 , #7FC1CA , #A8CE93 , #7FC1CA , #F2C38F , #83AFE5 , #9A93E1 , #F2C38F ) // โ•ผ "Ocean" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export ocean() => array.from( #2b303b , #343d46 , #4f5b66 , #65737e , #a7adba , #c0c5ce , #dfe1e8 , #eff1f5 , #bf616a , #d08770 , #ebcb8b , #a3be8c , #96b5b4 , #8fa1b3 , #b48ead , #ab7967 ) // โ•ผ "OceanicNext" โ•ผโ•ผ "https://github.com/voronianski/oceanic-next-color-scheme" export oceanicnext() => array.from( #1B2B34 , #343D46 , #4F5B66 , #65737E , #A7ADBA , #C0C5CE , #CDD3DE , #D8DEE9 , #EC5f67 , #F99157 , #FAC863 , #99C794 , #5FB3B3 , #6699CC , #C594C5 , #AB7967 ) // โ•ผ "One Light" โ•ผโ•ผ "Daniel Pfeifer (http://github.com/purpleKarrot)" export one_light() => array.from( #fafafa , #f0f0f1 , #e5e5e6 , #a0a1a7 , #696c77 , #383a42 , #202227 , #090a0b , #ca1243 , #d75f00 , #c18401 , #50a14f , #0184bc , #4078f2 , #a626a4 , #986801 ) // โ•ผ "OneDark" โ•ผโ•ผ "Lalit Magant (http://github.com/tilal6991)" export onedark() => array.from( #282c34 , #353b45 , #3e4451 , #545862 , #565c64 , #abb2bf , #b6bdca , #c8ccd4 , #e06c75 , #d19a66 , #e5c07b , #98c379 , #56b6c2 , #61afef , #c678dd , #be5046 ) // โ•ผ "Outrun Dark" โ•ผโ•ผ "Hugo Delahousse (http://github.com/hugodelahousse/)" export outrun_dark() => array.from( #00002A , #20204A , #30305A , #50507A , #B0B0DA , #D0D0FA , #E0E0FF , #F5F5FF , #FF4242 , #FC8D28 , #F3E877 , #59F176 , #0EF0F0 , #66B0FF , #F10596 , #F003EF ) // โ•ผ "pandora" โ•ผโ•ผ "Cassandra Fox" export pandora() => array.from( #131213 , #2f1823 , #472234 , #ffbee3 , #9b2a46 , #f15c99 , #81506a , #632227 , #b00b69 , #ff9153 , #ffcc00 , #9ddf69 , #714ca6 , #008080 , #a24030 , #a24030 ) // โ•ผ "PaperColor Dark" โ•ผโ•ผ "Jon Leopard (http://github.com/jonleopard) based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme)" export papercolor_dark() => array.from( #1c1c1c , #af005f , #5faf00 , #d7af5f , #5fafd7 , #808080 , #d7875f , #d0d0d0 , #585858 , #5faf5f , #afd700 , #af87d7 , #ffaf00 , #ff5faf , #00afaf , #5f8787 ) // โ•ผ "PaperColor Light" โ•ผโ•ผ "Jon Leopard (http://github.com/jonleopard) based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme)" export papercolor_light() => array.from( #eeeeee , #af0000 , #008700 , #5f8700 , #0087af , #444444 , #005f87 , #878787 , #bcbcbc , #d70000 , #d70087 , #8700af , #d75f00 , #d75f00 , #005faf , #005f87 ) // โ•ผ "Paraiso" โ•ผโ•ผ "Jan T. Sott" export paraiso() => array.from( #2f1e2e , #41323f , #4f424c , #776e71 , #8d8687 , #a39e9b , #b9b6b0 , #e7e9db , #ef6155 , #f99b15 , #fec418 , #48b685 , #5bc4bf , #06b6ef , #815ba4 , #e96ba8 ) // โ•ผ "Pasque" โ•ผโ•ผ "Gabriel Fontes (https://github.com/Misterio77)" export pasque() => array.from( #271C3A , #100323 , #3E2D5C , #5D5766 , #BEBCBF , #DEDCDF , #EDEAEF , #BBAADD , #A92258 , #918889 , #804ead , #C6914B , #7263AA , #8E7DC6 , #953B9D , #59325C ) // โ•ผ "PhD" โ•ผโ•ผ "Hennig Hasemann (http://leetless.de/vim.html)" export phd() => array.from( #061229 , #2a3448 , #4d5666 , #717885 , #9a99a3 , #b8bbc2 , #dbdde0 , #ffffff , #d07346 , #f0a000 , #fbd461 , #99bf52 , #72b9bf , #5299bf , #9989cc , #b08060 ) // โ•ผ "Pico" โ•ผโ•ผ "PICO-8 (http://www.lexaloffle.com/pico-8.php)" export pico() => array.from( #000000 , #1d2b53 , #7e2553 , #008751 , #ab5236 , #5f574f , #c2c3c7 , #fff1e8 , #ff004d , #ffa300 , #fff024 , #00e756 , #29adff , #83769c , #ff77a8 , #ffccaa ) // โ•ผ "pinky" โ•ผโ•ผ "Benjamin (https://github.com/b3nj5m1n)" export pinky() => array.from( #171517 , #1b181b , #1d1b1d , #383338 , #e7dbdb , #f5f5f5 , #ffffff , #f7f3f7 , #ffa600 , #00ff66 , #20df6c , #ff0066 , #6600ff , #00ffff , #007fff , #df206c ) // โ•ผ "Pop" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export pop() => array.from( #000000 , #202020 , #303030 , #505050 , #b0b0b0 , #d0d0d0 , #e0e0e0 , #ffffff , #eb008a , #f29333 , #f8ca12 , #37b349 , #00aabb , #0e5a94 , #b31e8d , #7a2d00 ) // โ•ผ "Porple" โ•ผโ•ผ "Niek den Breeje (https://github.com/AuditeMarlow)" export porple() => array.from( #292c36 , #333344 , #474160 , #65568a , #b8b8b8 , #d8d8d8 , #e8e8e8 , #f8f8f8 , #f84547 , #d28e5d , #efa16b , #95c76f , #64878f , #8485ce , #b74989 , #986841 ) // โ•ผ "Primer Dark Dimmed" โ•ผโ•ผ "Jimmy Lin" export primer_dark_dimmed() => array.from( #1c2128 , #373e47 , #444c56 , #545d68 , #768390 , #909dab , #adbac7 , #cdd9e5 , #f47067 , #e0823d , #c69026 , #57ab5a , #96d0ff , #539bf5 , #e275ad , #ae5622 ) // โ•ผ "Primer Dark" โ•ผโ•ผ "Jimmy Lin" export primer_dark() => array.from( #010409 , #21262d , #30363d , #484f58 , #8b949e , #b1bac4 , #c9d1d9 , #f0f6fc , #ff7b72 , #f0883e , #d29922 , #3fb950 , #a5d6ff , #58a6ff , #f778ba , #bd561d ) // โ•ผ "Primer Light" โ•ผโ•ผ "Jimmy Lin" export primer_light() => array.from( #fafbfc , #e1e4e8 , #d1d5da , #959da5 , #444d56 , #2f363d , #24292e , #1b1f23 , #d73a49 , #f66a0a , #ffd33d , #28a745 , #79b8ff , #0366d6 , #ea4aaa , #a04100 ) // โ•ผ "Purpledream" โ•ผโ•ผ "malet" export purpledream() => array.from( #100510 , #302030 , #403040 , #605060 , #bbb0bb , #ddd0dd , #eee0ee , #fff0ff , #FF1D0D , #CCAE14 , #F000A0 , #14CC64 , #0075B0 , #00A0F0 , #B000D0 , #6A2A3C ) // โ•ผ "Qualia" โ•ผโ•ผ "isaacwhanson" export qualia() => array.from( #101010 , #454545 , #454545 , #454545 , #808080 , #C0C0C0 , #C0C0C0 , #454545 , #EFA6A2 , #A3B8EF , #E6A3DC , #80C990 , #C8C874 , #50CACD , #E0AF85 , #808080 ) // โ•ผ "Railscasts" โ•ผโ•ผ "Ryan Bates (http://railscasts.com)" export railscasts() => array.from( #2b2b2b , #272935 , #3a4055 , #5a647e , #d4cfc9 , #e6e1dc , #f4f1ed , #f9f7f3 , #da4939 , #cc7833 , #ffc66d , #a5c261 , #519f50 , #6d9cbe , #b6b3eb , #bc9458 ) // โ•ผ "Rebecca" โ•ผโ•ผ "Victor Borja (http://github.com/vic) based on Rebecca Theme (http://github.com/vic/rebecca-theme)" export rebecca() => array.from( #292a44 , #663399 , #383a62 , #666699 , #a0a0c5 , #f1eff8 , #ccccff , #53495d , #a0a0c5 , #efe4a1 , #ae81ff , #6dfedf , #8eaee0 , #2de0a7 , #7aa5ff , #ff79c6 ) // โ•ผ "Rosรฉ Pine Dawn" โ•ผโ•ผ "Emilia Dunfelt <[email protected]>" export rose_pine_dawn() => array.from( #faf4ed , #fffaf3 , #f2e9de , #9893a5 , #6e6a86 , #575279 , #555169 , #26233a , #1f1d2e , #b4637a , #ea9d34 , #d7827e , #286983 , #56949f , #907aa9 , #c5c3ce ) // โ•ผ "Rosรฉ Pine Moon" โ•ผโ•ผ "Emilia Dunfelt <[email protected]>" export rose_pine_moon() => array.from( #232136 , #2a273f , #393552 , #59546d , #817c9c , #e0def4 , #f5f5f7 , #d9d7e1 , #ecebf0 , #eb6f92 , #f6c177 , #ea9a97 , #3e8fb0 , #9ccfd8 , #c4a7e7 , #b9b9bc ) // โ•ผ "Rosรฉ Pine" โ•ผโ•ผ "Emilia Dunfelt <[email protected]>" export rose_pine() => array.from( #191724 , #1f1d2e , #26233a , #555169 , #6e6a86 , #e0def4 , #f0f0f3 , #c5c3ce , #e2e1e7 , #eb6f92 , #f6c177 , #ebbcba , #31748f , #9ccfd8 , #c4a7e7 , #e5e5e5 ) // โ•ผ "Sagelight" โ•ผโ•ผ "Carter Veldhuizen" export sagelight() => array.from( #f8f8f8 , #e8e8e8 , #d8d8d8 , #b8b8b8 , #585858 , #383838 , #282828 , #181818 , #fa8480 , #ffaa61 , #ffdc61 , #a0d2c8 , #a2d6f5 , #a0a7d2 , #c8a0d2 , #d2b2a0 ) // โ•ผ "Sakura" โ•ผโ•ผ "Misterio77 (http://github.com/Misterio77)" export sakura() => array.from( #feedf3 , #f8e2e7 , #e0ccd1 , #755f64 , #665055 , #564448 , #42383a , #33292b , #df2d52 , #f6661e , #c29461 , #2e916d , #1d8991 , #006e93 , #5e2180 , #ba0d35 ) // โ•ผ "Sandcastle" โ•ผโ•ผ "George Essig (https://github.com/gessig)" export sandcastle() => array.from( #282c34 , #2c323b , #3e4451 , #665c54 , #928374 , #a89984 , #d5c4a1 , #fdf4c1 , #83a598 , #a07e3b , #a07e3b , #528b8b , #83a598 , #83a598 , #d75f5f , #a87322 ) // โ•ผ "Seti UI" โ•ผโ•ผ "" export seti_ui() => array.from( #151718 , #282a2b , #3B758C , #41535B , #43a5d5 , #d6d6d6 , #eeeeee , #ffffff , #Cd3f45 , #db7b55 , #e6cd69 , #9fca56 , #55dbbe , #55b5db , #a074c4 , #8a553f ) // โ•ผ "Shades of Purple" โ•ผโ•ผ "Iolar Demartini Junior (http://github.com/demartini) based on Shades of Purple Theme (https://github.com/ahmadawais/shades-of-purple-vscode)." export shades_of_purple() => array.from( #1e1e3f , #43d426 , #f1d000 , #808080 , #6871ff , #c7c7c7 , #ff77ff , #ffffff , #d90429 , #f92a1c , #ffe700 , #3ad900 , #00c5c7 , #6943ff , #ff2c70 , #79e8fb ) // โ•ผ "ShadeSmear Dark" โ•ผโ•ผ "Kyle Giammarco (http://kyle.giammar.co)" export shadesmear_dark() => array.from( #232323 , #1C1C1C , #4E4E4E , #C0C0C0 , #E4E4E4 , #DBDBDB , #E4E4E4 , #1C1C1C , #CC5450 , #A64270 , #307878 , #71983B , #C57D42 , #376388 , #D7AB54 , #6D6D6D ) // โ•ผ "ShadeSmear Light" โ•ผโ•ผ "Kyle Giammarco (http://kyle.giammar.co)" export shadesmear_light() => array.from( #DBDBDB , #E4E4E4 , #C0C0C0 , #4E4E4E , #1C1C1C , #232323 , #1C1C1C , #E4E4E4 , #CC5450 , #A64270 , #307878 , #71983B , #C57D42 , #376388 , #D7AB54 , #6D6D6D ) // โ•ผ "Shapeshifter" โ•ผโ•ผ "Tyler Benziger (http://tybenz.com)" export shapeshifter() => array.from( #f9f9f9 , #e0e0e0 , #ababab , #555555 , #343434 , #102015 , #040404 , #000000 , #e92f2f , #e09448 , #dddd13 , #0ed839 , #23edda , #3b48e3 , #f996e2 , #69542d ) // โ•ผ "Silk Dark" โ•ผโ•ผ "Gabriel Fontes (https://github.com/Misterio77)" export silk_dark() => array.from( #0e3c46 , #1D494E , #2A5054 , #587073 , #9DC8CD , #C7DBDD , #CBF2F7 , #D2FAFF , #fb6953 , #fcab74 , #fce380 , #73d8ad , #3fb2b9 , #46bddd , #756b8a , #9b647b ) // โ•ผ "Silk Light" โ•ผโ•ผ "Gabriel Fontes (https://github.com/Misterio77)" export silk_light() => array.from( #E9F1EF , #CCD4D3 , #90B7B6 , #5C787B , #4B5B5F , #385156 , #0e3c46 , #D2FAFF , #CF432E , #D27F46 , #CFAD25 , #6CA38C , #329CA2 , #39AAC9 , #6E6582 , #865369 ) // โ•ผ "Snazzy" โ•ผโ•ผ "Chawye Hsu (https://github.com/chawyehsu) based on Hyper Snazzy Theme (https://github.com/sindresorhus/hyper-snazzy)" export snazzy() => array.from( #282a36 , #34353e , #43454f , #78787e , #a5a5a9 , #e2e4e5 , #eff0eb , #f1f1f0 , #ff5c57 , #ff9f43 , #f3f99d , #5af78e , #9aedfe , #57c7ff , #ff6ac1 , #b2643c ) // โ•ผ "Solar Flare Light" โ•ผโ•ผ "Chuck Harmston (https://chuck.harmston.ch)" export solar_flare_light() => array.from( #F5F7FA , #E8E9ED , #A6AFB8 , #85939E , #667581 , #586875 , #222E38 , #18262F , #EF5253 , #E66B2B , #E4B51C , #7CC844 , #52CBB0 , #33B5E1 , #A363D5 , #D73C9A ) // โ•ผ "Solar Flare" โ•ผโ•ผ "Chuck Harmston (https://chuck.harmston.ch)" export solar_flare() => array.from( #18262F , #222E38 , #586875 , #667581 , #85939E , #A6AFB8 , #E8E9ED , #F5F7FA , #EF5253 , #E66B2B , #E4B51C , #7CC844 , #52CBB0 , #33B5E1 , #A363D5 , #D73C9A ) // โ•ผ "Solarized Dark" โ•ผโ•ผ "Ethan Schoonover (modified by aramisgithub)" export solarized_dark() => array.from( #002b36 , #073642 , #586e75 , #657b83 , #839496 , #93a1a1 , #eee8d5 , #fdf6e3 , #dc322f , #cb4b16 , #b58900 , #859900 , #2aa198 , #268bd2 , #6c71c4 , #d33682 ) // โ•ผ "Solarized Light" โ•ผโ•ผ "Ethan Schoonover (modified by aramisgithub)" export solarized_light() => array.from( #fdf6e3 , #eee8d5 , #93a1a1 , #839496 , #657b83 , #586e75 , #073642 , #002b36 , #dc322f , #cb4b16 , #b58900 , #859900 , #2aa198 , #268bd2 , #6c71c4 , #d33682 ) // โ•ผ "Spaceduck" โ•ผโ•ผ "Guillermo Rodriguez (https://github.com/pineapplegiant), packaged by Gabriel Fontes (https://github.com/Misterio77)" export spaceduck() => array.from( #16172d , #1b1c36 , #30365F , #686f9a , #818596 , #ecf0c1 , #c1c3cc , #ffffff , #e33400 , #e39400 , #f2ce00 , #5ccc96 , #00a3cc , #7a5ccc , #b3a1e6 , #ce6f8f ) // โ•ผ "Spacemacs" โ•ผโ•ผ "Nasser Alshammari (https://github.com/nashamri/spacemacs-theme)" export spacemacs() => array.from( #1f2022 , #282828 , #444155 , #585858 , #b8b8b8 , #a3a3a3 , #e8e8e8 , #f8f8f8 , #f2241f , #ffa500 , #b1951d , #67b11d , #2d9574 , #4f97d7 , #a31db1 , #b03060 ) // โ•ผ "Stella" โ•ผโ•ผ "Shrimpram" export stella() => array.from( #2B213C , #362B48 , #4D4160 , #655978 , #7F7192 , #998BAD , #B4A5C8 , #EBDCFF , #C79987 , #8865C6 , #C7C691 , #ACC79B , #9BC7BF , #A5AAD4 , #C594FF , #C7AB87 ) // โ•ผ "Still Alive" โ•ผโ•ผ "Derrick McKee ([email protected])" export still_alive() => array.from( #F0F0F0 , #F0D848 , #FFF018 , #F01818 , #F00000 , #D80000 , #489000 , #30A860 , #487830 , #183048 , #426395 , #5C5C6A , #2C3C57 , #001878 , #900000 , #140C0D ) // โ•ผ "summercamp" โ•ผโ•ผ "zoe firi (zoefiri.github.io)" export summercamp() => array.from( #1c1810 , #2a261c , #3a3527 , #504b38 , #5f5b45 , #736e55 , #bab696 , #f8f5de , #e35142 , #fba11b , #f2ff27 , #5ceb5a , #5aebbc , #489bf0 , #FF8080 , #F69BE7 ) // โ•ผ "Summerfruit Dark" โ•ผโ•ผ "Christopher Corley (http://christop.club/)" export summerfruit_dark() => array.from( #151515 , #202020 , #303030 , #505050 , #B0B0B0 , #D0D0D0 , #E0E0E0 , #FFFFFF , #FF0086 , #FD8900 , #ABA800 , #00C918 , #1FAAAA , #3777E6 , #AD00A1 , #CC6633 ) // โ•ผ "Summerfruit Light" โ•ผโ•ผ "Christopher Corley (http://christop.club/)" export summerfruit_light() => array.from( #FFFFFF , #E0E0E0 , #D0D0D0 , #B0B0B0 , #000000 , #101010 , #151515 , #202020 , #FF0086 , #FD8900 , #ABA800 , #00C918 , #1FAAAA , #3777E6 , #AD00A1 , #CC6633 ) // โ•ผ "Synth Midnight Terminal D โ•ผโ•ผ "Michaรซl Ball (http://github.com/michael-ball/)" export synth_midnight_terminal_dark() => array.from( #050608 , #1a1b1c , #28292a , #474849 , #a3a5a6 , #c1c3c4 , #cfd1d2 , #dddfe0 , #b53b50 , #ea770d , #c9d364 , #06ea61 , #42fff9 , #03aeff , #ea5ce2 , #cd6320 ) // โ•ผ "Synth Midnight Terminal L โ•ผโ•ผ "Michaรซl Ball (http://github.com/michael-ball/)" export synth_midnight_terminal_light() => array.from( #dddfe0 , #cfd1d2 , #c1c3c4 , #a3a5a6 , #474849 , #28292a , #1a1b1c , #050608 , #b53b50 , #ea770d , #c9d364 , #06ea61 , #42fff9 , #03aeff , #ea5ce2 , #cd6320 ) // โ•ผ "Tango" โ•ผโ•ผ "@Schnouki, based on the Tango Desktop Project" export tango() => array.from( #2e3436 , #8ae234 , #fce94f , #555753 , #729fcf , #d3d7cf , #ad7fa8 , #eeeeec , #cc0000 , #ef2929 , #c4a000 , #4e9a06 , #06989a , #3465a4 , #75507b , #34e2e2 ) // โ•ผ "tender" โ•ผโ•ผ "Jacobo Tabernero (https://github/com/jacoborus/tender.vim)" export tender() => array.from( #282828 , #383838 , #484848 , #4c4c4c , #b8b8b8 , #eeeeee , #e8e8e8 , #feffff , #f43753 , #dc9656 , #ffc24b , #c9d05c , #73cef4 , #b3deef , #d3b987 , #a16946 ) // โ•ผ "Tokyo City Dark" โ•ผโ•ผ "Michaรซl Ball" export tokyo_city_dark() => array.from( #171D23 , #1D252C , #28323A , #526270 , #B7C5D3 , #D8E2EC , #F6F6F8 , #FBFBFD , #F7768E , #FF9E64 , #B7C5D3 , #9ECE6A , #89DDFF , #7AA2F7 , #BB9AF7 , #BB9AF7 ) // โ•ผ "Tokyo City Light" โ•ผโ•ผ "Michaรซl Ball" export tokyo_city_light() => array.from( #FBFBFD , #F6F6F8 , #EDEFF6 , #9699A3 , #4c505e , #343B59 , #1D252C , #171D23 , #8C4351 , #965027 , #4C505E , #485E30 , #4C505E , #34548a , #5A4A78 , #5A4A78 ) // โ•ผ "Tokyo City Terminal Dark" โ•ผโ•ผ "Michaรซl Ball" export tokyo_city_terminal_dark() => array.from( #171D23 , #1D252C , #28323A , #526270 , #B7C5D3 , #D8E2EC , #F6F6F8 , #FBFBFD , #D95468 , #FF9E64 , #EBBF83 , #8BD49C , #70E1E8 , #539AFC , #B62D65 , #DD9D82 ) // โ•ผ "Tokyo City Terminal Light โ•ผโ•ผ "Michaรซl Ball" export tokyo_city_terminal_light() => array.from( #FBFBFD , #F6F6F8 , #D8E2EC , #B7C5D3 , #526270 , #28323A , #1D252C , #171D23 , #8C4351 , #965027 , #8f5E15 , #33635C , #0F4B6E , #34548A , #5A4A78 , #7E5140 ) // โ•ผ "Tokyo Night Dark" โ•ผโ•ผ "Michaรซl Ball" export tokyo_night_dark() => array.from( #1A1B26 , #16161E , #2F3549 , #444B6A , #787C99 , #A9B1D6 , #CBCCD1 , #D5D6DB , #C0CAF5 , #A9B1D6 , #0DB9D7 , #9ECE6A , #B4F9F8 , #2AC3DE , #BB9AF7 , #F7768E ) // โ•ผ "Tokyo Night Light" โ•ผโ•ผ "Michaรซl Ball" export tokyo_night_light() => array.from( #D5D6DB , #CBCCD1 , #DFE0E5 , #9699A3 , #4C505E , #343B59 , #1A1B26 , #1A1B26 , #343B58 , #965027 , #166775 , #485E30 , #3E6968 , #34548A , #5A4A78 , #8C4351 ) // โ•ผ "Tokyo Night Storm" โ•ผโ•ผ "Michaรซl Ball" export tokyo_night_storm() => array.from( #24283B , #16161E , #343A52 , #444B6A , #787C99 , #A9B1D6 , #CBCCD1 , #D5D6DB , #C0CAF5 , #A9B1D6 , #0DB9D7 , #9ECE6A , #B4F9F8 , #2AC3DE , #BB9AF7 , #F7768E ) // โ•ผ "Tokyo Night Terminal Dark โ•ผโ•ผ "Michaรซl Ball" export tokyo_night_terminal_dark() => array.from( #16161E , #1A1B26 , #2F3549 , #444B6A , #787C99 , #787C99 , #CBCCD1 , #D5D6DB , #F7768E , #FF9E64 , #E0AF68 , #41A6B5 , #7DCFFF , #7AA2F7 , #BB9AF7 , #D18616 ) // โ•ผ "Tokyo Night Terminal Ligh โ•ผโ•ผ "Michaรซl Ball" export tokyo_night_terminal_light() => array.from( #D5D6DB , #CBCCD1 , #DFE0E5 , #9699A3 , #4C505E , #4C505E , #1A1B26 , #1A1B26 , #8C4351 , #965027 , #8F5E15 , #33635C , #0F4B6E , #34548A , #5A4A78 , #655259 ) // โ•ผ "Tokyo Night Terminal Stor โ•ผโ•ผ "Michaรซl Ball" export tokyo_night_terminal_storm() => array.from( #24283B , #1A1B26 , #343A52 , #444B6A , #787C99 , #787C99 , #CBCCD1 , #D5D6DB , #F7768E , #FF9E64 , #E0AF68 , #41A6B5 , #7DCFFF , #7AA2F7 , #BB9AF7 , #D18616 ) // โ•ผ "Tokyodark Terminal" โ•ผโ•ผ "Tiagovla (https://github.com/tiagovla/)" export tokyodark_terminal() => array.from( #11121d , #1A1B2A , #212234 , #282c34 , #4a5057 , #a0a8cd , #a0a8cd , #a0a8cd , #ee6d85 , #f6955b , #d7a65f , #95c561 , #38a89d , #7199ee , #a485dd , #773440 ) // โ•ผ "Tokyodark" โ•ผโ•ผ "Tiagovla (https://github.com/tiagovla/)" export tokyodark() => array.from( #11121d , #151621 , #43444f , #393a45 , #1b1c27 , #abb2bf , #555661 , #2c2d38 , #a485dd , #a485dd , #7199ee , #d7A65f , #a485dd , #95c561 , #ee6d85 , #773440 ) // โ•ผ "Tomorrow Night Eighties" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export tomorrow_night_eighties() => array.from( #2d2d2d , #393939 , #515151 , #999999 , #b4b7b4 , #cccccc , #e0e0e0 , #ffffff , #f2777a , #f99157 , #ffcc66 , #99cc99 , #66cccc , #6699cc , #cc99cc , #a3685a ) // โ•ผ "Tomorrow Night" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export tomorrow_night() => array.from( #1d1f21 , #282a2e , #373b41 , #969896 , #b4b7b4 , #c5c8c6 , #e0e0e0 , #ffffff , #cc6666 , #de935f , #f0c674 , #b5bd68 , #8abeb7 , #81a2be , #b294bb , #a3685a ) // โ•ผ "Tomorrow" โ•ผโ•ผ "Chris Kempson (http://chriskempson.com)" export tomorrow() => array.from( #ffffff , #e0e0e0 , #d6d6d6 , #8e908c , #969896 , #4d4d4c , #282a2e , #1d1f21 , #c82829 , #f5871f , #eab700 , #718c00 , #3e999f , #4271ae , #8959a8 , #a3685a ) // โ•ผ "London Tube" โ•ผโ•ผ "Jan T. Sott" export london_tube() => array.from( #231f20 , #1c3f95 , #5a5758 , #737171 , #959ca1 , #d9d8d8 , #e7e7e8 , #ffffff , #ee2e24 , #f386a1 , #ffd204 , #00853e , #85cebc , #009ddc , #98005d , #b06110 ) // โ•ผ "Twilight" โ•ผโ•ผ "David Hart (https://github.com/hartbit)" export twilight() => array.from( #1e1e1e , #323537 , #464b50 , #5f5a60 , #838184 , #a7a7a7 , #c3c3c3 , #ffffff , #cf6a4c , #cda869 , #f9ee98 , #8f9d6a , #afc4db , #7587a6 , #9b859d , #9b703f ) // โ•ผ "Unikitty Dark" โ•ผโ•ผ "Josh W Lewis (@joshwlewis)" export unikitty_dark() => array.from( #2e2a31 , #4a464d , #666369 , #838085 , #9f9da2 , #bcbabe , #d8d7da , #f5f4f7 , #d8137f , #d65407 , #dc8a0e , #17ad98 , #149bda , #796af5 , #bb60ea , #c720ca ) // โ•ผ "Unikitty Light" โ•ผโ•ผ "Josh W Lewis (@joshwlewis)" export unikitty_light() => array.from( #ffffff , #e1e1e2 , #c4c3c5 , #a7a5a8 , #89878b , #6c696e , #4f4b51 , #322d34 , #d8137f , #d65407 , #dc8a0e , #17ad98 , #149bda , #775dff , #aa17e6 , #e013d0 ) // โ•ผ "Unikitty Reversible" โ•ผโ•ผ "Josh W Lewis (@joshwlewis)" export unikitty_reversible() => array.from( #2e2a31 , #4b484e , #69666b , #878589 , #a5a3a6 , #c3c2c4 , #e1e0e1 , #ffffff , #d8137f , #d65407 , #dc8a0e , #17ad98 , #149bda , #7864fa , #b33ce8 , #d41acd ) // โ•ผ "UwUnicorn" โ•ผโ•ผ "Fernando Marques (https://github.com/RakkiUwU) and Gabriel Fontes (https://github.com/Misterio77)" export uwunicorn() => array.from( #241b26 , #2f2a3f , #46354a , #6c3cb2 , #7e5f83 , #eed5d9 , #d9c2c6 , #e4ccd0 , #877bb6 , #de5b44 , #a84a73 , #c965bf , #9c5fce , #6a9eb5 , #78a38f , #a3a079 ) // โ•ผ "vice" โ•ผโ•ผ "Thomas Leon Highbaugh [email protected]" export vice() => array.from( #17191E , #22262d , #3c3f4c , #383a47 , #555e70 , #8b9cbe , #B2BFD9 , #f4f4f7 , #ff29a8 , #85ffe0 , #f0ffaa , #0badff , #8265ff , #00eaff , #00f6d9 , #ff3d81 ) // โ•ผ "vulcan" โ•ผโ•ผ "Andrey Varfolomeev" export vulcan() => array.from( #041523 , #122339 , #003552 , #7a5759 , #6b6977 , #5b778c , #333238 , #214d68 , #818591 , #9198a3 , #adb4b9 , #977d7c , #977d7c , #977d7c , #9198a3 , #977d7c ) // โ•ผ "Windows 10 Light" โ•ผโ•ผ "Fergus Collins (https://github.com/C-Fergus)" export windows_10_light() => array.from( #f2f2f2 , #e5e5e5 , #d9d9d9 , #cccccc , #ababab , #767676 , #414141 , #0c0c0c , #c50f1f , #f9f1a5 , #c19c00 , #13a10e , #3a96dd , #0037da , #881798 , #16c60c ) // โ•ผ "Windows 10" โ•ผโ•ผ "Fergus Collins (https://github.com/C-Fergus)" export windows_10() => array.from( #0c0c0c , #2f2f2f , #535353 , #767676 , #b9b9b9 , #cccccc , #dfdfdf , #f2f2f2 , #e74856 , #c19c00 , #f9f1a5 , #16c60c , #61d6d6 , #3b78ff , #b4009e , #13a10e ) // โ•ผ "Windows 95 Light" โ•ผโ•ผ "Fergus Collins (https://github.com/C-Fergus)" export windows_95_light() => array.from( #fcfcfc , #e0e0e0 , #c4c4c4 , #a8a8a8 , #7e7e7e , #545454 , #2a2a2a , #000000 , #a80000 , #fcfc54 , #a85400 , #00a800 , #00a8a8 , #0000a8 , #a800a8 , #54fc54 ) // โ•ผ "Windows 95" โ•ผโ•ผ "Fergus Collins (https://github.com/C-Fergus)" export windows_95() => array.from( #000000 , #1C1C1C , #383838 , #545454 , #7e7e7e , #a8a8a8 , #d2d2d2 , #fcfcfc , #fc5454 , #a85400 , #fcfc54 , #54fc54 , #54fcfc , #5454fc , #fc54fc , #00a800 ) // โ•ผ "Windows High Contrast Lig โ•ผโ•ผ "Fergus Collins (https://github.com/C-Fergus)" export windows_high_contrast_light() => array.from( #fcfcfc , #e8e8e8 , #d4d4d4 , #c0c0c0 , #7e7e7e , #545454 , #2a2a2a , #000000 , #800000 , #fcfc54 , #808000 , #008000 , #008080 , #000080 , #800080 , #54fc54 ) // โ•ผ "Windows High Contrast" โ•ผโ•ผ "Fergus Collins (https://github.com/C-Fergus)" export windows_high_contrast() => array.from( #000000 , #1C1C1C , #383838 , #545454 , #a2a2a2 , #c0c0c0 , #dedede , #fcfcfc , #fc5454 , #808000 , #fcfc54 , #54fc54 , #54fcfc , #5454fc , #fc54fc , #008000 ) // โ•ผ "Windows NT Light" โ•ผโ•ผ "Fergus Collins (https://github.com/C-Fergus)" export windows_nt_light() => array.from( #ffffff , #eaeaea , #d5d5d5 , #c0c0c0 , #a0a0a0 , #808080 , #404040 , #000000 , #800000 , #ffff00 , #808000 , #008000 , #008080 , #000080 , #800080 , #00ff00 ) // โ•ผ "Windows NT" โ•ผโ•ผ "Fergus Collins (https://github.com/C-Fergus)" export windows_nt() => array.from( #000000 , #2a2a2a , #555555 , #808080 , #a1a1a1 , #c0c0c0 , #e0e0e0 , #ffffff , #ff0000 , #808000 , #ffff00 , #00ff00 , #00ffff , #0000ff , #ff00ff , #008000 ) // โ•ผ "Woodland" โ•ผโ•ผ "Jay Cornwall (https://jcornwall.com)" export woodland() => array.from( #231e18 , #302b25 , #48413a , #9d8b70 , #b4a490 , #cabcb1 , #d7c8bc , #e4d4c8 , #d35c5c , #ca7f32 , #e0ac16 , #b7ba53 , #6eb958 , #88a4d3 , #bb90e2 , #b49368 ) // โ•ผ "XCode Dusk" โ•ผโ•ผ "Elsa Gonsiorowski (https://github.com/gonsie)" export xcode_dusk() => array.from( #282B35 , #3D4048 , #53555D , #686A71 , #7E8086 , #939599 , #A9AAAE , #BEBFC2 , #B21889 , #786DC5 , #438288 , #DF0002 , #00A0BE , #790EAD , #B21889 , #C77C48 ) // โ•ผ "Zenburn" โ•ผโ•ผ "elnawe" export zenburn() => array.from( #383838 , #404040 , #606060 , #6f6f6f , #808080 , #dcdccc , #c0c0c0 , #ffffff , #dca3a3 , #dfaf8f , #e0cf9f , #5f7f5f , #93e0e3 , #7cb8bb , #dc8cc3 , #000000 ) // ======================================================================= // @function To create a theme matrix with string index, use a color matrix global // add theme name to string array of theme titles // and last input a theme from above, or create your own theme arrays. // @param _mtx (color ) matrix for storage // @param _title (string ) Name of theme being added // @param _choices (string[] ) name index // @param _theme (color[] ) colors being added // @returns void export addToMatrix(matrix<color> _mtx, string _title, array<string> _choices, array<color> _theme) => if barstate.isfirst array.push(_choices,_title) matrix.add_row(_mtx,matrix.rows(_mtx),_theme) // @function Add theme to color matrix Non-indexed // @param _mtx (color ) matrix for storage // @param _theme (color[] ) colors being added export addToMatrix(matrix<color> _mtx, array<color> _theme) => if barstate.isfirst matrix.add_row(_mtx,matrix.rows(_mtx),_theme) //@function Dark Themne Selection (With light Equivalent in same location) //@returns Color matrix of dark themes export dark() => var _dark_cols = matrix.new<color>(0,16) if barstate.isfirst addToMatrix(_dark_cols, atelier_cave() ) addToMatrix(_dark_cols, atelier_dune() ) addToMatrix(_dark_cols, atelier_estuary() ) addToMatrix(_dark_cols, atelier_forest() ) addToMatrix(_dark_cols, atelier_heath() ) addToMatrix(_dark_cols, atelier_lakeside() ) addToMatrix(_dark_cols, atelier_plateau() ) addToMatrix(_dark_cols, atelier_savanna() ) addToMatrix(_dark_cols, atelier_seaside() ) addToMatrix(_dark_cols, atelier_sulphurpool() ) addToMatrix(_dark_cols, brush_trees_dark() ) addToMatrix(_dark_cols, classic_dark() ) addToMatrix(_dark_cols, edge_dark() ) addToMatrix(_dark_cols, equilibrium_dark() ) addToMatrix(_dark_cols, equilibrium_gray_dark() ) addToMatrix(_dark_cols, google_dark() ) addToMatrix(_dark_cols, grayscale_dark() ) addToMatrix(_dark_cols, gruvbox_dark_hard() ) addToMatrix(_dark_cols, gruvbox_dark_soft() ) addToMatrix(_dark_cols, gruvbox_material_dark_hard() ) addToMatrix(_dark_cols, gruvbox_material_dark_medium() ) addToMatrix(_dark_cols, gruvbox_material_dark_soft() ) addToMatrix(_dark_cols, harmonic16_dark() ) addToMatrix(_dark_cols, heetch_dark() ) addToMatrix(_dark_cols, horizon_dark() ) addToMatrix(_dark_cols, horizon_terminal_dark() ) addToMatrix(_dark_cols, humanoid_dark() ) addToMatrix(_dark_cols, ia_dark() ) addToMatrix(_dark_cols, material_darker() ) addToMatrix(_dark_cols, onedark() ) addToMatrix(_dark_cols, papercolor_dark() ) addToMatrix(_dark_cols, primer_dark() ) addToMatrix(_dark_cols, shadesmear_dark() ) addToMatrix(_dark_cols, silk_dark() ) addToMatrix(_dark_cols, solar_flare() ) addToMatrix(_dark_cols, solarized_dark() ) addToMatrix(_dark_cols, summerfruit_dark() ) addToMatrix(_dark_cols, synth_midnight_terminal_dark() ) addToMatrix(_dark_cols, tokyo_city_dark() ) addToMatrix(_dark_cols, tokyo_city_terminal_dark() ) addToMatrix(_dark_cols, tokyo_night_dark() ) addToMatrix(_dark_cols, tokyo_night_terminal_dark() ) addToMatrix(_dark_cols, unikitty_dark() ) _dark_cols //@function light Themne Selection (With dark Equivalent in same location) //@returns Color matrix of light themes export light() => var _light_cols = matrix.new<color>(0,16) if barstate.isfirst addToMatrix(_light_cols, atelier_cave_light() ) addToMatrix(_light_cols, atelier_dune_light() ) addToMatrix(_light_cols, atelier_estuary_light() ) addToMatrix(_light_cols, atelier_forest_light() ) addToMatrix(_light_cols, atelier_heath_light() ) addToMatrix(_light_cols, atelier_lakeside_light() ) addToMatrix(_light_cols, atelier_plateau_light() ) addToMatrix(_light_cols, atelier_savanna_light() ) addToMatrix(_light_cols, atelier_seaside_light() ) addToMatrix(_light_cols, atelier_sulphurpool_light() ) addToMatrix(_light_cols, brush_trees() ) addToMatrix(_light_cols, classic_light() ) addToMatrix(_light_cols, edge_light() ) addToMatrix(_light_cols, equilibrium_gray_light() ) addToMatrix(_light_cols, equilibrium_light() ) addToMatrix(_light_cols, google_light() ) addToMatrix(_light_cols, grayscale_light() ) addToMatrix(_light_cols, gruvbox_light_hard() ) addToMatrix(_light_cols, gruvbox_light_soft() ) addToMatrix(_light_cols, gruvbox_material_light_hard() ) addToMatrix(_light_cols, gruvbox_material_light_medium()) addToMatrix(_light_cols, gruvbox_material_light_soft() ) addToMatrix(_light_cols, harmonic16_light() ) addToMatrix(_light_cols, heetch_light() ) addToMatrix(_light_cols, horizon_light() ) addToMatrix(_light_cols, horizon_terminal_light() ) addToMatrix(_light_cols, humanoid_light() ) addToMatrix(_light_cols, ia_light() ) addToMatrix(_light_cols, material_lighter() ) addToMatrix(_light_cols, one_light() ) addToMatrix(_light_cols, papercolor_light() ) addToMatrix(_light_cols, primer_light() ) addToMatrix(_light_cols, shadesmear_light() ) addToMatrix(_light_cols, silk_light() ) addToMatrix(_light_cols, solar_flare_light() ) addToMatrix(_light_cols, solarized_light() ) addToMatrix(_light_cols, summerfruit_light() ) addToMatrix(_light_cols, synth_midnight_terminal_light()) addToMatrix(_light_cols, tokyo_city_light() ) addToMatrix(_light_cols, tokyo_city_terminal_light() ) addToMatrix(_light_cols, tokyo_night_light() ) addToMatrix(_light_cols, tokyo_night_terminal_light() ) addToMatrix(_light_cols, unikitty_light() ) _light_cols // @function Get a Theme By Name // @param _mtx (Matrix color) Name of Theme // @param _themes (Array string) Array with Names of Themes // @param _theme (string ) Name of Theme to select export selectTheme(matrix<color> _mtx, array<string> _themes, string _theme) => matrix.row(_mtx,array.indexof(_themes,_theme)) // @function Get a Theme By Number // @param _mtx (Matrix color) Name of Theme // @param _theme (int ) Number of Theme to select export selectTheme(matrix<color> _mtx, int _theme) => matrix.row(_mtx,_theme) var _light = light() var _dark = dark () var _both = matrix.concat(_light,_dark) _themecols = selectTheme(_both, int(bar_index/5)%85) p0 = plot(0 , 'separator', na ) p1 = plot(1 , 'separator', na ) p2 = plot(2 , 'separator', na ) p3 = plot(3 , 'separator', na ) p4 = plot(4 , 'separator', na ) p5 = plot(5 , 'separator', na ) p6 = plot(6 , 'separator', na ) p7 = plot(7 , 'separator', na ) p8 = plot(8 , 'separator', na ) p9 = plot(9 , 'separator', na ) p10 = plot(10 , 'separator', na ) p11 = plot(11 , 'separator', na ) p12 = plot(12 , 'separator', na ) p13 = plot(13 , 'separator', na ) p14 = plot(14 , 'separator', na ) p15 = plot(15 , 'separator', na ) p16 = plot(16 , 'separator', na ) fill(p0 , p1 , array.get(_themecols, 0 ) ) fill(p1 , p2 , array.get(_themecols, 1 ) ) fill(p2 , p3 , array.get(_themecols, 2 ) ) fill(p3 , p4 , array.get(_themecols, 3 ) ) fill(p4 , p5 , array.get(_themecols, 4 ) ) fill(p5 , p6 , array.get(_themecols, 5 ) ) fill(p6 , p7 , array.get(_themecols, 6 ) ) fill(p7 , p8 , array.get(_themecols, 7 ) ) fill(p8 , p9 , array.get(_themecols, 8 ) ) fill(p9 , p10 , array.get(_themecols, 9 ) ) fill(p10 , p11 , array.get(_themecols, 10 ) ) fill(p11 , p12 , array.get(_themecols, 11 ) ) fill(p12 , p13 , array.get(_themecols, 12 ) ) fill(p13 , p14 , array.get(_themecols, 13 ) ) fill(p14 , p15 , array.get(_themecols, 14 ) ) fill(p15 , p16 , array.get(_themecols, 15 ) )
AD's - Indecisive Candles, volume spikes, gaps
https://www.tradingview.com/script/d3l2b9jK-AD-s-Indecisive-Candles-volume-spikes-gaps/
Mkt_RnD
https://www.tradingview.com/u/Mkt_RnD/
13
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ Mkt_RnD //@version=5 indicator("Indecisive Candles, volume spikes, gaps", title="AD's", overlay=true) // Identification of pivots //mom = input(50, minval=1, title="Percentage for Momentum Candle") indec = input.int(15, minval=1, title="Percentage for Indecision Candle") //momentum = abs(open-close) >= mom*abs(high-low)/100 indecision = math.abs(open-close) < indec*math.abs(high-low)/100 //plotshape(momentum, style=shape.cross, location=location.abovebar, color=green, text='M') plotshape(indecision, style=shape.circle, location=location.abovebar, color=color.red) //Voluen spikes - twice the volume of 20 SMA of volume sma_volume = ta.sma(volume, 20)*2 volume_above_sma = volume > sma_volume plotshape(volume_above_sma, style=shape.triangleup, location=location.belowbar, color=color.blue) //Gap Identification barcolor(math.abs(high[1]) < math.abs(low)? color.green:math.abs(low[1]) > math.abs(high)? color.red:na)
Engulfing and ema
https://www.tradingview.com/script/8acCwSHL/
Malikdrajat
https://www.tradingview.com/u/Malikdrajat/
27
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ maulana5lik //@version=4 study("Engulfing and ema", overlay=true) validThreshold = input(50, title="Valid Threshold (%)", minval=1, maxval=100, step=1) boringThreshold = input(50, title="Boring Candle Threshold (%)", minval=1, maxval=100, step=1) engulfingThreshold = input(50, title="Engulfing Threshold (%)", minval=1, maxval=100, step=1) stopLevel = input(20, title="Stop Level (Pips)", minval=1) boringColor = input(color.orange, title="Boring Candle Color") ema1_length = input(9, title="EMA 1 Length") ema2_length = input(21, title="EMA 2 Length") // Calculate EMAs ema1 = ema(close, ema1_length) ema2 = ema(close, ema2_length) // Boring Candle (Inside Bar) boringCandle = abs(open - close) * 100 / abs(high - low) <= boringThreshold // Engulfing Candlestick bullEngulfing = close[1] < open[1] and close > open[1] and abs(close[1] - open[1]) >= (high[1] - low[1]) * (validThreshold / 100) and close - open >= engulfingThreshold / 100 and not boringCandle bearEngulfing = close[1] > open[1] and close < open[1] and abs(close[1] - open[1]) >= (high[1] - low[1]) * (validThreshold / 100) and open - close >= engulfingThreshold / 100 and not boringCandle bullStop = close + (stopLevel * syminfo.mintick) bearStop = close - (stopLevel * syminfo.mintick) bullSL = low bearSL = high bullTP = bullStop + (bullStop - low) bearTP = bearStop - (high - bearStop) // Plot EMAs on the chart plot(ema1, title="EMA 1", color=color.blue) plot(ema2, title="EMA 2", color=color.red) // Tandai Boring color barcolor(boringCandle ? boringColor : na) plotshape(bullEngulfing, style=shape.arrowup, location=location.abovebar, color=color.new(color.green, 0)) plotshape(bearEngulfing, style=shape.arrowdown, location=location.abovebar, color=color.new(color.red, 0)) // menentukan OP, SL dan TP plot(bullEngulfing ? bullStop : na, title="Bullish Engulfing stop", color=color.new(color.red, 0), linewidth=3, style=plot.style_linebr) plot(bearEngulfing ? bearStop : na, title="Bearish Engulfing stop", color=color.new(color.red, 0), linewidth=3, style=plot.style_linebr) plot(bullEngulfing ? bullSL : na, title="Bullish Engulfing SL", color=color.new(color.red, 0), linewidth=3, style=plot.style_linebr) plot(bearEngulfing ? bearSL : na, title="Bearish Engulfing SL", color=color.new(color.red, 0), linewidth=3, style=plot.style_linebr) plot(bullEngulfing ? bullTP : na, title="Bullish Engulfing TP", color=color.new(color.green, 0), linewidth=3, style=plot.style_linebr) plot(bearEngulfing ? bearTP : na, title="Bearish Engulfing TP", color=color.new(color.green, 0), linewidth=3, style=plot.style_linebr) // Label Stop Loss and Take Profit label.new(bullEngulfing ? bar_index : na, bullSL, text="SL: " + tostring(bullSL), color=color.red, textcolor=color.white, style=label.style_labelup, size=size.tiny) label.new(bearEngulfing ? bar_index : na, bearSL, text="SL: " + tostring(bearSL), color=color.red, textcolor=color.white, style=label.style_labeldown, size=size.tiny) label.new(bullEngulfing ? bar_index : na, bullTP, text="TP: " + tostring(bullTP), color=color.green, textcolor=color.white, style=label.style_labeldown, size=size.tiny) label.new(bearEngulfing ? bar_index : na, bearTP, text="TP: " + tostring(bearTP), color=color.green, textcolor=color.white, style=label.style_labelup, size=size.tiny)
Previous Candle Range 15 min
https://www.tradingview.com/script/HjQ81tL3-Previous-Candle-Range-15-min/
pioannis
https://www.tradingview.com/u/pioannis/
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/ // ยฉ pioannis //@version=5 indicator("Previous Candle Range 15 min", shorttitle = "Previous Candle Range 15 min", overlay=true) Lot_factor = input(1.0, "A factor in : LOT = Risc/(pips * A)") risc = input(1000, "Risc in $") var candlerange = 0. if open[1] > close[1] candlerange := high[1] - close[1] else candlerange := close[1] - low[1] //patternLabelPosLow = low[1] - math.abs(ta.atr(30) * 0.6) patternLabelPosLow = high[0] //patternLabelPosHigh = high[0] + math.abs(ta.atr(30) * 0.6) //l1 = label.new(bar_index[0]+5, patternLabelPosHigh, text=str.tostring(candlerange), style=label.style_label_down, color = color.rgb(89, 91, 89), textcolor=color.white) l2 = label.new(bar_index[0]+10, patternLabelPosLow, text=("Lot = " + str.tostring((risc/(candlerange*Lot_factor)), "#.#")), style=label.style_label_down, color = color.rgb(41, 40, 40), textcolor=color.white, size=size.large) //label.delete(l1[1]) label.delete(l2[1])
Expanded Camarilla Levels (R5 + R6)
https://www.tradingview.com/script/dgW9ZvpS-Expanded-Camarilla-Levels-R5-R6/
yareally
https://www.tradingview.com/u/yareally/
33
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 indicator('Expanded Camarilla Levels', overlay=true) mode = input.string(title='HTF Method', defval='Auto', options=['Auto', 'User Defined']) HTFm = input.timeframe('D', title='Time Frame (if HTF Method=User Defined)') showlast = input(title='Show Only Last Period', defval=true) showlabels = input(title='Show Labels', defval=true) lstyle = input.string(title='Line Style', options=['Solid', 'Circles', 'Cross'], defval='Solid') showhl1 = input(defval=false, title='Show R1/S1') showhl2 = input(defval=false, title='Show R2/S2') paddingTicks = input.int(defval = 0, title='# of ticks to allow after stop') //auto higher time frame HTFo = timeframe.period == '1' ? '30' : timeframe.period == '3' ? '60' : timeframe.period == '5' ? '240' : timeframe.period == '15' ? 'D' : timeframe.period == '30' ? 'D' : timeframe.period == '45' ? 'D' : timeframe.period == '60' ? 'D' : timeframe.period == '120' ? 'D' : timeframe.period == '180' ? 'D' : timeframe.period == '240' ? 'D' : timeframe.period == 'D' ? 'W' : timeframe.period == 'W' ? '4W' : 'D' HTF = mode == 'Auto' ? HTFo : HTFm highhtf = request.security(syminfo.tickerid, HTF, high[1], lookahead=barmerge.lookahead_on) lowhtf = request.security(syminfo.tickerid, HTF, low[1], lookahead=barmerge.lookahead_on) closehtf = request.security(syminfo.tickerid, HTF, close[1], lookahead=barmerge.lookahead_on) RANGE = highhtf - lowhtf // is this last bar for HTF? islast = showlast ? request.security(syminfo.tickerid, HTF, barstate.islast, lookahead=barmerge.lookahead_on) : true // Line Style linestyle = lstyle == 'Solid' ? plot.style_line : lstyle == 'Circle' ? plot.style_circles : plot.style_cross R6 = highhtf / lowhtf * closehtf R4 = closehtf + RANGE * 1.1 / 2 R3 = closehtf + RANGE * 1.1 / 4 R5 = R4 + 1.168 * (R4 - R3) R2 = closehtf + RANGE * 1.1 / 6 R1 = closehtf + RANGE * 1.1 / 12 S1 = closehtf - RANGE * 1.1 / 12 S2 = closehtf - RANGE * 1.1 / 6 S3 = closehtf - RANGE * 1.1 / 4 S4 = closehtf - RANGE * 1.1 / 2 S5 = S4 - 1.168 * (S3 - S4) S6 = closehtf - (R6 - closehtf) SellFrom = input.string(title='Sell from ', defval='R3', options=['R1', 'R2', 'R3', 'R4']) BuyFrom = input.string(title='Buy from ', defval='S3', options=['S1', 'S2', 'S3', 'S4']) pos = 0 iff_1 = BuyFrom == 'S4' ? S4 : 0 iff_2 = BuyFrom == 'S3' ? S3 : iff_1 iff_3 = BuyFrom == 'S2' ? S2 : iff_2 B = BuyFrom == 'S1' ? S1 : iff_3 iff_4 = SellFrom == 'R4' ? R4 : 0 iff_5 = SellFrom == 'R3' ? R3 : iff_4 iff_6 = SellFrom == 'R2' ? R2 : iff_5 S = SellFrom == 'R1' ? R1 : iff_6 iff_7 = close < B - paddingTicks ? -1 : nz(pos[1], 0) pos := close > S + paddingTicks ? 1 : iff_7 int signal = if pos == 1 1 else if pos == -1 -1 else 0 // for tying into a strategy on tradingview plot(signal, title="Ext Cam Strategy Connector", color=color.new(color.white, 100)) plot(islast ? R6 : na, title='R6', color=color.new(color.red, 0), linewidth=1, style=linestyle) plot(islast ? R5 : na, title='R5', color=color.new(color.red, 0), linewidth=1, style=linestyle) plot(islast ? R4 : na, title='R4', color=color.new(color.red, 0), linewidth=1, style=linestyle) plot(islast ? R3 : na, title='R3', color=color.new(color.red, 0), linewidth=1, style=linestyle) plot(islast ? S3 : na, title='S3', color=color.new(color.lime, 0), linewidth=1, style=linestyle) plot(islast ? S4 : na, title='S4', color=color.new(color.lime, 0), linewidth=1, style=linestyle) plot(islast ? S5 : na, title='S5', color=color.new(color.lime, 0), linewidth=1, style=linestyle) plot(islast ? S6 : na, title='S5', color=color.new(color.lime, 0), linewidth=1, style=linestyle) plot(islast and showhl1 ? R1 : na, title='R1', color=color.new(color.red, 0), linewidth=1, style=linestyle) plot(islast and showhl1 ? S1 : na, title='S1', color=color.new(color.lime, 0), linewidth=1, style=linestyle) plot(islast and showhl2 ? R2 : na, title='R2', color=color.new(color.red, 0), linewidth=1, style=linestyle) plot(islast and showhl2 ? S2 : na, title='S2', color=color.new(color.lime, 0), linewidth=1, style=linestyle) // Labels if showlabels var exlabels = array.new_label(0) for x = 0 to array.size(exlabels) > 0 ? array.size(exlabels) - 1 : na by 1 label.delete(array.pop(exlabels)) array.push(exlabels, label.new(x=bar_index + 20, y=S3, text='S3= ' + str.tostring(math.round_to_mintick(S3)), color=color.lime, textcolor=color.black, style=label.style_label_up, yloc=yloc.price)) array.push(exlabels, label.new(x=bar_index + 20, y=S4, text='S4= ' + str.tostring(math.round_to_mintick(S4)), color=color.lime, textcolor=color.black, style=label.style_label_up, yloc=yloc.price)) array.push(exlabels, label.new(x=bar_index + 20, y=S5, text='S5= ' + str.tostring(math.round_to_mintick(S5)), color=color.lime, textcolor=color.black, style=label.style_label_up, yloc=yloc.price)) array.push(exlabels, label.new(x=bar_index + 20, y=S6, text='S6= ' + str.tostring(math.round_to_mintick(S6)), color=color.lime, textcolor=color.black, style=label.style_label_up, yloc=yloc.price)) array.push(exlabels, label.new(x=bar_index + 20, y=R3, text='R3= ' + str.tostring(math.round_to_mintick(R3)), color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.price)) array.push(exlabels, label.new(x=bar_index + 20, y=R4, text='R4= ' + str.tostring(math.round_to_mintick(R4)), color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.price)) array.push(exlabels, label.new(x=bar_index + 20, y=R5, text='R5= ' + str.tostring(math.round_to_mintick(R5)), color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.price)) array.push(exlabels, label.new(x=bar_index + 20, y=R6, text='R6= ' + str.tostring(math.round_to_mintick(R6)), color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.price)) if showhl1 array.push(exlabels, label.new(x=bar_index + 20, y=S1, text='S1= ' + str.tostring(math.round_to_mintick(S1)), color=color.lime, textcolor=color.black, style=label.style_label_up, yloc=yloc.price)) array.push(exlabels, label.new(x=bar_index + 20, y=R1, text='R1= ' + str.tostring(math.round_to_mintick(R1)), color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.price)) if showhl2 array.push(exlabels, label.new(x=bar_index + 20, y=S2, text='S2= ' + str.tostring(math.round_to_mintick(S2)), color=color.lime, textcolor=color.black, style=label.style_label_up, yloc=yloc.price)) array.push(exlabels, label.new(x=bar_index + 20, y=R2, text='R2= ' + str.tostring(math.round_to_mintick(R2)), color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.price))
Previous Candle Range 15'-5'
https://www.tradingview.com/script/P4XzjHOi-Previous-Candle-Range-15-5/
pioannis
https://www.tradingview.com/u/pioannis/
10
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ pioannis //@version=5 indicator("Previous Candle Range 15'-5'", shorttitle = "Previous Candle Range 15'-5'", overlay=true) Lot_factor = input(1.0, "A factor in : LOT = Risc/(pips * A)") risc = input(1000, "Risc in $") candlerange = high[1] - low[1] //if open[1] > close[1] // candlerange := high[1] - close[1] //else // candlerange := close[1] - low[1] //patternLabelPosLow = low[1] - math.abs(ta.atr(30) * 0.6) patternLabelPosLow = high[0] //patternLabelPosHigh = high[0] + math.abs(ta.atr(30) * 0.6) //l1 = label.new(bar_index[0]+5, patternLabelPosHigh, text=str.tostring(candlerange), style=label.style_label_down, color = color.rgb(89, 91, 89), textcolor=color.white) l2 = label.new(bar_index[0]+10, patternLabelPosLow, text=("Lot = " + str.tostring((risc/(candlerange*Lot_factor)), "#.#")), style=label.style_label_down, color = color.rgb(41, 40, 40), textcolor=color.white, size=size.large) //label.delete(l1[1]) label.delete(l2[1])
Machine Learning Momentum Oscillator [ChartPrime]
https://www.tradingview.com/script/OCl780V6-Machine-Learning-Momentum-Oscillator-ChartPrime/
ChartPrime
https://www.tradingview.com/u/ChartPrime/
899
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ ChartPrime //@version=5 indicator("Machine Learning Momentum Oscillator [ChartPrime]",shorttitle = "Machine Learning Momentum Oscillator [ChartPrime]" , overlay=false) string Core = "โžž ML Core Settings ๐Ÿ”ธ" int ShortPriod = input.int (26, 'Short Period', 1,group=Core) int LongPriod = input.int (14, 'Long Period', 2,group=Core) int Smooth = input.int (13, 'Smoothing Period', 2,group=Core) int Neighbours = math.floor(input.int (50,'Neighbours Count', 5,group=Core)) bool showLines = input.bool(false,"Show prediction lines") float prediction = 0.0 float small = 0.0 float BIG = 0.0 int Class = 0 //-------- { type MachineLearning array<float> D1 array<float> D2 array<float> D3 array<int> dir array<int> Preds array<float> PerD type MLData float Prime1 float Prime2 float Prime3 float prediction float Smoothed float Band var ML = MachineLearning.new( array.new_float(0), array.new_float(0), array.new_float(), array.new_int(0), array.new_int(0), array.new_float() ) MData = MLData.new() method _Band(int len)=> math.min (ta.atr (len) * 0.3, close * (0.3/100)) [20] /2 method RawData(int x,z) => WS = ta.ema(hlc3 - hlc3[1], x) WQ = ta.ema(math.abs(hlc3 - hlc3[1]), x) Out = ta.ema(WS, z) Outs = ta.ema(WQ, z) Z = 100 * (Out / Outs) Z MData.Prime1 := RawData(LongPriod,Smooth) MData.Prime2 := RawData(ShortPriod,Smooth) MData.Band := _Band(30) * 2.5 max = MData.Prime2 + MData.Band min = MData.Prime2 - MData.Band for i = 0 to math.max(LongPriod,ShortPriod,Neighbours) Class := MData.Prime1[2] < MData.Prime1[0] ? -1 : MData.Prime1[2] > MData.Prime1[0] ? 1 : 0 ML.D1.push(MData.Prime1) ML.D2.push(MData.Prime2) ML.dir.push(Class) // if Algo.dir.size() > 10000 // Algo.dir.shift() // method MLCalculation(float x ,float y) => method MLCalculation(float x ,float y , float q , float z) => math.abs(x - y) + math.abs(q - z) // math.sqrt(math.abs(x - y) * math.abs(q - z)) // math.abs(x - y)) // Nearest Neighbor Calculations method Knn(MachineLearning MS) => float Minz = -1e-6 for i = 0 to MS.dir.size() - 1 MData.Prime3 := MLCalculation(MData.Prime1,MS.D1.get(i),MData.Prime2 ,MS.D2.get(i)) // MData.Prime3 := MLCalculation(MData.Prime1,ML.data.get(i)) if MData.Prime3 > Minz Minz := MData.Prime3 if MS.Preds.size() >= Neighbours MS.Preds.shift() MS.Preds.push(MS.dir.get(i)) float(MS.Preds.sum() * 5 ) // break MData.prediction := Knn(ML) MData.Smoothed := ta.sma(MData.prediction,Smooth) ML.PerD.push(MData.Smoothed) // if ML.PerD.size() > 1000 // ML.PerD.shift() small := ML.PerD.min() BIG := ML.PerD.max() Which = MData.prediction > 0 ? small:BIG Greeny = color.from_gradient(MData.prediction,small,BIG,color.rgb(7, 187, 37), color.rgb(0, 107, 43)) Reddy = color.from_gradient(MData.prediction,small,BIG,color.rgb(153, 0, 0),color.rgb(255, 82, 82)) con = MData.prediction == MData.Smoothed ? color.from_gradient(MData.prediction,small,BIG,color.rgb(164, 175, 10, 70), color.rgb(87, 61, 0, 70)): na pred = plot(MData.prediction,color =color.new(color.black,100),style = plot.style_line,title = "ML",editable = false) SmoothP = plot(MData.Smoothed,color =color.new(color.black,100),style = plot.style_linebr,title = "Smoothed ML",editable = false) _Which = plot(Which,color = color.new(color.black,100),editable = false) CONA = MData.prediction > MData.Smoothed ? Greeny:Reddy topLine = plot(BIG,color = color.new(color.white, 78),title = "T-TOP") botLine = plot(small,color = color.new(color.white, 78),title = "T-BOT") Top = plot(BIG + 15 ,color = color.new(color.white, 78),title = "B-TOP") Bot = plot(small - 15,color = color.new(color.white, 78),title = "B-BOT") _Center = plot(showLines ? MData.Prime1: na,color = color.new(#efb906, 70),linewidth = 2,editable = false) Center = plot(showLines ? MData.Prime2: na,color = color.new(#08d3ed, 70),linewidth = 2,editable = false) alpha = color.new(color.black, 100) TOP = plot(showLines ? max : na ,color = alpha,linewidth = 2,editable = false) BOT = plot(showLines ? min: na ,color = alpha,linewidth = 2,editable = false) plot(showLines ? MData.Prime1: na , "", color.new(#efb906, 70), 2, editable = false) plot(showLines ? MData.Prime1: na , "", color.new(#efb906, 90), 4, editable = false) plot(showLines ? MData.Prime2: na , "", color.new(#08d3ed, 70), 2, editable = false) plot(showLines ? MData.Prime2: na , "", color.new(#08d3ed, 90), 4, editable = false) fill(pred,_Which,color = con) fill(topLine,Top,color = color.rgb(255, 255, 255, 91)) fill(botLine,Bot,color = color.rgb(255, 255, 255, 91)) fill(topLine, botLine, BIG, small, color.rgb(255, 82, 82, 75), color.rgb(33, 149, 243, 82)) plotcandle(MData.prediction,MData.prediction,MData.Smoothed,MData.Smoothed,color=color.new(CONA,20),bordercolor = color.new(CONA,10)) fill(TOP, Center, top_value = max, bottom_value = MData.Prime2, bottom_color = color.new(#08edda, 75), top_color = alpha, editable = true) fill(Center, BOT, top_value = MData.Prime2, bottom_value = min, bottom_color = alpha, top_color = color.new(#08edda, 75), editable = true) fill(TOP, _Center, top_value = max, bottom_value = MData.Prime1, bottom_color = color.new(#efb906, 75), top_color = alpha, editable = true) fill(_Center, BOT, top_value = MData.Prime1, bottom_value = min, bottom_color = alpha, top_color = color.new(#efb906, 75), editable = true)
Volume Delta Trailing Stop [LuxAlgo]
https://www.tradingview.com/script/kkccHSw9-Volume-Delta-Trailing-Stop-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
1,799
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("Volume Delta Trailing Stop [LuxAlgo]", shorttitle="LuxAlgo - Volume Delta Trailing Stop", overlay=true) //-----------------------------------------------------------------------------} //Settings //-----------------------------------------------------------------------------{ res = input.string('1' , 'LTF' , options=['1S','5S','10S', '15S','30S','1' ]) trig = input.string('H/L' , 'Trigger' , options=[ 'H/L' , 'Close' ]) adj = input.string( 'Adjustment', 'ฮ” line', options=[ 'Adjustment' , 'Mult of TR' ]) perc = input.float ( 0.0 , 'Adjustment', minval =0, step=0.01 ) / 100 mult = input.float ( 10 , 'Mult of TR', minval =1, step=0.1 ) inputSource = input.string('open', 'based on:', options=[ 'open' , 'previous close']) neutral_green = input.bool (true , '"Neutral-Volume" is considered "Up-Volume"') gr = 'ย ย ย ย ย ย ย ย ย ย ย Upย ย ย ย -ย ย ย ย Down' , gr2 = 'ย ย ย ย ย ย ย ย Barcolor' colUp = input.color(#009688, 'ย ย ย ' , inline = 'c', group=gr ) colDn = input.color(#F23645, 'ย -ย ' , inline = 'c', group=gr ) BclUp = input.color(#3e89fa, 'ย ย ย ' , inline = 'c', group=gr2) BclDn = input.color(#ff9531, 'ย -ย ' , inline = 'c', group=gr2) wick = trig == 'H/L' ad = adj == 'Adjustment' //-----------------------------------------------------------------------------} //Variables //-----------------------------------------------------------------------------{ var int pos = 0, var int dir = na, var float sl = na, var float en = na, var float tLine = na, var float dLine = na //-----------------------------------------------------------------------------} //Calculations //-----------------------------------------------------------------------------{ o = inputSource == 'open' ? open : nz(close[1]) up = neutral_green ? close >= o : close > o dn = close < o [bV, sV] = request.security_lower_tf( syminfo.tickerid, res ,[ up ? volume : 0 , dn ? volume : 0 ] ) upV = bV .sum() dnV = sV .sum() dV = upV - dnV n = bar_index tr = ta.tr * mult mx = math.max(open, close) mn = math.min(open, close) bullishBear = dV > 0 and dn bearishBull = dV < 0 and up dir := bullishBear ? 1 : bearishBull? -1 : dir tLine := bullishBear ? high : bearishBull? low : tLine ch = ta.change(tLine) cp = ta.change( pos ) if pos == 0 if (wick ? high : close) > tLine and dir== 1 and o < tLine pos := 1 sl := low en := (wick ? tLine : close) alert('signal up' , wick ? alert.freq_once_per_bar : alert.freq_once_per_bar_close) if (wick ? low : close) < tLine and dir== -1 and o > tLine pos := -1 sl := high en := (wick ? tLine : close) alert('signal down', wick ? alert.freq_once_per_bar : alert.freq_once_per_bar_close) if pos == 1 if ch and not bearishBull lv = ad ? low * (1 - perc) : low - tr sl := math.max(sl, math.min(lv, nz(tLine[1], tLine))) if close < sl sl := na pos := 0 alert('TS-line broken down', alert.freq_once_per_bar_close) if pos == -1 if ch and not bullishBear lv = ad ? high * (1 + perc) : high + tr sl := math.min(sl, math.max(lv, nz(tLine[1], tLine))) if close > sl sl := na pos := 0 alert('TS-line broken up' , alert.freq_once_per_bar_close) if cp switch pos 1 => line.new (n -2, en, n -1, en, color=colUp, style=line.style_solid, width=2) -1 => line.new (n -2, en, n -1, en, color=colDn, style=line.style_solid, width=2) dLine := pos == 0 ? bearishBull ? low : bullishBear ? high : dLine : na //-----------------------------------------------------------------------------} //Plot/Fill/Barcolor //-----------------------------------------------------------------------------{ plot(dLine, color=color.new(chart.fg_color, 25), style = plot.style_steplinebr) l1 = plot(pos == 0 and pos[1] != 0 ? sl[1] : sl , color= pos == 1 or (pos == 0 and pos[1] == 1) ? colUp : pos == -1 or (pos == 0 and pos[1] == -1) ? colDn : color(na), style=plot.style_linebr, linewidth=2) l2 = plot(pos == 1 ? mn : pos == -1 ? mx : na , color=color.new(color.blue, 100), display=display.none) fill(l1, l2, color=close > sl or close[1] > sl[1] ? color.new(colUp, 80) : color.new(colDn, 80)) barcolor( bullishBear ? BclUp : bearishBull ? BclDn : na ) //-----------------------------------------------------------------------------}
TTP Green/Red Consecutive Candles
https://www.tradingview.com/script/OsiexeVY-TTP-Green-Red-Consecutive-Candles/
TheTradingParrot
https://www.tradingview.com/u/TheTradingParrot/
23
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ TheTradingParrot //@version=5 indicator("TTP Green/Red Consecutive Candles v0.1") redCandle = close < close[1] greenCandle = close >= close[1] candleChange = (redCandle and greenCandle[1]) or (greenCandle and redCandle[1]) bsGreen = ta.barssince(greenCandle) bsRed = ta.barssince(redCandle) threshold = input.int(5, "Signal threshold") varip mG = 0 varip mR = 0 showDistribution = input.bool(false, "Show distribution values") maL = input.int(50,"Length", group = "Moving Average") maM = input.float(1.0, "Factor", group = "Moving Average") maGreen = ta.ema(bsGreen, maL) * maM maRed = ta.ema(bsRed,maL) * maM plot(-1* maGreen, "red ma", style=plot.style_histogram, color=color.new(color.orange,50)) plot(maRed, "green ma", style=plot.style_histogram, color=color.new(color.lime,50)) if bsGreen > mG mG := bsGreen if bsRed > mR mR := bsRed plot(-1*bsGreen,"red", color.red) plot(bsRed, "green", color.green) plot(mR,"max red", color=color.white, style = plot.style_circles) plot(-1*mG, "max green", color=color.white, style = plot.style_circles) max = 30 varip redDistr = array.new<int>(max,0) varip greenDistr = array.new<int>(max,0) if candleChange if redCandle prev = array.get(greenDistr, bsRed[1]) log.info("prev={0} bsRed[1]={1}",prev, bsRed[1]) array.set(greenDistr, bsRed[1], prev + 1) if greenCandle prev = array.get(redDistr, bsGreen[1]) array.set(redDistr, bsGreen[1], prev + 1) maxG = max maxR = max for i = max to 1 g = array.get(greenDistr, i-1) r = array.get(redDistr, i-1) if maxG == max and g > 0 maxG := i if maxR == max and r > 0 maxR := i if barstate.isconfirmed and barstate.islastconfirmedhistory and showDistribution myLabel = label.new(x=bar_index , y=0, color=color.black, textcolor=color.white, style=label.style_label_left, size=size.large, text= "Green:\n"+str.tostring(greenDistr) + "\nmaxG=" +str.tostring(maxG) + "\nRed:\n"+str.tostring(redDistr) +"\nmaxR="+str.tostring(maxR), textalign=text.align_left ) displayThresholdSignals = input.bool(false, "Display Threshold signals") displayMASignals = input.bool(false, "Display MA signals") signalShortThreshold = bsRed >= threshold signalLongThreshold = bsGreen >= threshold plotshape(displayThresholdSignals and signalShortThreshold, "threshold signal short", style = shape.labeldown, location = location.top, text="TH", textcolor = color.white, color=color.red, display = display.pane) plotshape(displayThresholdSignals and signalLongThreshold, "threshold signal long", style = shape.labelup, location = location.bottom, text="TH", textcolor = color.white, color=color.green, display = display.pane) plot(signalShortThreshold ? 1 : 0, "Threshold Short Signal", display = display.data_window) plot(signalLongThreshold ? 1: 0 , "Threshold Long Signal", display = display.data_window) alertcondition(signalShortThreshold, "Threshold Short Signal") alertcondition(signalLongThreshold, "Threshold Long Signal") signalShortAboveMA = bsRed > maRed signalLongAboveMA = bsGreen > maGreen plotshape(displayMASignals and signalShortAboveMA, "MA signal short", style = shape.labeldown, location = location.top, text="MA", textcolor = color.white, color=color.red, display = display.pane) plotshape(displayMASignals and signalLongAboveMA, "MA signal long", style = shape.labelup, location = location.bottom, text="MA", textcolor = color.white, color=color.green, display = display.pane) plot( signalShortAboveMA ? 1 : 0, "MA Short Signal", display = display.data_window) plot(signalLongAboveMA ? 1: 0 , "MA Long Signal", display = display.data_window) alertcondition(signalShortAboveMA, "MA Short Signal") alertcondition(signalLongAboveMA, "MA Long Signal")
PERFECT ENGULFING Candlestick Patterns by Anmol
https://www.tradingview.com/script/qBg35gwR-PERFECT-ENGULFING-Candlestick-Patterns-by-Anmol/
anmolgoel056
https://www.tradingview.com/u/anmolgoel056/
97
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/ // ยฉ anmolgoel056 //@version=4 study(title="Candlestick Patterns with Entry Signals", shorttitle="CPES by Anmol", overlay=true) // User-defined inputs for label positions and visibility var label_position = input(title="Label Position", type=input.string, options=["Above Candle", "Below Candle", "Above High", "Below Low"], defval="Above High") var show_engulfing_labels = input(true, title="Show Engulfing Labels") var show_IB_labels = input(true, title="Show IB Labels") var show_zero_doji_labels = input(true, title="Show Zero Doji Labels") // Bullish Engulfing buE = (open < close[1]) and (close > open[1]) and (close > open) and (close[1] < open[1]) and (low < min(open, close)) and (high > max(open, close)) and (abs(close - open) / open > 0.00001) and high > high[1] // Bearish Engulfing beE = (open > close[1]) and (close < open[1]) and (close < open) and (close[1] > open[1]) and (low < min(open, close)) and (high > max(open, close)) and (abs(close - open) / open > 0.00001) and low < low[1] // Inside Bar - Combined (IB) IB = ((open < close[1] and close > open[1] and close[1] > open[1] and close < open and high < high[1] and low > low[1] and abs(close[1] - open[1]) / close[1] > 0.00001) or (open < open[1] and close[1] < open[1] and close > close[1] and close < open and high < high[1] and low > low[1] and abs(open[1] - close[1]) / open[1] > 0.00001) or (open > open[1] and close < close[1] and close[1] > open[1] and close > open and high < high[1] and low > low[1] and abs(close[1] - open[1]) / close[1] > 0.00001) or (open > close[1] and close < open[1] and close[1] < open[1] and close > open and high < high[1] and low > low[1] and abs(open[1] - close[1]) / open[1] > 0.00001)) // Zero Doji zeroDoji = (open == close or abs(open - close) / open <= 0.000009) and (open > low or open > high or open < low or open < high) // Plot text labels var label labelBuE = na var label labelBeE = na var label labelIB = na var label labelZD = na // Calculate label y-position based on user input buE_label_y = label_position == "Above Candle" ? high + syminfo.mintick : label_position == "Below Candle" ? low - syminfo.mintick : label_position == "Above High" ? high + syminfo.mintick : label_position == "Below Low" ? low - syminfo.mintick : na beE_label_y = buE_label_y IB_label_y = label_position == "Above Candle" ? high + syminfo.mintick : label_position == "Below Candle" ? low - syminfo.mintick : label_position == "Above High" ? high + syminfo.mintick : label_position == "Below Low" ? low - syminfo.mintick : na zeroDoji_label_y = label_position == "Above Candle" ? high + syminfo.mintick : label_position == "Below Candle" ? low - syminfo.mintick : label_position == "Above High" ? high + syminfo.mintick : label_position == "Below Low" ? low - syminfo.mintick : na // Plot labels based on visibility if show_engulfing_labels and buE labelBuE := label.new(x=bar_index, y=buE_label_y, text="BuE", color=color.green, size=size.small) if show_engulfing_labels and beE labelBeE := label.new(x=bar_index, y=beE_label_y, text="BeE", color=color.red, size=size.small) if show_IB_labels and IB labelIB := label.new(x=bar_index, y=IB_label_y, text="IB", color=color.blue, size=size.small) if show_zero_doji_labels and zeroDoji labelZD := label.new(x=bar_index, y=zeroDoji_label_y, text="ZD", color=color.orange, size=size.small) // Clear labels if no pattern is detected if na(buE) label.delete(labelBuE) if na(beE) label.delete(labelBeE) if na(IB) label.delete(labelIB) if na(zeroDoji) label.delete(labelZD)
Label_Trades Enter your trade information to display on chart
https://www.tradingview.com/script/MGBy9Ps7-Label-Trades-Enter-your-trade-information-to-display-on-chart/
jryan3
https://www.tradingview.com/u/jryan3/
31
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ jryan3 //@version=5 indicator("Label_Trades", overlay=true) t_bot = input.time(timestamp("1 Jan 2024 10:00"), "Date and Time Bought") t_sold = input.time(timestamp("1 Jan 2024 10:00"), "Date and Time Sold") lot_size = input.int(defval = 1, title = "Lot Size", minval = 1, step = 1 , tooltip = "Enter Lot Size Traded") long_short = input.string(defval = "long", title = "Long/Short", options = ["long", "short"]) bot_val = input.float(defval = 0.00, title = "Price Bought", minval = 0, tooltip = "Enter Price Value") sold_val = input.float(defval = 0.00, title = "Price Sold", minval = 0, tooltip = "Enter Price Value") if long_short == "long" label.new(x=t_sold, y=na, xloc=xloc.bar_time, yloc=yloc.abovebar, style=label.style_triangledown, color=color.red, size=size.small, tooltip=str.tostring(lot_size) + " lots sold at $" + str.tostring(sold_val)) label.new(x=t_bot, y=na, xloc=xloc.bar_time, yloc=yloc.belowbar, style=label.style_triangleup, color=color.green, size=size.small, tooltip=str.tostring(lot_size) + " lots bought at $" + str.tostring(bot_val)) if long_short == "short" label.new(x=t_bot, y=na, xloc=xloc.bar_time, yloc=yloc.abovebar, style=label.style_triangledown, color=color.green, size=size.small, tooltip=str.tostring(lot_size) + " lots bought at $" + str.tostring(bot_val)) label.new(x=t_sold, y=na, xloc=xloc.bar_time, yloc=yloc.belowbar, style=label.style_triangleup, color=color.red, size=size.small, tooltip=str.tostring(lot_size) + " lots sold at $" + str.tostring(sold_val))
Max - min - ML - top/bottom GP
https://www.tradingview.com/script/mbsONldh-Max-min-ML-top-bottom-GP/
alexhyer13
https://www.tradingview.com/u/alexhyer13/
15
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ alexhyer13 //@version=5 indicator("Max/mins",overlay=true) length=input.int(title="Length", defval=650) lookback = input.int(title="Lookback", defval=640) use_max = input.bool(title="Max", defval=1) use_min = input.bool(title="Min", defval=1) use_mid = input.bool(title="ML", defval=1) use_top_gp = input.bool(title="Top GP", defval=0) use_bot_gp = input.bool(title="Bottom GP", defval=0) var cur_time = 0 var highest_time = 0 var lowest_time = 0 var float highest = close var float lowest = close cur_time:=cur_time+1 if (highest<high) highest:=high highest_time:=cur_time if (cur_time-highest_time>=length) highest := ta.highest(lookback) if (lowest>low) lowest:=low lowest_time:=cur_time if (cur_time-lowest_time>=length) lowest := ta.lowest(lookback) ml = (highest+lowest)/2 top_gp = ((highest-lowest)*0.66)+lowest bottom_gp = ((highest-lowest)*0.34)+lowest plot(use_max==1 ? highest : na,color=color.red) plot(use_min==1 ? lowest : na,color=color.green) plot(use_mid==1 ? ml : na,color=color.blue) plot(use_top_gp==1 ? top_gp : na,color=color.yellow) plot(use_bot_gp==1 ? bottom_gp : na,color=color.yellow)
Volume Based RSI with ADX
https://www.tradingview.com/script/XQVzqiNc-Volume-Based-RSI-with-ADX/
noufalbinjalal
https://www.tradingview.com/u/noufalbinjalal/
28
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/ // ยฉ Noufal-Bin-Jalal //@version=5 indicator("Volume Based RSI with ADX", overlay=false, format=format.price, precision=2, timeframe="", timeframe_gaps=true,max_labels_count = 100, max_lines_count = 100, max_boxes_count = 100, max_bars_back = 100) //Settings src = input.source(defval = ohlc4,group = "RSI Settings", title="RSI Source", tooltip = "What type of source using RSI?") length = input.int(defval=25,group = "RSI Settings", minval=1, maxval=100, title="RSI Length", tooltip = "RSI length means the indicator is calculated using the last number of candles") overbought_level = input.int(defval=70,group = "RSI Settings", minval=1, maxval=100, title="Overbought Level", tooltip = "RSI overbought level") oversold_level = input.int(defval=30,group = "RSI Settings", minval=1, maxval=100, title="Oversold Level", tooltip = "RSI oversold level") minVol = input.int(title="Volume Settings", group = "Minimum Volume",defval=100, minval=100, step=10, maxval=500,tooltip = "Minimum volume required for a trade") bullColor = input.color(color.new(#3cf74b, 0),title = 'Bullish',group='RSI Settings', inline = 'RSI-Color') bearColor = input.color(color.new(#ec4e42, 0),title = 'Bearish',group='RSI Settings', inline = 'RSI-Color') sideColor = input.color(color.new(#8d8b8a,0),title = 'Weak Volume',group='RSI Settings', inline = 'RSI-Color') isADX = input.bool(group='ADX Settings', title="Show ADX", defval=true, tooltip = "It show's ADX level") adxlen = input.int(group='ADX Settings', title="ADX Smoothing", defval=14, minval=1, maxval=100) dilen = input.int(group='ADX Settings', title="DI Length", defval=14, minval=1, maxval=100) threshold = input.int(group='ADX Settings',title="ADX Threshold", defval=20, minval=1, maxval=100) adxColor = input.color(color.new(#715ceb, 80),title = 'Valid ADX',group='ADX Settings', inline = 'RSI-Color') wadxColor = input.color(color.new(#888685, 70),title = 'Weak ADX',group='ADX Settings', inline = 'RSI-Color') //Volume Analyze vol = math.sign(ta.change(hlc3)) * nz(volume) //Time Settings var isMoment = (second((time_close(timeframe.period, syminfo.session, syminfo.timezone) - time(timeframe.period))) <= 10) or (second((time_close(timeframe.period, syminfo.session, syminfo.timezone) - timenow)) <= 10)? true : false bool isVol = math.abs(vol) >= minVol ? true : false //RSI rsi_value = ta.rsi(src, length) //ADX dirmov(len) => up = ta.change(high) down = -ta.change(low) plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) truerange = ta.rma(ta.tr, len) plus = fixnan(100 * ta.rma(plusDM, len) / truerange) minus = fixnan(100 * ta.rma(minusDM, len) / truerange) [plus, minus] adx(dilen, adxlen) => [plus, minus] = dirmov(dilen) sum = plus + minus adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) sig = adx(dilen, adxlen) adxOk = (sig > threshold) ? true : false color rsiColor = if(vol > syminfo.mintick and (isVol and isMoment)) bullColor else if (vol < syminfo.mintick and (isVol and isMoment)) bearColor else sideColor color adxCol = (adxOk) ? adxColor : wadxColor // Plot RSI topLine=hline(100, "Top Band", color=color.new(#d6da0c, 50), linestyle=hline.style_solid, editable = false) plot(rsi_value, title="RSI", color=rsiColor, linewidth = 2,style = plot.style_linebr, editable = false) plot(sig, title="ADX", color=adxCol, linewidth = 2,style = plot.style_areabr, display = (isADX) ? display.all : display.none, editable = false) hline(overbought_level, title="Overbought", color=#787B86, linestyle=hline.style_solid) hline(50, "Middle Band", color=color.new(#787B86, 50), linestyle=hline.style_solid) hline(oversold_level, title="Oversold", color=#787B86, linestyle=hline.style_solid) lowLine=hline(0, "Low Band", color=color.new(#10c210, 50), linestyle=hline.style_solid, editable = false) fill(topLine, lowLine, color=color.rgb(126, 87, 194, 90), title="Background", editable = false)
Stochastic Trend mtf
https://www.tradingview.com/script/tIMQJpUn/
ahmettetik77
https://www.tradingview.com/u/ahmettetik77/
38
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ ahmettetik77 //@version=5 indicator(title="Stochastic Trend mtf", shorttitle="Stoch Trend mtf", format=format.price, precision=2, timeframe="240", timeframe_gaps=false) neon = input.bool(title = 'Neon Theme', defval = true) EMA = input(true, title='Show EMA Line?') smoothK = input.int(8, "K", minval=1) smoothD = input.int(3, "D", minval=1) lengthRSI = input.int(14, "RSI Length", minval=1) lengthStoch = input.int(14, "Stochastic Length", minval=1) src = input(close, title="RSI Source") bullcolor = neon ? #00ffbb : #00b712 bearcolor = neon ? #ff1100 : #c30010 rsi1 = ta.rsi(src, lengthRSI) k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK) d = ta.sma(k, smoothD) obupper = plot(100, color = color.new(bearcolor, 0), display = display.none) oblower = plot(90, color = color.new(bearcolor, 0), display = display.none) obmid = plot(80, display = display.none) osupper = plot(10, color = color.new(bullcolor, 30), display = display.none) oslower = plot(0, color = color.new(bullcolor, 30), display = display.none) osmid = plot(20, color = color.new(bullcolor, 70), display = display.none) hline(50) mid = plot(50, display = display.none, editable = false) plot1 = plot(k, color = color.new(color.white, 100)) plot2 = plot(EMA and d ? d : na, title='EMA Line', style=plot.style_line, linewidth=2, color=color.rgb(66, 170, 255, 100)) z = plot(k, color=k> d ? bullcolor : k < d ? bearcolor : color.rgb(27, 26, 26, 60), linewidth=1, title='STC') fill(z, plot2, k > d ? k : d, k > d ? d : k, k > d ? bullcolor : #00000000, k > d ? #00000000 : bearcolor) fill(obupper, oblower, color.new(bearcolor, 70)) fill (oblower, obmid, color.new(bearcolor, 85)) fill(osupper, oslower, color.new(bullcolor, 70)) fill(osupper, osmid, color.new(bullcolor, 85))
TrendCylinder (Expo)
https://www.tradingview.com/script/PFFQXniH-TrendCylinder-Expo/
Zeiierman
https://www.tradingview.com/u/Zeiierman/
675
study
5
CC-BY-NC-SA-4.0
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // ~~ ยฉ Zeiierman { //@version=5 indicator("TrendCylinder (Expo)", overlay = true) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ ToolTips { t1 = "Volatility Period defines the length of the look-back period for calculating volatility. Higher values make the bands adapt more slowly to volatility changes. Lower values make them adapt more quickly." t2 = "Trend Factor adjusts the sensitivity of the trend line to price movements. A higher value makes the trend line less sensitive and smoother. Lower values make it more sensitive and reactive to price changes." t3 = "Trend Step controls how quickly the trend line adjusts to sudden price changes. Higher values cause slower adjustments, leading to smoother trend lines. Lower values result in quicker adjustments to sudden changes." //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Inputs { volatilityPeriod = input.int(100, title="Period", step=10, minval=2, maxval=1000, inline="vol", group="Volatility Settings", tooltip=t1) trendFactor = input.float(9, step=0.1, title='Factor', minval = 0.1, inline="", group="Trend Settings", tooltip=t2) trendStep = input.float(0.7, "Step", step=0.1,minval = 0.5, maxval = 5.0, inline="", group="Trend Settings", tooltip=t3) color_trend = input.color(color.navy, title="Trend Lineโ€„โ€„", inline="trend", group="Style") colorForUpperBand = input.color(color.new(#862458, 10), title="Upper Band", inline="band", group="Style") colorForLowerBand = input.color(color.new(#493893, 10), title="Lower Band", inline="band", group="Style") //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Initialize Variables var float currentTrend = 0.0 var int trendDirection = 0 averageTrueRange = ta.atr(200) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Function to determine the trend direction determineTrendDirection(direction) => direction - direction[1] > 0 ? 1 : (direction - direction[1] < 0 ? -1 : 0) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Calculate Trend Direction closingPrice = close scaledStandardDev = (nz(averageTrueRange) * trendFactor) trendDirection := determineTrendDirection(currentTrend) * int(scaledStandardDev) priceTrendDiff = closingPrice - currentTrend > 0 ? closingPrice - currentTrend : currentTrend - closingPrice reciprocalFactor = (scaledStandardDev * (1 / trendFactor)) * 1 / math.pow(2, 100) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Calculate the Current Trend trendAdjustment = priceTrendDiff > scaledStandardDev * trendStep ? math.avg(closingPrice, currentTrend) : trendDirection * reciprocalFactor + currentTrend currentTrend := trendAdjustment //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Calculate Upper and Lower Bands upperBand = currentTrend + scaledStandardDev - averageTrueRange - ta.ema(ta.stdev(closingPrice, volatilityPeriod), 200) lowerBand = currentTrend - scaledStandardDev + averageTrueRange + ta.ema(ta.stdev(closingPrice, volatilityPeriod), 200) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Plot isTrendConsistent = trendDirection == trendDirection[1] colorForPlot = trendDirection == 1 ? color_trend : color_trend plotTrend = plot(isTrendConsistent ? currentTrend : na, title="Trend Line", color=colorForPlot) plotUpper = plot(isTrendConsistent ? upperBand : na, title="Upper Band", color = color.new(color.black, 100)) plotLower = plot(isTrendConsistent ? lowerBand : na, title="Lower Band", color = color.new(color.black, 100)) fill(plotUpper, plotTrend, top_color = colorForLowerBand, bottom_color =color.new(na,100), top_value = upperBand, bottom_value = currentTrend, title="Background Upper") fill(plotTrend, plotLower, top_color = color.new(na,100), bottom_color = colorForUpperBand, top_value = currentTrend, bottom_value = lowerBand, title="Background Lower") //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
fibo_levels
https://www.tradingview.com/script/VN0DoGxo-fibo-levels/
taran1tul
https://www.tradingview.com/u/taran1tul/
3
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ taran1tul //@version=5 // @description Calculate Fibo levels from any 2 levels. Your need know only 2 price of 2 levels for calculate any level of Fibo: function 'fibo_lvl', // or calculate array of price Fibo levels : function 'fibo_lvls' library("Fibo_levels") // @description Calculate fibo level from any 2 levels of them // @param fibo_lvl1 First of any level of fibo from 0 to 1 (example 0.236) // @param price1 Price for 1th any level (example 2356.1) // @param fibo_lvl2 Second of any level of fibo from 0 to 1 (example 0.382) // @param price2 Price for 2th any level (example 2497.4) // @param calc_level Price for level to calculate (example 0.5) // @returns return price for calc_level fibo export fibo_lvl(float fibo_lvl1, float price1, float fibo_lvl2, float price2, float calc_level) => down_fibo = fibo_lvl1 > fibo_lvl2 and price1 > price2 ? true : false up_fibo = fibo_lvl1 < fibo_lvl2 and price1 < price2 ? true : false error = fibo_lvl1 > 1 or fibo_lvl2 > 1 or fibo_lvl1 < 0 or fibo_lvl2 < 0 or (up_fibo and down_fibo) or (not up_fibo and not down_fibo) ? true : false delta_lvl = not error and down_fibo ? fibo_lvl1 - fibo_lvl2 : not error and up_fibo ? fibo_lvl2 - fibo_lvl1 : na delta_price = not error and down_fibo ? price1 - price2 : not error and up_fibo ? price2 - price1 : na fibo_delta_price = delta_price / delta_lvl lvl_0 = not error and up_fibo ? price1 - fibo_delta_price * fibo_lvl1 : not error and down_fibo ? price1 + fibo_delta_price * fibo_lvl1 : na lvl_1 = not error and up_fibo ? lvl_0 + fibo_delta_price : not error and down_fibo ? lvl_0 - fibo_delta_price : na price_calc_level = not na(lvl_0) and up_fibo ? lvl_0 + calc_level * fibo_delta_price : not na(lvl_0) and down_fibo ? lvl_0 - calc_level * fibo_delta_price : na // @description Calculate all fibo levels from any 2 levels of them // @param fibo_lvl1 First of any level of fibo from 0 to 1 (example 0.236) // @param price1 Price for 1th any level (example 2356.1) // @param fibo_lvl2 Second of any level of fibo from 0 to 1 (example 0.382) // @param price1 Price for 2th any level (example 2497.4) // @returns array of price for fibo levels : (0.0, 0.118, 0.236, 0.384, 0.5, 0.618, 0.786, 1.0, 1.27,-0.27,1.618,-0.618) export fibo_lvls(float fibo_lvl1, float price1, float fibo_lvl2, float price2) => levels = array.from(0.0, 0.118, 0.236, 0.384, 0.5, 0.618, 0.786, 1.0, 1.27,-0.27,1.618,-0.618) out = array.new_float(10) for [index,lvl] in levels _level = array.get(levels, index) array.push(out, fibo_lvl(fibo_lvl1, price1, fibo_lvl2, price2, _level)) out
RS_TD_Library_2
https://www.tradingview.com/script/6AOk0oub/
tom_munich
https://www.tradingview.com/u/tom_munich/
8
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ tom_munich //@version=5 // @description TradingView Library for showing option prices on the chart library("RS_TD_Library_2", true) // @function Shows the table of profit/loss of all options to the given underlying // @param sumShortPut Sum of all short put options // @param sumLongPut Sum of all long put options // @param sumShortCall Sum of all short call options // @param sumLongCall Sum of all long call options // @param sumTotal Sum of all kind of options // @param smallLayout Usage of a small table layout export showTable(float sumShortPut, float sumLongPut, float sumShortCall, float sumLongCall, float sumTotal, bool smallLayout) => var _text_size = smallLayout ? size.small : size.normal var table panel = table.new("top_right", 3, 6, border_width = 1) table.cell(panel, 0, 0, syminfo.ticker, bgcolor = color.new(color.black, 30), text_color = color.white, text_size = _text_size) table.cell(panel, 2, 0, "Result", bgcolor = color.new(color.black, 30), text_color = color.white, text_size = _text_size) table.cell(panel, 0, 1, "ShortPut", bgcolor = color.new(color.gray, 30), text_halign = text.align_left, text_size = _text_size) bgColor = sumShortPut >= 0.0 ? color.green : color.red table.cell(panel, 2, 1, str.tostring(sumShortPut, format.mintick), text_color = color.black, bgcolor = bgColor, text_halign = text.align_right, text_size = _text_size) table.cell(panel, 0, 2, "LongPut", bgcolor = color.new(color.gray, 30), text_halign = text.align_left, text_size = _text_size) bgColor := sumLongPut >= 0.0 ? color.green : color.red table.cell(panel, 2, 2, str.tostring(sumLongPut, format.mintick), text_color = color.black, bgcolor = bgColor, text_halign = text.align_right, text_size = _text_size) table.cell(panel, 0, 3, "ShortCall", bgcolor = color.new(color.gray, 30), text_halign = text.align_left, text_size = _text_size) bgColor := sumShortCall >= 0.0 ? color.green : color.red table.cell(panel, 2, 3, str.tostring(sumShortCall, format.mintick), text_color = color.black, bgcolor = bgColor, text_halign = text.align_right, text_size = _text_size) table.cell(panel, 0, 4, "LongCall", bgcolor = color.new(color.gray, 30), text_halign = text.align_left, text_size = _text_size) bgColor := sumLongCall >= 0.0 ? color.green : color.red table.cell(panel, 2, 4, str.tostring(sumLongCall, format.mintick), text_color = color.black, bgcolor = bgColor, text_halign = text.align_right, text_size = _text_size) table.cell(panel, 0, 5, "Total", bgcolor = color.new(color.black, 30), text_color = color.white, text_halign = text.align_left, text_size = _text_size) bgColor := sumTotal >= 0.0 ? color.green : color.red table.cell(panel, 2, 5, str.tostring(sumTotal, format.mintick), text_color = color.black, bgcolor = bgColor, text_halign = text.align_right, text_size = _text_size) // @function Shows a debugging label on each bar // @param _text Text to show on the label export debugging_labelOnEachBar(string _text) => label.new(bar_index, high, str.tostring(_text)) // @function Prints a line at the strike of the option // @param date1 Buying date of the option // @param date2 Selling date of the option // @param strike Strike of the option // @param color Color of the line export showLine(int date1, int date2, float strike, color color) => //debugging_labelOnEachBar(str.tostring(date1)) // Note: line has no argument "toolTip" line.new(date1, y1=strike, x2=date2, y2=strike, extend=extend.none, color = color, width = 4, xloc = xloc.bar_time) // @function Prints a label at the strike of the option // @param date Buying/Selling date of the option // @param strike Strike of the option // @param color Color of the line // @param tooltip ToolTip of the option with the detailed prices export showLabel(int date, float strike, color color, string toolTip) => //debugging_labelOnEachBar(str.tostring(date)) label.new(date, strike, xloc = xloc.bar_time, color = color, style=label.style_label_right, tooltip = toolTip) // example color COLOR_LONG_PUT = #B2DFDB color COLOR_LONG_CALL = #B2DFDB color COLOR_SHORT_CALL = #FFCDD2 color COLOR_SHORT_PUT = #FFCDD2 // example showOptions_AAPL() => // option 1 showLine(timestamp("25 Feb 2022"), timestamp("04 Mar 2022"), 160.0, COLOR_SHORT_PUT) showLabel(timestamp("25 Feb 2022"), 160.0, COLOR_SHORT_PUT, "Short Put\nAAPL 04MAR22 160 P\nQuantity: -1\nOpen: $1.1 (25 Feb 2022)\nClose: $0.0 (04 Mar 2022)") // option 2 showLine(timestamp("07 Oct 2022"), timestamp("14 Oct 2022"), 130.0, COLOR_SHORT_PUT) showLabel(timestamp("07 Oct 2022"), 130.0, COLOR_SHORT_PUT, "Short Put\nAAPL 14OCT22 130 P\nQuantity: -1\nOpen: $0.47 (07 Oct 2022)\nClose: $0.0 (14 Oct 2022)") // option 3 showLine(timestamp("22 Sep 2022"), timestamp("03 Oct 2022"), 160.0, COLOR_SHORT_CALL) showLabel(timestamp("22 Sep 2022"), 160.0, COLOR_SHORT_CALL, "Short Call\nAAPL 21OCT22 160 C\nQuantity: -1\nOpen: $3.2 (22 Sep 2022)\nClose: $0.25 (03 Oct 2022)") // option 4 showLine(timestamp("22 Sep 2022"), timestamp("04 Oct 2022"), 162.5, COLOR_LONG_CALL) showLabel(timestamp("22 Sep 2022"), 162.5, COLOR_LONG_CALL, "Long Call\nAAPL 21OCT22 162.5 C\nQuantity: 1\nOpen: $2.37 (22 Sep 2022)\nClose: $0.22 (04 Oct 2022)") // option 5 showLine(timestamp("12 Sep 2022"), timestamp("21 Oct 2022"), 130.0, COLOR_LONG_PUT) showLabel(timestamp("12 Sep 2022"), 130.0, COLOR_LONG_PUT, "Long Put\nAAPL 21OCT22 130 P\nQuantity: 1\nOpen: $0.4 (12 Sep 2022)\nClose: $0.0 (21 Oct 2022)") // option 6 showLine(timestamp("12 Sep 2022"), timestamp("19 Oct 2022"), 140.0, COLOR_SHORT_PUT) showLabel(timestamp("12 Sep 2022"), 140.0, COLOR_SHORT_PUT, "Short Put\nAAPL 21OCT22 140 P\nQuantity: -1\nOpen: $0.86 (12 Sep 2022)\nClose: $0.5 (19 Oct 2022)") // example if barstate.islast and syminfo.ticker == "AAPL" showOptions_AAPL() showTable(243.0, -40.0, 320.0, -237.0, 286.0, false)
ABC on Recursive Zigzag [Trendoscope]
https://www.tradingview.com/script/RGNBIIcD-ABC-on-Recursive-Zigzag-Trendoscope/
Trendoscope
https://www.tradingview.com/u/Trendoscope/
1,143
study
5
CC-BY-NC-SA-4.0
// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // ยฉ Trendoscope Pty Ltd // โ–‘โ–’ // โ–’โ–’โ–’ โ–’โ–’ // โ–’โ–’โ–’โ–’โ–’ โ–’โ–’ // โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–‘ โ–’ โ–’โ–’ // โ–’โ–’โ–’โ–’โ–’โ–’ โ–’ โ–’โ–’ // โ–“โ–’โ–’โ–’ โ–’ โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ // โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ โ–’ โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ // โ–’ โ–’ โ–‘โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–‘ // โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–‘โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ // โ–“โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ โ–’โ–’ // โ–’โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’โ–’โ–’ // โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ // โ–’โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’ // โ–‘โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–“ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— // โ–“โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’ โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• // โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— // โ–’โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ• โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ• โ–ˆโ–ˆโ•”โ•โ•โ• // โ–’โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— // โ–’โ–’ โ–’ //@version=5 import HeWhoMustNotBeNamed/DrawingTypes/2 as dr import HeWhoMustNotBeNamed/DrawingMethods/2 import HeWhoMustNotBeNamed/ZigzagTypes/5 as zg import HeWhoMustNotBeNamed/ZigzagMethods/6 import HeWhoMustNotBeNamed/utils/1 as ut import HeWhoMustNotBeNamed/FibRatios/1 as fibs indicator("ABC on Recursive Zigzag [Trendoscope]", "ABC-RZ[Trendoscope]", overlay = true, max_lines_count=500, max_labels_count=500, max_bars_back = 1000) theme = input.string('Dark', title='Theme', options=['Light', 'Dark'], group='Generic Settings', tooltip='Chart theme settings. Line and label colors are generted based on the theme settings. If dark theme is selected, '+ 'lighter colors are used and if light theme is selected, darker colors are used.', display=display.none) zigzagLength = input.int(13, step=5, minval=3, title='Length', group='Zigzag', tooltip='Zigzag length for level 0 zigzag', display = display.none) depth = input.int(200, "Depth", step=25, maxval=500, group='Zigzag', tooltip='Zigzag depth refers to max number of pivots to show on chart', display = display.none) minimumZigZagLevel = input.int(0, "Minimum Zigzag Level", group='Zigzag', minval = 0, tooltip = 'Minimum zigzag level to consider for pattern scanning', display=display.none) indicators = matrix.new<float>() indicatorNames = array.new<string>() base = input.string('ABC Extension', 'Base', ['ABC Extension', 'BC Retracement'], 'Base on which entry, stop and target are calculated', group='ABC', display = display.none) entryRatio = input.float(0.3, 'Entry Ratio', group='ABC', minval=0.1, step=0.1, display = display.none, tooltip = 'Entry ratio for the calculation of entry level') targetRatio = input.float(1.0, 'Target Ratio', group='ABC', display = display.none, tooltip = 'Target Ratio for the calculation of target level') stopRatio = input.float(0.0, 'Stop Ratio', group='ABC', maxval=0.0, step=0.1, display = display.none, tooltip = 'Stop Ratio for the calculation of stop level') logScale = input.bool(false, 'Log Scale', group='ABC', display = display.none, tooltip = 'Use log scale for scanning and targets') useClosePricesForEntry = input.bool(true, 'Entry', group='Use Close Prices', display = display.none, tooltip = 'Use close prices for tracking', inline = 'ucp') useClosePricesForTarget = input.bool(true, 'Target', group='Use Close Prices', display = display.none, tooltip = 'Use close prices for tracking', inline = 'ucp') useClosePricesForStop = input.bool(true, 'Stop', group='Use Close Prices', display = display.none, tooltip = 'Use close prices for tracking', inline = 'ucp') useClosePricesForRetest = input.bool(true, 'Retest', group='Use Close Prices', display = display.none, tooltip = 'Use close prices for tracking', inline = 'ucp') tradeConditionTooltip = 'any - no filter\ntrend - Both A and B pivots in the direction of trend. Example, HH, and HL for long signal and LH and LL for short signal\n'+ 'reverse - Both A and B pivots in the opposite direction of trend. Example, LH, and LL for long signal and HH and HL for short signal\n'+ 'contracting - Consider only if both A and B pivots are either LH or HL\nexpanding - Consider only if both A and B pivots are either HH or LL' tradeCondition = input.string('any', 'Trade Condition', ['any', 'trend', 'reverse', 'contracting', 'expanding'], group='ABC', display = display.none, tooltip = tradeConditionTooltip) condition = tradeCondition == 'any'? 0: tradeCondition == 'trend'? 1: tradeCondition == 'reverse'? 2: tradeCondition == 'contracting'? 3: 4 baseVal = base == 'ABC Extension'? 1 : 2 var zg.Zigzag zigzag = zg.Zigzag.new(zigzagLength, depth) zigzag.calculate(array.from(high, low), indicators, indicatorNames) type ABCProperties int base = 1 float entryRatio = 0.23 float targetRatio = 1.0 float stopRatio = -0.1 bool logScale = false bool useClosePricesForEntry = true bool useClosePricesForTarget = false bool useClosePricesForStop = true bool useClosePricesForRetest = false int condition = 0 type ABCDrawing dr.Line ab dr.Line bc dr.Line ac dr.Label a dr.Label b dr.Label c dr.Label abcRatio dr.Box entryBox dr.Box targetBox type ABC int id int direction zg.Pivot a zg.Pivot b zg.Pivot c color patternColor ABCProperties properties float entryPrice float stopPrice float targetPrice int status = 0 ABCDrawing drawing initialiseCounts(int numberOfStatus)=> countMap = map.new<int, int>() for i=0 to numberOfStatus-1 countMap.put(i, 0) countMap var array<ABC> abcdPatterns = array.new<ABC>() var array<ABC> oldPatterns = array.new<ABC>() var map<int, int> bullishCounts = initialiseCounts(3) var map<int, int> bearishCounts = initialiseCounts(3) var int bullishRetests = 0 var int bearishRetests = 0 method calculateTargets(ABC this)=> this.entryPrice := this.properties.base == 1 ? fibs.extension(this.a.point.price, this.b.point.price, this.c.point.price, this.properties.entryRatio, this.properties.logScale) : fibs.retracement(this.b.point.price, this.c.point.price, this.properties.entryRatio, this.properties.logScale) this.targetPrice := this.properties.base == 1 ? fibs.extension(this.a.point.price, this.b.point.price, this.c.point.price, this.properties.targetRatio, this.properties.logScale) : fibs.retracement(this.b.point.price, this.c.point.price, this.properties.targetRatio, this.properties.logScale) this.stopPrice := this.properties.base == 1 ? fibs.extension(this.a.point.price, this.b.point.price, this.c.point.price, this.properties.stopRatio, this.properties.logScale) : fibs.retracement(this.b.point.price, this.c.point.price, this.properties.stopRatio, this.properties.logScale) this method withinEntry(ABC this)=> dir = this.c.point.price > this.b.point.price? -1 : 1 close*dir < this.entryPrice*dir method delete(ABCDrawing this)=> if(not na(this)) this.ab.delete() this.bc.delete() this.ac.delete() this.abcRatio.delete() this.a.delete() this.b.delete() this.c.delete() this.entryBox.delete() this.targetBox.delete() else log.info('this should not be na') this method draw(ABCDrawing this)=> if(not na(this)) this.ab.draw() this.bc.draw() this.ac.draw() this.abcRatio.draw() this.a.draw() this.b.draw() this.c.draw() this.entryBox.draw() this.targetBox.draw() else log.info('this should not be na') this method draw(ABC this)=> this.drawing.draw() this method deleteDrawing(ABC this)=> if(not na(this.drawing)) this.drawing.delete() this.drawing := na this method createDrawing(ABC this)=> if(not na(this.drawing)) this.drawing.delete() dr.LineProperties patternLineProps = dr.LineProperties.new(color=this.patternColor, width = 1, style = line.style_solid) ab = this.a.point.createLine(this.b.point, patternLineProps) bc = this.b.point.createLine(this.c.point, patternLineProps) dr.LineProperties angleLineProps = dr.LineProperties.new(color=this.patternColor, width = 0, style = line.style_dotted) ac = dr.Line.new(this.a.point, this.c.point, angleLineProps) acMidPoint = dr.Point.new((this.a.point.price+this.c.point.price)/2, (this.a.point.bar + this.c.point.bar)/2, (this.a.point.bartime + this.c.point.bartime)/2) abcRatioValue = fibs.retracementRatio(this.a.point.price, this.b.point.price, this.c.point.price) ratioLabelProperties = dr.LabelProperties.new(yloc = yloc.price, textcolor = this.patternColor, style = label.style_none) abcRatio = dr.Label.new(acMidPoint, str.tostring(abcRatioValue), properties = ratioLabelProperties) pivotLabelPropertiesAC = dr.LabelProperties.new(yloc = this.a.point.price < this.b.point.price? yloc.belowbar : yloc.abovebar, textcolor = this.patternColor) pivotLabelPropertiesBD = dr.LabelProperties.new(yloc = this.a.point.price > this.b.point.price? yloc.belowbar : yloc.abovebar, textcolor = this.patternColor) a = dr.Label.new(this.a.point, 'A', properties = pivotLabelPropertiesAC) b = dr.Label.new(this.b.point, 'B', properties = pivotLabelPropertiesBD) c = dr.Label.new(this.c.point, 'C', properties = pivotLabelPropertiesAC) entryPoint = dr.Point.new(this.entryPrice, this.c.point.bar, this.c.point.bartime) barDiff = math.min((this.c.point.bar- this.a.point.bar)/2, 490) entryBoxEndPoint = dr.Point.new(this.stopPrice, this.c.point.bar+barDiff) targetBoxEndPoint = dr.Point.new(this.targetPrice, this.c.point.bar+barDiff) boxPropertiesEntry = dr.BoxProperties.new(this.patternColor, color.new(color.red, 90)) boxPropertiesTarget = dr.BoxProperties.new(this.patternColor, color.new(color.green, 90)) entryBox = dr.Box.new(entryPoint, entryBoxEndPoint, boxPropertiesEntry) targetBox = dr.Box.new(entryPoint, targetBoxEndPoint, boxPropertiesTarget) this.drawing := ABCDrawing.new(ab, bc, ac, a, b, c, abcRatio, entryBox, targetBox) this method update(ABC this, zg.Pivot c)=> this.c := c alert('ABC Pattern Coordinates Updated') this.calculateTargets() if(this.withinEntry()) this.deleteDrawing(). createDrawing(). draw() this method createAbc(zg.Zigzag this, ABCProperties props, color patternColor)=> var id = 1 c = this.zigzagPivots.get(0) b = this.zigzagPivots.get(1) a = this.zigzagPivots.get(2) direction = b.point.price > c.point.price? 1 : -1 abc = ABC.new(id, direction, a, b, c, patternColor, props) id+=1 abc method scanAbc(zg.Zigzag this, ABCProperties props)=> isAbc = false if(this.zigzagPivots.size() >= 4) c = this.zigzagPivots.get(0) b = this.zigzagPivots.get(1) a = this.zigzagPivots.get(2) aDir = math.abs(a.dir) bDir = math.abs(b.dir) conditionInLine = props.condition == 0 or (props.condition == 1 and aDir == 1 and bDir == 2) or (props.condition == 2 and aDir == 2 and bDir == 1) or (props.condition == 3 and aDir == 1 and bDir == 1) or (props.condition == 4 and aDir == 2 and bDir == 2) ratioInLine = c.ratio >= 0.618 and c.ratio <= 0.786 if(ratioInLine and conditionInLine) existingPattern = false isAbc := true for p in abcdPatterns existingPattern := p.a.point.price == a.point.price and p.b.point.price == b.point.price if(existingPattern) if(p.c.point.bar > c.point.bar and p.status == 0) p.update(c) isAbc:=false break isAbc method record(ABC pattern)=> countMapToSet = pattern.direction >0? bullishCounts : bearishCounts countMapToSet.put(pattern.status, countMapToSet.get(pattern.status)+1) method removePattern(array<ABC> patterns, int index)=> pattern = patterns.remove(index) pattern.deleteDrawing() pattern.record() method traverse(array<ABC> patterns)=> for i = patterns.size() >0? patterns.size()-1: na to 0 pattern = patterns.get(i) baseTarget = pattern.properties.useClosePricesForTarget? close : (pattern.direction > 0? high : low) baseStop = pattern.properties.useClosePricesForStop? close : (pattern.direction >0? low : high) baseEntry = pattern.properties.useClosePricesForEntry? close : (pattern.direction > 0? high : low) baseValueRetest = pattern.properties.useClosePricesForRetest? close : (pattern.direction > 0? low : high) baseInvalidation = close newStatus = baseTarget*pattern.direction >= pattern.targetPrice*pattern.direction? 2 : baseEntry*pattern.direction >= pattern.entryPrice*pattern.direction? 1: pattern.status retested = pattern.status == 1 and baseValueRetest <= pattern.entryPrice newStatus := math.max(pattern.status, newStatus) closed = (newStatus > 0 and baseStop*pattern.direction <= pattern.stopPrice*pattern.direction) or (newStatus == 0 and baseInvalidation*pattern.direction <= pattern.stopPrice*pattern.direction) or pattern.status == 2 increment = newStatus >= pattern.status pattern.status := newStatus if(closed) patterns.removePattern(i) var properties = ABCProperties.new(baseVal, entryRatio, targetRatio, stopRatio, logScale, useClosePricesForEntry, useClosePricesForTarget, useClosePricesForStop, useClosePricesForRetest, condition) var themeColors = ut.getColors(theme) abcdPatterns.traverse() oldPatterns.traverse() if zigzag.flags.newPivot mlzigzag = zigzag while(mlzigzag.zigzagPivots.size() >= 3) if(mlzigzag.level >= minimumZigZagLevel) isAbcd = mlzigzag.scanAbc(properties) if(isAbcd) patternColor = themeColors.shift() alert('New ABC Pattern Detected') pattern = mlzigzag.createAbc(properties, patternColor).calculateTargets() if(pattern.withinEntry()) pattern.createDrawing().draw() abcdPatterns.push(pattern) while(abcdPatterns.size() > 10) last = abcdPatterns.shift() oldPatterns.push(last) last.deleteDrawing() themeColors.push(patternColor) mlzigzag := mlzigzag.nextlevel() while(abcdPatterns.size() < 10 and oldPatterns.size() > 0) restoreOld = oldPatterns.pop() abcdPatterns.unshift(restoreOld) restoreOld.draw() if barstate.islast var closedStatsTable = table.new(position.top_right, 6, 3, border_color = chart.bg_color) closedStatsTable.clear(0, 0, 5, 2) closedStatsTable.cell(0, 0, 'Direction\\Status', text_color=color.white, bgcolor = color.maroon) closedStatsTable.cell(1, 0, 'Invalid', text_color=color.white, bgcolor = color.maroon) closedStatsTable.cell(2, 0, 'Stopped', text_color=color.white, bgcolor = color.maroon) closedStatsTable.cell(3, 0, 'Complete', text_color=color.white, bgcolor = color.maroon) closedStatsTable.cell(4, 0, 'Win Ratio', text_color=color.white, bgcolor = color.maroon) closedStatsTable.cell(5, 0, 'Risk Reward', text_color=color.white, bgcolor = color.maroon) closedStatsTable.cell(0, 1, 'Bullish', text_color=color.white, bgcolor = color.new(color.green, 50)) closedStatsTable.cell(0, 2, 'Bearish', text_color=color.white, bgcolor = color.new(color.red, 50)) bullishInvalid = bullishCounts.get(0) bullishStopped = bullishCounts.get(1) bullishCompleted = bullishCounts.get(2) riskReward =(targetRatio - entryRatio)/(entryRatio - stopRatio) bullishBgColor = color.new(color.green, 70) closedStatsTable.cell(1, 1, str.tostring(bullishInvalid), text_color=color.white, bgcolor = bullishBgColor) closedStatsTable.cell(2, 1, str.tostring(bullishStopped), text_color=color.white, bgcolor = bullishBgColor) closedStatsTable.cell(3, 1, str.tostring(bullishCompleted), text_color=color.white, bgcolor = bullishBgColor) closedStatsTable.cell(4, 1, str.tostring(bullishCompleted*100/(bullishCompleted+bullishStopped), format.percent), text_color=color.white, bgcolor = bullishBgColor) closedStatsTable.cell(5, 1, str.tostring(riskReward, '#.##'), text_color=color.white, bgcolor = bullishBgColor) bearishInvalid = bearishCounts.get(0) bearishStopped = bearishCounts.get(1) bearishCompleted = bearishCounts.get(2) bearishBgColor = color.new(color.red, 70) closedStatsTable.cell(1, 2, str.tostring(bearishInvalid), text_color=color.white, bgcolor = bearishBgColor) closedStatsTable.cell(2, 2, str.tostring(bearishStopped), text_color=color.white, bgcolor = bearishBgColor) closedStatsTable.cell(3, 2, str.tostring(bearishCompleted), text_color=color.white, bgcolor = bearishBgColor) closedStatsTable.cell(4, 2, str.tostring(bearishCompleted*100/(bearishCompleted+bearishStopped), format.percent), text_color=color.white, bgcolor = bearishBgColor) closedStatsTable.cell(5, 2, str.tostring(riskReward, '#.##'), text_color=color.white, bgcolor = bearishBgColor)
Draw
https://www.tradingview.com/script/rkonPq69-Draw/
reees
https://www.tradingview.com/u/reees/
39
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ reees //@version=5 // @description Draw patterns, lines, labels, shapes etc. library("Draw",overlay=true) import reees/TA/66 as t import reees/Utilities/2 as u //---------------------------------------------------------- // Color palettes //---------------------------------------------------------- export pat_colors(bool bull, color buLn=na, color beLn=na, color ltxt=na) => red = color.new(color.red,50) grn = color.new(color.green,50) [ color.new(color.gray,30), red, grn, color.new(color.white,100), na(ltxt) ? color.new(color.white,30) : ltxt, color.new(color.blue,100), bull==true ? (na(buLn) ? grn : buLn) : (na(beLn) ? red : beLn), bull==true ? grn : red, color.new(color.red,80), color.new(color.green,80) ] //---------------------------------------------------------- // Attribute maps //---------------------------------------------------------- export size(string size) => switch size "tiny" => size.tiny "small" => size.small "large" => size.large => size.normal export label_style(string style) => switch style "bottom" => label.style_label_up => label.style_label_down export line_style(string style) => switch style "dotted" => line.style_dotted "dashed" => line.style_dashed "arrowleft" => line.style_arrow_left "arrowright" => line.style_arrow_right => line.style_solid export font_size(string size) => switch size "tiny" => size.tiny "small" => size.small "normal" => size.normal "large" => size.large "huge" => size.huge => size.normal //---------------------------------------------------------- // Patterns //---------------------------------------------------------- // @function Draw XABCD pattern export xabcd(int xX, float xY,int aX,float aY,int bX,float bY,int cX, float cY, int dX=na,float dY=na, float iE=na,bool bull, color bu, color be) => lcol = bull==true ? bu : be lfcol = bull==true ? color.new(color.green,85) : color.new(color.red,85) w = 3 style = not na(dX) ? line.style_solid : line.style_dotted lbsize = size.small avgX = int(math.avg(aX-xX,bX-aX,cX-bX)*1.5) // pattern lines l1 = line.new(xX,xY,aX,aY,color=lcol,width=w,style=style) l2 = line.new(aX,aY,bX,bY,color=lcol,width=w,style=style) l3 = line.new(bX,bY,cX,cY,color=lcol,width=w,style=style) l4 = not na(dX) ? line.new(cX,cY,dX,dY,color=lcol,width=w,style=style) : (iE<0 ? na : line.new(cX,cY,cX+avgX,iE,color=lcol,width=2,style=line.style_arrow_right)) l5 = not na(dX) ? line.new(xX,xY,bX,bY,color=lcol,width=2,style=style) : na l6 = not na(dX) ? line.new(bX,bY,dX,dY,color=lcol,width=2,style=style) : na if not na(dX) linefill.new(l1,l5,lfcol) linefill.new(l3,l6,lfcol) [l1,l2,l3,l4,l5,l6] distX(dY,pH,p,avgLeg) => halfLeg = math.round(avgLeg/2) qLeg = math.round(avgLeg/4) eLeg = math.round(avgLeg/8) dist = math.abs(p-dY)/pH if dist>.75 avgLeg + qLeg + eLeg else if dist > .5 avgLeg + qLeg else if dist > .25 avgLeg + eLeg else if dist > .1 avgLeg else 0 // @function draw PRZ, entry, stop, targets, and projected reversal paths for XABCD pattern export xabcd_inProgress(bool bull, int type, int tLimit, float entry, float stop, float t1, float t2, float bcNt, float bcFt, float xaNt, float xaFt, int xX, float xY, float aY, int bX, float bY, float cY, int dX, float dY, color cBu, color cBe, color lTxt) => line[] fullIpLn = array.new_line(0) label[] fullIpL = array.new_label(0) linefill[] fullIpLf = array.new_linefill(0) [ccol,red,grn,ccl,cltxt,clbkg,cproj,cproj2,przFill,tgtFill] = pat_colors(bull,cBu,cBe,lTxt) midX = math.round(tLimit/2) avgLeg = math.round(dX-xX)/4 [bcN,bcF,xaN,xaF] = t.harmonic_xabcd_prz(type,xY,aY,bY,cY) bcN := bcN < 0 ? 0 : bcN bcF := bcF < 0 ? 0 : bcF xaN := xaN < 0 ? 0 : xaN xaF := xaF < 0 ? 0 : xaF [highest,lowest] = t.harmonic_xabcd_przRange(bcN,bcF,xaN,xaF) [lower,higher] = t.harmonic_xabcd_przClosest(bcN,bcF,xaN,xaF) pH = highest-lowest // Draw potential reversal zone // BC retracement projections line l_bcN = na, line l_bcF = na, line l_xaN = na, line l_xaF = na line przH = na, line przL = na if not na(bcN) l_bcN := line.new(dX,bcN,dX+tLimit,bcN,color=red,width=5) array.push(fullIpLn,l_bcN) array.push(fullIpLn,line.new(bX,bY,dX,bcN,style=line.style_dotted,color=ccol)) array.push(fullIpL,label.new(dX+midX,bcN,str.tostring(bcN,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if bcN == higher przH := l_bcN else if bcN == lower przL := l_bcN if not na(bcF) l_bcF := line.new(dX,bcF,dX+tLimit,bcF,color=red,width=5) array.push(fullIpLn,l_bcF) array.push(fullIpLn,line.new(bX,bY,dX,bcF,style=line.style_dotted,color=ccol)) array.push(fullIpL,label.new(dX+midX,bcF,str.tostring(bcF,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if bcF == higher przH := l_bcF else if bcF == lower przL := l_bcF // XA retracement projections if not na(xaN) l_xaN := line.new(dX,xaN,dX+tLimit,xaN,color=red,width=6) array.push(fullIpLn,l_xaN) array.push(fullIpLn,line.new(xX,xY,dX,xaN,style=line.style_dotted,color=ccol)) array.push(fullIpL,label.new(dX+int(midX/2),xaN,str.tostring(xaN,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if xaN == higher przH := l_xaN else if xaN == lower przL := l_xaN if not na(xaF) l_xaF := line.new(dX,xaF,dX+tLimit,xaF,color=red,width=6) array.push(fullIpLn,l_xaF) array.push(fullIpLn,line.new(xX,xY,dX,xaF,style=line.style_dotted,color=ccol)) array.push(fullIpL,label.new(dX+int(midX/2),xaF,str.tostring(xaF,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if xaF == higher przH := l_xaF else if xaF == lower przL := l_xaF if przL != przH array.push(fullIpLf,linefill.new(przL,przH,przFill)) if stop > 0 array.push(fullIpLn,line.new(dX,stop,dX+tLimit,stop,color=red,width=6)) array.push(fullIpL,label.new(dX+midX,stop,"Stop: "+str.tostring(stop,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) // entry array.push(fullIpLn,line.new(dX,entry,dX+tLimit,entry,color=grn,width=3,style=line.style_dotted)) // Reversal projections (XA retracement/extension) fromD = false // if entry is decided, draw projections based on that if not na(entry) if (bull==true and entry > dY) or (bull==false and entry < dY) array.push(fullIpLn,line.new(dX,dY,dX+avgLeg,t1,color=cproj,style=line.style_arrow_right,width=2)) fromD := true else distX = distX(dY,pH,entry,avgLeg) x1_2 = dX+int(distX/2) x2_2 = x1_2+distX if distX != 0 array.push(fullIpLn,line.new(dX,dY,x1_2,entry,color=cproj2,width=2)) array.push(fullIpLn,line.new(x1_2,entry,x2_2,t1,color=cproj2,style=line.style_arrow_right,width=2)) // else, draw projections based on PRZ levels else if not na(bcN) if (bull==true and bcN > dY) or (bull==false and bcN < dY) array.push(fullIpLn,line.new(dX,dY,dX+avgLeg,t1,color=cproj,style=line.style_arrow_right,width=2)) fromD := true else distX = distX(dY,pH,bcN,avgLeg) x1_2 = dX+int(distX/2) x2_2 = x1_2+distX if distX != 0 array.push(fullIpLn,line.new(dX,dY,x1_2,bcN,color=cproj2,width=2)) array.push(fullIpLn,line.new(x1_2,bcN,x2_2,bcNt,color=cproj2,style=line.style_arrow_right,width=2)) if not na(bcF) if (bull==true and bcF > dY) or (bull==false and bcF < dY) if fromD==false array.push(fullIpLn,line.new(dX,dY,dX+avgLeg,t1,color=cproj,style=line.style_arrow_right,width=2)) fromD := true else distX = distX(dY,pH,bcF,avgLeg) x1_2 = dX+int(distX/2) x2_2 = x1_2+distX if distX != 0 array.push(fullIpLn,line.new(dX,dY,x1_2,bcF,color=cproj2,width=2)) array.push(fullIpLn,line.new(x1_2,bcF,x2_2,bcFt,color=cproj2,style=line.style_arrow_right,width=2)) if not na(xaN) if (bull==true and xaN > dY) or (bull==false and xaN < dY) if fromD==false array.push(fullIpLn,line.new(dX,dY,dX+avgLeg,t1,color=cproj,style=line.style_arrow_right,width=2)) fromD := true else distX = distX(dY,pH,xaN,avgLeg) x1_2 = dX+int(distX/2) x2_2 = x1_2+distX if distX != 0 array.push(fullIpLn,line.new(dX,dY,x1_2,xaN,color=cproj2,width=2)) array.push(fullIpLn,line.new(x1_2,xaN,x2_2,xaNt,color=cproj2,style=line.style_arrow_right,width=2)) if not na(xaF) if (bull==true and xaF > dY) or (bull==false and xaF < dY) if fromD==false if not na(xaF) array.push(fullIpLn,line.new(dX,dY,dX+avgLeg,t1,color=cproj,style=line.style_arrow_right,width=2)) fromD := true else distX = distX(dY,pH,xaF,avgLeg) x1_2 = dX+int(distX/2) x2_2 = x1_2+distX if distX != 0 array.push(fullIpLn,line.new(dX,dY,x1_2,xaF,color=cproj2,width=2)) array.push(fullIpLn,line.new(x1_2,xaF,x2_2,xaFt,color=cproj2,style=line.style_arrow_right,width=2)) if fromD == false array.push(fullIpLn,line.new(dX,dY,dX+avgLeg,t1,color=cproj,style=line.style_arrow_right,width=2)) // Targets l_t1 = line.new(dX,t1,dX+tLimit,t1,color=grn,width=5) array.push(fullIpLn,l_t1) array.push(fullIpL,label.new(dX+midX,t1,"T1: " + str.tostring(t1,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) l_t2 = line.new(dX,t2,dX+tLimit,t2,color=grn,width=5) array.push(fullIpLn,l_t2) array.push(fullIpL,label.new(dX+midX,t2,"T2: " + str.tostring(t2,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) array.push(fullIpLf,linefill.new(l_t1,l_t2,tgtFill)) [fullIpLn,fullIpL,fullIpLf] incDistX(dY,pH,p,avgLeg) => halfLeg = math.round(avgLeg/2) qLeg = math.round(avgLeg/4) eLeg = math.round(avgLeg/8) dist = math.abs(p-dY)/pH if dist>.75 avgLeg + qLeg + eLeg else if dist > .5 avgLeg + qLeg else if dist > .25 avgLeg + eLeg else avgLeg export xabcd_incInProgress(bool bull, int type, int tLimit, float entry, int xX, float xY, float aY, int bX, float bY, int cX, float cY, float dY, color cBu, color cBe, color lTxt) => line[] incLn = array.new_line(0) label[] incL = array.new_label(0) linefill[] incLf = array.new_linefill(0) [ccol,red,grn,ccl,cltxt,clbkg,cproj,cproj2,przFill,tgtFill] = pat_colors(bull,cBu,cBe,lTxt) midX = math.round(tLimit/2) avgLeg = math.round(cX-xX)/3 dX = cX + avgLeg [bcN,bcF,xaN,xaF] = t.harmonic_xabcd_prz(type,xY,aY,bY,cY) bcN := bcN < 0 ? 0 : bcN bcF := bcF < 0 ? 0 : bcF xaN := xaN < 0 ? 0 : xaN xaF := xaF < 0 ? 0 : xaF [highest,lowest] = t.harmonic_xabcd_przRange(bcN,bcF,xaN,xaF) [lower,higher] = t.harmonic_xabcd_przClosest(bcN,bcF,xaN,xaF) pH = highest-lowest // Draw potential reversal zone // BC retracement projections line l_bcN = na, line l_bcF = na, line l_xaN = na, line l_xaF = na line przH = na, line przL = na if not na(bcN) l_bcN := line.new(dX,bcN,dX+tLimit,bcN,color=red,width=5) array.push(incLn,l_bcN) array.push(incLn,line.new(bX,bY,dX,bcN,style=line.style_dotted,color=ccol)) array.push(incL,label.new(dX+midX,bcN,str.tostring(bcN,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if bcN == higher przH := l_bcN else if bcN == lower przL := l_bcN if not na(bcF) l_bcF := line.new(dX,bcF,dX+tLimit,bcF,color=red,width=5) array.push(incLn,l_bcF) array.push(incLn,line.new(bX,bY,dX,bcF,style=line.style_dotted,color=ccol)) array.push(incL,label.new(dX+midX,bcF,str.tostring(bcF,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if bcF == higher przH := l_bcF else if bcF == lower przL := l_bcF // XA retracement projections if not na(xaN) l_xaN := line.new(dX,xaN,dX+tLimit,xaN,color=red,width=6) array.push(incLn,l_xaN) array.push(incLn,line.new(xX,xY,dX,xaN,style=line.style_dotted,color=ccol)) array.push(incL,label.new(dX+int(midX/2),xaN,str.tostring(xaN,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if xaN == higher przH := l_xaN else if xaN == lower przL := l_xaN if not na(xaF) l_xaF := line.new(dX,xaF,dX+tLimit,xaF,color=red,width=6) array.push(incLn,l_xaF) array.push(incLn,line.new(xX,xY,dX,xaF,style=line.style_dotted,color=ccol)) array.push(incL,label.new(dX+int(midX/2),xaF,str.tostring(xaF,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if xaF == higher przH := l_xaF else if xaF == lower przL := l_xaF if przL != przH array.push(incLf,linefill.new(przL,przH,przFill)) // entry array.push(incLn,line.new(dX,entry,dX+tLimit,entry,color=grn,width=3,style=line.style_dotted)) // Reversal projections (XA retracement/extension) if not na(bcN) distX = incDistX(dY,pH,bcN,avgLeg) x1_2 = dX+int(distX/2) array.push(incLn,line.new(cX,cY,x1_2,bcN,color=cproj2,width=2,style=line.style_arrow_right)) if not na(bcF) distX = incDistX(dY,pH,bcF,avgLeg) x1_2 = dX+int(distX/2) array.push(incLn,line.new(cX,cY,x1_2,bcF,color=cproj2,width=2,style=line.style_arrow_right)) if not na(xaN) distX = incDistX(dY,pH,xaN,avgLeg) x1_2 = dX+int(distX/2) array.push(incLn,line.new(cX,cY,x1_2,xaN,color=cproj2,width=2,style=line.style_arrow_right)) if not na(xaF) distX = incDistX(dY,pH,xaF,avgLeg) x1_2 = dX+int(distX/2) array.push(incLn,line.new(cX,cY,x1_2,xaF,color=cproj2,width=2,style=line.style_arrow_right)) [incLn,incL,incLf] distX2(dY,pH,p,avgLeg) => halfLeg = math.round(avgLeg/2) qLeg = math.round(avgLeg/4) eLeg = math.round(avgLeg/8) dist = math.abs(p-dY)/pH if dist>.75 avgLeg + qLeg + eLeg else if dist > .5 avgLeg + qLeg else if dist > .25 avgLeg + eLeg else if dist > .1 avgLeg else 0 // @function draw PRZ, entry, stop, targets, and projected reversal paths for XABCD pattern export xabcd_inProgress2(bool bull, int tLimit, float entry, float stop, float t1, float t2, float xadl, float bcdl, float xcdl, int xX, float xY, int bX, float bY, int dX, float dY, color cBu, color cBe, color lTxt) => [ccol,red,grn,ccl,cltxt,clbkg,cproj,cproj2,przFill,tgtFill] = pat_colors(bull,cBu,cBe,lTxt) midX = math.round(tLimit/2) avgLeg = math.round(dX-xX)/4 [highest,lowest] = t.harmonic_xabcd_przRange(xadl,bcdl,xcdl) [lower,higher] = t.harmonic_xabcd_przClosest(xadl,bcdl,xcdl) pH = highest-lowest e = na(entry) ? (bull?higher:lower) : entry line[] fullIpLn = array.new_line(0) label[] fullIpL = array.new_label(0) linefill[] fullIpLf = array.new_linefill(0) // Draw potential reversal zone // BC retracement projections line l_bcdl = na, line l_bcF = na, line l_xadl = na, line l_xcdl = na line przH = na, line przL = na if not na(bcdl) l_bcdl := line.new(dX,bcdl,dX+tLimit,bcdl,color=red,width=5) array.push(fullIpLn,l_bcdl) array.push(fullIpLn,line.new(bX,bY,dX,bcdl,style=line.style_dotted,color=ccol)) array.push(fullIpL,label.new(dX+midX,bcdl,str.tostring(bcdl,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if bcdl == higher przH := l_bcdl else if bcdl == lower przL := l_bcdl if not na(xadl) l_xadl := line.new(dX,xadl,dX+tLimit,xadl,color=red,width=6) array.push(fullIpLn,l_xadl) array.push(fullIpLn,line.new(xX,xY,dX,xadl,style=line.style_dotted,color=ccol)) array.push(fullIpL,label.new(dX+int(midX/2),xadl,str.tostring(xadl,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if xadl == higher przH := l_xadl else if xadl == lower przL := l_xadl if not na(xcdl) l_xcdl := line.new(dX,xcdl,dX+tLimit,xcdl,color=red,width=6) array.push(fullIpLn,l_xcdl) array.push(fullIpLn,line.new(xX,xY,dX,xcdl,style=line.style_dotted,color=ccol)) array.push(fullIpL,label.new(dX+int(midX/2),xcdl,str.tostring(xcdl,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) if xcdl == higher przH := l_xcdl else if xcdl == lower przL := l_xcdl if przL != przH array.push(fullIpLf,linefill.new(przL,przH,przFill)) if stop > 0 array.push(fullIpLn,line.new(dX,stop,dX+tLimit,stop,color=red,width=6)) array.push(fullIpL,label.new(dX+midX,stop,"Stop: "+str.tostring(stop,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) // entry array.push(fullIpLn,line.new(dX,entry,dX+tLimit,entry,color=grn,width=3,style=line.style_dotted)) // Reversal projection if (bull and entry > dY) or (bull==false and entry < dY) array.push(fullIpLn,line.new(dX,dY,dX+avgLeg,t1,color=cproj,style=line.style_arrow_right,width=2)) else distX = distX2(dY,pH,bcdl,avgLeg) x1_2 = dX+int(distX/2) x2_2 = x1_2+distX array.push(fullIpLn,line.new(dX,dY,x1_2,entry,color=cproj2,width=2)) array.push(fullIpLn,line.new(x1_2,entry,x2_2,t1,color=cproj2,style=line.style_arrow_right,width=2)) // Targets l_t1 = line.new(dX,t1,dX+tLimit,t1,color=grn,width=5) array.push(fullIpLn,l_t1) array.push(fullIpL,label.new(dX+midX,t1,"T1: " + str.tostring(t1,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) l_t2 = line.new(dX,t2,dX+tLimit,t2,color=grn,width=5) array.push(fullIpLn,l_t2) array.push(fullIpL,label.new(dX+midX,t2,"T2: " + str.tostring(t2,"#.#####"),style=label.style_label_center,color=clbkg,textcolor=cltxt,size=size.tiny)) array.push(fullIpLf,linefill.new(l_t1,l_t2,tgtFill)) // Return drawings [fullIpLn,fullIpL] //---------------------------------------------------------- // Labels //---------------------------------------------------------- // @function Draw entry hit label export eHitLbl(int x, float e, int dX, float dY, bool bull, bool lOnly=false) => if lOnly==false tt = "Entry @ " + str.tostring(e,"#.#####") label.new(x,e,"๐Ÿšช",size=size.small,style=label.style_none,color=color.new(color.white,100),tooltip=tt) line.new(dX,dY,x,e,style=line.style_dotted,color=(bull==true ? color.new(color.green,30) : color.new(color.red,30))) // @function Draw target hit label export tHitLbl(int x, float tgt, int eX, float eY, bool bull) => tt = "Hit target @ " + str.tostring(tgt,"#.#####") label.new(x,tgt,"โœ…",size=size.tiny,style=label.style_none,color=color.new(color.white,100),tooltip=tt) line.new(eX,eY,x,tgt,style=line.style_dotted,color=(bull==true ? color.new(color.green,30) : color.new(color.red,30))) // @function Draw stop hit label export sHitLbl(int x, float s, int eX, float eY, bool bull) => tt = "Hit stop @ " + str.tostring(s,"#.#####") label.new(x,s,"โŒ",size=size.tiny,style=label.style_none,color=color.new(color.white,100),tooltip=tt) line.new(eX,eY,x,s,style=line.style_dotted,color=(bull==true ? color.new(color.green,30) : color.new(color.red,30))) //---------------------------------------------------------- // Levels //---------------------------------------------------------- level_colors(type=0) => switch type 0 => [color.new(#7e8085,80),color.new(#b2ebf2,70),color.new(color.white,20)] txtLoc(x,length,loc) => switch loc "left" => x "right" => x+length => int(x+length/2) txtStyle(loc) => switch loc "left" => label.style_label_right "right" => label.style_label_left => label.style_label_center // @function Draw a level (box) export level(float y, int x=bar_index, int type=0, int length=50, string extend=extend.none, float padding=1, string b_style=line.style_solid, color colr=#ffffff, color txt_color=#ffffff, string txt=na, string txt_loc=na, string txt_size=size.tiny) => [bg,bord,txtc] = level_colors(type) box = box.new(x, y*(1+padding/100), x+length, y*(1-padding/100), colr!=#ffffff ? color.new(colr,40) : bord, bgcolor = colr!=#ffffff ? color.new(colr,70) : bg, border_style=b_style, extend=extend) txtLoc = na(txt_loc) ? int(x+length/2) : txtLoc(x,length,txt_loc) lbl = label.new(txtLoc,y,na(txt) ? str.tostring(y,"#.#####") : txt, style=txtStyle(txt_loc), color=color.new(color.black,100),size=txt_size, textalign=text.align_center, textcolor = txt_color!=#ffffff ? txt_color : txtc) [box,lbl] //---------------------------------------------------------- // Misc //---------------------------------------------------------- // Incomplete pattern tooltip. Not really useful, just needed to make space in Harmonics script. export incTtTxt(int tp, string name, float xbr, float xbre, float acr, float acre, float bcN, float bcF, float xaN, float xaF, float score, float e) => [rb,rc,rd1,rd2] = t.harmonic_xabcd_fibDispTxt(tp) l1 = "Potential " + name + " (" + str.tostring(score*100,"#.##") + "%)\n\n" l2 = " Potential Reversal Zone:\n" l21 = " Entry: " + str.tostring(e,"#.#####") + "\n" l211 = " BC retracement (" + rd1 + ")\n" l3 = " Near: " + (bcN<0 ? "<0" : str.tostring(bcN, "#.#####")) + "\n" l4 = " Far: " + (bcF<0? "<0" : str.tostring(bcF, "#.#####")) + "\n" l41 = " XA retracement (" + rd2 + ")\n" l42 = " Near: " + (xaN<0 ? "<0" : str.tostring(xaN, "#.#####")) + "\n" l43 = " Far: " + (not na(xaF) ? (xaF<0 ? "<0" : str.tostring(xaF, "#.#####")) : "N/A") + "\n" l5 = "\n Actual % Err Theoretical\n" l6 = "AB/XA " + str.tostring(xbr, "0.000") + " " + (tp==5 ? "NA " : (str.tostring(xbre*100, "00.0")+"%")) + " " + rb + "\n" l7 = "BC/AB " + str.tostring(acr, "0.000") + " " + str.tostring(acre*100, "00.0") + "% " + rc + "\n" l8 = "CD/BC " + "TBD " + " - " + rd1 + "\n" l9 = (tp==6 ? "CD/XC " : "AD/XA ") + "TBD " + " - " + rd2 + "\n" l1 + l2 + (na(e)?"":l21) + l211 + l3 + l4 + l41 + l42 + l43 + l5 + l6 + l7 + l8 + l9
LibIndicadoresUteis
https://www.tradingview.com/script/tARxmsTT/
Fabricio_Guima
https://www.tradingview.com/u/Fabricio_Guima/
2
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ Fabricio_Guima/GuimaIndicadoresUteis //@version=5 // @description Collection of useful indicators. This collection does not do any type of plotting on the graph, as the methods implemented can and should be used to get the return of mathematical formulas, in a way that speeds up the development of new scripts. The current version contains methods for stochastic return, slow stochastic, IFR, leverage calculation for B3 futures market, leverage calculation for B3 stock market, bollinger bands and the range of change. library("LibIndicadoresUteis") // @function Returns the value of stochastic // @param PeriodoEstocastico Period for calculation basis // @returns Float with the stochastic value of the period export estocastico(int PeriodoEstocastico) => var float d = 0.0 lowest = ta.lowest(PeriodoEstocastico) highest = ta.highest(PeriodoEstocastico) HN = highest - lowest k = 100 * (close - lowest) / HN // Valor do estocรกstico // @function Returns the value of slow stochastic // @param PeriodoEstocastico Stochastic period for calculation basis // @param PeriodoMedia Average period for calculation basis // @returns Float with the value of the slow stochastic of the period export estocasticoLento(int PeriodoEstocastico, int PeriodoMedia) => var float dLento = 0.0 stc = estocastico(PeriodoEstocastico) dLento := ta.sma(stc, PeriodoMedia) // Estocastico Lento // @function Returns the value of the RSI/IFR Poisoned of Guima // @param PeriodoIFR RSI/IFR period for calculation basis // @param OrigemIFR Source of RSI/IFR for calculation basis // @returns Float with the RSI/IFR value for the period export ifrInvenenado(int PeriodoIFR, float OrigemIFR) => up = ta.rma(math.max(ta.change(OrigemIFR), 0), PeriodoIFR) down = ta.rma(-math.min(ta.change(OrigemIFR), 0), PeriodoIFR) rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) // @function Returns the number of contracts to work based on margin // @param margem Margin for contract unit // @param alavancagemMaxima Maximum number of contracts to work // @returns Integer with the number of contracts suggested for trading export calculoAlavancagemFuturos(float margem, int alavancagemMaxima) => contratos = 0 contratos := int(strategy.equity/margem) if(strategy.equity < margem and strategy.equity > 10/100*strategy.equity) contratos := 1 contratos := contratos > alavancagemMaxima ? alavancagemMaxima : contratos // @function Returns the number of batches to work based on the margin // @param alavancagemMaxima Maximum number of batches to work // @returns Integer with the amount of lots suggested for trading export calculoAlavancagemAcoes(int alavancagemMaxima) => contratos = 0 contratos := (math.round(math.round(strategy.equity/close)/100))*100 if(contratos < 100) contratos := 100 contratos := contratos > alavancagemMaxima ? alavancagemMaxima : contratos // @function Returns the value of bollinger bands // @param periodoBB Period of bollinger bands for calculation basis // @param origemBB Origin of bollinger bands for calculation basis // @param desvioPadrao Standard Deviation of bollinger bands for calculation basis // @returns Two-position array with upper and lower band values โ€‹โ€‹respectively export bandasBollinger(int periodoBB, float origemBB, float desvioPadrao) => length = periodoBB src = origemBB mult = desvioPadrao basis = ta.sma(src, length) dev = mult * ta.stdev(src, length) upper = basis + dev lower = basis - dev bandas = array.new_float(2) array.set(bandas, 0, upper) array.set(bandas, 1, lower) bandas // @function Returns the value of Rate Of Change // @param periodoROC Period for calculation basis // @param origemROC Source of calculation basis // @returns Float with the value of Rate Of Change export theRoc(int periodoROC, float origemROC) => length = periodoROC source = origemROC roc = 100 * (source - source[length])/source[length]
kNN
https://www.tradingview.com/script/5wbvaWZT-kNN/
lastguru
https://www.tradingview.com/u/lastguru/
18
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ lastguru, 2022. All right reserved //@version=5 // @description Collection of experimental kNN functions library("kNN", true) // @function Store the previous trade; buffer the current one until results are in. Results are binary: up/down // @param knn knn matrix // @param p1 feature 1 value // @param p2 feature 2 value // @param src current price // @param maxrows limit the matrix size to this number of rows (0 of no limit) // @returns modified knn matrix export knnStore(matrix<float> knn, float p1, float p2, float src, int maxrows = 0) => var prevp1 = 0.0 var prevp2 = 0.0 var prevsrc = 0.0 if (maxrows > 0 and matrix.rows(knn) > maxrows) matrix.remove_row(knn, 0) // Add to storage matrix: parameter 1, parameter 2, price, result (up = 1; down = -1) matrix.add_row(knn, matrix.rows(knn), array.from(prevp1, prevp2, prevsrc, src >= prevsrc ? 1 : -1)) prevp1 := p1 prevp2 := p2 prevsrc := src knn // @function Store the previous trade; buffer the current one until results are in. Results are in percents // @param knn knn matrix // @param p1 feature 1 value // @param p2 feature 2 value // @param src current price // @param maxrows limit the matrix size to this number of rows (0 of no limit) // @returns modified knn matrix export knnStorePercent(matrix<float> knn, float p1, float p2, float src, int maxrows = 0) => var prevp1 = 0.0 var prevp2 = 0.0 var prevsrc = 0.0 if (maxrows > 0 and matrix.rows(knn) > maxrows) matrix.remove_row(knn, 0) // Add to storage matrix: parameter 1, parameter 2, price, result percentage matrix.add_row(knn, matrix.rows(knn), array.from(prevp1, prevp2, prevsrc, 100 * (src - prevsrc) / prevsrc)) prevp1 := p1 prevp2 := p2 prevsrc := src knn // @function Get neighbours by getting k results with the smallest distances // @param distance distance array // @param result result array // @returns array slice of k results export knnGet(float[] distance, float[] result, int k) => m = matrix.new<float>(0, 0, 0) matrix.add_col(m, 0, distance) matrix.add_col(m, 1, result) matrix.sort(m, 0) r = matrix.col(m, 1) out = array.slice(r, 0, math.min(k, array.size(r)-1)) // @function Create a distance array from the two given parameters // @param knn knn matrix // @param p1 feature 1 value // @param p2 feature 2 value // @returns distance array export knnDistance(matrix<float> knn, float p1, float p2) => dist = array.new_float(0) n = matrix.rows(knn) - 1 for i = 0 to n d = math.sqrt( math.pow(p1 - matrix.get(knn, i, 0), 2) + math.pow(p2 - matrix.get(knn, i, 1), 2) ) array.push(dist, d) dist // @function Make a prediction, finding k nearest neighbours and summing them up // @param knn knn matrix // @param p1 feature 1 value // @param p2 feature 2 value // @param k sum k nearest neighbors // @returns sum of k nearest neighbors export knnSum(matrix<float> knn, float p1, float p2, int k) => slice = (matrix.rows(knn) == 0) ? array.from(0.0) : knnGet(knnDistance(knn, p1, p2), matrix.col(knn, 3), k) out = array.sum(slice) // @function execute kNN filter // @param kNN filter type // @param k number k // @param skew kNN minimum difference // @param depth kNN matrix size limit // @param price series // @param long long condition // @param short short condition // @param store store the supplied features (if false, only checks the results without storage) // @param feature1 feature 1 value // @param feature2 feature 2 value // @returns [longOK, shortOK] filter output export doKNN(string type, int k = 5, int skew = 0, int depth, float src, bool long, bool short, bool store, float feature1, float feature2) => var knnM = matrix.new<float>(0, 0, 0) longOK = true shortOK = true switch type "Boolean" => if (long or short) if (store) knnM := knnStore(knnM, feature1, feature2, src, depth) filter = knnSum(knnM, feature1, feature2, k) longOK := filter >= skew shortOK := filter <= -skew "Percent" => if (long or short) if (store) knnM := knnStorePercent(knnM, feature1, feature2, src, depth) filter = knnSum(knnM, feature1, feature2, k) longOK := filter >= skew shortOK := filter <= -skew [longOK, shortOK]
condition
https://www.tradingview.com/script/qNWSt6SV-condition/
kaigouthro
https://www.tradingview.com/u/kaigouthro/
9
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ kaigouthro // @version=5 // @description True/False Condition tools and toggles for booleans and utility. // suggested use is checking if a calculation is required, or can be skipped // speeding up script calculations in realtime and historical scenarios. library("condition") // @function output is true only if first true and second false // @param _first_cond (bool) First Condition // @param _second_cond (bool) Second Condition // @returns True if coditions met export isonlywihtout ( bool _first_cond , bool _second_cond ) => varip _state = bool(na) _state := switch _first_cond and not _second_cond => true _first_cond and _second_cond => false => bool(na) // @function output is true only for the first condition if the second condition is also true // @param _first_cond (bool) First Condition // @param _second_cond (bool) Second Condition // @returns True if coditions met export isonlywih ( bool _first_cond , bool _second_cond ) => varip _state = bool(na) _state := switch _first_cond and _second_cond => true _first_cond and not _second_cond => false => bool(na) // @function output is true active only while actively true // @param _cond (bool) Condition met // @returns True if coditions met export isactive ( bool _cond ) => varip _state = bool(na) _state := switch _cond => true => false // @function output is true only while condition is not active // @param _cond (bool) Condition met // @returns True if coditions met export isnotactive ( bool _cond ) => varip _state = bool(na) _state := switch _cond => true => false // @function output is true and holds on True activation , na input has no effect, only a false will disengage // @param _cond (bool) Condition met // @returns True if coditions met export isontoggle ( bool _cond ) => varip _state = bool(na) _state := switch _cond => true not _cond => false => _state // @function output is true and holds on False activation, na input has no effect, only a true will disengage // @param _cond (bool) Condition met // @returns True if coditions met export isofftoggle ( bool _cond ) => varip _state = bool(na) _state := switch not _cond => true _cond => false => _state // @function output is false only if both are active, either or neither pass true // @param _first_cond (bool) First Condition // @param _second_cond (bool) Second Condition // @returns True if coditions met export isnotboth ( bool _first_cond , bool _second_cond ) => varip _state = bool(na) _state := switch _first_cond and _second_cond => false => true // @function output is false only if both are active, either or neither pass true // @param _first_cond (bool) First Condition // @param _second_cond (bool) Second Condition // @returns True if coditions met export isneither ( bool _first_cond , bool _second_cond ) => varip _state = bool(na) _state := switch _first_cond and _second_cond => false => true // @function output is true and held when both trigger true, and only disengages if both are false at once // @param _first_cond (bool) First Condition // @param _second_cond (bool) Second Condition // @returns True if coditions met export isbothtoggled ( bool _first_cond , bool _second_cond ) => varip _state = bool(na) _state := switch _first_cond and _second_cond => true not _first_cond and not _second_cond => false => _state
High/Low Fibs using Bullish Anchors
https://www.tradingview.com/script/YCwW6jyr-High-Low-Fibs-using-Bullish-Anchors/
thebearfib
https://www.tradingview.com/u/thebearfib/
76
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ thebearfib // //@version=5 // indicator(title = "High/Low Fibs Anchors Bear", shorttitle='Bear Fibs Anchors', format=format.price, precision=2, overlay = true) //~ https://www.tradingview.com/script/7poJ0BTX-HSV-and-HSL-gradient-Tools-Built-in-Drop-in-replacement/ import kaigouthro/hsvColor/15 as HSV o(col, o) => color.new(col, o) //~ https://www.tradingview.com/script/D1igBUy9-arrays/ import HeWhoMustNotBeNamed/arraymethods/1 _8 = input(false,'โ•โ•โ•โ•โ•โ•โ• INPUTS โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•') bool _flip = input.bool(true, 'Flip Fibs ๐Ÿ”ƒ') int lookback = input.int(defval = 1000, title = "High/Low Lookback โš“", minval = 0) bool showlab = input.bool(defval = true, title = "๐š‚๐š‘๐š˜๐š  Labels & Lines") bool showPrices = input.bool(defval = true, title = "๐š‚๐š‘๐š˜๐š  Prices") _8a = input(false,'โ•โ•โ•โ•โ•โ•โ• MOVE LINES โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•') int extndPrices = input.int(defval = 20, title = "Move Prices to Right โžก๏ธ") int extndRT = input.int(defval = 20, title = "Extend Lines Right โžก๏ธ") _8b = input(false,'โ•โ•โ•โ•โ•โ•โ• FIB LEVELS โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•') var FL = "Set Fib Levels" color fib0col =input( #dd09c1, '', inline = "12", group = FL)//Bottom Anchor & New Low color fib100col =input( #dd09c1, '', inline = "5", group = FL)//Top Anchor & New High color fib200col =input( #dd0909, '', inline = "1", group = FL)//Final Target color fib1618col =input( #73ff00, '', inline = "2", group = FL)//Targer #2 color fib150col =input( #df7f09, '', inline = "3", group = FL)//Test Level color fib1272col =input( #73ff00, '', inline = "4", group = FL)//Target #1 color fib854col =input( #8c8d84, '', inline = "6", group = FL)//Soft Level color fib782col =input( #0925df, '', inline = "7", group = FL)//Hard Level color fib650col =input( #ddac09, '', inline = "8", group = FL)//BreakOut Level color fib618col =input( #c8ff00fb, '', inline = "9", group = FL)//Retrace Level #2 color fib500col =input( #ff0000, '', inline = "10", group = FL)//Retrace Level #1 color fib382col =input( #55055f, '', inline = "11", group = FL)//Invaldation Line var color [] fibArrayc = array.from(fib0col,fib382col,fib500col,fib618col,fib650col,fib782col,fib854col,fib100col,fib1272col,fib150col,fib1618col,fib200col) float fib0Value = input.float(0.000, ' ', inline = "12", group = FL) // float fib382Value = input.float(0.382, ' ', inline = "11", group = FL)//Invaldation Line float fib500Value = input.float(0.500, ' ', inline = "10", group = FL)//Retrace Level #1 float fib618Value = input.float(0.618, ' ', inline = "9", group = FL)//Retrace Level #2 float fib650Value = input.float(0.650, ' ', inline = "8", group = FL)//BreakOut Level float fib782Value = input.float(0.782, ' ', inline = "7", group = FL)//Hard Level float fib854Value = input.float(0.854, ' ', inline = "6", group = FL)//Soft Level float fib100Value = input.float(1.000, ' ', inline = "5", group = FL)//Top Anchor & New High float fib1272Value = input.float(1.272, ' ', inline = "4", group = FL)//Target #1 float fib150Value = input.float(1.500, ' ', inline = "3", group = FL)//Test Level float fib1618Value = input.float(1.618, ' ', inline = "2", group = FL)//Targer #2 float fib200Value = input.float(2.000, ' ', inline = "1", group = FL)//Final Target bool _fib0Value = input.bool(true, 'Anchor & New High/Low', inline = "12", group = FL) //Bottom Anchor & New Low bool _fib382Value = input.bool(true, 'Invaldation Line', inline = "11", group = FL)//Invaldation Line bool _fib500Value = input.bool(true, 'Retrace Level #1', inline = "10", group = FL)//Retrace Level #1 bool _fib618Value = input.bool(true, 'Retrace Level #2', inline = "9", group = FL)//Retrace Level #2 bool _fib650Value = input.bool(true, 'BreakOut Level', inline = "8", group = FL)//BreakOut Level bool _fib782Value = input.bool(true, 'Hard Level', inline = "7", group = FL)//Hard Level bool _fib854Value = input.bool(true, 'Soft Level', inline = "6", group = FL)//Soft Level bool _fib100Value = input.bool(true, 'Anchor & New High/Low', inline = "5", group = FL)//Top Anchor & New High bool _fib1272Value = input.bool(true, 'Target #1', inline = "4", group = FL)//Target #1 bool _fib150Value = input.bool(true, 'Test Level', inline = "3", group = FL)//Test Level bool _fib1618Value = input.bool(true, 'Target #2', inline = "2", group = FL)//Targer #2 bool _fib200Value = input.bool(true, 'Final Target', inline = "1", group = FL)//Final Target var float [] fibArray = array.from(fib0Value,fib382Value,fib500Value,fib618Value,fib650Value,fib782Value,fib854Value,fib100Value,fib1272Value,fib150Value,fib1618Value,fib200Value) var line u = na var line d = na var line p = na // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Fib Level Calcs โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // if barstate.islast line.all.flush(), label.all.flush() arrHL = array.new_float() for i = 0 to lookback - 1 arrHL.push(high[i]) arrHL.push(low[i]) u.delete() d.delete() u := line.new(bar_index - (lookback - 1), arrHL.max(), bar_index + extndRT, arrHL.max(), color = o(fib0col, 60), width=3) d := line.new(bar_index - (lookback - 1), arrHL.min(), bar_index + extndRT, arrHL.min(), color = o(fib100col, 60), width=3) s12 = u.get_y2() s22 = d.get_y2() dist = s12 - s22 fibsBullf = array.from(s12,s12 - dist * 0.386, s12 - dist * 0.500, s12 - dist * 0.618, s12 - dist * 0.650, s12 - dist * 0.786, s12 - dist * 0.854, s22, s12 - dist * 1.272, s12 - dist * 1.500, s12 - dist * 1.618, s12 - dist * 2.00) fibsBearf = array.from(s22,s22 + dist * 0.386, s22 + dist * 0.500, s22 + dist * 0.618, s22 + dist * 0.650, s22 + dist * 0.786, s22 + dist * 0.854, s12, s22 + dist * 1.272, s22 + dist * 1.500, s22 + dist * 1.618, s22 + dist * 2.00) fibs = _flip == true ? fibsBullf : fibsBearf for i = 0 to fibs.size() - 1 [style, col] = switch i == 0 => [line.style_dashed, o(fib0col, 60)] i == 1 => [line.style_dashed, fib382col] i == 2 => [line.style_dashed, fib500col] i == 3 => [line.style_dashed, fib618col] i == 4 => [line.style_dashed, fib650col] i == 5 => [line.style_dashed, fib782col] i == 6 => [line.style_dashed, fib854col] i == 7 => [line.style_dashed, o(fib100col, 60)] i == 8 => [line.style_dashed, fib1272col] i == 9 => [line.style_dashed, fib150col] i == 10 => [line.style_dashed, fib1618col] i == 11 => [line.style_dashed, fib200col] kaicol =HSV.hsv_gradient(i, 0, fibs.size() - 1, fib0col, fib100col) if showlab line.new(bar_index - (lookback - 1), fibs.get(i), bar_index + extndRT, fibs.get(i), width = 1, style = style, color = o(col, 20)) label.new(bar_index + extndPrices + extndRT, fibs.get(i), xloc = xloc.bar_index, text = str.tostring(fibs.get(i), format.mintick), style = label.style_label_left, textcolor = o(col, 20), color = #ffffff00) if showPrices label.new(bar_index + extndRT, fibs.get(i), xloc = xloc.bar_index, text = str.tostring(fibArray.get(i)), style = label.style_label_left, textcolor = o(col, 20), color = #ffffff00) _calc1 = (u.get_y2() - d.get_y2()) _calc2 = (u.get_y2() - d.get_y2()) / d.get_y2() * 100 // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Table Inputs โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // _8c = input(false,'โ•โ•โ•โ•โ•โ•โ• TABLE INPUTS โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•') position3c = input.string("Bottom Right","๐Ÿ”ƒ- Table Position", options = ["Top Right", "Top Center", "Top Left", "Middle Right", "Middle Center", "Middle Left", "Bottom Right", "Bottom Center", "Bottom Left"]) tableposGo3 = switch position3c "Top Right" => position.top_right "Top Center" => position.top_center "Top Left" => position.top_left "Middle Right" => position.middle_right "Middle Center" => position.middle_center "Middle Left" => position.middle_left "Bottom Right" => position.bottom_right "Bottom Center" => position.bottom_center "Bottom Left" => position.bottom_left // // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” Inputs โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” // _fontSize1 = input.string("Normal","๐Ÿ—š - Table Font Size", options = [ "Auto", "Tiny", "Small", "Normal", "Large", "Huge"]) _fontSize = switch _fontSize1 "Normal" => size.normal "Auto" => size.auto "Tiny" => size.tiny "Small" => size.small "Large" => size.large "Huge" => size.huge bool showxA = input.bool(defval = false, title = "๐š‚๐š‘๐š˜๐š  Lookback in Bars") bool showxB = input.bool(defval = false, title = "๐š‚๐š‘๐š˜๐š  Diff $ & % ") if barstate.islast or barstate.islastconfirmedhistory var table tabu = table.new(tableposGo3, 99, 99, bgcolor = color.rgb(45, 44, 44,100), frame_color=color.rgb(59, 58, 58,100), frame_width = 3, border_color =color.rgb(19, 19, 19,100), border_width = 1) if showxA table.cell(tabu, 1, 5, 'ษดแด สŸแดแดแด‹ส™แด€แด„แด‹ ส™แด€ส€s:',text_halign = text.align_left,text_color = color.gray,text_size = _fontSize) table.cell(tabu, 2, 5, str.tostring(lookback),text_halign =text.align_right, text_color =color.white ,text_size = _fontSize ,text_font_family=font.family_monospace) if showxB table.cell(tabu, 1, 6, 'แด…แด‡สŸแด›แด€ ษชษด แด…แดสŸสŸแด€ส€s: $',text_halign = text.align_left,text_color = color.gray,text_size = _fontSize) table.cell(tabu, 2, 6, str.tostring(_calc1,format.mintick),text_halign = text.align_right,text_color = color.white, text_size = _fontSize, text_font_family=font.family_monospace) table.cell(tabu, 1, 7, 'แด…แด‡สŸแด›แด€ ษชษด แด˜แด‡ส€แด„แด‡ษดแด›:',text_halign = text.align_left,text_color = color.gray,text_size = _fontSize) table.cell(tabu, 2, 7, str.tostring(_calc2, format.percent),text_halign = text.align_right,text_color =color.white,text_size = _fontSize,text_font_family=font.family_monospace)
rows
https://www.tradingview.com/script/XWIiAjwT-rows/
kaigouthro
https://www.tradingview.com/u/kaigouthro/
12
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉkaigouthro // @version=5 // @description Whole Row Matrix Setter/Getter Operations library("rows") // Helpers for NA vals (prevents errors on reads later on) nafill(a)=> x = a.get(0), x := na // THANK @moebius1977 for finding bug. _resize(a,m,o) => d = o == 'c' h = m.rows() w = m.columns() naItem = nafill(a) while a.size ( ) < (d ?w : h) a.concat(array.from(naItem)) switch d => while m.columns() < a.size() m.add_col() => while m.rows() < a.size() m.add_row() a // functionality non-overloaded, mini-ish //@function : Deletes a row _delrow ( m, n ) =>m.remove_row ( n) //@function Resizes an array so it matches the size of the matrix rows _grow ( m , a ) => _resize ( a, m, 'c') //@function Returns a specific row from the matrix _row ( m, n ) =>m.row ( n) //@function Replaces a row in the matrix with a new one _replr ( m, n,a ) =>_a=_grow ( m , a ), _r=m.row( n ), m.remove_row ( n ), m.add_row ( n,_a ), _r //@function Sets a row in the matrix with a new one _rowset ( m, n,a ) =>_a=_grow ( m , a ), _replr ( m, n,_a) //@function Pushes an item onto the end of a specific row _rpush ( m, i,n ) =>a=m.row ( n ), v= a.shift (), a.push ( i ), _replr ( m,n,a ), v //@function Unshifts an item onto the start of a specific row _runshift ( m, i,n ) =>a=m.row ( n ), a.unshift ( i ), v= a.pop (), _replr ( m,n,a ), v //@function Pushes an array onto the end of the matrix _arpush ( m , a ) =>_a =_grow ( m , a ), m.add_row (m.columns(),_a) //@function Unshifts an array onto the start of the matrix _arunshift ( m , a ) =>_a=_grow ( m , a ), m.add_row ( 0,_a) //@function Inserts an array at a specific row in the matrix _arins ( m, n,a ) =>_a=_grow ( m , a ), m.add_row ( n,_a) //@function Pulls out and removes a specific row from the matrix _arpull ( m, n ) =>row=m.row ( n ), _delrow (m,n ), row //@function Pops off the last row from the matrix _arpop ( m ) => sz=m.rows()-1, row=m.row ( sz ), _delrow ( m,sz ), row //@function Shifts off the first row from the matrix _arshift ( m ) =>row=m.row ( 0 ), _delrow (m, 0 ), row //@function Sorts the rows of the matrix by the Nth value from each row _sort_by (m,id) => // create a copy buffer first _temp = m.copy() for [i,idx] in id _new = _temp.row(idx) _rowset(m, i,_new) m //@function do pop last row off of matrix //@param _matrix Matrix To Edit //@returns Array of Last row, removing it from matrix export pop ( matrix<bool> _matrix ) => _arpop ( _matrix ) export pop ( matrix<box> _matrix ) => _arpop ( _matrix ) export pop ( matrix<color> _matrix ) => _arpop ( _matrix ) export pop ( matrix<float> _matrix ) => _arpop ( _matrix ) export pop ( matrix<int> _matrix ) => _arpop ( _matrix ) export pop ( matrix<label> _matrix ) => _arpop ( _matrix ) export pop ( matrix<line> _matrix ) => _arpop ( _matrix ) export pop ( matrix<linefill> _matrix ) => _arpop ( _matrix ) export pop ( matrix<string> _matrix ) => _arpop ( _matrix ) export pop ( matrix<table> _matrix ) => _arpop ( _matrix ) //@function do shift the first row off of matrix //@param _matrix Matrix To Edit //@returns Array of First row, removing it from matrix export shift ( matrix<bool> _matrix ) => _arshift ( _matrix ) export shift ( matrix<box> _matrix ) => _arshift ( _matrix ) export shift ( matrix<color> _matrix ) => _arshift ( _matrix ) export shift ( matrix<float> _matrix ) => _arshift ( _matrix ) export shift ( matrix<int> _matrix ) => _arshift ( _matrix ) export shift ( matrix<label> _matrix ) => _arshift ( _matrix ) export shift ( matrix<line> _matrix ) => _arshift ( _matrix ) export shift ( matrix<linefill> _matrix ) => _arshift ( _matrix ) export shift ( matrix<string> _matrix ) => _arshift ( _matrix ) export shift ( matrix<table> _matrix ) => _arshift ( _matrix ) //@function retrieve specific row of matrix //@param _matrix Matrix To Edit //@param _rowNum Row being Targeted //@returns Array of selected row number, leaving in place export get ( matrix<bool> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) export get ( matrix<box> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) export get ( matrix<color> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) export get ( matrix<float> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) export get ( matrix<int> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) export get ( matrix<label> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) export get ( matrix<line> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) export get ( matrix<linefill> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) export get ( matrix<string> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) export get ( matrix<table> _matrix , int _rowNum ) => _row ( _matrix , _rowNum ) //@function add single item onto end of row //@param _matrix Matrix To Edit //@param _rowNum Row being Targeted //@param _item Item to Push on Row //@returns shifted item from row start export push ( matrix<bool> _matrix , int _rowNum , bool _item ) => _rpush ( _matrix , _item , _rowNum ) export push ( matrix<box> _matrix , int _rowNum , box _item ) => _rpush ( _matrix , _item , _rowNum ) export push ( matrix<color> _matrix , int _rowNum , color _item ) => _rpush ( _matrix , _item , _rowNum ) export push ( matrix<float> _matrix , int _rowNum , float _item ) => _rpush ( _matrix , _item , _rowNum ) export push ( matrix<int> _matrix , int _rowNum , int _item ) => _rpush ( _matrix , _item , _rowNum ) export push ( matrix<label> _matrix , int _rowNum , label _item ) => _rpush ( _matrix , _item , _rowNum ) export push ( matrix<line> _matrix , int _rowNum , line _item ) => _rpush ( _matrix , _item , _rowNum ) export push ( matrix<linefill> _matrix , int _rowNum , linefill _item ) => _rpush ( _matrix , _item , _rowNum ) export push ( matrix<string> _matrix , int _rowNum , string _item ) => _rpush ( _matrix , _item , _rowNum ) export push ( matrix<table> _matrix , int _rowNum , table _item ) => _rpush ( _matrix , _item , _rowNum ) //@function slide single item into start of row remove last //@param _matrix Matrix To Edit //@param _rowNum Row being Targeted //@param _item Item to Unshift on Row //@returns popped item from row end export unshift ( matrix<bool> _matrix , int _rowNum , bool _item ) => _runshift( _matrix , _item , _rowNum ) export unshift ( matrix<box> _matrix , int _rowNum , box _item ) => _runshift( _matrix , _item , _rowNum ) export unshift ( matrix<color> _matrix , int _rowNum , color _item ) => _runshift( _matrix , _item , _rowNum ) export unshift ( matrix<float> _matrix , int _rowNum , float _item ) => _runshift( _matrix , _item , _rowNum ) export unshift ( matrix<int> _matrix , int _rowNum , int _item ) => _runshift( _matrix , _item , _rowNum ) export unshift ( matrix<label> _matrix , int _rowNum , label _item ) => _runshift( _matrix , _item , _rowNum ) export unshift ( matrix<line> _matrix , int _rowNum , line _item ) => _runshift( _matrix , _item , _rowNum ) export unshift ( matrix<linefill> _matrix , int _rowNum , linefill _item ) => _runshift( _matrix , _item , _rowNum ) export unshift ( matrix<string> _matrix , int _rowNum , string _item ) => _runshift( _matrix , _item , _rowNum ) export unshift ( matrix<table> _matrix , int _rowNum , table _item ) => _runshift( _matrix , _item , _rowNum ) //@function replace an array to an existing row //@param _matrix Matrix To Edit //@param _rowNum Row being Targeted //@param _array Array to place in Matrix //@returns row that was replaced export set ( matrix<bool> _matrix , int _rowNum , array<bool> _array ) => _rowset ( _matrix , _rowNum , _array ) export set ( matrix<box> _matrix , int _rowNum , array<box> _array ) => _rowset ( _matrix , _rowNum , _array ) export set ( matrix<color> _matrix , int _rowNum , array<color> _array ) => _rowset ( _matrix , _rowNum , _array ) export set ( matrix<float> _matrix , int _rowNum , array<float> _array ) => _rowset ( _matrix , _rowNum , _array ) export set ( matrix<int> _matrix , int _rowNum , array<int> _array ) => _rowset ( _matrix , _rowNum , _array ) export set ( matrix<label> _matrix , int _rowNum , array<label> _array ) => _rowset ( _matrix , _rowNum , _array ) export set ( matrix<line> _matrix , int _rowNum , array<line> _array ) => _rowset ( _matrix , _rowNum , _array ) export set ( matrix<linefill> _matrix , int _rowNum , array<linefill> _array ) => _rowset ( _matrix , _rowNum , _array ) export set ( matrix<string> _matrix , int _rowNum , array<string> _array ) => _rowset ( _matrix , _rowNum , _array ) export set ( matrix<table> _matrix , int _rowNum , array<table> _array ) => _rowset ( _matrix , _rowNum , _array ) //@function insert an array to a new row //@param _matrix Matrix To Edit //@param _rowNum Row being Targeted //@param _array Array to place in Matrix //@returns void export insert ( matrix<bool> _matrix , int _rowNum , array<bool> _array ) => _arins ( _matrix , _rowNum , _array ) export insert ( matrix<box> _matrix , int _rowNum , array<box> _array ) => _arins ( _matrix , _rowNum , _array ) export insert ( matrix<color> _matrix , int _rowNum , array<color> _array ) => _arins ( _matrix , _rowNum , _array ) export insert ( matrix<float> _matrix , int _rowNum , array<float> _array ) => _arins ( _matrix , _rowNum , _array ) export insert ( matrix<int> _matrix , int _rowNum , array<int> _array ) => _arins ( _matrix , _rowNum , _array ) export insert ( matrix<label> _matrix , int _rowNum , array<label> _array ) => _arins ( _matrix , _rowNum , _array ) export insert ( matrix<line> _matrix , int _rowNum , array<line> _array ) => _arins ( _matrix , _rowNum , _array ) export insert ( matrix<linefill> _matrix , int _rowNum , array<linefill> _array ) => _arins ( _matrix , _rowNum , _array ) export insert ( matrix<string> _matrix , int _rowNum , array<string> _array ) => _arins ( _matrix , _rowNum , _array ) export insert ( matrix<table> _matrix , int _rowNum , array<table> _array ) => _arins ( _matrix , _rowNum , _array ) //@function unshift _arr row into matrix //@param _matrix Matrix To Edit //@param _array Array to place in Matrix //@returns void export unshift ( matrix<bool> _matrix , array<bool> _array ) => _arunshift ( _matrix , _array ) export unshift ( matrix<box> _matrix , array<box> _array ) => _arunshift ( _matrix , _array ) export unshift ( matrix<color> _matrix , array<color> _array ) => _arunshift ( _matrix , _array ) export unshift ( matrix<float> _matrix , array<float> _array ) => _arunshift ( _matrix , _array ) export unshift ( matrix<int> _matrix , array<int> _array ) => _arunshift ( _matrix , _array ) export unshift ( matrix<label> _matrix , array<label> _array ) => _arunshift ( _matrix , _array ) export unshift ( matrix<line> _matrix , array<line> _array ) => _arunshift ( _matrix , _array ) export unshift ( matrix<linefill> _matrix , array<linefill> _array ) => _arunshift ( _matrix , _array ) export unshift ( matrix<string> _matrix , array<string> _array ) => _arunshift ( _matrix , _array ) export unshift ( matrix<table> _matrix , array<table> _array ) => _arunshift ( _matrix , _array ) //@function push Array onto matrix //@param _matrix Matrix To Edit //@param _array Array to place in Matrix //@returns void export push ( matrix<bool> _matrix , array<bool> _array ) => _arpush ( _matrix , _array ) export push ( matrix<box> _matrix , array<box> _array ) => _arpush ( _matrix , _array ) export push ( matrix<color> _matrix , array<color> _array ) => _arpush ( _matrix , _array ) export push ( matrix<float> _matrix , array<float> _array ) => _arpush ( _matrix , _array ) export push ( matrix<int> _matrix , array<int> _array ) => _arpush ( _matrix , _array ) export push ( matrix<label> _matrix , array<label> _array ) => _arpush ( _matrix , _array ) export push ( matrix<line> _matrix , array<line> _array ) => _arpush ( _matrix , _array ) export push ( matrix<linefill> _matrix , array<linefill> _array ) => _arpush ( _matrix , _array ) export push ( matrix<string> _matrix , array<string> _array ) => _arpush ( _matrix , _array ) export push ( matrix<table> _matrix , array<table> _array ) => _arpush ( _matrix , _array ) //@function add an array to top and remove/return firrst row //@param _matrix Matrix To Edit //@param _array Array to place in Matrix //@returns first row which has been shifted out export slideDown ( matrix<bool> _matrix , array <bool> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) export slideDown ( matrix<box> _matrix , array <box> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) export slideDown ( matrix<color> _matrix , array <color> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) export slideDown ( matrix<float> _matrix , array <float> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) export slideDown ( matrix<int> _matrix , array <int> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) export slideDown ( matrix<label> _matrix , array <label> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) export slideDown ( matrix<line> _matrix , array <line> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) export slideDown ( matrix<linefill> _matrix , array <linefill> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) export slideDown ( matrix<string> _matrix , array <string> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) export slideDown ( matrix<table> _matrix , array <table> _array ) => _arpush ( _matrix , _array ) , _arshift ( _matrix ) //@function add an array into first row and remove/return the last row //@param _matrix Matrix To Edit //@param _array Array to place in Matrix //@returns last row which has been popped off of the top export slideUp ( matrix<bool> _matrix , array <bool> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) export slideUp ( matrix<box> _matrix , array <box> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) export slideUp ( matrix<color> _matrix , array <color> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) export slideUp ( matrix<float> _matrix , array <float> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) export slideUp ( matrix<int> _matrix , array <int> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) export slideUp ( matrix<label> _matrix , array <label> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) export slideUp ( matrix<line> _matrix , array <line> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) export slideUp ( matrix<linefill> _matrix , array <linefill> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) export slideUp ( matrix<string> _matrix , array <string> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) export slideUp ( matrix<table> _matrix , array <table> _array ) => _arunshift ( _matrix , _array ) , _arpop ( _matrix ) //@function pull out and remove specific row //@param _matrix Matrix To Edit //@param _rowNum Row being Targeted //@returns row which has been removed export pullOut ( matrix<bool> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) export pullOut ( matrix<box> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) export pullOut ( matrix<color> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) export pullOut ( matrix<float> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) export pullOut ( matrix<int> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) export pullOut ( matrix<label> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) export pullOut ( matrix<line> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) export pullOut ( matrix<linefill> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) export pullOut ( matrix<string> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) export pullOut ( matrix<table> _matrix , int _rowNum ) => _arpull ( _matrix , _rowNum ) //@function -> sortby Sort by indiced Array //@param _matrix Matrix To Edit //@param _clmnNum Column being Targeted //@returns Column which has been removed export method sortby ( matrix<bool> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<box> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<color> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<float> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<int> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<label> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<line> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<linefill> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<string> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<table> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) //@unction -> sort_by Sorts the rowws by the Nth col values //@param _matrix Matrix To Sort //@param _colNum col to utilize for sorting //@returns sorted matrix export method sortby ( matrix<float> _matrix , int _colNum ) => // create a copy buffer first _temp = _matrix.copy() sI = _matrix.col(_colNum).sort_indices() _sort_by(_matrix, sI) //@unction -> sort_by Sorts the rowws by the Nth col values //@param _matrix Matrix To Sort //@param _colNum col to utilize for sorting //@returns sorted matrix export method sortby ( matrix<int> _matrix , int _colNum ) => // create a copy buffer first _temp = _matrix.copy() sI = _matrix.col(_colNum).sort_indices() _sort_by(_matrix, sI) // // TEST ALL FUNCTIONS before and after display // test(_matrix,_arr,_item ) => // _st = '' // _m = _matrix // _a = _arr // _x = _item // push ( _m , _arr ) // push ( _m , _arr ) // unshift ( _m , _arr ) // unshift ( _m , _arr ) // _a := get ( _m , 3 ) // _a := pop ( _m ) // _a := shift ( _m ) // _x := push ( _m , 2 , _item ) // _x := push ( _m , 2 , _item ) // _x := push ( _m , 2 , _item ) // _x := unshift ( _m , 10 , _item ) // _x := unshift ( _m , 10 , _item ) // _x := unshift ( _m , 10 , _item ) // insert ( _m , 7 , _a ) // set ( _m , 3 , _a ) // _a := slideDown ( _m , _arr ) // _a := slideUp ( _m , _arr ) // _a := pullOut ( _m , 3 ) // varip matrix<string> _string = matrix.new<string> (10 , 10,'m' ) // varip array<string> _stringa = array.new<string> (6 , 'a' ) // varip matrix<float> _float = matrix.new<float> (10 , 10, 100 ) // varip array<float> _floata = array.new<float> (8 , 100 ) // var matrix<color> _col = matrix.new<color> (10 , 10, #333333 ) // var array<color> _cola = array.new<color> (5 , #ffffff ) // if barstate.islastconfirmedhistory // for k = 0 to _float.rows() - 1 // for [i,n] in _float.row(k) // if k * i > 0 // _float.set(i,k, i + k) // _col.set (i,k, color.hsv(k*15 + k*2,1,1,1)) // else // _float.set(i,k, math.max(k,i)) // _float.set(k,i, math.max(k,i)) // mtb.matrixtable(_float,_string, _col, _textSize = 3, tableXpos = 'left', tableYpos = 'bottom') // test(_float,_floata, 999. ) // test(_string,_stringa , "solo" ) // test(_col,_cola , #0000ff ) // // _float := _float.transpose() // // _string := _string.transpose() // // _col := _col.transpose() // // _float.sortby(0) // mtb.matrixtable(_float,_string, _col, _textSize = 3, _defaultbg = #ffffff, tableXpos = 'right', tableYpos = 'bottom') // import kaigouthro/matrixautotable/14 as mtb // import kaigouthro/hsvColor/15 as color
Robust Bollinger Bands with Trend Strength
https://www.tradingview.com/script/iezQb2d9-Robust-Bollinger-Bands-with-Trend-Strength/
federalTacos5392b
https://www.tradingview.com/u/federalTacos5392b/
41
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ federalTacos5392b //@version=5 indicator("Robust Bollinger Bands with Trend Strength", shorttitle="RBB", overlay=true) // Input for the number of periods length = input(14, title="Length") Trend_strength_length =input(14, title = "Trend Continuation length") rank_correlation_threshold =input (0.7, title= "Trend strength threshold") src1=input(hlc3, title= "Rank Correlation Price source") // Input for the multiplier for IQR multiplier = input(1.0, title="Multiplier") // Choose the source (hlc3 or Vwma) useHLC3 = input.bool(true, title="Use HLC3") src = useHLC3 ? hlc3 : ta.vwma(hlc3, 3) // Calculate median and IQR medianValue = ta.median(src, length) percentile_high = ta.percentile_nearest_rank(high, length, 75) percentile_low = ta.percentile_nearest_rank(low, length, 25) IQR = (percentile_high - percentile_low) iqrValue = ta.ema(IQR, length) // Calculate upper and lower bands upperBand = medianValue + multiplier * iqrValue lowerBand = medianValue - multiplier * iqrValue // Custom ranking function var srcRank = 0.0 if bar_index > length srcRank := src1 > src1[length] ? srcRank + 1 : src1 < src1[length] ? srcRank - 1 : srcRank // Calculate robust rank-based correlation coefficient based on bar count and src robust_rank_corr = ta.correlation(srcRank, bar_index, Trend_strength_length) // Define conditions for filling fillUpTrend = robust_rank_corr > rank_correlation_threshold fillDownTrend = robust_rank_corr < -1*rank_correlation_threshold fillNeutral = -1*rank_correlation_threshold < robust_rank_corr and robust_rank_corr < 1*rank_correlation_threshold // Define fill colors upTrendColor = color.rgb(202, 241, 202) downTrendColor = color.rgb(249, 210, 210) neutralColor = color.rgb(241, 231, 158) // Determine the color based on midline direction color_change = medianValue > medianValue[1] ? color.green : (medianValue < medianValue[1] ? color.red : color.blue) // Plot the Bollinger Bands plot_u = plot(upperBand, color=color.blue, title="Upper Bollinger Band") plot_l = plot(lowerBand, color=color.red, title="Lower Bollinger Band") plot_m = plot(medianValue, color=color_change, title="Median Bollinger Band", linewidth=3) // Fill based on conditions fill(plot_u, plot_l, color=fillUpTrend ? upTrendColor : fillDownTrend ? downTrendColor : neutralColor, title="Trend Fill") // Display the robust_rank_corr value on the chart
Volume Profile - Bear
https://www.tradingview.com/script/DOZrMvWs-Volume-Profile-Bear/
thebearfib
https://www.tradingview.com/u/thebearfib/
107
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ thebearfib // //@version=5 // indicator('Volume Profile Outline - Bear',shorttitle = 'VP cool- [BeaR]', overlay =true, max_bars_back =1000, max_lines_count =500, max_labels_count=500) //~ https://www.tradingview.com/script/7poJ0BTX-HSV-and-HSL-gradient-Tools-Built-in-Drop-in-replacement/ import kaigouthro/hsvColor/15 as HSV import HeWhoMustNotBeNamed/arraymethods/1 _Xxz = input(false,'โ•โ•โ•โ•โ•โ•โ• แด˜ส€แดา“ษชสŸแด‡ แด„แดสŸแดส€s โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•') color vp_poc_color =input.color(defval = color.rgb(255, 0, 0), title = 'Volume Profile POC COLOR') color vp_color_start =input.color(defval = color.rgb(8, 4, 247, 55), title = 'Volume Profile HISTOGRAM Start') color vp_color_end =input.color(defval = color.rgb(239, 0, 252, 55), title = 'Volume Profile HISTOGRAM End') _Xxzz = input(false,'โ•โ•โ•โ•โ•โ•โ• แด˜ส€แดา“ษชสŸแด‡ sแด‡แด›แด›ษชษดษขs โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•') bool outlineOnly= input.bool(true, 'Outline Only') int wid = input.int (2, 'Outline Width', minval=1, maxval=4) bool flip = input.bool(true, 'Flip Histogram') int _moveP = input.int(68, 'Move Profile Sideways', minval=1, maxval=1000) int bar = input.int(150, 'Row Size', minval=1, maxval=500) int bar_width = input.int(5, 'Bar Width') int width = input.int(15, 'Width (% of the box)', minval=1, maxval=100) int vp_len = input.int(400, 'Lookback [No. Periods/bars]', minval=1, maxval=1000) int vp_poc_width = input.int(3, 'POC Thickness', minval=1, maxval=5) var a = array.new_line() var b = array.new_line() if barstate.isfirst for i = 0 to bar - 1 by 1 array.push(a, line.new(na, na, na, na, style= line.style_solid, width=4)) array.push(b, line.new(na, na, na, na, width=1)) int _bi = bar_index int _bi_mP = _bi + _moveP float _volm = volume var Alvl = 0. var Blvl = 0. var current_num_conf = 0 var current_num_cont = 0 line _l = na line vp_poc = na bool _bs_Lst = barstate.islast float vp_high = ta.highest(vp_len) float vp_low = ta.lowest (vp_len) vp_levels = array.new_float(0) all_v = array.new_float(0) if _bs_Lst for i = 0 to bar by 1 array.push(vp_levels, vp_low + i / bar * (vp_high - vp_low)) for j = 0 to bar - 1 by 1 all = 0. for k = 0 to vp_len - 1 by 1 all := high[k] > array.get(vp_levels, j) and low[k] < array.get(vp_levels, j + 1) ? all + _volm[k] : all all array.push(all_v, all) for j = 0 to bar - 1 by 1 mult = array.get(all_v, j) / array.max(all_v) _l := array.get(a, j) get = array.get(vp_levels, j) if flip line.set_xy1(_l, _bi_mP, get) line.set_xy2(_l, _bi_mP - math.round(vp_len * width / 100 * mult), array.get(vp_levels, j)) else line.set_xy1(_l, _bi_mP - vp_len + 1, get) line.set_xy2(_l, _bi_mP - vp_len + math.round(vp_len * width / 100 * mult), array.get(vp_levels, j)) vp_hist_color =HSV.hsv_gradient(j,1, bar, vp_color_start, vp_color_end) line.set_color(_l, vp_hist_color) line.set_width(_l, bar_width) if mult == 1 vp_poc := array.get(b, 0) avg = math.avg(get, array.get(vp_levels, j + 1)) if flip line.set_xy1(vp_poc, _bi_mP, avg) line.set_xy2(vp_poc, _bi_mP - vp_len + 1, avg) else line.set_xy1(vp_poc, _bi_mP - vp_len + 1, avg) line.set_xy2(vp_poc, _bi_mP, avg) line.set_color(vp_poc, vp_poc_color) line.set_style(vp_poc, line.style_solid) line.set_width(vp_poc, vp_poc_width) _Xxd = input(false,'โ•โ•โ•โ•โ•โ•โ• sแด›แด€แด›s แด›แด€ส™สŸแด‡ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•') showxA = input.bool(defval = true, title = "๐Ÿงฎ Stats Main") position3b = input.string("Bottom Right","- Table Position", options = ["Top Right", "Top Center", "Top Left", "Middle Right", "Middle Center", "Middle Left", "Bottom Right", "Bottom Center", "Bottom Left"]) tableposGo2 = switch position3b "Top Right" => position.top_right "Top Center" => position.top_center "Top Left" => position.top_left "Middle Right" => position.middle_right "Middle Center" => position.middle_center "Middle Left" => position.middle_left "Bottom Right" => position.bottom_right "Bottom Center" => position.bottom_center "Bottom Left" => position.bottom_left if barstate.islast or barstate.islastconfirmedhistory var outline = array.new_line() outline.flush() outline.push(line.new(a.first().get_x1(), a.first().get_y1(), a.first().get_x2(), a.first().get_y2(),color = color.rgb(8, 4, 247), width = wid)) if a.size() > 0 for i = 0 to a.size() - 1 HSVcol = HSV.hsv_gradient(i, 0, a.size() - 1, color.rgb(8, 4, 247), color.rgb(239, 0, 252)) outline.push(line.new(outline.last().get_x2(), outline.last().get_y2(), a.get(i).get_x2(), a.get(i).get_y2(), color = HSVcol, width = wid)) if outlineOnly a.get(i).set_color(#00000000) outline.push(line.new(outline.last().get_x2(), outline.last().get_y2(), a.last().get_x1(), a.last().get_y1(), color = color.rgb(239, 0, 252), width = wid)) outline.push(line.new(outline.last().get_x2(), outline.last().get_y2(), outline.first().get_x1(), outline.get(math.round(outline.size() / 2)).get_y1(), color = color.rgb(239, 0, 252), width = 1)) outline.push(line.new(outline.first().get_x1(), outline.first().get_y1(), outline.first().get_x1(), outline.get(math.round(outline.size() / 2)).get_y1(), color = color.rgb(8, 4, 247), width = 1)) var table tab = table.new(tableposGo2, 99, 99, bgcolor = color.rgb(255, 255, 255, 100), frame_color=color.rgb(255, 255, 255, 100), frame_width = 1, border_color =color.rgb(255, 255, 255, 100), border_width = 1) if showxA table.cell(tab, 1, 7, "ษดแด. ส™แด€ส€s sสœแดแดกษด:",text_halign = text.align_left, text_color = color.white) table.cell(tab, 2, 7, str.tostring(vp_len), text_color = color.white, text_halign = text.align_left)
Bitcoin to GOLD [presentTrading]
https://www.tradingview.com/script/dPqS45zq-Bitcoin-to-GOLD-presentTrading/
PresentTrading
https://www.tradingview.com/u/PresentTrading/
44
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ PresentTrading //@version=5 indicator('Bitcoin to GOLD [presentTrading]') TimeFrame = input.string('480', "Time Frame") ma_length = input.int(200, 'Moving Average Length') // Changed from Gold to Bitcoin BTC = request.security('BINANCE:BTCUSD', TimeFrame, close) GOLD = request.security('TVC:SPX', TimeFrame, close) BTGRatio = BTC / GOLD BTGRatio_ma = ta.sma(BTGRatio, ma_length) BTGRatio_std = ta.stdev(BTGRatio, ma_length) // Calculate the upper and lower bands upper_band = BTGRatio_ma + BTGRatio_std lower_band = BTGRatio_ma - BTGRatio_std // Plotting p = plot(BTGRatio, linewidth=2) ma = plot(BTGRatio_ma, color=color.new(#3179f5, 0), linewidth=2) plot(upper_band, color=color.new(#3179f5, 0), linewidth=2) plot(lower_band, color=color.new(#3179f5, 0), linewidth=2) fill(p, ma, color=BTGRatio > BTGRatio_ma ? color.red: color.teal, transp=15)
Cynical Cold Index
https://www.tradingview.com/script/7jya0bKN-Cynical-Cold-Index/
doubtful-jelly
https://www.tradingview.com/u/doubtful-jelly/
2
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 indicator("Cynical Cold Index") gold = request.security("COMEX:GC1!", timeframe.period, close) * 1 oil = request.security("NYMEX:CL1!", timeframe.period, close) * 30.59273422562141 coffee = request.security("ICEUS:KC1!", timeframe.period, close) * 14.75334255417243 nat_gas = request.security("NYMEX:NG1!", timeframe.period, close) * 835.509138381201 silver = request.security("COMEX:SI1!", timeframe.period, close) * 88.88888888888889 sugar = request.security("ICEUS:SB1!", timeframe.period, close) * 104.2345276872964 corn = request.security("CBOT:ZC1!", timeframe.period, close) * 4.204993429697766 wheat = request.security("CBOT:ZW1!", timeframe.period, close) * 2.909090909090909 cotton = request.security("ICEUS:CT1!", timeframe.period, close) * 2327.272727272727 copper = request.security("COMEX:HG1!", timeframe.period, close) * 614.4393241167435 iron_one = request.security("SGX:FEF1!", timeframe.period, close) * 18.75732708089097 cattle = request.security("CME:LE1!", timeframe.period, close) * 13.22314049586777 urea = request.security("CBOT:UFB1!", timeframe.period, close) * 6.550665301944729 asset = request.security(syminfo.tickerid, timeframe.period, close) basket_sum = (gold + oil + coffee + nat_gas + silver + sugar + corn + wheat + cotton + copper + iron_one + cattle + urea) / 100000 plot( asset / basket_sum, color = color.teal)
How To Input CSV List Of Symbol Data Used For Screener
https://www.tradingview.com/script/KfqHqHUH-How-To-Input-CSV-List-Of-Symbol-Data-Used-For-Screener/
allanster
https://www.tradingview.com/u/allanster/
44
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ allanster //@version=5 indicator("How To Input CSV List Of Symbol Data Used For Screener") // Input CSV list using EXCHANGE:TICKER format for ticker IDs to be screened. feed = input.text_area('COINBASE:BTCUSD,COINBASE:LTCUSD,COINBASE:LINKUSD', 'Feed', tooltip = 'โ€ข Total ticker IDs cannot exceed 4.\nโ€ข Total characters cannot exceed 4096.' + '\nโ€ข Delimiters may use a space after comma but must use the chosen forrmat consistently.') feed(back) => // extract tickerid and decrement list of ticker IDs loop = back // declare string variable to hold content list getT = string(na) // declare string variable to hold tickerid if str.length(loop) == 0 // if list is empty getT := string(na) // assign na to tickerid variable loop := string(na) // assign na to list of ticker Ids variable else // else extract first tickerid getP = nz(str.pos(loop, ','), str.length(loop)) // get position of first comma or last character getT := str.substring(loop, 0, getP) // get tickerid in first position of list dlim = 1 // if no space after delimiter set character size to 1 if str.match(loop, ', ') == ', ' // if space used after delimiter dlim := 2 // then set character size of delimiter to 2 clrT = str.substring(loop, 0, getP + dlim) // get first tickerid + delimiter character(s) loop := str.replace(loop, clrT, '') // clear tickerid + delimiter character(s) from list [getT, loop] // return tickerid in first position & truncated list [tid1, out1] = feed(feed) // feed input list of ticker IDs [tid2, out2] = feed(out1) // feed decremented list [tid3, out3] = feed(out2) // feed decremented list [tid4, out4] = feed(out3) // feed decremented list // [tidN, outN] = feed(outN-1) // can add more declared tuples up to N = 40 ticker IDs f_roc(_tidN) => // example screener function rate of change call = request.security(_tidN, timeframe.period, ta.roc(close, 1)) // call expression rate of change for tickerid if str.length(_tidN) == 0 // if tickerid is blank call := float(na) // then overwrite result of call as float na call // return call result sym1 = f_roc(tid1) // screen tickerid 1 sym2 = f_roc(tid2) // screen tickerid 2 sym3 = f_roc(tid3) // screen tickerid 3 sym4 = f_roc(tid4) // screen tickerid 4 // symN = f_roc(tkrN) // can add more declared ticker IDs up to N = 40 plot(sym1, 'symbol1', #f79319) // plot rate of change for symbol 1 plot(sym2, 'symbol2', #c0c0c0) // plot rate of change for symbol 2 plot(sym3, 'symbol3', #2c61de) // plot rate of change for symbol 3 plot(sym4, 'symbol4', #ff00ff) // plot rate of change for symbol 4 // plot(symN, 'symbolN', #7f7f7f) // can add more plots up to N = 40
Buy/Sell EMA Crossover
https://www.tradingview.com/script/x5gxW3ll-Buy-Sell-EMA-Crossover/
AleSaira
https://www.tradingview.com/u/AleSaira/
20
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ AleSaira //@version=5 indicator(title = "Buy/Sell ema crossover", shorttitle="Buy/Sell ema crossover", overlay=false) emaLengthInput = input.int(200, title="EMA Length") ema200 = ta.ema(close, emaLengthInput) ema13LengthInput = input.int(13, title="EMA 13 Length") ema21LengthInput = input.int(21, title="EMA 21 Length") ema13 = ta.ema(close, ema13LengthInput) ema21 = ta.ema(close, ema21LengthInput) // Calculate crossover and crossunder conditions ema21_cross_over_ema200 = ta.crossover(ema21, ema200) ema21_cross_under_ema200 = ta.crossunder(ema21, ema200) ema13_cross_over_ema21 = ta.crossover(ema13, ema21) ema13_cross_under_ema21 = ta.crossunder(ema13, ema21) // Calculate src and pos src = close pos = 0 pos := src[1] < nz(ema21[1], src) ? 1 : src[1] > nz(ema21[1], src) ? -1 : nz(pos[1], 0) // Define colors for background color colorBg = na if (ema200 > src) colorBg := pos == -1 ? color.rgb(192, 13, 237) : na else colorBg := pos == 1 ? color.rgb(13, 222, 241) : na // Apply the background color bgcolor(colorBg) // Plot triangles only on crossovers and crossunders plotshape(ema21_cross_over_ema200, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small) plotshape(ema21_cross_under_ema200, style=shape.triangledown, location=location.abovebar, color=color.rgb(166, 10, 10), size=size.small) plotshape(ema13_cross_over_ema21, style=shape.triangleup, location=location.belowbar, color=color.white, size=size.small) plotshape(ema13_cross_under_ema21, style=shape.triangledown, location=location.abovebar, color=color.purple, size=size.small) // Debugging Plots plot(ema200, color=color.blue, title="EMA 200") plot(ema13, color=color.rgb(248, 246, 244), title="EMA 13") plot(ema21, color=color.purple, title="EMA 21")
Z-Score Based Momentum Zones with Advanced Volatility Channels
https://www.tradingview.com/script/oUQNMqOu-Z-Score-Based-Momentum-Zones-with-Advanced-Volatility-Channels/
federalTacos5392b
https://www.tradingview.com/u/federalTacos5392b/
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/ // ยฉ federalTacos5392b //@version=5 indicator("Z-Score Based Momentum Zones with Advanced Volatility Channels", overlay = true) look_back_length = input(5, title=" Volatility Correction Look Back Length") lookback_period = input(5, title="Relative Price Change Look Back Length") zscore_period = input(500, title="Z Score Look Back Period") avgZscore_length=input(14, title="Momentum Block Length") // Calculate Intraday Volatility IDV = ta.sma((high - low) / close, look_back_length) / 2 a_high = (ta.highest(high, 5) + ta.highest(high, 8) + ta.highest(high, 13) + ta.highest(high, 21) + ta.highest(high, 34)) / 5 b_high = (ta.sma(high, 5) + ta.sma(high, 8) + ta.sma(high, 13)) / 3 high_c = (a_high + b_high) / 2 a_low = (ta.lowest(low, 5) + ta.lowest(low, 8) + ta.lowest(low, 13) + ta.lowest(low, 21) + ta.lowest(low, 34)) / 5 b_low = (ta.sma(low, 5) + ta.sma(low, 8) + ta.sma(low, 13)) / 3 low_c = (a_low + b_low) / 2 c_high = high_c * (1 + IDV) c_low = low_c * (1 - IDV) basis = (c_high + c_low) / 2 basisIncreasing = basis > basis[1] basisDecreasing = basis < basis[1] plot_c_high = plot(c_high, color=color.blue, title="Composite High") plot_c_low = plot(c_low, color=color.red, title="Composite Low") // Calculate average z-score value (you need to calculate this value) // Calculate RPD sma_hlc3 = ta.sma(hlc3, lookback_period) psma_hlc3 = ta.valuewhen(true, sma_hlc3, 1) sma_volume = ta.sma(volume, lookback_period) psma_volume = ta.valuewhen(true, sma_volume, 1) std_hlc3 = ta.stdev(hlc3, lookback_period) rpdev = (hlc3 - psma_hlc3) // Input for Volume Correction include_vc = input(false, title="Include Volume Correction") // Calculate Volume Correction if include_vc is true vc = include_vc ? volume / psma_volume : 1 // Calculate Volume Corrected RPD vcrpd = rpdev * vc // Calculate Mean and Standard Deviation of VCRPD using all available data points mean_vcrpd = ta.sma(vcrpd, zscore_period) stddev_vcrpd = ta.stdev(vcrpd, zscore_period) // Calculate Z-Score for VCRPD using all available data points zScores = (vcrpd - mean_vcrpd) / stddev_vcrpd avgZScore=ta.sma(zScores, avgZscore_length) // Define color scheme based on z-score var color fillColor = na if (avgZScore >= 0.25 and avgZScore < 1) fillColor := color.new(#b5eeb7, 40) else if (avgZScore >= 1 and avgZScore < 2) fillColor := color.new(#4ad64f, 40) else if (avgZScore >= 2) fillColor := color.new(#328f35, 40) else if (avgZScore <= -0.25 and avgZScore > -1) fillColor := color.new(#e69292, 40) else if (avgZScore <= -1 and avgZScore > -2) fillColor := color.new(#ac4343, 40) else if (avgZScore <= -2) fillColor := color.new(#c03535, 40) else if (avgZScore >= -0.25 and avgZScore <= 0.25) fillColor := color.new(color.yellow, 70) fill(plot_c_high, plot_c_low, color=fillColor, title="Fill Area") plot(basis, color=basisIncreasing ? color.green : basisDecreasing ? color.red : color.black, title="mid_line", linewidth=3)
Fib TSI
https://www.tradingview.com/script/6yxWGs1k-Fib-TSI/
Options360
https://www.tradingview.com/u/Options360/
46
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ Options360 // 9/16/23 Fib TSI update to 1.1 // 10/30/23 update: 1) add Macro lengths 55, 89, 144, 233 & 377. 2) add All lower TSI histogram option. 3) add All Macro TSI histogram option. //@version=5 indicator("Fib TSI new") src = input(defval=ohlc4, title="Source") ma = input.int(1, 'stoch D smoothing', minval=1) tsia = input.int(3, title='TSI signal', tooltip='TSI uses 2 moving averages compared with each other.') tsi = input.int(5, title='TSI fastest', tooltip='TSI uses 2 moving averages compared with each other. Default value is 3/5') fastma = input.int(8, 'TSI fast', minval=1, tooltip='TSI uses 2 moving averages compared with each other. Default value is 5/8') midma = input.int(13, 'TSI mid', minval=1, tooltip='TSI uses 2 moving averages compared with each other. Default value is 8/13') slowma = input.int(21, 'TSI slow', minval=1, tooltip='TSI uses 2 moving averages compared with each other. Default value is 13/21') slowma2 = input.int(34, 'TSI slowest', minval=1, tooltip='TSI uses 2 moving averages compared with each other. Default value is 21/34') stoch = input.int(55, 'stoch K length & Macro length 1', minval=1, tooltip='TSI uses 2 moving averages compared with each other. Default value is 34/55') slowma3 = input.int(89, 'Macro length 2', minval=1, tooltip='TSI uses 2 moving averages compared with each other. Default value is 55/89') slowma4 = input.int(144, 'Macro length 3', minval=1, tooltip='TSI uses 2 moving averages compared with each other. Default value is 89/144') slowma5 = input.int(233, 'Macro length 4', minval=1, tooltip='TSI uses 2 moving averages compared with each other. Default value is 144/233') slowma6 = input.int(377, 'Macro length 5', minval=1, tooltip='TSI uses 2 moving averages compared with each other. Default value is 233/377') all = input.int(1, 'All rising / falling', minval=1, tooltip='Total average TSI of all rising or falling length bars ago') // ma1a = ta.tsi(src, tsia, tsi) ma1 = ta.tsi(src, tsi, fastma) ma2 = ta.tsi(src, fastma, midma) ma3 = ta.tsi(src, midma, slowma) ma4 = ta.tsi(src, slowma, slowma2) // ma5 = ta.tsi(src, slowma2, stoch) ma6 = ta.tsi(src, stoch, slowma3) ma7 = ta.tsi(src, slowma3, slowma4) ma8 = ta.tsi(src, slowma4, slowma5) ma9 = ta.tsi(src, slowma5, slowma6) // maa = ta.sma(ta.stoch(ma1a, ma1a, ma1a, stoch), ma) ma1b = ta.sma(ta.stoch(ma1, ma1, ma1, stoch), ma) ma2b = ta.sma(ta.stoch(ma2, ma2, ma2, stoch), ma) ma3b = ta.sma(ta.stoch(ma3, ma3, ma3, stoch), ma) ma4b = ta.sma(ta.stoch(ma4, ma4, ma4, stoch), ma) // ma5b = ta.sma(ta.stoch(ma5, ma5, ma5, stoch), ma) ma6b = ta.sma(ta.stoch(ma6, ma6, ma6, stoch), ma) ma7b = ta.sma(ta.stoch(ma7, ma7, ma7, stoch), ma) ma8b = ta.sma(ta.stoch(ma8, ma8, ma8, stoch), ma) ma9b = ta.sma(ta.stoch(ma9, ma9, ma9, stoch), ma) // total = (maa + ma1b + ma2b + ma3b + ma4b)/5 total2 = (ma5b + ma6b + ma7b + ma8b + ma9b)/5 tot = (total + total2)/2 // up = #3cfe12 up2 = #4e8642 down2 = #8c2121 down = #ff0202 dir = (total[all] < total ? up : down) dir2 = (total>=50 ? (total[1] < total ? up : up2) : (total[1] < total ? down2 : down)) // plot(maa, 'TSI Fastest', color=color.new(#ffffff, 0), linewidth=2) plot(ma1b, 'TSI Fast', color=color.new(#eaff00, 0))//), display=display.none) plot(ma2b, 'TSI Mid', color=color.new(#ff7700, 0))//, display=display.none) plot(ma3b, 'TSI Slow', color=color.new(#8d0eee, 0))//, display=display.none) plot(ma4b, 'TSI Slowest', color=color.new(#008eff, 0), linewidth=2) plot(total, 'All lower TSI', color=color.new((total>=50 ? (total[1] < total ? #3cfe12 : #4e8642) : (total[1] < total ? #8c2121 : #ff0202)), 70), linewidth=4, style=plot.style_area, histbase=50) // plot(ma5b, 'TSI Macro1', color=color.new(#ffffff, 0), linewidth=2, display=display.none) plot(ma6b, 'TSI Macro2', color=color.new(#eaff00, 0), display=display.none) plot(ma7b, 'TSI Macro3', color=color.new(#008eff, 0), display=display.none) plot(ma8b, 'TSI Macro4', color=color.new(#8d0eee, 0), display=display.none) plot(ma9b, 'TSI Macro5', color=color.new(#ff7700, 0), linewidth=2, display=display.none) plot(total2, 'All macro TSI', color=color.new((total>=50 ? (total[1] < total ? #3cfe12 : #4e8642) : (total[1] < total ? #8c2121 : #ff0202)), 70), linewidth=4, style=plot.style_area, histbase=50, display=display.none) plot(tot, 'All TSI', color=color.new(#ffffff, 0), histbase=50)//color=color.new(dir2, 70), linewidth=4, style=plot.style_area, histbase=50, display=display.none) // ArrowUp = ta.crossover(total, 1) or ta.crossover(total, 2) or ta.crossover(total, 3) or ta.crossover(total, 4) or ta.crossover(total, 5) or ta.crossover(total, 6) or ta.crossover(total, 7) or ta.crossover(total, 8) or ta.crossover(total, 9) plotshape(ArrowUp, title='long', style=shape.triangleup, location=location.bottom, color=(#3cfe12), size=size.small) ArrowUp2 = ta.crossover(maa, 5) or ta.crossover(maa, 10) or ta.crossover(maa, 15) or ta.crossover(maa, 20) or ta.crossover(maa, 25)// or ta.crossover(total, 40) or ta.crossover(total, 50) or ta.crossover(total, 60) or ta.crossover(total, 70) or ta.crossover(total, 80) or ta.crossover(total, 90) plotshape(ArrowUp2, title='crossover', style=shape.triangleup, location=location.bottom, color=(#3cfe12), size=size.tiny)//, display=display.none) au = ta.rising(tot, 1) plotchar(au, title='bullish', char=".", location=location.bottom, color=(#3cfe12), size=size.tiny)//, display=display.none) ArrowDown = ta.crossunder(total, 99) or ta.crossunder(total, 98) or ta.crossunder(total, 97) or ta.crossunder(total, 96) or ta.crossunder(total, 95) or ta.crossunder(total, 94) or ta.crossunder(total, 93) or ta.crossunder(total, 92) or ta.crossunder(total, 91) plotshape(ArrowDown, title='short', style=shape.triangledown, location=location.bottom, color=(#ff0202), size=size.small) ArrowDown2 = ta.crossunder(maa, 95) or ta.crossunder(maa, 90) or ta.crossunder(maa, 85) or ta.crossunder(maa, 80) or ta.crossunder(maa, 75)// or ta.crossunder(total, 60) or ta.crossunder(total, 50) or ta.crossunder(total, 40) or ta.crossunder(total, 30) or ta.crossunder(total, 20) or ta.crossunder(total, 10) plotshape(ArrowDown2, title='crossunder', style=shape.triangledown, location=location.bottom, color=(#ff0202), size=size.tiny)//, display=display.none) ad = ta.falling(tot, 1) plotchar(ad, title='bearish', char=".", location=location.bottom, color=(#ff0202), size=size.tiny)//, display=display.none) // ArrowUp3 = ta.cross(tot, 1) or ta.crossover(tot, 2) or ta.crossover(tot, 3) or ta.crossover(tot, 4) or ta.crossover(tot, 5) or ta.crossover(tot, 6) or ta.crossover(tot, 7) or ta.crossover(tot, 8) or ta.crossover(tot, 9) plotshape(ArrowUp3, title='superlong', style=shape.triangleup, location=location.bottom, color=(#3cfe12), size=size.normal) ArrowDown3 = ta.cross(tot, 99) or ta.crossunder(tot, 98) or ta.crossunder(tot, 97) or ta.crossunder(tot, 96) or ta.crossunder(tot, 95) or ta.crossunder(tot, 94) or ta.crossunder(tot, 93) or ta.crossunder(tot, 92) or ta.crossunder(tot, 91) plotshape(ArrowDown3, title='supershort', style=shape.triangledown, location=location.bottom, color=(#ff0202), size=size.normal) // h0 = hline(100, 'top', color=#989595, linestyle=hline.style_dotted) h1 = hline(75, '75', color=#989595, linestyle=hline.style_dotted) h2 = hline(50, '50', color=#989595, linestyle=hline.style_dashed) h3 = hline(25, '25', color=#989595, linestyle=hline.style_dotted) h4 = hline(0, '0', color=#989595, linestyle=hline.style_dotted)
columns
https://www.tradingview.com/script/a2K0wzx9-columns/
kaigouthro
https://www.tradingview.com/u/kaigouthro/
11
library
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉkaigouthro // @version=5 // @description Whole Column Matrix Setter/Getter Operations library("columns",true) // Helpers for NA vals (prevents errors on reads later on) // Helpers for NA vals (prevents errors on reads later on) nafill(a)=> x = a.get(0), x := na _add( m, _t , f) => i = _t == 'r' ? m.rows() : m.columns() while i < f switch _t 'c' => m.add_col() 'r' => m.add_row() i += 1 // THANK @moebius1977 for finding bug. _resize(a,sz) => naItem = nafill(a) while a.size ( ) < sz a.concat(array.from(naItem)) a // functionality non-overloaded, mini-ish //@function : Deletes a column _delcol ( m, n ) =>m.remove_col ( n) //@function Resizes an array so it matches the size of the matrix columns _grow ( m , a ) => msz=m.rows( ), _resize ( a, msz), _add(m, 'c', msz), a //@function Returns a specific column from the matrix _col ( m, n ) =>m.col ( n) //@function Replaces a column in the matrix with a new one _replr ( m, n,a ) =>_a=_grow ( m , a ), _r=m.col( n ), m.remove_col ( n ), m.add_col ( n,_a ), _r //@function Sets a column in the matrix with a new one _colset ( m, n,a ) =>_a=_grow ( m , a ), _replr ( m, n,_a) //@function Pushes an item onto the end of a specific column _cpush ( m, i,n ) =>a=m.col ( n ), v= a.shift (), a.push ( i ), _replr ( m,n,a ), v //@function Unshifts an item onto the start of a specific column _cunshift ( m, i,n ) =>a=m.col ( n ), a.unshift ( i ), v= a.pop (), _replr ( m,n,a ), v //@function Pushes an array onto the end of the matrix _acpush ( m , a ) =>_a =_grow ( m , a ), m.add_col (m.rows(),_a) //@function Unshifts an array onto the start of the matrix _acunshift ( m , a ) =>_a=_grow ( m , a ), m.add_col ( 0,_a) //@function Inserts an array at a specific column in the matrix _acins ( m, n,a ) =>_a=_grow ( m , a ), m.add_col ( n,_a) //@function Pulls out and removes a specific column from the matrix _acpull ( m, n ) =>col=m.col ( n ), _delcol (m,n ), col //@function Pops off the last column from the matrix _acpop ( m ) => sz=m.columns()-1, col=m.col ( sz ), _delcol ( m,sz ), col //@function Shifts off the first column from the matrix _acshift ( m ) =>col=m.col ( 0 ), _delcol (m, 0 ), col //@function Sorts the columns of the matrix by the Nth value from each column _sort_by (m,id) => // create a copy buffer first _temp = m.copy() for [i,idx] in id _new = _temp.col(idx) _colset(m, i,_new) m // functions //@function -> pop last Column off of matrix //@param _matrix Matrix To Edit //@returns Array of Last Column, removing it from matrix export method pop ( matrix<bool> _matrix ) => _acpop ( _matrix ) export method pop ( matrix<box> _matrix ) => _acpop ( _matrix ) export method pop ( matrix<color> _matrix ) => _acpop ( _matrix ) export method pop ( matrix<float> _matrix ) => _acpop ( _matrix ) export method pop ( matrix<int> _matrix ) => _acpop ( _matrix ) export method pop ( matrix<label> _matrix ) => _acpop ( _matrix ) export method pop ( matrix<line> _matrix ) => _acpop ( _matrix ) export method pop ( matrix<linefill> _matrix ) => _acpop ( _matrix ) export method pop ( matrix<string> _matrix ) => _acpop ( _matrix ) export method pop ( matrix<table> _matrix ) => _acpop ( _matrix ) //@function -> shift first Column off of matrix //@param _matrix Matrix To Edit //@returns Array of First Column, removing it from matrix export method shift ( matrix<bool> _matrix ) => _acshift ( _matrix ) export method shift ( matrix<box> _matrix ) => _acshift ( _matrix ) export method shift ( matrix<color> _matrix ) => _acshift ( _matrix ) export method shift ( matrix<float> _matrix ) => _acshift ( _matrix ) export method shift ( matrix<int> _matrix ) => _acshift ( _matrix ) export method shift ( matrix<label> _matrix ) => _acshift ( _matrix ) export method shift ( matrix<line> _matrix ) => _acshift ( _matrix ) export method shift ( matrix<linefill> _matrix ) => _acshift ( _matrix ) export method shift ( matrix<string> _matrix ) => _acshift ( _matrix ) export method shift ( matrix<table> _matrix ) => _acshift ( _matrix ) //@function -> get specific Column of matrix //@param _matrix Matrix To Edit //@param _clmnNum Column being Targeted //@returns Array of selected Column number, leaving in place export method get ( matrix<bool> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) export method get ( matrix<box> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) export method get ( matrix<color> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) export method get ( matrix<float> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) export method get ( matrix<int> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) export method get ( matrix<label> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) export method get ( matrix<line> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) export method get ( matrix<linefill> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) export method get ( matrix<string> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) export method get ( matrix<table> _matrix , int _clmnNum ) => matrix.col ( _matrix , _clmnNum ) //@function -> push single item onto end of Column //@param _matrix Matrix To Edit //@param _clmnNum Column being Targeted //@param _item Item to Push on Column //@returns shifted item from Column start export method push ( matrix<bool> _matrix , int _clmnNum , bool _item ) => _cpush ( _matrix , _item , _clmnNum ) export method push ( matrix<box> _matrix , int _clmnNum , box _item ) => _cpush ( _matrix , _item , _clmnNum ) export method push ( matrix<color> _matrix , int _clmnNum , color _item ) => _cpush ( _matrix , _item , _clmnNum ) export method push ( matrix<float> _matrix , int _clmnNum , float _item ) => _cpush ( _matrix , _item , _clmnNum ) export method push ( matrix<int> _matrix , int _clmnNum , int _item ) => _cpush ( _matrix , _item , _clmnNum ) export method push ( matrix<label> _matrix , int _clmnNum , label _item ) => _cpush ( _matrix , _item , _clmnNum ) export method push ( matrix<line> _matrix , int _clmnNum , line _item ) => _cpush ( _matrix , _item , _clmnNum ) export method push ( matrix<linefill> _matrix , int _clmnNum , linefill _item ) => _cpush ( _matrix , _item , _clmnNum ) export method push ( matrix<string> _matrix , int _clmnNum , string _item ) => _cpush ( _matrix , _item , _clmnNum ) export method push ( matrix<table> _matrix , int _clmnNum , table _item ) => _cpush ( _matrix , _item , _clmnNum ) //@function -> unshiftsingle item into start of Column //@param _matrix Matrix To Edit //@param _clmnNum Column being Targeted //@param _item Item to Unshift on Column //@returns popped item from Column end export method unshift ( matrix<bool> _matrix , int _clmnNum , bool _item ) => _cunshift( _matrix , _item , _clmnNum ) export method unshift ( matrix<box> _matrix , int _clmnNum , box _item ) => _cunshift( _matrix , _item , _clmnNum ) export method unshift ( matrix<color> _matrix , int _clmnNum , color _item ) => _cunshift( _matrix , _item , _clmnNum ) export method unshift ( matrix<float> _matrix , int _clmnNum , float _item ) => _cunshift( _matrix , _item , _clmnNum ) export method unshift ( matrix<int> _matrix , int _clmnNum , int _item ) => _cunshift( _matrix , _item , _clmnNum ) export method unshift ( matrix<label> _matrix , int _clmnNum , label _item ) => _cunshift( _matrix , _item , _clmnNum ) export method unshift ( matrix<line> _matrix , int _clmnNum , line _item ) => _cunshift( _matrix , _item , _clmnNum ) export method unshift ( matrix<linefill> _matrix , int _clmnNum , linefill _item ) => _cunshift( _matrix , _item , _clmnNum ) export method unshift ( matrix<string> _matrix , int _clmnNum , string _item ) => _cunshift( _matrix , _item , _clmnNum ) export method unshift ( matrix<table> _matrix , int _clmnNum , table _item ) => _cunshift( _matrix , _item , _clmnNum ) //@function -> set/replace an array to an existing Column //@param _matrix Matrix To Edit //@param _clmnNum Column being Targeted //@param _arr Array to place in Matrix //@returns Column that was replaced export method set ( matrix<bool> _matrix , int _clmnNum , array<bool> _array ) => _colset ( _matrix , _clmnNum , _array ) export method set ( matrix<box> _matrix , int _clmnNum , array<box> _array ) => _colset ( _matrix , _clmnNum , _array ) export method set ( matrix<color> _matrix , int _clmnNum , array<color> _array ) => _colset ( _matrix , _clmnNum , _array ) export method set ( matrix<float> _matrix , int _clmnNum , array<float> _array ) => _colset ( _matrix , _clmnNum , _array ) export method set ( matrix<int> _matrix , int _clmnNum , array<int> _array ) => _colset ( _matrix , _clmnNum , _array ) export method set ( matrix<label> _matrix , int _clmnNum , array<label> _array ) => _colset ( _matrix , _clmnNum , _array ) export method set ( matrix<line> _matrix , int _clmnNum , array<line> _array ) => _colset ( _matrix , _clmnNum , _array ) export method set ( matrix<linefill> _matrix , int _clmnNum , array<linefill> _array ) => _colset ( _matrix , _clmnNum , _array ) export method set ( matrix<string> _matrix , int _clmnNum , array<string> _array ) => _colset ( _matrix , _clmnNum , _array ) export method set ( matrix<table> _matrix , int _clmnNum , array<table> _array ) => _colset ( _matrix , _clmnNum , _array ) //@function -> insert an array to _arr new Column //@param _matrix Matrix To Edit //@param _clmnNum Column being Targeted //@param _arr Array to place in Matrix //@returns void export method insert ( matrix<bool> _matrix , int _clmnNum , array<bool> _array ) => _acins ( _matrix , _clmnNum , _array ) export method insert ( matrix<box> _matrix , int _clmnNum , array<box> _array ) => _acins ( _matrix , _clmnNum , _array ) export method insert ( matrix<color> _matrix , int _clmnNum , array<color> _array ) => _acins ( _matrix , _clmnNum , _array ) export method insert ( matrix<float> _matrix , int _clmnNum , array<float> _array ) => _acins ( _matrix , _clmnNum , _array ) export method insert ( matrix<int> _matrix , int _clmnNum , array<int> _array ) => _acins ( _matrix , _clmnNum , _array ) export method insert ( matrix<label> _matrix , int _clmnNum , array<label> _array ) => _acins ( _matrix , _clmnNum , _array ) export method insert ( matrix<line> _matrix , int _clmnNum , array<line> _array ) => _acins ( _matrix , _clmnNum , _array ) export method insert ( matrix<linefill> _matrix , int _clmnNum , array<linefill> _array ) => _acins ( _matrix , _clmnNum , _array ) export method insert ( matrix<string> _matrix , int _clmnNum , array<string> _array ) => _acins ( _matrix , _clmnNum , _array ) export method insert ( matrix<table> _matrix , int _clmnNum , array<table> _array ) => _acins ( _matrix , _clmnNum , _array ) //@function -> unshift _arr Column into matrix //@param _matrix Matrix To Edit //@param _arr Array to place in Matrix //@returns void export method unshift ( matrix<bool> _matrix , array<bool> _array ) => _acunshift ( _matrix , _array ) export method unshift ( matrix<box> _matrix , array<box> _array ) => _acunshift ( _matrix , _array ) export method unshift ( matrix<color> _matrix , array<color> _array ) => _acunshift ( _matrix , _array ) export method unshift ( matrix<float> _matrix , array<float> _array ) => _acunshift ( _matrix , _array ) export method unshift ( matrix<int> _matrix , array<int> _array ) => _acunshift ( _matrix , _array ) export method unshift ( matrix<label> _matrix , array<label> _array ) => _acunshift ( _matrix , _array ) export method unshift ( matrix<line> _matrix , array<line> _array ) => _acunshift ( _matrix , _array ) export method unshift ( matrix<linefill> _matrix , array<linefill> _array ) => _acunshift ( _matrix , _array ) export method unshift ( matrix<string> _matrix , array<string> _array ) => _acunshift ( _matrix , _array ) export method unshift ( matrix<table> _matrix , array<table> _array ) => _acunshift ( _matrix , _array ) //@function -> push array Column onto matrix end //@param _matrix Matrix To Edit //@param _arr Array to place in Matrix //@returns void export method push ( matrix<bool> _matrix , array<bool> _array ) => _acpush ( _matrix , _array ) export method push ( matrix<box> _matrix , array<box> _array ) => _acpush ( _matrix , _array ) export method push ( matrix<color> _matrix , array<color> _array ) => _acpush ( _matrix , _array ) export method push ( matrix<float> _matrix , array<float> _array ) => _acpush ( _matrix , _array ) export method push ( matrix<int> _matrix , array<int> _array ) => _acpush ( _matrix , _array ) export method push ( matrix<label> _matrix , array<label> _array ) => _acpush ( _matrix , _array ) export method push ( matrix<line> _matrix , array<line> _array ) => _acpush ( _matrix , _array ) export method push ( matrix<linefill> _matrix , array<linefill> _array ) => _acpush ( _matrix , _array ) export method push ( matrix<string> _matrix , array<string> _array ) => _acpush ( _matrix , _array ) export method push ( matrix<table> _matrix , array<table> _array ) => _acpush ( _matrix , _array ) //@function -> slideDown add an array to top and remove/return firrst Column //@param _matrix Matrix To Edit //@param _arr Array to place in Matrix //@returns first Column which has been shifted out export method slideDown ( matrix<bool> _matrix , array <bool> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) export method slideDown ( matrix<box> _matrix , array <box> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) export method slideDown ( matrix<color> _matrix , array <color> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) export method slideDown ( matrix<float> _matrix , array <float> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) export method slideDown ( matrix<int> _matrix , array <int> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) export method slideDown ( matrix<label> _matrix , array <label> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) export method slideDown ( matrix<line> _matrix , array <line> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) export method slideDown ( matrix<linefill> _matrix , array <linefill> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) export method slideDown ( matrix<string> _matrix , array <string> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) export method slideDown ( matrix<table> _matrix , array <table> _array ) => _acpush ( _matrix , _array ) , _acshift ( _matrix ) //@function -> slideUp add an array to first Column and remove/return the last Column //@param _matrix Matrix To Edit //@param _arr Array to place in Matrix //@returns last Column which has been popped off of the top export method slideUp ( matrix<bool> _matrix , array <bool> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) export method slideUp ( matrix<box> _matrix , array <box> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) export method slideUp ( matrix<color> _matrix , array <color> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) export method slideUp ( matrix<float> _matrix , array <float> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) export method slideUp ( matrix<int> _matrix , array <int> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) export method slideUp ( matrix<label> _matrix , array <label> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) export method slideUp ( matrix<line> _matrix , array <line> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) export method slideUp ( matrix<linefill> _matrix , array <linefill> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) export method slideUp ( matrix<string> _matrix , array <string> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) export method slideUp ( matrix<table> _matrix , array <table> _array ) => _acunshift ( _matrix , _array ) , _acpop ( _matrix ) //@function -> pullOut pull out and remove _arr specific Column //@param _matrix Matrix To Edit //@param _clmnNum Column being Targeted //@returns Column which has been removed export method pullOut ( matrix<bool> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) export method pullOut ( matrix<box> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) export method pullOut ( matrix<color> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) export method pullOut ( matrix<float> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) export method pullOut ( matrix<int> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) export method pullOut ( matrix<label> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) export method pullOut ( matrix<line> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) export method pullOut ( matrix<linefill> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) export method pullOut ( matrix<string> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) export method pullOut ( matrix<table> _matrix , int _clmnNum ) => _acpull ( _matrix , _clmnNum ) //@function -> sortby Sort by indiced Array //@param _matrix Matrix To Edit //@param _clmnNum Column being Targeted //@returns Column which has been removed export method sortby ( matrix<bool> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<box> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<color> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<float> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<int> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<label> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<line> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<linefill> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<string> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) export method sortby ( matrix<table> _matrix , int[] _indices ) => _sort_by ( _matrix , _indices ) //@unction -> sort_by Sorts the columns by the Nth row values //@param _matrix Matrix To Sort //@param _rowNum Row to utilize for sorting //@returns sorted matrix export method sortby ( matrix<float> _matrix , int _rowNum ) => // create a copy buffer first _temp = _matrix.copy() sI = _matrix.row(_rowNum).sort_indices() _sort_by(_matrix, sI) //@unction -> sort_by Sorts the columns by the Nth row values //@param _matrix Matrix To Sort //@param _rowNum Row to utilize for sorting //@returns sorted matrix export method sortby ( matrix<int> _matrix , int _rowNum ) => // create a copy buffer first _temp = _matrix.copy() sI = _matrix.row(_rowNum).sort_indices() _sort_by(_matrix, sI) // // TEST ALL FUNCTIONS before and after display // test(_matrix,_arr,_item ) => // _st = '' // _m = _matrix // _a = _arr // _x = _item // push ( _m , _arr ) // push ( _m , _arr ) // unshift ( _m , _arr ) // unshift ( _m , _arr ) // _a := get ( _m , 3 ) // _a := pop ( _m ) // _a := shift ( _m ) // _x := push ( _m , 2 , _item ) // _x := push ( _m , 2 , _item ) // _x := push ( _m , 2 , _item ) // _x := unshift ( _m , 10 , _item ) // _x := unshift ( _m , 10 , _item ) // _x := unshift ( _m , 10 , _item ) // insert ( _m , 7 , _a ) // set ( _m , 3 , _a ) // _a := slideDown ( _m , _arr ) // _a := slideUp ( _m , _arr ) // _a := pullOut ( _m , 3 ) // varip matrix<string> _string = matrix.new<string> (10 , 10,'m' ) // varip array<string> _stringa = array.new<string> (6 , 'a' ) // varip matrix<float> _float = matrix.new<float> (10 , 10, 100 ) // varip array<float> _floata = array.new<float> (8 , 100 ) // var matrix<color> _col = matrix.new<color> (10 , 10, #333333 ) // var array<color> _cola = array.new<color> (5 , #ffffff ) // if barstate.islastconfirmedhistory // for k = 0 to _float.rows() - 1 // for [i,n] in _float.row(k) // if k * i > 0 // _float.set(i,k, i + k) // _col.set (k,i, color.hsv(k*15 + k*2,1,1,1)) // else // _float.set(i,k, math.max(k,i)) // _float.set(k,i, math.max(k,i)) // mtb.matrixtable(_float,_string, _col, _textSize = 3, tableXpos = 'left', tableYpos = 'top') // test(_float,_floata, 999. ) // // _float.sortby(0) // test(_string,_stringa , "solo" ) // test(_col,_cola , #0000ff ) // _float := _float.transpose() // _string := _string.transpose() // _col := _col.transpose() // mtb.matrixtable(_float,_string, _col, _textSize = 3, _defaultbg = #ffffff, tableXpos = 'right', tableYpos = 'top') // import kaigouthro/matrixautotable/14 as mtb // import kaigouthro/hsvColor/15 as color
VWMA/SMA Delta Volatility (Statistical Anomaly Detector)
https://www.tradingview.com/script/Ytt6Fo6M-VWMA-SMA-Delta-Volatility-Statistical-Anomaly-Detector/
tkarolak
https://www.tradingview.com/u/tkarolak/
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/ // ยฉ tkarolak //@version=5 // ==================== // ==== Background ==== // ==================== // This indicator detects and visualizes market volatility by // analyzing the difference between VWMA and SMA to spot price anomalies. // Calculation involves statistical analysis, including standard deviation and Z-score. // Visualize results through histograms and a Z-score channel. // Red hisogram bars indicate negative, green bars positive, and silver bars normal values. // Utilize this tool to detect abnormal price movements and adapt trading strategies. // Enhance market analysis during periods of increased volatility. // Spot potential market anomalies and make informed trading decisions. // A valuable addition to your trading toolkit for better risk management. // MA Delta above 0 may signal a bullish reversal, // while crossing below 0 suggests a bearish sentiment reversal. // Use in conjunction with other analysis methods for better results. indicator("VWMA/SMA Delta Volatility (Statistical Anomaly Detector)", "MAs Delta Volatility (SAD)", overlay = false, precision = 2) type SettingsSad float source int lenght int sampleSize float zScore bool showChannel // Tooltips string ttSourceSad = "Source for MAs delta calculations" string ttLenghtSad = "MAs length" string ttSampleSizeSad = "Dataset length for statistical computations in deriving a normal distribution, used to identify data points (MA delta), meeting criteria exceeding the standard deviation multiplied by the Z-score coefficient" string ttZscoreSad = "The Z-scores multiplier serves as a filtering mechanism, providing insight into the extent to which a data point (MA delta) deviates from the mean in terms of standard deviations." string ttHistogramSad = "Displays a Z-score channel, acting as filter" string gSad = "Statistical Anomaly Detector" SettingsSad settingsSad = SettingsSad.new( input.source (close, "Source", group=gSad, tooltip = ttSourceSad), input.int (14, "MAs Length", group=gSad, minval = 3, tooltip = ttLenghtSad), input.int (100, "Statistical sample size", group=gSad, step = 1, minval = 100, maxval = 500, tooltip = ttSampleSizeSad), input.float (2.0, "Z-score", group=gSad, step = 0.1, minval = 1.0, maxval = 3.0, tooltip = ttZscoreSad), input.bool (true, "Z-score channel", group=gSad, tooltip=ttHistogramSad) ) // Functions // Normalization function calcNormalized(series float _src, float _additional1, float _additional2, int _len, float _scaleMin, float _scaleMax) => float _srcLowest = 10e10 float _srcHigest = -10e10 _srcLowest := math.min(nz(ta.lowest(_src, _len)),_srcLowest) _srcHigest := math.max(nz(ta.highest(_src, _len)),_srcHigest) float _scaleRange = _scaleMax - _scaleMin float _normalized = _scaleMin + _scaleRange * (_src - _srcLowest) / math.max(_srcHigest - _srcLowest, 10e-10) float _normalized_add1 = _scaleMin + _scaleRange * (_additional1 - _srcLowest) / math.max(_srcHigest - _srcLowest, 10e-10) float _normalized_add2 = _scaleMin + _scaleRange * (_additional2 - _srcLowest) / math.max(_srcHigest - _srcLowest, 10e-10) [_normalized, _normalized_add1, _normalized_add2] // Calculate moving average delta (MA Delta), MA, standard deviation, and filters sadDelta = ta.vwma(settingsSad.source, settingsSad.lenght)-ta.sma(settingsSad.source, settingsSad.lenght) sadMa = ta.sma(sadDelta, settingsSad.sampleSize) sadStdDev = ta.stdev(sadDelta, settingsSad.sampleSize) sadLowerFilter = sadMa - settingsSad.zScore * sadStdDev sadUpperFilter = sadMa + settingsSad.zScore * sadStdDev // Normalization taking place here [normalizedDelta, normalizedlowerFilter, normalizedupperFilter] = calcNormalized(sadDelta, sadLowerFilter, sadUpperFilter, settingsSad.sampleSize, -100, 100) // Plots colorDelta = sadDelta < 0 and sadDelta < sadLowerFilter ? color.red : sadDelta > 0 and sadDelta > sadUpperFilter ? color.green : color.new(color.silver, 80) hline(0, "Base Line", color.new(color.orange, 50), hline.style_dotted) plot(normalizedDelta, "Delta", color=colorDelta, style=plot.style_histogram) plot(settingsSad.showChannel ? normalizedlowerFilter : na, color=color.new(color.gray, 70), display = display.pane) plot(settingsSad.showChannel ? normalizedupperFilter : na, color=color.new(color.gray, 70), display = display.pane) //easy peasy
Composite Momentum Indicator
https://www.tradingview.com/script/4I3G9j26-Composite-Momentum-Indicator/
federalTacos5392b
https://www.tradingview.com/u/federalTacos5392b/
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/ // ยฉ federalTacos5392 //@version=5 indicator("Composite Momentum Oscillator", overlay=false) // Input parameters lookback_period = input.int(500, title="Look-back Period") overbought_threshold=input(1.2, title= "Overbought Threshold") oversold_threshold=input(-1.2, title= "Oversold Threshold") // selection of osscilators include_stochastic = input.bool(true, title="Include Stochastic Z-Score") include_rsi = input.bool(true, title="Include RSI Z-Score") include_uo = input.bool(true, title="Include Ultimate Oscillator Z-Score") include_cci = input.bool(true, title="Include CCI Z-Score") include_co = input.bool(true, title="Include Chaikin Oscillator Z-Score") include_mfi =input.bool(true, title="Include Money Flow Index Z-Score") include_kri =input.bool(true, title="Include Kairi Relative Index Z-Score") include_wpr=input.bool(true,title="Include Williams % R") include_ao=input.bool(true,title= "Awesome Oscillator") // Custom Lengths SOL=input(14, title="Stochastic length" ) MFIL=input(14, title="Money Flow Index Length") RSIL=input(14, title="RSI Length") UOL1= input(7, title= "Ultimate Oscilator Length1") UOL2= input(14, title= "Ultimate Oscilator Length2") UOL3= input(28, title= "Ultimate Oscilator Length3" ) CCIL=input(20, title="Comodity Channel Inedx Length") COL1=input(3, title="Chinkin Oscilator fast Length") COL2=input(10, title="Chinkin Oscilator slow Length") KRIL=input(14, title="Kairi Relative Index Length" ) WPRL=input(14,title= "Williams % R") AOL1=input(5, title="Awesome Oscilator fast Length") AOL2=input(34, title="Awesome Oscilator slow Length") // Calculate Stochastic Oscillator (Fast Line) stochastic_fast_k = ta.stoch(close, high, low, SOL) stochastic_fast_zscore = (stochastic_fast_k - ta.sma(stochastic_fast_k, lookback_period)) / ta.stdev(stochastic_fast_k, lookback_period) // Calculate Awesome Oscilator ao = ta.sma(hl2,AOL1) - ta.sma(hl2,AOL2) ao_zscore=(ao- ta.sma(ao, lookback_period)) / ta.stdev(ao, lookback_period) // Calculate Williams % R _pr(WPRL) => max = ta.highest(WPRL) min = ta.lowest(WPRL) 100 * (close - max) / (max - min) wpr = _pr(WPRL) wpr_zscore=(wpr- ta.sma(wpr, lookback_period)) / ta.stdev(wpr, lookback_period) // Calculate Money Flow Index mfi=ta.mfi(hlc3,MFIL) mfi_zscore=(mfi - ta.sma(mfi, lookback_period)) / ta.stdev(mfi, lookback_period) // Calculate RSI rsi = ta.rsi(close, RSIL) rsi_zscore = (rsi - ta.sma(rsi, lookback_period)) / ta.stdev(rsi, lookback_period) // Calculate KRI sma= ta.sma(close, KRIL) kri = (close-sma)/sma kri_zscore = (kri - ta.sma(kri, lookback_period)) / ta.stdev(kri, lookback_period) // Custom Ultimate Oscillator Calculation length1 = UOL1 length2 = UOL2 length3 = UOL3 average(bp, tr_, length) => ta.sma(bp, length) / ta.sma(tr_, length) high_ = ta.highest(high, 2) low_ = ta.lowest(low, 2) bp = close - low_ tr_ = high_ - low_ avg7 = average(bp, tr_, length1) avg14 = average(bp, tr_, length2) avg28 = average(bp, tr_, length3) uo = 100 * (4 * avg7 + 2 * avg14 + avg28) / 7 uo_zscore = (uo - ta.sma(uo, lookback_period)) / ta.stdev(uo, lookback_period) // Calculate Commodity Channel Index (CCI) cci = ta.cci(close, CCIL) cci_zscore = (cci - ta.sma(cci, lookback_period)) / ta.stdev(cci, lookback_period) // calculate chaikin oscilator (CO) var cumVol = 0. cumVol += nz(volume) if barstate.islast and cumVol == 0 runtime.error("No volume is provided by the data vendor.") co = ta.ema(ta.accdist, COL1) - ta.ema(ta.accdist, COL2) co_zscore = (co - ta.sma(co, lookback_period))/ta.stdev(co, lookback_period) // Calculate the average z-score based on selected inputs z_scores = array.new_float(0) if include_stochastic array.push(z_scores, stochastic_fast_zscore) if include_rsi array.push(z_scores, rsi_zscore) if include_uo array.push(z_scores, uo_zscore) if include_cci array.push(z_scores, cci_zscore) if include_co array.push(z_scores,co_zscore) if include_mfi array.push(z_scores,mfi_zscore) if include_kri array.push(z_scores,kri_zscore) if include_wpr array.push(z_scores, wpr_zscore) if include_ao array.push(z_scores, ao_zscore) average_zscore = array.size(z_scores) > 0 ? array.avg(z_scores) : 0 // Define the color based on the Z-score average value colorCondition = average_zscore > overbought_threshold ? color.green : average_zscore < oversold_threshold ? color.red : color.blue sma_average_zscore = ta.sma(average_zscore,3) // Plot the composite momentum oscillator with the conditional color plot1 = plot(average_zscore, title="Composite Momentum Oscillator", color=colorCondition) plot (sma_average_zscore,color=color.black, title = "smoothed line") // Plot Lines at 0, 3, -3, 2, -2, 1, -1 hline(0, "Center Line", color=color.blue, linestyle=hline.style_solid) hline(3, "Upper 3", color=color.red, linestyle=hline.style_solid) hline(-3, "Lower -3", color=color.green, linestyle=hline.style_solid) hline(2, "Upper 2", color=color.red, linestyle=hline.style_dashed) hline(-2, "Lower -2", color=color.green, linestyle=hline.style_dashed) overbought = hline(1, "Upper 1", color=color.red, linestyle=hline.style_dotted) oversold = hline(-1, "Lower -1", color=color.green, linestyle=hline.style_dotted) midLinePlot = plot(0, color = na, editable = false, display = display.none) fill(plot1, midLinePlot, 3, overbought_threshold, top_color = color.new(color.green, 0), bottom_color = color.new(color.green, 100), title = "Overbought Gradient Fill") fill(plot1, midLinePlot, oversold_threshold, -3, top_color = color.new(color.red, 100), bottom_color = color.new(color.red, 0), title = "Oversold Gradient Fill")
Dynamic GANN Square Of 9 Bands
https://www.tradingview.com/script/toCyMkKA-Dynamic-GANN-Square-Of-9-Bands/
Arun_K_Bhaskar
https://www.tradingview.com/u/Arun_K_Bhaskar/
195
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ Arun_K_Bhaskar //@version=5 indicator(title='Dynamic GANN Square Of 9 Bands', shorttitle='Dynamic GANN', overlay=true, format=format.price) ////////////////////////////////////////////////////////////// Quick Menu gpQ = 'Quick Menu' // Increment // 0 / 360 = 0 // 45 / 360 = 0.125 // 90 / 360 = 0.25 // 135 / 360 = 0.375 // 180 / 360 = 0.5 // 225 / 360 = 0.625 // 270 / 360 = 0.75 // 315 / 360 = 0.875 // 360 / 360 = 1 ttI = 'Increment Values for Various Markets:\n\n' + 'For Intraday:\n\n' + 'India NSE BSE: 0.125 / 0.0625 / 0.03125\n' + 'NIFTY: 0.375, 0.25 / 0.125 / 0.0625\n' + 'BANKNIFTY: 0.375 / 0.25 / 0.125\n' + 'FINNIFTY: 0.25 / 0.125\n' + 'MIDCPNIFTY: 0.25 / 0.125\n\n' + 'USDINR: 0.0078125 / 0.00390625\n' + 'EURUSD: 0.001953125 / 0.0009765625\n\n' + 'BTCUSD: 0.125 / 0.0625\n' + 'ETHUSD: 0.03125 / 0.015625\n\n' + 'Note: The increment values are subjected to change over time & volatility' i_increment = input.string(defval='0.125', title='Incrementโ€ƒ' , options=['0.0009765625', '0.001953125', '0.00390625', '0.0078125', '0.015625', '0.03125', '0.0625', '0.125', '0.25', '0.375', '0.5', '0.625', '0.75', '0.875', '1'], tooltip=ttI, inline='01', group=gpQ) increment = i_increment == '0.0009765625' ? 0.0009765625 : i_increment == '0.001953125' ? 0.001953125 : i_increment == '0.00390625' ? 0.00390625 : i_increment == '0.0078125' ? 0.0078125 : i_increment == '0.015625' ? 0.015625 : i_increment == '0.03125' ? 0.03125 : i_increment == '0.0625' ? 0.0625 : i_increment == '0.125' ? 0.125 : i_increment == '0.25' ? 0.25 : i_increment == '0.375' ? 0.375 : i_increment == '0.5' ? 0.5 : i_increment == '0.625' ? 0.625 : i_increment == '0.75' ? 0.75 : i_increment == '0.875' ? 0.875 : 1 ////////////////////////////////////////////////////////////// Moving Average Menu gpMA = 'Moving Average' i_ma_type = input.string(defval="EMA", title='', options=["โ–ˆ EMA Based:", "EMA", "DEMA", "TEMA", "ETMA", "ZLEMA", "โ–ˆ SMA Based:", "SMA", "TMA", "SMMA (RMA)", "โ–ˆ Volume Based:", "VWMA", "MVWAP", "โ–ˆ Others:", "ALMA", "HMA", "LSMA", "WMA"], inline='1', group=gpMA) i_ma_length = input.int(defval=200, title="", inline='1', group=gpMA) i_ma_source = input.source(defval=close, title="", inline='1', group=gpMA) i_ma_timeframe = input.timeframe(defval='', title='', inline='1', group=gpMA) i_ma_color = input.color(defval=#00FF00, title="", inline='2', group=gpMA) i_offset = input.int(defval=0, minval=0, title='Offset', inline='2', group=gpMA) ////////////////////////////////////////////////////////////// Support & Resistance Menu gpG = "Support & Resistance" i_show_r_01 = input.bool(defval=true, title="R01", group=gpG, inline="R1") i_show_r_02 = input.bool(defval=true, title="R02", group=gpG, inline="R1") i_show_r_03 = input.bool(defval=true, title="R03", group=gpG, inline="R1") i_show_r_04 = input.bool(defval=true, title="R04", group=gpG, inline="R1") i_show_r_05 = input.bool(defval=true, title="R05", group=gpG, inline="R1") i_r_05_color = input.color(defval=#FF0000, title="", group=gpG, inline="R1") i_show_r_06 = input.bool(defval=false, title="R06", group=gpG, inline="R2") i_show_r_07 = input.bool(defval=false, title="R07", group=gpG, inline="R2") i_show_r_08 = input.bool(defval=false, title="R08", group=gpG, inline="R2") i_show_r_09 = input.bool(defval=false, title="R09", group=gpG, inline="R2") i_show_r_10 = input.bool(defval=false, title="R10", group=gpG, inline="R2") i_r_10_color = input.color(defval=#FF0000, title="", group=gpG, inline="R2") i_r_color = input.color(defval=#505050, title="", group=gpG, inline="R2") i_show_s_01 = input.bool(defval=true, title="S01", group=gpG, inline="S1") i_show_s_02 = input.bool(defval=true, title="S02", group=gpG, inline="S1") i_show_s_03 = input.bool(defval=true, title="S03", group=gpG, inline="S1") i_show_s_04 = input.bool(defval=true, title="S04", group=gpG, inline="S1") i_show_s_05 = input.bool(defval=true, title="S05", group=gpG, inline="S1") i_s_05_color = input.color(defval=#FF0000, title="", group=gpG, inline="S1") i_show_s_06 = input.bool(defval=false, title="S06", group=gpG, inline="S2") i_show_s_07 = input.bool(defval=false, title="S07", group=gpG, inline="S2") i_show_s_08 = input.bool(defval=false, title="S08", group=gpG, inline="S2") i_show_s_09 = input.bool(defval=false, title="S09", group=gpG, inline="S2") i_show_s_10 = input.bool(defval=false, title="S10", group=gpG, inline="S2") i_s_10_color = input.color(defval=#FF0000, title="", group=gpG, inline="S2") i_s_color = input.color(defval=#505050, title="", group=gpG, inline="S2") ////////////////////////////////////////////////////////////// Get OHLCV get_ohlcv(timeframe, source, prev_value) => request.security(symbol=syminfo.tickerid, timeframe=timeframe, expression=source[prev_value], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on) ////////////////////////////////////////////////////////////// Moving Average Calculation moving_average(source, length, ma_type, timeframe, prev_value) => float result = na float source_ohlcv = get_ohlcv(timeframe, source, prev_value) //Exponential Moving Average if ma_type == "EMA" result := ta.ema(source_ohlcv, length) //Double Exponential Moving Average if ma_type == "DEMA" result := 2 * (ta.ema(source_ohlcv, length)) - (ta.ema((ta.ema(source_ohlcv, length)), length)) result //Triple Exponential Moving Average if ma_type == "TEMA" result := 3 * ((ta.ema(source_ohlcv, length)) - (ta.ema((ta.ema(source_ohlcv, length)), length))) + ta.ema((ta.ema((ta.ema(source_ohlcv, length)), length)), length) result //Zero Lag Exponential Moving Average if ma_type == "ZLEMA" result := ta.ema(source_ohlcv + source_ohlcv - source_ohlcv[(length - 1) / 2], length) result //Simple Moving Average if ma_type == "SMA" result := ta.sma(source_ohlcv, length) result //Triangular Simple Moving Average if ma_type == "TMA" result := ta.sma(ta.sma(source_ohlcv, length), length) result //Smoothed Moving Average (SMMA) if ma_type == "SMMA (RMA)" result := ta.rma(source_ohlcv, length) result //Weighted Moving Average if ma_type == "WMA" result := ta.wma(source_ohlcv, length) result //Volume Weighted Moving Average if ma_type == "VWMA" result := ta.vwma(source_ohlcv, length) result // EMA VWAP if ma_type == "MVWAP" result := ta.ema(ta.vwap, length) result //Hull Moving Average if ma_type == "HMA" result := ta.hma(source_ohlcv, length) result //Arnaud Legoux Moving Average if ma_type == "ALMA" result := ta.alma(source_ohlcv, length, 0.85, 6) result //Triangular Exponential Moving Average if ma_type == "ETMA" result := ta.ema(ta.ema(source_ohlcv, length), length) result //Least Squares Moving Average if ma_type == "LSMA" result := ta.linreg(source_ohlcv, length, i_offset) result result // Get Moving Average ma = moving_average(i_ma_source, i_ma_length, i_ma_type, i_ma_timeframe, 0) ////////////////////////////////////////////////////////////// Dynamic Gann Square of 9 Calculation gann_square_of_9(price, multiplier) => upper = math.pow((math.sqrt(price) + (multiplier * increment)), 2) lower = math.pow((math.sqrt(price) - (multiplier * increment)), 2) [upper, lower] [r_01, s_01] = gann_square_of_9(ma, 1) [r_02, s_02] = gann_square_of_9(ma, 2) [r_03, s_03] = gann_square_of_9(ma, 3) [r_04, s_04] = gann_square_of_9(ma, 4) [r_05, s_05] = gann_square_of_9(ma, 5) [r_06, s_06] = gann_square_of_9(ma, 6) [r_07, s_07] = gann_square_of_9(ma, 7) [r_08, s_08] = gann_square_of_9(ma, 8) [r_09, s_09] = gann_square_of_9(ma, 9) [r_10, s_10] = gann_square_of_9(ma, 10) ////////////////////////////////////////////////////////////// Plot plot(series= ma, title='Moving Average', color=i_ma_color, offset=i_offset) plot(series=i_show_r_01 ? r_01 : na, title='R01', color=i_r_color, offset=i_offset) plot(series=i_show_r_02 ? r_02 : na, title='R02', color=i_r_color, offset=i_offset) plot(series=i_show_r_03 ? r_03 : na, title='R03', color=i_r_color, offset=i_offset) plot(series=i_show_r_04 ? r_04 : na, title='R04', color=i_r_color, offset=i_offset) plot(series=i_show_r_05 ? r_05 : na, title='R05', color=i_r_05_color, offset=i_offset) plot(series=i_show_r_06 ? r_06 : na, title='R06', color=i_r_color, offset=i_offset) plot(series=i_show_r_07 ? r_07 : na, title='R07', color=i_r_color, offset=i_offset) plot(series=i_show_r_08 ? r_08 : na, title='R08', color=i_r_color, offset=i_offset) plot(series=i_show_r_09 ? r_09 : na, title='R09', color=i_r_color, offset=i_offset) plot(series=i_show_r_10 ? r_10 : na, title='R10', color=i_r_10_color, offset=i_offset) plot(series=i_show_s_01 ? s_01 : na, title='S01', color=i_s_color, offset=i_offset) plot(series=i_show_s_02 ? s_02 : na, title='S02', color=i_s_color, offset=i_offset) plot(series=i_show_s_03 ? s_03 : na, title='S03', color=i_s_color, offset=i_offset) plot(series=i_show_s_04 ? s_04 : na, title='S04', color=i_s_color, offset=i_offset) plot(series=i_show_s_05 ? s_05 : na, title='S05', color=i_s_05_color, offset=i_offset) plot(series=i_show_s_06 ? s_06 : na, title='S06', color=i_s_color, offset=i_offset) plot(series=i_show_s_07 ? s_07 : na, title='S07', color=i_s_color, offset=i_offset) plot(series=i_show_s_08 ? s_08 : na, title='S08', color=i_s_color, offset=i_offset) plot(series=i_show_s_09 ? s_09 : na, title='S09', color=i_s_color, offset=i_offset) plot(series=i_show_s_10 ? s_10 : na, title='S10', color=i_s_10_color, offset=i_offset) //////////////////////////////////////////////////////////// CODE END
Price Strength Index + RSI Buy/Sell Zones
https://www.tradingview.com/script/zTRUboks-Price-Strength-Index-RSI-Buy-Sell-Zones/
tkarolak
https://www.tradingview.com/u/tkarolak/
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/ // ยฉ tkarolak //@version=5 // ==================== // ==== Background ==== // ==================== // This Indicator assesses the strength and direction of a financial asset's price trend // by comparing the current price to a range of Volume Weighted Moving Averages (VWMAs) // with varying lengths and subsequently calculates the percentage of prices above these VWMAs. // Insights: // 1. Price Trend Strength: The indicator calculates multiple VWMAs based on historical price // and volume data, allowing traders to assess the varying aspects of the price trend. // 2. Buy and Sell Zones: User-defined thresholds create buy and sell zones, indicating potential // entry and exit points. // 3. RSI Integration: RSI conditions further refine signals. When the Price Strength Index // falls within the buy zone and RSI is below the lower RSI threshold, it may signal a buy opportunity. // Conversely, when it falls within the sell zone and RSI is above the upper RSI threshold, // it may indicate a sell opportunity. // 4. Color Coding: The indicator employs color coding for visual clarity. // - PSI Index Line: The PSI Index line color is used to signify trends. Green denotes an uptrend, // indicating that the percentage of prices above VWMAs is increasing and the trend is strengthening. // Conversely, red signifies a downtrend, indicating a decrease in the percentage of prices above VWMAs // and a weakening trend. // - Background Color: The background color adapts based on PSI Index and RSI conditions. // Red indicates a potential buy zone and oversold territory, while green highlights a potential sell zone // and overbought territory. // - The middle horizontal orange line is used to mark the median and potential reversal points if crossed. indicator("Price Strength Index + RSI Buy/Sell Zones", "Price Strength + B/S Zones", overlay = false) // Custom types type SettingsPsi float source int quantity int lenght type SettingsRsi bool showInZones int upperRsi int lowerRsi // Price Strength Index settings string gPsi = "Price Strength Index (PS Index)" string ttSource = "Select the price source for VWMA and RSI calculations" string ttQuantityPsi = "Set the number of historical VWMA calculations" string ttLenghtPsi = "Specify the smoothing length for obtaining the Simple Moving Average of the Index" string ttUpperPsi = "Set the upper threshold for the Sell Zone (high percentage of prices above VWMA)" string ttLowerPsi = "Set the lower threshold for the Buy Zone (low percentage of prices above VWMA)." SettingsPsi settingsPsi = SettingsPsi.new( input.source (close, "Source", group = gPsi, tooltip = ttSource), input.int (400, "Quantity of MA", group = gPsi, tooltip = ttQuantityPsi), input.int (14, "Strength Index's SMA Lenght", group = gPsi, minval = 1, tooltip = ttLenghtPsi) ) settingsPsiUpperPsi = input.int(90, "Zone Sell", group = gPsi, minval = 50, maxval = 100, step = 1, tooltip = ttUpperPsi) settingsPsiLowerPsi = input.int(10, "Zone Buy", group = gPsi, minval = 0, maxval = 50, step = 1, tooltip = ttLowerPsi) // Relative Strength Index settings string gRsi = "RSI settings" string ttLenghtRsi = "Specify the length for calculating the Relative Strength Index (RSI)." string ttUpperRsi = "Set the upper threshold for the Overbought RSI." string ttLowerRsi = "Set the lower threshold for the Oversold RSI." settingsRsiLengthRsi = input.int(14,"RSI Length", group = gRsi, minval = 3, tooltip = ttLenghtRsi) SettingsRsi settingsRsi = SettingsRsi.new( input.bool (false, "Show extreem RSI in zones", group = gRsi), input.int (70, "Overbought (OB) RSI", group = gRsi, minval = 50, maxval = 100, tooltip = ttUpperRsi), input.int (30, "Oversold (OS) RSI", group = gRsi, minval = 0, maxval = 50, tooltip = ttLowerRsi) ) // Runtime error indicating the absence of volume data from the data vendor if barstate.islast and ta.cum(volume) == 0 runtime.error("No volume is provided by the data vendor.") // Calculate RSI float rsi = ta.rsi(settingsPsi.source, settingsRsiLengthRsi) int priceAboveVWMA = 0 float weights = 0.0 float sum = 0.0 for i = 0 to settingsPsi.quantity sum := sum + settingsPsi.source[i] * volume[i] weights := weights + volume[i] // Check if the current source value is above the weighted moving average if i > 0 and settingsPsi.source > sum / weights priceAboveVWMA := priceAboveVWMA + 1 // Calculate the percentage of prices above VWMA float psi = priceAboveVWMA / settingsPsi.quantity * 100 // Calculate Result's SMA float psiMa = ta.sma(psi, settingsPsi.lenght) //////////////////////////////////////////////////////////////////////////////// // ====== DRAWING and PLOTTING ====== // //////////////////////////////////////////////////////////////////////////////// // Background Color bgcolor = psiMa < settingsPsiLowerPsi ? color.new(color.red, 90) : psiMa > settingsPsiUpperPsi ? color.new(color.green, 90) : na // Check RSI conditions and update bgcolor bgcolor := settingsRsi.showInZones and psiMa < settingsPsiLowerPsi and rsi < settingsRsi.lowerRsi ? color.new(color.red, 50) : settingsRsi.showInZones and psiMa > settingsPsiUpperPsi and rsi > settingsRsi.upperRsi ? color.new(color.green, 50) : bgcolor // Trend Color trendColor = psiMa < 50 ? color.new(color.red, 0) : psiMa > 50 ? color.new(color.green, 0) : color.new(color.orange, 0) //Hlines median = hline(50, "Median", color.new(color.orange, 50), hline.style_dotted) upperMA = hline(settingsPsiUpperPsi, "OB MA", color.new(color.red, 70)) lowerMA = hline(settingsPsiLowerPsi, "OS MA", color.new(color.green, 70)) //Plots bgcolor(bgcolor) plot(psi, "Percentage of Prices Above VWMA", color = color.new(color.yellow, 80), linewidth = 1, display = display.pane) plot(psiMa, "Price Strength Index", color = trendColor, linewidth = 2)
Drawing multiple horizontal levels
https://www.tradingview.com/script/NEeu9eqq-Drawing-multiple-horizontal-levels/
mr_coffeefe
https://www.tradingview.com/u/mr_coffeefe/
17
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ mr_coffeefe // This is a simple Indicator to draw pricelevels or any kind of horizontal levels into your chart. //@version=5 indicator("MC Levels", overlay=true, max_lines_count=500) MCLevelsString = input.string(title="Insert Levels here", defval="4500.00, 4550.50, 4600") seperator = input.string(",", title = "Insert the seperator here") extendOption = input.string("both", title="Line Extension", options=["none", "left", "right", "both"]) lineColor = input.color(color.rgb(223, 64, 251, 80), title = 'Choose the line color here') lineWidth = input.int(3, 'Line Width') mclevels = str.split(MCLevelsString, seperator) lineExtend = extendOption == "left" ? extend.left : extendOption == "right" ? extend.right : extendOption == "both" ? extend.both : extend.none for i = 0 to array.size(mclevels)-1 line.new(bar_index,str.tonumber(array.get(mclevels, i)),bar_index+1,str.tonumber(array.get(mclevels, i)), xloc=xloc.bar_index, extend=lineExtend, width=lineWidth, color=lineColor)
Cross Correlation [Kioseff Trading]
https://www.tradingview.com/script/4iriNqgS-Cross-Correlation-Kioseff-Trading/
KioseffTrading
https://www.tradingview.com/u/KioseffTrading/
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/ // ยฉ KioseffTrading //@version=5 indicator("Cross Correlation Scanner", precision = 12, overlay = true, max_bars_back = 1000) k = input.int (defval = 1, title = "Start Lag", minval = 1, inline = "1") ke = input.int (defval = 5, title = "End Lag", minval = 2, inline = "1") norm = input.bool (defval = true , title = "Normalize Result"), all = input.bool (defval = false, title = "Normalize Overlapping Segments Only") center = input.bool (defval = true, title = "Center Mean") iso = input.bool (defval = false, title = "Isolate Asset") typex = input.string(defval = "Absolute Difference", title = "Cross Correlation Data Display", options = ["Absolute Difference", "Greatest Sum"]) results = input.int (defval = 20, minval = 1, maxval = 99) - 1 size = input.int (defval = 100, minval = 3, title = "Bars for Correlation") colS = input.color (defval = #6929F2, title = "Gradient Start Color", inline = "Col") colE = input.color (defval = #14D990, title = "Gradient End Color" , inline = "Col") cust = input.bool (defval = false, title = "Use Custom Symbols", group = "Custom Symbols") sym1 = input.symbol(defval = "MSFT", title = "Symbol 1 ", group = "Custom Symbols"),sym2 = input.symbol(defval = "AAPL", title = "Symbol 2 ", group = "Custom Symbols") sym3 = input.symbol(defval = "SPY", title = "Symbol 3 ", group = "Custom Symbols"),sym4 = input.symbol(defval = "QQQ", title = "Symbol 4 ", group = "Custom Symbols") sym5 = input.symbol(defval = "V", title = "Symbol 5 ", group = "Custom Symbols"),sym6 = input.symbol(defval = "MA", title = "Symbol 6 ", group = "Custom Symbols") sym7 = input.symbol(defval = "ADBE", title = "Symbol 7 ", group = "Custom Symbols"),sym8 = input.symbol(defval = "Z", title = "Symbol 8 ", group = "Custom Symbols") sym9 = input.symbol(defval = "INTU", title = "Symbol 9 ", group = "Custom Symbols"),sym10 = input.symbol(defval = "AMZN", title = "Symbol 10", group = "Custom Symbols") sym11 = input.symbol(defval = "NFLX", title = "Symbol 11", group = "Custom Symbols"),sym12 = input.symbol(defval = "TSLA", title = "Symbol 12", group = "Custom Symbols") sym13 = input.symbol(defval = "SHOP", title = "Symbol 13", group = "Custom Symbols"),sym14 = input.symbol(defval = "IWM", title = "Symbol 14", group = "Custom Symbols") sym15 = input.symbol(defval = "DIS", title = "Symbol 15", group = "Custom Symbols"),sym16 = input.symbol(defval = "WMT", title = "Symbol 16", group = "Custom Symbols") sym17 = input.symbol(defval = "KO", title = "Symbol 17", group = "Custom Symbols"),sym18 = input.symbol(defval = "BAC", title = "Symbol 18", group = "Custom Symbols") sym19 = input.symbol(defval = "KR", title = "Symbol 19", group = "Custom Symbols"),sym20 = input.symbol(defval = "NVDA", title = "Symbol 20", group = "Custom Symbols") import RicardoSantos/MathOperator/2 import kaigouthro/hsvColor/15 as kai method float (int id) => float(id) var allMat = matrix.new<float>(20, size, 0), var isoClose = array.new_float(size) lcp = switch iso true => 20 * (ke - k + 1) => (20 * 19 / 2) * (ke - k + 1) finStr = matrix.new<string>(2, lcp), var setArr = array.new_int(1, 0) [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20] = switch cust => [sym1, sym2, sym3, sym4, sym5, sym6, sym7, sym8, sym9, sym10, sym11, sym12, sym13, sym14, sym15, sym16, sym17, sym18, sym19, sym20] syminfo.type == "forex" => [ "EURUSD", "USDJPY", "GBPUSD", "USDCHF", "AUDUSD", "USDCAD", "NZDUSD", "EURGBP", "EURJPY", "GBPJPY", "AUDJPY", "EURCHF", "USDHKD", "USDSGD", "USDSEK", "USDNOK", "USDMXN", "NZDJPY", "USDZAR", "USDDKK"] syminfo.type == "futures" => [ "ES1!", "NQ1!", "YM1!", "ZB1!", "ZN1!", "ZF1!", "ZT1!", "6E1!", "6A1!", "6B1!", "6J1!", "6S1!", "6C1!", "CL1!", "NG1!", "RB1!", "HO1!", "GC1!", "SI1!", "HG1!"] syminfo.type == "crypto" => [ "BTCUSDT.P", "ETHUSDT.P", "BNBUSDT.P", "XRPUSDT.P", "ADAUSDT.P", "DOGEUSDT.P", "SOLUSDT.P", "TRXUSDT.P", "TONUSDT.P", "DOTUSDT.P", "MATICUSDT.P", "LTCUSDT.P", "SHIBUSDT.P", "QNTUSDT.P", "BCHUSDT.P", "AVAXUSDT.P", "ATOMUSDT.P", "LINKUSDT.P", "XLMUSDT.P", "XMRUSDT.P"] => ["XLY", "XLRE", "XLP", "XLU", "XLE", "XLC", "XLF", "XLV", "XLI", "XLK", "XLB", "IBUY", "PAVE", "EBIZ", "TAN", "OIH", "HERO", "KBE", "KBWD", "IHI"] strArr = array.from( s1 + "/", s2+ "/" , s3+ "/" , s4+ "/" , s5 + "/", s6 + "/", s7 + "/", s8 + "/", s9 + "/", s10+ "/", s11+ "/", s12+ "/", s13+ "/", s14+ "/", s15+ "/", s16+ "/", s17+ "/", s18+ "/", s19+ "/", s20+ "/") method noPrefix (string id) => string = switch cust true => str.substring(id, str.pos(id, ":") + 1) => id string := switch syminfo.type "crypto" => str.contains(string, ".P") ? str.replace_all(string, "USDT.P", "") : str.replace_all(string, "USD", "") => string string output(a, b) => switch typex "Absolute Difference" => math.abs(a - b) => a + b normType(a, b, y, z) => calc = math.sqrt(a * b) [normed, normed1] = switch norm false => [1, 1] true and not all => [calc, calc] true and all => [calc, math.sqrt(y * z)] [normed, normed1] method crossCor (matrix <float> id, iterationS, iterationE) => if not iso for m = k to ke for i = iterationS to iterationE if i > allMat.rows() - 1 break a = allMat.row(i), Amean = a.avg() if center for j = 0 to a.size() - 1 a.set(j, a.get(j) - Amean) for x = i + 1 to allMat.rows() - 1 if x > allMat.rows() - 1 break b = allMat.row(x), Bmean = b.avg() varSums = matrix.new<float>(6, a.size()) for j = 0 to a.size() - 1 if center b.set(j, b.get(j) - Bmean) varSums.set(2, j, math.pow(a.get(j), 2)) varSums.set(3, j, math.pow(b.get(j), 2)) for j = 0 to a.size() - (m + 1) varSums.set(0, j, a.get(j) * b.get(j + m)) varSums.set(1, j, a.get(j + m) * b.get(j)) if norm and all varSums.set(3, j, math.pow(b.get(j + m), 2)) varSums.set(4, j, math.pow(a.get(j + m), 2)) varSums.set(5, j, math.pow(b.get(j), 2)) [normed, normed1] = normType(varSums.row(2).sum(), varSums.row(3).sum(), varSums.row(4).sum(), varSums.row(5).sum()) ccf1prod = varSums.row(0).sum() / normed ccf1nprod = varSums.row(1).sum() / normed1 value = output(ccf1prod, ccf1nprod) set = setArr.first() id .set (0, set, value ) id .set (1, set, ccf1prod ) id .set (2, set, ccf1nprod) newString = str.substring(strArr.get(x).noPrefix(), 0, str.length(strArr.get(x).noPrefix()) - 1) finStr.set (0, set, strArr.get(i).noPrefix() + newString) finStr.set (1, set, str.tostring(m)) setArr.set(0, setArr.first() + 1) if iso Amean = isoClose.avg() if center for j = 0 to isoClose.size() -1 isoClose.set(j, isoClose.get(j) - Amean) for m = k to ke for x = 0 to allMat.rows() - 1 varSums = matrix.new<float>(6, isoClose.size()) b = allMat.row(x), Bmean = b.avg() for j = 0 to isoClose.size() - 1 if center b.set(j, b.get(j) - Bmean) varSums.set(2, j, math.pow(isoClose.get(j), 2)) varSums.set(3, j, math.pow(b.get(j) , 2)) for j = 0 to isoClose.size() - (m + 1) varSums.set(0, j, isoClose.get(j) * b.get(j + m)) varSums.set(1, j, isoClose.get(j + m) * b.get(j)) if norm and all varSums.set(3, j, math.pow(b.get(j + m) , 2)) varSums.set(4, j, math.pow(isoClose.get(j + m), 2)) varSums.set(5, j, math.pow(b.get(j) , 2)) calc = math.sqrt(varSums.row(2).sum() * varSums.row(3).sum()) [normed, normed1] = normType(varSums.row(2).sum(), varSums.row(3).sum(), varSums.row(4).sum(), varSums.row(5).sum()) ccf1prod = varSums.row(0).sum() / normed ccf1nprod = varSums.row(1).sum() / normed1 value = output(ccf1prod, ccf1nprod) set = setArr.first() id .set (0, set, value ) id .set (1, set, ccf1prod ) id .set (2, set, ccf1nprod) finStr.set (0, set, syminfo.ticker + "/" + str.substring(strArr.get(x).noPrefix(), 0, str.length(strArr.get(x).noPrefix()) - 1)) finStr.set (1, set, str.tostring(m)) setArr.set(0, setArr.first() + 1) logg = math.log(close / close[1]), var conditionMat = matrix.new<bool>(size, 2, false) req (string, col) => [log, difference, class, dom] = request.security(string, "", [math.log(close / close[1]), time, syminfo.type, timeframe.change("D") ? 1 : 0]) if barstate.islastconfirmedhistory for x = 0 to allMat.columns() - 1 allMat.set(col, x, log[size - x - 1]) if difference[x] - difference[x + 1] > timeframe.in_seconds(timeframe.period) * 1000 if dom[x] == 0 conditionMat.set(col, 0, true) if x.float().equal(0) if class != syminfo.type conditionMat.set(col, 1, true) req(s1, 0 ), req(s2 , 1 ), req(s3, 2 ), req(s4, 3 ) req(s5, 4 ), req(s6 , 5 ), req(s7, 6 ), req(s8, 7 ) req(s9, 8 ), req(s10, 9 ), req(s11, 10), req(s12, 11) req(s13, 12), req(s14, 13), req(s15, 14), req(s16, 15) req(s17, 16), req(s18, 17), req(s19, 18), req(s20, 19) method isoPush (array<float> id) => if barstate.islastconfirmedhistory for i = 0 to isoClose.size() - 1 id.set(i, logg[size - i - 1]) isoClose.isoPush() type sortedCorr float main float kP float kN string pair string lag method updateTable (table tab, int x) => for i = 0 to 3 str = switch i.float().equal(0) => "Symbol" i.float().equal(1) => "Lag" i.float().equal(2) => "+" i.float().equal(3) => "-" tab.cell(x * 20 + i + 1, 0, str, text_color = color.white, text_size = size.small) method outside (float id) => id.under(-1) or id.over(1) if barstate.islastconfirmedhistory hiLoMat = matrix.new<float>(2, 0) hiLoMat.add_col(0, array.from(-1e8, 1e8)) for i = 0 to size - 1 hiLoMat.set(0, 0, math.max(hiLoMat.get(0, 0), high[i])) hiLoMat.set(1, 0, math.min(hiLoMat.get(1, 0), low [i])) box.new(bar_index - size - 1, hiLoMat.max(), bar_index, hiLoMat.min(), bgcolor = color.new(#6929F2, 75), border_color = #00000000) finMat = matrix.new<float>(3, lcp), start = math.floor(allMat.rows() / 4) switch iso true => finMat.crossCor(0, allMat.rows() - 1) => finMat.crossCor(0 , start ), finMat.crossCor(start + 1, start * 2), finMat.crossCor(start * 2 + 1, start * 3), finMat.crossCor(start * 3 + 1, start * 4), finMat.crossCor(start * 4 + 1, allMat.rows() - 1) crossCopy = finMat.row(0).copy(), crossCopy.sort(order.descending), pairs = matrix.new<sortedCorr>(5, 0), rowSearch0 = finMat.row(0), r1 = finMat.row(1), r2 = finMat.row(2) str1 = finStr.row(0), str2 = finStr.row(1) for i = 0 to math.min(crossCopy.size() - 1, results) for x = 0 to finStr.columns() - 1 if crossCopy.get(i).equal(rowSearch0.get(x)) pairs.add_col(pairs.columns(), array.from( sortedCorr.new(rowSearch0 .get(x)), sortedCorr.new(kP = r1 .get(x)), sortedCorr.new(kN = r2 .get(x)), sortedCorr.new(pair = str1.get(x)), sortedCorr.new(lag = str2.get(x)) )) var tab = table.new(position.bottom_right, 99, 99, frame_color = color.white, frame_width = 1, border_color = color.white, border_width = 1) count = 0, col = 20, tab.updateTable(count) for i = 0 to results if i.float().over(0) and (i % col).float().equal(0) count += 1 tab.updateTable(count) kaicol = kai.hsv_gradient(i, 0, results, color.new(colS, 50), color.new(colE, 50)) tab.cell(count * 20 + 1, i % col + 1, pairs.get(3, i).pair, bgcolor = kaicol, text_size = size.small, text_color = color.white) tab.cell(count * 20 + 2, i % col + 1, pairs.get(4, i).lag , bgcolor = kaicol, text_size = size.small, text_color = color.white) form = switch norm false => "0.000000" => "0.000" tab.cell(count * 20 + 3, i % col + 1, str.tostring(pairs.get(1, i).kP, form) + (pairs.get(1, i).kP.outside() ? "(!)" : ""), bgcolor = kaicol, text_size = size.small, text_color = color.white) tab.cell(count * 20 + 4, i % col + 1, str.tostring(pairs.get(2, i).kN, form) + (pairs.get(2, i).kN.outside() ? "(!)" : ""), bgcolor = kaicol, text_size = size.small, text_color = color.white) var tab2 = table.new(position.top_right, 99, 99, frame_color = color.white, frame_width = 1, border_color = color.white, border_width = 1) tab2.cell(0, 0, text_color = color.white, text = "Lag Pair/Asset Tested: " + str.tostring(lcp), bgcolor = #00000000, text_size = size.small) col1 = conditionMat.col(0), col2 = conditionMat.col(1) if col1.some() gaps = "" for i = 0 to col1.size() - 1 if col1.get(i) == true gaps += str.substring(strArr.get(i).noPrefix(), 0, str.length(strArr.get(i).noPrefix()) - 1) + ", " tab2.cell(0, 1, text = "WARNING: Gapped Data Detected" + "\n" + gaps, text_color = color.red, text_size = size.small) if col2.some() diff = "" fin = switch syminfo.type "crypto" => "Cryptos" "stock" => "Stocks" "futures" => "Futures" "forex" => "Forex" => syminfo.type for i = 0 to col2.size() - 1 if col2.get(i) == true diff += str.substring(strArr.get(i).noPrefix(), 0, str.length(strArr.get(i).noPrefix()) - 1) + ", " tab2.cell(0, 2, text = "WARNING: The Following Symbols Are Not " + fin + "\n" + diff +"\nPlease Ensure There Are Not Time Gaps Between Symbols", text_color = color.red, text_size = size.small)
CCPD Candle Color Price Detector
https://www.tradingview.com/script/SQRvvKwB-CCPD-Candle-Color-Price-Detector/
KingForexBob
https://www.tradingview.com/u/KingForexBob/
28
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/ // ยฉ KingForexBob //@version=4 study(title="CCPD Candle Color Price Detector", shorttitle="CCPD", overlay=true) // Input to adjust the number of bars for highest high and lowest low calculation barsForHighLow = input(10, title="Bars for High/Low", minval=1) var color currentColor = na var float highestHigh = na var float lowestLow = na // Calculate highest high and lowest low if bar_index >= barsForHighLow highestHigh := highest(high, barsForHighLow) lowestLow := lowest(low, barsForHighLow) if close > open currentColor := color.green else currentColor := color.red // Calculate the midpoint between highest high and lowest low midpoint = (highestHigh + lowestLow) / 2 // Plot buy and sell signals with EMA filter plotshape(currentColor == color.green and close > midpoint, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal") plotshape(currentColor == color.red and close < midpoint, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal") // Calculate the midpoint line plot(highestHigh, title="Highest High", color=color.orange) plot(lowestLow, title="Lowest Low", color=color.orange) // Plot the midpoint line plot(midpoint, title="Midpoint", color=color.purple, linewidth=2) // Plot a line between midpoint and highest high plot((midpoint + highestHigh) / 2, title="Midpoint to Highest High", color=color.green, linewidth=1) // Plot a line between midpoint and lowest low plot((midpoint + lowestLow) / 2, title="Midpoint to Lowest Low", color=color.green, linewidth=1) // Plot a line between green line and highest high plot((highestHigh + (midpoint + highestHigh) / 2) / 2, title="Midpoint of Midpoint of Highest High", color=color.white, linewidth=1) // Plot a line between red line and lowest low plot((lowestLow + (midpoint + lowestLow) / 2) / 2, title="Midpoint of Midpoint of Lowest Low", color=color.white, linewidth=1) // Create alerts for buy and sell signals alertcondition(currentColor == color.green and close > midpoint, title="Buy Signal Alert", message="Buy Signal Detected!") alertcondition(currentColor == color.red and close < midpoint, title="Sell Signal Alert", message="Sell Signal Detected!")
Ultimate RSI [LuxAlgo]
https://www.tradingview.com/script/17Jj7Vcg-Ultimate-RSI-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
2,953
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("Ultimate RSI [LuxAlgo]", "LuxAlgo - Ultimate RSI") //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ length = input.int(14, minval = 2) smoType1 = input.string('RMA', 'Method', options = ['EMA', 'SMA', 'RMA', 'TMA']) src = input(close, 'Source') arsiCss = input(color.silver, 'Color', inline = 'rsicss') autoCss = input(true, 'Auto', inline = 'rsicss') //Signal Line smooth = input.int(14, minval = 1, group = 'Signal Line') smoType2 = input.string('EMA', 'Method', options = ['EMA', 'SMA', 'RMA', 'TMA'], group = 'Signal Line') signalCss = input(#ff5d00, 'Color', group = 'Signal Line') //OB/OS Style obValue = input.float(80, 'Overbought', inline = 'ob', group = 'OB/OS Style') obCss = input(#089981, '', inline = 'ob', group = 'OB/OS Style') obAreaCss = input(color.new(#089981, 80), '', inline = 'ob', group = 'OB/OS Style') osValue = input.float(20, 'Oversoldโ€„โ€„โ€„โ€„', inline = 'os', group = 'OB/OS Style') osCss = input(#f23645, '', inline = 'os', group = 'OB/OS Style') osAreaCss = input(color.new(#f23645, 80), '', inline = 'os', group = 'OB/OS Style') //-----------------------------------------------------------------------------} //Functions //-----------------------------------------------------------------------------{ ma(x, len, maType)=> switch maType 'EMA' => ta.ema(x, len) 'SMA' => ta.sma(x, len) 'RMA' => ta.rma(x, len) 'TMA' => ta.sma(ta.sma(x, len), len) //-----------------------------------------------------------------------------} //Augmented RSI //-----------------------------------------------------------------------------{ upper = ta.highest(src, length) lower = ta.lowest(src, length) r = upper - lower d = src - src[1] diff = upper > upper[1] ? r : lower < lower[1] ? -r : d num = ma(diff, length, smoType1) den = ma(math.abs(diff), length, smoType1) arsi = num / den * 50 + 50 signal = ma(arsi, smooth, smoType2) //-----------------------------------------------------------------------------} //Plots //-----------------------------------------------------------------------------{ plot_rsi = plot(arsi, 'Ultimate RSI' , arsi > obValue ? obCss : arsi < osValue ? osCss : autoCss ? chart.fg_color : arsiCss) plot(signal, 'Signal Line', signalCss) //Levels plot_up = plot(obValue, color = na, editable = false) plot_avg = plot(50, color = na, editable = false) plot_dn = plot(osValue, color = na, editable = false) //OB-OS fill(plot_rsi, plot_up, arsi > obValue ? obAreaCss : na) fill(plot_dn, plot_rsi, arsi < osValue ? osAreaCss : na) //Gradient fill(plot_rsi, plot_avg, obValue, 50, obAreaCss, color.new(chart.bg_color, 100)) fill(plot_avg, plot_rsi, 50, osValue, color.new(chart.bg_color, 100), osAreaCss) hline(obValue, 'Overbought') hline(50, 'Midline') hline(osValue, 'Oversold') //-----------------------------------------------------------------------------}
Market Trend
https://www.tradingview.com/script/lBxqimNh-Market-Trend/
Tradingninjaa-com
https://www.tradingview.com/u/Tradingninjaa-com/
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/ // ยฉ Trading Ninjaa //@version=5 indicator(title="Market Trend", shorttitle="Market Trend", overlay=true) // Input for MA period maPeriod = input.int(9, title="MA Period", minval=1) // Define higher timeframe higherTf = "" if (timeframe.isintraday) if (timeframe.multiplier == 1) higherTf := "5" else if (timeframe.multiplier <= 5) higherTf := "15" else if (timeframe.multiplier <= 15) higherTf := "30" else if (timeframe.multiplier <= 30) higherTf := "60" else if (timeframe.multiplier <= 60) higherTf := "120" else if (timeframe.multiplier <= 120) higherTf := "180" else higherTf := "D" else if (timeframe.multiplier == 1) higherTf := "W" else higherTf := "M" // Fetching the higher timeframe MA htMA = request.security(syminfo.tickerid, higherTf, ta.sma(close, maPeriod)) // Trend identification upTrend = close > htMA downTrend = close < htMA // Determine color for MA line maColor = upTrend ? color.new(color.green, 0) : downTrend ? color.new(color.red, 0) : color.new(color.blue, 0) // Plotting plot(htMA, color=maColor, linewidth=2, title="Higher Timeframe MA9") // Identifying Sideways market: Using ATR atrValue = ta.atr(14) isDecreasingATR = atrValue < ta.sma(atrValue, 50) // Using the current close range to define a sideways movement isSideways = isDecreasingATR and not upTrend and not downTrend // Background Coloring bgcolor(upTrend ? color.new(color.green, 90) : downTrend ? color.new(color.red, 90) : isSideways ? color.new(color.gray, 90) : na)
FVG w/ Fibs [QuantVue]
https://www.tradingview.com/script/qsQDdHqc-FVG-w-Fibs-QuantVue/
QuantVue
https://www.tradingview.com/u/QuantVue/
358
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ QuantVue //@version=5 indicator("FVG w/ Fibs [QuantVue]", overlay = true, max_boxes_count = 250, max_lines_count = 500) //----------settings----------// bullCol = input.color(color.new(color.lime,85), 'Bullish Color', inline = '1') bearCol = input.color(color.new(color.red,85), 'Bearish Color', inline = '1') minGap = input.float(.1, 'Minimum FVG %', minval = .01, step = .01, inline = '2') tooLongBool = input.bool(true, 'Stop Drawing Box After', inline = '3') tooLong = input.int(60, ' ', inline = '3') removeOld = input.bool(true, 'Hide Boxes That Are Too Long', inline = '4') var g1 = 'Filled Gaps' mitType = input.string('Close', 'Mitigation Type', ['Close', 'Wicks'], group = g1, inline = '1') removeFilled = input.bool(true, 'Remove Filled Gaps', group = g1, inline = '2') filledBorder = input.bool(true, 'Changed Filled FVG Box Border', group = g1, inline = '3') borderStyle = input.string('Dashed', 'Filled Border ', options = ['Dotted', 'Dashed', 'Solid'], inline = '4', group = g1) borderCol = input.color(color.gray, ' ', inline = '4', group = g1) var g2 = 'Fibs' show_50 = input.bool(true, '', inline = 'Level1', group = g2) value_50 = input.float(0.5, '', inline = 'Level1', group = g2) color_50 = input.color(#c2c5ce, '', inline = 'Level1', group = g2) style_50 = input.string('Solid', ' ', options = ['Dotted', 'Dashed', 'Solid'], inline = 'Level1', group = g2) show_618 = input.bool(true, '', inline = 'Level2', group = g2) value_618 = input.float(0.618, '', inline = 'Level2', group = g2) color_618 = input.color(#00ccff, '', inline = 'Level2', group = g2) style_618 = input.string('Solid', ' ', options = ['Dotted', 'Dashed', 'Solid'], inline = 'Level2', group = g2) var g3 = 'Clean Up' activeBoxes = input.int(20, 'Maximum Number of Gaps to Update', group = g3, inline = '1') //----------udt----------// type FVG box b bool a = true bool bull = true line f line s //----------variables----------// var bearFvg = array.new<FVG>() var bullFvg = array.new<FVG>() //----------methods----------// method switcher(string this)=> switch this 'Dashed' => line.style_dashed 'Dotted' => line.style_dotted 'Solid' => line.style_solid method run(array<FVG> this)=> for [idx,fvg] in this src = mitType == 'Close' ? close : fvg.bull ? low : high if fvg.a fvg.b.set_right(bar_index) fvg.f.set_x2(bar_index) fvg.s.set_x2(bar_index) if fvg.b.get_right() - fvg.b.get_left() > tooLong and tooLongBool fvg.a := false if removeOld fvg.b.delete() fvg.f.delete() fvg.s.delete() if (src <= fvg.b.get_bottom() and barstate.isconfirmed and fvg.bull) or (src >= fvg.b.get_top() and barstate.isconfirmed and not fvg.bull) fvg.a := false alert(fvg.bull ? 'Bullish FVG Filled' : 'Bearish FVG Filled', alert.freq_once_per_bar_close) if filledBorder fvg.b.set_border_color(borderCol) fvg.b.set_border_style(borderStyle.switcher()) if removeFilled fvg.b.delete() fvg.f.delete() fvg.s.delete() if not fvg.a this.remove(idx) //----------conditions & calculations----------// bullishFVG = low > high[2] and close[1] > high[2] and ((low - high[2]) / high[2] * 100) >= minGap bearishFVG = high < low[2] and close[1] < low[2] and ((low[2] - high) / high * 100) >= minGap fiddy = bullishFVG ? low - value_50 * (low - high[2]) : high + value_50 * (low[2] - high) sixOneEight = bullishFVG ? low - value_618 * (low - high[2]) : high + value_618 * (low[2] - high) //----------find fvgs and store data----------// if bullishFVG if bullFvg.size() > activeBoxes -1 bullFvg.pop() bullFvg.unshift(FVG.new(box.new(bar_index[2], low, bar_index, high[2], bullCol, bgcolor = bullCol), f = show_50 ? line.new(bar_index[2], fiddy, bar_index, fiddy, style = style_50.switcher(), color= color_50) : na, s = show_618 ? line.new(bar_index[2], sixOneEight, bar_index, sixOneEight, style = style_618.switcher(), color = color_618) : na)) else bullFvg.unshift(FVG.new(box.new(bar_index[2], low, bar_index, high[2], bullCol, bgcolor = bullCol), f = show_50 ? line.new(bar_index[2], fiddy, bar_index, fiddy, style = style_50.switcher(), color= color_50) : na, s = show_618 ? line.new(bar_index[2], sixOneEight, bar_index, sixOneEight, style = style_618.switcher(), color = color_618) : na)) if bearishFVG if bearFvg.size() > activeBoxes -1 bearFvg.pop() bearFvg.unshift(FVG.new(box.new(bar_index[2], low[2], bar_index + 1, high, bearCol, bgcolor = bearCol),bull = false, f = show_50 ? line.new(bar_index[2], fiddy, bar_index, fiddy, style = style_50.switcher(), color = color_50) : na, s = show_618 ? line.new(bar_index[2], sixOneEight, bar_index, sixOneEight, style = style_618.switcher(), color = color_618) : na)) else bearFvg.unshift(FVG.new(box.new(bar_index[2], low[2], bar_index + 1, high, bearCol, bgcolor = bearCol),bull = false, f = show_50 ? line.new(bar_index[2], fiddy, bar_index, fiddy, style = style_50.switcher(), color = color_50) : na, s = show_618 ? line.new(bar_index[2], sixOneEight, bar_index, sixOneEight, style = style_618.switcher(), color = color_618) : na)) //----------run the code----------// bearFvg.run() bullFvg.run()
Liquidity Concepts [StratifyTrade]
https://www.tradingview.com/script/pII2VRaA-Liquidity-Concepts-StratifyTrade/
StratifyTrade
https://www.tradingview.com/u/StratifyTrade/
625
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/ // ยฉ HunterAlgos //@version=5 indicator("Liquidity Concepts [HunterAlgos]", shorttitle = "Liquidity Concepts [1.0.0]",overlay = true, max_lines_count = 500, max_labels_count = 500, max_boxes_count = 500, max_bars_back = 500) lookback = input.int(12,"Pivot Point Length",minval = 2,group = "Inputs") liq_valid = input.int(7,"Liquidation Validity",minval = 1,tooltip = "Measure how many candles should max pass to count as liquidity. Ex: if set to 7, the liquidation should happen in those 7 bars; otherwise, it is not valid.",inline = "AA",group = "Inputs") liq_bool = input.bool(true,"Use Pivot Length",inline = "AA",group = "Inputs") switch liq_bool true => liq_valid := lookback false => na => liq_valid HH_css = input.color(color.white, "HH & HL", inline = "HHLL2", group = "Inputs") LL_css = input.color(color.gray , "LL & LH", inline = "HHLL2", group = "Inputs") css_candle = input.string("CHoCH", "Candle Coloring",options = ["CHoCH","Default"]) // bt_show = input.bool(false,"Show feedbacks result",group = "Settings") show_liq = input.bool(false,"Hide Liquidity Swipe",group = "Settings") show_pivot = input.bool(false,"Hide Pivot Point",group = "Settings") show_wick = input.bool(false,"Hide Liquidation Wicks Point",group = "Settings") css_bull = input.color(#089981 , "Bull CHoCH", inline = "Color 1", group = "Colors trend") css_bear = input.color(color.red, "Bear CHoCH", inline = "Color 1", group = "Colors trend") css_up = input.color(color.gray, "Up Candle", inline = "Color 2", group = "Colors trend") css_dn = input.color(color.black, "Down Candle", inline = "Color 2", group = "Colors trend") major_trans = input.int(80,"Transp Major Liquidation",0,100,inline = "trans1",group = "Liquidations Color") minor_trans = input.int(90,"Transp Minor Liquidation",0,100,inline = "trans2",group = "Liquidations Color") liq_bear_minor = input.color(color.gray,"Bearish Liquidity Minor Swipe", group = "Liquidations Color") liq_bull_minor = input.color(color.gray,"Bullish Liquidity Minor Swipe", group = "Liquidations Color") liq_bear_major = input.color(color.purple,"Bearish Liquidity Major Swipe", group = "Liquidations Color") liq_bull_major = input.color(color.aqua,"Bullish Liquidity Major Swipe", group = "Liquidations Color") liq_wick_lh = input.color(color.orange, "Bearish Liquidation wick", group = "Liquidations Color") liq_wick_hl = input.color(color.aqua, "Bearish Liquidation wick", group = "Liquidations Color") lbl_size = input.int(1,"Pivot Text size",1,maxval = 5, group = "Text size") lbl_t = switch lbl_size 1 => size.tiny 2 => size.small 3 => size.normal 4 => size.large 5 => size.huge txt_size = input.int(1,"Market structure Text size",1,maxval = 5, group = "Text size") txt_t = switch txt_size 1 => size.tiny 2 => size.small 3 => size.normal 4 => size.large 5 => size.huge transline = 0 BOS_bull_css = input.color(color.white, "Bullish BOS", inline = "BOS1", group = "BOS and CHoCH colors") BOS_bear_css = input.color(color.gray , "Bullish BOS", inline = "BOS2", group = "BOS and CHoCH colors") CHOCH_bull_css = input.color(color.white, "Bullish CHoCH", inline = "BOS1", group = "BOS and CHoCH colors") CHOCH_bear_css = input.color(color.gray , "Bearish CHoCH", inline = "BOS2", group = "BOS and CHoCH colors") switch show_liq true => major_trans := 100, minor_trans := 100 false => na colinv = color.new(color.white,100) // gay type bar float o = open float h = high float l = low float c = close float v = volume int idx = bar_index int t = time // type col // color gray = color.gray // color black = color.black // color green = color.green // color red = color.red // color blue = color.blue // color purple = color.purple // color ared = #e60000 // color ablue = #3366ff // color inv = #ffffff00 type zBin float[] LH float[] HL float[] LL float[] HH int[] LHindex int[] HLindex int[] LLindex int[] HHindex float[] LHchoch float[] HLchoch float[] LLchoch float[] HHchoch int[] LHchochIndex int[] HLchochIndex int[] LLchochIndex int[] HHchochIndex float[] _popLH int[] _popLHidx var bin = zBin.new( array.new<float>() , array.new<float>() , array.new<float>() , array.new<float>() , array.new<int>() , array.new<int>() , array.new<int>() , array.new<int>() , array.new<float>() , array.new<float>() , array.new<float>() , array.new<float>() , array.new<int>() , array.new<int>() , array.new<int>() , array.new<int>() , array.new<float>() , array.new<int>() ) bar = bar.new() // col = col.new() var int itrend = 0 f_drawLine(x1, y1, x2, y2, color, widh, bBar, txt, down, dashed,transline) => var line id = na id := line.new(na, na, na, na, xloc = xloc.bar_index, style = dashed ? line.style_dashed : line.style_solid) line.set_x1(id ,x1) line.set_y1(id ,y1) line.set_x2(id ,x2) line.set_y2(id ,y2) line.set_color(id, color.new(color,transline)) line.set_width(id, widh) structure_lbl = label.new(int(math.avg(x1, bBar)), y1, txt , color = colinv , textcolor = color , style = down ? label.style_label_down : label.style_label_up , size = txt_t) f_drawBox(left, top, right, bottom, bgcolor, bcolor, trans) => var box id = na id := box.new(left, top, right, bottom) box.set_bgcolor(id,color.new(bgcolor,trans)) box.set_border_width(id, 1) box.set_border_color(id, color.new(bcolor,100)) // && => HH LL LH ph = ta.pivothigh(lookback, lookback) pl = ta.pivotlow(lookback, lookback) iff_1 = pl ? -1 : na // Trend direction hl = ph ? 1 : iff_1 iff_2 = pl ? pl : na // similar to zigzag but may have multiple highs/lows zz = ph ? ph : iff_2 valuewhen_1 = ta.valuewhen(hl, hl, 1) valuewhen_2 = ta.valuewhen(zz, zz, 1) zz := pl and hl == -1 and valuewhen_1 == -1 and pl > valuewhen_2 ? na : zz valuewhen_3 = ta.valuewhen(hl, hl, 1) valuewhen_4 = ta.valuewhen(zz, zz, 1) zz := ph and hl == 1 and valuewhen_3 == 1 and ph < valuewhen_4 ? na : zz valuewhen_5 = ta.valuewhen(hl, hl, 1) valuewhen_6 = ta.valuewhen(zz, zz, 1) hl := hl == -1 and valuewhen_5 == 1 and zz > valuewhen_6 ? na : hl valuewhen_7 = ta.valuewhen(hl, hl, 1) valuewhen_8 = ta.valuewhen(zz, zz, 1) hl := hl == 1 and valuewhen_7 == -1 and zz < valuewhen_8 ? na : hl zz := na(hl) ? na : zz findprevious() => // finds previous three points (b, c, d, e) ehl = hl == 1 ? -1 : 1 loc1 = 0.0 loc2 = 0.0 loc3 = 0.0 loc4 = 0.0 xx = 0 for x = 1 to 1000 by 1 if hl[x] == ehl and not na(zz[x]) loc1 := zz[x] xx := x + 1 break ehl := hl for x = xx to 1000 by 1 if hl[x] == ehl and not na(zz[x]) loc2 := zz[x] xx := x + 1 break ehl := hl == 1 ? -1 : 1 for x = xx to 1000 by 1 if hl[x] == ehl and not na(zz[x]) loc3 := zz[x] xx := x + 1 break ehl := hl for x = xx to 1000 by 1 if hl[x] == ehl and not na(zz[x]) loc4 := zz[x] break [loc1, loc2, loc3, loc4] isNot() => float a = na float b = na float c = na float d = na float e = na if not na(hl) [loc1, loc2, loc3, loc4] = findprevious() a := zz b := loc1 c := loc2 d := loc3 e := loc4 e _hh = zz and a > b and a > c and c > b and c > d _ll = zz and a < b and a < c and c < b and c < d _hl = zz and (a >= c and b > c and b > d and d > c and d > e or a < b and a > c and b < d) _lh = zz and (a <= c and b < c and b < d and d < c and d < e or a > b and a < c and b > d) [_hh, _ll, _hl, _lh] [_hh, _ll, _hl, _lh] = isNot() float res = na float sup = na res := _lh ? zz : res[1] sup := _hl ? zz : sup[1] int trend = na iff_3 = close < sup ? -1 : nz(trend[1]) trend := close > res ? 1 : iff_3 res := trend == 1 and _hh or trend == -1 and _lh ? zz : res sup := trend == 1 and _hl or trend == -1 and _ll ? zz : sup rechange = res != res[1] suchange = sup != sup[1] //table int var int tot_structure_bull = 0 var int tot_structure_bear = 0 var float tot_bear_liq = 0 var float tot_bull_liq = 0 var float tot_liq_sell = 0 var float tot_liq_buy = 0 // && => Pivot HH and CHoCH var bxHHchOchPoint = array.new<float>() color onetap = na float src_onetap_lh = na float src_onetap_hl = na bodyLength = math.abs(close - open) downWickLength = low - math.min(open, close) downWickBigger = downWickLength > bodyLength if _hh id = show_pivot ? na : label.new(bar.idx[lookback], bar.h[lookback], text = "HH", text_font_family = font.family_monospace, style = label.style_label_down, size = lbl_t, color = colinv, textcolor = HH_css) bin.HH.push(bar.h[lookback]) bin.HHindex.push(bar.idx[lookback]) bxHHchOchPoint.push(bar.h[1]) if bin.HH.size() > 0 if bar.idx % (lookback * 2) == 0 bin.HHchoch.push(bin.HH.pop()) bin.HHchochIndex.push(bin.HHindex.pop()) if bin.HH.size() > 0 for j = 0 to bin.HH.size() if bin.HH.size() <= 0 break else var _popHH = array.new<float>() var _popHHidx = array.new<int>() var int barsince = ta.barssince(ta.crossunder(bar.c, bin.HH.last())) if ta.crossover(bar.h, bin.HH.last()) bool choch = false if itrend < 0 choch := true txt = choch ? "CHoCH" : "BOS" _popHH.push(bin.HH.pop()) _popHHidx.push(bin.HHindex.pop()) if math.abs(_popHHidx.last() - bar.idx) > 500 break else col = choch ? CHOCH_bull_css : BOS_bull_css itrend := 1 tot_structure_bull += 1 f_drawLine(_popHHidx.last(), _popHH.last(), bar.idx, _popHH.last(), col, 1, bar.idx, txt, true, txt == "BOS" ? true : false, transline) if bin.HHchoch.size() > 0 for j = 0 to bin.HHchoch.size() if bin.HHchoch.size() <= 0 break else var _popHHchoch = array.new<float>() var _popHHchochIndex = array.new<int>() if ta.crossover(bar.c, bin.HHchoch.last()) bool choch = false if itrend < 0 choch := true txt = choch ? "CHoCH" : "BOS" _popHHchoch.push(bin.HHchoch.pop()) _popHHchochIndex.push(bin.HHchochIndex.pop()) if math.abs(_popHHchochIndex.last() - bar.idx) > 500 break else col = choch ? CHOCH_bull_css : BOS_bull_css f_drawLine(_popHHchochIndex.last(), _popHHchoch.last(), bar.idx, _popHHchoch.last(), col, 1, bar.idx, txt, true, txt == "BOS" ? true : false, transline) itrend := 1 tot_structure_bull += 1 if bxHHchOchPoint.size() > 0 barsince = ta.barssince(ta.crossover(bar.h ,bxHHchOchPoint.last())) var float lastLvl = na var int index = na if ta.crossover(bar.h, bxHHchOchPoint.last()) lastLvl := bxHHchOchPoint.last() index := bar.idx[1] if ta.crossunder(bar.h, bxHHchOchPoint.last()) and barsince <= liq_valid var maxtop = array.new<float>() for j = 0 to barsince maxtop.push(bar.h[j]) f_drawBox(index, maxtop.max(), bar.idx, lastLvl, liq_bear_major, liq_bear_major, major_trans) tot_liq_sell += ta.cum(volume) lastLvl := na index := na maxtop.clear() else if ta.crossunder(bar.h, bxHHchOchPoint.last()) and barsince > liq_valid lastLvl := na index := na // && => Pivot LL and CHoCH var bxLLchOch = array.new<float>() if _ll id = show_pivot ? na : label.new(bar.idx[lookback], bar.l[lookback], text = "LL", text_font_family = font.family_monospace, style = label.style_label_up, size = lbl_t, color = colinv, textcolor = LL_css) bin.LL.push(bar.l[lookback]) bin.LLindex.push(bar.idx[lookback]) bxLLchOch.push(bar.l[1]) if bin.LL.size() > 0 if bar.idx % (lookback * 2) == 0 bin.LLchoch.push(bin.LL.pop()) bin.LLchochIndex.push(bin.LLindex.pop()) if bin.LL.size() > 0 for j = 0 to bin.LL.size() if bin.LL.size() <= 0 break else var _popLL = array.new<float>() var _popLLidx = array.new<int>() var int barsince = ta.barssince(ta.crossunder(bar.c, bin.LL.last())) if ta.crossunder(bar.l, bin.LL.last()) bool choch = false if itrend > 0 choch := true txt = choch ? "CHoCH" : "BOS" _popLL.push(bin.LL.pop()) _popLLidx.push(bin.LLindex.pop()) if math.abs(_popLLidx.last() - bar.idx) > 500 break else col = choch ? CHOCH_bear_css : BOS_bear_css f_drawLine(_popLLidx.last(), _popLL.last(), bar.idx, _popLL.last(), col, 1, bar.idx, txt, false, txt == "BOS" ? true : false, transline) itrend := -1 tot_structure_bear += 1 if bin.LLchoch.size() > 0 for j = 0 to bin.LLchoch.size() if bin.LLchoch.size() <= 0 break else var _popLLchoch = array.new<float>() var _popLLchochIndex = array.new<int>() if ta.crossunder(bar.c, bin.LLchoch.last()) bool choch = false if itrend > 0 choch := true txt = choch ? "CHoCH" : "BOS" _popLLchoch.push(bin.LLchoch.pop()) _popLLchochIndex.push(bin.LLchochIndex.pop()) if math.abs(_popLLchochIndex.last() - bar.idx) > 500 break else col = choch ? CHOCH_bear_css : BOS_bear_css f_drawLine(_popLLchochIndex.last(), _popLLchoch.last(), bar.idx, _popLLchoch.last(), col, 1, bar.idx, txt, false, txt == "BOS" ? true : false, transline) itrend := -1 tot_structure_bear += 1 if bxLLchOch.size() > 0 barsince = ta.barssince(ta.crossunder(bar.l ,bxLLchOch.last())) var float lastLvl = na var int index = na if ta.crossunder(bar.h, bxLLchOch.last()) lastLvl := bxLLchOch.last() index := bar.idx[1] if ta.crossover(bar.h, bxLLchOch.last()) and barsince <= liq_valid var maxtop = array.new<float>() for j = 0 to barsince maxtop.push(bar.l[j]) f_drawBox(index, lastLvl, bar.idx[1], maxtop.min(), liq_bull_major, liq_bull_major, major_trans) tot_liq_buy += ta.cum(volume) lastLvl := na index := na maxtop.clear() else if ta.crossover(bar.l, bxLLchOch.last()) and barsince > liq_valid lastLvl := na index := na // && => Pivot HL var bxHLPoint = array.new<float>() if _hl id = show_pivot ? na : label.new(bar.idx[lookback], bar.l[lookback], text = "HL", text_font_family = font.family_monospace, style = label.style_label_up, size = lbl_t, color = colinv, textcolor = HH_css) bin.HL.push(bar.l[lookback]) bin.HLindex.push(bar.idx[lookback]) bxHLPoint.push(bar.l[lookback]) if bin.HL.size() > 0 for j = 0 to bin.HL.size() if bin.HL.size() <= 0 break else if bin.HL.size() > 0 var _popHL = array.new<float>() var _popHLidx = array.new<int>() var int barsince = ta.barssince(ta.crossunder(bar.c, bin.HL.last())) if ta.crossunder(bar.l, bin.HL.last()) _popHL.push(bin.HL.pop()) _popHLidx.push(bin.HLindex.pop()) if math.abs(_popHLidx.last() - bar.idx) > 500 break else show_pivot ? na : f_drawLine(_popHLidx.last(), _popHL.last(), bar.idx, _popHL.last(), HH_css, 1, bar.idx, "", false, false, 0) if bar.c > _popHL.last() and bar.o > _popHL.last() and math.abs(close - open) <= math.abs(low - (close > open ? open : close)) src_onetap_hl := low if bxHLPoint.size() > 0 barsince = ta.barssince(ta.crossunder(bar.l ,bxHLPoint.last())) var float lastLvl = na var int index = na if ta.crossunder(bar.h, bxHLPoint.last()) lastLvl := bxHLPoint.last() index := bar.idx[1] if ta.crossover(bar.h, bxHLPoint.last()) and barsince <= liq_valid var maxtop = array.new<float>() for j = 0 to barsince maxtop.push(bar.l[j]) f_drawBox(index, lastLvl, bar.idx[1], maxtop.min(), liq_bear_minor, liq_bear_minor, minor_trans) tot_liq_buy += ta.cum(volume) lastLvl := na index := na maxtop.clear() else if ta.crossover(bar.l, bxHLPoint.last()) and barsince > liq_valid lastLvl := na index := na // && => Pivot LH and Liquidity Swap var bxLHPoint = array.new<float>() if _lh id = show_pivot ? na : label.new(bar.idx[lookback], bar.h[lookback], text = "LH", text_font_family = font.family_monospace, style = label.style_label_down, size = lbl_t, color = colinv, textcolor = LL_css) bin.LH.push(bar.h[lookback]) bin.LHindex.push(bar.idx[lookback]) bxLHPoint.push(bar.h[lookback]) if bin.LH.size() > 0 for j = 0 to bin.LH.size() if bin.LH.size() <= 0 break else if ta.crossover(bar.h, bin.LH.last()) bin._popLH.push(bin.LH.pop()) bin._popLHidx.push(bin.LHindex.pop()) if math.abs(bin._popLHidx.last() - bar.idx) > 500 break else show_pivot ? na : f_drawLine(bin._popLHidx.last(), bin._popLH.last(), bar.idx, bin._popLH.last(), LL_css, 1, bar.idx, "", false, false, 0) if bar.c < bin._popLH.last() and bar.o < bin._popLH.last() and math.abs(close - open) <= math.abs(high - (close > open ? close : open)) src_onetap_lh := high if bxLHPoint.size() > 0 barsince = ta.barssince(ta.crossover(bar.h ,bxLHPoint.last())) var float lastLvl = na var int index = na if ta.crossover(bar.h, bxLHPoint.last()) lastLvl := bxLHPoint.last() index := bar.idx[1] if ta.crossunder(bar.h, bxLHPoint.last()) and barsince <= liq_valid var maxtop = array.new<float>() for j = 0 to barsince maxtop.push(bar.h[j]) f_drawBox(index, maxtop.max(), bar.idx[1], lastLvl, liq_bull_minor, liq_bull_minor, minor_trans) tot_liq_sell += ta.cum(volume) lastLvl := na index := na maxtop.clear() else if ta.crossunder(bar.h, bxLHPoint.last()) and barsince > liq_valid lastLvl := na index := na css(x) => var color col = na if x == "CHoCH" col := itrend == 1 ? css_bull : css_bear else if x == "Default" col := bar.c > bar.o ? css_up : css_dn col css = css(css_candle) c_src = close > open ? close : open c_csrc = close > open ? open : close int b_wick = 0 switch show_wick false => na true => b_wick := 100 plotcandle(bar.o ,bar.h, bar.l, bar.c, color = css, wickcolor = css, bordercolor = css,display = display.pane) plotcandle(src_onetap_lh,c_src, c_src ,c_src, color = colinv,wickcolor = colinv,bordercolor = color.new(liq_wick_lh,b_wick),display = display.pane) plotcandle(src_onetap_hl,c_csrc, c_csrc ,c_csrc, color = colinv,wickcolor = colinv,bordercolor = color.new(liq_wick_hl,b_wick),display = display.pane) //src_onetap // // && =>
Trade Tool VDWMA + OI RSI Based
https://www.tradingview.com/script/WkmAi64j/
Demech
https://www.tradingview.com/u/Demech/
59
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ Demech //@version=5 indicator("Trade Tool VDWMA + OI RSI Based", shorttitle = "VDWMA Tool", overlay=true, format=format.price, precision = 2, timeframe = "", timeframe_gaps = false) import PineCoders/Time/3 // Parameters resistance_length = input(50, title = "Resistance") support_length = input(50, title = "Support") vdwmalength = input(200, title = "VDWMA Slow" ) vdwmalengthfast = input(50, title='VDWMA Fast') rsi1_period = input(title='RSI Period', defval=14) oirsiPeriod = input(7, title="OI RSI Period") // Barcolor Input upper_color = input(color.new (color.rgb(1, 250, 10),0),"bull") lower_color = input(color.new (color.rgb(255, 0, 0),0),"bear") middle_color = input(color.new(color.gray,0), "neutral") // Calculation of the volume delta (buy volume - sell volume) upWick = high - (open < close ? open : close) downWick = (open > close ? open : close) - low wickSum = upWick + downWick buyVolume = wickSum != 0 ? volume * (upWick / wickSum) : volume / 2 sellVolume = wickSum != 0 ? volume * (downWick / wickSum) : volume / 2 volDelta = buyVolume - sellVolume // Use the absolute value of the volume delta as weight absVolDelta = math.abs(volDelta) // VDWMA vdwma = ta.vwma(close * absVolDelta, vdwmalength) / ta.vwma(absVolDelta, vdwmalength) vdwmac = ta.vwma(close * absVolDelta, vdwmalengthfast) / ta.vwma(absVolDelta, vdwmalengthfast) // Barcolor Logik up = vdwmac > vdwma and close > vdwmac down = vdwmac < vdwma and close < vdwmac barcolor(up ? upper_color : down ? lower_color : middle_color) // Resistance and Support resistance = ta.highest(close, resistance_length) support = ta.lowest(close, support_length) resistanceh = ta.highest(high, resistance_length) supportl = ta.lowest(low, support_length) // RSI rsiValue = ta.rsi(close, rsi1_period) // Search for highest/lowest points priceHigh = ta.highest(high, rsi1_period) priceLow = ta.lowest(low, rsi1_period) rsiHigh = ta.highest(rsiValue, rsi1_period) rsiLow = ta.lowest(rsiValue, rsi1_period) // Find the divergences bearishDiv = high == priceHigh and rsiValue < rsiHigh bullishDiv = low == priceLow and rsiValue > rsiLow // OI RSI Code // These two lines create user inputs that allow the user to override the default symbol bool overwriteSymbolInput = input.bool(false, "Override symbol", inline = "Override symbol") string tickerInput = input.symbol("", "", inline = "Override symbol") // This checks if the user has chosen to override the default symbol. If they have, it uses the inputted symbol. If not, it uses the default. string symbolOnly = syminfo.ticker(tickerInput) string userSymbol = overwriteSymbolInput ? symbolOnly : syminfo.prefix + ":" + syminfo.ticker // This creates the symbol for the open interest data and determines the timeframe for the data string openInterestTicker = str.format("{0}_OI", userSymbol) string timeframe = syminfo.type == "futures" and timeframe.isintraday ? "1D" : timeframe.period // This line requests the open, high, low, and close of the open interest data [oiOpen, oiHigh, oiLow, oiClose, oiColorCond] = request.security(openInterestTicker, timeframe, [open, high, low, close, close > close[1]], ignore_invalid_symbol = true) // This checks if there's any missing open interest data, and if so, returns an error message if barstate.islastconfirmedhistory and na(oiClose) runtime.error(str.format("No Open Interest data found for the `{0}` symbol.", userSymbol)) // Creates the OI RSI oiRSI = ta.rsi(oiClose, oirsiPeriod) // Signal Logic oib = ((oiRSI > 70 and rsiValue < 30) or (oiRSI < 30 and rsiValue < 30)) and not (oiOpen > oiClose) ois = ((oiRSI < 30 and rsiValue > 70) or (oiRSI > 70 and rsiValue > 70)) and not (oiOpen < oiClose) // Plot Signals bgcolor(oib ? color.new(color.green, 30) : na) bgcolor(ois ? color.new(color.red, 30) : na) // Buy and Sell Signals Logic newsell = resistance[1] == resistance and high >= resistance and close < resistance and bearishDiv newbull = support[1] == support and low <= support and close > support and bullishDiv // Draw support and resistance lines and signals r1 = plot(resistance, color=color.new(color.rgb(253, 0, 241), 100), title = "Resistance Close") s1 = plot(support, color=color.new(color.rgb(253, 0, 241), 100), title = "Support Close") r2 = plot(resistanceh, color=color.new(color.rgb(253, 0, 241), 100), title = "Resistance High") s2 = plot(supportl, color=color.new(color.rgb(253, 0, 241), 100), title = "Support Low") fill(r1, r2, color = color.new(color.purple, 80), title = "Resistance Fill Color") fill(s1, s2, color = color.new(color.purple, 80), title = "Support Fill Color") // Draws VDWMA Fast and slow plot(vdwmac, color=color.new(color.blue, 0), title = "VDWMA Fast") plot(vdwma, color=color.new(#000000, 0), title = "VDWMA Slow" ) // Draws signals plotshape(newbull, title="Buy", location=location.belowbar, color=color.green, style=shape.labelup, text="b", textcolor = color.white) plotshape(newsell, title="Sell", location=location.abovebar, color=color.red, style=shape.labeldown, text="s", textcolor = color.white) plotshape(bearishDiv, title="Bearish Divergence", location=location.abovebar, color=color.red, style=shape.triangledown, size = size.tiny) plotshape(bullishDiv, title="Bullish Divergence", location=location.belowbar, color=color.green, style=shape.triangleup, size = size.tiny) // Alerts alertcondition(condition = newbull, title = "buy", message = "Buy") alertcondition(condition = newsell, title = "sell", message = "Sell") alertcondition(condition = bullishDiv, title = "Bullisch Divergence", message = "Bullisch Divergence") alertcondition(condition = bearishDiv, title = "Bearisch Divergence", message = "Bearisch Divergence") alertcondition(condition = oib, title = "Bullisch OI RSI Signal", message = "Bullisch OI RSI Signal") alertcondition(condition = ois, title = "Bearisch OI RSI Signal", message = "Bearisch OI RSI Signal") combined_alert = newbull or newsell or bullishDiv or bearishDiv or oib or ois alertcondition(combined_alert, title='Combined Alert', message='A signal has triggered!')
ICT True Day Range [MK]
https://www.tradingview.com/script/8I87kv7I-ICT-True-Day-Range-MK/
malk1903
https://www.tradingview.com/u/malk1903/
106
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ malk1903 // @version=5 indicator(title="ICT True Day Range [MK]", shorttitle="True Day Range [MK]", overlay=true, max_lines_count=500) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Inputs mid_hl = input.bool(defval=true, title="Daily Range + Days of Week", inline='2', group="Enable Disable Sections--------------------------------------") monds = input.bool(true, "Monday H/L/Mid", inline='3', group="Enable Disable Sections--------------------------------------") i_hline = input.bool(true, "Midnight Open Line", inline='4', group="Enable Disable Sections--------------------------------------") i_hline2 = input.bool(true, "08:30 Open Line", inline='4', group="Enable Disable Sections--------------------------------------") wkOPN = input.bool(title='Week Open', defval=true, inline='3', group="Enable Disable Sections--------------------------------------") tzone = input.string("GMT-4", "Timezone", options=["GMT+0", "GMT+1", "GMT+2", "GMT+3","GMT+4","GMT+5","GMT+6","GMT+7","GMT+8","GMT+9","GMT+10","GMT+11","GMT+12","GMT-1", "GMT-2", "GMT-3","GMT-4","GMT-5","GMT-6","GMT-7","GMT-8","GMT-9","GMT-10","GMT-11","GMT-12"], inline='5', group="Enable Disable Sections--------------------------------------") i_maxtf_dr = input.int (60, "Max Timeframe", 1, 240, inline='5', group="Enable Disable Sections--------------------------------------") disp_dr = timeframe.isintraday and timeframe.multiplier <= i_maxtf_dr //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Days of Week dow_colour = input.color(color.new(color.silver,0), title='Days of Week', inline='01', group="Days of the Week--------------------------------") var minuteFix = 0 if timeframe.ismonthly or timeframe.isweekly or timeframe.isdaily minuteFix := 59 minuteFix plotshape(mid_hl and disp_dr ? hour == 11 and minute == minuteFix and dayofweek == dayofweek.monday : false, text='Monday', color=color.new(color.white, 100), offset=0, style=shape.diamond, textcolor=dow_colour, size=size.normal, location=location.bottom) plotshape(mid_hl and disp_dr ? hour == 11 and minute == minuteFix and dayofweek == dayofweek.tuesday : false, text='Tuesday', color=color.new(color.white, 100), offset=0, style=shape.diamond, textcolor=dow_colour, size=size.normal, location=location.bottom) plotshape(mid_hl and disp_dr ? hour == 11 and minute == minuteFix and dayofweek == dayofweek.wednesday : false, text='Wednesday', color=color.new(color.white, 100), offset=0, style=shape.diamond, textcolor=dow_colour, size=size.normal, location=location.bottom) plotshape(mid_hl and disp_dr ? hour == 11 and minute == minuteFix and dayofweek == dayofweek.thursday : false, text='Thursday', color=color.new(color.white, 100), offset=0, style=shape.diamond, textcolor=dow_colour, size=size.normal, location=location.bottom) plotshape(mid_hl and disp_dr ? hour == 11 and minute == minuteFix and dayofweek == dayofweek.friday : false, text='Friday/Sunday', color=color.new(color.white, 100), offset=0, style=shape.diamond, textcolor=dow_colour, size=size.normal, location=location.bottom) plotshape(mid_hl and disp_dr ? hour == 11 and minute == minuteFix and dayofweek == dayofweek.saturday : false, text='Saturday', color=color.new(color.white, 100), offset=0, style=shape.diamond, textcolor=dow_colour, size=size.normal, location=location.bottom) plotshape(mid_hl and disp_dr ? hour == 11 and minute == minuteFix and dayofweek == dayofweek.sunday : false, text='Sunday', color=color.new(color.white, 100), offset=0, style=shape.diamond, textcolor=dow_colour, size=size.normal, location=location.bottom) //////////////////////////////////////////////////////////////////////////////////////////////Vline for Days of the Week //Vertical Day Seperator EST midnight // === Used By Both Methods Below === openHourk2 = 23 openMinutek2 = 00 isHourk2 = hour == openHourk2 isMinutek2 = minute == openMinutek2 vline_colour = input.color(color.new(color.silver,0), title='Day Seperator', inline='01', group="Day Seperator") i_vline_style = input.string(defval="Solid", title="", options=["Solid", "Dotted", "Dashed"], inline='01', group="Day Seperator") vwidth = input.int(1, title="Width", inline='01', group="Day Seperator") vline_style = i_vline_style == "Solid" ? line.style_solid : i_vline_style == "Dotted" ? line.style_dotted : line.style_dashed // === Method Line === vline2(BarIndex, Color, LineStyle, LineWidth) => // Verticle Line Function, โ‰ˆ50-54 lines maximum allowable per indicator reTurn = line.new(BarIndex, low - ta.tr, BarIndex, high + ta.tr, xloc.bar_index, extend.both, Color, LineStyle, LineWidth) // Suitable for study(overlay=true) if(mid_hl and isHourk2 and isMinutek2) and disp_dr vline2(bar_index,vline_colour, vline_style, vwidth) // Variable assignment not required inSession(sessionTime, sessionTimeZone=syminfo.timezone) => not na(time(timeframe.period, sessionTime, sessionTimeZone)) /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Monday High/Low/Mid var market_open_day_of_week = input.string(title='What day of the week does the market open?', options=['Sunday', 'Monday'], defval='Sunday', group="Monday High/Low/Mid") // Some exchanges open sunday evening vs crypto std monday var bars_extended_to_week_end = input(title='Extend bars to end of week?', defval=false, inline='2') monmid = input.bool(defval=true, title="Show Midline", inline='2') var bars_extent = input.int(title='Length of bars', defval=150, minval=1, maxval=300) var line_colour = input.color(color.new(color.fuchsia,0), title='Line Color', inline='01') mline_style = input.string(defval="dashed (โ•Œ)", title="", options=["solid (โ”€)", "dotted (โ”ˆ)", "dashed (โ•Œ)"], inline='01') mondaywidth = input.int(2, title="Width", inline='01') monday_open_time = request.security(syminfo.tickerid, 'D', time('D'), lookahead=barmerge.lookahead_on) monday_high = request.security(syminfo.tickerid, 'D', high, lookahead=barmerge.lookahead_on) monday_low = request.security(syminfo.tickerid, 'D', low, lookahead=barmerge.lookahead_on) monday_midpoint = math.avg(monday_high, monday_low) is_monday() => dayofweek(time('D')) == (market_open_day_of_week == 'Sunday' ? dayofweek.sunday : dayofweek.monday) and close ? true : false var can_show_monday_range = not timeframe.isweekly and not timeframe.ismonthly and not timeframe.isseconds // dont show above daily or below minutes // Function the converts string inputs to line style code line_style_function(input_var) => switch input_var "dotted (โ”ˆ)" => line.style_dotted "dashed (โ•Œ)" => line.style_dashed => line.style_solid i_mline_style = line_style_function(mline_style) line_end_bars = if bars_extended_to_week_end // Calculate the bars until the end of the week // timeframe.multiplier is either daily or minutes if timeframe.isdaily 7 else 1440 / timeframe.multiplier * 7 // (mins in day / multiplier) * days in a week else bars_extent line_end_right = monday_open_time + (time - time[1]) * line_end_bars // extend line until the end of the week or number of bars chosen if is_monday() and monds and disp_dr // Monday high monday_high_text = 'MH ' var monday_high_line = line.new(x1=monday_open_time, x2=line_end_right, y1=monday_high, y2=monday_high, color=line_colour, width=mondaywidth, xloc=xloc.bar_time, style=i_mline_style) var monday_high_label = label.new(x=line_end_right, y=monday_open_time, text=monday_high_text, style=label.style_none, textcolor=line_colour, size=size.small, xloc=xloc.bar_time) line.set_x1(monday_high_line, monday_open_time) line.set_x2(monday_high_line, line_end_right) line.set_y1(monday_high_line, monday_high) line.set_y2(monday_high_line, monday_high) label.set_x(monday_high_label, line_end_right) label.set_y(monday_high_label, monday_high) // Monday low monday_low_text = 'ML ' var monday_low_line = line.new(x1=monday_open_time, x2=line_end_right, y1=monday_low, y2=monday_low, color=line_colour, width=mondaywidth, xloc=xloc.bar_time, style=i_mline_style) var monday_low_label = label.new(x=line_end_right, y=monday_open_time, text=monday_low_text, style=label.style_none, textcolor=line_colour, size=size.small, xloc=xloc.bar_time) line.set_x1(monday_low_line, monday_open_time) line.set_x2(monday_low_line, line_end_right) line.set_y1(monday_low_line, monday_low) line.set_y2(monday_low_line, monday_low) label.set_x(monday_low_label, line_end_right) label.set_y(monday_low_label, monday_low) // Monday mid if monmid monday_mid_text = 'MID ' var monday_mid_line = line.new(x1=monday_open_time, x2=line_end_right, y1=monday_midpoint, y2=monday_midpoint, color=line_colour, width=mondaywidth, xloc=xloc.bar_time, style=i_mline_style) var monday_mid_label = label.new(x=line_end_right, y=monday_open_time, text=monday_mid_text, style=label.style_none, textcolor=line_colour, size=size.small, xloc=xloc.bar_time) line.set_x1(monday_mid_line, monday_open_time) line.set_x2(monday_mid_line, line_end_right) line.set_y1(monday_mid_line, monday_midpoint) line.set_y2(monday_mid_line, monday_midpoint) label.set_x(monday_mid_label, line_end_right) label.set_y(monday_mid_label, monday_midpoint) //////Midnight Line i_time = '0000-0001:1234567'//input.session ('0000-0001:1234567', "New York", tooltip="Different exchanges will have difference time zones so change accordingly.", group="Opening Line") i_time2 = '0830-0831:1234567'//input.session ('0830-0831:1234567', "New York", tooltip="Different exchanges will have difference time zones so change accordingly.", group="Opening Line") opening = "Opening Lines--------------------------------------" i_linecol = input.color (#0064ff, "Midnight Line", inline="in1", group=opening) i_linecol2 = input.color (color.new(color.yellow,25), "08:30 Line", inline="in2", group=opening) i_linestyle = input.string ("Solid", "", options=["Solid", "Dotted", "Dashed"], inline="in1", group=opening) i_linestyle2 = input.string ("Dashed", "", options=["Solid", "Dotted", "Dashed"], inline="in2", group=opening) mid_w = input.int (defval=2, title="Width", inline="in1", group=opening) eight_w = input.int (defval=2, title="Width", inline="in2", group=opening) i_ex = "None" // MISC nymid = time ("1", i_time, tzone) open_830 = time ("1", i_time2, tzone) linestyle = i_linestyle == "Solid" ? line.style_solid : i_linestyle == "Dotted" ? line.style_dotted : line.style_dashed linestyle2 = i_linestyle2 == "Solid" ? line.style_solid : i_linestyle2 == "Dotted" ? line.style_dotted : line.style_dashed ex = "None" htime = i_ex == "+1 Day" ? 172800000 : 86400000//extends 00:00 line to midnight - for midnight sessions htime2 = i_ex == "+1 Day" ? 172800000 : 55800000//extends 0830 line to midnight - for midnight sessions dow = dayofweek == dayofweek.friday ? 259200000 : 86400000 dow2 = dayofweek == dayofweek.friday ? 172800000 : 86400000 //this is for asia coming out of weekend dow3 = dayofweek == dayofweek.friday ? 172800000 : 0 var openprice = 0.0 if nymid if not nymid[1] openprice := open else openprice := math.max(open, openprice) // OBJECTS var label lb = na if openprice != openprice[1] and i_hline and disp_dr var line lne = na line.set_x2(lne, nymid) line.set_extend(lne, extend.none) lne := line.new(nymid, openprice, nymid + htime + dow3, openprice, xloc.bar_time, extend=extend.none, color=i_linecol, style=linestyle, width=mid_w) //0830 Line var openprice2 = 0.0 if open_830 if not open_830[1] openprice2 := open else openprice2 := math.max(open, openprice2) // OBJECTS var label lb2 = na if openprice2 != openprice2[1] and i_hline2 and disp_dr var line lne2 = na // line.set_x2(lne2, open_830) line.set_extend(lne2, extend.none) lne2 := line.new(open_830, openprice2, open_830 + htime2 + dow3, openprice2, xloc.bar_time, extend=extend.none, color=i_linecol2, style=linestyle2, width=eight_w) ////////////////////////////////////////////////////////////////////////////////////////Session High/Lows //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ reghl_c = input.color(color.new(color.white,50), 'High/Low Lines' , inline = '1', group ="Session H/L------------------------------") i_hl_style = input.string ("Solid", "", options=["Solid", "Dotted", "Dashed"], inline = '1', group ="Session H/L------------------------------") reghl_w = input.int(defval=1, title='Width', inline = '1', group ="Session H/L------------------------------") hl_style = i_hl_style == "Solid" ? line.style_solid : i_hl_style == "Dotted" ? line.style_dotted : line.style_dashed //-----------------------------------------------------------------------------} //UDT's //-----------------------------------------------------------------------------{ type session_range line max line min //-----------------------------------------------------------------------------} //Methods //-----------------------------------------------------------------------------{ n = bar_index //Method for setting session range maximum/minimum method set_range(session_range id)=> max = math.max(high, id.max.get_y2()) min = math.min(low, id.min.get_y2()) id.max.set_xy2(n, max) id.max.set_y1(max) id.min.set_xy2(n, min) id.min.set_y1(min) //-----------------------------------------------------------------------------} //Variables //-----------------------------------------------------------------------------{ var chartCss = color.new(color.white,50) var session_range sesr = na //-----------------------------------------------------------------------------} //New session - NY Midnight Hours //-----------------------------------------------------------------------------{ //On new session if(isHourk2 and isMinutek2) and mid_hl and disp_dr //Set delimiter line.new(n, high + syminfo.mintick , n, low - syminfo.mintick , color = chartCss , style = line.style_dashed , extend = extend.both) //Set new range sesr := session_range.new( line.new(n, high, n, high, color = chartCss, style=hl_style, width=reghl_w) , line.new(n, low, n, low, color = chartCss, style=hl_style, width=reghl_w)) //Set range else if not na(sesr) sesr.set_range() //Set range lines color sesr.max.set_color(reghl_c) sesr.min.set_color(reghl_c) wkOPN_clr = input.color(color.new(color.orange, 0), title="Week Open Line", group="Week Open-------------------------------------------------------", inline = "4") WkStyle = input.string ("Solid", "", options=["Solid", "Dotted", "Dashed"], group="Week Open-------------------------------------------------------", inline = "4") linewidths = input.int(defval=2, title="Width", group="Week Open-------------------------------------------------------", inline = "4") //linestyles _WkStyle = WkStyle == "Solid" ? line.style_solid : WkStyle == "Dotted" ? line.style_dotted : line.style_dashed //Fri_PM = input.session(defval="0830-1600", title="Friday hours to show 20-30% levels")//input.session(title='Display Period', defval='1300-1600:6', inline="2", group="Friday Only-------------------------------------------------------", tooltip="20-30% box will only be shown during this session period, default is to only show during friday PM session") Wk_sess = '1800-1700' //Weekly New Bar is_newbar2(sess) => t = time('W', sess, tzone) na(t[1]) and not na(t) or t[1] < t is_session2(sess) => not na(time('W', sess, tzone)) //New Week WeekNewbar = is_newbar2(Wk_sess) WeekSession = is_session2(Wk_sess) ///////new weekbox high low and level boxes if WeekSession and disp_dr /////////////////////////////////////////// float WkOpen = na WkOpen := if WeekSession if WeekNewbar open else WkOpen[1] ///////////////////////////////////////// int WkStart = na WkStart := if WeekSession if WeekNewbar time else math.min(WkStart[1], time) else na int WkEnd = na WkEnd := if WeekSession if WeekNewbar time_close else math.max(WkEnd[1], time_close) else na weeklyopen = if WeekNewbar weeklyopen = wkOPN ? line.new(WkStart, WkOpen, WkEnd, WkOpen, xloc = xloc.bar_time, style = _WkStyle, width = linewidths, color = wkOPN_clr) : na if not WeekNewbar line.set_x2(weeklyopen[1], WkEnd) line.set_y1(weeklyopen[1], WkOpen) line.set_y2(weeklyopen[1], WkOpen)
[GTH decimals heatmap] (wide screen advised)
https://www.tradingview.com/script/gODo96lh-GTH-decimals-heatmap-wide-screen-advised/
gehteha
https://www.tradingview.com/u/gehteha/
6
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ gehteha //@version=5 indicator("[GTH decimals heatmap]", overlay = false) pre = input.bool(false, "Pre-market", tooltip = "ETH must be selected on the chart") main = input.bool(true, "Main market", tooltip = "If only \"Main market\" is chosen, select RTH on the chart to have more data available.") post = input.bool(false, "Post-market", tooltip = "ETH must be selected on the chart") size_x = input.string(defval = size.tiny, title = "Size X", options = [size.auto, size.tiny, size.small, size.normal, size.large, size.huge]) size_y = input.string(defval = size.auto, title = "Size Y", options = [size.auto, size.tiny, size.small, size.normal, size.large, size.huge]) norm = input.bool(defval=false, title = "Normalize", tooltip = "If actived, black is assigned to the lowest number of occurrences. Otherwise, black is assigned to zero occurrences.") prt_val = input.bool(false, title = "Print Values") var o_cents = array.new_int(100, 0) var h_cents = array.new_int(100, 0) var l_cents = array.new_int(100, 0) var c_cents = array.new_int(100, 0) var col_hi = color.white var col_lo = color.black var hm_color = col_hi var tbl_hdr_col = col_lo var tbl = table.new(position = position.bottom_center, columns = 101, rows = 5, bgcolor = col_lo, frame_color = color.white, frame_width = 1) cl(val, min, max) => mn = norm ? min : 0 st = (max - mn) / 100 100 - ((val - mn) / st) // frac(v) => i = (math.round(v, 2) - int(v)) * 100 int ret = 0 for a = 0 to 99 if i == a ret := a break ret // col(v, mn, mx) => if v == mn color.white else if v == mx color.black else if v > 50 color.white else color.black // set_field(src, min, max, i, c) => tmp = cl(src, min, max) table.cell_set_text_color(tbl, i+1, c, col(tmp, min, max)) table.cell_set_bgcolor(tbl, i+1, c, color.new(hm_color, tmp)) table.cell_set_text_size(tbl, i+1, c, size_x) if src == min table.cell_set_bgcolor(tbl, i+1, c, color.rgb(0, 0, 255)) table.cell_set_text_color(tbl, i+1, c, color.white) if src == max table.cell_set_bgcolor(tbl, i+1, c, color.rgb(134, 201, 255)) table.cell_set_text_color(tbl, i+1, c, color.black) // inc(ar, i) => array.set(ar, i, array.get(ar, i) + 1) // if (session.ispremarket and pre) or (session.ispostmarket and post) or (session.ismarket and main) o_fr = frac(open) h_fr = frac(high) l_fr = frac(low) c_fr = frac(close) inc(o_cents, o_fr) inc(h_cents, h_fr) inc(l_cents, l_fr) inc(c_cents, c_fr) if barstate.isfirst table.cell(tbl, 0, 0, "", text_color = color.white, bgcolor = tbl_hdr_col, text_size = size_x) table.cell(tbl, 0, 1, "O", text_color = color.white, bgcolor = tbl_hdr_col, text_size = size_y) table.cell(tbl, 0, 2, "H", text_color = color.white, bgcolor = tbl_hdr_col, text_size = size_y) table.cell(tbl, 0, 3, "L", text_color = color.white, bgcolor = tbl_hdr_col, text_size = size_y) table.cell(tbl, 0, 4, "C", text_color = color.white, bgcolor = tbl_hdr_col, text_size = size_y) for a = 1 to 100 table.cell(tbl, a, 0, str.tostring(a-1, "00"), text_color = (a==51) ? color.black : color.white, bgcolor = (a==51) ? color.white : color.black, text_size = size_x) if barstate.islastconfirmedhistory max_o = array.max(o_cents) max_h = array.max(h_cents) max_l = array.max(l_cents) max_c = array.max(c_cents) min_o = array.min(o_cents) min_h = array.min(h_cents) min_l = array.min(l_cents) min_c = array.min(c_cents) for a = 0 to 99 o = array.get(o_cents, a) h = array.get(h_cents, a) l = array.get(l_cents, a) c = array.get(c_cents, a) if prt_val table.cell_set_text(tbl, a+1, 1, str.tostring(o,"#")) set_field(o, min_o, max_o, a, 1) // if prt_val table.cell_set_text(tbl, a+1, 2, str.tostring(h,"#")) set_field(h, min_h, max_h, a, 2) if prt_val table.cell_set_text(tbl, a+1, 3, str.tostring(l,"#")) set_field(l, min_l, max_l, a, 3) if prt_val table.cell_set_text(tbl, a+1, 4, str.tostring(c,"#")) set_field(c, min_c, max_c, a, 4) curr_dec_idx = frac(close) + 1 if barstate.islast if curr_dec_idx[1] == 51 table.cell_set_bgcolor(tbl, curr_dec_idx[1], 0, color.white) table.cell_set_text_color(tbl, curr_dec_idx[1], 0, color.black) else table.cell_set_bgcolor(tbl, curr_dec_idx[1], 0, color.black) table.cell_set_text_color(tbl, curr_dec_idx[1], 0, color.white) table.cell_set_bgcolor(tbl, curr_dec_idx, 0, color.red) table.cell_set_text_color(tbl, curr_dec_idx, 0, color.white)
ICT Time Indicator - Minimalistic
https://www.tradingview.com/script/Hb0z3RMN-ICT-Time-Indicator-Minimalistic/
SuspiciousAvocado
https://www.tradingview.com/u/SuspiciousAvocado/
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/ // ยฉ SuspiciousAvocado //@version=5 indicator(title = 'ICT Time Indicator - Minimalistic', shorttitle = 'ICT Time Indicator') // Constants ny_timezone = string('America/New_York') // Inputs group_time = 'Time Settings (New York Time):' title_am = "Morning Session" title_lunch = "Lunch" title_pm = "Afternoon Session" title_marco_0950_1010 = "Marco 0950-1010" title_marco_1050_1110 = "Marco 1050-1110" title_marco_1450_1510 = "Marco 1450-1510" title_silver_bullet_london = "Silver Bullet London Open" title_silver_bullet_7_830 = "Silver Bullet 7-8:30 NY" title_silver_bullet_am = "Silver Bullet AM" title_silver_bullet_pm = "Silver Bullet PM" title_silver_bullet_final_hour = "Silver Bullet Final Hour" bool_show_am = input.bool(defval=false, title='', inline='s1', group=group_time) session_am = input.session(defval='0830-1201', title=title_am, inline='s1', group=group_time) bool_show_lunch = input.bool(defval=false, title='', inline='s2', group=group_time) session_lunch = input.session(defval='1201-1301', title=title_lunch, inline='s2', group=group_time) bool_show_pm = input.bool(defval=false, title='', inline='s3', group=group_time) session_pm = input.session(defval='1301-1631', title=title_pm, inline='s3', group=group_time) bool_show_marco_0950_1010 = input.bool(defval=true, title='', inline='s4', group=group_time) session_marco_0950_1010 = input.session(defval='0950-1011', title=title_marco_0950_1010, inline='s4', group=group_time) bool_show_marco_1050_1110 = input.bool(defval=true, title='', inline='s5', group=group_time) session_marco_1050_1110 = input.session(defval='1050-1111', title=title_marco_1050_1110, inline='s5', group=group_time) bool_show_marco_1450_1510 = input.bool(defval=true, title='', inline='s6', group=group_time) session_marco_1450_1510 = input.session(defval='1450-1511', title=title_marco_1450_1510, inline='s6', group=group_time) bool_show_silver_bullet_london = input.bool(defval=true, title='', inline='s7', group=group_time) session_silver_bullet_london = input.session(defval='0300-0401', title=title_silver_bullet_london, inline='s7', group=group_time) bool_show_silver_bullet_7_830 = input.bool(defval=false, title='', inline='s8', group=group_time) session_silver_bullet_7_830 = input.session(defval='0700-0831', title=title_silver_bullet_7_830, inline='s8', group=group_time) bool_show_silver_bullet_am = input.bool(defval=true, title='', inline='s9', group=group_time) session_silver_bullet_am = input.session(defval='1000-1101', title=title_silver_bullet_am, inline='s9', group=group_time) bool_show_silver_bullet_pm = input.bool(defval=true, title='', inline='s10', group=group_time) session_silver_bullet_pm = input.session(defval='1400-1501', title=title_silver_bullet_pm, inline='s10', group=group_time) bool_show_silver_bullet_final_hour = input.bool(defval=false, title='', inline='s11', group=group_time) session_silver_bullet_final_hour = input.session(defval='1500-1601', title=title_silver_bullet_final_hour, inline='s11', group=group_time) group_bar = 'Visual Settings:' color_session = input.color(#2a2e39, title='Session', group = group_bar) color_lunch = input.color(#ffffff00, title='Lunch', group = group_bar) color_marco = input.color(#787b86, title='Marco', group = group_bar) color_silver_bullet = input.color(#b2b5be, title='Silver Bullet', group = group_bar) int_line_width = input.int(1, title='Thickness', group = group_bar) // Calculations time_am = time(timeframe = timeframe.period, session = session_am, timezone = ny_timezone) time_lunch = time(timeframe = timeframe.period, session = session_lunch, timezone = ny_timezone) time_pm = time(timeframe = timeframe.period, session = session_pm, timezone = ny_timezone) time_marco_0950_1010 = time(timeframe = timeframe.period, session = session_marco_0950_1010, timezone = ny_timezone) time_marco_1050_1010 = time(timeframe = timeframe.period, session = session_marco_1450_1510, timezone = ny_timezone) time_marco_1450_1510 = time(timeframe = timeframe.period, session = session_marco_1450_1510, timezone = ny_timezone) time_silver_bullet_london = time(timeframe = timeframe.period, session = session_silver_bullet_london, timezone = ny_timezone) time_silver_bullet_7_830 = time(timeframe = timeframe.period, session = session_silver_bullet_7_830, timezone = ny_timezone) time_silver_bullet_am = time(timeframe = timeframe.period, session = session_silver_bullet_am, timezone = ny_timezone) time_silver_bullet_pm = time(timeframe = timeframe.period, session = session_silver_bullet_pm, timezone = ny_timezone) time_silver_bullet_final_hour = time(timeframe = timeframe.period, session = session_silver_bullet_final_hour, timezone = ny_timezone) var line_color = color(#ffffff00) if ((time_marco_0950_1010 and bool_show_marco_0950_1010) or (time_marco_1050_1010 and bool_show_marco_1050_1110) or (time_marco_1450_1510 and bool_show_marco_1450_1510)) line_color := color_marco else if ((time_silver_bullet_london and bool_show_silver_bullet_london) or (time_silver_bullet_7_830 and bool_show_silver_bullet_7_830) or (time_silver_bullet_am and bool_show_silver_bullet_am) or (time_silver_bullet_pm and bool_show_silver_bullet_pm)) or (time_silver_bullet_final_hour and bool_show_silver_bullet_final_hour) line_color := color_silver_bullet else if ((time_am and bool_show_am) or (time_pm and bool_show_pm)) line_color := color_session else if (time_lunch and bool_show_lunch) line_color := color_lunch else line_color := color(#ffffff00) // Plots plot_condition = na(time_am) or na(time_lunch) or na(time_pm) or na(time_marco_0950_1010) or na(time_marco_1050_1010) or na(time_marco_1450_1510) or na(time_silver_bullet_london) or na(time_silver_bullet_am) or na(time_silver_bullet_pm) plot(plot_condition ? 0:na, style=plot.style_columns, linewidth = int_line_width, histbase = int_line_width, color=line_color, title='Plot')
MACDV
https://www.tradingview.com/script/eEMacXQx-MACDV/
Options360
https://www.tradingview.com/u/Options360/
41
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ Options360 // 10/7/23 update: fine tune default input lengths, add a total line option, add a PVT or AD option, add a bullish or bearish tiny dot option. // 10/14/23 update: add 6 volume source options: Accumulation Distribution, Price Volume Trend, Positive Volume Index, On Balance Volume, Money Flow Index, Average of all 5. //@version=5 indicator("MACDV") // len2 = input.int(7, 'K length', minval=1, tooltip='Stochastic accumulation / distribution length') len = input.int(3, 'D smoothing', minval=1, tooltip='Smoothing stochastic accumulation / distribution volume weighted moving average') fa = input.int(6, 'MACDV fast', minval=1, tooltip='MACDV fast length line') sl = input.int(13, 'MACDV slow', minval=1, tooltip='MACDV slow length line') sig = input.int(4, 'MACDV signal', minval=1, tooltip='MACDV histogram length') mult = input.int(2, 'stretch', minval=1, tooltip='Output multiplier for MACDV visual expansion') total = input.int(1, 'total', minval=1, tooltip='Moving average of all 3 : MACDV fast + MACDV slow + MACDV histogram / 3') // normalize(src, min, max) => var historicMin = 10e10 var historicMax = -10e10 historicMin := math.min(nz(src, historicMin), historicMin) historicMax := math.max(nz(src, historicMax), historicMax) min + (max - min) * (src - historicMin) / math.max(historicMax - historicMin, 10e-10) // var cumVol = 0. cumVol += nz(volume) ad = ta.cum(close==high and close==low or high==low ? 0 : ((2*close-low-high)/(high-low))*volume) ad2 = ta.sma(ta.stoch(ad, ad, ad, len2), len) pvt = ta.pvt pvt2 = ta.sma(ta.stoch(pvt, pvt, pvt, len2), len) pvi = ta.pvi pvi2 = ta.sma(ta.stoch(pvi, pvi, pvi, len2), len) obv = ta.obv obv2 = ta.sma(ta.stoch(obv, obv, obv, len2), len) mfi = ta.mfi(ohlc4, len) mfi2 = ta.sma(ta.stoch(mfi, mfi, mfi, len2), len) all = (ad2 + pvt2 + pvi2 + obv2 + mfi2)/5 // string v01 = "AD" string v02 = "PVT" string v03 = "PVI" string v04 = "OBV" string v05 = "MFI" string v06 = "ALL" string GRP = "Settings" string vType = input.string(v02, "Volume Type", group = GRP, options = [v01, v02, v03, v04, v05, v06], tooltip='Accumulation Distribution, Price Volume Trend, Positive Volume Index, On Balance Volume, Money Flow Index, Average of all 5') v(simple string type) => float result = switch type v01 => ad2 v02 => pvt2 v03 => pvi2 v04 => obv2 v05 => mfi2 v06 => all => na // A = v(vType) B = normalize(A, -100, 100) C = B * mult // up = #3cfe12 up2 = #4e8642 down2 = #8c2121 down = #ff0202 // [macdLine, signalLine, histLine] = ta.macd(C, fa, sl, sig) plot(histLine * 2, 'Histogram', style=plot.style_area, color=(histLine>=0 ? (histLine[1] < histLine ? up : up2) : (histLine[1] < histLine ? down2 : down))) plot(macdLine, 'MACD fast', linewidth=2, color=color.new(#008eff, 0)) plot(signalLine, 'MACD slow', linewidth=2, color=color.new(#ffffff, 0)) t = ta.sma((macdLine + signalLine + histLine)/3, total) plot(t, 'total', linewidth=2, color=(t[1] < t ? up : down), display=display.none) // long = ta.crossover(macdLine, signalLine) plotshape(long, title='long', style=shape.circle, location=location.bottom, color=(#3cfe12), size=size.tiny) bull = ta.rising(histLine, 1) plotchar(bull, title='bullish', char=".", location=location.bottom, color=(#3cfe12), size=size.tiny) short = ta.crossunder(macdLine, signalLine) plotshape(short, title='short', style=shape.circle, location=location.top, color=(#ff0202), size=size.tiny) bear = ta.falling(histLine, 1) plotchar(bear, title='bearish', char=".", location=location.top, color=(#ff0202), size=size.tiny) // h0 = hline(100, 'top', color=#989595, linestyle=hline.style_dotted) h1 = hline(75, '75', color=#989595, linestyle=hline.style_dotted, display=display.none) h2 = hline(50, '50', color=#989595, linestyle=hline.style_dotted) h3 = hline(25, '25', color=#989595, linestyle=hline.style_dotted, display=display.none) h4 = hline(0, '0', color=#989595, linestyle=hline.style_dashed) h5 = hline(-25, '-25', color=#989595, linestyle=hline.style_dotted, display=display.none) h6 = hline(-50, '-50', color=#989595, linestyle=hline.style_dotted) h7 = hline(-75, '-75', color=#989595, linestyle=hline.style_dotted, display=display.none) h8 = hline(-100, 'bottom', color=#989595, linestyle=hline.style_dotted)
Personal Trading Hours (timezone Europe/Amsterdam)
https://www.tradingview.com/script/4DXs9UCu-Personal-Trading-Hours-timezone-Europe-Amsterdam/
chrismariatrader
https://www.tradingview.com/u/chrismariatrader/
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/ // ยฉ chrismariatrader // Originaly created for the students of fxminds.nl for backtesting purposes on the days and times that they are able to trade on. // But it can also be used for live trading when you, for example, want to filter out opening times or times that important news is released. // Can be used on timeframes that are LOWER than the Daily timeframe. // If used on the Daily timeframe: in the above section of the settingsmenu all days must be unchecked and only the lower part of the settingsmenu can be used. // Can NOT be used on timeframes higher than the Daily timeframe. // Last updated 31-8-2023 // Version 1.0 //@version=5 indicator(title="Trading Hours with days and time input (timezone Europe/Amsterdam)", shorttitle="Trading Hours Europe/Amsterdam timezone", overlay=true) // Create the user inputs var G_Time_1 = "Trading Hours for Monday" monSession = input.bool(false, title="Trade on Monday", group=G_Time_1, tooltip="If you want to trade on Monday, check this box.") Mon1 = input.session(title="1st Session Monday", defval="0000-0000", group=G_Time_1, tooltip= "If you do not need the extra trading sessions below, make sure that the unused blocks have the same time periode as one of the used blocks") Mon2 = input.session(title="2nd Session Monday", defval="0000-0000", group=G_Time_1) Mon3 = input.session(title="3th Session Monday", defval="0000-0000", group=G_Time_1) var G_Time_2 = "Trading Hours for Tuesday" tueSession = input.bool(false, title="Trade on Tuesday", group=G_Time_2, tooltip="If you want to trade on Tuesday, check this box.") Tue1 = input.session(title="1st Session Tuesday", defval="0000-0000", group=G_Time_2, tooltip= "If you do not need the extra trading sessions below, make sure that the unused blocks have the same time periode as one of the used blocks") Tue2 = input.session(title="2nd Session Tuesday", defval="0000-0000", group=G_Time_2) Tue3 = input.session(title="3th Session Tuesday", defval="0000-0000", group=G_Time_2) var G_Time_3 = "Trading Hours for Wednesday" wedSession = input.bool(false, title="Trade on Wednesday", group=G_Time_3, tooltip="If you want to trade on Wednesday, check this box.") Wed1 = input.session(title="1st Session Wednesday", defval="0000-0000", group=G_Time_3, tooltip= "If you do not need the extra trading sessions below, make sure that the unused blocks have the same time periode as one of the used blocks") Wed2 = input.session(title="2nd Session Wednesday", defval="0000-0000", group=G_Time_3) Wed3 = input.session(title="3th Session Wednesday", defval="0000-0000", group=G_Time_3) var G_Time_4 = "Trading Hours for Thursday" thuSession = input.bool(false, title="Trade on Thursday", group=G_Time_4, tooltip="If you want to trade on Thursday, check this box.") Thu1 = input.session(title="1st Session Thursday", defval="0000-0000", group=G_Time_4, tooltip= "If you do not need the extra trading sessions below, make sure that the unused blocks have the same time periode as one of the used blocks") Thu2 = input.session(title="2nd Session Thursday", defval="0000-0000", group=G_Time_4) Thu3 = input.session(title="3th Session Thursday", defval="0000-0000", group=G_Time_4) var G_Time_5 = "Trading Hours for Friday" friSession = input.bool(false, title="Trade on Friday", group=G_Time_5, tooltip="If you want to trade on Friday, check this box.") Fri1 = input.session(title="1st Session Friday", defval="0000-0000", group=G_Time_5, tooltip= "If you do not need the extra trading sessions below, make sure that the unused blocks have the same time periode as one of the used blocks") Fri2 = input.session(title="2nd Session Friday", defval="0000-0000", group=G_Time_5) Fri3 = input.session(title="3th Session Friday", defval="0000-0000", group=G_Time_5) var G_Time_6 = "Trading Hours for Saturday" satSession = input.bool(false, title="Trade on Saturday", group=G_Time_6, tooltip="If you want to trade on Saturday, check this box.") Sat1 = input.session(title="1st Session Saturday", defval="0000-0000", group=G_Time_6, tooltip= "If you do not need the extra trading sessions below, make sure that the unused blocks have the same time periode as one of the used blocks") Sat2 = input.session(title="2nd Session Saturday", defval="0000-0000", group=G_Time_6) Sat3 = input.session(title="3th Session Saturday", defval="0000-0000", group=G_Time_6) var G_Time_7 = "Trading Hours for Sunday" sunSession = input.bool(false, title="Trade on Sunday", group=G_Time_7, tooltip="If you want to trade on Sunday, check this box.") Sun1 = input.session(title="1st Session Sunday", defval="0000-0000", group=G_Time_7, tooltip= "If you do not need the extra trading sessions below, make sure that the unused blocks have the same time periode as one of the used blocks") Sun2 = input.session(title="2nd Session Sunday", defval="0000-0000", group=G_Time_7) Sun3 = input.session(title="3th Session Sunday", defval="0000-0000", group=G_Time_7) var G_daily = "Want to trade only on Daily Chart?" daily_only = input.bool(false, title="Trade only on daily chart", group=G_daily, tooltip="If you want to trade only on the daily, check this box and make sure that all seperate days above are NOT checked, then check the boxes of the days you want to trade daily below. At least one of the days must be checked. You can't use these settings on other timeframes than the daily.") monSessionDay = input.bool(false, title="Mon", group=G_daily, inline="1") tueSessionDay = input.bool(false, title="Tue", group=G_daily, inline="1") wedSessionDay = input.bool(false, title="Wed", group=G_daily, inline="1") thuSessionDay = input.bool(false, title="Thu", group=G_daily, inline="1") friSessionDay = input.bool(false, title="Fri", group=G_daily, inline="2") weekend = input.bool(false, title="Weekend", group=G_daily, inline="2") // Create function Tradingtime(tradinghours, TimeZone = "Europe/Amsterdam")=> not na(time(timeframe.period, tradinghours, TimeZone)) Monday = "" if monSession == true Monday += "2" tradingSessionMon = Mon1 + "," + Mon2 + "," + Mon3 + "," + ":" + Monday MondaySession = Tradingtime(tradingSessionMon) bgcolor_mon = MondaySession and monSession ? color.new(color.fuchsia, 90) : na Tuesday = "" if tueSession == true Tuesday += "3" tradingSessionTue = Tue1 + "," + Tue2 + "," + Tue3 + "," + ":" + Tuesday TuesdaySession = Tradingtime(tradingSessionTue) bgcolor_tue = TuesdaySession and tueSession ? color.new(color.fuchsia, 90) : na Wednesday = "" if wedSession == true Wednesday += "4" tradingSessionWed = Wed1 + "," + Wed2 + "," + Wed3 + "," + ":" + Wednesday WednesdaySession = Tradingtime(tradingSessionWed) bgcolor_wed = WednesdaySession and wedSession ? color.new(color.fuchsia, 90) : na Thursday = "" if thuSession == true Thursday += "5" tradingSessionThu = Thu1 + "," + Thu2 + "," + Thu3 + "," + ":" + Thursday ThursdaySession = Tradingtime(tradingSessionThu) bgcolor_thu = ThursdaySession and thuSession ? color.new(color.fuchsia, 90) : na Friday = "" if friSession == true Friday += "6" tradingSessionFri = Fri1 + "," + Fri2 + "," + Fri3 + "," + ":" + Friday FridaySession = Tradingtime(tradingSessionFri) bgcolor_fri = FridaySession and friSession ? color.new(color.fuchsia, 90) : na Saturday = "" if satSession == true Saturday += "7" tradingSessionSat = Sat1 + "," + Sat2 + "," + Sat3 + "," + ":" + Saturday SaturdaySession = Tradingtime(tradingSessionSat) bgcolor_sat = SaturdaySession and satSession ? color.new(color.fuchsia, 90) : na Sunday = "" if sunSession == true Sunday += "1" tradingSessionSun = Sun1 + "," + Sun2 + "," + Sun3 + "," + ":" + Sunday SundaySession = Tradingtime(tradingSessionSun) bgcolor_sun = SundaySession and sunSession ? color.new(color.fuchsia, 90) : na //Highlight background Trading Hours bgcolor(bgcolor_mon, title="Monday Sessions") bgcolor(bgcolor_tue, title="Tuesday Sessions") bgcolor(bgcolor_wed, title="Wednesday Sessions") bgcolor(bgcolor_thu, title="Thursday Sessions") bgcolor(bgcolor_fri, title="Friday Sessions") bgcolor(bgcolor_sat, title="Saturday Sessions") bgcolor(bgcolor_sun, title="Sunday Sessions") // Create function TradingtimeDaily(tradinghours, TimeZone = "Europe/Amsterdam")=> not na(time(timeframe.period, tradinghours, TimeZone)) DailySessions = "" if monSessionDay DailySessions += "1" if tueSessionDay DailySessions += "2" if wedSessionDay DailySessions += "3" if thuSessionDay DailySessions += "4" if friSessionDay DailySessions += "5" if weekend DailySessions += "67" tradingSessionDaily = string(na) if daily_only == true tradingSessionDaily := "0000-0000" + "," + ":" + DailySessions dailySession = TradingtimeDaily(tradingSessionDaily) colordaily=dailySession and daily_only ? color.new(#fbdf40, 90) : na //Highlight background Trading Hours bgcolor(colordaily, title="Daily Sessions")
Normal Distribution Asymmetry & Volatility Zones
https://www.tradingview.com/script/EfLL08Ju-Normal-Distribution-Asymmetry-Volatility-Zones/
tkarolak
https://www.tradingview.com/u/tkarolak/
44
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ tkarolak //@version=5 indicator("Normal Distribution Asymmetry & Volatility Zones", "ND-Asymetry & Volatility", overlay=false, precision = 8) // ==================== // ==== Background ==== // ==================== // This script calculates and visualizes normal distribution asymmetry and volatility zones // which are useful in identifying potential buying and selling opportunities in the market. // Skewness calculation leverages the third central moment and variance of the price distribution // within a specified period to ascertain the asymmetry in the price distribution. // The Z-score coefficient (multiplier) aids in defining the volatility zones by categorizing // data points that are a certain number of standard deviations away from the mean. // By analyzing the skewness coefficient, traders can gain insights into the distribution of recent prices. // A positive skewness indicates that recent prices are skewed to the right of the average price, suggesting potential for upward movement. // Conversely, a negative skewness indicates a potential downward trend. // The normalized skewness (skNorm) helps in understanding how the current skewness value deviates from // a moving average of the recent "x-bars" skewness values. // The script generates buy and sell signals based on the skewness value and the specified Z-score multiplier. // The buy and sell zones are determined based on whether the current price is in the tails of the distribution. // - Buy zone: Identified when skewness is negative and the current price is significantly below the mean price. // - Sell zone: Highlighted when skewness is positive and the current price is notably above the mean price. // The script further identifies 'superbuy' and 'supersell' zones that are extreme representations of the buy and sell zones. // These zones are recognized as areas with even higher potential for profit, albeit with higher risk. // The plot presents the skewness coefficient, enabling traders to visualize the price distribution asymmetry at a glance. // The background color dynamically changes to visually represent the current market condition based on the calculated zones. // For optimal results, users are advised to experiment with different settings for the source, length, // multiplier, and normalization length parameters to find the setup that best suits their trading strategy. // The horizontal zero line serves as a reference point, delineating positive and negative skewness values // and thereby aiding in the swift interpretation of the market condition. // Users can toggle between the raw and normalized skewness values through the 'Plot normalized' setting, // facilitating a more flexible approach to market analysis based on individual preferences. // Custom types type SettingsSk float source int lenght float multiplier bool selector int lenghtNormalize // Normal Distribution Asymmetry string gNda = "Normal Distribution Asymmetry" string ttSourceSk = "Select the price source indicator calculations" string ttLengthSk = "Specify the distribution length (between 50 and 2000)" string ttMultiplierSk = "Set a volatility threshold (1 to 3) to determine when to take long (buy) or short (sell) positions based on positive (above mean) and negative (below mean) Z-scores. The Z-score measures how many standard deviations a data point is from the mean." string ttSelector = "Switch to normalized values. The normalized indicator reflects its deviation from the x-bars moving average." string ttLengthNormSk = "Length for normalization" SettingsSk settingsSk = SettingsSk.new( input.source (close, "Source", group = gNda, tooltip = ttSourceSk), input.int (180, "Distribution Length", group = gNda, minval = 50, maxval = 2000, tooltip = ttLengthSk), input.float (2.0, "Define Z-score coefficient", group = gNda, minval = 1, maxval = 3, step = 0.1, tooltip = ttMultiplierSk), input.bool (false, "Plot normalized", group = gNda, tooltip = ttSelector), input.int (14, "Length for normalization", group = gNda, minval = 7, maxval = 50, tooltip = ttLengthNormSk) ) skewness(float _source, int _length, int _lenghtNorm) => // Calculate the mean (average) float ma = ta.sma(_source, _length) // Calculate the standard deviation of price signals float stddev = ta.stdev(_source, settingsSk.lenght) // Calculate variance float variance = ta.variance(_source, _length) // Calculate the third central moment float moment3 = ta.sma(math.pow(_source - ma, 3), _length) // Calculate the skewness coefficient float skewness = moment3 / math.pow(variance, 3) float skNorm = skewness / ta.sma(skewness,_lenghtNorm)-1 // The 'sk' variable has been transformed into a normalized value, reflecting its deviation from the "_lenghtNorm" bars long average. // If the result is greater than 0, it signifies that the current value exceeds the average, // while if it's less than 0, it suggests that the current value is below the average. [skewness, skNorm, ma, stddev] [sk, skNorm, ma, stddev] = skewness(settingsSk.source, settingsSk.lenght, settingsSk.lenghtNormalize) // Generate buy/sell zones based on skewness and volatility buyZone = sk < 0 and settingsSk.source < ma - settingsSk.multiplier * stddev sellZone = sk > 0 and settingsSk.source > ma + settingsSk.multiplier * stddev buySrc = array.new_float(0) sellSrc = array.new_float(0) for i = 0 to settingsSk.lenght-1 by 1 if buyZone[i] array.push(buySrc, settingsSk.source[i]) if sellZone[i] array.push(sellSrc, settingsSk.source[i]) maBuySrc = array.avg(buySrc) maSellSrc = array.avg(sellSrc) sdBuySrc = array.stdev(buySrc) sdSellSrc = array.stdev(sellSrc) bool superbuyZone = sk < 0 and settingsSk.source < maBuySrc - settingsSk.multiplier * sdBuySrc bool supersellZone = sk > 0 and settingsSk.source > maSellSrc + settingsSk.multiplier * sdSellSrc //////////////////////////////////////////////////////////////////////////////// // ====== DRAWING and PLOTTING ====== // //////////////////////////////////////////////////////////////////////////////// // Define colors for skewness and signals skColor = sk > 0 ? color.green : color.red signalColor = buyZone ? color.new(color.red, 90) : sellZone ? color.new(color.green, 90) : na signalColor := superbuyZone ? color.new(color.red, 10) : supersellZone ? color.new(color.green, 10) : signalColor // Plot the skewness coefficient plot(settingsSk.selector ? skNorm : sk, title="Skewness Coefficient", color=skColor, linewidth=2) // Add horizontal reference lines hline(0, "Zero Line", color = color.gray) // Set background color based on signals bgcolor(signalColor) //easy peasy
[sphx] FWMA
https://www.tradingview.com/script/jEJSshjO/
zamansiz74
https://www.tradingview.com/u/zamansiz74/
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/ // ยฉ zamansiz74 //@version=5 indicator("[sphx] FWMA", overlay = true) // periods = input.int(defval = 6, title="Long Period") periods2 = input.int(defval = 5, title="Short Period") // if periods2 > periods periods2 := periods - 1 // Fibonacci-Zahlenreihe fibonacciNumbers = array.new_int(periods) // Erste beiden Fibonacci-Zahlen array.set(fibonacciNumbers, 0, 1) array.set(fibonacciNumbers, 1, 2) // var bool direction = false var bool colorChanged = false // for i = 2 to periods - 1 array.set(fibonacciNumbers, i, array.get(fibonacciNumbers, i - 1) + array.get(fibonacciNumbers, i - 2)) // Funktion zur Berechnung des Fibonacci-Durchschnitts fibonacciAvg(src, periods) => sum = 0.0 weightSum = 0.0 for i = 0 to periods - 1 fibNumber = fibonacciNumbers.get(i) sum := sum + src[fibNumber - 1] sum / periods // fibonacciAvgValue = ta.ema(fibonacciAvg(close, periods),periods) fibonacciAvgValue2 = ta.ema(fibonacciAvg(close, periods2),periods) // distance = fibonacciAvgValue2 - fibonacciAvgValue distance2 = ta.ema(distance,periods) // Color clr =distance < distance2 ? distance > 0 ? color.rgb(64,255,64,80) : color.rgb(255,0,0,50) : distance > 0 ? color.rgb(0,255,0,50) : color.rgb(255,0,0,80) // Plot fa1 = plot(fibonacciAvgValue, title = "Fibonacci Average 1", color = clr, linewidth = 1) fa2 = plot(fibonacciAvgValue2, title = "Fibonacci Average 2", color = clr, linewidth = 1) fill(fa1, fa2, color = clr)
PhantomFlow AccumulationDetector
https://www.tradingview.com/script/2tOhRFZk-PhantomFlow-AccumulationDetector/
PhantomFlow
https://www.tradingview.com/u/PhantomFlow/
266
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ mxrshxl_trxde // //@version=5 indicator(title = "PhantomFlow AccumulationDetector", shorttitle = "PhantomFlow AccumulationDetector", overlay = true, max_boxes_count = 500, max_labels_count = 500, max_lines_count = 500) tf = input.timeframe('60', title='Timeframe') bg_poc_color = input.color(title='Background', defval = color.rgb(7, 34, 237, 80), group="Visual Settings", inline = 'bg_ltf_color_liquidity') va_percent = 70. cnum = 100 type period_data float vah float poc float val float high_ float low_ int start_bar int end_bar var array<period_data> periods_data = array.new<period_data>() ltf = timeframe.period ltf_seconds = timeframe.in_seconds(ltf) / 60 htf_seconds = timeframe.in_seconds(tf) / 60 num_bars_ltf = htf_seconds / ltf_seconds is_new_bar(t) => ta.change(time(t)) != 0 get_vol(y11, y12, y21, y22, height, vol) => nz(math.max(math.min(math.max(y11, y12), math.max(y21, y22)) - math.max(math.min(y11, y12), math.min(y21, y22)), 0) * vol / height) levels = array.new_float(cnum + 1) totalvols = array.new_float(cnum, 0.) d_switch = is_new_bar(tf) var top = 0.0 var bot = 0.0 if not d_switch if top < high top := high if bot > low bot := low calculateLevels(int bar_end, int bar_start) => step = (top - bot) / cnum for x = 0 to cnum by 1 array.set(levels, x, bot + step * x) if d_switch bar_end = bar_index - 1 bar_start = bar_index - num_bars_ltf volumes = array.new_float(cnum * 2, 0.) all_bars = bar_end - bar_start calculateLevels(bar_end, bar_start) for bars = 1 to num_bars_ltf by 1 body_top = math.max(close[bars], open[bars]) body_bot = math.min(close[bars], open[bars]) itsgreen = close[bars] >= open[bars] topwick = high[bars] - body_top bottomwick = body_bot - low[bars] body = body_top - body_bot bodyvol = body * volume[bars] / (2 * topwick + 2 * bottomwick + body) topwickvol = 2 * topwick * volume[bars] / (2 * topwick + 2 * bottomwick + body) bottomwickvol = 2 * bottomwick * volume[bars] / (2 * topwick + 2 * bottomwick + body) for x = 0 to cnum - 1 by 1 array.set(volumes, x, array.get(volumes, x) + (itsgreen ? get_vol(array.get(levels, x), array.get(levels, x + 1), body_bot, body_top, body, bodyvol) : 0) + get_vol(array.get(levels, x), array.get(levels, x + 1), body_top, high[bars], topwick, topwickvol) / 2 + get_vol(array.get(levels, x), array.get(levels, x + 1), body_bot, low[bars], bottomwick, bottomwickvol) / 2) array.set(volumes, x + cnum, array.get(volumes, x + cnum) + (itsgreen ? 0 : get_vol(array.get(levels, x), array.get(levels, x + 1), body_bot, body_top, body, bodyvol)) + get_vol(array.get(levels, x), array.get(levels, x + 1), body_top, high[bars], topwick, topwickvol) / 2 + get_vol(array.get(levels, x), array.get(levels, x + 1), body_bot, low[bars], bottomwick, bottomwickvol) / 2) for x = 0 to cnum - 1 by 1 array.set(totalvols, x, array.get(volumes, x) + array.get(volumes, x + cnum)) int poc = array.indexof(totalvols, array.max(totalvols)) totalmax = array.sum(totalvols) * va_percent / 100. va_total = array.get(totalvols, poc) int up = poc int down = poc for x = 0 to cnum - 1 by 1 above = 0.0 if up + 1 < array.size(totalvols) - 1 above += nz(array.get(totalvols, up + 1), 0.0) above if up + 2 < array.size(totalvols) - 1 above += nz(array.get(totalvols, up + 2), 0.0) above below = 0.0 if down - 1 > 0 below += nz(array.get(totalvols, down - 1), 0.0) below if down - 2 > 0 below += nz(array.get(totalvols, down - 2), 0.0) below if above > below up := math.min(up + 2, array.size(totalvols) - 1) va_total += above va_total else down := math.max(down - 2, 0) va_total += below va_total if va_total >= totalmax or down <= 0 and up >= array.size(totalvols) - 1 break maxvol = array.max(totalvols) for x = 0 to cnum * 2 - 1 by 1 array.set(volumes, x, array.get(volumes, x) * all_bars / (3 * maxvol)) poc_level = (array.get(levels, poc) + array.get(levels, poc + 1)) / 2 val_level = (array.get(levels, down) + array.get(levels, down + 1)) / 2 vah_level = (array.get(levels, up) + array.get(levels, up + 1)) / 2 array.push(periods_data, period_data.new(vah_level, poc_level, val_level, top, bot, bar_start, bar_end)) // box first_box = box.new(bar_start, val_level, bar_end, vah_level, border_color = color.rgb(0, 0, 0, 100), bgcolor = bg_poc_color) // box second_box = box.new(bar_start, top, bar_end, vah_level, border_color = color.rgb(0, 0, 0, 100), bgcolor = bg_vah_color) // box three_box = box.new(bar_start, bot, bar_end, val_level, border_color = color.rgb(0, 0, 0, 100), bgcolor = bg_val_color) if d_switch and array.size(periods_data) != 1 period_data prev_period = array.get(periods_data, array.size(periods_data) - 2) period_data last_period = array.last(periods_data) if prev_period.vah > last_period.poc and last_period.poc > prev_period.val and prev_period.start_bar != 0 box.new(prev_period.start_bar, math.max(prev_period.vah, last_period.vah), last_period.end_bar, math.min(prev_period.val, last_period.val), border_color = bg_poc_color, bgcolor = bg_poc_color) if d_switch bot := low top := high
The Swinging Momentum Indicator
https://www.tradingview.com/script/gmXSHgRo-The-Swinging-Momentum-Indicator/
durunvo
https://www.tradingview.com/u/durunvo/
7
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ durunvo //@version=5 indicator("Momentum", overlay=true) // plotshape(year == 2021 and month == 5 and dayofmonth == 28, style=shape.triangleup, location=location.belowbar, size=size.small) // plotshape(year == 2021 and month == 10 and dayofmonth == 14, style=shape.triangleup, location=location.belowbar, size=size.small) // plotshape(year == 2023 and month == 1 and dayofmonth == 12, style=shape.triangleup, location=location.belowbar, size=size.small) // plotshape(year == 2020 and month == 8 and dayofmonth == 3, style=shape.triangleup, location=location.belowbar, size=size.small) // plotshape(year == 2019 and month == 12 and dayofmonth == 12, style=shape.triangleup, location=location.belowbar, size=size.small) // plotshape(year == 2023 and month == 3 and dayofmonth == 16, style=shape.triangleup, location=location.belowbar, size=size.small) showBuySignal = input(true, "Buy Signal") showSellSignal = input(true, "Sell Signal") barDiff1 = ta.change(close) barDiff2 = ta.change(close[1]) barDiff3 = ta.change(close[2]) highestVolume = (volume == ta.highest(volume, 4)) // Define buy conditions buyCondition = true and ((barDiff1 >= barDiff2) and (barDiff1 >= barDiff3)) // Rate of change increase and (close > ta.highest(high[1], 3)) // and (close > ta.ema(close, 20) // and (low > ta.sma(close, 20) * 0.99) and highestVolume // Define sell conditions sellCondition = true and ((barDiff1 <= barDiff2) and (barDiff1 <= barDiff3)) // Rate of change increase and (close < ta.lowest(low[1], 3)) // and (close < ta.sma(close, 20)) // and (low < ta.sma(close, 20) * 1.01) and highestVolume gainingDays = 0 losingDays = 0 for i = 0 to 6 // Calculate the change from previous close change = close[i] - close[i+1] // Increment the count of gaining days or losing days if change > 0 gainingDays := gainingDays + 1 else if change <= 0 losingDays := losingDays + 1 strengthOfBuySignal = 0 if close >= ohlc4 strengthOfBuySignal := strengthOfBuySignal + 1 if ta.lowest(low, 4) < low strengthOfBuySignal := strengthOfBuySignal + 1 if gainingDays > losingDays strengthOfBuySignal := strengthOfBuySignal + 1 strongBuySignal = strengthOfBuySignal > 2 strengthOfSellSignal = 0 if close < ohlc4 strengthOfSellSignal := strengthOfSellSignal + 1 if ta.highest(high, 4) > high strengthOfSellSignal := strengthOfSellSignal + 1 if losingDays > gainingDays strengthOfSellSignal := strengthOfSellSignal + 1 strongSellSignal = strengthOfSellSignal > 2 plotshape( showBuySignal and buyCondition, color=strongBuySignal ? color.rgb(0, 255, 8) : color.yellow, style=shape.triangleup, location = location.belowbar) plotshape( showSellSignal and sellCondition, color=strongSellSignal ? color.rgb(255, 17, 0) : color.yellow, style=shape.triangledown, location = location.abovebar)
[TTI] Closing Range Indicator
https://www.tradingview.com/script/xRzgrqPw-TTI-Closing-Range-Indicator/
TintinTrading
https://www.tradingview.com/u/TintinTrading/
23
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ TintinTrading //@version=5 indicator("[TTI] Closing Range Indicator", overlay=true, max_labels_count=500) // Input for timeframe selection timeframeOption = input.string(title="Timeframe", options=["D", "W"], defval="D") invisible = input(true, title="Make invisible") // Calculate the closing range closingRange() => barRange = high - low if barRange > 0 (close - low) / barRange * 100 else 0 transp= invisible ? 100 : 50 weeklyHigh = request.security(syminfo.tickerid, "W", high) weeklyLow = request.security(syminfo.tickerid, "W", low) weeklyClose = request.security(syminfo.tickerid, "W", close) weekRange = weeklyHigh - weeklyLow // Compute values based on the selected timeframe var float closingValue = na if timeframeOption == "D" closingValue := closingRange() else // Weekly computation closingValue := weekRange > 0 ? (weeklyClose - weeklyLow) / weekRange * 100 : 0 // Plot circle at the close of each bar label.new(x=bar_index, y=close, text="\n", style=label.style_label_center, color=color.rgb(255, 5, 218,transp), size=size.large, tooltip="CR: " + str.tostring(math.round(closingValue,2)) + "%")
ATR Adaptive RSI Oscillator
https://www.tradingview.com/script/WxRL7biz-ATR-Adaptive-RSI-Oscillator/
tkarolak
https://www.tradingview.com/u/tkarolak/
60
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ tkarolak //@version=5 // ==================== // ==== Background ==== // ==================== // The "ATR Adaptive RSI Oscillator" combines the ATR (Average True Range) and the RSI (Relative Strength Index) to enhance the responsiveness of the RSI to current market conditions. // Hypothesis: Adjusting the RSI period dynamically based on the ATR's measure of market volatility could offer more precise signals in different market environments. // This dynamic adjustment employs a Z-score mechanism that utilizes the standard deviation and mean of the ATR over a specified sample size to set a threshold. // The oscillator leverages volume-smoothed RSI calculations, which use a time-decayed weighted moving average of RSI values to potentially reduce noise and offer a clearer trend representation. // It adapts the RSI calculation period automatically, choosing longer periods in high volatility environments and shorter ones during low volatility, aiming to enhance the accuracy of the RSI in diverse market situations. // Insights: // - The adaptive mode can be toggled on or off, allowing users to switch between a dynamic RSI and a traditional fixed-period RSI, facilitating a customizable approach to market analysis. // - Users can fine-tune the sensitivity of the adaptive mechanism through settings such as the Z-score multiplier, which filters ATR values based on their deviation from the mean. // - The visual representation of the oscillator is color-coded to depict the current RSI period dynamically, assisting in quick visual analysis. // - The indicator includes an option to display a histogram representing the number of bars the RSI length was increased, aiding in the historical analysis of market volatility and its effects on the RSI period. // - For identifying potential reversals, the script features divergence detection settings, allowing users to specify the lookback range for detecting divergences. // - The Overbought (OB) and Oversold (OS) boundaries are configurable, offering users the ability to set their thresholds for these critical levels, including extreme OB and OS levels for more stringent filtering of signals. // - While utilizing this tool, traders should remain aware of the broader market context and consider using it in conjunction with other analysis methods for a well-rounded approach. // Usage: // - In highly volatile markets, traders might observe the adaptive RSI taking on higher periods, potentially filtering out noise and highlighting more significant trends. // - In quieter markets, the adaptive mechanism might default to shorter periods, potentially offering quicker signals for short-term opportunities. // - Users can exploit the divergence detection feature to identify potential reversal points by observing discrepancies between price movements and the RSI. // - For those who prefer a more traditional approach, the adaptive feature can be disabled to revert to a standard RSI analysis with a fixed period. // - Consider utilizing the OB/OS boundaries to identify potential entry and exit points, keeping an eye on the extreme levels for potential high-confidence signals. indicator("ATR Adaptive RSI Oscillator", "ATR ARSI", false, format.price, 2) // Custom types type SettingsRsi float source int lenght int lenghtMax bool smoothing int sampleSize float zScore //////////////////////////////////////////////////////////////////////////////// // ====== TOOLTIPS ====== // //////////////////////////////////////////////////////////////////////////////// // RSI settings string gRsi = "General RSI settings" string gRsiAtr = "ATR-Based Periods" string ttSourceRsi = "Source for RSI calculations" string ttLenRsi = "The minimum RSI length for adaptive mode or the default RSI length used when adaptive mode is disabled" string ttSmoothingRsi = "The smoothing process computes a time-decayed weighted moving average of RSI values over the last two bars, using volume-based weights.\n\nThis approach provides a time-sensitive smoothing effect, reducing noise for a clearer view of trend strength compared to the standard RSI" string ttAdaptiveRsi = "Enable adaptive RSI periods based on ATR.\n\nThis feature dynamically adjusts the RSI calculation period based on market volatility measured by ATR. It enhances accuracy during different market conditions by using longer periods in high volatility and shorter periods in lower volatility." string ttAtrLengthRsi = "Lenght used for ATR calculation" string ttMaxLenRsi = "Maximum RSI length for adaptive periods" string ttSampleSizeRsi = "Dataset length for statistical computations in deriving a normal distribution, used to identify data points (ATR), meeting criteria exceeding the standard deviation multiplied by the Z-score coefficient" string ttZscoreRsi = "The Z-scores multiplier serves as a filtering mechanism, providing insight into the extent to which a data point (ATR) deviates from the mean in terms of standard deviations." string ttHistogramRsi = "Displays a histogram representing the number of bars the RSI length was increased" SettingsRsi settingsRsi = SettingsRsi.new( input.source (close, "Source", group = gRsi, tooltip = ttSourceRsi), input.int (14, "Length", group = gRsi, minval = 3, tooltip = ttLenRsi), input.int (28, "Maximum RSI Length", group = gRsi, minval = 7, maxval = 36, tooltip = ttMaxLenRsi), input.bool (true, "Smoothed Mode RSI?", group = gRsi, tooltip = ttSmoothingRsi), input.int (200, "Control sample size", group = gRsiAtr, step = 1, minval = 100, maxval = 500, tooltip = ttSampleSizeRsi), input.float (2.0, "Z-score", group = gRsiAtr, step = 0.1, minval = 1.0, maxval = 3.0, tooltip = ttZscoreRsi) ) bool settingsRsiEnableAdaptive = input.bool(true, "Adaptive Mode RSI?", group = gRsi, tooltip = ttAdaptiveRsi) int settingsRsiLengthAtr = input.int (14,"ATR Length", group = gRsiAtr, minval = 3) bool settingsRsiHistogram = input.bool(true, "Show RSI boost histogram", group = gRsiAtr, tooltip = ttHistogramRsi) // Divergences Config string gdivergence = "Divergence Detector" settingsDvgShowDvg = input.bool (false, "Enable Divergences?", group = gdivergence) settingsDvgLookbackR = input (5, "Pivot Lookback Right", group = gdivergence) settingsDvgLookbackL = input (5, "Pivot Lookback Left", group = gdivergence) settingsDvgLookbackMax = input (60, "Max of Lookback Range", group = gdivergence) settingsDvgLookbackMin = input (5, "Min of Lookback Range", group = gdivergence) // -- Channel OB/OS config string gRsiBoundaries = "OB/OS Boundaries" int settingsRsiUpper = input.int (70, "OB", group = gRsiBoundaries, inline = "OB", minval = 50, maxval = 100) int settingsRsiUpperx = input.int (80, "OB Extreme", group = gRsiBoundaries, inline = "OB", minval = 50, maxval = 100) int settingsRsiLower = input.int (30, "OS", group = gRsiBoundaries, inline = "OS", minval = 0, maxval = 50) int settingsRsiLowerx = input.int (20, "OS Extreme", group = gRsiBoundaries, inline = "OS", minval = 0, maxval = 50) //////////////////////////////////////////////////////////////////////////////// // ====== FUNCTIONS ====== // //////////////////////////////////////////////////////////////////////////////// if barstate.islast and settingsRsi.lenghtMax <= settingsRsi.lenght runtime.error("The maximum RSI length must exceed the RSI length") // Function to calculate RSI with optional volume smoothing getRsi(_source, _length, _mode) => float _zrsi = ta.rsi(_source, _length) var float _smoothed = na _smoothed := na(_smoothed[2]) ? _zrsi : (_smoothed[2] * volume[2]/3 + _smoothed[1] * volume[1]/2 + _zrsi * volume) / (volume[2]/3+volume[1]/2+volume) _mode ? _smoothed : _zrsi ////////////////////////////////////////////////////////////////////////// // ====== RSI / ADAPTIVE RSI ====== // ////////////////////////////////////////////////////////////////////////// rsiArray = array.new_float(37) // Repeat RSI calculation for other periods array.set(rsiArray,0,na) array.set(rsiArray,1,na) array.set(rsiArray,2,na) array.set(rsiArray,3,getRsi(settingsRsi.source, 3, settingsRsi.smoothing)) array.set(rsiArray,4,getRsi(settingsRsi.source, 4, settingsRsi.smoothing)) array.set(rsiArray,5,getRsi(settingsRsi.source, 5, settingsRsi.smoothing)) array.set(rsiArray,6,getRsi(settingsRsi.source, 6, settingsRsi.smoothing)) array.set(rsiArray,7,getRsi(settingsRsi.source, 7, settingsRsi.smoothing)) array.set(rsiArray,8,getRsi(settingsRsi.source, 8, settingsRsi.smoothing)) array.set(rsiArray,9,getRsi(settingsRsi.source, 9, settingsRsi.smoothing)) array.set(rsiArray,10,getRsi(settingsRsi.source, 10, settingsRsi.smoothing)) array.set(rsiArray,11,getRsi(settingsRsi.source, 11, settingsRsi.smoothing)) array.set(rsiArray,12,getRsi(settingsRsi.source, 12, settingsRsi.smoothing)) array.set(rsiArray,13,getRsi(settingsRsi.source, 13, settingsRsi.smoothing)) array.set(rsiArray,14,getRsi(settingsRsi.source, 14, settingsRsi.smoothing)) array.set(rsiArray,15,getRsi(settingsRsi.source, 15, settingsRsi.smoothing)) array.set(rsiArray,16,getRsi(settingsRsi.source, 16, settingsRsi.smoothing)) array.set(rsiArray,17,getRsi(settingsRsi.source, 17, settingsRsi.smoothing)) array.set(rsiArray,18,getRsi(settingsRsi.source, 18, settingsRsi.smoothing)) array.set(rsiArray,19,getRsi(settingsRsi.source, 19, settingsRsi.smoothing)) array.set(rsiArray,20,getRsi(settingsRsi.source, 20, settingsRsi.smoothing)) array.set(rsiArray,21,getRsi(settingsRsi.source, 21, settingsRsi.smoothing)) array.set(rsiArray,22,getRsi(settingsRsi.source, 22, settingsRsi.smoothing)) array.set(rsiArray,23,getRsi(settingsRsi.source, 23, settingsRsi.smoothing)) array.set(rsiArray,24,getRsi(settingsRsi.source, 24, settingsRsi.smoothing)) array.set(rsiArray,25,getRsi(settingsRsi.source, 25, settingsRsi.smoothing)) array.set(rsiArray,26,getRsi(settingsRsi.source, 26, settingsRsi.smoothing)) array.set(rsiArray,27,getRsi(settingsRsi.source, 27, settingsRsi.smoothing)) array.set(rsiArray,28,getRsi(settingsRsi.source, 28, settingsRsi.smoothing)) array.set(rsiArray,29,getRsi(settingsRsi.source, 29, settingsRsi.smoothing)) array.set(rsiArray,30,getRsi(settingsRsi.source, 30, settingsRsi.smoothing)) array.set(rsiArray,31,getRsi(settingsRsi.source, 31, settingsRsi.smoothing)) array.set(rsiArray,32,getRsi(settingsRsi.source, 32, settingsRsi.smoothing)) array.set(rsiArray,33,getRsi(settingsRsi.source, 33, settingsRsi.smoothing)) array.set(rsiArray,34,getRsi(settingsRsi.source, 34, settingsRsi.smoothing)) array.set(rsiArray,35,getRsi(settingsRsi.source, 35, settingsRsi.smoothing)) array.set(rsiArray,36,getRsi(settingsRsi.source, 36, settingsRsi.smoothing)) // Get default RSI float rsi = array.get(rsiArray,settingsRsi.lenght) // Calculate RSI Lenght for Adaptive RSI atr = ta.atr(settingsRsiLengthAtr) // Calculate standard deviation and mean of ATR with samle data size atrStddev = ta.stdev(atr, settingsRsi.sampleSize) atrMean = ta.sma(atr, settingsRsi.sampleSize) zScoreThreshold = atrMean + settingsRsi.zScore * atrStddev // Gather and normalize ATR values exceeding one standard deviation (# z-score ranges right) overZscoreAtr = array.new_float() for i = 0 to settingsRsi.sampleSize-1 by 1 if atr[i] > zScoreThreshold array.push(overZscoreAtr,atr[i]) // Normalize ATR values exceeding z-score limit to boosted range of RSI Lenght overZscoreAtrMin = array.min(overZscoreAtr) overZscoreAtrMax = array.max(overZscoreAtr) minBoostedRsi = settingsRsi.lenght + 1 // Normalization taking place here newRsiLenght = atr > zScoreThreshold ? int((atr - overZscoreAtrMin) / (overZscoreAtrMax - overZscoreAtrMin) * (settingsRsi.lenghtMax - minBoostedRsi) + minBoostedRsi) : settingsRsi.lenght // Determine RSI Length based on Adaptive Mode // If adaptive mode is enabled (i_adaptive), // find the corresponding RSI length from the array based on the ATR value // Otherwise, use the default RSI (rsi). rsi := settingsRsiEnableAdaptive and atr > zScoreThreshold ? array.get(rsiArray,newRsiLenght): rsi rsiOriginal = settingsRsiEnableAdaptive ? array.get(rsiArray,settingsRsi.lenght): na //////////////////////////////////////////////////////////////////////////////// // ====== DRAWING and PLOTTING ====== // //////////////////////////////////////////////////////////////////////////////// // RSI and histogram color colStep = int(255/(settingsRsi.lenghtMax-settingsRsi.lenght)) greenPaint = settingsRsiEnableAdaptive ? 255-colStep*(newRsiLenght-settingsRsi.lenght) : 255 greenPaint := greenPaint > 255 ? 255 : greenPaint < 0 ? 0 : greenPaint color colRSI = color.new(color.rgb(255,greenPaint,0),20) color colHistogram = color.new(color.rgb(255,greenPaint,0),50) // RSI channel Lines top = hline(100, "Top", color.new(color.red, 80), display = display.none) upperx = hline(settingsRsiUpperx, "OB Extreme", color.new(color.red, 80), hline.style_solid) upper = hline(settingsRsiUpper, "OB", color.new(color.red, 90)) median = hline(50, "Median", color.new(color.orange,50), hline.style_dotted) lower = hline(settingsRsiLower, "OS", color.new(color.green, 90)) lowerx = hline(settingsRsiLowerx, "OS Extreme", color.new(color.green, 80), hline.style_solid) bottom = hline(settingsRsiHistogram and settingsRsiEnableAdaptive ? 0 : na, "Baseline", color.new(color.rgb(204,0,102),60), hline.style_dotted) // Channel fill fill(upper, upperx, color.new(color.red, 90), title="Background Fill OB") fill(upper, lower, color.new(color.blue, 95), title="Background Channel") fill(lower, lowerx, color.new(color.green, 90), title="Background Fill OS") // Plot the number of bars the RSI length was increased plot(settingsRsiHistogram and settingsRsiEnableAdaptive and atr > zScoreThreshold ? newRsiLenght-settingsRsi.lenght : na, title="RSI Lenght increase", color=colHistogram, style=plot.style_histogram) // RSI plot plot(rsiOriginal, "RSI orginal", color.new(color.yellow,66),1) plot(rsi, "RSI", colRSI, 2) //////////////////////////////////////////////////////////////////////////////// // ====== DIVERGENCE ====== // //////////////////////////////////////////////////////////////////////////////// plFound = na(ta.pivotlow(rsi, settingsDvgLookbackL, settingsDvgLookbackR)) ? false : true phFound = na(ta.pivothigh(rsi, settingsDvgLookbackL, settingsDvgLookbackR)) ? false : true _inRange(cond) => bars = ta.barssince(cond == true) settingsDvgLookbackMin <= bars and bars <= settingsDvgLookbackMax bearColor = color.red bullColor = color.green noneColor = color.new(color.white, 100) textColor = color.white // Regular Bullish // RSI: Higher Low RSIHL = rsi[settingsDvgLookbackR] > ta.valuewhen(plFound, rsi[settingsDvgLookbackR], 1) and _inRange(plFound[1]) // Price: Lower Low priceLL = low[settingsDvgLookbackR] < ta.valuewhen(plFound, low[settingsDvgLookbackR], 1) bullCond = priceLL and RSIHL and plFound plot( plFound and settingsDvgShowDvg ? rsi[settingsDvgLookbackR] : na, offset=-settingsDvgLookbackR, title="Regular Bullish", linewidth=2, color=(bullCond ? bullColor : noneColor), display=display.pane ) plotshape( bullCond and settingsDvgShowDvg ? rsi[settingsDvgLookbackR] : na, offset=-settingsDvgLookbackR, title="Regular Bullish Label", text=" Bull ", style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor, display=display.pane ) // Regular Bearish // RSI: Lower High RSILH = rsi[settingsDvgLookbackR] < ta.valuewhen(phFound, rsi[settingsDvgLookbackR], 1) and _inRange(phFound[1]) // Price: Higher High priceHH = high[settingsDvgLookbackR] > ta.valuewhen(phFound, high[settingsDvgLookbackR], 1) bearCond = priceHH and RSILH and phFound plot( phFound and settingsDvgShowDvg ? rsi[settingsDvgLookbackR] : na, offset=-settingsDvgLookbackR, title="Regular Bearish", linewidth=2, color=(bearCond ? bearColor : noneColor), display=display.pane ) plotshape( bearCond and settingsDvgShowDvg ? rsi[settingsDvgLookbackR] : na, offset=-settingsDvgLookbackR, title="Regular Bearish Label", text=" Bear ", style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor, display=display.pane ) //easy peasy
[TTI] Price confirmation indicator
https://www.tradingview.com/script/lAj07bhr-TTI-Price-confirmation-indicator/
TintinTrading
https://www.tradingview.com/u/TintinTrading/
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/ // ยฉ TintinTrading //@version=5 indicator("[TTI] Price confirmation indicator", overlay = true) // Input settings price_up_color = input.color(color.rgb(0, 51, 255), "Price Up Color") price_down_color = input.color(color.rgb(135, 25, 155), "Price Down Color") // Determine up and down days isUpDay = close > close[1] isDownDay = close < close[1] // Calculate the 50DSMA volume avgVolume = ta.sma(volume, 50) volDifference = (volume - avgVolume) / avgVolume * 100 // Determine the transparency based on volume difference var transparency = 0 if volDifference > 40 transparency := 100 else if volDifference > 20 transparency := 80 else if volDifference > 0 transparency := 60 else if volDifference > -20 transparency := 40 else if volDifference > -40 transparency := 20 else if volDifference > -80 transparency := 10 else transparency := 100 // Color bars based on the conditions barcolor(isUpDay and volDifference > -80 ? color.new(price_up_color, 100 - transparency) : isDownDay and volDifference > -80 ? color.new(price_down_color, 100 - transparency) : volDifference <= -80 ? color.new(color.orange, 0) : na)
[TTI] MarketSmith & IBD Style Model Stock Quarters
https://www.tradingview.com/script/egZKC0r7-TTI-MarketSmith-IBD-Style-Model-Stock-Quarters/
TintinTrading
https://www.tradingview.com/u/TintinTrading/
20
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ TintinTrading //@version=5 indicator("[TTI] MarketSmith & IBD Style Model Stock Quarters ", overlay=true, max_lines_count=500) // Function to get the abbreviation of the next month nextMonthAbbreviation(month) => month == 1 ? "Feb" : month == 2 ? "Mar" : month == 3 ? "Apr" : month == 4 ? "May" : month == 5 ? "Jun" : month == 6 ? "Jul" : month == 7 ? "Aug" : month == 8 ? "Sep" : month == 9 ? "Oct" : month == 10 ? "Nov" : month == 11 ? "Dec" : "Jan" nextmonth = month == 1 ? "Feb" : month == 2 ? "Mar" : month == 3 ? "Apr" : month == 4 ? "May" : month == 5 ? "Jun" : month == 6 ? "Jul" : month == 7 ? "Aug" : month == 8 ? "Sep" : month == 9 ? "Oct" : month == 10 ? "Nov" : month == 11 ? "Dec" : "Jan" // Draw a line at the beginning of the quarter if month==1 and month[1] !=1 or month==4 and month[1] !=4 or month==7 and month[1] !=7 or month==10 and month[1] !=10 line.new(bar_index, close, bar_index, close*1.01, width = 1, color=color.black, extend = extend.both) // linescol = month==1 and month[1] !=1 or month==4 and month[1] !=4 or month==7 and month[1] !=7 or month==10 and month[1] !=10 // bgcolor(linescol ? color.black : na) //var t1 = 0 t1 = month==2 or month==5 or month==8 or month==11 t2 = t1 and t1[1] != t1 ? 1 : 0 if t2 label.new(bar_index, 0, text=nextMonthAbbreviation(month)+" "+str.tostring(year%100), style=label.style_none, textalign=text.align_center)
Show-Bias
https://www.tradingview.com/script/ZZU1PyJS-Show-Bias/
amitni82
https://www.tradingview.com/u/amitni82/
16
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ amitni82 //@version=5 indicator("Show-Bias-v2", overlay = true, max_bars_back = 5) // Inputs // highlightBar = input.bool(true, "Highlight current bar") highlighterColorBullish = input.color(color.new(color.lime, 75), "Highlighter Color for Bullish bias", group = "formatting") highlighterColorBearish = input.color(color.new(color.orange, 75), "Highlighter Color for Bearish bias", group = "formatting") // Bullish Bearish var infotbl = table.new(position.top_right, 1, 1, border_color = color.white, border_width = 1) color highlighterColor = na if barstate.islast if close > open and high > high[1] and low > low[1] and close > high[1] highlighterColor := highlighterColorBullish table.cell(infotbl, 0, 0, "Bull HH + HL + HC", text_color = color.white, bgcolor = color.green, width = 15, text_size = size.normal) else if close < open and high < high[1] and low < low[1] and close < low[1] highlighterColor := highlighterColorBearish table.cell(infotbl, 0, 0, "Bear LH + LL + LC", text_color = color.white, bgcolor = color.orange, width = 15, text_size = size.normal) else table.cell(infotbl, 0, 0, "No bias", text_color = color.white, bgcolor = color.gray, width = 15, text_size = size.normal) //bgcolor(barstate.islast ? highlighterColor : na, editable = false)
Plot Closed Candles
https://www.tradingview.com/script/ijXH41Qo-Plot-Closed-Candles/
tradefavorite2021
https://www.tradingview.com/u/tradefavorite2021/
11
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ tradefavorite2021 //@version=5 indicator("Plot Closed Candles", overlay=true ) // Must turn off normal candles first by right clicking on the candles and turning off borders , bodies , and wicks plotcandle(barstate.isconfirmed and close>open ? open : na, high, low, close, color=color.green) plotcandle(barstate.isconfirmed and close < open ? open : na, high, low, close, color=color.red)
Daily Pivots with Fakeout Protection
https://www.tradingview.com/script/Hv1IOvCt-Daily-Pivots-with-Fakeout-Protection/
cyatophilum
https://www.tradingview.com/u/cyatophilum/
147
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ cyatophilum //@version=5 indicator("Daily Pivots with Fakeout Protection",overlay=true) pivot_tf = input.timeframe('D','Pivots Timeframe') fakeout_perc = input.float(0.2,'Fakeout Protection (%)') [daily_high,daily_low] = request.security(syminfo.tickerid,pivot_tf,[high[1],low[1]],lookahead = barmerge.lookahead_on) is_new_period = daily_high != daily_high[1] is_bullish = close > daily_high is_bearish = close < daily_low breakout_long_line = daily_high * (1 + fakeout_perc/100) breakout_short_line = daily_low * (1 - fakeout_perc/100) volma = ta.sma(volume,100) long_breakout = ta.crossover(close,breakout_long_line) and volume > 2 * volma short_breakout = ta.crossunder(close,breakout_short_line) and volume > 2 * volma // Render { theme_color = color.rgb(0,255,255) theme_color_transp = color.rgb(0,255,255,80) p0 = plot(close,'close',display = display.none) ph = plot(not is_new_period ? daily_high : na,'daily high',theme_color, 2, plot.style_linebr) pl = plot(not is_new_period ? daily_low : na, 'daily low', theme_color, 2, plot.style_linebr) fill(ph,pl,theme_color_transp,'Pivot Range background') plotshape(long_breakout, 'Long Breakout Signal', shape.triangleup, location.belowbar,theme_color, text='Breakout', textcolor = theme_color, size=size.small) plotshape(short_breakout,'Short Breakout Signal',shape.triangledown,location.abovebar,theme_color, text='Breakout', textcolor = theme_color, size=size.small) plot(not is_new_period and bar_index % 2 == 0 ? breakout_long_line : na, 'breakout long line', theme_color, 1, plot.style_linebr) plot(not is_new_period and bar_index % 2 == 0 ? breakout_short_line : na,'breakout short line', theme_color, 1, plot.style_linebr) bgcolor(is_new_period ? color.rgb(255, 255, 255, 80) : na) fill(p0,ph,is_bullish ? color.rgb(0, 255, 132, 80) : na) fill(p0,pl,is_bearish ? color.rgb(255, 0, 0, 80) : na) // }
Incomplete Session Candle - Incomplete Timeframe Candle Marker
https://www.tradingview.com/script/d0ViOp87-Incomplete-Session-Candle-Incomplete-Timeframe-Candle-Marker/
AfnanTAjuddin
https://www.tradingview.com/u/AfnanTAjuddin/
107
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ AfnanTAjuddin //@version=5 indicator("Incomplete Session Candle - Incomplete Timeframe Candle Marker ", shorttitle="Incomplete Session candle", overlay=true) // Check if current timeframe is intraday isIntraday = timeframe.isintraday // Calculate the expected duration of the current candle in milliseconds expectedDuration() => if (timeframe.multiplier == 1 and timeframe.period == "D") na // If it's a daily candle, we can't determine its expected duration else if (timeframe.period == "S") timeframe.multiplier * 1000 // For seconds else if (timeframe.period == "M") timeframe.multiplier * 60 * 1000 * 60 * 24 * 30 // For months else if (timeframe.period == "W") timeframe.multiplier * 60 * 1000 * 60 * 24 * 7 // For weeks else timeframe.multiplier * 60 * 1000 // For minutes and hours // Check if the current candle's duration is less than the expected duration isIncompleteCandle = isIntraday and (time_close - time) < expectedDuration() // Plot a shape above the last candle if it's incomplete plotshape(series=isIncompleteCandle)
strategy
https://www.tradingview.com/script/L8ULxMae-strategy/
Trendoscope
https://www.tradingview.com/u/Trendoscope/
59
library
5
MPL-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 // @description Library containing few key calculations for strategy involving leveraged limit and stop orders library("strategy", overlay = true) // @function calculate qty and leverage based on entry and stop price for given risk percentage. // @param entry Entry Price // @param stop Stop Price // @param riskAmount risk percentage per trade or risk cash per trade // @param riskType Can be either trategy.percent_of_equity or strategy.cash // @returns [quantity, leverage] - Quantity based on the risk and calculated leverage on position including existing positions export getQty(float entry, float stop, simple float riskAmount=0.25, simple string riskType=strategy.percent_of_equity) => risk = riskType == strategy.percent_of_equity? strategy.equity*riskAmount/100 : riskAmount quantity = risk/(entry-stop) existingPosition = nz(strategy.position_avg_price*strategy.position_size) newPosition = math.abs(existingPosition + quantity*entry) leverage = math.ceil(newPosition/strategy.equity) [math.abs(quantity), leverage] // @function Calculates position size based on risk and creates bracket orders for given entry/stop/target // @param entry Entry Price // @param stop Stop Price // @param target Target Price // @param maxLeverage Maximum leverage allowed // @param isLimitOrder if true, places limit order for entry, else places stop order. // @param riskAmount risk percentage per trade or risk cash per trade // @param riskType Can be either trategy.percent_of_equity or strategy.cash // @returns orderPlaced - true if orders successfully placed, false otherwise. export bracketOrder(string id, float entry, float stop, float target, int maxLeverage=100, bool isLimitOrder=false, simple float riskAmount=0.25, simple string riskType=strategy.percent_of_equity)=> dir = entry > stop and entry < target ? 1 : entry < stop and entry > target? -1 : 0 [qty, leverage] = getQty(entry, stop, riskAmount, riskType) bool orderPlaced = false if(dir != 0 and leverage <= maxLeverage) if(isLimitOrder) strategy.entry(str.tostring(id), dir > 0 ? strategy.long : strategy.short, qty, limit=entry) else strategy.entry(str.tostring(id), dir > 0 ? strategy.long : strategy.short, qty, stop=entry) strategy.exit('Exit '+str.tostring(id), str.tostring(id), stop=stop, limit=target) orderPlaced := true orderPlaced // @function Creates bracket orders for given entry/stop/target without leverage and qty calculation. (Uses the values from strategy definition) // @param entry Entry Price // @param stop Stop Price // @param target Target Price // @param isLimitOrder if true, places limit order for entry, else places stop order. // @returns orderPlaced - true if orders successfully placed, false otherwise. export bracketOrderWithoutLeverage(string id, float entry, float stop, float target, bool isLimitOrder=false)=> dir = entry > stop and entry < target ? 1 : entry < stop and entry > target? -1 : 0 bool orderPlaced = false if(dir != 0) if(isLimitOrder) strategy.entry(str.tostring(id), dir > 0 ? strategy.long : strategy.short, limit=entry) else strategy.entry(str.tostring(id), dir > 0 ? strategy.long : strategy.short, stop=entry) strategy.exit('Exit '+str.tostring(id), str.tostring(id), stop=stop, limit=target) orderPlaced := true orderPlaced // @function Calculates position size based on risk and creates order for given entry/stop // @param entry Entry Price // @param stop Stop Price // @param maxLeverage Maximum leverage allowed // @param isLimitOrder if true, places limit order for entry, else places stop order. // @param riskAmount risk percentage per trade or risk cash per trade // @param riskType Can be either trategy.percent_of_equity or strategy.cash // @returns orderPlaced - true if orders successfully placed, false otherwise. export order(string id, float entry, float stop, int maxLeverage=100, bool isLimitOrder=false, simple float riskAmount=0.25, simple string riskType=strategy.percent_of_equity)=> dir = entry > stop? 1 : entry < stop? -1 : 0 [qty, leverage] = getQty(entry, stop, riskAmount, riskType) bool orderPlaced = false if(leverage <= maxLeverage and dir != 0) if(isLimitOrder) strategy.entry(str.tostring(id), dir > 0 ? strategy.long : strategy.short, qty, limit=entry) else strategy.entry(str.tostring(id), dir > 0 ? strategy.long : strategy.short, qty, stop=entry) strategy.exit('Exit '+str.tostring(id), str.tostring(id), stop=stop) orderPlaced := true orderPlaced
MAX_MIN_V1
https://www.tradingview.com/script/VOcORRLm/
pernath
https://www.tradingview.com/u/pernath/
14
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ pernath //@version=5 indicator("MAX_MIN_V1", overlay=true) //###############VAR################### //angulo_mdl_short=input(title='angle_mdl_short', defval=-3.0) //angulo_mdl_long=input(title='angle_mdl_long', defval=10.0) var_ema=input(title='var_ema', defval=500) var_mdl=input(title='var_mdl', defval=35) var_mdl2=input(title='var_mdl2', defval=400)//SOL // Variables var float lastTradePrice = na var float lastTradeProfit = 0 var float learningRate = 0.01 //###############VAR################### //#######HIGH_LOW_MID################ highestHigh = ta.highest(high, 1000)[1] lowestLow = ta.lowest(low, 1000)[1] middle=(highestHigh+lowestLow)/2 highestHigh_val=ta.sma(highestHigh,100) lowestLow_val=ta.sma(lowestLow,100) plot(highestHigh_val, color=color.green, linewidth=2, title="Highest High") plot(lowestLow_val, color=color.red, linewidth=2, title="Lowest Low") middle_val=ta.sma(middle,100) plot(middle_val, color=color.white, linewidth=1, title="middle") //#######HIGH_LOW_MID################ mdl = ta.sma(close, var_mdl) // 20 trading days simple moving average mdl2 = ta.sma(close, var_mdl2) //*****ANGLE EMA*********// normalizacion=220 pendiente(y)=> y/y[1] - 1 angulo(y)=> math.atan(pendiente(y)) *180/math.acos(-1) * normalizacion angulocruce(m1,m2)=> math.atan((pendiente(m1)-pendiente(m2)) / (1 + pendiente(m1) * pendiente(m2)))* 100 / math.acos(-1) * normalizacion m1=ta.ema(close, 14) m2=ta.ema(close, 21) //*****ANGLE EMA*********// //###############EMA##############/ var_color=color.black var_trade="" if (angulo(ta.ema(close, 200)))>1 var_color:=color.green var_trade:='L' if (angulo(ta.ema(close, 200)))<-1 var_color:=color.red var_trade:='S' if ((angulo(ta.ema(close, 200)))>-1)and((angulo(ta.ema(close, 200)))<1) var_color:=color.yellow var_trade:='N' if (angulo(middle_val))>0.1 var_color:=color.green var_trade:='L' if (angulo(middle_val))<-0.1 var_color:=color.red var_trade:='S' if ((angulo(middle_val))>-0.1)and((angulo(middle_val))<0.1) var_color:=color.yellow var_trade:='N' plot(middle_val, title='middle_color', color=var_color,style=plot.style_linebr, linewidth=1) //plot(ta.ema(close, 200), title='ema 200', color=var_color,style=plot.style_linebr, linewidth=2) //#############################/ muestra=1000 diferencial_total=0.0 for i = 1 to muestra diferencial_total:=diferencial_total+(((high[i]-low[i])*100)/close[i]) diferencial_tot=diferencial_total/muestra angulo_mdl=angulo(mdl) highestHigh_2 = ta.highest(high, 100)[1] bcolor = ta.crossunder(close,middle_val) ? color.red : ta.crossover(close,middle_val) ? color.green: close<middle_val ? color.red : close>middle_val ? color.green: color.green // : color.black barcolor(bcolor)
Position and Risk Calculator (for Indices) [dR-Algo]
https://www.tradingview.com/script/2n8jh7l8/
dR-Algo
https://www.tradingview.com/u/dR-Algo/
150
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ dR-Algo //@version=5 indicator("Position and Risk Calculator [dR-Algo]", overlay = true, shorttitle = "Position Size Calculator [dR]") // INPUT equity = input.float(50000, title = "Equity", tooltip = "Equity", group='Risk Management') risk_trade = input.float(1, title = "Risk in %", tooltip = "Risk per Trade in %", minval=0, maxval=100, step=0.1 , group='Risk Management') entry = input.price(40000, title = "Entry Price", confirm = true, group='Price') tp = input.price(40000, title = "TP", confirm = true, group='Price') sl = input.price(40000, title = "SL", confirm = true, group='Price') table_location_input = input.string("Top Right", title="Location", options=["Bottom Right", "Bottom Left", "Bottom Center", "Top Left", "Top Center", "Top Right", "Middle left", "Middle Center", "Middle Right" ], group='Dashboard Settings') size = input.string(size.small, title='Text Size', options=[size.normal, size.small, size.tiny], group='Dashboard Settings') string table_location = switch table_location_input "Bottom Right" => position.bottom_right "Top Left" => position.top_left "Top Center" => position.top_center "Top Right" => position.top_right "Middle left" => position.middle_left "Middle Center" => position.middle_center "Middle Right" => position.middle_right "Bottom Left" => position.bottom_left "Bottom Center" => position.bottom_center => position.bottom_right // Draw Input Lines on Chart plot(entry, color = color.gray) plot(tp, color = color.green) plot(sl, color = color.red) GetTickValue() => syminfo.mintick * syminfo.pointvalue // Dashboard Calculations risk_money = risk_trade * equity / 100 if (tp > entry ) and (sl > entry) runtime.error("Please check SL and TP") if (tp < entry ) and (sl < entry) runtime.error("Please check SL and TP") tick_value = GetTickValue() delta_tp = math.abs(tp - entry) delta_sl = math.abs(sl - entry) crv = delta_tp / delta_sl delta_sl_ticks = delta_sl / syminfo.mintick delta_tp_ticks = delta_tp / syminfo.mintick lot_size_raw = risk_money / (delta_sl_ticks * tick_value) lot_size_rounded = math.floor(lot_size_raw) tp_profit = lot_size_rounded * math.round_to_mintick(delta_tp_ticks) * tick_value sl_risk = lot_size_rounded * math.round_to_mintick(delta_sl_ticks) * tick_value // Dashboard Settings table_color = color.new(#07071f, 5 ) table_borderColor = color.new(#d1d1d1, 34) table_text_color = color.white table_separator = "โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€" // Draw Dashboard var table dashboard = table.new(table_location, rows=15, columns=15, bgcolor=table_color , frame_color=color.gray, frame_width=2, border_color=table_borderColor, border_width = 0) table.cell(dashboard, text_size=size, column=1, row=1, text_color = table_text_color, text_halign=text.align_left, text="Equity: " + str.tostring(equity) + ' ๐Ÿ’ฐ') table.cell(dashboard, text_size=size, column=1, row=2, text_color = table_text_color, text_halign=text.align_left, text="Risk per Trade: " + str.tostring(risk_trade) + " %") table.cell(dashboard, text_size=size, column=1, row=3, text_color = table_text_color, text_halign=text.align_left, text="Risk per Trade: " + str.tostring(risk_money) + " ๐Ÿ’ฐ") table.cell(dashboard, text_size=size, column=1, row=4, text_color = table_text_color, text_halign=text.align_center, text=table_separator) table.cell(dashboard, text_size=size, column=1, row=5, text_color = table_text_color, text_halign=text.align_left, text="Entry: " + str.tostring(entry, format.mintick)) table.cell(dashboard, text_size=size, column=1, row=6, text_color = color.green, text_halign=text.align_left, text="TP: " + str.tostring(tp, format.mintick) + " - " + str.tostring(delta_tp_ticks,format.mintick) + " Ticks") table.cell(dashboard, text_size=size, column=1, row=7, text_color = color.red, text_halign=text.align_left, text="SL: " + str.tostring(sl, format.mintick) + " - " + str.tostring(delta_sl_ticks,format.mintick) + " Ticks") table.cell(dashboard, text_size=size, column=1, row=8, text_color = table_text_color, text_halign=text.align_left, text="CRV: " + str.tostring(crv, format.mintick)) table.cell(dashboard, text_size=size, column=1, row=9, text_color = table_text_color, text_halign=text.align_center, text=table_separator) table.cell(dashboard, text_size=size, column=1, row=10, text_color = table_text_color, text_halign=text.align_left, text="LOT SIZE: " + str.tostring(lot_size_rounded)) table.cell(dashboard, text_size=size, column=2, row=1, text_color = table_text_color, text_halign=text.align_left, text="Symbol: " + str.tostring(syminfo.ticker)) table.cell(dashboard, text_size=size, column=2, row=2, text_color = table_text_color, text_halign=text.align_left, text="Tick: " + str.tostring(syminfo.mintick)) table.cell(dashboard, text_size=size, column=2, row=3, text_color = table_text_color, text_halign=text.align_left, text="Tick Value: " + str.tostring(GetTickValue()) + " ๐Ÿ’ฐ") table.cell(dashboard, text_size=size, column=2, row=4, text_color = table_text_color, text_halign=text.align_center, text=table_separator) table.cell(dashboard, text_size=size, column=2, row=6, text_color = color.green, text_halign=text.align_left, text="Profit: " + str.tostring(tp_profit) + " ๐Ÿ’ฐ") table.cell(dashboard, text_size=size, column=2, row=7, text_color = color.red, text_halign=text.align_left, text="Risk: " + str.tostring(sl_risk) + " ๐Ÿ’ฐ")
Auto Fibonacci Levels [MisterMoTA]
https://www.tradingview.com/script/eMTByULS-Auto-Fibonacci-Levels-MisterMoTA/
MisterMoTA
https://www.tradingview.com/u/MisterMoTA/
191
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // @author = MisterMoTA // ยฉ MisterMoTA //@version=5 indicator('Auto Fibonacci Levels [MisterMoTA]', 'FIBEMO', overlay = true) // Create an input that specifies on which time and date lineDate = input.time(timestamp("14 November 2023 16:30"), title="Lookback start date ", group = "Date Range", confirm = true) lbackLength = input.int(defval=16, maxval = 10000, minval = 1, title="Number of candles to look back", group = "Date Range") extendLeft = input.int(defval=75, maxval = 10000, minval = 1, title="Distance from current bar to fib labels", group = "FIB LINES AND LABELS") plotBullishExpansion = input.bool(true, title="Show Bullish Expansion Levels", group = "FIB LINES AND LABELS") plotBearishExpansion = input.bool(true, title="Show Bearish Expansion Levels", group = "FIB LINES AND LABELS") plotBullishRetracement = input.bool(false, title="Show Bullish Retracement Levels", group = "FIB LINES AND LABELS") plotBearishRetracement = input.bool(false, title="Show Bearish RetracementLevels", group = "FIB LINES AND LABELS") hideLabels =input.bool(false, title="Hide All Labels", group = "FIB LINES AND LABELS") //variable for time looking back stop lineStop = lineDate -time[lbackLength] //============================================================================= var g_fibs = "Fibonacci Levels" // Get Fibonacci level user inputs //------------------------------------------------------------------------------ show_0_236 = input(true, "", inline = "Level0", group=g_fibs) value_0_236 = input(0.236, "", inline = "Level0", group=g_fibs) color_0_236 = input(#f44336, "", inline = "Level0", group=g_fibs) //------------------------------------------------------------------------------ show_0_382 = input(true, "", inline = "Level1", group=g_fibs) value_0_382 = input(0.382, "", inline = "Level1", group=g_fibs) color_0_382 = input(#527fd9, "", inline = "Level1", group=g_fibs) //------------------------------------------------------------------------------ show_0_5 = input(true, "", inline = "Level1", group=g_fibs) value_0_5 = input(0.5, "", inline = "Level1", group=g_fibs) color_0_5 = input(#4caf50, "", inline = "Level1", group=g_fibs) //------------------------------------------------------------------------------ show_0_618 = input(true, "", inline = "Level2", group=g_fibs) value_0_618 = input(0.618, "", inline = "Level2", group=g_fibs) color_0_618 = input(#009688, "", inline = "Level2", group=g_fibs) //------------------------------------------------------------------------------ show_0_65 = input(false, "", inline = "Level2", group=g_fibs) value_0_65 = input(0.65, "", inline = "Level2", group=g_fibs) color_0_65 = input(#d67149, "", inline = "Level2", group=g_fibs) //------------------------------------------------------------------------------ show_0_786 = input(true, "", inline = "Level3", group=g_fibs) value_0_786 = input(0.786, "", inline = "Level3", group=g_fibs) color_0_786 = input(#642abd, "", inline = "Level3", group=g_fibs) //------------------------------------------------------------------------------ show_1 = input(true, "", inline = "Level3", group=g_fibs) value_1 = input(1, "", inline = "Level3", group=g_fibs) color_1 = input(#787b86, "", inline = "Level3", group=g_fibs) //------------------------------------------------------------------------------ show_1_272 = input(false, "", inline = "Level4", group=g_fibs) value_1_272 = input(1.272, "", inline = "Level4", group=g_fibs) color_1_272 = input(#81c784, "", inline = "Level4", group=g_fibs) //------------------------------------------------------------------------------ show_1_414 = input(false, "", inline = "Level4", group=g_fibs) value_1_414 = input(1.414, "", inline = "Level4", group=g_fibs) color_1_414 = input(#f44336, "", inline = "Level4", group=g_fibs) //------------------------------------------------------------------------------ show_1_618 = input(true, "", inline = "Level5", group=g_fibs) value_1_618 = input(1.618, "", inline = "Level5", group=g_fibs) color_1_618 = input(#298377, "", inline = "Level5", group=g_fibs) //------------------------------------------------------------------------------ show_1_65 = input(false, "", inline = "Level5", group=g_fibs) value_1_65 = input(1.65, "", inline = "Level5", group=g_fibs) color_1_65 = input(#e39562, "", inline = "Level5", group=g_fibs) //------------------------------------------------------------------------------ show_2_618 = input(true, "", inline = "Level6", group=g_fibs) value_2_618 = input(2.618, "", inline = "Level6", group=g_fibs) color_2_618 = input(#34700a, "", inline = "Level6", group=g_fibs) //------------------------------------------------------------------------------ show_2_65 = input(false, "", inline = "Level6", group=g_fibs) value_2_65 = input(2.65, "", inline = "Level6", group=g_fibs) color_2_65 = input(#f44336, "", inline = "Level6", group=g_fibs) //------------------------------------------------------------------------------ show_3_618 = input(true, "", inline = "Level7", group=g_fibs) value_3_618 = input(3.618, "", inline = "Level7", group=g_fibs) color_3_618 = input(#8cad3f, "", inline = "Level7", group=g_fibs) //------------------------------------------------------------------------------ show_3_65 = input(false, "", inline = "Level7", group=g_fibs) value_3_65 = input(3.65, "", inline = "Level7", group=g_fibs) color_3_65 = input(#9c27b0, "", inline = "Level7", group=g_fibs) //------------------------------------------------------------------------------ show_4_236 = input(false, "", inline = "Level8", group=g_fibs) value_4_236 = input(4.236, "", inline = "Level8", group=g_fibs) color_4_236 = input(#e91e63, "", inline = "Level8", group=g_fibs) //------------------------------------------------------------------------------ show_4_618 = input(true, "", inline = "Level8", group=g_fibs) value_4_618 = input(4.618, "", inline = "Level8", group=g_fibs) color_4_618 = input(#87114f, "", inline = "Level8", group=g_fibs) //------------------------------------------------------------------------------ ///Retacement levels var r_fibs = "Fibonacci Retracement Levels" // Get Fibonacci level user inputs show_0_2360 = input(true, "", inline = "Level0", group=r_fibs) value_0_2360 = input(0.236, "", inline = "Level0", group=r_fibs) color_0_2360 = input(#493fcc, "", inline = "Level0", group=r_fibs) //------------------------------------------------------------------------------ show_0_3820 = input(true, "", inline = "Level1", group=r_fibs) value_0_3820 = input(0.382, "", inline = "Level1", group=r_fibs) color_0_3820 = input(#6b188c, "", inline = "Level1", group=r_fibs) //------------------------------------------------------------------------------ show_0_50 = input(true, "", inline = "Level1", group=r_fibs) value_0_50 = input(0.5, "", inline = "Level1", group=r_fibs) color_0_50 = input(#299e4c, "", inline = "Level1", group=r_fibs) //------------------------------------------------------------------------------ show_0_6180 = input(true, "", inline = "Level2", group=r_fibs) value_0_6180 = input(0.618, "", inline = "Level2", group=r_fibs) color_0_6180 = input(#009688, "", inline = "Level2", group=r_fibs) //------------------------------------------------------------------------------ show_0_650 = input(false, "", inline = "Level2", group=r_fibs) value_0_650 = input(0.65, "", inline = "Level2", group=r_fibs) color_0_650 = input(#d67149, "", inline = "Level2", group=r_fibs) //------------------------------------------------------------------------------ show_0_7860 = input(true, "", inline = "Level3", group=r_fibs) value_0_7860 = input(0.786, "", inline = "Level3", group=r_fibs) color_0_7860 = input(#87114f, "", inline = "Level3", group=r_fibs) // Draw the vertical line at the input's specified time and date if barstate.islastconfirmedhistory line.new(x1=lineDate, y1=high, x2=lineDate, y2=low, extend=extend.both, color=color.orange, width=2, xloc=xloc.bar_time) line.new(x1=lineStop, y1=high, x2=lineStop, y2=low, extend=extend.both, color=color.rgb(18, 187, 244), width=2, xloc=xloc.bar_time) var l0 = label (na) var l20 = label (na) var myBox = box (na) //variable for getting high and low of the defined timeframe interval var float Val_high = na var float Val_low = na //variables for highest and lowest values in the interval of time choosed by user var topLine = line.new(x1=na, y1=na, x2=na, y2=na, extend =extend.right, color=color.rgb(146, 254, 149, 15), style=line.style_dotted, width=2) var bottomLine = line.new(x1=na, y1=na, x2=na, y2=na, extend =extend.right, color=color.rgb(255, 82, 82), style=line.style_dotted, width=2) //decimals numbers default is 2, users can use up to 8 decimals to display fibonacci levels decimals = input.int(2, "Decimals for fibonacci lines", maxval = 8) var string decs =na if decimals == 0 decs := "#" else if decimals == 1 decs :="#.#" else if decimals == 2 decs :="#.##" else if decimals == 3 decs :="#.###" else if decimals == 4 decs :="#.####" else if decimals == 5 decs :="#.#####" else if decimals == 6 decs :="#.######" else if decimals == 7 decs :="#.#######" else if decimals == 8 decs :="#.########" // Draw fibonacci levels as lines and return the line object ID draw_fib_line(price, col) => var id = line.new(x1=na, y1=na, x2=na, y2=na, color=col, width=1, style=line.style_solid, extend=extend.left) line.set_xy1(id, bar_index-200, price) line.set_xy2(id, bar_index + extendLeft , price) id processLeveBearish(show, value, colorL) => if show fibPrice = Val_low * math.pow(Val_low/Val_high, value) lineId = draw_fib_line(fibPrice, colorL) // if close < fibPrice // line.set_style(lineId, line.style_dashed) lineId drawlabelsbearish(show, value, colorL) => if show and hideLabels == false fibPrice = Val_low * math.pow(Val_low/Val_high, value) labelId =label.new(bar_index+extendLeft, fibPrice, str.tostring(value) + " Bearish Expansion : " + str.tostring(fibPrice, decs), color=#00000000, textcolor=colorL, style=label.style_label_left, size=size.normal) label.delete(labelId[1]) labelId processLeveBearishRetracement(show, value, colorL) => if show fibPrice = Val_low * math.pow(Val_high/Val_low, value) lineId = draw_fib_line(fibPrice, colorL) // if close < fibPrice // line.set_style(lineId, line.style_dashed) lineId drawlabelsbearishRetracement(show, value, colorL) => if show and hideLabels == false fibPrice = Val_low * math.pow(Val_high/Val_low, value) labelId =label.new(bar_index+extendLeft, fibPrice, str.tostring(value) + " Bearish Retracement : " + str.tostring(fibPrice, decs), color=#00000000, textcolor=colorL, style=label.style_label_left, size=size.normal) label.delete(labelId[1]) labelId processLeveBbullish(show, value, colorL) => if show fibPrice = Val_high * math.pow(Val_high/Val_low, value) lineId = draw_fib_line(fibPrice, colorL) // if close > fibPrice // line.set_style(lineId, line.style_dashed) lineId drawlabelsBullish(show, value, colorL) => if show and hideLabels == false fibPrice = Val_high * math.pow(Val_high/Val_low, value) labelId =label.new(bar_index+extendLeft, fibPrice, str.tostring(value) + " Bullish Expansion : " + str.tostring(fibPrice, decs), color=#00000000, textcolor=colorL, style=label.style_label_left, size=size.normal) label.delete(labelId[1]) labelId processLeveBbullishRetracement(show, value, colorL) => if show fibPrice = Val_high * math.pow(Val_low/Val_high, value) lineId = draw_fib_line(fibPrice, colorL) // if close > fibPrice // line.set_style(lineId, line.style_dashed) lineId drawlabelsBullishRetracement(show, value, colorL) => if show and hideLabels == false fibPrice = Val_high * math.pow(Val_low/Val_high, value) labelId =label.new(bar_index+extendLeft, fibPrice, str.tostring(value) + " Bullish Retracement : " + str.tostring(fibPrice, decs), color=#00000000, textcolor=colorL, style=label.style_label_left, size=size.normal) label.delete(labelId[1]) labelId taHi = ta.highest(high, lbackLength) taLow =ta.lowest(low, lbackLength) //check for user time imput and set the values for highest and lowest lines if time <= lineDate Val_high := taHi Val_low := taLow line.set_xy1(id=topLine, x=bar_index[1]- lbackLength, y=Val_high) line.set_xy2(id=topLine, x=bar_index+5, y=Val_high) line.set_xy1(id=bottomLine, x=bar_index[1]- lbackLength, y=Val_low) line.set_xy2(id=bottomLine, x=bar_index+5, y=Val_low) l0 := label.new(bar_index[1]- lbackLength, Val_high, str.tostring(Val_high, decs) + ' is Highest of ' + str.tostring(lbackLength) + ' bars from ' + str.format_time(lineDate, "d-M-yyyy HH:mm", "UTC+3"), color=color.rgb(25, 85, 34), textcolor=color.white, style=label.style_label_lower_right, size=size.normal) l20 := label.new(bar_index[1]- lbackLength, Val_low, str.tostring(Val_low, decs) + ' is Lowest of ' + str.tostring(lbackLength) + ' bars from ' + str.format_time(lineDate, "d-M-yyyy HH:mm", "UTC+3"), color=color.rgb(255, 0, 0, 25), textcolor=color.white, style=label.style_label_upper_right, size=size.normal) label.delete(l0[1]) label.delete(l20[1]) myBox := box.new(bar_index-lbackLength, Val_high, bar_index, Val_low, border_color=color.rgb(155, 39, 176, 77), border_width=1,bgcolor=na) box.set_bgcolor(id=myBox, color=color.rgb(135, 75, 233, 77)) box.delete(myBox[1]) //processing the bullish expansion levels if (plotBullishExpansion == true) lineId1 = processLeveBbullish(show_0_236, value_0_236, color_0_236) lineId2 = processLeveBbullish(show_0_382, value_0_382, color_0_382) lineId3 = processLeveBbullish(show_0_5, value_0_5, color_0_5) lineId4 = processLeveBbullish(show_0_618, value_0_618, color_0_618) lineId5 = processLeveBbullish(show_0_65, value_0_65, color_0_65) lineId6 = processLeveBbullish(show_0_786, value_0_786, color_0_786) lineId7 = processLeveBbullish(show_1, value_1, color_1) lineId8 = processLeveBbullish(show_1_272, value_1_272, color_1_272) lineId9 = processLeveBbullish(show_1_414, value_1_414, color_1_414) lineId10 = processLeveBbullish(show_1_618, value_1_618, color_1_618) lineId11 = processLeveBbullish(show_1_65, value_1_65, color_1_65 ) lineId12 = processLeveBbullish(show_2_618, value_2_618, color_2_618 ) lineId13 = processLeveBbullish(show_2_65, value_2_65, color_2_65 ) lineId14 = processLeveBbullish(show_3_618, value_3_618, color_3_618 ) lineId15 = processLeveBbullish(show_3_65, value_3_65, color_3_65 ) lineId16 = processLeveBbullish(show_4_236, value_4_236, color_4_236) lineId17 = processLeveBbullish(show_4_618, value_4_618, color_4_618 ) //drawing the bullish expansion levels labelId1 = drawlabelsBullish(show_0_236, value_0_236, color_0_236) labelId2 = drawlabelsBullish(show_0_382, value_0_382, color_0_382) labelId3 = drawlabelsBullish(show_0_5, value_0_5, color_0_5) labelId4 = drawlabelsBullish(show_0_618, value_0_618, color_0_618) labelId5 = drawlabelsBullish(show_0_65, value_0_65, color_0_65) labelId6 = drawlabelsBullish(show_0_786, value_0_786, color_0_786) labelId7 = drawlabelsBullish(show_1, value_1, color_1) labelId8 = drawlabelsBullish(show_1_272, value_1_272, color_1_272) labelId9 = drawlabelsBullish(show_1_414, value_1_414, color_1_414) labelId10 = drawlabelsBullish(show_1_618, value_1_618, color_1_618) labelId11 = drawlabelsBullish(show_1_65, value_1_65, color_1_65 ) labelId12 = drawlabelsBullish(show_2_618, value_2_618, color_2_618 ) labelId13 = drawlabelsBullish(show_2_65, value_2_65, color_2_65 ) labelId14 = drawlabelsBullish(show_3_618, value_3_618, color_3_618 ) labelId15 = drawlabelsBullish(show_3_65, value_3_65, color_3_65 ) labelId16 = drawlabelsBullish(show_4_236, value_4_236, color_4_236) labelId17 = drawlabelsBullish(show_4_618, value_4_618, color_4_618 ) //processing the bullish retracement levels if (plotBullishRetracement == true) //negative fibs for retracement lineId101 = processLeveBbullishRetracement(show_0_2360, value_0_2360, color_0_2360) lineId201 = processLeveBbullishRetracement(show_0_3820, value_0_3820, color_0_3820) lineId301 = processLeveBbullishRetracement(show_0_50, value_0_50, color_0_50) lineId401 = processLeveBbullishRetracement(show_0_6180, value_0_6180, color_0_6180) lineId501 = processLeveBbullishRetracement(show_0_650, value_0_650, color_0_650) lineId601 = processLeveBbullishRetracement(show_0_7860, value_0_7860, color_0_7860) // draw retracement levels labelId101 = drawlabelsBullishRetracement(show_0_2360, value_0_2360, color_0_2360) labelId201 = drawlabelsBullishRetracement(show_0_3820, value_0_3820, color_0_3820) labelId301 = drawlabelsBullishRetracement(show_0_50, value_0_50, color_0_50) labelId401 = drawlabelsBullishRetracement(show_0_6180, value_0_6180, color_0_6180) labelId501 = drawlabelsBullishRetracement(show_0_650, value_0_650, color_0_650) labelId601 = drawlabelsBullishRetracement(show_0_7860, value_0_7860, color_0_7860) //processing the bearish expansion levels if (plotBearishExpansion == true) lineId1 = processLeveBearish(show_0_236, value_0_236, color_0_236) lineId2 = processLeveBearish(show_0_382, value_0_382, color_0_382) lineId3 = processLeveBearish(show_0_5, value_0_5, color_0_5) lineId4 = processLeveBearish(show_0_618, value_0_618, color_0_618) lineId5 = processLeveBearish(show_0_65, value_0_65, color_0_65) lineId6 = processLeveBearish(show_0_786, value_0_786, color_0_786) lineId7 = processLeveBearish(show_1, value_1, color_1) lineId8 = processLeveBearish(show_1_272, value_1_272, color_1_272) lineId9 = processLeveBearish(show_1_414, value_1_414, color_1_414) lineId10 = processLeveBearish(show_1_618, value_1_618, color_1_618) lineId11 = processLeveBearish(show_1_65, value_1_65, color_1_65 ) lineId12 = processLeveBearish(show_2_618, value_2_618, color_2_618 ) lineId13 = processLeveBearish(show_2_65, value_2_65, color_2_65 ) lineId14 = processLeveBearish(show_3_618, value_3_618, color_3_618 ) lineId15 = processLeveBearish(show_3_65, value_3_65, color_3_65 ) lineId16 = processLeveBearish(show_4_236, value_4_236, color_4_236) lineId17 = processLeveBearish(show_4_618, value_4_618, color_4_618 ) labelId01 = drawlabelsbearish(show_0_236, value_0_236, color_0_236) labelId02 = drawlabelsbearish(show_0_382, value_0_382, color_0_382) labelId03 = drawlabelsbearish(show_0_5, value_0_5, color_0_5) labelId04 = drawlabelsbearish(show_0_618, value_0_618, color_0_618) labelId05 = drawlabelsbearish(show_0_65, value_0_65, color_0_65) labelId06 = drawlabelsbearish(show_0_786, value_0_786, color_0_786) labelId07 = drawlabelsbearish(show_1, value_1, color_1) labelId08 = drawlabelsbearish(show_1_272, value_1_272, color_1_272) labelId09 = drawlabelsbearish(show_1_414, value_1_414, color_1_414) labelId010 = drawlabelsbearish(show_1_618, value_1_618, color_1_618) labelId101 = drawlabelsbearish(show_1_65, value_1_65, color_1_65 ) labelId012 = drawlabelsbearish(show_2_618, value_2_618, color_2_618 ) labelId013 = drawlabelsbearish(show_2_65, value_2_65, color_2_65 ) labelId014 = drawlabelsbearish(show_3_618, value_3_618, color_3_618 ) labelId015 = drawlabelsbearish(show_3_65, value_3_65, color_3_65 ) labelId016 = drawlabelsbearish(show_4_236, value_4_236, color_4_236) labelId017 = drawlabelsbearish(show_4_618, value_4_618, color_4_618 ) //processing the bearish retracement levels if (plotBearishRetracement == true) //negative fibs for retracement lineId10122 = processLeveBearishRetracement(show_0_2360, value_0_2360, color_0_2360) lineId20122 = processLeveBearishRetracement(show_0_3820, value_0_3820, color_0_3820) lineId30122 = processLeveBearishRetracement(show_0_50, value_0_50, color_0_50) lineId40122 = processLeveBearishRetracement(show_0_6180, value_0_6180, color_0_6180) lineId50122 = processLeveBearishRetracement(show_0_650, value_0_650, color_0_650) lineId60122 = processLeveBearishRetracement(show_0_7860, value_0_7860, color_0_7860) // draw bearish retracement levels labelId10122 = drawlabelsbearishRetracement(show_0_2360, value_0_2360, color_0_2360) labelId20122 = drawlabelsbearishRetracement(show_0_3820, value_0_3820, color_0_3820) labelId30122 = drawlabelsbearishRetracement(show_0_50, value_0_50, color_0_50) labelId40122 = drawlabelsbearishRetracement(show_0_6180, value_0_6180, color_0_6180) labelId50122 = drawlabelsbearishRetracement(show_0_650, value_0_650, color_0_650) labelId60122 = drawlabelsbearishRetracement(show_0_7860, value_0_7860, color_0_7860)
True Strength [PINESCRIPTLABS]
https://www.tradingview.com/script/aF01pQY1/
PINE_LABS
https://www.tradingview.com/u/PINE_LABS/
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/ // ยฉ PINE_LABS //@version=5 indicator("True Strength [PINESCRIPTLABS]", shorttitle="True Strength [PINESCRIPTLABS]", format=format.price, precision=4, timeframe="", timeframe_gaps=true,overlay =false) long = input(title="Long Length", defval=40) short = input(title="Short Length", defval=40) signal = input(title="Signal Length", defval=13) buy_tsi_value = input(title="Buy TSI Value", defval=-40.0) sell_tsi_value = input(title="Sell TSI Value", defval=40.0) price = close double_smooth(src, long, short) => fist_smooth = ta.ema(src, long) ta.ema(fist_smooth, short) pc = ta.change(price) double_smoothed_pc = double_smooth(pc, long, short) double_smoothed_abs_pc = double_smooth(math.abs(pc), long, short) tsi_value = 100 * (double_smoothed_pc / double_smoothed_abs_pc) plot(tsi_value, title="True Strength Index", color=#2962FF) plot(ta.ema(tsi_value, signal), title="Signal", color=#E91E63) hline(0, title="Zero", color=#787B86) buySignal = tsi_value <= buy_tsi_value sellSignal = tsi_value >= sell_tsi_value plotshape(buySignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small) plotshape(sellSignal, style=shape.triangledown, location=location.top, color=color.red, size=size.small) plot(buy_tsi_value, style=plot.style_linebr, color=color.green) plot(sell_tsi_value, style=plot.style_linebr, color=color.red)
The Next Pivot [Kioseff Trading]
https://www.tradingview.com/script/pLzwXOug-The-Next-Pivot-Kioseff-Trading/
KioseffTrading
https://www.tradingview.com/u/KioseffTrading/
800
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // ยฉ Kioseff Trading //@version=5 indicator("The Next Pivot [Kioseff Trading]", overlay=true, max_lines_count = 500, max_boxes_count = 500, max_labels_count = 500) import TradingView/ZigZag/6 as ZigZagLib import HeWhoMustNotBeNamed/arraymethods/1 import RicardoSantos/MathOperator/2 historical = input.int(defval = 20, title = "Correlation Length", minval = 5, maxval = 100, group = "How Long Should The Correlating Sequences Be? (Bars Back)") forecastLen = input.int(defval = 50, minval = 15, maxval = 250, title = "Forecast Length", group = "How Long Should The Forecast Be?") typec = input.string("Cosine Similarity", title = "Similarity Calculation", options = ["Spearmen", "Pearson", "Euclidean (Absolute Difference)", "Cosine Similarity", "Mean Squared Error", "Kendall"], group = "Similarity Method"), var t = time simtype = input.string(defval = "Price", title = "Looks For Similarities In", options = ["%Change", "Price"], group = "Similarity Method") tim = input.int(defval = 5000, minval = 500, step = 1000, title = "Bars Back To Search", group ="How Many Bars Back Should We Look To Find The Most Similar Sequence?") zonly = input.bool(defval = true , title = "Show Projected Zig Zag" , group = "Aesthetics", inline = "Projected") ponly = input.bool(defval = true, title = "Show Projected Price Path", group = "Aesthetics", inline = "Projected") on = input.bool(defval = false, title = "", inline = "Lin", group = "Aesthetics") stdev = input.float(defval = 1, title = "Lin Reg ฯƒ", minval = 0, step = 0.1, inline = "Lin", group = "Aesthetics") projcol = input.color(defval = #14D990, title = "Projected Zig Zag Color", inline = "1", group = "Aesthetics") forecastCol = input.color(defval = color.white , title = "Forecast Colorโ€€โ€€", inline = "1", group = "Aesthetics") var ret = array.new_float(), var mastertime = array.new_int(), result = matrix.new<float>(2, 1, -1e8), float [] recRet = na method rankEstimate(array <float> id, iteration) => math.round((id.percentrank(iteration) / 100) * (historical - 1) + 1) method effSlice(array<float> id, iteration) => id.slice(iteration, iteration + historical) method update (matrix <float> id, float id2, i) => if id2.over_equal(id.get(0, 0)) id.set(0, 0, id2) id.set(1, 0, i) method spearmen (matrix <float> id) => denominator = (historical * (math.pow(historical, 2) - 1)) estimate = array.new_int() for i = 0 to recRet.size() - 1 estimate.push(recRet.rankEstimate(i)) for i = 0 to ret.size() - historical * 2 - forecastLen slice = ret.effSlice(i) d2 = array.new_float(historical) for x = 0 to historical - 1 s = estimate.get(x) s1 = slice.rankEstimate(x) fin = math.pow(s - s1, 2) d2.set(x, fin) r = 1 - (6 * d2.sum()) / denominator id.update(i, r) method pearson (matrix <float> id) => stdevA = recRet.stdev() for i = 0 to ret.size() - historical * 2 - forecastLen slice = ret.effSlice(i) p = slice.covariance(recRet) / (stdevA * slice.stdev()) id.update(p, i) method euc (matrix <float> id) => for i = 0 to ret.size() - historical * 2 - forecastLen slice = ret.effSlice(i) euc = array.new_float(historical) for x = 0 to historical - 1 euc.set(x, math.pow(recRet.get(x) - slice.get(x), 2)) inv = 1 / (1 + math.sqrt(euc.sum())) id.update(inv, i) method cosine(matrix <float> id) => nA = 0. for i = 0 to recRet.size() - 1 nA += math.pow(recRet.get(i), 2) nA := math.sqrt(nA) for i = 0 to ret.size() - historical * 2 - forecastLen slice = ret.effSlice(i) prod = 0., nB = 0. for x = 0 to historical - 1 prod += recRet.get(x) * slice.get(x) nB += math.pow(slice.get(x), 2) cos = prod / (nA * math.sqrt(nB)) id.update(cos, i) method mse (matrix <float> id) => for i = 0 to ret.size() - historical * 2 - forecastLen slice = ret.effSlice(i) mse = array.new_float(historical) for x = 0 to historical - 1 mse.set(x, math.pow(slice.get(x) - recRet.get(x), 2)) mseC = 1 / (1 + mse.sum() / historical) id.update(mseC, i) method kendall (matrix <float> id) => for i = 0 to ret.size() - historical * 2 - forecastLen slice = ret.effSlice(i) valMat = matrix.new<float>(4, math.ceil(slice.size() * (slice.size() - 1) / 2), 0) iteration = 0 for x = 0 to slice.size() - 1 for y = x + 1 to historical - 1 if y > historical - 1 break diff1 = recRet.get(y) - recRet.get(x) diff2 = slice.get(y) - slice.get(x) switch math.sign(diff1 * diff2) 1 => valMat.set(0, iteration, 1) -1 => valMat.set(1, iteration, 1) if diff1.equal(0) valMat.set(2, iteration, 1) if diff2.equal(0) valMat.set(3, iteration, 1) iteration += 1 con = valMat.row(0).sum(), dis = valMat.row(1).sum() aT = valMat.row(2).sum(), bT = valMat.row(3).sum() fin = (con - dis) / math.sqrt((con + dis + aT) * (con + dis + bT)) id.update(fin, i) method determine(bool id, a, b) => switch id true => a => b method updateZig(array <line> id, x1, y1, x2, y2) => id.push(line.new(x1, y1, x2, y2, color = projcol, width = 2)) method float (int id) => float(id) var zigZag = ZigZagLib.newInstance( ZigZagLib.Settings.new( 0.00001, //input.float(0.00001, "Price deviation for reversals (%)", 0.00001, 100.0, 0.5, "0.00001 - 100", group = "Aesthetics"), 5, //input.int(5, "Pivot legs", 2, group = "Aesthetics"), #00000000, //input(#2962FF, "Line color", group = "Aesthetics", inline = "1"), false, //input(true, "Extend to last bar"), false, //input(false, "Display reversal price", group = "Aesthetics"), false, //input(false, "Display cumulative volume", group = "Aesthetics"), false, //input(false, "Display reversal price change", inline = "priceRev", group = "Aesthetics"), "Absolute", //input.string("Absolute", "", ["Absolute", "Percent"], inline = "priceRev", group = "Aesthetics"), true) ), zigZag.update() if typec == "Kendall" tim := math.min(tim, 1500) historical := math.min(20, historical) var closeArr = array.new_float(), var loArr = array.new_float() var hiArr = array.new_float(), var timeArr = array.new_int (), mastertime.push(time) if last_bar_index - bar_index <= tim val = switch simtype "%Change" => math.log(close / close[1]) => close timeArr .push(time), closeArr.push(close) ret .push(val) , loArr .push(low), hiArr .push(high) if barstate.islastconfirmedhistory lineAll = line.all, box.all.flush() var xcor = last_bar_index for i = 0 to lineAll.size() - 1 if lineAll.get(i).get_x2() > t for x = mastertime.size() - 1 to 0 if mastertime.get(x).float().equal(lineAll.get(i).get_x2()) xcor := x break if lineAll.size().float().over(0) for i = lineAll.size() - 1 to 0 if lineAll.get(i).get_x2().float().under(1e8) lineAll.get(i).delete() recRet := ret.slice(ret.size() - historical, ret.size()) switch typec "Spearmen" => result.spearmen() "Pearson" => result.pearson () "Euclidean (Absolute Difference)" => result.euc () "Cosine Similarity" => result.cosine () "Mean Squared Error" => result.mse () "Kendall" => result.kendall () startarr = int(result.get(1, 0)) midarr = startarr + historical endarr = midarr + forecastLen float [] lineData = na if simtype == "%Change" lineData := ret.slice(startarr + historical + 1, endarr + 1) else lineData := array.new_float() for i = startarr + historical + 1 to endarr lineData.push(closeArr.get(i) / closeArr.get(i - 1) - 1) projectZig = array.new_line(), lines = array.new_line(), diffArr = array.new_float() if lineAll.size().float().over(0) for i = 1 to lineAll.size() - 1 diffArr.push(math.abs((lineAll.get(i).get_y2() - lineAll.get(i - 1).get_y2()) / lineAll.get(i - 1).get_y2())) lasty2 = lineAll.last().get_y2(), lasty22 = lineAll.get(lineAll.size() - 2).get_y2(), threshold = diffArr.percentile_nearest_rank(25) lines.push(line.new(bar_index, close, bar_index + 1, close * (1 + lineData.first()), color = ponly.determine(forecastCol, #00000000), style = line.style_dotted )) if zonly projectZig.updateZig(xcor, lineAll.last().get_y2(), bar_index, lasty22.under(lasty2).determine(low, high)) for i = 1 to lineData.size() - 1 lines.push( line.new( lines.get(i - 1).get_x2(), lines.get(i - 1).get_y2(), lines.get(i - 1).get_x2() + 1, lines.get(i - 1).get_y2() * (1 + lineData.get(i)), color = ponly.determine(forecastCol, #00000000), style = line.style_dotted)) if zonly if projectZig.size().float().equal(1) if lasty22.under(lasty2) var min = 1e8, var max = 0. min := math.min(lines.last().get_y2(), min, projectZig.last().get_y2()) switch min.equal(lines.last().get_y2()) true => max := 0 => max := math.max(max, lines.last().get_y2()) projectZig.last().set_y2(min) projectZig.last().set_x2(min.equal(lines.last().get_y2()).determine(lines.last().get_x2(), projectZig.last().get_x2())) if math.abs((max - min) / min).over_equal(threshold) and max.not_equal(0) maxmap = map.new<float, int>(), count = hiArr.size() - 1 for x = mastertime.size() - 1 to 0 switch mastertime.get(x) > lineAll.last().get_x2() true => maxmap.put(hiArr.get(count), x) => break count -= 1 keymaxx = maxmap.keys() if keymaxx.max() > projectZig.last().get_y1() projectZig.last().set_xy1(maxmap.get(keymaxx.max()), keymaxx.max()) projectZig.updateZig(projectZig.last().get_x2(), projectZig.last().get_y2(), lines.last().get_x2(), max) else if i.float().equal(1) min = map.new<float, int>(), count = loArr.size() - 1 for x = mastertime.size() - 1 to 0 switch mastertime.get(x).float().over_equal(lineAll.last().get_x2()) true => min.put(loArr.get(count), x) => break count -= 1 keys = min.keys() if keys.min().under(projectZig.last().get_y2()) projectZig.last().set_y2(math.min(keys.min(), lines.last().get_y2())) x2 = switch lines.last().get_y2().under(keys.min()) true => lines.last().get_x2() => min .get(keys.min()) projectZig.last().set_x2(x2), projectZig.last().set_x1(mastertime.indexof(lineAll.get(lineAll.size() - 2).get_x2())) projectZig.last().set_y1(lineAll.get(lineAll.size() - 2).get_y2()) projectZig.updateZig(projectZig.last().get_x2(), projectZig.last().get_y2(), lines.last().get_x2(), lines.last().get_y2()) var min = 1e8, var max = 0. max := math.max(lines.last().get_y2(), max) switch max.equal(lines.last().get_y2()) true => min := 1e8 => min := math.min(min, lines.last().get_y2()) projectZig.last().set_y2(max) projectZig.last().set_x2(max.equal(lines.last().get_y2()).determine(lines.last().get_x2(), projectZig.last().get_x2())) if math.abs((max - min) / min).over_equal(threshold) and min.not_equal(1e8) projectZig.updateZig(projectZig.last().get_x2(), projectZig.last().get_y2(), lines.last().get_x2(), min) else if projectZig.size().float().over(1) if projectZig.last().get_y2().over_equal(projectZig.get(projectZig.size() - 2).get_y2()) var max =0., var min = 1e8 max := math.max(max, lines.last().get_y2(), projectZig.last().get_y2()) switch max.equal(lines.last().get_y2()) true => min := 1e8 => min := math.min(min, lines.last().get_y2()) projectZig.last().set_y2(math.max(max, projectZig.last().get_y2())) projectZig.last().set_x2(max.equal(lines.last().get_y2()).determine(lines.last().get_x2(), projectZig.last().get_x2())) if math.abs((max - min) / min).over_equal(threshold) and min.not_equal(1e8) if projectZig.size().float().over(2) or projectZig.size().float().equal(2) and projectZig.first().get_y1().equal(lineAll.last().get_y2()) projectZig.updateZig(projectZig.last().get_x2(), projectZig.last().get_y2(), lines.last().get_x2(), min) else if projectZig.size().float().equal(2) maxx = map.new<float, int>(), count = hiArr.size() - 1 for x = mastertime.size() - 1 to 0 switch mastertime.get(x).float().over(lineAll.last().get_x2()) true => maxx.put(hiArr.get(count), x) => break count -= 1 keyMax = maxx.keys() if keyMax.max().over(max) projectZig.last().set_y2(keyMax.max()), projectZig.last().set_x2(maxx.get(keyMax.max())) if projectZig.last().get_x1().float().not_equal(last_bar_index) switch lineAll.last().get_x1().float().over(lineAll.last().get_x2()) true => projectZig.last().set_xy1(mastertime.indexof(lineAll.last().get_x1()), lineAll.last().get_y1()) => projectZig.last().set_xy1(mastertime.indexof(lineAll.last().get_x2()), lineAll.last().get_y2()) projectZig.remove(projectZig.size() - 2).delete() projectZig.updateZig(projectZig.last().get_x2(), projectZig.last().get_y2(), lines.last().get_x2(), min) max := 0, min := 1e8 else if projectZig.last().get_y2().under(projectZig.get(projectZig.size() - 2).get_y2()) var min = 1e8, var max = 0. min := math.min(lines.last() .get_y2(), min, projectZig.last().get_y2()) switch min.equal(lines.last().get_y2()) true => max := 0 => max := math.max(max, lines.last().get_y2()) projectZig.last().set_y2(min) projectZig.last().set_x2(min.equal(lines.last().get_y2()).determine(lines.last().get_x2(), projectZig.last().get_x2())) if math.abs((max - min) / min).over_equal(threshold) and max.not_equal(0) if projectZig.size().float().over(1) max := 0, min := 1e8 projectZig.updateZig(projectZig.last().get_x2(), projectZig.last().get_y2(), lines.last().get_x2(), lines.last().get_y2()) if i.float().equal(lineData.size() - 1) if projectZig.size().float().equal(1) valMap = map.new<float, int>() for x = lines.size() - 1 to 0 switch lines.get(x).get_x2().float().over(projectZig.last().get_x2()) true => valMap.put(lines.get(x).get_y2(), x) => break keys = valMap.keys(), cond = projectZig.last().get_y2().under(projectZig.last().get_y1()) [finx, finy] = switch cond true => [valMap.get(keys.max()), keys.max()] => [valMap.get(keys.min()), keys.min()] projectZig.updateZig(projectZig.last().get_x2(), projectZig.last().get_y2(), bar_index + finx + 1, finy) if on linReg = matrix.new<float>(4, forecastLen) for i = 0 to forecastLen - 1 linReg.set(0, i, i + 1), linReg.set(1, i, lines.get(i).get_y2()) b = linReg.row(0) for i = 0 to lineData.size() - 1 linReg.set(2, i, math.pow(b.get(i) - b.avg(), 2)) linReg.set(3, i, (b.get(i) - b.avg()) * (linReg.row(1).get(i) - linReg.row(1).avg())) bx = linReg.row(3).sum() / linReg.row(2).sum() mx = linReg.row(1).avg() - (bx * b.avg()) upper = line.new(bar_index, (bx + mx) + linReg.row(1).stdev() * stdev, bar_index + linReg.row(1).size(), (bx * linReg.row(1).size() + mx) + linReg.row(1).stdev() * stdev, color = #6929F2 ) lower = line.new(bar_index, (bx + mx) - linReg.row(1).stdev() * stdev, bar_index + linReg.row(1).size(), (bx * linReg.row(1).size() + mx) - linReg.row(1).stdev() * stdev, color = #6929F2 ) linefill.new(upper, lower, color.new(#6929F2, 75)) slicex = closeArr.slice(startarr, endarr + 1) sliceHi = hiArr .slice(closeArr.size() - historical, closeArr.size()) sliceLo = loArr .slice(closeArr.size() - historical, closeArr.size()) box.new(timeArr.get(startarr), slicex.min(), timeArr.get(midarr), slicex.max(), bgcolor = color.new(color.blue, 70), xloc = xloc.bar_time, border_color = #00000000 ) box.new(timeArr.get(midarr), slicex.min(), timeArr.get(endarr), slicex.max(), bgcolor = color.new(forecastCol, 70), xloc = xloc.bar_time, border_color = #00000000 ) box.new(bar_index - historical + 1, sliceHi.max(), bar_index, sliceLo.min(), bgcolor = color.new(color.blue, 80), border_color = #00000000 ) var tab = table.new(position.bottom_right, 5, 5, frame_color = color.white, border_color = color.white, frame_width = 1, border_width = 1) tab.cell(0, 0, text = "Searching " + str.tostring(math.min(last_bar_index, tim), "##") + " Bars Back", text_color = color.white, text_size = size.small , bgcolor = #00000050)
K Line Pow Moving Average Convergence Divergence
https://www.tradingview.com/script/pfzYaOJn/
lihulu123
https://www.tradingview.com/u/lihulu123/
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/ // ยฉ lihulu123 //@version=5 indicator(title="K Line Pow Moving Average Convergence Divergence", shorttitle="KLinePowMACD",max_boxes_count=40000,max_bars_back=500) // Getting inputs fast_length = input(title="Fast Length", defval=12) slow_length = input(title="Slow Length", defval=26) src = input(title="Source", defval=close) signal_length = input.int(title="Signal Smoothing", minval = 1, maxval = 50, defval = 9) sma_source = input.string(title="Oscillator MA Type", defval="EMA", options=["SMA", "EMA"]) sma_signal = input.string(title="Signal Line MA Type", defval="EMA", options=["SMA", "EMA"]) // Plot colors col_macd = input(#FFFFFF, "MACD Line", group="Color Settings", inline="MACD") col_signal = input(#fbff0d, "Signal Line", group="Color Settings", inline="Signal") col_green_zhuzi_shiti = input(color.new(#089981, 0), "MACDๆŸฑๅญ", group="MACD BAR", inline="Above") col_green_zhuzi_kong = input(color.new(#089981, 100), "MACDๆŸฑๅญ", group="MACD BAR", inline="Above") col_red_zhuzi_shiti = input(color.new(#FF5252, 0), "MACDๆŸฑๅญ", group="MACD BAR", inline="Below") col_red_zhuzi_kong = input(color.new(#FF5252, 100), "MACDๆŸฑๅญ", group="MACD BAR", inline="Below") // Calculating col_green_boder = input(color.new(#089981, 0), "Fall", group="MACD BODER", inline="Above") col_red_boder = input(color.new(#FF5252, 0), "Fall", group="MACD BODER", inline="Below") fast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length) slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length) macd = fast_ma - slow_ma signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length) hist = (macd - signal)*2 hline(0, "Zero Line", color=color.new(#787B86, 50)) plot(macd, title="็™ฝ็บฟ", color=col_macd) plot(signal, title="้ป„็บฟ", color=col_signal) plotcandle(hist,0 , 0, 0,bordercolor=(hist>=0 ? col_green_boder : col_red_boder),color = (hist>=0 ? (hist[1] < hist ? col_green_zhuzi_kong : col_green_zhuzi_shiti) : (hist[1] < hist ? col_red_zhuzi_kong : col_red_zhuzi_shiti)))