PureBytes Links
Trading Reference Links
|
@gp_sydney:
PositionSize in EnterTrade call is expressed in DOLLARS, not in shares.
@murthysuresh:
your code does not work because you do not call PreProcess/PostProcess
See
http://www.amibroker.com/guide/a_custommetrics.html
for correct coding.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "gp_sydney" <gp.investment@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, September 08, 2007 1:43 AM
Subject: [amibroker] Re: custom backtester challenges
> I'm a bit confused by your EnterTrade call. You have the last
> parameter set to one, which is the position size variable. If the
> price is more than one and PosSize is only one, then that would only
> allow a fraction of a share to be purchased.
>
> Regards,
> GP
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@xxx> wrote:
>>
>> 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
>
>
>
>
>
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/
|