İş tamamlandı
![](https://c.mql5.com/i/avatar/avatar_na2.png)
İş Gereklilikleri
Hi, i would like a straight forward conversion of this indicator to MT4. the exact same functionality doesnt exist in MT4 despite many simular.
thanks,
Mark
//----
Length = input(9,title="Period of Evaluation", type=input.integer)
Smooth = input(3,title="Period of Smoothing", type=input.integer)
show_histo = input(true, title="Show Histogam", type=input.bool)
//----
src = input(close,title="Source")
Mode = input(title="Indicator Method", type=input.string, defval="RSI", options=["RSI", "STOCHASTIC","ADX"])
ma_type = input(title="MA", type=input.string, defval="WMA", options=["ALMA", "EMA", "WMA", "SMA", "SMMA", "HMA"])
alma_offset = input(defval=0.85, title="* Arnaud Legoux (ALMA) Only - Offset Value", minval=0, step=0.01)
alma_sigma = input(defval=6, title="* Arnaud Legoux (ALMA) Only - Sigma Value", minval=0)
ma(type, src, len) =>
float result = 0
if type=="SMA" // Simple
result := sma(src, len)
if type=="EMA" // Exponential
result := ema(src, len)
if type=="WMA" // Weighted
result := wma(src, len)
if type=="SMMA" // Smoothed
w = wma(src, len)
result := na(w[1]) ? sma(src, len) : (w[1] * (len - 1) + src) / len
if type=="HMA" // Hull
result := wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))
if type=="ALMA" // Arnaud Legoux
result := alma(src, len, alma_offset, alma_sigma)
result
//----
Price = src
//----
Price1 = ma("SMA",Price,1)
Price2 = ma("SMA",Price[1],1)
//RSI
Bulls0 = 0.5*(abs(Price1-Price2)+(Price1-Price2))
Bears0 = 0.5*(abs(Price1-Price2)-(Price1-Price2))
//STOCHASTIC
Bulls1 = Price1 - lowest(Price1,Length)
Bears1 = highest(Price1,Length) - Price1
//ADX
Bulls2 = 0.5*(abs(high-high[1])+(high-high[1]))
Bears2 = 0.5*(abs(low[1]-low)+(low[1]-low))
//
Bulls = Mode == "RSI" ? Bulls0 : Mode == "STOCHASTIC" ? Bulls1 : Bulls2
Bears = Mode == "RSI" ? Bears0 : Mode == "STOCHASTIC" ? Bears1 : Bears2
AvgBulls=ma(ma_type,Bulls,Length)
AvgBears=ma(ma_type,Bears,Length)
//----
SmthBulls=ma(ma_type,AvgBulls,Smooth)
SmthBears=ma(ma_type,AvgBears,Smooth)
difference = abs(SmthBulls - SmthBears)
bull_trend_color = (SmthBulls<SmthBulls[1])?color.lime:color.green
bear_trend_color = (SmthBears<SmthBears[1])?color.orange:color.red
difference_color = difference > SmthBulls ? ((SmthBears<SmthBears[1])?color.orange:color.red) : difference > SmthBears ? ((SmthBulls<SmthBulls[1])?color.lime:color.green) : color.gray
plot(difference, style=plot.style_histogram, linewidth=3, color=show_histo ? difference_color : na, transp=45, title="Strength")
//----
A = plot(SmthBulls,color=bull_trend_color,linewidth=4,transp=0)
B = plot(SmthBears,color=bear_trend_color,linewidth=4,transp=0)
//fill(A,B,color=trend==1?color.aqua:color.fuchsia,transp=80)