I need to create an automatic code converter
from MQL4 API
( a C-like language )
into Forex Tester API
( C++ / Delphi DLL
).
There are suggestions that it can be done with the help of ANTLR
and MMVP
. However, I do not know how it can be done with the help of the above-mentioned technologies.
Could anybody tell how my problem can be solved?
If you do not know how to accomplish my task using ANTLR
or MMVP
then please advise other technologies.
Here is an example of a simple MQL4
program.
int Count=0; // Global variable.
int init() // Special function init()
{
Print ("init()");
return 0;
}
int start()
{
double Price = Bid;
My_Function();
Print("New tick: ",Count," Price = ",Price);
return 0;
}
int deinit()
{
Print ("deinit()");
return 0;
}
int My_Function()
{
Count++;
return Count;
}
An example of the same program written in C++ API.
#include <windows.h>
#include "StrategyInterfaceUnit.h"
#include "TechnicalFunctions.h"
int Count=0;
char buf[100];
EXPORT void __stdcall InitStrategy()
{
Print ("init ");
}
EXPORT void __stdcall DoneStrategy()
{
Print ("deinit()");
}
EXPORT void __stdcall ResetStrategy()
{
Print ("ResetStrategy()");
}
int My_Function()
{
return Count++;
}
EXPORT void __stdcall GetSingleTick()
{
SetCurrencyAndTimeframe("EURUSD", PERIOD_M1);
double Price = Bid();
My_Function();
sprintf (buf, "New Tick %d Price = %f", Count, Price);
Print(buf);
}
Sample.def
LIBRARY ISHIMOKU
EXPORTS InitStrategy
DoneStrategy
GetSingleTick
ResetStrategy
ReplaceStr
IntrfProcsRec