Need help starting with MQL4

 
Hi all, I´m starting to use mql4, and I´m having some odd results in a little program I wrote that logs the closing price of all bars. However it takes a time period from Jan 31st 2005 to Feb 2 2005. Dan somebody tell me why the CurTime() function returns me such date?

I appretiate any help in this matter... Thanks.

Here is portion of the code:

Print("Hora: ",TimeToStr(Time[Bars-1])," Cierre: ", Close[Bars-1]);
Print("");
Print(TimeToStr(CurTime()));
for(int i=1; i<=Bars; i++) {
Print("Hora: ",TimeToStr(Time[i-1])," Cierre: ",Close[i-1]);
}
---

And this is the output:

09:19:55 2005.02.02 20:30 Prueba EURUSD,M30: Hora: 2005.01.31 18:30 Cierre: 1.3043
09:19:55 2005.02.02 20:30 Prueba EURUSD,M30:
09:19:55 2005.02.02 20:30 Prueba EURUSD,M30: 2005.02.02 20:30
09:19:55 2005.02.02 20:30 Prueba EURUSD,M30: Hora: 2005.02.02 20:30 Cierre: 1.3037
-
-
-
09:19:55 2005.02.02 20:30 Prueba EURUSD,M30: Hora: 2005.01.31 18:30 Cierre: 1.3043
---
 
Hello lreyna

As you probably know, CurTime() returns the 'last known' server time... etc.
Just how your code outputs CurTime() as "2005.02.02 20:30" is a mystery.
To better understand what's going on, if you posted the complete source code or link to the file etc. I would have better chance of offering more concrete help.

In the meantime Ireyna, taking your code and putting into test script...
If I run your code with a 'for' loop of just 6 iterations, using GBPJPY,Monthly - I get the following output:

2006.04.01 12:50:15 test3 GBPJPY,Monthly: removed
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2005.10.01 00:00 Cierre: 206.13
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2005.11.01 00:00 Cierre: 207.15
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2005.12.01 00:00 Cierre: 202.84
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2006.01.01 00:00 Cierre: 208.53
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2006.02.01 00:00 Cierre: 203.01
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2006.03.01 00:00 Cierre: 204.45
2006.04.01 12:50:15 test3 GBPJPY,Monthly: 2006.03.31 22:59 <<< Notice 'last known server time'
2006.04.01 12:50:15 test3 GBPJPY,Monthly:
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 1978.01.01 00:00 Cierre: 470.6
2006.04.01 12:50:15 test3 GBPJPY,Monthly: loaded successfully
2006.04.01 12:49:54 Compiling 'test3'

That "TimeToStr(CurTime())" value is last Friday evening when server stopped serving data rates...

Regards
ukt
 
Thank you for your comment ukt. This happens when I use the strategy tester, because when I attach the EA to the chart nothing seems to happen. It´s when I start the test on the tester panel I get that ouput on the Journal pane. I don´t know if the test is being performed with old data. Does this make any sense and can you tell me what should I expect when I attach the EA to the chart or when the cart is refreshed with new operations.

ukt:
Hello lreyna

As you probably know, CurTime() returns the 'last known' server time... etc.
Just how your code outputs CurTime() as "2005.02.02 20:30" is a mystery.
To better understand what's going on, if you posted the complete source code or link to the file etc. I would have better chance of offering more concrete help.

In the meantime Ireyna, taking your code and putting into test script...
If I run your code with a 'for' loop of just 6 iterations, using GBPJPY,Monthly - I get the following output:

2006.04.01 12:50:15 test3 GBPJPY,Monthly: removed
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2005.10.01 00:00 Cierre: 206.13
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2005.11.01 00:00 Cierre: 207.15
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2005.12.01 00:00 Cierre: 202.84
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2006.01.01 00:00 Cierre: 208.53
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2006.02.01 00:00 Cierre: 203.01
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 2006.03.01 00:00 Cierre: 204.45
2006.04.01 12:50:15 test3 GBPJPY,Monthly: 2006.03.31 22:59 <<< Notice 'last known server time'
2006.04.01 12:50:15 test3 GBPJPY,Monthly:
2006.04.01 12:50:15 test3 GBPJPY,Monthly: Hora: 1978.01.01 00:00 Cierre: 470.6
2006.04.01 12:50:15 test3 GBPJPY,Monthly: loaded successfully
2006.04.01 12:49:54 Compiling 'test3'

That "TimeToStr(CurTime())" value is last Friday evening when server stopped serving data rates...

Regards
ukt
 
Hello Ireyna

I'll have to confess here... I do not use EA's, preferring to use custom indicators only. In a nutshell, I prefer to manage my trading activities myself because at the end of the day I want to trade and not spend time [better spent TA'ing, reading,studying imho] then fretting over what that xxx EA is up to!
Horses for courses - as the saying goes. Custom indicators do the biz for me - while others prefer EA's or maybe combination of both...

However Ireyna, imho I believe that any considered/worthwhile comments [from anyone] will have to come from a basis of seeing your code. Speculation is only going to waste time and cause much frustration all around.

As to what you should expect when you attach EA to chart - well then, in all honesty - only you can answer that, as the EA author/designer/coder and chief bottle washer. ..yes?

Not much practical help this is it Ireyna?
But I do wish you all success in your EA quest ;)

Regards
ukt
Reason: