|
2 registered members (TipmyPip, Quad),
2,921
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Z12 live performance
[Re: alx]
#489484
06/19/26 08:07
06/19/26 08:07
|
Joined: Dec 2017
Posts: 21
vince
Newbie
|
Newbie
Joined: Dec 2017
Posts: 21
|
Hi, I can confirm that Z12 had no luck with XAU/USD and US30 in the last months. Forex, NAS100 and GER30 were positive for me, but starting about one month earlier, though. About wrong calculations of several values for indices and gold: I had to fix PIPCost, LotAmount and Swap in Zorro.mq4 to align with my broker. Not sure if that applies to other brokers, too, but maybe it helps. Here is my patch for Zorro.mq4 in "int run(int mode)" at "case CMD_ASSET":
--- Zorro.mq4 2024-05-02 13:04:58.000000000 +0200
+++ ZorroFixed.mq4 2026-06-19 09:41:19.866954700 +0200
@@ -354,7 +354,11 @@
if(TickSize == 0) TickSize = MarketInfo(Asset,MODE_POINT);
if(TickSize == 0) TickSize = 1;
arr[4] = PIPCost = MarketInfo(Asset,MODE_POINT) / TickSize * MarketInfo(Asset,MODE_TICKVALUE) * LotFactor * Factor; // pipcost
- arr[5] = LotAmount = MarketInfo(Asset,MODE_LOTSIZE) * LotFactor;
+ LotAmount = LotFactor;
+ const bool isForex = ((int)MarketInfo(Asset, MODE_MARGINCALCMODE) == 0);
+ if (isForex)
+ LotAmount *= MarketInfo(Asset,MODE_LOTSIZE);
+ arr[5] = LotAmount;
#ifdef OUTLIERTEST
if(LotAmount == 0. && arr[0] > 0.)
Print(Asset," Lot ",MarketInfo(Asset,MODE_LOTSIZE)," Min ",LotFactor);
@@ -362,10 +366,24 @@
arr[6] = MarketInfo(Asset,MODE_MARGINREQUIRED) * LotFactor; // margin
arr[7] = MarketInfo(Asset,MODE_SWAPLONG);
arr[8] = MarketInfo(Asset,MODE_SWAPSHORT);
- if(MarketInfo(Asset,MODE_SWAPTYPE) == 0.) {
- arr[7] *= arr[4];
- arr[8] *= arr[4];
- }
+ const int swapType = (int)MarketInfo(Asset,MODE_SWAPTYPE);
+ if(swapType == 0) { // points
+ // e.g. Forex and Gold
+ arr[7] *= arr[4]/*PIPCost*/;
+ arr[8] *= arr[4]/*PIPCost*/;
+ } else if(swapType == 2) { // interest
+ // e.g. CFDs like US30, GER30, ...
+ arr[7] *= arr[0]/*price*/ * LotFactor / (365.0/*days*/ * 100.0/*percent*/);
+ arr[8] *= arr[0]/*price*/ * LotFactor / (365.0/*days*/ * 100.0/*percent*/);
+ if (StringCompare(StringSubstr(Asset, 0, MathMin(3, StringLen(Asset))), "Ger", false) != 0) {
+ const double eurUsdRate = MarketInfo("EURUSD", MODE_ASK);
+ arr[7] /= eurUsdRate;
+ arr[8] /= eurUsdRate;
+ // MarketInfo(Asset,MODE_TICKVALUE) should be "Tick value in the deposit currency" according to the MQL4 Reference.
+ // But apparently this is not the case for CFDs, so we have to adjust to Euro:
+ arr[4] = PIPCost = PIPCost / eurUsdRate;
+ }
+ }
arr[9] = iVolume(Asset,PERIOD_M15,0)/15.;
respond(cmd,arr);
break;
My account currency is Euro so you have to adjust the calculations regarding "eurUsdRate" if your account currency is different. Probably the 'if "Ger"' also needs attention (no conversion for GER30 needed for me as GER30 is in Euro). That part should be something like this I guess with <ACCOUNTCURRENCY> to be replaced with your currency:
double currencyConversion = MarketInfo("<ACCOUNTCURRENCY>USD", MODE_ASK);
if (StringCompare(StringSubstr(Asset, 0, MathMin(3, StringLen(Asset))), "Ger", false) != 0)
currencyConversion = MarketInfo("<ACCOUNTCURRENCY>EUR", MODE_ASK);
arr[7] /= currencyConversion;
arr[8] /= currencyConversion;
// MarketInfo(Asset,MODE_TICKVALUE) should be "Tick value in the deposit currency" according to the MQL4 Reference.
// But apparently this is not the case for CFDs, so we have to adjust to <ACCOUNTCURRENCY>:
arr[4] = PIPCost = PIPCost / currencyConversion;
|
|
|
|