Metastock Language Help

#1
Hello everyone.
Recently i've read the Dennis Tilley's article about a trading stategy based on a moving average with related supports and resistances.
This is the easylanguage formula for the indicators:
Inputs: Price(Close), Length(10), F(8);
Vars: AvgVal(0), S(0), R(0), SC(0), RC(0);

AvgVal = Average(Price, Length);
RC = RC + 1;
SC = SC + 1;

IF Close Crosses Below AvgVal AND AvgVal > S* (1+(F/100)) AND R <> 0 Then Begin
For value1 = RC-2 TO RC+2 Begin
Plot2[value1](R, "R");
End;
Alert = True;
S = L;
SC = 0;
End
Else Begin
IF Close Crosses Below S AND R <> 0 Then Begin
For value1 = RC-2 TO RC+2 Begin
Plot2[value1](R, "R");
End;
Alert = True;
S = L;
SC = 0;
End;
End;

IF Close Crosses Above AvgVal AND AvgVal < R / (1+(F/100)) AND S <> 0 Then Begin
For value1 = SC-2 TO SC+2 Begin
Plot3[value1](S, "S");
End;
Alert = True;
R = H;
RC = 0;
End
Else Begin
IF Close Crosses Above R AND S <> 0 Then Begin
For value1 = SC-2 TO SC+2 Begin
Plot3[value1](S, "S");
End;
Alert = True;
R = H;
RC = 0;
End;
End;

IF Close > AvgVal Then Begin
IF High >= R Then Begin
R = High;
RC = 0;
End;
End;

IF Close < AvgVal Then Begin
IF Low <= S OR S = -1 Then Begin
S = Low;
SC = 0;
End;
End;

Plot1(AvgVal, "SMA");


Could someone translate that in metastock language?
Thank you in advance and forgive my poor English.
Great 2008 everyone!
 

Similar threads