PureBytes Links
Trading Reference Links
|
Nice
work DT!
<FONT face=Arial color=#0000ff
size=2>
I
added a few columns to your code to show how often your predictions
occur and to show final stats for watch lists instead of single
stocks.
<FONT face=Arial color=#ff0000
size=2>Filter<FONT face=Arial color=#8b0000
size=2>=Status<FONT
face=Arial color=#8b0000 size=2>(<FONT face=Arial color=#cc4466
size=2>"LastBarInTest"<FONT face=Arial color=#8b0000
size=2>);<FONT face=Arial color=#0000ff
size=2>SetOption(<FONT
face=Arial color=#cc4466 size=2>"NoDefaultColumns"<FONT face=Arial
color=#8b0000 size=2>,<FONT face=Arial color=#ff0000
size=2>False<FONT face=Arial color=#8b0000
size=2>);<FONT face=Arial color=#0000ff
size=2>AddColumn<FONT face=Arial color=#8b0000
size=2>(BarCount<FONT
face=Arial color=#8b0000 size=2>,<FONT face=Arial color=#cc4466
size=2>"BarCount",<FONT
face=Arial color=#ff00ff size=2>1.0<FONT face=Arial color=#8b0000
size=2>);<FONT face=Arial color=#0000ff
size=2>AddColumn<FONT face=Arial color=#8b0000
size=2>(DescTotalPredictions,<FONT face=Arial color=#cc4466
size=2>"DescTotalPredictions"<FONT face=Arial color=#8b0000
size=2>,1.0<FONT face=Arial
color=#8b0000 size=2>);<FONT face=Arial color=#0000ff
size=2>AddColumn<FONT face=Arial color=#8b0000
size=2>(BarCount<FONT
face=Arial color=#8b0000 size=2>/<FONT face=Arial color=#8b0000
size=2>DescTotalPredictions,<FONT face=Arial color=#cc4466
size=2>"AvePredictionInterval"<FONT face=Arial color=#8b0000
size=2>,1.0<FONT face=Arial
color=#8b0000 size=2>);
<FONT face=Arial color=#8b0000
size=2>
Best
regards,
<FONT face=Arial color=#0000ff
size=2>herman.
<FONT face=Tahoma
size=2>-----Original Message-----From: Dimitris Tsokakis
[mailto:TSOKAKIS@xxxxxxxxx]Sent: Wednesday, July 16, 2003 4:05
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 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="Times New Roman">
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=Verdana
size=2>
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<FONT
size=2>(C,p)-(p-1)*<FONT
size=2>Ref(MA<FONT
size=2>(C,p-1),-<FONT
size=2>1);<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><FONT
face="Times New Roman">(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,<FONT
size=2>"Acc0 Desc %",1.0<FONT
face=Verdana size=2><FONT
face="Times New Roman">);<FONT
face="Times New Roman">
AddColumn(100<FONT
size=2>*Accurate1DescPredictions/DescTotalPredictions,<FONT
size=2>"Acc1 Desc %",1.0<FONT
face=Verdana size=2><FONT
face="Times New Roman">);<FONT
face="Times New Roman">
AddColumn(100<FONT
size=2>*Accurate2DescPredictions/DescTotalPredictions,<FONT
size=2>"Acc2 Desc %",1.0<FONT
face=Verdana size=2><FONT
face="Times New Roman">);<FONT
face="Times New Roman">
AddColumn(100<FONT
size=2>*UselessDescPredictions/DescTotalPredictions,<FONT
size=2>"Useless Desc %",<FONT
size=2>1.0<FONT
face="Times New Roman">);<FONT
face="Times New Roman">
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
title=tsokakis@xxxxxxxxx href="">Dimitris
Tsokakis
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">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
face="Times New Roman" color=#000000>AscCrossPrediction OR
DescCrossPrediction;
<FONT
face="Times New Roman" color=#000000>to see the predictions for tomorrow, or
with the
<FONT face="Times New Roman"
color=#000000>Filter=<FONT face=Verdana
color=#ffffe0><FONT face="Times New Roman" color=#000000
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]Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
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.
|