Backtesting Multi-Currency EA - page 2

 
In my case solution was IsNewBar() metod and switch on "Every Tick" execution metod unless my EA work only on open prices..
Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants - Documentation on MQL5
 
trendick:

Ali, the example I mentioned above is the EA you refer to, which is the source of the IsNewBar() function you mentioned, and already uses it.

How do you explain this? 

I was talking about my EA which trades on two symbols.one symbol gets the data with ontick()

the other uses Isnewbar()

when i change their way of getting data the result is the same. you might try this and compare the results. i also tried to get both quotes using isnewbar like the EA discussed above and had the same problems however getting the quotes of the original symbol with ontick() the problem resolved.

ofcourse there is a problem with the tester i just showed how i managed to get my wanted results.

 
kgo:
In my case solution was IsNewBar() metod and switch on "Every Tick" execution metod unless my EA work only on open prices..

Can you please elaborate? maybe a code snippet to demonstrate?  Can you handle 3 currencies?
 
trendick:
Can you please elaborate? maybe a code snippet to demonstrate?  Can you handle 3 currencies?

Ok, I see what you mean. One of the pairs is used to trigger a new bar opening and for the rest you instantly read the ticks.

 

Kgo, but still this doesn't solve the problem in my case. Could you please show a snippet of what you do?

 

Thanks, trendick 

 
Thanks TheEconmist! (I thought you guys stick to the random walk hypothesis...:-)):  am checking this out right away. 
 
I made some new test and my previously post is incorrect. IsNewBar() method  isn't help. TheEconomist show good example how OnTick() have to be implemented for Multi-Currency EA. 
 
Can you believe I don't even know where is this IsNewBar() method? Which class?
 
TheEconomist:
Can you believe I don't even know where is this IsNewBar() method? Which class?

We are referring to the Method from article 105. Here it is (only the beginning and end are relevant):

 

Here it is:

 

/+X================================================================X+
//| IsNewBar() function                                              |
//+X================================================================X+
bool IsNewBar(int Number,string symbol,ENUM_TIMEFRAMES timeframe)
  {
//----+
   static datetime Told[];
   datetime Tnew[1];
//----+ Declare variable to store sizes of variables arrays
   static int Size_=0;

//----+ Change size of variables arrays
   if(Number+1>Size_)
     {
      uint size=Number+1;
      //----
      if(ArrayResize(Told,size)==-1)
        {
         string word="";
         StringConcatenate(word,"IsNewBar( ",Number,
                           " ): Error!!! Unable to change sizes of variables arrays!!!");
         Print(word);
         //----          
         int error=GetLastError();
         ResetLastError();
         if(error>4000)
           {
            StringConcatenate(word,"IsNewBar( ",Number," ): Error code ",error);
            Print(word);
           }
         //----                                                                                                                                                                                                  
         Size_=-2;
         return(false);
        }
     }

   CopyTime(symbol,timeframe,0,1,Tnew);
   if(Tnew[0]!=Told[Number])
     {
      Told[Number]=Tnew[0];
      return(true);
     }
//----+
   return(false);
  }
Reason: