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

 

Good afternoon everyone. I have an indicator that draws an arrow on the chart when a signal appears. It turns out that all these arrows are placed on the history on the chart and you can assess the potential for signals.

the graph with the indicator arrows.

I tried to attach an alert that would signal the occurrence of a signal. I found a function in the indicator that draws arrows when a signal appears.

void SetDivergenceUP(string sy, int work_period, int wnd, string name_ind, string pattern, const datetime &time[], int index,
                     datetime left_time, double left_point, datetime time_b, double ind_b, 
                     datetime last_prc_tm, double last_prc_val, datetime time_extr, datetime &last_time_gv, double price_extr, double &Buffer[]) {
   double atr=iATR(sy,PERIOD_CURRENT,14,index);
   color line_color=clrNONE;
   string nm="", gv_name="";
   if(name_ind=="AO") {line_color=ColorUpperAO; gv_name=GV_nameCTS;}
   else if(name_ind=="MACD") {line_color=ColorUpperMACD; gv_name=GV_nameCTS;}
   else if(name_ind=="RSI") {line_color=ColorUpperRSI; gv_name=GV_nameCTS;}
   else {line_color=ColorUpperSTO; gv_name=GV_nameCTS;}
   //--- поставим сигнальную стрелку на график цены и запишем сигнал для CTS и его время
   //int bar_extr=Bars(sy,PERIOD_CURRENT,TimeCurrent(),time_extr);
   int bar_extr=GetBarShift(sy,PERIOD_CURRENT,time_extr);
   //Buffer[bar_extr]=GetPriceHigh(sy,Period(),bar_extr);
   Buffer[index]=GetPriceHigh(sy,Period(),index)+atr*shiftArrow;
   if(ModeSignalsCTS==enBoth || ModeSignalsCTS==enSell) {
      GlobalVariableSet(gv_name,-1.0);
      last_time_gv=time[index];
      }
   //--- соединим линией ближайшие точки экстремумов цены
   int last_bar_extr=Bars(sy,PERIOD_CURRENT,TimeCurrent(),last_prc_tm);
   nm=Prefix+"P"+name_ind+"divUpper"+TimeToString(time_b);
   SetTLine(0,nm,line_color,0,last_prc_tm,last_prc_val,time_extr,price_extr,widthChartLine,pattern+" "+name_ind+(work_period==Period()?"":"\nна периоде "+GetNameTF(work_period)));
   //--- если есть окно индикатора, соединим линией ближайшие точки экстремумов индикатора
   if(wnd>0) {
      nm=Prefix+name_ind+"divUpper"+TimeToString(time_b);
      SetTLine(0,nm,line_color,wnd,left_time,left_point,time_b,ind_b,widthIndicatorstLine,pattern+" "+(work_period==Period()?"":"\nна периоде "+GetNameTF(work_period)));
      }

}


I added a line at the end of this function to generate the alert. I highlighted the added line with colour ;-)

void SetDivergenceUP(string sy, int work_period, int wnd, string name_ind, string pattern, const datetime &time[], int index,
                     datetime left_time, double left_point, datetime time_b, double ind_b, 
                     datetime last_prc_tm, double last_prc_val, datetime time_extr, datetime &last_time_gv, double price_extr, double &Buffer[]) {
   double atr=iATR(sy,PERIOD_CURRENT,14,index);
   color line_color=clrNONE;
   string nm="", gv_name="";
   if(name_ind=="AO") {line_color=ColorUpperAO; gv_name=GV_nameCTS;}
   else if(name_ind=="MACD") {line_color=ColorUpperMACD; gv_name=GV_nameCTS;}
   else if(name_ind=="RSI") {line_color=ColorUpperRSI; gv_name=GV_nameCTS;}
   else {line_color=ColorUpperSTO; gv_name=GV_nameCTS;}
   //--- поставим сигнальную стрелку на график цены и запишем сигнал для CTS и его время
   //int bar_extr=Bars(sy,PERIOD_CURRENT,TimeCurrent(),time_extr);
   int bar_extr=GetBarShift(sy,PERIOD_CURRENT,time_extr);
   //Buffer[bar_extr]=GetPriceHigh(sy,Period(),bar_extr);
   Buffer[index]=GetPriceHigh(sy,Period(),index)+atr*shiftArrow;
   if(ModeSignalsCTS==enBoth || ModeSignalsCTS==enSell) {
      GlobalVariableSet(gv_name,-1.0);
      last_time_gv=time[index];
      }
   //--- соединим линией ближайшие точки экстремумов цены
   int last_bar_extr=Bars(sy,PERIOD_CURRENT,TimeCurrent(),last_prc_tm);
   nm=Prefix+"P"+name_ind+"divUpper"+TimeToString(time_b);
   SetTLine(0,nm,line_color,0,last_prc_tm,last_prc_val,time_extr,price_extr,widthChartLine,pattern+" "+name_ind+(work_period==Period()?"":"\nна периоде "+GetNameTF(work_period)));
   //--- если есть окно индикатора, соединим линией ближайшие точки экстремумов индикатора
   if(wnd>0) {
      nm=Prefix+name_ind+"divUpper"+TimeToString(time_b);
      SetTLine(0,nm,line_color,wnd,left_time,left_point,time_b,ind_b,widthIndicatorstLine,pattern+" "+(work_period==Period()?"":"\nна периоде "+GetNameTF(work_period)));
      }
      Alert("ДИВЕРГЕНЦИЯ НА "+Symbol());
}

The Alert is working and everything is normal in the tester. But when I start the terminal and if there is an indicator on the chart, it gives out as many beeps and messages as there were arrows on the historyJ What should I do and how should I make Alert be given only when the last signal is received when the terminal is on, and the arrows on the history are silent?
 
DanilaMactep #:

Good afternoon everyone. I have an indicator that draws an arrow on the chart when a signal appears. It turns out that all these arrows are placed on the history on the chart and you can assess the potential for signals.

I tried to attach an alert that would signal the occurrence of a signal. I found a function in the indicator that draws arrows when a signal appears.


I added a line at the end of this function to generate the alert. I highlighted the added line with colour ;-)

The Alert is working and everything is normal in the tester. But when I start the terminal and if there is an indicator on the chart it generates as many audio signals and messages as there were arrows on the historyJ What should I do and how should I make Alert only at the last signal when the terminal is on, and the arrows on the history were silent?
To alert only on the first or zero bar.
 

Colleagues - organizational question:

Free space on disk C on my computer, where I test and optimize expos on MT4 and MT 5 became scarce... like out of 220 left 30 GB on my computer...

I suspect that the space is taken by logs of robots working earlier or being tested, as well as history of different symbols on different terminals and MT4 and MT5 - I am interested:

How can you clear the symbol history (ticks by symbol) and logs in different folders terminals are in (not many in total about 5).

Sort of like before on MT 4 was a magic file clear.bat.

In general, need option(s) to clear space under the history of the characters (their ticks) and logs in different folders. All shortcuts on the desktop are to MT4 and MT5. Sort of like.

in general to clear disk space from past tests (symbol tick history) and trades (their logs).

At least where to read how to clean and which folders to delete and MT4 and MT5 - where they are located...

Sps.

 

Can you give me a hint?

The Expert Advisor via iCustom uses an indicator, but on every tick there are such errors in the log.

Can it be fixed without editing the indicator? And if so, how?

 
ALEKSANDR SOKOLOV every tick in the log.

Can it be fixed without editing the indicator? And if so, how?

If the indicator, run separately from the Expert Advisor, does not produce such records, then check if the indicator parameters are specified correctly when iCustom() is called in the Expert Advisor.

 
Roman Shiredchenko folders terminals are in (not many in total about 5).

Sort of like before on MT 4 was a magic file clear.bat.

In general, need option(s) to clear space under the history of the characters (their ticks) and logs in different folders. All shortcuts on the desktop are to MT4 and MT5. Sort of like.

in general to clear disk space from past tests (symbol tick history) and trades (their logs).

At least where to read how to clean and which folders to delete and MT4 and MT5 - where they are located...

Thanks.

How old is the computer and when have the system logs been cleaned in local folders, temp folders and service intel or other manufacturers folders. On a 10 year old computer with only a browser and an office it took out almost 100 gigs with the sikliner from under the admin. In my Intel folder I found 25gb.

Ticks in the histories folder. There too for example from binans all characters was 25 gb. And the logs in the shared and mcl folder check. If you tear down the logs, it doesn't affect anything. But if you take down the ticks, you may have to wait for the right ones to be loaded.

 
Artyom Trishkin #:

If the indicator, run separately from the Expert Advisor, does not give such records, then check if the parameters of the indicator are specified correctly in the Expert Advisor when calling it via iCustom()

If you enable the indicator itself, it is displayed in a separate window and creates several text labels in addition to the chart. I checked if the parameters are correct, I tried not to specify parameters, the result is the same.

 
Valeriy Yastremskiy #:
Alerate only on the first or zero bar.

How do I write this condition correctly in the indirector and at the end of this function?

 
Valeriy Yastremskiy #:

How old is the computer and when have the system logs been cleaned in local folders, temp folders and Intel or other manufacturer's service folders. On a 10 year old computer with only a browser and an office, almost 100 gigs have been cleaned out by the administrator's cleaner. In my Intel folder I found 25gb.

Ticks in the histories folder. There too for example from binans all characters was 25 gb. And the logs in the shared and mcl folder check. If you tear down the logs, it doesn't affect anything. But if you remove the ticks, you may have to wait until the necessary ones are loaded.

"And check the logs in the general and mcl folder "- in the general where is it?


... ...until the right ones are downloaded.

That's understandable. I will wait for the history data to be updated.

Thanks. I will have a look. Is the histories folder also in data folder in MQL5 folder?

I will look and delete...

I can see the old data directory:

 
ALEKSANDR SOKOLOV #:

If you switch on the indicator itself, it is displayed in a separate window and creates several text labels in addition to the chart. I checked if the parameters are correct, I tried not to specify parameters, the result is the same.

But if the indicator is enabled on the chart, there is no error