Does anyone have some sort of readymade code or template for an EA that they are using every time they make an EA?
I’m not interested in the ‘logic’ of the EA, but some code taking care of the 4/5digits brokers issue, Normal broker/ECN/STP brokers issue, SL, TP, TS, Slippage, maybe some trading time and code in the EA so it can be back tested with the strategy tester and maybe more.
A while back I created a very simple EA template for a generic RSI system as part of a tutorial. The code can be downloaded at the end of part two of the article below.
It is very simple but for a bit more complexity you might take a look at the code for snowroller on that site (more capabilities but also more complex code including handling 4/5 digit brokers, magic numbers, basket close all routines for profit or loss based on % of account, SL, TP, trading times (start/stop)). This EA makes a fairly good template.
You might also try taking a look at the code for buy with stop loss take profit for a script to handle SL and TP issues.
I generated a clean copy and it looks okay. You can fill in your own signals and generate the code.
BE AWARE: If you use a generator, you still should review the code before using it live. It is an out-of-the-box-solution for a bespoke trading plan, so keep that in mind! I started with a generated code like this a couple of years ago, and still work with a tweaked version. I learned what can go wrong and see the value of having such a starting Base.
NOTE: select a condition for all Open_Buy, Open_Sell, etc. Even if it is a bogus condition. Without it will not create the required code for that section. You can alter the conditions later.