Zorro calculated correctly the value I wanted during backtest.
However, in the middle of the backtest (after years of daily data), Zorro suddenly seem to gives the wrong value. I tried running the backtest several times, but Zorro always gives the wrong value starting from the same date.
Here is the code:
printf("#\ntotalLots: %i", totalLots);
printf("#\nMultiplier: %i", Multiplier);
printf("#\nPrice: %.8f", Prices[0]);
var CurrentExposure = totalLots*Multiplier*Prices[0];
Log result:
[6351: Mon 14-06-30 15:40] 137988181 +7744915 10410/7546
Asset: JPYUSDeod
totalLots: 171
Multiplier: 12500000
Price: 0.00987120
CurrentExposure = 21099689.4
[6352: Tue 14-07-01 15:40] 138542189 +8123764 10413/7547
Asset: JPYUSDeod
totalLots: 171
Multiplier: 12500000
Price: 0.00984730
CurrentExposure = 21048604.0
[6353: Wed 14-07-02 15:40] 137908707 +7468570 10409/7555
Asset: JPYUSDeod
totalLots: 190
Multiplier: 12500000
Price: 0.00982590
CurrentExposure = -18865407.0
[6354: Thu 14-07-03 15:40] 137791508 +7353988 10405/7562
Asset: JPYUSDeod
totalLots: 194
Multiplier: 12500000
Price: 0.00978450
CurrentExposure = -18296695.2
As you can see, after running years of daily data, Zorro seems to suddenly give the wrong "CurrentExposure" value starting from 2014-07-02, by turning into negative all of the sudden. The previous values before this date are all correct.
Not sure why it went wrong here.