Question for connoisseurs - page 21

 
Hi. I have limited my work to the following function:
bool isTradeTimeInt(int hb=0, int mb=0, int he=0, int me=0) {
  datetime db, de;         
  int      hc;              

  db=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+hb+":"+mb);
  de=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+he+":"+me);
  hc=TimeHour(TimeCurrent());
  if (db>=de) {
    if (hc>=he) de+=24*60*60; else db-=24*60*60;
  }

  if (TimeCurrent()>=db && TimeCurrent()<=de) return(True);
  else return(False);
}

However, the open orders are left to their own devices...

I would like the EA not to place new orders at a certain time, but to accompany the open orders.

I presume that you will be able to disable/disable the formation of a signal at a certain time.

Please advise how to do this.

 

I remember I.Kim had such time functions: https://www.mql5.com/ru/forum/131859 - p.9

isTradeTimeString - Returns the flag allowing to trade by time.
isTradeTimeInt - Returns the flag to allow trading by time.

To make sure that open orders are not "left to chance", the condition if (isTradeTimeString()==false) { ... only be used for opening positions. Do not use this function (this condition) for all other actions (trailing, modification, position closing).

Vinin:
Remove comments
Thank you.
 

Greetings all.

My indicator draws several lines in a separate window. For example - MA of two currencies. And also the line of their difference.

#property indicator_separate_window
#property indicator_buffers 4
... ...
// Буферы для отображения данных
double Buf1[];    // Первый инструмент ма1
double Buf2[];    // Второй инструмент ма2
double BufS[];    // Средняя линия (ма1+ма2)/2
double BufW[];    // разность ма1-ма2
double BufW_Up[]; // Восходящиая разность
double BufW_Dn[]; // Нисходящая разность

...
int init() {
 IndicatorBuffers(7);
  
  SetIndexStyle(0,DRAW_LINE);
  SetIndexBuffer(0,Buf1);
  SetIndexLabel(0, Symbol1); 

  SetIndexStyle(1,DRAW_LINE);
  SetIndexBuffer(1,Buf2);
  SetIndexLabel(1,Symbol2); 

  SetIndexStyle(2,DRAW_LINE);
  SetIndexBuffer(2,BufW_Up);
  SetIndexLabel(2,"Channel width Up");

  SetIndexStyle(3,DRAW_LINE);
  SetIndexBuffer(3,BufW_Dn);
  SetIndexLabel(3,"Channel width Down");
  
  SetIndexBuffer(4,BufW);
  SetIndexBuffer(5,BufS);

I manually "hang" this indicator in the terminal in the "First indicators data" mode to another indicator, e.g. Bonds or Envelope.

I need this second indicator to "hang" exactly on the difference line - buffer BufW,

Please advise - how can I specify it in the code programmatically? In order to "hang" any other indicator in the "First indicators data" mode to choose strictly the line of difference in the buffer BufW?

At the moment, the second indicator constantly "hangs" on the MA line of the first symbol Buf1.