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

[amibroker] custom backtester challenges



PureBytes Links

Trading Reference Links

Hello
I am trying to force the custom backtester to trade at a predefined 
price and predefined time. the buy signal is triggered based on time. 
however backtester trades at the close price defined by the Buy 
signal. there is something wrong in this code snippet that i cannot 
figure out. 

/* Now custom-backtest procedure follows */
if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject();





// try to force the enntry and exit price
bo.EnterTrade(49360,STOCKNAME,True,1.20067,1);
bo.exittrade(49360 +25,STOCKNAME,1.21111,1);

SumProfitPerRisk = 0;
NumTrades = 0;

// iterate through closed trades first
for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )
{
trade.AddCustomMetric("MAE $", StrFormat( "%.4f", 100 * trade.GetMAE
() /
trade.EntryPrice ) );
trade.AddCustomMetric("MFE $", StrFormat( "%.4f", 100 * trade.GetMFE
() /
trade.EntryPrice ) );
}
bo.ListTrades();
}




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/