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

 
MakarFX #:
Yes

Thank you

 
Mihail Matkovskij #:

The second option will not work. To do the overrun from the end of the list you have to do the following:

Thank you. I've been thinking for two days.)

 
Nerd Trader #:

I usually do without it, because it doesn't work in the tester, but here the case allows for real data - I'll have to try it. What I've realized, the version of this code with renaming the object is not different from the past, when objects were recreated when changing colours, because renaming does the same thing: it creates an object with a new name and deletes the old one.


UPD

Buttons I use to create lines in mql4 in debug mode are absent in the chart

Crutch on crutch.

UPD

Buttons in tester in mt4 are very well drawn in tester, and even work at that.

 
Can you please tell me how to write the opening time condition for the night scalper? I can't figure it out.

If
Hour() >= start && Hour() <= end

it doesn't work if the start time is 22 or 23 hours and the end time is 2-3am.
 
Ivan Butko #:
Can you please tell me how to write the opening time condition for the night scalper? I can't figure it out.

If
this doesn't work if the start time is 22 or 23 hours and the end time is 2-3am.

Try this code

//----------------------- Возвращает флаг разрешения торговли по времени
bool isTradeTime(string TimeBegin="00:00", string TimeEnd="00:00") {
 datetime dtBegin, dtEnd, TimeCur=TimeCurrent();
  dtBegin=StringToTime(TimeToString(TimeCur, TIME_DATE)+" "+TimeBegin);
  dtEnd  =StringToTime(TimeToString(TimeCur, TIME_DATE)+" "+TimeEnd);
  if(dtBegin>=dtEnd) {
   if(TimeCur>=dtEnd) dtEnd+=24*60*60; else dtBegin-=24*60*60;
  }
  return(TimeCur>=dtBegin && TimeCur<=dtEnd);
 }
 
Vitaly Muzichenko #:

Try this code.

Vitaly, thank you!

 
Artyom Trishkin #:

Crutch on crutch.

UPD

Buttons in the tester in mt4 even draw very well in the tester, and even work while doing so.

What does this have to do with the tester if I'm writing about the debugger? And in the tester the buttons don't work properly, e.g. click events are ignored.
 
Nerd Trader #:
And what's the tester got to do with it, if I'm writing about a debugger? And in the tester the buttons work incompletely, e.g. click events are ignored.

And you don't need to watch the events. They don't work at all in the tester. You have to watch the status.

UPD. Not modest of course, but if you had listened to my hints for once, you would have done everything a long time ago. Properly and without the crutches of a multi-storey.

But everyone chooses the abyss they want to plunge into.

 
Nerd Trader #:

I usually do without it, because it doesn't work in the tester, but here the case allows for real data - I'll have to try it. What I've realized, the version of this code with object renaming isn't different from the past, when objects were recreated with colour change, because renaming does the same thing: it creates an object with new name and deletes old one.


UPD

To use debug in tester, learn to write in MQL5. Everything works there.

There is no object renaming. Think of it as replacing an existing object with a new object.

Buttons used to create lines in mql4 in debug mode are not present on the chart


This cannot be. Your code looks like a mess of things. That's probably why you are experiencing lags with the buttons. Like I told you before, start with something simple. Don't overcomplicate things. And gradually complicate it when the simple starts to work and you're confident in it.

 
законопослушный гражданин #:

Thank you. I've been thinking for two days.)

You should not only think, but also act. For example, you can google "loops for C++".