MQLLock Remotevar(RV) feature

What is RV?

RV is a tool developed for professional level coders to access variables across network. You define variables inside MQLLock Control Panel and can edit them remotely without updating your Projects.

Why should you need RV?

To be very flexible! Some usage examples:

  • You can change trading parameters dynamically without updating your projects.
  • Define Message Of Day and update it daily to display this to your clients.
  • You may have programmed your own expiration date, you can check the date and extend it remotely if its required.
  • You can stop your Project remotely in emergency cases.
  • You can define brokers which are allowed to be traded and this you can maintain flexible and remotely.
  • Increase security! Without having access to RV servers noone will be able to read and know your trading parameters! So even if someone try to hack you, this someone will have no access to correct parameters you update regularly.
  • There are tons of possible ways you may use RV in your projects .
How to use RV?

Remotevars are part of MQLLock Library and you can download the mll.dll file which you can find in Downloads area and start using it. Please note: Removevar is only available for Professional type of accounts. Unfortunetly you cannot try this without buying a Professional licence. You will also find a mll.mqh file which is include file you may want to use by your development, this will simplify your duties.

Remotevar functions

Function : MLRVInit(string AUTH)
This function initializes the RemoteVar function and returns a handle. This handle can be used to further processing.

//-- MLRVInit demonstration
RVHandle = MLRVInit("ACCEC468E5496DA5907A655F265BE06F");
if (RVHandle>0) Print ("Successfully connected to RV Server"); else Print ("RV Connection failed. Errorcode: "+RVHandle);

Following error codes are possible:

Enumaration Value
ML_INVALID_AUTH -14 – Invalid AUTH
ML_DATA_LIMIT -12 – Too frequent call
ML_INVALID_PARAMETER -10 – Invalid Project
ML_NO_DATA -8
ML_UNKNOWN -97

MLL has implemented protection against brute-force. This means that you cannot send MLRVInit command more then one time every 3 seconds. Especially by development you may get this error several times, dont get suprized. We think 3 seconds is reasonable time for recompile. Beside this its very important to know that your project must be at least Professional to use this feature. If not you will get ML_INVALID_PARAMETER error. In case you did not define any variable you may get ML_NO_DATA returned. A value bigger then 0 is a valid handle. Its also very important to close a handle using MLRVClose command. Otherwise your EA may cause memory leaks and may use more memory then intended. Its important to understand that you are not allowed to query another project from your source codes. This means, if you have a professional project then you must decleare its auth here, otherwise RV will not work after converting to ML

Function : MLRVClose(int Handle)
Use this function to close a valid RV Handle. You can use this typically inside deinit() to close it. If you dont use this command, memory leaks may start and your terminal may use more memory then intended.

deinit()
{
    if (RVHandle>0) MLRVClose(RVHandle);
}

Function : MLRVExists(int Handle,string VarName)

Use this function to check if given VarName exists and declared in backend. You may check existence of variables with this simple function.

if (MLRVExists(RV,"nonexisting")) Print("Variable 'nonexisting' exists in RemoteVar backend"); 
else Print("I could not find Variable 'nonexisting' "); 

Function : double MLRVDouble(int Handle, string VarName)
Function : int MLRVInt(int Handle, string VarName)
Function : bool MLRVBool(int Handle, string VarName)
Function : datetime MLRVDate(int Handle, string VarName)
Function : string MLRVString(int Handle, string VarName)
As you see those functions are used to access to remote variables. Its your job to know which variable has which type. MLL does not do any type checking. This means if you have a variable from type string and access it via MLRVInit() function then its content will be tried to convert to Integer. So try to access variables using proper function calls.


#include <mll.mqh>

int RV=0;

int init()
  {
  RV = MLRVInit("4DC7DD710304ED7FFA25EADB25E962A2");      
  if (RV>0) Print("Remotevar connected successfully"); else Print("Remotevar connection failed. Errorcode: "+RV);
  return(0);
  }
int deinit()
  {
   // Never forget to close a handle
   if (RV>0) MLRVClose(RV);
   return(0);
  }

int start()
  {
   // if we have valid RV Handle, lets access to variables
   if (RV>0)
      {
      Print("Variable 'mydouble1' = "+MLRVDouble(RV,"mydouble1"));
      Print("Variable 'var23' = "+MLRVDouble(RV,"var23"));
      Print("Variable 'motd'(string) = "+MLRVString(RV,"motd"));
      Print("Variable 'motd2'(string) = "+MLRVString(RV,"motd2"));
      Print("Variable 'bool4'(bool) = "+MLRVBool(RV,"bool4"));
      Print("Variable 'date1'(date) = "+TimeToStr(MLRVDate(RV,"date1")));
      }
   return(0);
  }