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

 

alexey1979621, why don't you first try to write an EA on one pair without errors, and then multi-currency ones?

 

Trying to organise a tic for an expert - no luck. The weekend took me by surprise. How to organise it properly? For example, we have the following elementary Expert Advisor:

int delay = 180;
datetime read_now;
int init(){
   read_now = TimeCurrent() + delay;
}
int start(){
   int how_many_remains = read_now - TimeCurrent();
   Comment(StringConcatenate(
      StringSubstr("-", (how_many_remains%60 >= 0), 0),
      StringSubstr("0", (MathAbs(how_many_remains/60) > 9), 0),
      MathAbs(how_many_remains/60),
      ":",
      StringSubstr("0", (MathAbs(how_many_remains%60) > 9), 0),
      MathAbs(how_many_remains%60)
   ));
   return(0);
}

- how to simulate ticks and start a timer?

I understand that it's weekend, but in the market the schedule of holidays doesn't coincide with those in RF, and there's work to be done...

 
gyfto:

Trying to organise a tic for an expert - no luck. The weekend took me by surprise. How to organise it properly? For example, we have the following elementary Expert Advisor:

- how to simulate ticks and start a timer?

I understand it's a weekend, but in the market the schedule of holidays doesn't coincide with those in RF, and one still needs to work...


Why suffer for something you don't have to?

there will be an official release of the new builds around january 20th and.

There is a timer implemented, with what frequency you need with that and will be called.

It is better to spend your energy on studying the 5, so as not to have thousands of stupid questions.

 
ALXIMIKS:


There's a timer implemented


This is for indication until the next data parsing. At 03:00 the parsing is started from the EA itself by a third-party script, at 00:00 the data is displayed on the chart, and everything is started again with the configured data update rate in seconds. Would a countdown display like this be easier to implement on a five?
 
Unfortunately, I am not competent in this matter, but I have saved https://forum.mql4.com/ru/59441 to read it at your leisure, maybe it will be useful to you.
 
#property indicator_separate_window
#property indicator_buffers 3
#property  indicator_color1 Gold
#property  indicator_color2 Gold
#property  indicator_color3 Gold
//+---------------------------------------------------------------------+
extern double _N_ = 1; 
extern double _M_ = -1; 
extern int History = 10000;
//+---------------------------------------------------------------------+
int p; 
//+---------------------------------------------------------------------+
double Buf_0[];
double Buf_1[];
double Buf_2[];
double RSI;
double ADX_Main; 
double ADX_dD;
double ADX_DD;
double price;
//+---------------------------------------------------------------------+  
bool R_adx;
bool R_time;
bool R_adx_time;
bool R_rsi_time;
bool R_rrsi_time;
//+---------------------------------------------------------------------+
int init()
{
//+---------------------------------------------------------------------+  
SetIndexBuffer(0,Buf_0);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
//+---------------------------------------------------------------------+  
SetIndexBuffer(1,Buf_1);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
//+---------------------------------------------------------------------+  
SetIndexBuffer(2,Buf_2);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
//+---------------------------------------------------------------------+  
return;
}
//+---------------------------------------------------------------------+
int start()
{
//+---------------------------------------------------------------------+  
for(
p=0;
p<History;
p++)
{
//+---------------------------------------------------------------------+  
price = Bid;
//+---------------------------------------------------------------------+  
ADX_Main    = iADX(Symbol(),0,25,0,0,p);
ADX_dD      = iADX(Symbol(),0,25,0,1,p);
ADX_DD      = iADX(Symbol(),0,25,0,2,p);
RSI         = iRSI(Symbol(),0,25,0,p);
//+---------------------------------------------------------------------+  
R_adx         = (ADX_DD - ADX_dD) * ADX_Main; 
R_time        = Seconds() * Minute() * Hour(); 
//+---------------------------------------------------------------------+  
R_adx_time    = _N_ * (R_time + R_adx); 
R_rsi_time    = _N_ * (R_time + RSI);
R_rrsi_time   = _M_ * (R_time + RSI);
//+---------------------------------------------------------------------+  
Buf_0[p] = R_adx_time;
Buf_1[p] = R_rsi_time;
Buf_2[p] = R_rrsi_time;
//+---------------------------------------------------------------------+  
return; 
}
}
//+---------------------------------------------------------------------+  
Hello again!
Happy New Year, everyone!

Another rumour for help.
The "H" indicator is not showing any lines.

I can't figure out what this is about.

The code for the "H" indicator is shown above.
 
ALXIMIKS:
I've saved https://forum.mql4.com/ru/59441 to read at your leisure, maybe you'll find it useful.

I have already implemented the parsing itself, why. I am interested in how to emulate tick to make this timer work. I need time to retrain to mql5 which I will lose and time is money.
 
Link_x:
Hello again!
Happy New Year, everyone!

Another rumour for help.
The "H" indicator is not showing any lines.

I can't figure out what this is about.

The code for the "H" indicator is shown above.

Extreme values are coming out something as a result of the calculation...
 
evillive:

Exceptional values come out something as a result of the calculation...
The important thing is that they are displayed. :)

R_adx_time    = _N_ * (R_time + R_adx) / 500; 
R_rsi_time    = _N_ * (R_time + RSI) / 50 0;
R_rrsi_time   = _M_ * (R_time + RSI) / 50 0;
Do this and the limit values evaporate, but the problem remains.
 
gyfto:

Trying to organise a tic for an expert - no luck. The weekend took me by surprise. How to organise it properly? For example, we have the following elementary Expert Advisor:

- how to simulate ticks and start a timer?

I understand that it's weekend, but in the market the schedule of holidays doesn't coincide with the one in RF, and I have to work...

Library.

 //=================================================================================================================================================
 // 4.7. Функции для управления обновлением графика.
 //=================================================================================================================================================
 // 4.7.1. Функция запускает обновление всех графиков с указанным периодом. Если обновление уже запущено, то функция меняет период обновления графиков.
 //        Останавливается обновление функциями "ServiceStopRefreshChart()" или "ServiceStopRefreshAllCharts()" или закрытием графика.
 void ServiceRefreshAllCharts(int nPeriodMilliSec); // Период обновления графика в миллисекундах.
 //=================================================================================================================================================
 // 4.7.2. Функция запускает обновление всех графиков однократно. Вызов функции при работающих других режимах останавливает обновление всех графиков.
 void ServiceRefreshAllOnceCharts();
 //=================================================================================================================================================
 // 4.7.3. Функция запускает обновление указанного графика с указанным периодом. Если обновление уже запущено, то функция меняет только период обновления графика.
 //        Останавливается обновление функциями "ServiceStopRefreshChart()" или "ServiceStopRefreshAllCharts()" или закрытием графика.
 void ServiceRefreshChart(int hwndChart,        // Системный дескриптор обновляемого графика.
                          int nPeriodMilliSec); // Период обновления графика в миллисекундах.
 //=================================================================================================================================================
 // 4.7.4. Функция запускает обновление автономных графиков с указанным периодом. Если обновление уже запущено, то функция меняет период обновления графиков.
 //        Останавливается обновление функциями "ServiceStopRefreshChart()" или "ServiceStopRefreshAllCharts()" или закрытием графика.
 void ServiceRefreshOfflineCharts(int nPeriodMilliSec); // Период обновления графика в миллисекундах.
 //=================================================================================================================================================
 // 4.7.5. Функция запускает обновление online-графиков с указанным периодом. Если обновление уже запущено, то функция меняет период обновления графиков.
 //        Останавливается обновление функциями "ServiceStopRefreshChart()" или "ServiceStopRefreshAllCharts()" или закрытием графика.
 void ServiceRefreshOnlineCharts(int nPeriodMilliSec); // Период обновления графика в миллисекундах.
 //=================================================================================================================================================
 // 4.7.6. Функция останавливает обновление указанного графика.
 void ServiceStopRefreshChart(int hwndChart); // Системный дескриптор графика, на котором останавливается обновление.
 //=================================================================================================================================================
 // 4.7.7. Функция корректно останавливает обновление всех графиков при bTerminate = FALSE, иначе функция завершает обновление аварийно.
 void ServiceStopRefreshAllCharts(int bTerminate); // Флаг аварийной остановки потоков обновления графиков.
                                                   // FALSE - потоки останавливаются корректно, TRUE - потоки останавливаются аварийно.
 //=================================================================================================================================================
 // 4.7.8. Функция эммулирует тик для эксперта на указанном графике.
 void ServiceTickExpert(int hwndChart); // Системный дескриптор окна графика, для эмуляции тика для эксперта.
 //=================================================================================================================================================
 // 4.7.9. Функция эммулирует тик для индикаторов на указанном графике.
 void ServiceTickIndicators(int hwndChart); // Системный дескриптор окна графика, для эмуляции тика для индикаторов.
 //=================================================================================================================================================