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

 
Artyom Trishkin:

What is this?

What time do you take in the loop? What is TimeCurrent() ?

The current time.

 
lil_lil:

Current time

Why do you need the current time in the indicator? What will you compare with it?

 
Alexey Viktorov:

I recently came across a freelance order with a similar task. Isn't that the job you do?

Not doing freelance, not enough time to code my own ideas)

 
lil_lil:

I compare the time from variable "t_b" plus 60 seconds with the current time

if it is more than 60 seconds, I record new time and price

further, if the price has changed by 30 for less than 60 seconds, put an arrow

but there is no arrow even though the condition is fulfilled.

Where do you place the arrow? At which bar?

 
Artyom Trishkin:

Where do you put the arrow? Which bar?

On the current

 
lil_lil:

For the current

Why do you need a cycle then?

for(int i=limit; i>=0; i--)
  {
   datetime t_=TimeCurrent();
   if(t_>t_b+60)
     {
      t_b = TimeCurrent();
      pr_b=close[0];
     }
   if(MathAbs(close[0]-pr_b)>=30*Point && t_<t_b+60)
     {
      BufferUP[i]=low[i]-10*Point;
     }
  }
 
Artyom Trishkin:

Why do you need a loop then?

This is one of the conditions, there will be some that need to be checked in the loop as well. Or can this condition be checked after the loop?

 
lil_lil:

This is one of the conditions, there will also be those that need to be checked in the loop. Or can this condition be checked behind the loop?

Is there anything here that bothers you? It is inside the loop.

if(MathAbs(close[0]-pr_b)>=30*Point && t_<t_b+60)
  {
   BufferUP[i]=low[i]-10*Point;
  }

Can you read in words what you have here?

 
Artyom Trishkin:

Aren't you worried about anything here? It is inside the loop.

Can you read in words what you have here?

If the difference between the current price and the variable price is greater than or equal to 30 pips and the time elapsed since t_b - the last recorded time - is less than 60 sec, I place an arrow. In this case close[0] and close[i] are the same

What's wrong?

 
lil_lil:

If the difference between the current price and the variable price is greater than or equal to 30 pips and the time elapsed since t_b - the last recorded time - is less than 60 sec, I place an arrow. In this case close[0] and close[i] are the same

What is wrong?

Where do you put the arrow?

Reason: