Download MetaTrader 5

TestGenerator: unmatched data error

To add comments, please log in or register
What is MetaQuotes ID? Find that out from the article!
Ernest Klokow
1084
Ernest Klokow 2011.05.16 10:57 

I have successfully compiled my first EA without any errors and want to to some back testing on it.

I have chosen to start with the EURUSD 1MIN and 5MIN charts - but get NO results!(No buy or sell signals.)

When I look at the log file I get the following error:

TestGenerator: unmatched data error (low value 1.4243 at 2011.05.12 23:35 is not reached from the least timeframe, low price 1.4243 mismatches)

Since this is the first time I have ever written an EA I have no clue what this means.

Could the problem lie with the following declarations?

double HighestLevel = iHigh(NULL,0,5);
int nBarHighNo = iHighest(NULL,0,MODE_HIGH,5,1);
double LowestLevel = iLow(NULL,0,5);
int nBarLowNo = iLowest(NULL,0,MODE_LOW,5,1);

Can anybody PLEASE help?

forexCoder
507
forexCoder 2011.05.16 11:01  

This means that the historical data in your history center can not be matched between different timeframes, seems that the price 1.4243 in a higher timeframe is not reached by any bar on the lowest timeframe - the M1 timeframe. At least it's how I understand it.

However this is not the reason for you not getting buys/sells. Please paste code.

EDIT: seems you modified post. Reading.

EDIT2: the declarations seem alright. However, what do you do with int nBarHighNo and nBarLowNo afterwards?

Ubzen
5394
Ubzen 2011.05.16 11:06  

Un-matched data error have nothing to do with EA logic. Paste the entire code using the Src button above.

Ernest Klokow
1084
Ernest Klokow 2011.05.16 12:31  

I suspect the problem lies somewhere in this algorithm

// ReversalBar Function
                 
         double HighestLevel = iHigh(NULL,0,5);
         int nBarHighNo = iHighest(NULL,0,MODE_HIGH,5,1);
         double LowestLevel = iLow(NULL,0,5);
         int nBarLowNo = iLowest(NULL,0,MODE_LOW,5,1);
         
         if (nBarHighNo < nBarLowNo)
            {
               for (int i = nBarHighNo; i >= nBarHighNo - 4; i--)
               RefreshRates();
                  if (High[i-1] < HighestLevel)
                     if (Close[i-1] <= Open[i])
                        {
                           nBullRevBars = nBullRevBars + 1;
                           dSellPrice = iHigh(NULL,0,4)- (PipsOpenTrans * UsePoint);
                        } 
                      else 
                        {
                           nBullRevBars = nBullRevBars + 0;  
                        }
                  else 
                  {
                     nBullRevBars = 0;
                     dSellPrice = 0.0;
                  }
             
             }
           
           if (nBarHighNo > nBarLowNo)
            {
               for (i = nBarLowNo; i >= nBarLowNo - 4; i--)
               RefreshRates();
                  if (Low[i-1] > LowestLevel)
                     if (Close[i-1] >= Open[i])
                        {
                           nBearRevBars = nBearRevBars + 1;
                           dBuyPrice = iHigh(NULL,0,4) + (PipsOpenTrans * UsePoint);
                        } 
                      else 
                        {
                           nBearRevBars = nBearRevBars + 0;  
                        }
                  else 
                  {
                     nBearRevBars = 0;
                     dBuyPrice = 0.0;
                  }
         
             }
Ernest Klokow
1084
Ernest Klokow 2011.05.16 15:07  

The code above is placing my EA in an endless loop.

It is most probably either the way I use the "for" and "if .. else" operators or Refreshrates() is in the wrong postion??

Ernest Klokow
1084
Ernest Klokow 2011.05.16 18:29  

I have added some Print functions to the code to see if I can find out what is happening.

The first thing that I noticed was that no matter when I ran the back test and no matter what the price was the log file would always start with a non-existing High Price and always the same nBarHighNo, e.g.

17:55:45 2011.05.13 01:19 Turning Point EURUSD,M1: Highest Level is 1.425

17:55:45 2011.05.13 01:19 Turning Point EURUSD,M1: nBarHighNo is 5

The rest is just Greek to me. I have tried to upload the log file but it does not want to upload (maybe it is too big - it is many gigabytes large)

I am sure if one of you expert programmers see my code you wil lol and immediately see the mistakes.

I have struggled for the whole day without any success and desperately need help.

Here is the code with the added Print functions:

 double HighestLevel = iHigh(NULL,0,5);
         int nBarHighNo = iHighest(NULL,0,MODE_HIGH,5,1);
         double LowestLevel = iLow(NULL,0,5);
         int nBarLowNo = iLowest(NULL,0,MODE_LOW,5,1);
         Print("Highest Level is ", HighestLevel);
         Print("nBarHighNo is ", nBarHighNo);
         Print("Lowest level is ", LowestLevel);
         Print("nBarLowNo is ", nBarLowNo);
         
         if (nBarHighNo < nBarLowNo)
            {
               for (int i = nBarHighNo; i >= nBarHighNo - 4; i--)
               Print("Counter ", i);
               RefreshRates();
                  if (High[i-1] < HighestLevel)
                       {
                        if (Close[i-1] <= Open[i])
                        
                        {
                           nBullRevBars = nBullRevBars + 1;
                           dSellPrice = iHigh(NULL,0,4)- (PipsOpenTrans * UsePoint);
                           Print("Sell Price is ", dSellPrice);
                           Print("Bull Reverse Bars are ", nBullRevBars);
                        } 
                      else nBullRevBars = nBullRevBars + 0;
                    }
                  else 
                  {
                     nBullRevBars = 0;
                     dSellPrice = 0.0;
                     Print("HighBar is ", High);
                  }
              }
Ubzen
5394
Ubzen 2011.05.16 18:32  
You're concerned about it placing Orders right? I wanna see the entire code from top to bottom. Including the Ordersend() part.
Ernest Klokow
1084
Ernest Klokow 2011.05.16 23:04  
ubzen:
You're concerned about it placing Orders right? I wanna see the entire code from top to bottom. Including the Ordersend() part.

The entire code is about six A4 pages long so it will most probably be too long to insert here. I can upload it for you, but it is clear from the log file that the EA does not proceed past the algorithm that I published above. It goes into an endless loop. So the problem lies with this code as I see it. If we can fix this particular algorithm the EA will most probably work.

Please look at the code that is given above and tell me if you can see why it is stuck in this endless loop.

Your assistance will be greatly appreciated.

Ubzen
5394
Ubzen 2011.05.16 23:41  
For starter's you're comparing Integers with Doubles. if (nBarHighNo < nBarLowNo) and I don't know why. I don't really like debugging. So, tell me what you're trying to do within that code and I'll attempt to code it for you.
Ernest Klokow
1084
Ernest Klokow 2011.05.17 08:20  
ubzen:
For starter's you're comparing Integers with Doubles. if (nBarHighNo < nBarLowNo) and I don't know why. I don't really like debugging. So, tell me what you're trying to do within that code and I'll attempt to code it for you.

Why do you say I am comparing Integers with Doubles? Both nBarHighNo AND nBarLowNo are INTEGERS. Just look at the snippet of code! These variables represent the shift of the bar with the highest price of the previous 5 bars (nBarHighNo) and the shift of the bar with the lowest price of the previous 5 bars (nBarLowNo).
Ubzen
5394
Ubzen 2011.05.17 08:55  
You're right my oversight.
12
To add comments, please log in or register