MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

Moving Average - Crossovers Explorer II by Dimitris Tsokakis

Dimitris Tsokakis' article in this issue, "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 follow:

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.
5. 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 Tsokakis' article.

The explorations and instructions for creating them in MetaStock are:

6. Select the Column B tab and enter the following formula:


Total

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)

 
7. Click in the Col Name box and enter the text: "1 day".
8. Select the Column C tab and enter the following formula.

1 day

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)


 
9. Click in the Col Name box and enter the text: "2 day".
10. Select the Column D tab and enter the following formula.

2 day

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)

 
11. Click in the Col Name box and enter the text: "3 day".
12. Select the Column E tab and enter the following formula.

3 day

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)


 
13. Click in the Col Name box and enter the text: "useless".
14. Select the Column F tab and enter the following formula.

useless

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)


 
15. Click in the Col Name box and enter the text: "false"
16. 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.
 

SMA cross stats - descending

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);

 
5. Click in the Col Name box and enter the text: "Total".
6. Select the Column B tab and enter the following formula.
 

Total

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)

 
7. Click in the Col Name box and enter the text: "1 day".
8. Select the Column C tab and enter the following formula.
 

1 day

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)

 
9. Click in the Col Name box and enter the text: "2 day".
10. Select the Column D tab and enter the following formula.
 

2 day

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)

 
11. Click in the Col Name box and enter the text: "3 day".
12. Select the Column E tab and enter the following formula.
 

3 day

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)

 
13. Click in the Col Name box and enter the text: "useless".
14. Select the Column F tab and enter the following formula.
 

Useless

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)

 

15. Click in the Col Name box and enter the text: "false"
16. Click OK to close the exploration editor.

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 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
MetaStock Support Representative
Equis International (A Reuters Company)
801 265-9998, www.metastock.com

Source / From: TOP
http://www.traders.com  

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!