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

[amibroker] A quasi-optimization procedure for Indicator builder



PureBytes Links

Trading Reference Links




Here is the outline
a. We have in AA the 49 steps of
 
d1=Optimize(<FONT 
size=2>"d1",20<FONT 
size=2>,20,<FONT 
size=2>50,5);
d2=Optimize(<FONT 
size=2>"d2",60<FONT 
size=2>,60,<FONT 
size=2>90,5);
Buy=Cross(<FONT 
size=2>StochD(),d1);
Sell=Cross(<FONT 
size=2>StochD(),d2);
 
b. We may see in indicator builder these 49 final equities as 
the last 49 bars of a new array G0
with the code
// Quasi-Optimization IB code
Counter=0;G0=0;L1=LastValue(Cum(1)); 
ZD1=0;ZD2=0;for(d2=60;d2<=90;d2=d2+5){for(d1=20;d1<=50;d1=d1+5){Buy=Cross(StochD(),d1);Sell=Cross(StochD(),d2);e=(Equity(1,0));Counter=Counter+1;G0[L1-CountER]=LastValue(e);ZD1[L1-CountER]=d1;ZD2[L1-CountER]=d2;}}// 
Plot(ZD1,"",colorBlack,8+styleLeftAxisScale); Plot(ZD2,"",colorOrange,8+styleLeftAxisScale);
<FONT 
size=2>Plot(G0,"",2,2);G0max=LastValue(Highest(G0));ZG0=ValueWhen(G0==G0max,L1+1-Cum(1));ZD10=ValueWhen(G0==G0max,ZD1);ZD20=ValueWhen(G0==G0max,ZD2);Title="The 
optimal solution for "+Name()+" is the #"+WriteVal(ZG0,1.0)+" : 
[D1="+WriteVal(ZD10,1.0)+",D2="+WriteVal(ZD20,1.0)+"] = 
"+WriteVal(100*(-1+G0max/10000),1.2)+" %";
 
This is an easy IB reference for the optimal solution, without 
using the AA window.
Of course it can no way substitute all these interesting 
info available with the Optimize button use.
The method can afford less optimization steps than the total 
stock quotations, else an "out of range" message will appear.
The delay of the final result is nearly the same with 
optimization time.
A 496steps MSFT optimization would look like the 
2quasiOpt.gif.  
To see the parallel D1, D2 progress, uncomment the // Plot(... 
line.
The visual interpretation of an optimization may give some 
interesting point of view, not easily accessible in the crowded
Results list. 
 
Dimitris Tsokakis






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:
1quasiOpt.gif
Description: GIF image
Attachment:

Attachment: Description: "Description: GIF image"

Attachment: Description: "2quasiOpt.gif"