Normalize price tick size

 
Hi guys, I need some help on normalizing prices.
I use broker A that has an ECN and CENTS account
Using my EA on the ECN account and normalizing the prices to Symbol XAUUSD works just fine.
However, when using the same EA on the CENTS account, I get error 4107.
When I print the TICKSIZE it makes me the value 0.001 on the CENTS account and 0.01 on the ECN account.
Why is there this difference in TICKSIZE?
And for a case of TICKSIZE being smaller than the number of decimals in SYMBOL XAUUSD, as happen in the CENTS account, the best method is to use POINTS to normalize the price?

Here's the formula I use to normalize


double  tickSize = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE); //Ticke size to normalize in a correct way
priceTarget = MathRound(priceTarget/tickSize )*tickSize ; //  return normal price normalize in corret way

Thanks

 

yes tick size is a number expressed in the unit called ''_POINT"  and the tick size is the minimal price jump allowed by the broker for the asset. So the tick size varies from brokers to brokers and given a broker, from his assets to assets. Same thing for his unit ''_POINT".


so to know everything about an asset of a broker, first run their script here https://docs.mql4.com/constants/environment_state/marketinfoconstants


for the normalization, I do

double  tickSize = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE); //Ticke size to normalize in a correct way

MathRound(NUMBER_TO_NORMLIZE*1.0/tickSize)*tickSize

this outputs a double. you have to check that

1.0/tickSize

gives really the inverse of the ticksize, because inverting a double is always risky. If does not give the right answer, you have to use MathCeil(1.0/SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE)).

Symbol Properties - Environment State - Constants, Enumerations and Structures - MQL4 Reference
Symbol Properties - Environment State - Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
Symbol Properties - Environment State - Constants, Enumerations and Structures - MQL4 Reference
Reason: