TrandinVeiwde kullandiğim indikatör matriks IQ ya cevirmemde yardimci olurmusunuz alarmlar 1dk geç caliyor bunu nasil cözebilirim Kullandiğim indikatörün açik kaynak kodu burada
//@version=4
study("ZigZag Plus [xdecow]", overlay=true, max_bars_back=1500)
useclose = input(true, title="Use close to confirm", type=input.bool)
alertupvol = input(50, title="Up swing alert perc", type=input.float, minval=0.01)
alertdnvol = input(50, title="Down swing alert perc", type=input.float, minval=0.01)
lineColorInput = input('navy', 'Line color', options=['aqua', 'black', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple', 'red', 'silver', 'teal', 'white', 'yellow'])
lineColor = lineColorInput == 'aqua' ? color.aqua :
lineColorInput == 'black' ? color.black :
lineColorInput == 'blue' ? color.blue :
lineColorInput == 'fuchsia' ? color.fuchsia :
lineColorInput == 'gray' ? color.gray :
lineColorInput == 'green' ? color.green :
lineColorInput == 'lime' ? color.lime :
lineColorInput == 'marron' ? color.maroon :
lineColorInput == 'navy' ? color.navy :
lineColorInput == 'olive' ? color.olive :
lineColorInput == 'orange' ? color.orange :
lineColorInput == 'purple' ? color.purple :
lineColorInput == 'red' ? color.red :
lineColorInput == 'silver' ? color.silver :
lineColorInput == 'teal' ? color.teal :
lineColorInput == 'white' ? color.white :
lineColorInput == 'yellow' ? color.yellow :
color.black
var bool uptrend = na
var float tophigh = na(uptrend[1]) ? high : na
var float toplow = na(uptrend[1]) ? low : na
var float bothigh = na(uptrend[1]) ? high : na
var float botlow = na(uptrend[1]) ? low : na
newtop = na(uptrend[1])
newbot = na(uptrend[1])
changed = na(uptrend[1])
// colors
cup1 = #67E300
cup2 = #439400
cup3 = #A9F16C
cdown1 = #E7003E
cdown2 = #AD2B4E
cdown3 = #F36D91
if na(uptrend[1])
uptrend := close > close[1]
else
if uptrend[1]
if na(tophigh[1]) or high > tophigh[1]
tophigh := high
toplow := low
newtop := true
if na(toplow[1]) or ((close < toplow[1] and useclose) or (low < toplow[1] and not useclose))
bothigh := high
botlow := low
newbot := true
changed := true
uptrend := false
else
if na(botlow[1]) or low < botlow[1]
bothigh := high
botlow := low
newbot := true
if na(bothigh[1]) or ((close > bothigh[1] and useclose) or (high > bothigh[1] and not useclose))
tophigh := high
toplow := low
changed := true
newtop := true
uptrend := true
// labels
float v = 0.0
float oldv = 0.0
float perc = 0.0
float perc2 = 0.0
if changed and not barstate.isrealtime
if uptrend
for i = 0 to 1000
if newbot[i]
v := open > close ? volume : 0.0
for j = 1 to 1000
if newtop[j]
if open[j] > close[j]
v := v + volume[j]
break
v := v + volume[j]
oldv := valuewhen(changed and uptrend, v, 1)
perc := (v - oldv) * 100 / oldv
label.new(bar_index[i], na, "Vol: " + tostring(round(v), "#,###,###.##") + " (" + (perc > 0 ? "+" : "") + tostring(round(perc)) + "%)",
color=cdown2,
textcolor=color.white,
style=label.style_labelup, yloc=yloc.belowbar)
break
else
for i = 0 to 1000
if newtop[i]
v := open < close ? volume : 0.0
for j = 1 to 1000
if newbot[j]
if open[j] < close[j]
v := v + volume[j]
break
v := v + volume[j]
oldv := valuewhen(changed and not uptrend, v, 1)
perc2 := (v - oldv) * 100 / oldv
label.new(bar_index[i], na, "Vol: " + tostring(round(v), "#,###,###.##") + " (" + (perc2 > 0 ? "+" : "") + tostring(round(perc2)) + "%)",
color=cup2,
textcolor=color.white,
style=label.style_labeldown, yloc=yloc.abovebar)
break
alertcondition(changed[1], title='Direction changed', message='Zigzag top/bottom found')
alertcondition(changed[1] and uptrend, title='Up swing started', message='Up swing started')
alertcondition(changed[1] and not uptrend, title='Down swing started', message='Down swing started')
alertcondition(perc2 >= alertupvol, title='Up swing vol', message='Up swing volume increased')
alertcondition(perc >= alertdnvol, title='Down swing vol', message='Down swing volume increased')
// bar color
barcolor(changed ? uptrend ? cup1 : cdown1 : na, title="Barcolor Top/Bottom confirmation")
barcolor(newtop and not changed ? cup2 : newbot and not changed ? cdown2 : na, title="Barcolor Candle Breakout confirmation")
barcolor(uptrend and not newtop and not changed ? cup3 : not uptrend and not newbot and not changed ? cdown3 : na, title="Barcolor Inside bar confirmation")
// shapes
plotshape(uptrend and changed, style=shape.triangleup, color=cup1, location=location.belowbar, title="Bottom confirmation")
plotshape(not uptrend and changed, style=shape.triangledown, color=cdown1, location=location.abovebar, title="Top confirmation")
plotshape(newtop and not changed, style=shape.circle, color=cup2, location=location.belowbar, title="Uptrend candle breakout")
plotshape(newbot and not changed, style=shape.circle, color=cdown2, location=location.abovebar, title="Downtrend candle breakout")
plotshape(uptrend and not newtop and not changed, style=shape.square, color=cup3, location=location.belowbar, title="Uptrend inside bar")
plotshape(not uptrend and not newbot and not changed, style=shape.square, color=cdown3, location=location.abovebar, title="Downtrend inside bar")
// zig zag
getBot() =>
int index = na
float resbot = na
x = not uptrend ? 1 : 0
for i = x to 1000
if newbot[i]
index := i
resbot := low[i]
break
[index, resbot]
getTop() =>
int index = na
float restop = na
x = uptrend ? 1 : 0
for i = x to 1000
if newtop[i]
index := i
restop := high[i]
break
[index, restop]
[ziglow, resbotnew] = getBot()
[zighigh, restopnew] = getTop()
if changed[1]
if uptrend[1]
l = line.new(bar_index[ziglow[1]+1], low[ziglow[1]+1], bar_index[zighigh[1]+1], high[zighigh[1]+1], width=2, color=lineColor)
else
l = line.new(bar_index[ziglow[1]+1], low[ziglow[1]+1], bar_index[zighigh[1]+1], high[zighigh[1]+1], width=2, color=lineColor)
// support and resistance
var float restop = na
var float resbot = na
if changed
if uptrend
resbot := resbotnew
else
restop := restopnew
plot(restop, color=color.green, style=plot.style_circles, title='Resistance')
plot(resbot, color=color.red, style=plot.style_circles, title='Support')