Traders' Tips from TASC Magazine

Moving Average Crossovers

Dimitris Tsokakis’s article, “Moving Average Crossovers (part II),” introduces more formulas to analyze moving averages. The formula for the indicator and the instructions on adding it to MetaStock are:

 

To enter these indicators into MetaStock:

  1. In the Tools menu, select Indicator Builder.
  2. Click New to open the Indicator Editor for a new indicator.
  3. Type the name of the formula
  4. Click in the larger window and type in the formula.
  1. Click Ok to close the Indicator Editor.

 

Name: the Stochastic TC graph

Formula:

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=Input("short MA time periods", 2, 200, 20);
  • z:=Input("long MA time periods", 3, 200, 30);
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • test:=If(z-y=0,-9999,z-y);
  • tc:=If(test=-9999, 0,
  • (y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/test);
  • tc;
  • Stoch(5,3);
  • p1

 

This indicator will prompt for the time periods of the two moving averages, but it defaults to the values suggested in the article.

 

 

The explorations and instruction for creating them in MetaStock are:

  1. Select Tools >
    the Explorer.
  2. Click New
  3. Enter a name, “SMA cross stats - ascending”
  4. Select the Column A tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • ascxpred:=Cross(p1,tc);
  • confascx:=Cross(may,maz);
  • Cum(ascxpred);

 

  1. Click in the Col Name box and enter the text: “Total”.
  2. Select the Column B tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • ascxpred:=Cross(p1,tc);
  • confascx:=Cross(may,maz);
  • asctotpred:=Cum(ascxpred);
  • acc0ascxpred:=Cum(confascx AND Ref(ascxpred,-1));
  • 100*(acc0ascxpred/asctotpred)

 

  1. Click in the Col Name box and enter the text: “1 day”.
  2. Select the Column C tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • ascxpred:=Cross(p1,tc);
  • confascx:=Cross(may,maz);
  • asctotpred:=Cum(ascxpred);
  • acc1ascxpred:=Cum(confascx AND Ref(ascxpred,-2));
  • 100*(acc1ascxpred/asctotpred)

 

  1. Click in the Col Name box and enter the text: “2 day”.
  2. Select the Column D tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • ascxpred:=Cross(p1,tc);
  • confascx:=Cross(may,maz);
  • asctotpred:=Cum(ascxpred);
  • acc2ascxpred:=Cum(confascx AND Ref(ascxpred,-3));
  • 100*(acc2ascxpred/asctotpred)

 

  1. Click in the Col Name box and enter the text: “3 day”.
  2. Select the Column E tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • ascxpred:=Cross(p1,tc);confascx:=Cross(may,maz);
  • asctotpred:=Cum(ascxpred);
  • uslsascxpre:=Cum(confascx AND ascxpred);
  • 100*(uslsascxpre/asctotpred)

 

  1. Click in the Col Name box and enter the text: “useless”.
  2. Select the Column F tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • ascxpred:=Cross(p1,tc);ascxpred:=Cross(C,tc);
  • confascx:=Cross(may,maz);
  • asctotpred:=Cum(ascxpred);
  • acc0ascxpred:=Cum(confascx AND Ref(ascxpred,-1));
  • acc1ascxpred:=Cum(confascx AND Ref(ascxpred,-2));
  • acc2ascxpred:=Cum(confascx AND Ref(ascxpred,-3));
  • uslsascxpre:=Cum(confascx AND ascxpred);
  • 100-(100*(acc0ascxpred+acc1ascxpred+acc2ascxpred+uslsascxpre)/asctotpred)

 

  1. Click in the Col Name box and enter the text: “false”
  2. Click OK to close the exploration editor.

 

I also suggest, before closing the editor, adding the following text to the Notes field to provide a more detailed description of the column names:

 

columns descriptions:

1: total ascending predictions

2: percent confirmed 1 day later

3: percent confirmed 2 days later

4: percent confirmed 3 days later

5: percent useless (confirmed same day as prediction)

6: percent of false predictions

 

The second exploration is added in the same manner, but the formulas and notes are different. The column names are the same. The steps to create it are:

  1. Select Tools >
    the Explorer.
  2. Click New
  3. Enter a name, “SMA cross stats - descending”
  4. Select the Column A tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • decxpred:=Cross(tc,p1);
  • confdecx:=Cross(maz,may);
  • Cum(decxpred);

 

  1. Click in the Col Name box and enter the text: “Total”.
  2. Select the Column B tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • decxpred:=Cross(tc,p1);
  • confdecx:=Cross(maz,may);
  • destotpred:=Cum(decxpred);
  • acc0desxpred:=Cum(confdecx AND Ref(decxpred,-1));
  • 100*(acc0desxpred/destotpred)

 

  1. Click in the Col Name box and enter the text: “1 day”.
  2. Select the Column C tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • decxpred:=Cross(tc,p1);
  • confdecx:=Cross(maz,may);
  • destotpred:=Cum(decxpred);
  • acc1desxpred:=Cum(confdecx AND Ref(decxpred,-2));
  • 100*(acc1desxpred/destotpred)

 

  1. Click in the Col Name box and enter the text: “2 day”.
  2. Select the Column D tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • decxpred:=Cross(tc,p1);
  • confdecx:=Cross(maz,may);
  • destotpred:=Cum(decxpred);
  • acc2desxpred:=Cum(confdecx AND Ref(decxpred,-3));
  • 100*(acc2desxpred/destotpred)

 

  1. Click in the Col Name box and enter the text: “3 day”.
  2. Select the Column E tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

  • decxpred:=Cross(tc,p1);
  • confdecx:=Cross(maz,may);
  • destotpred:=Cum(decxpred);
  • uslsdesxpred:=Cum(confdecx AND decxpred);
  • 100*(uslsdesxpred/destotpred)

 

  1. Click in the Col Name box and enter the text: “useless”.
  2. Select the Column F tab and enter the following formula.

 

  • p1:=Mov(Stoch(5,3),3,S);
  • y:=20;
  • z:=30;
  • may:=Mov(p1,y,S);
  • maz:=Mov(p1,z,S);
  • tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);

 

decxpred:=Cross(tc,p1);

  • confdecx:=Cross(maz,may);
  • destotpred:=Cum(decxpred);
  • acc0desxpred:=Cum(confdecx AND Ref(decxpred,-1));
  • acc1desxpred:=Cum(confdecx AND Ref(decxpred,-2));
  • acc2desxpred:=Cum(confdecx AND Ref(decxpred,-3));
  • uslsdesxpre:=Cum(confdecx AND decxpred);

 

  • 100-(100*(acc0desxpred+acc1desxpred+acc2desxpred+uslsdesxpre)/destotpred)

 

  1. Click in the Col Name box and enter the text: “false”
  2. Click OK to close the exploration editor.

 

The recommended notes for this exploration are:

 

columns descriptions:

1: total descending predictions

2: percent confirmed 1 day later

3: percent confirmed 2 days later

4: percent confirmed 3 days later

5: percent useless (confirmed same day as prediction)

6: percent of false predictions

 

It should also be noted that MetaStock version 10 users can put all 12 columns, both explorations, into a single exploration. It would only require changing the column names just a bit in order to easily tell which ones are for the ascending crosses and which ones are for the descending crosses. The second exploration would then have its formulas put in columns G through L.

 

William Golson

Equis International


Contents