ZS #F
AFL code
had a short sign
at 2014/11/04 01:00:00
short price is 1038
and the k bar high price is 1035
backtest result show this trade
It's wrong
參考一下
Yahoo! Groups上buyprice不依help上的O,C的作法。
Hello,
You got it all wrong. DO NOT change default settings unless you know very well what you are doing.
Correct formula is:
SetOption("PriceBoundChecking", TRUE); //DO NOT CHANGE DEFAULTS!
HistoVolat_10 = StDev(log(C / Ref(C, -1)), 10) * sqrt(260); // * 10;
formula = (Avg * HistoVolat_10) * sqrt(Days/260);
HiPrc = C + formula/2;
LoPrc = C - formula/2;
BuyPrice = Ref(LoPrc,-1);
Buy = L < BuyPrice AND H > BuyPrice;
SellPrice = Ref(HiPrc,-1);
Sell = L < SellPrice AND H > SellPrice;
Best regards,
Tomasz Janeczko
amibroker.com
On 2013-04-01 23:09, ewn87544 wrote:
> I am trying to backtest the script below but
> It will buy or sell at the BUYPRICE or SELLPRICE
> even when it is out of the range of the price bar.
> How do I make this statement be binding?
> IIf(L < BuyPrice AND H > BuyPrice, Buy = 1,0 );
> Thanks
>
> SetOption("PriceBoundChecking",0); //fALSE
> SetTradeDelays( 1, 1, 1, 1 );
> HistoVolat_10 = StDev(log(C / Ref(C, -1)), 10) * sqrt(260); // * 10;
> formula = (Avg * HistoVolat_10) * sqrt(Days/260);
> HiPrc = C + formula/2;
> LoPrc = C - formula/2;
>
> BuyPrice = Ref(LoPrc,-1);
> IIf(L < BuyPrice AND H > BuyPrice, Buy = 1,0 );
>
> SellPrice = Ref(HiPrc,-1);
> IIf(L < SellPrice AND H > SellPrice,Sell = 1,0);
>
>
>
>
> ------------------------------------
>
> **** 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
> (submissions sent via other channels won't be considered)
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>
> Yahoo! Groups Links
>
>
> atrader 發表於 14-11-6 10:35 static/image/common/back.gif
參考一下
Yahoo! Groups上buyprice不依help上的O,C的作法。
恩呀~ 這做法就是我在 8F裡寫的
Buy = (BuyPrice >= L);
Sell = (SellPrice <= H);
Short = (ShortPrice <= H);
Cover = (CoverPrice >= L);
我不確定這個問題是 BUG
或是個案
但我覺得
為了以防萬一
還是將買賣價設定在K線範圍的邏輯寫在買賣訊號中
不然就會像我再重新回測時
前後回測的結果差異大到你吐血崩潰
{:4_155:}
There is no bug. The bug is that you don't understand.
Exploration for example does not support portfolio level functionalities.
You can only use single security backtester function Equity() there in exploration. That one (as it's name says - "single security backtester") does not support newer portfolio level backtester functionalities and some backtest settings supported only for portfolio level. for example priceboundchecking is not supported by Equity() function. Equity() was introduced in 4.40. Priceboundchecking was introduced in 4.45. Simply check development log.
If you wanna be smarter than TJ then contact him. 本帖最後由 joshsmi 於 14-11-6 21:37 編輯
Here is some altered alternative apx file
頁:
1
[2]