Grant,
That's quite a chunk of code! Thanks. I was just about to post some
Forex backtesting questions exactly on this subject and lo and behold...
It will take me some time to decipher your code, but a few basic
questions in the interim:
(a)
You use SetOption("AccountMargin", 100) but then set up a leverage
paramater: leverage = Param("Leverage rate", 50, 1, 100, 1); Don't these
lines contradict one another? A leverage rate of 50, for example, means
the Account Margin is 2.
(b)
Does your entire chunk of code go above a trading system? Or do I insert
my trading system just before your BarCount loop?
(c)
The broker I'm setting up with is IB. Are the default values in your
code appropriate for IB?