thank's for interest!
The full code is this:
//+------------------------------------------------------------------+
//| nuovotick.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
int cont;
datetime last;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
last=Time[0];
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if(Time[0]!=last)
{
last=Time[0];
cont++;
}
Print("new bar: "+cont);
//----
return(0);
}
//+------------------------------------------------------------------+
And the output is this: (More ticks for each bar is normal...but as you can see there is a jump from 11 to 17, in another test the jump could be (at random) from 18 to 20)
Perfect!!! you are a nice person!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I relized thet I have a serious problem while testing a strategy: using the same EA I obtain very different results using exactly the same parameters on the tester.
The script I'm going to show you is written for counting bars when they come out, but MetaTrader jumps some ones!!
example:
Test1: 1,2,3,4,5,6,7,8,9,10,24,25,26,27....Test2: 1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17...
This is the algorithm:
int cont;
datetime last;
int init()
{
//----
last=Time[0];
//----
return(0);
}
int start()
{
//----
if(Time[0]!=last)
{
last=Time[0];
cont++;
}
Print("new bar: "+cont);
//----
return(0);
}