FOREX TRADING COACHES - EXPERT ADVISOR

MACD 3 TRADE ASSISTANT EA™

MACD 3 Trade Assistant

The MACD 3 Trade Assistant EA™ is an automated trade management program.  What this means is that you tell it when and how to enter a MACD 3 trade, and it handles the trade management -- when to move stops to zero, when to trail stops up closer to current price to lock in profits, and when to trail stop out and close the trade.  The MACD 3 Trade Assistant EA™ is specifically designed to facilitate trading the MACD 3 system.  Certain parameters can be changed to make it behave differently, and might even be used to have it manage a trade as though it were a swing trade rather than a day trade.  This documentation will cover the designed default behavior in detail, and will explain what effect changing certain parameters will have on the behavior of the program.

You should experiment with the behavior of the EA in demo accounts.  Any use of the EA in a live account is completely your decision, and you accept responsibility and liability for any consequence arising out of the use of the software, whether it be unexpected/undocumented behavior, improper use by you, or even software flaws or errors.  Use of this expert advisor is 100% your responsibility.  So please use it extensively in demo so you can properly educate yourself about its use, and make fully informed decisions about if, when and where you want to use it.

On this page:

How a trade is opened
How a trade is managed
How a trade is closed
Things that you can't or shouldn't do
Things you can do without disrupting the EA
How the EA keeps track of trades.
Find it in the Navigator
Drop it on a chart
Settings required for first time use
Set the parameters
Confirm the trade
How do I know if an EA is running on a currency pair?
How do I know if an EA is actively monitoring my open trades?
 
 
  • Parameters
Summary of Parameters
Parameters - Detailed Explanations
 

Trading strategy used by the MACD 3 Trade Assistant EA™

The MACD 3 Trade Assistant EA™ is designed to manage a specific trading strategy, the MACD 3 Forex Trading System™.  Although by modifying parameters you can make it behave differently, it is still confined to certain approaches toward trade management that are based upon the MACD 3 Forex Trading System™.

Here is a general description of how the EA behaves, followed by more detailed explanations.  When you use the EA to execute a trade, it opens two positions at current price (or optionally two pending orders at an entry price you designate).  You must tell the EA if you are buying or selling, and how many lots to trade in each of the two positions it will open.

How a trade is opened

Some brokers don't allow stops and limits to be placed in the initial order, therefore, the EA will first open the positions, then modify them with their stops and limits.  The EA operates by opening two trades with lots and an initial target of your choosing.  First it opens each position, then it modifies the stops and limits of each position.  If the modifications fail for some reason (like invalid stops/limits or other reasons) you should get a message window telling you that it failed to set your stops and/or limit and that you should manually modify the trades yourself to set valid stops or limits.  However, regardless of whether or not you see such a message, you should ALWAYS verify that your initial positions are what you intended them to be.  There are always a variety of ways that either through software glitches, problems at the broker, or simple user errors and typos on your part that the trade might be entered differently than you expected.  ALWAYS VERIFY YOUR POSITIONS AS SOON AS THE EA SETS THEM UP.

How a trade is managed

The EA manages the trades based upon the status of the two trades, the input parameters you have used, and general rules governing the MACD 3 Trading System™.  There are two distinct stages of trade management.

You have two positions initially, one has a hard limit with the broker (the first target) and the other has no limit set.  Both have hard stop losses set with the broker.  The trade with the hard limit is considered "Position #1' and the one with no limit is 'Position #2'.  At first, the EA is only monitoring for the first position to close.  This closure could be because the trade reaches its hard limit, or, could be a result of you manually closing the trade before the hard limit is reached.  Either way, the EA considers the event of the first trade closing to be the equivalent of the first target being hit.  As soon as the EA notices that the first trade is closed, it immediately attempts to move the stop loss of the second position to even - meaning that the stop loss is equal to the entry price.  If you manually close the first trade so close to your entry price that the broker does not allow the stop to be moved there (some brokers require modified stops be a minimum 5 pips away from current price), then the EA will repeatedly be sending modify orders to the broker, and the broker will be repeatedly refusing them.  You should try to avoid this.  So, be aware of what your broker minimums are if you are trying to manually close position 1 early.

Once position 1 is closed and the EA moves the stop of position 2 to even, then it is monitoring the second position to trail the stop according to the internal rules of the MACD 3 Trading System™ and the parameters you have set in the EA.  The parameters pipsBehindLevelForStop (default 10) and minimumStopLossPips (default 30) are what control the moving of the stop loss during the course of the trade.  The "Level" in "pipsBehindLevelForStop" are the 25 pip levels of the price levels indicator. However, the EA is not aware of the price levels indicator.  It knows the price levels are every 25 pips because the EA parameteter "levelPipSize" is set to 25 by default.  If you changed this parameter to 50, it would behave as though the levels are every 50 pips.

So, what is it monitoring?  Based upon the default values, as soon as current price is a minimum of 30 pips away from the price that is 10 pips behind the nearest price level, it will move the stop loss to that price.  This means that when a trade is going your way, the majority of the time your stop loss is greater than 30 pips.  Also, if you consider the math behind this approach you will find that it translates to moving the stop loss to 10 pips behind the most recent level every time current price gets within 5 pips of the upcoming level about to be reached.  This is exactly consistent with the MACD 3 Trading System™.  If you change any of the three previously mentioned parameters you will get significantly different behavior from the EA.  For example, if you wanted to have the EA monitor more of a swing trading strategy with bigger stops, you could change the minimumStopLossPips from 30 to 55, and the effect would be that when price came within 5 pips of the next level, the stop would move to 10 pips behind not the previous level, but the level before that.  These examples are being given only to help explain how the logic works.  We are not suggesting that you actually make any of these changes.  CHANGES TO THESE THREE PARAMETERS HAVE NOT BEEN EXTENSIVELY TESTED.  PLEASE EXPERIMENT WITH THEM ON A DEMO ACCOUNT UNTIL YOU ARE SATISFIED WITH THE RESULT.  The average user should not be concerned with changing these parameters.  We are providing this information because somebody out there will probably be wondering :)

Parameter Settings
Behavior
levelPipSize=25
pipsBehindLevelForStop=10
minimumStopLossPips=55
When price gets within 5 pips of the upcoming price level, stop will be moved to 10 pips behind the second level behind.  The reason it occurs within 5 pips of the next level is because 10 pips behind one level is the possible stop new stop loss.  When current price is 55 pips ahead of that point, then the stop is moved.  Because the price levels are 25 pips apart, then 10 pips behind one level, plus 55 pips means it is always within 5 pips of the next level.  There is no parameter controlling "5 pips from the next level", it is just a result of the mathematics of the three parameters.
levelPipSize=50
pipsBehindLevelForStop=10
minimumStopLossPips=50
When price gets within 10 pips of the upcoming level, stop will be moved to 10 pips behind the previous level which calculates to 50 pips behind current price.
levelPipSize=25
pipsBehindLevelForStop=5
minimumStopLossPips=30
When price hits a new level, stop will be moved to 10 pips behind the previous level.  This is because the price that is 10 pips behind the prior level plus 30 pips will equal the upcoming price level.

How a trade is closed

As previously discussed, the first trade is closed when it hits the hard limit that was set with the broker.  Once that trade has closed then the EA monitors the second position's profit and moves the stop loss periodically as previously discussed.  The second trade is closed when price falls back to the hard stop loss set with the broker, or until you manually close the trade.  If you manually close the trade the EA will detect that and will stop monitoring.

 

Limitations, Restrictions, Interacting with open trades

Things that you can't or shouldn't do

You can only have one set of EA trades open on one currency pair.  In other words, you may have EA managed trades open in the EURJPY, and also in the EURUSD, and also in the USDJPY, etc, but you may not have one set of trades in the EURUSD managed by the EA and also have another set of trades in the EURUSD also managed by the EA.  Please do NOT try to work around this limitation -- you will not be successful.  Even if you have another installation of your trade station on another computer, if you are logged into the same trading account on both, an instance of the EA on trade station #2 will still recognize the trades that were placed on trade station #1 and will attempt to control them.  You will not be able to enter another set of trades on that currency pair, and instead will have two instances of the EA on the same currency pair on two different trade stations, each fighting the other to manage the trade.

