Several values calculated (at 6a or 5a decimal) in standard function by expert mt5 and manual calculation in same expert optimization tester

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.

You used NormalizeDouble, It's use is usually wrong, as it is in your case.

Floating point has an infinite number of decimals, it's you were not understanding floating point and that some numbers can't be represented exactly. (like 1/10.)
Doubleprecision floatingpoint format  Wikipedia, the free encyclopediaSee also The == operand.  MQL4 programming forum (2013)

Print out your values to the precision you want with DoubleToString  Conversion Functions  MQL4 Reference.

SL/TP (stops) need to be normalized to tick size (not Point) — code fails on noncurrencies.
On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql?  MQL4 programming forum (2011)And abide by the limits Requirements and Limitations in Making Trades  Appendixes  MQL4 Tutorial and that requires understanding floating point equality Can price != price ?  MQL4 programming forum (2012)

Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on noncurrencies. So do it right.
Trailing Bar Entry EA  MQL4 programming forum (2013)
Bid/Ask: (No Need) to use NormalizeDouble in OrderSend  MQL4 programming forum (2012) 
Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
(MT4 2013)) (MT5 2022)) 
MathRound() and NormalizeDouble() are rounding in a different way. Make it explicit.
MT4:NormalizeDouble  MQL5 programming forum (2017)
How to Normalize  Expert Advisors and Automated Trading  MQL5 programming forum (2017) 
Prices you get from the terminal are already correct (normalized).

PIP, Point, or Tick are all different in general.
What is a TICK?  MQL4 programming forum (2014)


Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.

You used NormalizeDouble, It's use is usually wrong, as it is in your case.

Floating point has an infinite number of decimals, it's you were not understanding floating point and that some numbers can't be represented exactly. (like 1/10.)
Doubleprecision floatingpoint format  Wikipedia, the free encyclopediaSee also The == operand.  MQL4 programming forum (2013)

Print out your values to the precision you want with DoubleToString  Conversion Functions  MQL4 Reference.

SL/TP (stops) need to be normalized to tick size (not Point) — code fails on noncurrencies.
On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql?  MQL4 programming forum (2011)And abide by the limits Requirements and Limitations in Making Trades  Appendixes  MQL4 Tutorial and that requires understanding floating point equality Can price != price ?  MQL4 programming forum (2012)

Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on noncurrencies. So do it right.
Trailing Bar Entry EA  MQL4 programming forum (2013)
Bid/Ask: (No Need) to use NormalizeDouble in OrderSend  MQL4 programming forum (2012) 
Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
(MT4 2013)) (MT5 2022)) 
MathRound() and NormalizeDouble() are rounding in a different way. Make it explicit.
MT4:NormalizeDouble  MQL5 programming forum (2017)
How to Normalize  Expert Advisors and Automated Trading  MQL5 programming forum (2017) 
Prices you get from the terminal are already correct (normalized).

PIP, Point, or Tick are all different in general.
What is a TICK?  MQL4 programming forum (2014)

dear William Roeder, THANKS FOR ALL YOUR INFOS! let me clarify my request, for your

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.

You used NormalizeDouble, It's use is usually wrong, as it is in your case.

Floating point has an infinite number of decimals, it's you were not understanding floating point and that some numbers can't be represented exactly. (like 1/10.)
Doubleprecision floatingpoint format  Wikipedia, the free encyclopediaSee also The == operand.  MQL4 programming forum (2013)

Print out your values to the precision you want with DoubleToString  Conversion Functions  MQL4 Reference.

MathRound() and NormalizeDouble() are rounding in a different way. Make it explicit.
MT4:NormalizeDouble  MQL5 programming forum (2017)
How to Normalize  Expert Advisors and Automated Trading  MQL5 programming forum (2017) 
Prices you get from the terminal are already correct (normalized).

I realized that using normalizedouble as well as being wrong is also superfluous,
so I removed from the code, let me explain and you why I thought about using it.
checking values on chart and MT5console about iCCI vs Custom CCI (rename in CCIx but downloaded from https://www.mql5.com/it/code/18) and extrapolated only the calculation code of the indicator (so myCCI is the same code of Custom CCIx)
I get exact and equal values if I use OHLC standard prices and similar for Median prices, but very different values if I use Typical and Weighted prices, this is very strange because then if I apply an AMA like smooth for example, only for Typical and Weighted different values are not acceptable
NB: if i in the values obtained with 2 decimal digits the differences are not noticed and using Typical and Weighted prices some different value comes out at the second decimal of a 0.01 but then applying a smooth the values diverge more from 5dec
I find this problem for other indicators such as MOM, BBANDS or ATR, so I think that the problem is in the calculation of the indicator values between the iCCI and CCI function call as Custom, or in the calculation of the average values for SMA(example) of the standard libraries of mt5, because my code doesn't change,
the prices used to test the different call indicator mode are the same downloaded from Dukascopy and imported as custom symbol timeframe M1.
resuming:
 the price's base data for calculating the indicators is the same (from Dukascopy and imported like Custom symbol) I don't use broker or terminal data for this operativity
 if I use OHLC prices the calculated values are equal (indicator and smooth)
 using Median, Typical and Weighted the values are different
in the file there is the explosion of the calculated values up to 50 decimal digits but the problem is already encountered before,
in attached file (I put some minus char "" to the decimal place where values begin different) these differences then produce evident differences in the calculated values of a smooth (example AMA) applied to the iCCI indicator for example
so my question was:
how the values of the indicators called via the iCCI example function and drawn on the chart (in the platform data window) are calculated
respect to a Custom CCI, because in my opinion there are some rounding or formatting problems upstream, Or I don't understand what they do
so what does they do?
I ask you if anyone knows how the values are obtained which then result in the handle of the indicator called as an iCCI or iMOM or iAMA function compared calling them as Custom indicators but using the official metaquotes code, or if someone understands the problem
I hope I was clearer now, there are many competent people here, like you William and I'am a senior software engineer and I check this many times my code before asking for support
thanks for support
 2018.08.03
 www.mql5.com
 Free trading apps
 Over 8,000 signals for copying
 Economic news for exploring financial markets
You agree to website policy and terms of use
hey guys
1) I downloaded the Dukascopy prices from Tickstory (O,H,L,C,Median,Typical, Weighted) and imported them into custom symbol M1 in MT5
2) I call any standard indicator and hook its expert advisor handle, for example Momentum
... MOMhandle = iMomentum(NULL,0,MOMperiod,MOMprice); ...
3) lanch EA optimization with single tester based on custom symbol data (point 1)
4) in the same expert i calculate manually calculate the Typical and Weighed values
with formulas and i put on arrays
Typical = (High+Low+Close)/3
Weighting = (High+Low+Close+Close)/4
at its formula I apply this formatting: DoubleToString(NormalizeDouble(value,16),6)
So I get different values (often to the 6th decimal place, in several cases also to the 5th decimal place), from those shown on the chart (which are calculated by the indicator called iMomemtum example)
PLEASE NOTE: this problem only occurs with Typical or Weighted prices
then the doubt bring the question, how are the values of the Typical and Weighted prices that are displayed on Data Windows (with call indicator function) of MT5 CTRL+D calculated and how those are formatted? (6 decimals)
I hope I was clear
please support, thanks & regards