Type: System, Name: Mov Avg X 2_20
Inputs: Price(Close), AvgLen(20), StpPnts(10);
Vars: AvgVal(0), Buyit(0), Sellit(0);
AvgVal = XAverage(Price, AvgLen);
{Buy/Sell Entry Setup}
IF Lowest(Low, 2) > AvgVal AND Low 1 Bar Ago Crosses Above AvgVal AND
MarketPosition <> 1 Then Begin
Buyit = Highest(High, 2) + StpPnts Points;
Condition1 = True;
End;
IF Highest(High, 2) < AvgVal AND High 1 Bar Ago Crosses Below AvgVal
AND
MarketPosition <> -1 Then Begin
Sellit = Lowest(Low, 2) — StpPnts Points;
Condition2 = True;
End;
{Buy/Sell Entry Orders}
IF Lowest(Low, 2) > AvgVal AND Condition1 Then
Buy Next Bar at Buyit Stop;
IF Highest(High, 2) < AvgVal AND Condition2 Then
Sell Next Bar at Sellit Stop;
{Long/Short Exits}
ExitLong Next Bar at AvgVal Stop;
ExitShort Next Bar at AvgVal Stop;
IF MarketPosition <> 0 Then Begin
Condition1 = False;
Condition2 = False;
End;