Data persistence / User authentication with external server

 

I need to authenticate a MetaTrader 4 user against an external user database using session token or similar means.

For this I am currently looking into making data persistent between multiple calls and instances of a MQL4 plugin.

Now my questions are:

  • Are static variables the best solution for this or is there a better way?
  • Can I make data persistent between multiple starts and exits of MetaTrader itself?
  • Is it possible to open a text input box?

Anything to get me started is highly appreciated!

Thanks a lot,

Markus

 
  1. Static/global. You don't want to authenticate every tick.
  2. Sure, write to a file, read on load.
  3. Buttons & Textfields on mt4 chart possible now - MQL4 forum
 

GlobalVariableSet() GlobalVariableGet() and friends: https://docs.mql4.com/globals

Not to be confused with the notion of "variable" in the usual programming sense. The above is an API to persist numerical values referenced by a name (given as a string). GlobalVariableSet() will immediately write to disk, so it should be pretty robust, even if you crash MT4.

Reason: