Basic backtest questions

#1
Hi,

I am putting together a backtesting framework and have become a
little stuck. If anyone could help it would be great.


1. How do I code for open gaps (ie. place buy order. The entry bar
gaps up through this buy order price, so the actual entry price is
not the one originally specified, but the open of the bar that gaps
up)


2. How do I code for gap downs through a stop loss (ie. I place a
stop loss order, but the price of the bar that triggers the stop loss
opens below the stop loss. Therefore I would be stopped out at the
new open price)


3. How do I tell the backtester to simulate spread betting (I live in
the UK). I will explain it here:

- Spread betting is betting x per point (or pip) of movement.
- I risk 5% of my total capital on any one trade
- Therefore the calculations are as follows (an example):

Buy Price = 1.9000
Initial Stop Loss = 1.8950
Risk = 50 pips
Capital = 20000
5% risk per trade = 20000 * 5% = 1000 to risk on this trade
Price to bet per point: 1000 / 50 points = 20 per pips

Thanks!
Alex
 

Similar threads