PureBytes Links
Trading Reference Links
|
<SPAN
class=609400604-26042003>Hi,
<SPAN
class=609400604-26042003>
Has
anyone found a way to use FOR loops to replace the existing Optimize
feature?
I want
to run an exploration that essentially works just like the Optimize feature, but
I want to add a new Column, MAR, so I can sort by MAR without the hassle of
exporting to excel.
<SPAN
class=609400604-26042003>
<SPAN
class=609400604-26042003>Tomasz' example below only reports the best result. I
still want to see all the results.
<SPAN
class=609400604-26042003>
Any
help would be appreciated.
<SPAN
class=609400604-26042003>
<SPAN
class=609400604-26042003>Cheers,
<SPAN
class=609400604-26042003>-Steve
<FONT face=Tahoma
size=2>-----Original Message-----From: Tomasz Janeczko
[mailto:amibroker@xxxxxx]Sent: Sunday, April 13, 2003 12:15
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: AmiBroker
4.31.1 BETA released, was [amibroker] AmiBroker 4.31.0 BETA
released
Dale,
Yes it is possible to perform optimization using for loop
inside exploration code:
Sample code follows, it runs optimization inside for loop
and reports only THE BEST
result. It should be run usign "EXPLORE". The code in fact
runs several
backtests inside 'for' loop and notes the best result and
best parameter range.
bestequity = 0<FONT
size=1>;bestrange = 0<FONT
size=1>;
// optimization loop
for( range = 12;
range < 40; range ++
){
Buy = <FONT color=#0000ff
size=1>Cross( Close, <FONT color=#0000ff
size=1>EMA( Close, range ) );
Sell = Cross<FONT
size=1>( EMA(
Close, range ), Close );
L<FONT
face="Courier New" size=1>e =<FONT
face="Courier New" size=1> <FONT face="Courier New" color=#0000ff
size=1>LastValue(
Equity()<FONT
face="Courier New" size=1> );
if( L<FONT
face="Courier New" size=1>e > bestequity )
{ bestequity =
L<FONT face="Courier New"
size=1>e; bestrange = range; }<FONT
size=1>}
range = bestrange;
Buy = Cross(
Close, EMA(
Close, range ) );
Sell = Cross(
EMA( Close, range
), Close );
Filter = <FONT
face="Courier New" color=#0000ff size=1>BarIndex<FONT
face="Courier New" size=1>() == BarCount - <FONT
face="Courier New" color=#ff00ff size=1>1<FONT face="Courier New"
size=1>;
AddColumn( bestrange, <FONT
face="Courier New" color=#ff00ff size=1>"Best range"<FONT
face="Courier New" size=1> );<FONT face="Courier New" color=#0000ff
size=1>
AddColumn( <FONT
face="Courier New" color=#0000ff size=1>Equity<FONT face="Courier New"
size=1>(), "Best
Equity" );
Best regards,Tomasz
Janeczkoamibroker.com
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.
|