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

RE: [amibroker] Basic backtest questions



PureBytes Links

Trading Reference Links

Problems 1 & 2 are handled by Amibroker automatically in the backtester.

Use this line of code:

SetOption("PriceBoundChecking",True); 

Note there are many other similar things that can/should be set in code.
Look up SetOptions in HELP.

As to question 3, set it up as a future. Then you can use TickSize to do
your calculations. You will also want to backtest futures so you get the
proper calculation on return using PointValue (just set it, the backtester
uses it properly).

SetOption("FuturesMode",True); //Also must check the Futures box in AA.

Finally, you can set BuyPrice, SellPrice, ShortPrice, CoverPrice according
to needs. For example, 

BuyPrice = Ref(H,-1) + TickSize; 
//you may need to do some rounding of your price using TickSize.
--
Terry

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of dralexchambers
Sent: Monday, January 29, 2007 07:46
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Basic backtest questions

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



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links





Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.12/655 - Release Date: 1/28/2007 1:12 PM