// =================================================================================================
// This Pine Script™ 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="Fib Golden Wave + VWAP Divergence + RSI (Kernel Optimized)",
overlay=true, max_boxes_count=500, max_labels_count=500, max_lines_count=500, max_bars_back=5000)
// ------------------------------------------------------------------------------------------------
// === 1) GLOBÁLIS DEBUG & KONSTANSOK ===
// ------------------------------------------------------------------------------------------------
const bool DEBUG = false
const int labelCooldown = 8
const int maxDistanceToLastBar = 5000
const int KDELimit = 300
// ------------------------------------------------------------------------------------------------
// === 2) FIBONACCI GOLDEN WAVE + VWAP DIVERGENCE KÓD ===
// ------------------------------------------------------------------------------------------------
const int textBack = 2, pivLen = 10
// -- INPUTOK (egysoros) --
pivotRange = input.int(20, "Swing Range", group="General Configuration")
usePivots = DEBUG ? input.bool(false, "Use Pivots", group="General Configuration") : false
fibArea1 = input.float(0.5, "", options=[0.236,0.382,0.5,0.618,0.786], group="Golden Zone", inline="zone")
fibArea2 = input.float(0.618, " - ", options=[0.236,0.382,0.5,0.618,0.786], group="Golden Zone", inline="zone")
gzLineColor = input.color(color.new(color.yellow,80),"Golden Zone Lines",group="Style")
showArea = input.bool(true,"Show Area",group="Style",inline="area")
gzAreaColor = input.color(color.new(color.yellow,90),"",group="Style",inline="area")
textSizeFib = input.string("Normal","Text Size",options=["Auto","Small","Normal"],group="Style",inline="text")
textColorFib= input.color(color.new(color.white,30),"",group="Style",inline="text")
hideonDWM = input.bool(false,"Hide VWAP on 1D or Above",group="VWAP Settings")
src = input.source(hlc3,"Source",group="VWAP Settings")
offset = input.int(0,"Offset",group="VWAP Settings")
anchor = input.string("Session","Anchor Period",options=["Session","Week","Month","Quarter","Year","Decade","Century","Earnings","Dividends","Splits"],group="VWAP Settings")
divergenceLookback = input.int(5,"Lookback Period",group="Divergence Settings",tooltip="How long the lookback is for divergences")
divergenceATRmultiplier = input.float(3,"ATR Multiplier",group="Divergence Settings",tooltip="How much ATR is multiplied",step=0.1)
// A két indikátor is használja a "bearishColor" / "bullishColor" neveket, ezért itt "VWAP" végződés:
bearishColorVWAP = input.color(color.red,"VWAP down color",group="Visual Settings",inline="Colors")
bullishColorVWAP = input.color(color.lime,"VWAP up color",group="Visual Settings",inline="Colors")
alternateColor = input.bool(true,"Trend Coloring",group="Visual Settings",tooltip="Alternate red/green VWAP?")
showVWAP = input.bool(true,"Show VWAP",group="Visual Settings")
divergence_plot_size_input = input.string("Normal","Divergence Plot Size",options=["Small","Normal","Large"],group="Visual Settings")
float divergence_plot_size = divergence_plot_size_input=="Small"?3:divergence_plot_size_input=="Normal"?5:7
bearishAlertSignal = input.bool(true,"Bearish divergence alerts",group="Alert Settings",inline="Alert Confirmations")
bullishAlertSignal = input.bool(true,"Bullish divergence alerts",group="Alert Settings",inline="Alert Confirmations")
// --- Változók (pivot kezeléshez) ---
type pivot
bool isHigh
float price
int barTime
var pivot[] highPivots = array.new<pivot>(0)
var pivot[] lowPivots = array.new<pivot>(0)
var box tf1Text = na
float pivotHigh = na, pivotLow = na
int pHighTime = na, pLowTime = na
// -- SWING PIVOT LOGIKA --
if not usePivots
pivotHigh := ta.highest(high,pivotRange)
pHighTime := time[math.abs(ta.highestbars(high,pivotRange))]
pivotLow := ta.lowest(low,pivotRange)
pLowTime := time[math.abs(ta.lowestbars(low,pivotRange))]
else
pivotHigh := ta.pivothigh(pivotRange,pivotRange)
pHighTime := time[pivotRange]
pivotLow := ta.pivotlow(pivotRange,pivotRange)
pLowTime = time[pivotRange]
if not na(pivotHigh)
highPivots.unshift(pivot.new(true,pivotHigh,pHighTime))
if highPivots.size()>pivLen
highPivots.pop()
if not na(pivotLow)
lowPivots.unshift(pivot.new(false,pivotLow,pLowTime))
if lowPivots.size()>pivLen
lowPivots.pop()
// -- Függvények (Fib + timeframe) --
f_formatTimeframeString(tf) =>
timeframeF = tf==""?timeframe.period:tf
if str.contains(timeframeF,"D") or str.contains(timeframeF,"W") or str.contains(timeframeF,"S") or str.contains(timeframeF,"M")
timeframeF
else
seconds = timeframe.in_seconds(timeframeF)
if seconds>=3600
hourCount = int(seconds/3600)
str.tostring(hourCount)+" Hour"+(hourCount>1?"s":"")
else
timeframeF+" Min"
f_getFibonacciLevels(fib1,fib2) =>
if highPivots.size()>0 and lowPivots.size()>0
hiP = highPivots.get(0)
loP = lowPivots.get(0)
top = hiP.price
bot = loP.price
diff=top - bot
[top-(diff*fib1), top-(diff*fib2)]
else
[na,na]
// -- FIB KIRAJZOLÁS --
[fib05,fib061] = f_getFibonacciLevels(fibArea1,fibArea2)
line05 = plot(fib05,color=gzLineColor,linewidth=1,style=plot.style_line)
line061 = plot(fib061,color=gzLineColor,linewidth=1,style=plot.style_line)
fill(line05,line061,color=showArea?gzAreaColor:na)
if barstate.islast
box.delete(tf1Text)
// -- VWAP + Divergence --
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)
// Egysoros switch anchor
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)
[vw, stdevU, _] = ta.vwap(src,isNewPeriod,1)
vwapValue := vw
stdevAbs = stdevU - vw
plot(vwapValue,"VWAP", showVWAP?(alternateColor?(vwapValue>vwapValue[1]?#00ff0d:#ff0000):#ffffff):na, offset,2)
// Divergence
last5gain = high - low[divergenceLookback]
last5loss = high[divergenceLookback] - low
atrVwapDiv = ta.atr(14)
gaps = false
for i = 0 to divergenceLookback
if math.abs(open[i]-close[i+1])>atrVwapDiv
gaps := true
var lastBullishDivergence = bar_index
bullishDivergenceBool = close>close[1] and vwapValue<vwapValue[1] and last5gain>atrVwapDiv*divergenceATRmultiplier and ((bar_index-lastBullishDivergence>15) or (ta.highest(high,20)-ta.lowest(low,20)>atrVwapDiv*2 and bar_index-lastBullishDivergence>10))
if gaps
bullishDivergenceBool := false
if bullishDivergenceBool and bullishAlertSignal
alert("Bullish VWAP Divergence",freq=alert.freq_once_per_bar_close)
plot(bullishDivergenceBool?low-atrVwapDiv*0.5:na,style=plot.style_circles,color=bullishColorVWAP,linewidth=7,title="Bullish Divergence Dot")
if bullishDivergenceBool
lastBullishDivergence := bar_index
var lastBearishDivergence = bar_index
bearishDivergenceBool = close<close[1] and vwapValue>vwapValue[1] and last5loss>atrVwapDiv*divergenceATRmultiplier and ((bar_index-lastBearishDivergence>15) or (ta.highest(high,20)-ta.lowest(low,20)>atrVwapDiv*2 and bar_index-lastBearishDivergence>10))
if gaps
bearishDivergenceBool := false
if bearishDivergenceBool and bearishAlertSignal
alert("Bearish VWAP Divergence",freq=alert.freq_once_per_bar_close)
plot(bearishDivergenceBool?high+atrVwapDiv*0.5:na,style=plot.style_circles,color=bearishColorVWAP,linewidth=divergence_plot_size,title="Bearish Divergence Dot")
if bearishDivergenceBool
lastBearishDivergence := bar_index
// ------------------------------------------------------------------------------------------------
// === 3) RSI (Kernel Optimized) — KDE-vel ===
// ------------------------------------------------------------------------------------------------
// Egysoros inputok
rsiLengthInputKDE = input.int(14,"RSI Length (KDE RSI)",minval=1,group="RSI (KDE) Settings")
rsiSourceInputKDE = input.source(close,"Source (KDE RSI)",group="RSI (KDE) Settings")
highPivotLenKDE = input.int(21,"High Pivot Length (KDE)",minval=1,group="RSI (KDE) Pivots",display=display.none)
lowPivotLenKDE = input.int(21,"Low Pivot Length (KDE)",minval=1,group="RSI (KDE) Pivots",display=display.none)
realPivotLabelsKDE = DEBUG?input.bool(false,"[DBG] Real Pivot Labels (KDE)",group="RSI (KDE) Pivots"):false
kdePivotLabelsKDE = DEBUG?input.bool(false,"[DBG] KDE Pivot Labels (KDE)",group="RSI (KDE) Pivots"):false
activationThresholdStrKDE = input.string("Medium","Activation Threshold (KDE)",options=["High","Medium","Low"],group="KDE RSI",tooltip="Arrows shown: High => more signals")
string KDEKernelKDE = input.string("Gaussian","Kernel (KDE RSI)",options=["Uniform","Gaussian","Sigmoid"],group="KDE RSI",tooltip="Kernel function for KDE calculation.")
float KDEBandwidthKDE = input.float(2.71828,"Bandwidth (KDE RSI)",group="KDE RSI",tooltip="Smoothness factor of KDE.")
int KDEStepKDE = input.int(100,"Nº Bins (KDE RSI)",minval=1,group="KDE RSI",tooltip="Number of elements in KDE Probability array.")
activationThresholdKDE = DEBUG?input.float(0.25,"[DBG] Activation Threshold (KDE RSI)",group="KDE RSI"):0.25
if not DEBUG
activationThresholdKDE := activationThresholdStrKDE=="High"?0.4:activationThresholdStrKDE=="Medium"?0.25:0.15
probModeKDE = DEBUG?input.string("Sum","[DBG] Probability Mode (KDE RSI)",options=["Sum","Nearest"],group="KDE RSI"):"Sum"
minPaddingKDE = DEBUG?input.bool(false,"[DBG] KDE Min Padding (KDE RSI)",group="KDE RSI"):false
tableEnabledKDE = input.bool(true,"KDE RSI Dashboard",group="KDE RSI Dashboard",display=display.none)
tableLocationKDE = input.string("Top Right","Position (KDE RSI Dash)",options=["Top Right","Top Center","Right Center","Middle Center","Left Center","Bottom Center"],group="KDE RSI Dashboard",display=display.none)
screenerColorKDE = input.color(#1B1F2B,"Background (KDE RSI Dash)",group="KDE RSI Dashboard",display=display.none)
frameColorKDE = input.color(color.rgb(255,255,255),"Frame (KDE RSI Dash)",group="KDE RSI Dashboard",display=display.none)
borderColorKDE = input.color(color.rgb(255,255,255),"Border (KDE RSI Dash)",group="KDE RSI Dashboard",display=display.none)
textColorDBKDE = input.color(color.white,"Text (KDE RSI Dash)",group="KDE RSI Dashboard",display=display.none)
fillBackgroundsKDE = input.bool(true,"Fill Backgrounds (KDE RSI Dash)",group="KDE RSI Dashboard",display=display.none)
bearishColorKDE = input.color(#f23646,"High Pivots (KDE)",group="KDE RSI Style",inline="col",display=display.none)
neutralColorKDE = input.color(color.gray,"Neutral (KDE)",group="KDE RSI Style",inline="col",display=display.none)
bullishColorKDE = input.color(#089981,"Low Pivots (KDE)",group="KDE RSI Style",inline="col",display=display.none)
textColorKDE = input.color(color.white,"Text (KDE RSI)",group="KDE RSI Style",inline="col",display=display.none)
RSILabelsEnabledKDE = input.bool(true,"RSI Labels (KDE)",group="KDE RSI Style")
KDELabelsEnabledKDE = input.bool(true,"KDE Labels",group="KDE RSI Style")
// -- RSI számítás (KDE) --
rsiKDE = ta.rsi(rsiSourceInputKDE,rsiLengthInputKDE)
// -- Helper a table pozicionálásához --
f_getPositionKDE(ptxt) =>
ptxt=="Top Right"?position.top_right:
ptxt=="Top Center"?position.top_center:
ptxt=="Right Center"?position.middle_right:
ptxt=="Left Center"?position.middle_left:
ptxt=="Bottom Center"?position.bottom_center:
ptxt=="Middle Center"?position.middle_center
// -- Kernel fv-k + KDE --
f_gaussianKDE(d,bw=1.0) => 1.0/math.sqrt(2.0*math.pi)*math.pow(math.e,-0.5*math.pow(d/bw,2.0))
f_uniformKDE(d,bw=1.0) => math.abs(d)>bw?0.0:0.5
f_sigmoidKDE(d,bw=1.0) => 2.0/math.pi*(1.0/(math.pow(math.e,d/bw)+math.pow(math.e,-(d/bw))))
f_kdeKDE(arr, kernel, bandwidth, steps)=>
arrSize=arr.size()
arrRange=arr.range()
arrMin=arr.min()-(minPaddingKDE?(arrRange/2.0):0)
stepCount=arrRange/steps
densityRange=array.new<float>(steps*2)
for i=0 to (steps*2)-1
densityRange.set(i,arrMin+i*stepCount)
xArr=array.new<float>()
yArr=array.new<float>()
for i=0 to densityRange.size()-1
float temp=0.0
for j=0 to arrSize-1
switch KDEKernelKDE
"Gaussian"=>temp+=f_gaussianKDE(densityRange.get(i)-arr.get(j),1.0/bandwidth)
"Uniform"=>temp+=f_uniformKDE(densityRange.get(i)-arr.get(j),1.0/bandwidth)
"Sigmoid"=>temp+=f_sigmoidKDE(densityRange.get(i)-arr.get(j),1.0/bandwidth)
xArr.push(densityRange.get(i))
yArr.push(1.0/arrSize*temp)
[xArr,yArr]
// -- Pivots + KDE logika --
f_prefixSumKDE(arr,l,r)=> arr.get(r)-(l==0?0:arr.get(l-1))
float MidKDEHigh=na, MidKDELow=na
var array<float> KDEHighX=na, KDEHighY=na, KDEHighYSum=array.new<float>()
var array<float> KDELowX=na, KDELowY=na, KDELowYSum=array.new<float>()
highPivotKDE=ta.pivothigh(highPivotLenKDE,highPivotLenKDE)
lowPivotKDE=ta.pivotlow(lowPivotLenKDE,lowPivotLenKDE)
var array<float> highPivotRSIs=array.new<float>()
var array<float> lowPivotRSIs=array.new<float>()
if not na(highPivotKDE)
if highPivotRSIs.size()>KDELimit
highPivotRSIs.remove(0)
highPivotRSIs.push(rsiKDE[highPivotLenKDE])
[KDEHighX1,KDEHighY1]=f_kdeKDE(highPivotRSIs,KDEKernelKDE,KDEBandwidthKDE,KDEStepKDE)
KDEHighX:=KDEHighX1
KDEHighY:=KDEHighY1
KDEHighYSum.clear()
float tempSum=0.0
for i=0 to KDEHighY.size()-1
tempSum+=KDEHighY.get(i)
KDEHighYSum.push(tempSum)
MidKDEHigh:=array.get(KDEHighX,array.indexof(KDEHighY,array.max(KDEHighY)))
if not na(lowPivotKDE)
if lowPivotRSIs.size()>KDELimit
lowPivotRSIs.remove(0)
lowPivotRSIs.push(rsiKDE[lowPivotLenKDE])
[KDELowX1,KDELowY1]=f_kdeKDE(lowPivotRSIs,KDEKernelKDE,KDEBandwidthKDE,KDEStepKDE)
KDELowX:=KDELowX1
KDELowY:=KDELowY1
KDELowYSum.clear()
float tempSum2=0.0
for i=0 to KDELowY.size()-1
tempSum2+=KDELowY.get(i)
KDELowYSum.push(tempSum2)
MidKDELow:=array.get(KDELowX,array.indexof(KDELowY,array.max(KDELowY)))
// KDE optim
f_lin_interpolateKDE(x0,x1,y0,y1,x)=> y0+(x-x0)*(y1-y0)/(x1-x0)
float lowProb=na, maxLowProb=na, highProb=na, maxHighProb=na
if last_bar_index-maxDistanceToLastBar<bar_index
if highPivotRSIs.size()>0
int hlxL=array.binary_search_leftmost(KDEHighX,rsiKDE)
int hlxR=math.min(array.binary_search_rightmost(KDEHighX,rsiKDE),KDEHighX.size()-1)
int nearestIndex=(math.abs(rsiKDE-KDEHighX.get(hlxL))<math.abs(rsiKDE-KDEHighX.get(hlxR)))?hlxL:hlxR
if probModeKDE=="Nearest"
highProb=KDEHighY.get(nearestIndex)
maxHighProb=array.max(KDEHighY)
else
highProb=f_prefixSumKDE(KDEHighYSum,0,nearestIndex)
if lowPivotRSIs.size()>0
int llxL=array.binary_search_leftmost(KDELowX,rsiKDE)
int llxR=math.min(array.binary_search_rightmost(KDELowX,rsiKDE),KDELowX.size()-1)
int nearestIndex2=(math.abs(rsiKDE-KDELowX.get(llxL))<math.abs(rsiKDE-KDELowX.get(llxR)))?llxL:llxR
if probModeKDE=="Nearest"
lowProb=KDELowY.get(nearestIndex2)
maxLowProb=array.max(KDELowY)
else
lowProb=f_prefixSumKDE(KDELowYSum,nearestIndex2,KDELowYSum.size()-1)
diffToHighKDE=math.abs(rsiKDE-MidKDEHigh)
diffToLowKDE =math.abs(rsiKDE-MidKDELow)
// PIVOT JELEK
color curColorKDE=na
if not na(KDELowY) and not na(KDEHighY)
if probModeKDE=="Nearest"
if math.abs(lowProb-maxLowProb)<activationThresholdKDE/50.0
curColorKDE:=bullishColorKDE
if math.abs(highProb-maxHighProb)<activationThresholdKDE/50.0
curColorKDE:=bearishColorKDE
else
if lowProb>KDELowY.sum()*(1.0-activationThresholdKDE)
curColorKDE:=bullishColorKDE
else if highProb>KDEHighY.sum()*(1.0-activationThresholdKDE)
curColorKDE:=bearishColorKDE
float atrKDE=ta.atr(50)
plotarrow(curColorKDE==bullishColorKDE and barstate.isconfirmed?1:na,"Bullish Arrows (KDE RSI)",color.new(bullishColorKDE,70),color.new(bullishColorKDE,70),20,20)
plotarrow(curColorKDE==bearishColorKDE and barstate.isconfirmed?-1:na,"Bearish Arrows (KDE RSI)",color.new(bearishColorKDE,70),color.new(bearishColorKDE,70),20,20)
// Esetleges pivot-váltás
plotarrow((na(curColorKDE) and curColorKDE[1]==bullishColorKDE and barstate.isconfirmed)?1:na,"Possible Bullish Pivot (KDE RSI)",bullishColorKDE,bullishColorKDE,20,20)
plotarrow((na(curColorKDE) and curColorKDE[1]==bearishColorKDE and barstate.isconfirmed)?-1:na,"Possible Bearish Pivot (KDE RSI)",bearishColorKDE,bearishColorKDE,20,20)
alertcondition(na(curColorKDE) and curColorKDE[1]==bullishColorKDE and barstate.isconfirmed,"Possible Bullish Pivot (KDE RSI)")
alertcondition(na(curColorKDE) and curColorKDE[1]==bearishColorKDE and barstate.isconfirmed,"Possible Bearish Pivot (KDE RSI)")
if KDELabelsEnabledKDE or RSILabelsEnabledKDE
var lastBullishLabelKDE=0
var lastBearishLabelKDE=0
if (na(curColorKDE) and curColorKDE[1]==bullishColorKDE and barstate.isconfirmed) and (bar_index-lastBullishLabelKDE)>labelCooldown
lastBullishLabelKDE:=bar_index
txt=""
if RSILabelsEnabledKDE and KDELabelsEnabledKDE
txt:="RSI | "+str.tostring(rsiKDE,"#")+" | "+str.tostring(lowProb*100,"#.##")+"%"
else if RSILabelsEnabledKDE
txt:="RSI | "+str.tostring(rsiKDE,"#")
else
txt:=str.tostring(rsiKDE,"#")+"%"
label.new(bar_index,low,txt,yloc=yloc.belowbar,color=na,style=label.style_label_up,textcolor=textColorKDE,force_overlay=true)
if (na(curColorKDE) and curColorKDE[1]==bearishColorKDE and barstate.isconfirmed) and (bar_index-lastBearishLabelKDE)>labelCooldown
lastBearishLabelKDE:=bar_index
txt2=""
if RSILabelsEnabledKDE and KDELabelsEnabledKDE
txt2:="RSI | "+str.tostring(rsiKDE,"#")+" | "+str.tostring(highProb*100,"#.##")+"%"
else if RSILabelsEnabledKDE
txt2:="RSI | "+str.tostring(rsiKDE,"#")
else
txt2:=str.tostring(rsiKDE,"#")+"%"
label.new(bar_index,low,txt2,yloc=yloc.abovebar,color=na,style=label.style_label_down,textcolor=textColorKDE,force_overlay=true)
if kdePivotLabelsKDE
txt3=str.tostring(rsiKDE,"#.##")+"\nHP -> "+str.tostring(highProb,"#.##")+"\nLP -> "+str.tostring(lowProb,"#.##")+"\n\nMHP -> "+str.tostring(maxHighProb,"#.##")+"\nMLP -> "+str.tostring(maxLowProb,"#.##")
if math.abs(lowProb-maxLowProb)<activationThresholdKDE
label.new(bar_index,high,txt3,yloc=yloc.belowbar,color=textColorKDE,style=label.style_label_up,textcolor=color.black,force_overlay=true)
if math.abs(highProb-maxHighProb)<activationThresholdKDE
label.new(bar_index,high,txt3,yloc=yloc.abovebar,color=textColorKDE,style=label.style_label_down,textcolor=color.black,force_overlay=true)
if realPivotLabelsKDE
if not na(highPivotKDE)
txt4=str.tostring(rsiKDE[highPivotLenKDE],"#.##")+"\nHP -> "+str.tostring(highProb[highPivotLenKDE],"#.##")+"\nLP -> "+str.tostring(lowProb[highPivotLenKDE],"#.##")+"\n\nMHP -> "+str.tostring(maxHighProb[highPivotLenKDE],"#.##")+"\nMLP -> "+str.tostring(maxLowProb[highPivotLenKDE],"#.##")
label.new(bar_index-highPivotLenKDE,high,txt4,yloc=yloc.abovebar,color=textColorKDE,style=label.style_label_down,textcolor=color.black,force_overlay=true)
if not na(lowPivotKDE)
txt5=str.tostring(rsiKDE[lowPivotLenKDE],"#.##")+"\nHP -> "+str.tostring(highProb[lowPivotLenKDE],"#.##")+"\nLP -> "+str.tostring(lowProb[lowPivotLenKDE],"#.##")+"\n\nMHP -> "+str.tostring(maxHighProb[lowPivotLenKDE],"#.##")+"\nMLP -> "+str.tostring(maxLowProb[lowPivotLenKDE],"#.##")
label.new(bar_index-lowPivotLenKDE,high,txt5,yloc=yloc.belowbar,color=textColorKDE,style=label.style_label_up,textcolor=color.black,force_overlay=true)
// DASHBOARD (TABLE)
if tableEnabledKDE
var table realtimeTableKDE=table.new(f_getPositionKDE(tableLocationKDE),2,10,bgcolor=screenerColorKDE,frame_width=2,frame_color=frameColorKDE,border_width=1,border_color=borderColorKDE)
table.merge_cells(realtimeTableKDE,0,0,1,0)
table.cell(realtimeTableKDE,0,0,"KDE Optimized RSI",text_color=textColorDBKDE,bgcolor=screenerColorKDE)
table.cell(realtimeTableKDE,0,1,"RSI",text_color=textColorDBKDE,bgcolor=screenerColorKDE)
table.cell(realtimeTableKDE,1,1,str.tostring(rsiKDE,"#"),text_color=textColorDBKDE,bgcolor=screenerColorKDE)
table.cell(realtimeTableKDE,0,2,(lowProb>highProb)?"Bullish KDE":"Bearish KDE",text_color=(lowProb>highProb)?bullishColorKDE:bearishColorKDE,bgcolor=screenerColorKDE)
table.cell(realtimeTableKDE,1,2,str.tostring(nz(math.max(highProb,lowProb),0)*100,"#.##")+"%",text_color=textColorDBKDE,bgcolor=screenerColorKDE)
Show all 389 lines