Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1007

 
Ratmirf:

I want the order to close after e.g. 2 hours, 15 minutes. Is it correct to write it in this way?

if (OrderOpenTime()+2*15*00 <=TimeCurrent()) Cls_Buy=true;

No. We should convert 2 hours into seconds (2*60*60) and add 15 minutes converted into seconds (15*60). Then it will be correct.
 

Can you tell me how to correctly convert from a string to an array by breaking down the file transfer character?

Here's an example:

string str = "String1\nString2\nString3\n";
 
flajelet:

Can you tell me how to correctly convert from a string to an array by breaking down the file transfer character?

Here's an example:

Might help.
 
Hello all) Please advise how to select a period of time (for exampleto find the maximum, minimum of the past or current day) or for example the last 7 days
 
Tema97:
Hello all) Please advise how to select a period of time (for example - find max,min for the past or current day) or for example the last 7 days

Maybehttps://docs.mql4.com/ru/series/ihighest andhttps://docs.mql4.com/ru/series/ilowest will help

 
AlexeyVik:
AlexeyVik:
No. You must convert 2 hours to seconds (2*60*60) and add 15 minutes converted to seconds (15*60). Then it will be correct.

Thank you! What is the correct entry in this case?

if (OrderOpenTime()+2*60*60+15*60 <=TimeCurrent()) Cls_Buy=true;

Is it correct?

 
Ratmirf:
or if (OrderOpenTime()+7200+15*60 <=TimeCurrent()) Cls_Buy=true;?
 
AlexeyVik:
No. We should convert 2 hours into seconds (2*60*60) and add 15 minutes converted into seconds (15*60). Then it will be correct.

So this is correct?

if (OrderOpenTime()+7200+15*60 <=TimeCurrent()) Cls_Buy=true;

if (OrderOpenTime()+7200+900 <=TimeCurrent()) Cls_Buy=true;

and end up like this?

if (OrderOpenTime()+8100 <=TimeCurrent()) Cls_Buy=true;

 
Good day to all. Content - for each open market order (have take profit and stop loss) i place pending in opposite direction when stop loss triggered (if order is buy, then pending send). I can't find any syntax sequence to write a script that will delete pending order when current one closes on take profit? Maybe there is a written script among free ones, but search has no luck ( . I would like to write one myself to be able to deal with it, but i cannot understand the syntax sequence. Let me explain on another example - I want ice cream - the sequence of syntax - 1) - get off the couch 2) Get dressed 3) Go to the shop 4) Buy ice cream. Is it possible to do the same for my task?
 
Stereosin:
Good day to all. The idea is to place pending order in opposite direction for each open market order (take profit and stop loss) when stop loss triggered (if buy order, then send pending order). I can't find any syntax sequence to write a script that will delete pending order when current one closes on take profit? Maybe there is a written script among free ones, but search has no luck ( . I would like to write one myself to be able to deal with it, but i cannot understand the syntax sequence. Let me explain on another example - I want ice cream - the sequence of syntax - 1) - get off the couch 2) Get dressed 3) Go to the shop 4) Buy ice cream. Is it possible to do the same for my task?

when the current one is closed, the number of buy orders will decrease, or they will be absent at all (depends on the algorithm), you do this check and delete the pending orders

something like this (in this case, on the contrary, the pending orders are deleted if an earlier placed buy has closed on profit):

 for(int m=OrdersTotal()-1;m>=0;m--)
   if(OrderSelect(m,SELECT_BY_POS,MODE_TRADES)) 
     if(Symbol()==OrderSymbol() && OrderMagicNumber()==Magic) {  
    
      if(OrderType()==OP_BUY)  sBuy++; 
      if(OrderType()==OP_SELL) sSell++;
       
      if(OrderType()==OP_BUYLIMIT)
       if(sBuy==0 || sSell>0) OrderDelete(OrderTicket());
      if(OrderType()==OP_SELLLIMIT) 
       if(sSell==0 || sBuy>0) OrderDelete(OrderTicket());
  }