History Centre
hi
To see your local history press 'f2' or Tools>history centre.
To ensure u have history see
https://www.mql5.com/en/forum/173507
The link for good data is
http://www.alpari-idc.com/en/dc/databank.php
Good luck
Thanks Cardio.
I've now checked my history. I end up using the H1, M15, and M5 charts on GBPUSD, so I made each of their histories contain the same data (from 4/11/06 13:00 to present).
But, iTime keeps returning 0. Not every run, but on most.
The code that's failing looks like this:
cnt = 0;
DBMsg = "Daily 1";Debug(DBMsg);
while (TimeHour(iTime(ThisPair, PERIOD_H1, cnt)) != midnightET)
{ DBMsg = " hour " + TimeHour(iTime(ThisPair, PERIOD_H1, cnt)) + " itime " + iTime(ThisPair, PERIOD_H1, cnt) + " midnightET " + midnightET; Debug(DBMsg);
cnt++;
}
ThisPair is defined as a global string and contains the name of the pair (in this case GBPUSD)
cnt in defined as an int.
The EA is being run by the Strategy Tester.
Any ideas?
The code was working (and sometimes still does) upto Tuesday evening, then it just stopped. Normally that would make me think about buffers and such, but I don't see any for EAs. I'm trying to calculate pivot points based at midnight Eastern Time.
The output I get from the above loop is: (the date and time starting each line is added by the Debug routine).
11/17/05 06:15 Daily 1
11/17/05 06:15 hour 0 itime 0 midnightET 3
11/17/05 06:15 hour 0 itime 0 midnightET 3
11/17/05 06:15 hour 0 itime 0 midnightET 3
11/17/05 06:15 hour 0 itime 0 midnightET 3
11/17/05 06:15 hour 0 itime 0 midnightET 3
Thanks again.
Daniel
unsolved
Hi
What a co-incidence - we are both working on the same problem - calculating pivots and backtesting them in the stratergy tester.
Your code looks good - I could not see the error - sorry.
This is how I determine when to recalc the pivots. A window of 120 (i think its milli seconds) is set to calc the pivots on the start of the new day. Once they are calc'd , a variable is set that halts the ea for and extra 240 milli seconds - so the pivots will not be calced again until the next new day.
extern string ChartTimeToTrade1 = "00:00";
...
int start()
{
if(Bars < 1) {Print("Not enough bars for this strategy"); return(0);}
TimeFrame=Period();
// time1 = CurTime();
if (CurTime()<= time1)
{
//Print(" Cur: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS)," time1: ",TimeToStr(time1,TIME_DATE|TIME_SECONDS));
return(0);
}
StartTime1 = StrToTime(ChartTimeToTrade1);
bool trade1 = false;
//set magic based on Time
//set up the pivots
if(CurTime() >= StartTime1 && CurTime() <= StartTime1+120)
{
Print(" Cur: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS), " , s1: ",TimeToStr(StartTime1,TIME_DATE|TIME_SECONDS), " ,s1e: ",TimeToStr(StartTime1+30,TIME_DATE|TIME_SECONDS), " ,s2: ", TimeToStr(StartTime2,TIME_DATE|TIME_SECONDS), ," time1: ",TimeToStr(time1,TIME_DATE|TIME_SECONDS));
time1 = CurTime()+360;
...
//Calc pivots
}

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Howdy fellow programmers.
I'm having trouble with iTime. When I run it, it returns 0 (yes, all the parameters are correct). The help page says it will return 0 if the local history is empty (not loaded).
What is the local history and how do I make sure it's loaded from the code?
Thanks.
Daniel