Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 451

 
I added variables of int type, in which I put explicitly converted datetime, and it worked. But now I need the result of ratio to be lower than 1, i.e.
formula MathMin(Time1-Time2,Time2-Time3)/MathMax(Time1-Time2,Time2-Time3)
but it started giving 0 again, although separately it is correct
 
Roman Sharanov:
I added variables of int type, in which I put explicitly converted datetime, and it worked. But now I need the result of ratio to be lower than 1, i.e.
formula MathMin(Time1-Time2,Time2-Time3)/MathMax(Time1-Time2,Time2-Time3)
but it started giving 0 again, although separately it is correct
(double)MathMin(Time1-Time2,Time2-Time3)/(double)MathMax(Time1-Time2,Time2-Time3)
 
Roman Sharanov:

I wrote that I tried it that way already, nothing

the receiving variable must also be double

 
Great, now it gives 1 all the time
MathMin and MathMax give the same value even though their arguments are different
 
Roman Sharanov:

Please advise, how to find ratio of 2 timeframes? (we need the ratio of bars between 2 periods)
I wrote it like this but it gives 0. Time1>Time>Time3 always

I tried both without explicit type conversion, and (double) tried to write

And with an example you can explain what is on the input and what should be on the output. I have already reread all tips and questions several times, but I still can't understand where we start from and what we should come to.

For example this code

#define  PRINT(A) ::Print(#A + " = " + (string)(A));
/********************Script program start function*******************/
void OnStart()
{
 datetime t1 = TimeCurrent(), t2 = TimeCurrent()-PeriodSeconds(PERIOD_M1)*7, t3 = TimeCurrent()-PeriodSeconds(PERIOD_M15);
 PRINT(t1-t2);
 PRINT(t1-t3);
 PRINT(double(t1-t2)/double(t1-t3));
 PRINT((t1-t2)/double(t1-t3));
 PRINT(double(t1-t2)/(t1-t3));
}/*******************************************************************/

gives this result

2018.02.04 15:41:35.922 00 EURUSD,H1: double(t1-t2)/(t1-t3) = 0.46666667
2018.02.04 15:41:35.922 00 EURUSD,H1: (t1-t2)/double(t1-t3) = 0.46666667
2018.02.04 15:41:35.922 00 EURUSD,H1: double(t1-t2)/double(t1-t3) = 0.46666667
2018.02.04 15:41:35.922 00 EURUSD,H1: t1-t3 = 900
2018.02.04 15:41:35.922 00 EURUSD,H1: t1-t2 = 420
 
Alexey Viktorov:

And with an example, can you explain what the input is and what the output should be. I have already read all the advice and questions several times, but I still don't understand what we are starting from and what we should come to.

For example this code

gives this result

Yes, except it gives 0 or 1, but I solved it with an if else condition, but at least it works

 
Roman Sharanov:

Yes, except that it gives 0 or 1, but I solved it with an if else condition, but at least it works

It says it should output result like double

and here

And even after my example.... the words are not enough.

What does it have to do with if else??? This is a conditional operator and does not depend in any way on the type of values in the conditions.

It can only make 1 if numerator and denominator are equal. But it can NEVER be 0.

 

Good day to you all.

Can you please tell me how to get rid of the huge

of metaeditors in the computer.

I have 7 terminals installed and each one is dragging a meta-editor with it.

7.0 is going crazy when you try to open an mq file from the context menu

It opens them in different metaeditors periodically which makes me feel very uncomfortable.

Maybe someone knows how to solve this problem?

Would like to have only 1 configured meta editor.

Thanks in advance.

 
Northwest:

Good day to you all.

Can you please tell me how to get rid of the huge

of metaeditors in the computer.

I have 7 terminals installed and each one is dragging a meta-editor with it.

7.0 is going crazy when you try to open an mq file from the context menu

it periodically opens them in different meta-editors, which makes it emotionally unpleasant.

May someone know how to solve this problem?

I would like to have only 1 configured meta editor.

Thanks in advance.

I solved this problem for me with"symbolic link/label" to MQL folder. As such, I took the main folder out of the program directory, created a shortcut to it and deleted these directories, replacing them with a shortcut. Now I have the same set of Expert Advisors/indicators/scripts in any terminal. And Opening any maetaditor leads to the same files.

Of course, the main directories are different for MQL4/5.

 
Konstantin Nikitin:

I solved this problem with a"symbolic link/label" to the MQL folder. As such, I took the main folder out of the program directory, created a shortcut to it and deleted these directories, replacing them with a shortcut. Now I have the same set of Expert Advisors/indicators/scripts in any terminal. And Opening any maetaditor leads to the same files.

Of course, main directories are different for MQL4/5.

Thanks for the advice.

But it would be desirable for me to see only "my EAs and indicators" in different terminals.

In other words, MQL folders must be "their own".

This suggests the brute force method. I should pluck meta-editor files from the installed distributions.

Leave only one of them. And then use registry cleaner to remove paths to non-existing files.

But I don't know if it will work or not. I would like it to be without consequences.

Reason: