Post Tagged with: "metatrader"

Top 6 Reasons Your Expert Advisor Does Not Trade

Help! My Expert Advisor Does Not Trade

1. Did you enable trading on your MetaTrader platform?

The icon should be green, not red. This shows Expert Advisors as disabled:

This is what it looks like when Expert Advisors are enabled:

Expert Advisors enabled

 

 

 

2. Have you enabled Live Trading on the Expert Advisor input tab? 

If you don’t see a smiley face in the top right corner of the chart, no trades will be placed.

Check the Live Trading box when you attach your EA to a price chart.

EA input tab

 

3. Are there any error messages in the MetaTrader platform Experts tab:

MetaTrader Platform experts tab

Some error messages you may see are:

  • Error code 130 (ERR_INVALID_STOPS): This means your StopLoss or TakeProfit value is not valid. Check them and make sure they are large enough. The actual minimum or maximum value varies from broker to broker.
  • Error code 131 (ERR_INVALID_TRADE_VOLUME): This means your Lot value is not valid. The allowable values vary according to account type (micro, mini or standard).
  • Error code 133 (ERR_TRADE_DISABLED): Use the instructions above to learn how to enable trading on your MT platform.

If you see an error number that you do not understand, use the Navigator in the MetaEditor to search for the error number. See this post for using the MetaEditor for help.

 

4. Is one of the VTS System Managers preventing a trade from opening?

  • Check the Trade Time Manager and the Trade Signal Manager and make sure they are not configured to prevent trades from opening.
  • Check the values of the Input Variables MaxTrade, MaxBuys and MaxSells and make sure they are not set to 0 (zero).

 

5. Have you ever successfully open a trade using an Expert Advisor on this MetaTrader account?

Use the Test Wizard to create a simple EA that opens a trade. (The Test Wizard only allows EAs to run on a DEMO account.)

VTS Test Wizard

Make sure you can open a trade using a Test Wiizard EA before attempting to open trades using a more complex EA.

6. Is your Expert Advisor generating a Trade Signal? Is the EA not even trying to open a trade because the trade Logic is never true?

If you think your EA should be generating a valid signal to open a trade, and it appears that it is not, then see this post for debugging an Expert Advisor.

 

 

 

Common reasons your Expert Advisor does not build

The most common reasons your Expert Advisor does not build

First: Did your Expert Advisor really not build? 

VTS will output both Errors and WarningsWarnings are informational only. They may indicate there is a problem, but they will not prevent an Expert Advisor from being built. For example, if a Logic Element is not fully defined, you will see a warning, but the EA will still build.

How and Why does VTS allow syntax errors to occur?

First, Why?  VTS allows some free-form MQL to be added to a VTS system. This keeps you from being restricted from using advanced trading techniques. However, this can also cause errors.

How? There are 4 basic ways that syntax errors sneak into a VTS system

1. Variable Assignment

The Variable assignment field allows you to enter any valid MQL, not just a numerical or alpha-numerical value.   For example, you may want to determine the spread, so you create a variable named “spread” and in the assignment field enter:

Ask – Bid

Or you may want the average price:

(Ask – Bid)/2

It’s pretty useful to be able to enter simple MQL like this.

2. MQL Element

This is similar to entering MQL code in the variable assignment field, except that you can enter multiple lines of MQL code, or even an entire MQL function.  You should not use the MQL Element unless you have some experience with MQL or are willing to learn.

3. Parenthesis

On the Logic Element configuration window, there are parenthesis buttons to add open or close parenthesis  to any logical condition.

The  open and close parenthesis allow you to create complex logic. But if the parenthesis don’t match up, you will get an MQL syntax error. Again, you should not use this functionality unless you have clear understanding of the order of logical precedence in MQL (or you are willing to learn).

Best practice: When using any of the above 3 methods, press the Build button often (after making any changes) and check for errors. This way, if you inject an error, you’ll have a better idea of where it is located.

4. Non-ASCII characters or Spaces

  •  Most of our testing is done on Windows PCs where US-English is the primary locale. If your PC is not using an English locale, please be very careful with your element names and values and be sure they are simple ASCII values.
  • MQL variables and function names can not have spaces (or start with numbers). The VTS entry screens should prevent these from being entered, but it does happen.
  • If you are used to using commas for fractional numbers and decimals as a thousand separator (backwards to us English users) this will cause problems. The MQL syntax expects fractional numbers as 1.23, not 1,23.

See this post on how to resolve an MQL Syntax error.