Backtesting for hedged accounts
Backtesting for hedged accounts
27 Mar 2014, 23:23
Hello.
Are there a way to backtest the robot which assumes that it can open several individual positions for the symbol?
In cBroker, the account has the type of "Hedging".
When I try to backtest such a robot, backtesting engine just merges opened positions into one.
Replies
AlexanderRC
01 Apr 2014, 04:25
RE:
That code works as intended. I even modified it to open 3 distinct Buy orders in 3 consequtive OnBar() invocations. The positions are distinct both for netted and hedged demo accounts.
The problem with me thinking that position was merged was that the line for long running position was above or below on the backtesting chart. When I clicked on the Graph tab, i only saw one the line for one position (instead of several lines for several positions) because the local chart quotes around the clicked position did not cross the lines of other positions which were hidden as they were off chart due radically different open and close prices.
@AlexanderRC
Spotware
28 Mar 2014, 10:14
There is no netting functionality in backtesting. Probably you have a mistake in code of your cBot.
Try to backtest the following cBot and you will see that positions are not merged:
@Spotware