'Trade disabled' error when backtesting

the strange thing is, the expert just did well in testing, it was able to trade in tester without problem.
now no matter what I do, it pops a [trade disabled] error each time EA tries to open a position.
trade disabled in tester ??? how ? and why it happens suddenly, without changing anything ? (actually what could be changed in order to disable trading in tester ? :slight_smile: )

EDIT : same errors with different pairs and different EAs, so it’s a terminal bug ?

Update : when I switch account, tester works fine as used to.
when I switch back to MetaQuote servers, [trade disabled] shows up again :expressionless:

i checked settings, none of “disable auto trading when…” check boxes are checked. and auto trading for experts are enabled.

what’s going on ? :S


Because while you are connected to a server, the trading environment of a backtest data. Metaquotes-Demo being a testing server I suppose they disabled (intentionally or not) trading on this symbol.

I recommend to not use Metaquotes-Demo unless you want to become a beta-tester. Metaquotes is not a broker, their data have 0 guarantee, there is no valid reason to use it.

so metaquotes server stops being server for testing purposes, after using a non-metaquote server for the first time ?
this is what happened to me.

MQ used to work fine, regardless of reliability of test results , and I tested a EA with broker X, then switched back to MQ demo.
thanks for explanation.

Sorry I don’t understand the question.

I tested the EA with MetaQuote demo, no problem. (EA traded in back test successfully)
then I tested the same EA, same settings, same everything, with an demo account of broker X. it worked fine again.
then I switched back to my MetaQuote demo account, and now, all EA back-tests show the [trade disabled] error.

is it normal ?

Can you open a trade manually once connected to Metaquotes-Demo ?

yes. just made a 0.15 lot manually


So change the starting date of your test, (1 week for example) and it will rebuild the trading environment for this test. It should work after that.

it just got strange.

changing the back-test period (starting 1 month earlier) , still same errors.
same EA , changing the tested pair to another pair which was NOT tested earlier (never tested before by any EA, any server) still the same errors.

but, the built-in EAs bundled with MT5, (MACD, MAMA etc…) are unaffected. they open positions in tester (MQ demo server) without problem.

SO it’s like a black list. seems my EAs are not allowed to trade in MQ demo server ,after being tested by broker server.
while other untested EAs (or just bundle EAs?) can still be tested using MQ demo server.

probably one can re-produce the problem i’m seeing.

Weird. Maybe something is cached ?

Can you try with an other MT5 Terminal ?

is there any way to reset the tester environment stuff ?

no other terminal, i just can unistall/install terminal .
is there any option beside this ?

i’ll delete BrokerX tick data folder first, to see what happens, and retry the tests.if still same error, will reinstall the terminal and update this thread.

Not one I am aware of.

deleted the broker’s tick data . (Bases/BokerX demo01/… folder) and restarted the terminal. no help.

What brokerX has to do here ? I thought the problem was on Metaquotes-Demo only.

all problems started after testing an EA with that broker. after that Metaquotes-Demo tests failed.
I don’t know. just thought that those tick data maybe the only remnants of that back-test. :s

oh God…
reinstalled terminal, (deleted user data when uninstalling), and still the same damn [trading disabled] error.

How can this be possible ??? some EAs can be back-tested (so not a terminal/server problem).
while some EAs can’t be back-tested. (and they were tested earlier with the same server without problem, so it’s not the EA’s problem).
this whole thing seems like a weird blockage or something similar.

don’t know how to think for a solution anymore.

I don’t have any problem. I just tried an EA backtest on Metaquotes-Demo.

If you can send a test case EA (ex5), I can try it if you want.

thanks to @fuphamk ,problem was found to be setting the deviation to ULONG_MAX using the standard trade class function : SetDeviationInPoints()

do not use m_trade.SetDeviationInPoints(ULONG_MAX); when using CTrade class :slight_smile:

Thanks for the credit :wink: