Hi,
May it please someone to mercifully translate the following Easylanguage codes to Metaquotes.
Thank you in advance.
Trend Bands
Variables: BandDays(28), DevConstant(3.500000);
Variables: keltnerTop(0), keltnerMid(0), keltnerBot(0), expSmoothPrice(0);
Variables: expSmoothRange(0);
Variables: altu(0),altd(0),up(0),down(0),dir(0),n(0),p(0);
IF (CURRENTBAR = 1) THEN
BEGIN
expSmoothPrice = CLOSE ;
expSmoothRange = HIGH-LOW ;
END ELSE
BEGIN
expSmoothPrice = (expSmoothPrice*(BandDays-1)+CLOSE)/BandDays ;
expSmoothRange = (expSmoothRange*(BandDays-1)+(HIGH-LOW))/BandDays ;
END ;
keltnerTop = expSmoothPrice+(expSmoothRange*DevConstant) ;
keltnerMid = expSmoothPrice ;
keltnerBot = expSmoothPrice-(expSmoothRange*DevConstant) ;
if close <= KeltnerMid then altd = 1 else altd = 0;
if altd = 1 and high[1] <= KeltnerMid and close < Low[1] then begin
dir = -1 ;
end;
if close >= KeltnerMid then altu = 1 else altu = 0;
if altu = 1 and low[1] >= KeltnerMid and close > high[1] then begin
dir = 1;
end;
if dir = -1 then setplotcolor(2,magenta);
if dir = 1 then setplotcolor(2,green);
PLOT1 (keltnerTop, "TBand Top") ;
PLOT2 (keltnerMid, "TBand Mid") ;
PLOT3 (keltnerBot, "TBand Bot") ;
Trigger Lines
variables: Length(20), TrigAvg(5), UpColor(green), DnColor(magenta);
Variables: xAvg(0),yAvg(0);
yAvg = TimeSeriesForecast (Length, 0) ;
xAvg = XAverage (yAvg, TrigAvg) ;
PLOT1 (yAvg, "Trigger");
PLOT2 (xAvg, "AverageTSF") ;
IF (PLOT2 >= PLOT1) THEN
BEGIN
SETPLOTCOLOR (1, DnColor) ;
SETPLOTCOLOR (2, DnColor) ;
END ELSE
BEGIN
SETPLOTCOLOR (1, UpColor) ;
SETPLOTCOLOR (2, UpColor) ;
END ;
Plot3(yAvg,"Sy");
Trade Activator
First the TSI Function
Inputs:
Price(NumericSeries), r(NumericSimple), s(NumericSimple),
u(NumericSimple);
Value1= 100*TXAverage(Price-Price[1],r,s,u) ; { Numerator }
Value2=TXAverage(AbsValue(Price-Price[1]),r,s,u) ; { Denominator }
If Value2 <> 0 then TSI = Value1 / Value2
Else TSI = 0;
The Indicator
Inputs: Price(c), r(7), s(27), u(1), SmthLen(7);
Value1= TSI(Price, r, s, u);
Value2= XAverage(TSI(Price, r, s, u), SmthLen);
plot1(value2,"XAverage");
plot2(value2,"SXAverage");
plot3(value1,"TSI");
IF (PLOT1 >= PLOT3) THEN
BEGIN
SETPLOTCOLOR (1, magenta) ;
SETPLOTCOLOR (3, magenta) ;
END ELSE
BEGIN
SETPLOTCOLOR (1, green) ;
SETPLOTCOLOR (3, green) ;
END ;
plot4(value1,"STSI");
plot5(value1,"Histogram");
May it please someone to mercifully translate the following Easylanguage codes to Metaquotes.
Thank you in advance.
Trend Bands
Variables: BandDays(28), DevConstant(3.500000);
Variables: keltnerTop(0), keltnerMid(0), keltnerBot(0), expSmoothPrice(0);
Variables: expSmoothRange(0);
Variables: altu(0),altd(0),up(0),down(0),dir(0),n(0),p(0);
IF (CURRENTBAR = 1) THEN
BEGIN
expSmoothPrice = CLOSE ;
expSmoothRange = HIGH-LOW ;
END ELSE
BEGIN
expSmoothPrice = (expSmoothPrice*(BandDays-1)+CLOSE)/BandDays ;
expSmoothRange = (expSmoothRange*(BandDays-1)+(HIGH-LOW))/BandDays ;
END ;
keltnerTop = expSmoothPrice+(expSmoothRange*DevConstant) ;
keltnerMid = expSmoothPrice ;
keltnerBot = expSmoothPrice-(expSmoothRange*DevConstant) ;
if close <= KeltnerMid then altd = 1 else altd = 0;
if altd = 1 and high[1] <= KeltnerMid and close < Low[1] then begin
dir = -1 ;
end;
if close >= KeltnerMid then altu = 1 else altu = 0;
if altu = 1 and low[1] >= KeltnerMid and close > high[1] then begin
dir = 1;
end;
if dir = -1 then setplotcolor(2,magenta);
if dir = 1 then setplotcolor(2,green);
PLOT1 (keltnerTop, "TBand Top") ;
PLOT2 (keltnerMid, "TBand Mid") ;
PLOT3 (keltnerBot, "TBand Bot") ;
Trigger Lines
variables: Length(20), TrigAvg(5), UpColor(green), DnColor(magenta);
Variables: xAvg(0),yAvg(0);
yAvg = TimeSeriesForecast (Length, 0) ;
xAvg = XAverage (yAvg, TrigAvg) ;
PLOT1 (yAvg, "Trigger");
PLOT2 (xAvg, "AverageTSF") ;
IF (PLOT2 >= PLOT1) THEN
BEGIN
SETPLOTCOLOR (1, DnColor) ;
SETPLOTCOLOR (2, DnColor) ;
END ELSE
BEGIN
SETPLOTCOLOR (1, UpColor) ;
SETPLOTCOLOR (2, UpColor) ;
END ;
Plot3(yAvg,"Sy");
Trade Activator
First the TSI Function
Inputs:
Price(NumericSeries), r(NumericSimple), s(NumericSimple),
u(NumericSimple);
Value1= 100*TXAverage(Price-Price[1],r,s,u) ; { Numerator }
Value2=TXAverage(AbsValue(Price-Price[1]),r,s,u) ; { Denominator }
If Value2 <> 0 then TSI = Value1 / Value2
Else TSI = 0;
The Indicator
Inputs: Price(c), r(7), s(27), u(1), SmthLen(7);
Value1= TSI(Price, r, s, u);
Value2= XAverage(TSI(Price, r, s, u), SmthLen);
plot1(value2,"XAverage");
plot2(value2,"SXAverage");
plot3(value1,"TSI");
IF (PLOT1 >= PLOT3) THEN
BEGIN
SETPLOTCOLOR (1, magenta) ;
SETPLOTCOLOR (3, magenta) ;
END ELSE
BEGIN
SETPLOTCOLOR (1, green) ;
SETPLOTCOLOR (3, green) ;
END ;
plot4(value1,"STSI");
plot5(value1,"Histogram");