1 (edited by martinsta 2017-04-27 16:40:58)

Topic: Error in MT4 backtesting

Hi,

I am getting an error on each MQ4 I make with FSB and want to backtest on MT4
It's always telling met that there is it
"can't load enough bars. The expert needs minimum xxx bars. Check the use data ...."
My periode in MT4 is set from April 2010 till April 2017
No matter which EA from FSB I want to test I get this error in MT4.
FSB data used is from Jan 2014 till March 2017

Am I doing something wrong?

Post's attachments

FSB-01001.jpg 86.64 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Error in MT4 backtesting

The problem is that MT is very "stupid" and loads only 100 bars in the tester. There is no way to set it loading more data programmatically. Because your expert needs at least 163 bars it gives an error and stops.

Actually it tells you what to do, but you probably do not read the complete message.

You have to select the "Use date" option in the MT tester and to set a starting data in a way that will assure 163 bars on the chart.

http://s10.postimg.org/hot88o0y1/screenshot_219.png

The correct "from" date depends on the time frame, the number of bars on the chart and the number of the recurred bars of the expert.

Re: Error in MT4 backtesting

Thanks for the quick answer.
You can be sure that I did exactly that.
"Use data" is on and "From" is set to April 2007 and "To" to April 2017 (99% tick data 10 years backtest)
That's why I don't understand the error?

I'm using Tick Data Suite to run back tests.
Did a new test with Tick Data off.
When I turn that off it's running without giving an error.

That's weird!

Re: Error in MT4 backtesting

Why can I not run a good 99% backtest using Tick Dat Suite with EA's created by FSB or EA Studio?
Uploaded and tested about 10 strategies and they all give the same error: not enough bars!
Anybody else using TDS in conjunction with created EA's?

Re: Error in MT4 backtesting

The MT tick testing only contributes to the global warming.

Re: Error in MT4 backtesting

martinsta wrote:

Why can I not run a good 99% backtest using Tick Dat Suite with EA's created by FSB or EA Studio?
Uploaded and tested about 10 strategies and they all give the same error: not enough bars!
Anybody else using TDS in conjunction with created EA's?

Martin, is TDS a third party MT plugin of some sort? You should direct those questions to TDS, they should apparently have an answer why it doesn't load enough bars.

I'm wondering, does your strategy have a considerable amount of ambiguous bars? Otherwise I don't see the rational behind testing twice, it won't change a thing...

Re: Error in MT4 backtesting

footon wrote:
martinsta wrote:

Why can I not run a good 99% backtest using Tick Dat Suite with EA's created by FSB or EA Studio?
Uploaded and tested about 10 strategies and they all give the same error: not enough bars!
Anybody else using TDS in conjunction with created EA's?

Martin, is TDS a third party MT plugin of some sort? You should direct those questions to TDS, they should apparently have an answer why it doesn't load enough bars.

I'm wondering, does your strategy have a considerable amount of ambiguous bars? Otherwise I don't see the rational behind testing twice, it won't change a thing...

TDS is a sort of MT4 plugin
I'm not testing own created EA's but some of the ones available on this site and FF
For instance: EA_Studio_Expert_75137755.mq4

More info about TDS: https://eareview.net/tick-data-suite
I will ask them what the reason for this can be.
No other EA's have this problem.
But FSB and EA Studio are different fro other EA's (?).

Why testing?
Strategies with good results in FSB (incl Monte Carlo) had a margin call after 2 days of trading live.
That's why I want to have second opinion.
And I run 10 year 99% tick data back test on every EA I buy or make.
It's no guarantee for a good EA but it shows me that it would have run good on 10 years info.
Which means that it's not a bad EA.

Re: Error in MT4 backtesting

Here is an expert that prints the number of bars.
Run it on your MT Tester and see the "Journal" tab for the number.

This show that if no start date is selected the MT Tester loads 101 bars.

http://s5.postimg.org/f7ay5zyuf/screenshot_2017_04_28_at_17_19_57.png

By setting a start date, the tester can start with a greater number.

Here is the expert code:

int OnInit()
  {
    MqlRates rates[];
    int bars = CopyRates(_Symbol, 0, 0, 100000, rates);
    Print("Bars: " + IntegerToString(bars));
    return INIT_FAILED;
  }
Post's attachments

Print Bars Count.mq4 631 b, 1 downloads since 2017-04-28 

You don't have the permssions to download the attachments of this post.

Re: Error in MT4 backtesting

But FSB and EA Studio are different fro other EA's (?).

EA Studio's EAs are like other EAs.

Re: Error in MT4 backtesting

martinsta wrote:

Why testing?
Strategies with good results in FSB (incl Monte Carlo) had a margin call after 2 days of trading live.
That's why I want to have second opinion.
And I run 10 year 99% tick data back test on every EA I buy or make.
It's no guarantee for a good EA but it shows me that it would have run good on 10 years info.
Which means that it's not a bad EA.

What does that other 1% stand for in tick data back test? What does 99% mean? Data is one thing, but the real question is how is that data handled.

Have you compared live results with back test results after the fact? Take data you traded on and back test your strats with that, compare trades, do they match. This way you get the idea whether there's an issue or not.

Re: Error in MT4 backtesting

Using the ten year tick data is not necessary with FSBPro.

What the tick data is great for is backtesting, optimiszing, but with FSBPro you do not really need it....

I can understand that you are experiencing some difficulties, keep in mind that FSBPro is using the bar close and open in most cases, where as the tick data is intrabar..

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

Re: Error in MT4 backtesting

Popov wrote:

