|
參考一下
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
>
>
> |
|