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

RE: [amibroker] Optimise coding



PureBytes Links

Trading Reference Links

Hello Natasha,

Going by equity of some other stat you can calculate yourself you can use an
inline optimization. Below is a simple example. You could save the optimum
parameter using a Static Variable for more general use...

Best regards,
herman

// Inline optimization
bestequity = 0;
bestrange = 0;

for( range = 10; range < 20; range ++ )
{
  Buy = Cross( Close, EMA( Close, range ) );
  Sell = Cross( EMA( Close, range ), Close );
  LastEquity = LastValue( Equity() );

  if( LastEquity > bestequity )
  {
   bestequity = LastEquity;
   bestrange = range;
  }

E=Equity(1);
AddColumn( BestRange, "R="+WriteVal(range,1.0));
AddColumn( BestEquity, "E="+WriteVal(range,1.0));
}
Range = BestRange;
Buy = Cross( Close, EMA( Close, range ) );
Sell = Cross( EMA( Close, range ), Close );
Filter = Status("LastBarInTest");

Plot(E,"",1,1);
Title = Name() +", Best Equity: "+E+" at Range: "+Range;




-----Original Message-----
From: Natasha !! [mailto:dynomitedoll_ddd@xxxxxxxxx]
Sent: Sunday, March 06, 2005 3:20 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Optimise coding


   Hi,
         This is regarding Optimisation coding;
   Suppose i had a code like below to optimise;

x=Optimize("x",10,10,100,1);
Sell=Cross(z,x);Buy=Cross(x,z);
Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
     Now here after optimisation i get the optimal value as  suppose say 52
.Now i do a back test but this will consider the initial value 10 above in
the Optimise function and then perform the back test. How do i code so that
after optimisation the back test will use the optimised number viz 52
automatically and then  perform the back test ?Currently with the above code
i have to physically change the number and then perform the back-test.

 Thanks.

--- N !!





Warm regards,
Natasha !




Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Yahoo! Groups Sponsor
ADVERTISEMENT






Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/

To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx

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




------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/