You would have to be a little more clear on exactly what it is you are trying to accomplish. Though, writing to a file directly, or using static variables might be areas to explore.
Mike --- In [email protected], "ozzyapeman" <zoopf...@...> wrote: > > Ah. Well that would explain that. Thanks. > > Any ideas for a possible workaround? > > > > --- In [email protected], "Mike" <sfclimbers@> wrote: > > > > 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 [email protected], "ozzyapeman" <zoopfree@> 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(); > > > } > > > > > >
