
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Problem in detecting New Bar ( Testing using Daily Data ).
In the following code, the value of Old_Time is *always* has same the same value as New_Time. Any idea why it is so ?
Thanks,
Walter
static datetime Old_Time;
datetime New_Time[1];bool IsNewBar=false;
int copied=CopyTime(_Symbol,_Period,0,1,New_Time);
if(copied>0) // ok, the data has been copied successfully
{
printf ( "Bar %d, %d", Old_Time, New_Time[0]) ;
if(Old_Time!=New_Time[0]) // if old time isn't equal to new bar time
{
IsNewBar=true;
Old_Time=New_Time[0]; // saving bar time
return true ;
}
}
else
{
Alert("Error in copying historical times data, error =",GetLastError());
ResetLastError();
}
return false;