PureBytes Links
Trading Reference Links
|
As indicated in the user guide ( http://www.amibroker.com/guide/a_custombacktest.html ), HandleStops and UpdateStats are low level interface methods. The behavior of these two methods is handled by ProcessTradeSignals at the mid level.
You are effectively performing the same operation twice, which is likely what is causing your mystery trades.
Mike
--- In amibroker@xxxxxxxxxxxxxxx, Potato Soup <potatosoupz@xxx> wrote:
>
> So I took the template code for a backtest from the user knowledge base article. What I don't understand is why it changes the outcome of my trades even though I have no custom code in it. For instance, before inserting the custom backtest code, my AFL creates 30 trades. But with this added, it creates 34 trades, and 2 of them are on the same day.
>
> Why would this following code modify the outcome of an AFL backtest:
>
> SetCustomBacktestProc("");
> if (Status("action") == actionPortfolio)
> {
> // Get backtester object
> bo = GetBacktesterObject();
>
> // o pre-processing
> bo.PreProcess();
>
> // Loop through all bars
> for (i = 0; i < BarCount; i++)
> {
>
> // Loop through all signals at this bar
> for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i))
> {
> // Process trades at this bar
> bo.ProcessTradeSignals(i);
> }
>
> // Handle programmed stops at this bar
> bo.HandleStops(i);
>
> // Update MAE/MFE stats for bar
> bo.UpdateStats(i, 1);
>
> // Update stats at bar's end
> bo.UpdateStats(i, 2);
> }
>
> // Do post-processing
> bo.PostProcess();
> }
> ///// End of custom backtesting code
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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:
amibroker-digest@xxxxxxxxxxxxxxx
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/
|