I read the manual pages about Virtual Hedging, Phantom, enterLong/Short, and the guide to reading the trade log.
http://zorro-trader.com/manual/en/hedge.htmhttp://zorro-trader.com/manual/en/lots.htm#phantomhttp://zorro-trader.com/manual/en/buylong.htmhttp://zorro-trader.com/manual/en/trading.htmThis is an awesome feature, by the way. I'm very excited by it.

I thought I had a good grasp on Virtual Hedging. But I'm seeing some behavior which surprises me. Can you please explain it?
Using
set(LOGFILE+TICKS);
Verbose = 2;
BarPeriod = 60;
Hedge = 4;
ExitTime = 2;
I try to enter two positions at a specific 2013 EUR/USD Hourly Bar [2604: Thu 06.06. 12:00]
enterLong(0, 1.312090, 0, 0.004361);
enterShort(0, 1.312090, 0, 0.002509);
Looking ahead for our reference, the next bar has the following characteristics:
OHLC[-1]: 1.312090 1.316780 1.309290 1.315180
O[-2]: 1.315180
I've chosen values for Entry and TakeProfit based on this advance knowledge, for demonstration purposes.
I expect that, at least in concept, two opposite positions will be entered at next bar's open (1.312090). The Long will exit when (1.312090 + 0.004361 = 1.316451) is reached. The Short will exit when (1.312090 - 0.002509 = 1.309581) is reached. I know these exit conditions will be met within the bar because I've peeked into the future, i.e., L_next=1.309290 < 1.309581 < 1.316451 < H_next=1.316780.
Instead, I find that the exit condition of the Short is not met within the bar. The simulator exits the position, unprofitably, at the start of the next bar (due to ExitTime=2) instead of @1.309581. This results in profit -3.39 at 13:00 instead of +2.23 at 12:32.
Here's the Trade Log:
[2604: Thu 06.06. 12:00] 1.31133-1.31111-1.31261-1.31209
{EUR/USD::l} Long 1@1.3121 Entry stop
{EUR/USD::l} Entry stop 1.3121 hit at 12:00
{EUR/USD::l0401} Long 1@1.3121 Risk 13 at 12:00
[EUR/USD::L0402] Long 1@1.3121 Risk 263 at 12:00
{EUR/USD::s} Short 1@1.3121 Entry stop
{EUR/USD::s} Entry stop 1.3121 hit at 12:00
{EUR/USD::s0403} Short 1@1.3121 Risk 13 at 12:00
[EUR/USD::L0402] Sell 1@1.3121: -0.18 at 12:00
{EUR/USD::l0401} Target 1@1.3165: +4.23 at 12:48
[EUR/USD::S0504] Short 1@1.3152 Risk 265 at 12:48
[2605: Thu 06.06. 13:00] -2p 0/2
{EUR/USD::s0403} Cover 1@1.3152: -3.39 at 13:00
[EUR/USD::S0504] Cover 1@1.3152: -0.20 at 13:00
Ignoring this problem for now, there is another confusing thing. Please draw your attention to the Net trades. Why do they both exit at their entry values? Why do the profits of the Phantom trades not sum to roughly the same as the profits of the Net trades? Let me group them by type to make it clearer:
Phantom Trades:
Long:
{EUR/USD::l} Entry stop 1.3121 hit at 12:00
{EUR/USD::l} Long 1@1.3121 Entry stop
{EUR/USD::l0401} Long 1@1.3121 Risk 13 at 12:00
{EUR/USD::l0401} Target 1@1.3165: +4.23 at 12:48
Short:
{EUR/USD::s} Entry stop 1.3121 hit at 12:00
{EUR/USD::s} Short 1@1.3121 Entry stop
{EUR/USD::s0403} Short 1@1.3121 Risk 13 at 12:00
{EUR/USD::s0403} Cover 1@1.3152: -3.39 at 13:00
Net Trades:
[EUR/USD::L0402] Long 1@1.3121 Risk 263 at 12:00
[EUR/USD::L0402] Sell 1@1.3121: -0.18 at 12:00
[EUR/USD::S0504] Short 1@1.3152 Risk 265 at 12:48
[EUR/USD::S0504] Cover 1@1.3152: -0.20 at 13:00
I would expect l0401 + s0403 ~= L0402 + S0504. It doesn't.
l0401 + s0403 = 0.84
L0402 + S0504 = -0.38
What am I missing?
Thanks for your time.