Easy Expert Functions - Include file

 

While coding my own experts, I realized that the process for opening/closing orders, etc. is pretty much the same every time, and I kept reusing the same code every time I wanted to try a new strategy.

Instead of having to write new code each time to open and close orders, I decided to write an include file with functions that will do it automatically, and keep track of the state of opened/closed orders, trailing stops, adding to profitable positions and hedging.

The end result is that it takes minutes to code an EA to try out a new strategy using different indicators. That way, the programmer can concentrate on coding buy/sell logic instead of dealing with routine actions.

Try it out, modify it and let me know if you like it or have any suggestions.

Files:
 

Thanks for sharing. I did something similar a year back but eventually decided to embed all lib functions in every EA due to weird issues. I suspect that it is related to concurrency. When Two or more EAs used the lib in the same terminal, variables became mixed and the executions somehow didn't go through.

I distinctively remember some functions couldn't execute in MQH file, and all EA settings (Allow live trading, allow short/long/both orders, etc) didn't apply to function calls in MQH file.

 

i tried it, and it did not work

this what i get:

2008.02.05 23:41:44 2008.02.06 04:39 EasyExpert MA Cross GBPJPY,M15: OrderSend error 130

 

In retrospect, that was an early beta version and I've since discovered a lot of bugs. I may release a more polished version in the future, but not until I'm confident that it works well.