OK, so when I ran the above script exactly as you have it, I got this result:

BackTest: TradeTest_1 EUR/USD 2013
[1: Wed 02.01. 04:09] 1.32728
Lots 10, Stop 0.0010, PIPCost 0.0760, Risk 9.42
[EUR/USD::S0101] Short 10@1.3269 Risk 9 at 04:09

[2: Wed 02.01. 04:10] 0p 1/0
[EUR/USD::S0101] Cover 10@1.3264: +1.20 at 04:10

[3: Wed 02.01. 04:11] 16p 1/0
Lots 10, Stop 0.0010, PIPCost 0.0760, Risk 9.42
[EUR/USD::S0302] Short 10@1.3271 Risk 9 at 04:11

[4: Wed 02.01. 04:12] 16p 1/1
[EUR/USD::S0302] Cover 10@1.3275: -4.86 at 04:12

[5: Wed 02.01. 04:13] -48p 1/1
Lots 10, Stop 0.0010, PIPCost 0.0760, Risk 9.42
[EUR/USD::S0503] Short 10@1.3274 Risk 9 at 04:13

The displayed risk matches the manually calculated risk.

Then I ran the script with this code, using an ATR stop like in my strategy:

function run()
{
BarPeriod = 1;
LookBack = 0;
NumYears = 1;
set(LOGFILE);

Lots = 10;
Stop = 10*ATR(20);
TakeProfit = 10*ATR(20);

if(NumOpenTotal > 0) {
exitLong();
exitShort();
} else {
printf("\nLots %.0f, Stop %.4f, PIPCost %.4f, Risk %.2f",
Lots, Stop, PIPCost, Lots*(Stop+Spread)/PIP*PIPCost);
if(random() > 0)
enterLong();
else
enterShort();
}
}

I got this result:

BackTest: TradeTest_2 EUR/USD 2013
[1: Wed 02.01. 04:09] 1.32728
Lots 10, Stop 0.0000, PIPCost 0.0760, Risk 1.82
[61: Wed 02.01. 05:09] 1.32658
Lots 10, Stop 0.0000, PIPCost 0.0760, Risk 1.82
[EUR/USD::S6101] Short 10@1.3267 Risk 103 at 05:09

[62: Wed 02.01. 05:10] 0p 0/1
[EUR/USD::S6101] Cover 10@1.3265: -0.46 at 05:10

[63: Wed 02.01. 05:11] -6p 0/1
Lots 10, Stop 0.0000, PIPCost 0.0760, Risk 1.82
[EUR/USD::L6302] Long 10@1.3267 Risk 103 at 05:11

[64: Wed 02.01. 05:12] -6p 0/2
[EUR/USD::L6302] Sell 10@1.3269: -0.68 at 05:12

[65: Wed 02.01. 05:13] -15p 0/2
Lots 10, Stop 0.0000, PIPCost 0.0760, Risk 1.82
[EUR/USD::L6503] Long 10@1.3269 Risk 103 at 05:13

[66: Wed 02.01. 05:14] -15p 0/3
[EUR/USD::L6503] Sell 10@1.3269: -1.75 at 05:14

[67: Wed 02.01. 05:15] -38p 0/3
Lots 10, Stop 0.0000, PIPCost 0.0760, Risk 1.82
[EUR/USD::L6704] Long 10@1.3268 Risk 103 at 05:15

Here the manually calculated risk does not match the displayed risk.

Then I traded the first script. Attached is a screenshot showing Zorro and MT4 (TestScript1). Here you can see that the manually calculated risk - 12.00 - and displayed risk - 12 -match and that MT4 opened the trade with the correct risk - 12 pips + spread.

Then I traded the second script with the ATR stop and profit. As with the test, the attached screenshot (TestScript2_10*ATR) again shows a mismatch between the manually calculated risk - 2.0 - and the displayed risk - 138 - and MT4 has the stop 2,718 pips away.

I then traded this script with Stop = 1*ATR(20) and TakeProfit = 1*ATR(20). The attached screenshot (TestScript2_1*ATR) shows a similar mismatch as with 10*ATR above, and MT4 again placed the stop 2,700 pips away.

Finally I traded the 1*ATR script on a FXCM mini account (as opposed to micro account). The attached screenshot (TestScript2_1*ATR_FXCM) agains shows the same discrepancy between the manually calculated risk - 17.0 - and the displayed risk - 1,375 (although in this case both are a factor of 10 greater because of trading a full standard lot). FXCM trade station didn't indicate any stop loss.

As one final test, I traded the same script on a FXCM MT4 micro account. The attached screenshot (TestScript2_1*ATR_FXCM_MT4) shows the same discrepancy, but the platform doesn't show a stop.

Hope this helps. And once again, many thanks!

Attached Files TestScript1.pngTestScript2_10*ATR.pngTestScript2_1*ATR.pngTestScript2_1*ATR_FXCM.pngTestScript2_1*ATR_FXCM_MT4.png