Download MetaTrader 5

Expert Advisor trades during testing, but not when attached to live chart

To add comments, please log in or register
Konstantinos 2010.01.08 06:13 

Hi all,

I compiled and tested an expert for the EURGBP M15 pair. I attached the expert to the EURGBP M15 chart, enabled live trading (without manual confirmation), and got the smiley face at the top right of the chart, next to the expert's name.

The problem is that the expert does not make any trades, but I know it should be trading, because I am running the same data (January 6, 7, and 8, 2010) in the tester, and I see trades there.

For instance, it is 05:10 GMT now that I am writing this message; According to the strategy tester the expert should have made a (losing) trade at 5:00 sharp (I just ran the live data through the strategy tester) but it did not.

Background info: Demo account, denominated in USD (should that matter since I'm trading EURGBP? I think not), vanilla installation and everything else performed to the letter of the guide...

Thanks a lot in advance!

Philippe 2010.01.08 11:16  


May be your code have if(IsOptimisation()) and/or if(VisualMode()) statement that's makes some difference ?

Nothing in the expert log ?

Enought money on your demo account ?


cloudbreaker 2010.01.08 14:10  

Have you got your broker to enable the live account for EA-based trading?

You really need to output the errors from the order function calls in your EA so that you can see the exact cause.


Konstantinos 2010.01.08 16:14  

Hi guys, thanks for the responses.

Matutin: there are no pieces of code that would discriminate between testing and live, such as IsOptimization or VisualMode.

Furthermore, the expert log is clean, except the line "GBPLong EURGBP, M15: initialized" and "Expert GBPLong EURGBP, M15: Loaded successfully" (in the Journal).

I just opened the demo account, and it has 100,000 USD in it. Do you think the currency matters?

cloudbreaker: I am using FXCM (I have a real micro account there and wanted to give MT4 a try). So I downloaded FXCM's MT4 platform, which boasts "expert advisor trading". I will check again to make sure that they allow EAs, but let's assume that they do.

Regarding the orders, there are no errors in the log: my problem is that the EA does not initiate orders in the live (demo) chart.

Thanks again!

JC 2010.01.08 16:29  

cloudbreaker: I am using FXCM (I have a real micro account there and wanted to give MT4 a try). [...]

The last time this came up, I guessed - correctly as it turned out ( - that the EA was placing profit targets and/or stoplosses on market orders. The standard FXCM platform uses the Boston Technologies bridge, which requires that the s/l and t/p are placed independently of a market order. I.e. using an OrderSend() followed by an OrderModify().

There's a number of reasons why an EA could work in backtesting but not in live trading, but this one is perhaps now the most common as use of the BT Bridge becomes more widespread.

cloudbreaker 2010.01.08 20:43  

Yep, reinforces my second point - you should at least have error checking in your EA. That way you'd be able to tell if your problem was down to EAs not enabled on your live account (error 133), invalid stops (as per jjc comment - error 130) or something else.

See the following:



To add comments, please log in or register