Zorro ver 4.50.

I am specifically referring to the extraction of parameters from the MT4 platform. Before posting here I did search for a concrete asset example but could not find one among the brokers I have access to these days. However, here it goes:

Athough not usually a problem with Forex assets, there can be assets where TickSize is other than one Point i.e. some brokers may only issue a new quote every N points where N can be 2, 4, 25, etc.

For this reason traditionally in the MT4 world:

PointCost = MarketInfo(Asset,MODE_POINT) * MarketInfo(Asset,MODE_TICKVALUE) / MarketInfo(Asset,MODE_TICKSIZE);

The ratio TICKVALUE/TICKSIZE scales TICKVALUE down to give us the true Value or Cost of one Point when TICKSIZE is greater than one Point.

This issue has gone unnoted for a long time because more frequently than not the missing parameters MarketInfo(Asset,MODE_POINT) / MarketInfo(Asset,MODE_TICKSIZE) = 1.0.

Your original expression in the Zorro EA will return a wrong PIPCost for every asset which has a TICKSIZE greater than one Point:

arr[4] = PIPCost = MarketInfo(Asset,MODE_TICKVALUE) * LotFactor * Factor; // pipcost

The corrected code could be:

arr[4] = PIPCost = MarketInfo(Asset,MODE_POINT) * (MarketInfo(Asset,MODE_TICKVALUE) / MarketInfo(Asset,MODE_TICKSIZE)) * LotFactor * Factor); // corrected pipcost

Simplifying (POINT * Factor) = PIP and adding protection against the dreaded, unpredictable, far too frequent MT4 "divide by zero" error, we have:

arr[4] = PIPCost = PIP * (MarketInfo(Asset,MODE_TICKVALUE) / MathMax(MarketInfo(Asset,MODE_TICKSIZE),1e-10)) * LotFactor; // true pipcost

I further notice that several parameters are calculated more than once in Zorro EA, including PIPCost, which is also calculated within the block #ifdef EXAMINE.

So I recommend corrections be applied to both places. Needless to say, ideally calculations would better be done only once right up front, as early as possible, then used severally as needed.

Addendum: Here are some examples of Metals and Commodities from two distinct brokers :

2022.08.03 19:36:16.871 TickSizeVsPoint EURUSD,H1: Of all assets examined 36 have TICKSIZE of one POINT
2022.08.03 19:36:16.871 TickSizeVsPoint EURUSD,H1: Ahah! Platinum: TickValue= 1.00000, Point= 0.01000, TickSize= 0.05000, correct PIPCost= 0.0020000000
2022.08.03 19:36:16.871 TickSizeVsPoint EURUSD,H1: Ahah! Palladium: TickValue= 1.00000, Point= 0.01000, TickSize= 0.05000, correct PIPCost= 0.0020000000
2022.08.03 19:36:16.871 TickSizeVsPoint EURUSD,H1: Broker: FBS Inc

2022.08.03 15:14:29.362 TickSizeVsPoint EURUSD,H1: Ahah! #QMV22: TickValue= 10.00000, Point= 0.00100, TickSize= 0.03000, correct PIPCost= 0.0333333333
2022.08.03 15:14:29.362 TickSizeVsPoint EURUSD,H1: Ahah! #QMU22: TickValue= 10.00000, Point= 0.00100, TickSize= 0.03000, correct PIPCost= 0.0333333333
2022.08.03 15:14:29.362 TickSizeVsPoint EURUSD,H1: Ahah! #QMQ22: TickValue= 10.00000, Point= 0.00100, TickSize= 0.03000, correct PIPCost= 0.0333333333
2022.08.03 15:14:29.362 TickSizeVsPoint EURUSD,H1: Ahah! #PLF: TickValue= 10.00000, Point= 0.10000, TickSize= 0.50000, correct PIPCost= 0.0200000000
2022.08.03 15:14:29.362 TickSizeVsPoint EURUSD,H1: Ahah! #PAF: TickValue= 10.00000, Point= 0.01000, TickSize= 0.50000, correct PIPCost= 0.0020000000
2022.08.03 15:14:29.362 TickSizeVsPoint EURUSD,H1: Ahah! SILVER: TickValue= 2.50000, Point= 0.00100, TickSize= 0.00500, correct PIPCost= 0.0500000000
2022.08.03 15:14:29.362 TickSizeVsPoint EURUSD,H1: Broker: InstaForex


Last edited by faustotex; 08/03/22 12:30.