PureBytes Links
Trading Reference Links
|
Ozzy,
The Stats object only contains values for built in metrics as
described here (scroll to bottom):
http://www.amibroker.com/guide/a_custombacktest.html
Mike
--- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" <zoopfree@xxx> wrote:
>
> Hello, I've read Herman's excellent doc, "IntroToATC".
>
> I am trying to run an optimization, and then store the values of the
> optimized variables in some composite symbols. I later want to pull
> values of a certain range and input them automatically in another
AFL.
> However, I keep getting a syntax error that the fields are not
> available, even though they clearly are.
>
> Hoping someone can point out my mistake, or give me some
suggestions on
> what else to try.
>
> Here is the code. Any ideas? :
>
>
> //------------------------------------------------------------------
--
> // TRADING SYSTEM
> //------------------------------------------------------------------
--
>
> FastMALength = Optimize("FastMALength", 10, 1, 10,
1);
> SlowMALength = Optimize("SlowMALength", 20, 20, 50,
10);
>
> FastMA = MA( C, FastMALength );
> SlowMA = MA( C, SlowMALength );
> Buy = Cross( FastMA, SlowMA );
> Sell = Cross( SlowMA, FastMA );
>
>
>
> //------------------------------------------------------------------
--
> // CUSTOM OPTIMIZATION PROCEDURE (Store opt vars in composite
symbols)
> //------------------------------------------------------------------
--
>
> SetCustomBacktestProc( "" );
>
> if ( Status( "action" ) == actionPortfolio )
> {
> bo = GetBacktesterObject();
>
> // run default backtest procedure
> bo.Backtest( 1 );
>
> st = bo.getperformancestats( 0 );
>
> // iterate through closed trades first
> for ( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade
() )
> {
> FastMALength = st.getvalue( "FastMALength" );
> SlowMALength = st.getvalue( "SlowMALength" );
>
> AddToComposite( FastMALength, "~OptFastMA", "X", 1+2+8+16+64 );
> AddToComposite( SlowMALength, "~OptSlowMA", "X", 1+2+8+16+64 );
> }
> bo.ListTrades();
> }
>
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
*********************************
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|