https://www.prorealcode.com/prorealtime ... indicator/
I came across an interesting version of the SSL indicator on the Internet. Maybe this can be done for MT4? There is a code in the link
Code: Select all
//PRC_SSL Hybrid | indicator
//version = 0
//31.01.24
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
///////////////DEFAULT PARAMETERS//////////////////////////////////////
atrlen = 14
mult = 1.0
smoothing=2 //(Average type. Default WMA)
showcandleviolation=1 //(Boolean)
showcolor=1 //(Boolean)
showSSL2=1 //(Boolean)
ssl1Type = 7 //(Average type. Default HMA)
len = 60
ssl2Type = 7 //(Average type. Default HMA)
len2 = 5 //(Integer)
Exittype = 7 //(Average type. Default HMA)
len3 = 15 //(Integer)
showbaseline = 1 //(Boolean)
baselinetype = 7 //(Average type. Default HMA)
Usetruerange = 1 //(Boolean)
multy = 0.2 //(Decimal)
//////////////////////////////////////////////////////////////////
//atr
atrlensmoot = average[atrlen,smoothing](TR(close))
//atr up/low bands
upperband = atrlensmoot * mult + close
lowerband = close - atrlensmoot * mult
////Ssl 1
emahigh = average[len,ssl1Type](high)
emalow = average[len,ssl1Type](low)
////Ssl 2
mahigh = average[len2,ssl2Type](high)
malow = average[len2,ssl2Type](low)
////Exit
src = CustomClose
exithigh = average[len3,ExitType](high)
exitlow = average[len3,ExitType](low)
////keltner baseline channel
bbmc = average[len,baselineType](close)
keltma = average[len,baselineType](src)
if UseTrueRange then
myrange = tr
else
myrange = high-low
endif
rangema = exponentialaverage[len](myrange)
upperk = keltma + rangema * multy
lowerk = keltma - rangema * multy
////baseline violation candle
openpos = open*1
closepos = close*1
difference = abs(closepos-openpos)
atrviolation = difference > atrlensmoot
inrange = upperband > bbmc and lowerband < bbmc
candlesizeviolation = atrviolation and inrange
//Ssl1 values
if close > emahigh then
hlv = 1
elsif close < emalow then
hlv = -1
else
hlv = hlv[1]
endif
if Hlv < 0 then
ssldown = emahigh
else
ssldown = emalow
endif
//Ssl2 values
if close > mahigh then
hlv2 = 1
elsif close < malow then
hlv2 = -1
else
hlv2 = hlv[1]
endif
if hlv2 < 0 then
ssldown2 = mahigh
else
ssldown2 = malow
endif
//Exit values
if close > exithigh then
hlv3 = 1
elsif close < exitlow then
hlv3 = -1
else
hlv3 = hlv3[1]
endif
if hlv3 < 0 then
sslexit = exithigh
else
sslexit = exitlow
endif
basecrosslong = close crosses over sslexit
basecrossshort = sslexit crosses over close
if basecrosslong then
codiff = 1
elsif basecrossshort then
codiff = -1
else
codiff = 0
endif
//////////Colours//////////////////////////////
///Bars
if close > upperk then
rbar= 0
gbar= 195
bbar= 255
elsif close < lowerk then
rbar=255
gbar=0
bbar=98
else
rbar=120
gbar=123
bbar=134
endif
//Ssl1
if close > ssldown then
rssl1= 0
gssl1= 195
bssl1= 255
elsif close < ssldown then
rssl1= 255
gssl1= 0
bssl1= 98
endif
//Exit
if codiff > 0 then
rcodiff=0
gcodiff=195
bcodiff=255
elsif codiff < 0 then
rcodiff=255
gcodiff=0
bcodiff=98
endif
/////////SSL2 continuation from ATR//////////////
atrcrit =0.9
upperhalf = atrlensmoot * atrcrit + close
lowerhalf = close - atrlensmoot * atrcrit
buyinatr = lowerhalf < ssldown2
buycont = close > bbmc and close > ssldown2
sellinatr = upperhalf > ssldown2
sellcont = close < bbmc and close < ssldown2
buyatr = buyinatr and buycont
sellatr = sellinatr and sellcont
//Points colour
if buyatr then
rpto = 76
gpto = 175
bpto = 80
elsif sellatr then
rpto = 156
gpto = 39
bpto = 176
else
rpto = 200
gpto = 200
bpto = 200
endif
///////////////////Plots////////////////////////////
//plotshape --> candlesizeviolation
if showcandleviolation and candlesizeviolation then
drawtext("♦",barindex,high)coloured(255,255,0)
endif
//color bars
if showcolor then
DRAWCANDLE(open, high, low, close) coloured(rbar,gbar,bbar)
endif
//Exit Arrows
if codiff > 0 then
drawarrowup(barindex,low-0.1*atrlensmoot)coloured(rcodiff,gcodiff,bcodiff)
elsif codiff < 0 then
drawarrowdown(barindex,high+0.1*atrlensmoot)coloured(rcodiff,gcodiff,bcodiff)
endif
//Ssl2
if showSSL2 then
drawpoint(barindex,ssldown2,2)coloured(rpto,gpto,bpto)
endif
//color BASELINE channel
if showbaseline then
ColorBetween(lowerk,upperk,rbar,gbar,bbar,30)
endif
return showbaseline*bbmc as "baseline" coloured(rbar,gbar,bbar),showbaseline*upperk as "up line" coloured(rbar,gbar,bbar), showbaseline*lowerk as "low line" coloured(rbar,gbar,bbar),ssldown as "SSL1" coloured(rbar,gbar,bbar), upperband as "+ATR", lowerband as "-ATR"