Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-06-2006, 02:26 AM
Junior Member
 
Join Date: Jul 2006
Posts: 9
danielpasono is on a distinguished road
Cool iTime problem

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-06-2006, 02:39 AM
Senior Member
 
Join Date: Sep 2005
Location: St Louis, MO, USA
Posts: 176
cardio is an unknown quantity at this point
History Centre

hi

To see your local history press 'f2' or Tools>history centre.

To ensure u have history see
Using the Period Converter Script

The link for good data is
http://www.alpari-idc.com/en/dc/databank.php

Good luck

Last edited by cardio; 07-06-2006 at 02:40 AM. Reason: Heading
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-06-2006, 03:57 AM
Junior Member
 
Join Date: Jul 2006
Posts: 9
danielpasono is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-06-2006, 04:29 AM
Senior Member
 
Join Date: Sep 2005
Location: St Louis, MO, USA
Posts: 176
cardio is an unknown quantity at this point
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.

Code:
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

}

Last edited by cardio; 07-06-2006 at 02:24 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with .ex4................. EFX General Discussion 4 10-21-2006 07:23 AM
Problem with BGcross EA Andrewsurfer Expert Advisors - Metatrader 4 2 05-26-2006 06:13 AM
Backtesting Problem juanchoc Expert Advisors - Metatrader 4 3 05-23-2006 03:26 PM
My First EA problem demag Questions 4 02-10-2006 08:18 AM
I've a Problem here hellkas Metatrader 4 6 11-04-2005 12:30 AM


All times are GMT. The time now is 03:04 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.