You must avoid manually closing out the first position trade if the second position is not in enough profit to allow the EA to move the stop to even.  Brokers have a requirement that a newly modified stop loss be a minimum number of pips away from current price.  Often this is set to 5 pips but is controlled by the individual broker.  The EA does NOT know what this broker setting is.  All it knows is that if there is only one position open, then it assumes it is the second position and that the first position limited out.  It will immediately and repeatedly attempt to move the stop loss on the remaining position to equal its entry price (move stop to zero profit).  It is perfectly OK to manually close the first position early in order to trigger this action, however, if you do this when current price is too close to your entry, then you will cause the EA to continually and repeatedly attempt to move the stop loss to an invalid price.  This will clog the trading thread in your trade station, flood the broker with invalid trade modification requests, and generally cause your trade station to "misbehave".  If you ever find that you manually closed a first position too close to current price for the EA to move the stop on the remaining position, your best course of action would be to remove the EA from the chart and manually manage the remaining position.  Once the remaining position is in enough profit to legally move the stop, you can put the EA back on the chart, set its initial parameters again, and it will find the trade and start managing it again.

You should avoid manually closing the second position trade while leaving the first position open.  If you do this, it will treat the 1st position as though it was the the second position and attempt to move the stop to zero and trail stop the trade even though it has its own hard limit set with the broker.

You must avoid trying to set up pending orders too close to current price.  Brokers have a requirement that the entry price of a new order be a minimum number of pips away from current price.  Often this is 5 pips but it is controlled by the individual broker.  If you attempt to have the EA put in a pending/entry order too close to current price, the order will fail to be placed, and it will seem to you like the EA is not working.  It will not flood the broker with repeated and continuous attempts to enter the trade.  It will retry a few times and then give up.  However, it will appear to you like the EA is not working.  You may get an error displayed in a window two times - once for each trade it attempted to open.  You will also have additional information in the Experts tab of the Terminal window of the MT4 trade station.

Once the first position has closed (whether you closed it manually or it hit its hard limit), the EA immediately attempts to move the stop loss of the second position even with the entry price.  If for some reason you want to keep the stop loss earlier than entry, you will not be able to keep it there while the EA is running.  If you modify the stop to be at -5 pips profit, the EA will detect the first position has closed and so will reset the stop loss back to even.  The only way you will be able to maintain a stop loss less than even after the first position has closed, is to either turn off EAs at the trade station level, turn off "Allow Live Trading" in the property window for this particular instance of the EA, or, remove the EA from the chart completely.  Once the EA is no longer monitoring the trade, you can change the stop loss to less than even and the EA will not be live to change it back.  Once you want your stop loss at even or greater, and you want the EA to resume managing the trade, simply undo whatever process you chose to disable the EA and it will detect the trade and start monitoring it again.

Things you can do without disrupting the EA

You may shut down your trade station and restart it.  Of course, during the time your trade station is shut down the EA is not monitoring the trades.  But, when the trade station restarts, chart windows with the EA on them will search for trades that "belong" to them and if any are found, they will resume managing them.

You may close a chart or remove an EA from a chart, and although the trades will no longer be monitored, you are still able to put the EA back on that chart, set its parameters to match the trade that is currently live, and it will resume monitoring the trade.

If you have EA monitored trades open in a currency pair, you may open additional positions in that pair manually without interfering with the trades that are being managed by the EA.  You may also use the EA to open and manage trades in OTHER currency pairs, and each instance of the EA will manage the trades of its own currency pair without interfering with the EA managed trades of the other currency pairs.  You may NOT have multiple instances of EA managed trades on the SAME currency pair.  In other words, if you have EA managed trades in the EURUSD, you cannot open another set of EA managed trades on the EURUSD.

You can have another trade station running on another computer logged into the same trading account, and if drop the EA on a chart it will take over management of any trades that were opened by the EA on that currency pair.  For example, you have a laptop and you opened EA managed trades on it.  However, you need to leave and take your laptop with you.  If you have another PC at your house with the trade station and MACD 3 Forex Charts Pro Enhancements™ installed on it, you can turn off the EA on your laptop and set up the EA on your other PC and the other PC will take over management of the trade.

You can set up your parameters well in advance of the trade setup happening, so when the time comes you already have the parameters set up and ready to go -- just display the EA properties window by clicking on the smiley face on the chart that is running the EA, verify your settings are correct, and click OK to execute the trades.  To set up the options in advance, simply follow the instructions for setting up the EA, but when the final confirmation dialog is displayed, choose "No".  (See "Confirming The Trade" below).

How the EA keeps track of trades.

The EA uses an internal numbering system that lets it analyze all open trades on your trade station and discover if any of those trades are in the currency pair that the EA is on, and if any of the trades in that currency pair were opened by the EA.  So, even if the trade station was temporarily shut down, or if a chart with the EA on it was accidentally closed, when the EA starts up again on a chart it can retake control of trades if they were set up by the EA on that same currency pair.

Setting up the MACD 3 Trade Assistant EA™ to trade a currency pair

Find it in the Navigator

Choosing "Navigator" under the "View" menu of your trade station, or pressing Ctrl+N will display the Navigator window.  Scroll down to the item called "Expert Advisors".  If it has a "+" sign next to it, click on it to expand the node and see all the expert advisors that are installed on your trade station.  Locate the one called "MACD 3 Trade Assistant"

Drop it on a chart

To execute the EA for a currency pair, simply click down on the MACD 3 Trade Assistant, drag it to a chart of the currency pair you wish to trade, and drop it on the chart.  See "How do I Know an EA is Running On A Currency Pair" for more information.

Settings required for first time use

Whenever you drop the EA on a chart, you will see the following window, called the "Properties" window.  This window contains all the parameters in the "Input" tab, and other settings in the "Common" tab.  The first time you use the EA, you must verify that the settings in the "Common" tab of the properties window are set like the following example.  If you do not "Allow Live Trading" and "Allow DLL imports" AND "Allow import of external experts", then the EA will not work.  If you accidentally have checked the "Confirm DLL function calls" you will get lots of nagging confirmation windows and it could interfere with the functionality of the EA.

The EA already asks for manual confirmation before entering live or pending orders, so, having the "Ask manual confirmation" is redundant, and may also interfere with timely execution of your two initial positions if you are trying to enter in at current market price.

Set the parameters

Next you must tell the EA how when you want your trade executed, and how you want it to manage it.  Parameters are documented here (Parameters) and in greater detail here (Parameters - Detailed Explanations).

Confirm the trade

After you have entered all your parameters, and you click "Ok" on the Inputs tab, you will get a final confirmation window.  You will get one of the two windows below depending upon whether you are setting up live market orders or pending/entry orders:

    

If you click "Yes", then the EA will attempt to execute your trades.  If you click "No", then the EA will not execute your trades, however, it will still be installed on the chart with your current parameters settings.  You can shut down and restart your trade station, or change chart periods/timeframes, and the EA will not reinitialize and attempt to make trades.  The EA will only attempt to execute trades when the last action was clicking OK on the Inputs tab of the property window.

So you have the ability to set up the EA parameters ahead of time, and after clicking OK on the Inputs tab, simply click "No" on the confirmation window.  This will give you the ability to quickly execute the EA when the trade you are looking for actually sets up.  If you have a non-trading EA installed on a chart and you want to make it execute your trade, simply click on the smiley face on the chart which will display the properties window, confirm that your parameters are set correctly, and click OK in the input tab.  You will again see one of the above confirmation windows.  This time, click "Yes" and the EA will execute your trades.

How do I know if an EA is running on a currency pair?

If an EA is intalled on a chart, you will see one of the following three graphics in the upper right corner of the chart:

         

Here is what each of these graphics mean to you, and what you can/should do about them:

EAs are turned off at the trade station level.  There are two ways to turn EAs on for the entire trade station.  One is through the menus, and the other is with a toolbar.  If EAs are off at the trade station level, your "Standard Toolbar" will look like this:

The "Expert Advisors" button shows that EAs are turned off.  This is a toggle switch, so by clicking on the button it will turn EAs on at the trade station level and then the Standard Toolbar will look like this:

This setting is also controlled through the menus by clicking the "Tools" menu, choosing "Options" and making sure the first option of "Enable Expert Advisors (except for Custom Indicators and Scripts)" is checked.  It is also important that other options checked in the graphic below are also checked in your trade station.

This graphic means that even though EAs are turned on at the trade station level, the individual EAs property window is not allowing live trading.  You need to be sure you check the options discussed in "Settings Required For First Time Use".  You may also find that even though you have a smiley face the EA is still not trading.  Check to be sure that the "Allow Live Trading" in the Tools->Options window above is also checked.

This graphic means that your EA is set up to trade, or is actually actively trading.  When you drop the EA on a chart and set up the parameters, even if you click "No" to the final trading confirmation window, the EA will still be displayed with a smiley face.  So, what the smiley face means is that "the EA is working", it doesn't necessarily mean it is trading or monitoring trades.

How do I know if an EA is actively monitoring my open trades?

If an EA is installed on a chart, and it is being displayed with the smiley face, then you will be able to tell if it is monitoring trades by a message displayed in the upper left corner of the chart it is on.  Here are the messages that tell you about the EAs status.

The EA is not monitoring any trades The EA is in the process of attempting to open live or pending orders.  This message will only be displayed during the time that it is actually processing trade requests If the market is closed, or your requested prices are invalid, or your stops or limits are invalid, you will see an error window, and also see this message in the upper right area.

This is what it will look like if your EA is monitoring your live or pending orders.  When you see this message, you know that the EA has found orders for this currency that "belong" to it, and it is monitoring them:

 

How manually modifying trades can affect the trade assistant

If you manually close the first position, the EA will move the stop loss of the second position to even.

If you manually change the hard limit of the first position, then the EA will not attempt to move the stop loss of the second position to even until the first position has limited out.

If you remove the limit from the first position, the EA will never move stop losses until the first position is closed.

If you set a limit on the second position instead of letting the EA manage the trade, then when it limits out the EA will detect that its job is done and will stop trying to monitor trades.

If the first position is closed and the EA is moving/trailing the stop on your second position, if you move the stop further back the EA will just move the stop loss back up to where it is programmed to be.  You will have to disable the EA if you want to have larger than the managed stop losses.

If the first position is closed and the EA is moving/trailing the stop on your second position, you may modify the stop loss of the second position to be closer to current price without affecting the EA.  The EA will continue to monitor trades without objection if you have changed the stop loss to be closer than the default management methodology.  However, as previously stated, if you move the stop loss further away than the default management methodology, the EA will detect that the stop loss is further away than it should be and it will simply move it back to where it was before you modified it.

Removing the EA from a chart

To remove the EA from a chart, simply right-click anywhere on the chart, choose "Expert Advisors" then choose "Remove"

Parameters

(Click here for more info about parameters)

When you drop the EA on a chart, an options window is displayed.  The parameters for the MACD 3 Trade Assistant™ are listed under the "Inputs" tab.  The parameters that start with the "_" character and are in all upper case are not real parameters - they have no effect on the program.  They are there so you can see quick reminder descriptions of the purpose of different parameters.

BUYorSELL
Required.  Must be equal to "BUY" or "SELL" or "buy" or "sell" (without the quotes)
_LOTS_T1_="# LOTS FOR TRADE THAT LIMITS FIRST";
_LOTS_T2_="# LOTS FOR TRADE THAT TRAILS";
_TARGET_PRICE_="PRICE LIMIT OF 1ST POSITION";
These are only comments to remind you at runtime what some of the parameters mean.  You never change the value of "parameters" that start with a "_" character and are all upper case.
lots_T1=0.00;
lots_T2=0.00;
Required.  This is the lot sizes for the first and second positions the EA will open.  T1 is the first position that gets the hard limit set, T2 is the second position that is managed, trail stopped, etc.
targetPrice=0.00;
This is the price of the limit of the first position.  You do not need to adjust for the spread when buying or selling.
_START_AT_PRICE_="ZERO=MARKET, PRICE=ENTRY ORDER";
startAtPrice=0.00;
Leave this at zero, and EA enters live trades at current market price.  Put in a price, and the EA enters pending/entry orders at that price.  You DO need to adjust for the spread when BUYing.
minStopLossPips=23;
This is used to calculate the initial stop loss of the positions when they are opened.
_LEVEL_PIP_SIZE_="SIZE/PIPS OF THE PRICE LEVELS";
levelPipSize=25;
This tells the EA the size of your price levels.  Just like the price level indicator (the blue lines every 25 pips), this number tells the EA that the price levels you are using are 25 pip multiples.
_PIPS_BEHIND_LEVEL_FOR_STOP_="PIPS +/- PRICE LEVEL TO SET STOP";
pipsBehindLevelForStop=10;
This tells the EA that stops are based upon 10 pips beyond a price level.  This is how it knows its stop loss levels are 10 pips beyond each 25 pip price level.
minTrailStopPips=30;
This tells the EA to never move the stop loss closer than 30 pips from current price.

Parameters - Detailed explanations

BUYorSELL  -  Default Value: ----

Required.  Must be equal to "BUY" or "SELL" or "buy" or "sell" (without the quotes).  You cannot mix case.  In other words, Buy or BUy or bUY will not work.

lots_T1  -  Default Value: 0.00

Required.  This is the lot size for the first position the EA will open.  The first position gets the hard limit set to close at the first target.  The closing of the first position triggers the EA to move the stop of the second position to be even with the entry price.  Once this position has closed the EA will monitor the second position to trail the stop.

lots_T2  -  Default Value: 0.00

Required.  This is the lot size for the second position the EA will open.  The second position has no hard limit set.  When the first position limits, it triggers the EA to move the stop of the second position to be even with the entry price and then monitors the trade to trail the stop.

targetPrice  -  Default Value: 0.00

Required: The hard limit of the first position will be set to this price. You do not need to adjust for the spread when buying or selling.  The EA will use the current spread at the time of the order to calculate the limit price based upon the chart price (bid price) you enter here.

startAtPrice  -  Default Value: 0.00

Leave this at zero, and EA enters live trades at current market price.  Put in a price, and the EA enters pending/entry orders at that price. NOTE: Unlike target price you MUST account for the spread when setting up a pending order for a buy.  A sell will be at chart price (Bid) but a buy will be at the Ask price which is the chart price plus the spread.  When entering a pending buy order, you must use a price that is likely to be the Ask price when the chart price reaches your entry level.

minStopLossPips  -  Default Value: 23

This is used to calculate the initial stop loss of the positions when they are opened.  Based upon a 25 pip price grid and the fact that stop losses are by default placed 10 pips beyond a price level, this helps the EA know if it should set the initial stop in back of a nearer level or a further level.  If a stop loss 10 pips beyond the first level is less than 23 pips, then it will check on the price 10 pips beyond the next level, and continue to do so until the stop loss would be a minimum of 23 pips.

levelPipSize  -  Default Value: 25

This tells the EA the size of your price levels.  Just like the price level indicator (the blue lines every 25 pips), this number tells the EA that the price levels you are using are 25 pip multiples.

pipsBehindLevelForStop  -  Default Value: 10

This tells the EA that stops are based upon 10 pips beyond a price level.  This is how it knows its stop loss levels are 10 pips beyond each 25 pip price level.

minTrailStopPips  -  Default Value: 30

This tells the EA to never move the stop loss closer than 30 pips from current price.  So, if 10 pips past the most recent price level is not 30 pips away, then it will continue checking for deeper stop loss levels until it is at least 30 pips away from current price.  Setting this at 30 causes the EA to move the stop to 10 pips before the prior price level as soon as it comes within 5 pips of the next price level.  The EA always looks to move stops within 5 pips of a price level.  That 5 pip proximity is not changeable through parameters.