PureBytes Links
Trading Reference Links
|
I don't have this problem when I try it. The included variable works
fine across the custom backtest code.
However, there are a few problems with the custom backtest code you've
shown here. Firstly there's no actual backtest performed, and secondly
you can't write to the Trade object's "Shares" property as it's
read-only (although the help doesn't actually tell you that).
By including the PreProcess method you've indicated you're going to
use the mid-level (or low-level) interface, in which case you need a
matching PostProcess method call and a call to ProcessTradeSignals at
each bar. If you only want to use the high-level interface, replace
the PreProcess method with the Backtest method.
Regards,
GP
--- In amibroker@xxxxxxxxxxxxxxx, "dralexchambers"
<dralexchambers@xxx> wrote:
>
> I have an include file which contains some variables for use in my
> backtest, eg:
>
> <INCLUDE FILE>
> myvar = 1;
> </INCLUDE FILE>
>
> My backtest AFL is as follows:
>
> #include <INCLUDE FILE.afl>;
> (rest of file....)
>
> This works fine and the backtest AFL uses myvar correctly when NOT
> using the custom backtester.
>
> However, if I add the Custom Backtester code - below - I get the
> following error:
>
> "Variable 'myvar' used without being initialized"
>
> It seems the Custom Backtester ignores include files.
>
> What can I do here as I am stuck?
>
> ---------------------------------
>
> SetCustomBacktestProc("");
> if( Status("action") == actionPortfolio )
> {
> bo = GetBacktesterObject();
>
> bo.PreProcess();
>
> for( trade = bo.GetFirstTrade(); trade; trade =
> bo.GetNextTrade() )
> {
> if (trade.Shares > 10)
> { trade.Shares = 20; }
> }
> }
>
Please note that this group is for discussion between users only.
To get 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/
|