[新手問題] backtesting setting 問題
請問如何set指數期貨每點價值?例如我玩恒指期貨, 如何set1點50元
看過AB簡介, 但依書方法設定完後也不行
不知哪裡出了問題
謝謝!! Set PointValue in Information window.
or in AFL code set variable Pointvalue = ...;
Additionally activate futures mode in backtest settings
Or via code SetOption( "FuturesMode", True); 本帖最後由 jacklcl 於 13-11-3 23:35 編輯
joshsmi 發表於 13-11-3 22:54 static/image/common/back.gif
Set PointValue in Information window.
or in AFL code set variable Pointvalue = ...;
Hi joshsmi, thanks for your help
i just followed your suggestion and set the point value to HK$50
after running the backtest, i discovered that the PnL was calcuated based on the % change of the future price multiply by the equity and the point value
e.g. buy price @ 22968 and sell @ 22982
then this trade suffered a loss of 14 points which equal to HK$ 700 (14 x HK$50)
but in AB, the calculation is as follows:
from 22982 to 22968, the % change is 0.06%
then it applied this 0.06% to my equity (say HK$ 100,000) which is 60
and then it used this 60 multiply by the point value which the loss is HK$3000 in the bactest result
Look here it is calculated the way it should be.
http://img266.imageshack.us/img266/8854/t0z7.png
So probably you seem to be doing something wrong. Obviously you haven't set a position size. 本帖最後由 joshsmi 於 13-11-4 04:17 編輯
if you need to use variable margin calaculation then you need to add custom backtest procedure.
www.amibroker.com/guide/a_custombacktest.html
http://www.amibroker.org/userkb/ ... tester-interface-2/
The following calculation is just an example and not related to Hang Seng
//Start of Custom Backtest Interface
SetCustomBacktestProc("");
if ( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.preProcess();
for ( bar = 0; bar < BarCount; bar ++ )
{
for ( sig = bo.GetFirstSignal( bar ); sig ; sig = bo.GetNextSignal( bar ) )
{
if ( sig.isEntry() )
sig.MarginDeposit = sig.Price * sig.Pointvalue / Leverage; // calculate margin to be used
}
bo.ProcessTradeSignals( bar );
}
bo.postProcess();
} joshsmi 發表於 13-11-4 04:15 static/image/common/back.gif
if you need to use variable margin calaculation then you need to add custom backtest procedure.
www. ...
Thank you!
you are so nice ^^
頁:
[1]