Old Dog with New Tricks | Foreign Exchange EA Download- MT4/MT5 Resources
I realize my most recent posts are far off. Trust me, there's a good reason for this.
Over the past two years, my trading has been largely based on EAs. Of course, the problem is that I find myself constantly optimizing and updating my EA. This was a fairly tedious process and required a lot of analysis on my part. All EAs also have problems because they are all "stupid". They don't really analyze the market and try to determine if the current trading market is in their favor. This is something I have to do manually.
Now, I need to come up with some kind of self-optimizing EA, or at least an EA that is smart enough to know whether a specific trading strategy is suitable for a specific market. There have been attempts to mechanically determine whether the market is trending or range-bound, but with poor results. There is an article on the MQL codebase that explains how to make an EA self-optimizing, but it is tricky to implement and completely unreliable.
This system is one of my most promising attempts and can be quite computer intensive. It uses bars on the chart to try to run a very rough backtest. Based on the information in the backtest, the EA can decide whether the market is suitable for them. The original system was based on the old system: new highs and new lows.
Essentially, if a new high occurs, the EA will place a long trade (assuming it expects a breakout) or a short trade (assuming it expects a reverse trade). Therefore, if a new low occurs, the EA will enter a short trade (assuming a breakout) or a long trade (assuming a reverse trade).
The system itself is very simple, there's no doubt about it. The underlying analysis took a while to code and try to perfect.
At the beginning of each day, the EA re-runs the crude oil backtest to determine whether the market is still suitable for the specific trading system.
- extern string Remark1 = "== Main settings==";
- external int MagicNumber = 0;
- This number should be unique when multiple EAs are connected to one terminal.
- extern bool SignalsOnly = False;
- If set to true, the EA will only use any combination of the following alerts to alert you to trades.
- extern bool alert = False;
- If set to true, the EA will send pop-up alerts when trading signals arrive.
- extern bool SignalMail = False;
- If set to true, the EA will send you an email when a trading signal arrives (assuming you have email set up in your MT4 terminal).
- extern bool PlaySounds = False;
- If set to true, the EA will play the file "alerts.wav" when a trading signal arrives.
- external boolean ECNBroker = False;
- Some brokers require the EA to first place the trade and then modify the trade via stop loss and take profit. If your proxy requires this value, set this value to True.
- extern bool CloseOnOppositeSignal = True;
- If set to true, the EA will close the trade on the occurrence of an opposite trading signal.
- extern bool EachTickMode = True;
- If set to true, the EA will immediately place a trade when it sees a signal. If set to false, the EA will trade only when there is a signal at the end of the bar.
- External double lot size = 0;
- Fixed lot size
- extern bool MoneyManagement = False;
- Enable/disable batch size feature.
- outer integer risk = 0;
- The percentage of available margin you are willing to put into a trade.
- extern int slippage = 5;
- Maximum slippage allowed when placing an order.
- extern int stop loss = 100;
- Hard Stop Loss (measured in pips).
- extern int take profit = 60;
- Hard profit point.
- External string remark 2 = "";
- extern string Remark3 = "== HiLo settings==";
- external int BarStart = 0;
- This is the number of bars in the chart history that the EA will check when running backtests. Set to 0 to use all bars on the chart.
- external int initial range = 10;
- The EA looks for new daily highs and lows. This is the number of bars after the start of the new day establishing these highs and lows.
- external doubleWinPercent = 0;
- This is the minimum winning percentage required before the EA decides which system to use.
- outer double minimum success score = 0;
- This is the minimum success score required before the EA decides which system to use.
- extern int minimum confidence = 90;
- This is the minimum confidence level allowed. Confidence refers to the number of trades for which profit or loss cannot be determined.
When you attach this EA to the chart, you will see the following parameters:
Breakout Wins: The number of winning breakout trades in the backtest.
Breakout Loss: The number of breakout trades that failed during the backtest.
Uncertain Breakouts: The number of breakout trades in backtesting where the EA was unsure whether the trade was winning or losing.
Counter Wins: The number of winning counter trades in the backtest.
Counter loss: The number of counter trades that failed during the backtest.
Anti-uncertainty: The number of anti-trades in backtesting where the EA was not sure whether the trade was winning or losing.
Breakout Percent: The percentage of winning trades.
Breakout Success Score: The success score for breakout style trading. (See How I Rate Systems to learn how I calculate success scores.)
Counter Percent: The percentage of winning trades.
Counter-trend success score: The success score for counter-trend style trading.
Tester quality: The EA determines the result (win/loss) of the percentage of trades with a high value: the current daily maximum price.
Low Value: Current daily lowest price.
Trading Style: The trading style used by the EA.
[edit]
Earlier versions of EA did not enable CloseOnOppositeSignal value. These versions do.
HiLo Trader [TD] Lines draw lines showing where the internal backtesting engine will place high and low trades.
I should probably also explain how the backtester works.
The EA can see every bar on the chart. Depending on the number of bars it is told to review, the EA checks highs and lows. When a new daily high is reached, the EA calculates TP and SL and then checks the next few bars to see if TP or SL is between the high and low of that bar (including the entry bar).
- If the TakeProfit or StopLoss price is hit in the entry bar, the EA is added to the "uncertain" count.
- If the Take Profit and Stop Loss prices are hit in the same bar after the entry bar, the EA adds an "uncertain" count.
- If the TP is hit in the bar after the entry bar and the stop loss is never hit, the EA increases the "win" count
- If StopLoss is hit in the bar after the entry bar, and TakeProfit is never hit, the EA adds a "Loss" count.
























Attachment to original post (2)
📦 Summary of post attachments (30)
Below are all the files (30) shared in the reply.
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •