Unlock Profits with the MA_Mirror EA for MetaTrader 4

Mike 2010.10.13 17:41 13 0 0
Attachments

If you're on the lookout for a reliable trading tool, let me introduce you to the MA_Mirror EA, a simple yet effective Expert Advisor designed for MetaTrader 4. This EA is particularly effective during trending markets and works like a charm on smaller time frames such as M1 and M5.

The core functionality of the EA is driven by the ea.mqh include file, which houses the more complex features that support all my trading systems. The start() function checks the status of your orders, implements a trailing stop loss, and then calls the Signal() function. This function determines the action based on the signals generated by the indicator part of the EA, returning either -1, OP_BUY, or OP_SELL depending on whether it’s time to buy, sell, or do nothing.

int Signal()
{

int i=1;
int signal = -1;
double ma1, ma2;
ma1=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,i)-iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_OPEN,i);
ma2=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_OPEN,i)-iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,i);

if (ma1 > ma2) signal = OP_BUY;
if (ma1 < ma2) signal = OP_SELL;

return (signal);

}


Feel free to tweak the Signal() function to suit your trading style. Whether you want to use a different indicator, create a strategy that always buys or sells, or even throw a random number generator into the mix, the choice is yours! I've experimented with all these variations to see if the EA can outperform simple trend-following or random decisions.


Just a heads up, there’s a new version of ea.mqh that includes an important fix for the FindOrders function—make sure to rename it accordingly. Plus, I’ve added a nifty BreakEven feature: if your indicator shows a profit of 20 pips, it automatically sets the stop loss to zero. This small tweak can make a big difference!

So, why not give the MA_Mirror EA a spin? It might just be the edge you’ve been looking for!

List
Comments 0