MATLAB dlls with MT4

 

All,

I am using matlab to develop a trading strategy, I have converted the strategy into a dll however when i import this into MT4 i get error 127. I have seen that quite a few people on this forum have recieved this error. I was hopiong someone could explain this error and suggest anything that i need to change when creating it or importing the dll. I have attached both the mt4 code and the matlab code to help explain the situation.

The stategy is a very simple one based on RSI values. Where if the RSI is less than 50 it buys and if it it greater than 50 it sells. It isnt designed to be profitable it is designed to trade so that I can test easily that the DLL importation has been successful, which in this case it hasnt.

Furthmore the system is developed in stateflow (which is part of simulink, which is part of matlab) so unless you are aware of these toolboxes then you probably wont be able to comment on this. It uses the realtime workshop toolbox to creat the DLLs.

Any pointer or assistance would be much appreciated.

Rgds

epictrader.

 
I was pretty confident something like this would was the symptom of the problem. However this does little to help me solve the root cause. Could it be that the codet hat is generated from MATLAB is automated code. I know many of you would be critical of this type of code however i have it on good assurance and since the speed of computer is quite high these days that the speed isnt really affected by a large enough amount to be concerned about. What is of concern is if MT4 is even cabable of handling this type of code, or are there certain parameter on which the C code needs to be programmed in order to function properly in MT4 ? Can anyone present any eliggtenment on this topic? Furthermore I understand that Mt5 is soon to be released, any word on its ability to handle DLLs, or too take commands form another program sucha s matlab. Would be great if anyone has some suggestions otherswise, have a good day! Rgds epictrader
Reason: