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

[amibroker] Using AFL to change the Equity() in a backtest



PureBytes Links

Trading Reference Links

Hi,

I'm writing a backtest AFL that does SpreadBetting on the FOREX.

The spreadbet company deducts (or adds to - depending on the security
and interest rate) money at the end of each day from your account for
each day the trade rolls over to the next day.

How do I do this in AFL? - I need the following:

1. After each trade has concluded (ie. sold if long), I multiply the
number of days between the buy and sell bars by a value - say X.

(Please note - it is important to make sure the number of bars
between buy and sell are counted in days and not mins or hrs - as I
may be running this AFL on intraday data also).

2. I then deduct X from the current equity value after each trade.

It is important to ensure Step 2 occurs immediately after each trade
has concluded, as gains/loses from my overall equity will affect
position sizing on future trades.

Most grateful!
Alex


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 2/12/2007 1:23 PM