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....


Reply via email to