MT4 Strategy Tester Stops When First Order Opened

 

The EA I am developing should place one or two trades per day. The strategy tester stops as soon as the first order is opened. What conditions would cause it to do that?

 
A condition in your code that allows orders to be placed is no longer being met . . . if you want more specific help you will need to show some/all of your code.
 
GarthThe1st:

The EA I am developing should place one or two trades per day. The strategy tester stops as soon as the first order is opened. What conditions would cause it to do that?


I found this with the sample "Moving Average.mq4" EA (before trying my own!). In the journal, I had the following lines prior to the EA running:

2011.08.01 09:28:07     Tester: margin exchange rate cannot be calculated
2011.08.01 09:28:07     Tester: exchange rate cannot be calculated

I had to go to "Tester/Settings/Expert properties/Testing" dialog and set the currency to my local currency (had to change from USD to GBP in my case) - and then I started getting a series of trades.

 
GarthThe1st:
The EA I am developing should place one or two trades per day. The strategy tester stops as soon as the first order is opened. What conditions would cause it to do that?
Look in the journal, a divide by zero stops the tester.
 

I have the same problem an in my code isn't a division by zero.

The metatrader is disconnected from the broker, because I want to use it only for testing.

The ea is working on the same underlying with another metatrader account.

 
sunshineh:

I have the same problem an in my code isn't a division by zero.

The metatrader is disconnected from the broker, because I want to use it only for testing.

The ea is working on the same underlying with another metatrader account.

I had a similar issue in my code last night,  I had written a new function with a while loop in it but had forgotten to add the Shift++  so the while just ran and ran and ran . . .

Is your EA stopping (terminating)  or just sitting there working your CPU ? 

 

First I am getting the following messages

"Tester: margin exchange rate cannot be calculated 

 Tester: exchange rate cannot be calculated"


Then the EA is opening and modifying the first position and close it in the same second! - That's it.

The same behaviour is, when I try the "MACD Sample". My ea is working fine on other accounts!

 
sunshineh:

First I am getting the following messages

"Tester: margin exchange rate cannot be calculated 

 Tester: exchange rate cannot be calculated"


Then the EA is opening and modifying the first position and close it in the same second! - That's it.

The same behaviour is, when I try the "MACD Sample". My ea is working fine on other accounts!


Ah OK.  It may well be that you are looking for info on a symbol that you haven't already got in your symbols  file . . .  I suspect you will need to re-connect to your Broker to get the information.
 
I disconnected the account because I have imported my own backtest quotes. When I connect it, it also imports the last days of their qoutes.
 
sunshineh:
I disconnected the account because I have imported my own backtest quotes. When I connect it, it also imports the last days of their qoutes.
Yes . . . so shutdown MT4 backup you hst files,  restart MT4 and connect . . .  when you are done, disconnect,  shut down MT4 and restore your hst files . . .  it's not difficult.
Reason: