double moving average

If 1 moving average is a fine thing, 2 averages should be even better. But judge for yourself and test this colour coded double sma indicator.

On the properties page you can set the periods of the two moving averages. the indicator will give you a green chart if the market trades above the short moving average & the short average is above the long average & the long average is rising. (reverse conditions for red condition)

 

The chart shows the german DAX index on a weekly basis using the 54/21 setting.

colour coded 2 sma

 

Trading idea:

Buy if the chart is green and breaks its previous local high. Sell if it falls below last local low.

Indicator code:

Meta: subchart(true);
Inputs: periodLong(54), periodShort(21);
variables: smaL, smaS, colour;

smaL=average(close,periodLong); // use xaverage for exponential moving average
smaS=average(close,periodShort);

colour=black;
if smaS>smaL and close>smaS then colour=darkgreen;
if smaS<smaL and close

drawbar(o,h,l,c,colour,colour);
drawline(smaS);
drawline(smaL);

a single, simple moving average

To start things up a single moving average is a wonderful indicator. If it is an exponential one or just the simple version does not make a big difference, an average is a fine tool to define if something is rising or falling.

The first example is a colour coded indicator that gives you a green chart if the market is above its rising average, and a red one if it trades below a falling average. A rising average is defined as an average that is higher than a number of bars before.

You can set the period of the average and the lookback period for the rising/falling condition on the properties page.

 

The chart shows the german DAX index using a 54 week average.

colour coded sma

Trading idea:

Buy if the chart is green and breaks its previous local high. Sell if it falls below last local low.

Indicator code:

Meta: subchart(true);
Inputs: period(54), lookback(3,1);
variables: sma, colour;

sma=average(close,period); // use xaverage for exponential moving average
colour=black;
if sma>sma[lookback] and close>sma then colour=darkgreen;
if sma<sma[lookback] and close

drawbar(o,h,l,c,colour,colour);
drawline(sma);