Here is an expert that prints the number of bars.
Run it on your MT Tester and see the "Journal" tab for the number.

This show that if no start date is selected the MT Tester loads 101 bars.

http://s5.postimg.org/f7ay5zyuf/screenshot_2017_04_28_at_17_19_57.png

By setting a start date, the tester can start with a greater number.

Here is the expert code:

int OnInit()
  {
    MqlRates rates[];
    int bars = CopyRates(_Symbol, 0, 0, 100000, rates);
    Print("Bars: " + IntegerToString(bars));
    return INIT_FAILED;
  }

have run it with TDS on
As you can see I have 101 bars loaded see attachment
Run it without TDS on and I have 1002 bars loaded

Post's attachments

FSB-02.jpg 46.28 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Error in MT4 backtesting

You have to find a way to load at least 163 bars in order to make the test.

Re: Error in MT4 backtesting

I just realized that the MT tester cannot load more than 1000 bars at the beginning of a test.
That explains strange issues:
- modified indicators that require thousands of bars crash.
- indicators that use Exponential Moving Average calculations give differences.

Now our experts try to detect how many bars they need in order to show a stable signals. It looks like it is meaningless to check for more than 1000 bars.

I'm solving these problems for my by using only Simple Moving Averages and periods lower than 100. This is possible in FSB Pro because we can set the MA type for all indicators. For example, we can set MACD to use Simple MAs. On the other hand, the MetaTrader's MACD (and EA Studio) use Exponential MAs.

Re: Error in MT4 backtesting

Thanks all for your great contribution to solve this issue for me.
1000 bars to test?? Understand!
But the back test stops because it can not load 211 bars which is less than 1000 bars
See attached picture
I'm using EA_Studio_Expert_75137755.ex4 for this test.
"The expert need minimum 211 bars......." line 5 from bottom.

Post's attachments

FSB-03.jpg 104.89 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Error in MT4 backtesting

Made a very simple new strategy with FSB for GBPUSD D1:
Open position when simple MA period 10 rise and close when simple MA period 10 falls
Run back test with tick data ...... MT4 comes with error that it needs at least 104 bars

Post's attachments

FSB-04.jpg 85.88 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Error in MT4 backtesting

You have to select the "Use date" option in the MT tester and to set a starting data in a way that will assure enough bars on the chart.

http://s10.postimg.org/hot88o0y1/screenshot_219.png

The correct "from" date depends on the time frame, the number of bars on the chart and the number of the recurred bars of the expert.

Re: Error in MT4 backtesting

What I see in History Center / Data Statistics is
"Data Horizon cut off 101 bars."

See attached picture for Dat Horizon settings.
Can this be the problem with the bar loading in MT4?

Post's attachments

FSB-05.jpg
FSB-05.jpg 16.93 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

19 (edited by martinsta 2017-04-29 08:24:21)

Re: Error in MT4 backtesting

Popov wrote:

You have to select the "Use date" option in the MT tester and to set a starting data in a way that will assure enough bars on the chart.

http://s10.postimg.org/hot88o0y1/screenshot_219.png

The correct "from" date depends on the time frame, the number of bars on the chart and the number of the recurred bars of the expert.

You can be sure that is done correctly

Post's attachments

FSB-06.jpg 21.78 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Error in MT4 backtesting

I'll try for last time.


The experts use indicators.
The indicators need historical data in order to calculate signals.
If you have MA with period of 15, it needs minimum 15 bars to calculate its first value.
The strategy needs 2 bars more to calculate the signals.
If you don't have enough bars, the strategy cannot calculate the first signals.

If you have indicators that need 104 bars, you have to force MetaTrader to load these 104 bars. That is!

The inability of MT or third party plugins to load enough bars is not our problem.

Re: Error in MT4 backtesting

Popov wrote:

I'll try for last time.


The experts use indicators.
The indicators need historical data in order to calculate signals.
If you have MA with period of 15, it needs minimum 15 bars to calculate its first value.
The strategy needs 2 bars more to calculate the signals.
If you don't have enough bars, the strategy cannot calculate the first signals.

If you have indicators that need 104 bars, you have to force MetaTrader to load these 104 bars. That is!

The inability of MT or third party plugins to load enough bars is not our problem.

Do understand!
You made me clear that this is not a FSB problem.
So I will solve this problem outside this forum.
Sorry to bother you.

22 (edited by lefteris.marrek 2017-06-07 08:12:26)

Re: Error in MT4 backtesting

Hello Every one .
Very nice software but I have 2 questions please.

1)    Trailing Stop loss  on MT5.( By the way i could not find MT5 posts )
Is MT5 has  a problem ?
I made many ex5 , and I run them on MT5s tester  ,  it opens trades , but the trailing stop loss never works.
Though  it works on MT4s tester .
( I am thinking , that maybe MT5 ‘s Data , affected when I am making changes on them.
I am erasing Zeros from the last column and I am changing the CSV’s  name  , in order to FSB can read them. )

2)    Also I see many deferent results , when I create a strategy on FSB and test them on testers MT4 – MT5..

Please note , that in all cases , I have imported  the  right Data into the right  FSB Source Data Folder.

Anyone can answer, thanks in advance.

Re: Error in MT4 backtesting

Please upload a strategy that has this problem and we will be able to analyze it and to find a solution.

Re: Error in MT4 backtesting

Greetings Mr Popov .
Here is my strategy.
It looks fine, but as I said trailing stop loss it is not working , only on Mt5’s tester.

Thanks .

Post's attachments

EUR H1.xml 12.38 kb, 2 downloads since 2017-06-07 

You don't have the permssions to download the attachments of this post.