Callback functions for MQL4

 
Hi,

Im still a newbie though. Maybe i still havent discovered smth yet, bu I was wondering MQL has callback functions for whatever events are happening. The similar way you have a start() or init(), having functions like on_order_close() or on_new_period_start() would be nice. Event driven programming would simplify programmer's job a lot :)

Thanx.
 
No. There are not events in MQL4 language. You have handle such events yourself.
 
dRONCHIKUS:
Im still a newbie though. Maybe i still havent discovered smth yet, bu I was wondering MQL has callback functions for whatever events are happening. The similar way you have a start() or init(), having functions like on_order_close() or on_new_period_start() would be nice. Event driven programming would simplify programmer's job a lot :) 

on my opinion, you usually use callback - when you do not know when the function will finishes its work, in order this callback could signal you about the finish of e.g. long-playing action (e,g, asynchronous url-load) - in order not to freeze the application while waiting...

in other cases (not long-living & NOT from another thread) everything can be done with simple functions... and any bool flag being checked ...

only being executed in a separate thread the function needs somehow (e.g. with functor passed into it) to signal about the finish (callback is of urgent importance)... imho

main Events already exist

События клиентского терминала - Программы MQL4 - Справочник MQL4
События клиентского терминала - Программы MQL4 - Справочник MQL4
  • docs.mql4.com
События клиентского терминала - Программы MQL4 - Справочник MQL4
Reason: