[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 414

 
OlegArH:

Good afternoon, folks!

I am messing around with my first robot. My idea is to open a pending order with a set expiry time.

I do not have enough knowledge to implement it.

If you don't mind, could you please describe the example of EA which, if I compile it, just opens one by one, e.g. BuyStop for 100 min at 50 points from the current price SL=50, TP=100 for eur/usd at any timeframe.

Thank you in advance!

another example
Files:
temp_3.mq4  4 kb
 
It's not working, it's just hanging there.
 
emotraid:
It's not working, just hangs there.

)

optimize it.

;)

 
costy_:

I thought it was pretty clear.


Thank you! [Laughs]
 
costy_:
another example
Thank you very much!!!
 

Please explain about operator return(-1); called in the body of function start() - what does it give?

Is return(0); the same thing or not? It seems that the result is not passed anywhere.

Why do they write it in such a way in this case?

int start()
  {
  if(a == b)return(-1);
  
  return(0);
  }
 
fore-x:

Please explain about operator return(-1); called in the body of function start() - what does it give?

Is return(0); the same thing or not? The result does not seem to be passed anywhere.

Why do they write it that way?

Write void start()

and return is unnecessary ))

I don't know why!

 
costy_:
I have a feeling you won't figure it out on your own.

How do I get all the conditions to be checked in order: first condition_1, then condition_2, and only then condition_3, and not like that (which condition coincided, that was not fulfilled in order)? And when all the conditions are fulfilled in order, then open a market order to sell. Will it be correct?

bool Val_max=true;
bool Cl_dn=true;
bool Val_min=true;
void start()
  {
      if(Val_max==true)
         if(условие_1)
         {
           Alert("Значение инд. >= 1.0000 (исп. 1-е усл.)");
           Val_max=false;                                       //заглушка
         }
      if(Cl_dn==true && Val_max==false)
         if(условие_2)
         {
           Alert("1 бар закрылся падением (исп. 2-е усл.)");
           Cl_dn=false;                                         //заглушка
         }
      if(Val_min==true && Val_max==false && Cl_dn==false)
         if(условие_3)
         {
           Alert("Значение инд. <= 0.9980 (исп. 3-е усл.)");
           Val_min=false;                                       //заглушка
         }
      if(Val_max!=true && Cl_dn!=true && Val_min!=true)
         {
           Val_max=true;
           Cl_dn=true;
           Val_min=true;      
         }   
//----
   return(0);
  }
 
fore-x:

Please explain about operator return(-1); called in the body of function start() - what does it give?

Is return(0); the same thing or not? It seems that the result is not passed anywhere.

Why do they write it in this way?

A procedure is a function whose return value is not used.

return is often typed for fun and can safely be thrown out.

In the above example, the return value can be used: Alert(init());

 
kolyango:

How do I get all the conditions to be checked in order: first condition_1, then condition_2, and only then condition_3, and not like that (which condition coincided, that was not fulfilled in order)? And when all the conditions are fulfilled in order, then open a market order to sell. Is it correct?

Yes.
Reason: