[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 670

 
artmedia70:

What is the probability of a new tick arriving before all the current EA calculations are completed? It seems to me that only in this case will the data become old and irrelevant.

i checked how long your code counts - i too, just recently had my doubts, is MT4 calculation speed enough for my EA, it turned out it is enough for now, my code takes about 18 ms, i.e. in 1 second you are checked 55 times, ticks come from 10 to 70 per minute, if more than 50 ticks per minute, it means there is a candle

try to see how your code works, like this

int tik,barM1


int init(){
   barM1  = Bars;
   tik = 0;

return (0);
}


//_______________________________________________________
//  это добавить в start()
//_______________________________________________________
int start=GetTickCount();
 

 // некие серьёзные вычисления...


tik++;
Print("Время вычисления ", GetTickCount()-start, " миллисекунд.");

int counted  = Bars;
if (counted != barM1) {
print("за один бар было принято ",tik, "тиков" )
tik=0;
barM1=counted;
}

here's the indicator that counts the ticks - for the reconciliation

Well, if you have an opening price, sorry I missed it

OpnPrice =iOpen(NULL,PERIOD_M5,0); you can change only at a closed bar - the code above with the condition if (counted != barM1) {

Files:
 

How to change the number of digits after the decimal point of indicator iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0) when calculating in the expert body? The result is displayed with 4 (i.e. 0.0001), while it should be displayed with 5 (e.g. 0.00012) for accurate analysis. And the MT4 terminal displays 5-digit values in the indicator window on the chart.

 
The NormalizeDouble() operator will solve your problems.
 
Roger:
The NormalizeDouble() operator will solve your problems.


I.e., NormalizeDouble(iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0),5) will result in the desired 0.00012 ?

P.S. Added and tested - nothing. The output is just 0.00010, which is the same 4 bits...

 

No, not quite right, Roger.

IndicatorDigits() see Boris. But it must be inserted in the indicator itself, because it will refer to it, not to the EA.

P.S. Another thing: this function is suitable only to the indicator for which you have the code. Then it will be possible to call it using iCustom().

And for those that are called "standard" like iMACD(), I don't know the right solution.

 
pathfinder1:

So, the result of NormalizeDouble(iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0),5) will be the desired 0.00000 ?

Yes, that's right. The key phrase was in the calculation in the body of the EA? And apparently with the standard indicator this is impossible (((
 
pathfinder1:

How to change the number of digits after the decimal point of indicator iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0) when calculating in the expert body? The result is displayed with 4 (i.e. 0.0001), while it should be displayed with 5 (e.g. 0.00012) for accurate analysis. And the MT4 terminal displays 5-digit values in the indicator window on the chart.

You should not change anything, the accuracy in the standard indicators is set to maximum (up to 8 digits), you made a wrong conclusion about the data output accuracy because Print() outputs up to 4 digits by default, in calculations (in the gut of Expert Advisors for example) the maximum accuracy is used, you need to output double through DoubleToStr() as an example:

Print("iMACD ", DoubleToStr(iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0), 8));

and we get this output:

 
ToLik_SRGV:

You don't need to change anything, in standard indicators the accuracy is set to maximum (up to 8 digits), you made a wrong conclusion about the data output accuracy because Print() outputs up to 4 digits by default, in calculations (in the gut of Expert Advisors for example) maximum accuracy is used, to see this you need to output double via DoubleToStr(), as an example:

and we get such an output:


Right, right, right ! ! ! Anatoly - great kudos, I was getting hung up on that.

The truth of life is "one head is good, but two is better" (quote)

 
ToLik_SRGV:

No need to change anything, the standard indicators are set to maximum accuracy (up to 8 digits)


That's right, I had the same suspicion :)
 
As has often been the case - the truth is on the surface)) I admit my fault.
Reason: