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

Re: [amibroker] Re: Simple slippage implemented in CBT generates COM error



PureBytes Links

Trading Reference Links

Tomasz Janeczko wrote:
You don't need custom backtester to do such things.
BuyPrice = BuyPrice + Slippage:
SellPrice = SellPrice - Slippage;
CoverPrice = CoverPrice + Slippage:
ShortPrice = ShortPrice - Slippage.
 
When using ApplyStop make sure to switch "ExitAtStop" argument to false
and it will use prices defined above.

Best regards,
Tomasz Janeczko
amibroker.com
Hello Tomasz,

I'm not sure that applies to the following scenario (for simplicity we lets not consider slippage):

Trading conditions:
Price = (bid+ ask)/2
tickSize = 0.1
Spread  = 2 * ticksize
commissions = 0


system rules:
Buy on  bar Close;
takeProfit = 2 * ticksize = 0.2;
stopLoss = 100 * ticksize = 10;


trade entry:

Close Price= 100;
buyprice = close + 0.5*spread = 100.01;



trade exit:

Check Bid prices next bar for an exit


Convert  High and Low to bid prices:

High = 100.03
Low = 99.81   
BidHigh = 100.03 - 0.5 * spread  = 100.02
BidLow = 99.81 - 0.5 * spread = 99.80

check if stopLoss is hit:
buyPrice - bidLow < stopLoss (stop not Hit)

check if profit target is hit:
bidHigh - buyprice  = 100.02 - 100.01 = 0.1 (take profit not hit either)

Continue checking  the same way  the rest of the bars....




__._,_.___


**** 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
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___