[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Fw: Predictions II [indicators]



PureBytes Links

Trading Reference Links




 
----- Original Message ----- 
From: <A 
href="" title=tsokakis@xxxxxxxxx>Dimitris Tsokakis 

To: <A href="" 
title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
Sent: Thursday, July 17, 2003 10:06 PM
Subject: Predictions II [indicators]

PART II : PREDICTIONS 
FOR THE CROSS OF TWO INDICATOR MOVING AVERAGES
 
The same principle may be used to predict a cross of two MAs 
of an indicator.
Example : The StochD() indicator and its MAk=MA(StochD(),k) 
and MAp=MA(StochD(),p).
We just need to replace C by StochD() in the original 
Prediction formula.
The results are impressive, false predictions are 
rare.
The majority of Accurate predictions are confirmed the very 
next bar, the Acc2Desc and Acc2Asc, 
ie predictions verified two bars later is totally<FONT 
size=2> removed from the N100 study and, actually, are included 
here just for the comparison [both columns are zero for ALL 
N100 stocks, for the last 43 months...]
After this extended test, we may say that the cross of two 
StochD() MAs is successfully predicted.
Use the following exploration [n=1 last quotations] for the 
absolute # of crosses
 
// Prediction of MAcross of 
StochD()C1=StochD();p=20;MAp=MA(C1,p);k=30;MAk=MA(C1,k);y=p*MA(C1,p)-(p-1)*Ref(MA(C1,p-1),-1);tC1=(p*(k-1)*MA(C1,k-1)-k*(p-1)*MA(C1,p-1))/(k-p);DescCrossPrediction=Cross(tC1,C1);AscCrossPrediction=Cross(C1,tC1);ConfirmedDesc=Cross(MAk,MAp);ConfirmedAsc=Cross(MAp,MAk);DescTotalPredictions=Cum(DescCrossPrediction);Accurate0DescPredictions=Cum(ConfirmedDesc 
AND Ref(DescCrossPrediction,-1));Accurate1DescPredictions=Cum(ConfirmedDesc 
AND Ref(DescCrossPrediction,-2));Accurate2DescPredictions=Cum(ConfirmedDesc 
AND Ref(DescCrossPrediction,-3));UselessDescPredictions=Cum(ConfirmedDesc 
AND 
DescCrossPrediction);AscTotalPredictions=Cum(AscCrossPrediction);Accurate0AscPredictions=Cum(ConfirmedAsc 
AND Ref(AscCrossPrediction,-1));Accurate1AscPredictions=Cum(ConfirmedAsc AND 
Ref(AscCrossPrediction,-2));Accurate2AscPredictions=Cum(ConfirmedAsc AND 
Ref(AscCrossPrediction,-3));UselessAscPredictions=Cum(ConfirmedAsc AND 
AscCrossPrediction);Filter=1;AddColumn(Accurate0DescPredictions,"Acc0 
Desc",1.0);AddColumn(Accurate1DescPredictions,"Acc1 
Desc",1.0);AddColumn(Accurate2DescPredictions,"Acc2 
Desc",1.0);AddColumn(UselessDescPredictions,"Useless 
Desc",1.0);AddColumn(DescTotalPredictions-Column0-Column1-Column2-Column3,"False 
Desc",1.0);AddColumn(Accurate0AscPredictions,"Acc0 
Asc",1.0);AddColumn(Accurate1AscPredictions,"Acc1 
Asc",1.0);AddColumn(Accurate2AscPredictions,"Acc2 
Asc",1.0);AddColumn(UselessAscPredictions,"Useless 
Asc",1.0);AddColumn(AscTotalPredictions-Column5-Column6-Column7-Column8,"False 
Asc",1.0);
 
[see some results in the upper gif]
and the following exploration for the % 
success
// % Prediction of MAcross of 
StochD()C1=StochD();p=20;MAp=MA(C1,p);k=30;MAk=MA(C1,k);y=p*MA(C1,p)-(p-1)*Ref(MA(C1,p-1),-1);tC1=(p*(k-1)*MA(C1,k-1)-k*(p-1)*MA(C1,p-1))/(k-p);DescCrossPrediction=Cross(tC1,C1);AscCrossPrediction=Cross(C1,tC1);ConfirmedDesc=Cross(MAk,MAp);ConfirmedAsc=Cross(MAp,MAk);DescTotalPredictions=Cum(DescCrossPrediction);Accurate0DescPredictions=Cum(ConfirmedDesc 
AND Ref(DescCrossPrediction,-1));Accurate1DescPredictions=Cum(ConfirmedDesc 
AND Ref(DescCrossPrediction,-2));Accurate2DescPredictions=Cum(ConfirmedDesc 
AND Ref(DescCrossPrediction,-3));UselessDescPredictions=Cum(ConfirmedDesc 
AND 
DescCrossPrediction);AscTotalPredictions=Cum(AscCrossPrediction);Accurate0AscPredictions=Cum(ConfirmedAsc 
AND Ref(AscCrossPrediction,-1));Accurate1AscPredictions=Cum(ConfirmedAsc AND 
Ref(AscCrossPrediction,-2));Accurate2AscPredictions=Cum(ConfirmedAsc AND 
Ref(AscCrossPrediction,-3));UselessAscPredictions=Cum(ConfirmedAsc AND 
AscCrossPrediction);Filter=1;AddColumn(100*Accurate0DescPredictions/DescTotalPredictions,"Acc0 
Desc 
%",1.0);AddColumn(100*Accurate1DescPredictions/DescTotalPredictions,"Acc1 
Desc 
%",1.0);AddColumn(100*Accurate2DescPredictions/DescTotalPredictions,"Acc2 
Desc 
%",1.0);AddColumn(100*UselessDescPredictions/DescTotalPredictions,"Useless 
Desc %",1.0);AddColumn(100-Column0-Column1-Column2-Column3,"False Desc 
%",1.0);AddColumn(100*Accurate0AscPredictions/AscTotalPredictions,"Acc0 Asc 
%",1.0);AddColumn(100*Accurate1AscPredictions/AscTotalPredictions,"Acc1 Asc 
%",1.0);AddColumn(100*Accurate2AscPredictions/AscTotalPredictions,"Acc2 Asc 
%",1.0);AddColumn(100*UselessAscPredictions/AscTotalPredictions,"Useless Asc 
%",1.0);AddColumn(100-Column5-Column6-Column7-Column8,"False Asc 
%",1.0);
 
[the respective results in the lower gif]
 
Dimitris Tsokakis 
 
 
PART I : PREDICTIONS FOR THE CROSS OF 
TWO MOVING AVERAGES
 
To make the probable cross window more narrow, let 
us forget the unexpected +50% or -50% daily return.
Each stock has a history, including gapups and 
gapdowns.
The new hypothesis is that the stock will not 
double its historical highest ROC(C,1).
For the Upper [Lower] limit we have
<DIV 
>UR=2*Highest(ROC(C,1));LR=2*Lowest(ROC(C,1));
and the respective coefficients will 
beUcoeff=1+UR/100;Lcoeff=1+LR/100;
and the more realistic condition will 
beFilter=tClose<Lcoeff*C OR tClose>Ucoeff*C;
You will see now very few bars to expect an 
MAcross [the black candles in the att. gif]
The updated Title helps for info through the 
interpretation window.[it is also an extended use of Boolean operators]
 
// Probable MAcross 
bars
<FONT 
face="Times New Roman">p=20;MAp=MA(C,p);k=30;MAk=MA(C,k);y=p*MA(C,p)-(p-1)*Ref(MA(C,p-1),-1);tClose=(p*(k-1)*MA(C,k-1)-k*(p-1)*MA(C,p-1))/(k-p);DescCrossPrediction=Cross(tClose,C);AscCrossPrediction=Cross(C,tClose);ExpectMAcross=DescCrossPrediction 
OR AscCrossPrediction;Confirmed=Cross(MAk,MAp) OR 
Cross(MAp,MAk);UR=2*Highest(ROC(C,1));LR=2*Lowest(ROC(C,1));Ucoeff=1+UR/100;Lcoeff=1+LR/100;Filter=tClose<Lcoeff*C 
OR 
tClose>Ucoeff*C;AddColumn(MAp,"MAp");AddColumn(MAk,"MAk");Plot(C,"",7*Filter+1,64);Plot(MAp,"",4,1);Plot(MAk,"",5,1);bars=BarsSince(Cross(MAp,MAk) 
OR Cross(MAk,MAp));expect=NOT(Filter);Title=Name()+" , 
"+WriteIf(expect AND NOT(expectMAcross) AND NOT(Confirmed) AND bars>3 AND 
tClose<C,"EXPECT a bearish MAcross SOON","")+WriteIf(expect AND 
NOT(expectMAcross) AND NOT(Confirmed) AND bars>3 AND tClose>C,"EXPECT a 
bullish MAcross SOON","")+WriteIf(DescCrossPrediction,"EXPECT a bearish 
MAcross TOMORROW","")+WriteIf(AscCrossPrediction,"EXPECT a bullish MAcross 
TOMORROW","")+WriteIf(Confirmed,"MAcross","");In many cases now, there 
is one "EXPECT SOON" and one "EXPECT TOMORROW".
Dimitris 
Tsokakis
 
---- Original Message ----- 
<DIV 
>From: <A 
href="" title=tsokakis@xxxxxxxxx>Dimitris Tsokakis 

To: <A 
href="" 
title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
Sent: Thursday, July 17, 2003 2:35 PM
Subject: Fw: Predictions I

Let us see now the more realististic 
approach:
Hypothesis : We do not expect for 
tomorrow  a daily return greater than +50% OR  less than -50% 
.
Then you will find out very few days to expect the 
MAcrossover.
Some times we see two or three premature signals before the 
main one.
This observation helps to speculate in advance the upcoming 
MAcross and find best intraday prices for your movement.
We may have 3 types of signals
*EXPECT an MAcross SOON
*EXPECT an MAcross TOMORROW
*an MAcross confirmation
to check the value of the method.
Use for your ind. builder [interpretation window] the 
code
 
// MA cross 
Expectationp=20;MAp=MA(C,p);k=30;MAk=MA(C,k);y=p*MA(C,p)-(p-1)*Ref(MA(C,p-1),-1);tClose=(p*(k-1)*MA(C,k-1)-k*(p-1)*MA(C,p-1))/(k-p);DescCrossPrediction=Cross(tClose,C);AscCrossPrediction=Cross(C,tClose);ExpectMAcross=DescCrossPrediction 
OR AscCrossPrediction;Filter=tClose<0.5*C OR 
tClose>1.5*C;AddColumn(MAp,"MAp");AddColumn(MAk,"MAk");Plot(C,"",7*Filter+1,64);Plot(MAp,"",4,1);Plot(MAk,"",5,1);bars=BarsSince(Cross(MAp,MAk) 
OR Cross(MAk,MAp));expect=NOT(Filter) AND 
NOT(ExpectMAcross);Title=Name()+" , "+WriteIf(expect AND bars>=2,"EXPECT 
an MAcross SOON","")+WriteIf(ExpectMAcross,"EXPECT an MAcross 
TOMORROW","");
to read the respective signals.
In the att. gif, all the olive candles are far from any 
probable MAcross, the big black candle gives 
the premature expectation signal and the very next bar 
predicts [successfully] that an MAcross will occur tomorrow.
Dimitris Tsokakis
----- Original Message ----- 
From: <A 
href="" title=tsokakis@xxxxxxxxx>Dimitris Tsokakis 

To: <A href="" 
title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
Sent: Thursday, July 17, 2003 11:17 AM
Subject: Fw: Predictions I

The conditions DescCrossPrediction or 
AscCrossPrediction give a quite reliable warning for an upcoming MA cross, 
bullish or bearish.
There are some periods when this cross is IMPOSSIBLE and may 
be accurately idendified.
This tClose is the virtual next bar Close which will fulfill 
the condition MA(C,p)=MA(C;k).
The argument is quite simple:
 
If tClose is negative, then it is IMPOSSIBLE 
to see an MAcross tomorrow.
 
[Of course there are many other cases we may exclude, for 
example tClose=0.1*C, since we do not expect a -90% daily return for CSCO 
!!!
but, in this formula we just want to investigate the 
theoretical IMPOSSIBLE]
For your indicator builder [or AA] use the
 
// Impossible MA cross Prediction 
p=20;MAp=MA(C,p);k=30;MAk=MA(C,k);y=p*MA(C,p)-(p-1)*Ref(MA(C,p-1),-1);tClose=(p*(k-1)*MA(C,k-1)-k*(p-1)*MA(C,p-1))/(k-p);Filter=tClose<0;AddColumn(MAp,"MAp");AddColumn(MAk,"MAk");Plot(C,"",6*Filter+1,64);Plot(MAp,"",4,1);Plot(MAk,"",5,1);
In AA explore the database for the n=1 last quotations to see 
all these stocks you do not expect an MA cross, bullish or bearish.
Any MAcross technique should be applied to the 
rest...
For July16 there were 18 N100 stocks indifferent for an 
MAcross.
Dimitris Tsokakis
----- Original Message ----- 
From: <A 
href="" title=tsokakis@xxxxxxxxx>Dimitris Tsokakis 

To: <A href="" 
title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
Sent: Wednesday, July 16, 2003 11:04 AM
Subject: Fw: Predictions I

The condition
DescCrossPrediction=Cross(tClose,C); 
predicts that a Descending MA cross will occur 
tomorrow.
It will be named
 <FONT 
face="Times New Roman">
Accurate0DescPredictions, if it is confirmed tomorrow<FONT 
face=Verdana size=2>
Accurate1DescPredictions, if it is confirmed 1 day later<FONT 
face=Verdana size=2>
Accurate2DescPredictions, if it is confirmed 2 days 
later
UselessDescPredictions, if it is simultaneous 
with the prediction
False, if it does not belong in one above 
category. 
 
[Last bar predictions are also considered as 
false, although the majority will be confirmed tomorrow...]
Similar terminology is used for the Ascending 
crosses.
The N100 results from Jan2000 till now are 
enthusiastic and, in practical terms, we may say that we can have a safe 
prediction 
for the [unknown] next bar MA 
cross.
Explore your database for the n=1 last 
quotations with
 
// MA cross Prediction Statistics, by Dimitris 
Tsokakis, July 2003 <FONT 
face="Times New Roman">
p=20;MAp=<FONT 
size=2>MA(C,p);<FONT face=Verdana 
size=2>
k=30;MAk=<FONT 
size=2>MA(C,k);<FONT face=Verdana 
size=2>
y=p*MA(C,p)-(p-<FONT 
size=2>1)*Ref<FONT 
size=2>(MA(C,p-<FONT 
size=2>1),-1<FONT 
size=2>);<FONT face=Verdana 
size=2>
tClose=(p*(k-1)*<FONT 
size=2>MA(C,k-1<FONT 
size=2>)-k*(p-1)*<FONT 
size=2>MA(C,p-1<FONT face=Verdana 
size=2>))/(k-p);<FONT 
face="Times New Roman">
DescCrossPrediction=Cross<FONT 
face=Verdana size=2>(tClose,C);<FONT 
face="Times New Roman">
AscCrossPrediction=Cross<FONT 
face=Verdana size=2>(C,tClose);<FONT 
face="Times New Roman">
ConfirmedDesc=Cross<FONT face=Verdana 
size=2>(MAk,MAp);<FONT 
face="Times New Roman">
ConfirmedAsc=Cross<FONT face=Verdana 
size=2>(MAp,MAk);<FONT 
face="Times New Roman">
DescTotalPredictions=Cum<FONT 
face=Verdana size=2><FONT 
face="Times New Roman">(DescCrossPrediction);<FONT 
face="Times New Roman">
Accurate0DescPredictions=Cum<FONT 
size=2>(ConfirmedDesc AND Ref<FONT 
size=2>(DescCrossPrediction,-1<FONT face=Verdana 
size=2>));<FONT 
face="Times New Roman">
Accurate1DescPredictions=Cum<FONT 
size=2>(ConfirmedDesc AND Ref<FONT 
size=2>(DescCrossPrediction,-2<FONT face=Verdana 
size=2>));<FONT 
face="Times New Roman">
Accurate2DescPredictions=Cum<FONT 
size=2>(ConfirmedDesc AND Ref<FONT 
size=2>(DescCrossPrediction,-3<FONT face=Verdana 
size=2>));<FONT 
face="Times New Roman">
UselessDescPredictions=Cum<FONT 
face=Verdana size=2>(ConfirmedDesc AND 
DescCrossPrediction);
AscTotalPredictions=Cum<FONT face=Verdana 
size=2>(AscCrossPrediction);<FONT 
face="Times New Roman">
Accurate0AscPredictions=Cum<FONT 
size=2>(ConfirmedAsc AND Ref<FONT 
size=2>(AscCrossPrediction,-1<FONT face=Verdana 
size=2>));<FONT 
face="Times New Roman">
Accurate1AscPredictions=Cum<FONT 
size=2>(ConfirmedAsc AND Ref<FONT 
size=2>(AscCrossPrediction,-2<FONT face=Verdana 
size=2>));<FONT 
face="Times New Roman">
Accurate2AscPredictions=Cum<FONT 
size=2>(ConfirmedAsc AND Ref<FONT 
size=2>(AscCrossPrediction,-3<FONT face=Verdana 
size=2>));<FONT 
face="Times New Roman">
UselessAscPredictions=Cum<FONT 
face=Verdana size=2>(ConfirmedAsc AND 
AscCrossPrediction);
Filter=1<FONT 
face="Times New Roman">;<FONT 
face="Times New Roman">
AddColumn(100<FONT 
size=2>*Accurate0DescPredictions/DescTotalPredictions,"Acc0 
Desc %",1.0<FONT face=Verdana 
size=2>);<FONT 
face=Verdana size=2>
AddColumn(100<FONT 
size=2>*Accurate1DescPredictions/DescTotalPredictions,"Acc1 
Desc %",1.0<FONT face=Verdana 
size=2>);<FONT 
face=Verdana size=2>
AddColumn(100<FONT 
size=2>*Accurate2DescPredictions/DescTotalPredictions,"Acc2 
Desc %",1.0<FONT face=Verdana 
size=2>);<FONT 
face=Verdana size=2>
AddColumn(100<FONT 
size=2>*UselessDescPredictions/DescTotalPredictions,"Useless 
Desc %",1.0<FONT face=Verdana 
size=2>);<FONT 
face=Verdana size=2>
AddColumn(100<FONT 
size=2>-Column0-Column1-Column2-Column3,"False Desc 
%",1.0<FONT face=Verdana 
size=2>);<FONT 
face=Verdana size=2>
AddColumn(100<FONT 
size=2>*Accurate0AscPredictions/AscTotalPredictions,"Acc0 
Asc %",1.0<FONT face=Verdana 
size=2>);<FONT 
face=Verdana size=2>
AddColumn(100<FONT 
size=2>*Accurate1AscPredictions/AscTotalPredictions,"Acc1 
Asc %",1.0<FONT face=Verdana 
size=2>);<FONT 
face=Verdana size=2>
AddColumn(100<FONT 
size=2>*Accurate2AscPredictions/AscTotalPredictions,"Acc2 
Asc %",1.0<FONT face=Verdana 
size=2>);<FONT 
face=Verdana size=2>
AddColumn(100<FONT 
size=2>*UselessAscPredictions/AscTotalPredictions,"Useless 
Asc %",1.0<FONT face=Verdana 
size=2>);<FONT 
face=Verdana size=2>
AddColumn(100<FONT 
size=2>-Column5-Column6-Column7-Column8,"False Asc 
%",1.0<FONT face=Verdana 
size=2>);
 
----- Original Message ----- 
From: <A 
href="" title=tsokakis@xxxxxxxxx>Dimitris Tsokakis 

To: <A href="" 
title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
Sent: Tuesday, July 15, 2003 5:35 PM
Subject: Predictions I

We may calculate the next bar Close necessary for a MA(C,p) to 
cross another MA(C,k).
I will overcome this procedure and I will try just to predict 
if a cross will occur tomorrow.
For your AA window explore for the n=1 last quotations 
with
// Prediction for a cross of two moving averages
<FONT 
size=2>p=20;MAp=MA(C,p);Plot(MAp,"",1,8);k=30;MAk=MA(C,k);Plot(MAk,"",2,8);y=p*MA(C,p)-(p-1)*Ref(MA(C,p-1),-1);//Plot(Ref(C,0),"",7,8);tClose=(p*(k-1)*MA(C,k-1)-k*(p-1)*MA(C,p-1))/(k-p);DescCrossPrediction=Cross(tClose,C);AscCrossPrediction=Cross(C,tClose);ConfirmedDesc=Cross(MAk,MAp);ConfirmedAsc=Cross(MAp,MAk);Title=Name()+WriteIf(ConfirmedDesc,", 
Confirmed descending MAcross","")+WriteIf(DescCrossPrediction,", A 
descending MAcross will occur tomorrow","")+WriteIf(ConfirmedAsc,", 
Confirmed ascending MAcross","")+WriteIf(AscCrossPrediction,", An ascending 
MAcross will occur 
tomorrow","");Filter=1;AddColumn(Cum(DescCrossPrediction),"Predicted 
DescCrosses",1.0);AddColumn(Cum(ConfirmedDesc),"Confirmed 
DescCrosses",1.0);AddColumn(100*Cum(DescCrossPrediction)/Cum(ConfirmedDesc),"Desc 
%");AddColumn(Cum(AscCrossPrediction),"Predicted 
AscCrosses",1.0);AddColumn(Cum(ConfirmedAsc),"Confirmed 
AscCrosses",1.0);AddColumn(100*Cum(AscCrossPrediction)/Cum(ConfirmedAsc),"Asc 
%",1.0);
 
 to see the commulative predicted/actual cross 
relation.
Replace the Filter=1; line with the 
Filter=<FONT 
color=#000000 face="Times New Roman">AscCrossPrediction OR 
DescCrossPrediction;
<FONT color=#000000 
face="Times New Roman">to see the predictions for tomorrow, or with the 

<FONT color=#000000 
face="Times New Roman">Filter=<FONT color=#ffffe0 
face=Verdana><FONT color=#000000 face="Times New Roman" 
size=2>Ref(AscCrossPrediction OR DescCrossPrediction,-1);<FONT 
size=2>
to see the confirmed 
crosses
The commulative view for my favorites selection is in the 
attached gif.
A detailed analysis will follow.
Use the same formula in Indicator Builder or Interpretation 
window.
Dimitris Tsokakis
[to be continued]






Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



Attachment:
prob.gif

Attachment: Description: "Description: GIF image"