+1 888 340 6572

# Averages > Mov Avg - Supp/Res

Article/Author: "Simple Moving Average with Resistance & Support", Dennis L. Tilley, S&C Magazine, Traders Tips, 09/1998

File Includes: Indicator - Mov Avg - Supp/Res

Category: Indicator > Averages

Description:

Simple moving average with resistance and support, is robust two-parameter trading approach that uses resistance and support levels to confirm Moving Average crossover signals. Compared with most classical approaches, this one does not sacrifice performance to significantly reduce the number of whipsaw trades. It also handles trading ranges well.

Usage:

If the price immediately rebounds and crosses the Moving Average, system will wait until the resistance level is broken before triggering a buy. If the market holds in a trading range, the trigger points will wait for a breakout on the upside before triggering a buy.

The identification of support and resistance depends only on the lookback period of the moving average; no additional fitting parameters are required. Confirmation of buy and sell signals is required when the SMA is within a critical percentage (for instance, 8 %) of the resistance/ support level at the time of the crossover.

Inputs:

Price - the data series to average
Length - the parameter tells how many bars to average
F - critical percentage, should be entered as the percent value (8=8%)

EasyLanguage Code:
```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 CLOSE > S* (1+(F/100)) AND R <> 0 THEN BEGIN
FOR VALUE1 = RC-2 TO RC+2 BEGIN
PLOT2[VALUE1](R, "R");
END;
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;
S = L;
SC = 0;
END;
END;

IF CLOSE CROSSES ABOVE AVGVAL AND CLOSE < R / (1+(F/100)) AND S <> 0 THEN BEGIN
FOR VALUE1 = SC-2 TO SC+2 BEGIN
PLOT3[VALUE1](S, "S");
END;
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;
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");```