There are some things I cannot comprehend. For searching reasons of lost trades I added this line to the simple broker arbitrage example before any enterX() or exitX() command:
Code:
print(TO_LOG, "\nPriceA: %.0f, PriceB: %.0f, Difference: %.0f", PriceA, PriceB, Difference);


Setting slippage = 0 I expected the logged prices to be the same as the traded ones but:
Code:
[4: Tue 18-01-02 04:00:00] 66.73 0 1/3  (13605.60)

PriceA: 13069, PriceB: 13412, Difference: -343
[Asset_A::L0501] Long 100@13069.00000  at 04:00:00
[Asset_B::S0502] Short 1@13204.59961  at 04:00:00

[5: Tue 18-01-02 05:00:00] 66.73 -155 1/5  (13412.70)
[6: Tue 18-01-02 06:00:00] 66.73 -131 1/5  (13197.10)

PriceA: 13294, PriceB: 13231, Difference: 62
[Asset_A::L0501] Sell 100@13294.00: +162 at 06:00:00
[Asset_B::S0502] Cover 1@13431.50: -283 at 06:00:00


While the logged PriceAs are the same at long entry and sell exit, the differences of logged PriceBs to its short entry is 208 and to its cover exit -200.
The deviation is so extreme that the exit condition is simply not met because PriceA (13294) minus 'traded' PriceB (13431) is -137 and therefore still lower than 0. So the negative result is no surprise.
Any hint where those deviations can result from?