Alert/print seems to not be executed, in start function

 

Hi,

I have not used MQL or MetaTrader in a while, but, for now, decided to have a look at it again, so I am starting back at the basics, to get back into it.

I have an expertadvisor a.mql4, whose start function looks like this (for testing):

int start()
  {
//----
   int i = 0;
   Print("hi");
   Alert("hi");   
//----
   return(0);
  }

Now, as far as I remember, the start function is called on every new tick, correct?

So, when I use this advisor in the strategy tester, on a symbol, shouldn't I be getting alerts ("hi"), and also prints of hi to the log file?

The expert runs through, but I get neither an alert nor a print.

If I put the alert in the init function, I do get an alert, when it initializes.

Is something not correct, about my understanding of the run of the program/when the start function is executed?

 

I don't think that Alerts work in the tester.

If you have not used MetaTrader in a while, perhaps you did not have the necessary history loaded for the symbol that you were using.

 
GumRai:

I don't think that Alerts work in the tester.

If you have not used MetaTrader in a while, perhaps you did not have the necessary history loaded for the symbol that you were using.

it seems you are right, I was just gonna post that the alert only works when I attach it to the chart, not when I test it. sucks. anyway, shouldn't the print work though?

 
hansaaa:

it seems you are right, I was just gonna post that the alert only works when I attach it to the chart, not when I test it. sucks. anyway, shouldn't the print work though?

The Print does work . . . did the test run ? did you click the start button ? did you look in the log file . .. not the journal tab but the log file ?
 
hansaaa:

it seems you are right, I was just gonna post that the alert only works when I attach it to the chart, not when I test it. sucks. anyway, shouldn't the print work though? Oh yeah, and I did load the history data before using the tester, so, I can not say why at least the print is not working.

 
RaptorUK:
The Print does work . . . did the test run ? did you click the start button ? did you look in the log file . .. not the journal tab but the log file ?

Yes the tast ran.

The log file in experts/logs, right?

There is only one file, 20131031.log, and all it contains is

14:22:27 Compiling 'MACD Sample'
14:22:28 Compiling 'Moving Average'
14:22:28 Compiling 'Accelerator'
14:22:28 Compiling 'Accumulation'
14:22:28 Compiling 'Alligator'
14:22:28 Compiling 'ATR'
14:22:28 Compiling 'Awesome'
14:22:29 Compiling 'Bands'
14:22:29 Compiling 'Bears'
14:22:29 Compiling 'Bulls'
14:22:29 Compiling 'CCI'
14:22:29 Compiling 'Heiken Ashi'
14:22:29 Compiling 'Ichimoku'
14:22:29 Compiling 'iExposure'
14:22:30 Compiling 'MACD'
14:22:30 Compiling 'Momentum'
14:22:30 Compiling 'Moving Averages'
14:22:30 Compiling 'OsMA'
14:22:30 Compiling 'Parabolic'
14:22:30 Compiling 'RSI'
14:22:30 Compiling 'Stochastic'
14:22:30 Compiling 'ZigZag'
14:22:31 Compiling 'close'
14:22:31 Compiling 'delete_pending'
14:22:31 Compiling 'modify'
14:22:31 Compiling 'modify_pending'
14:22:31 Compiling 'period_converter'
14:22:32 Compiling 'rotate_text'
14:22:32 Compiling 'send_pending'
14:22:32 Compiling 'stdlib'
17:16:35 Experts are disabled because the account has been changed

This is about 6 hours ago local time.

The expert creates the log automatically when it runs, or do I need manually open a file so that it knows where to write to?

 
hansaaa:

it seems you are right, I was just gonna post that the alert only works when I attach it to the chart, not when I test it. sucks. anyway, shouldn't the print work though?


Yes, the print should work, but if you do not have the necessary history, ticks will not be created.

Also note that if you make the testing period "use date", the start and end date must be different

 
Where are you looking to see the print?
 
GumRai:
Where are you looking to see the print?

I am looking in C:\Program Files\MetaTrader\experts\logs

It shows what I posted above. No entry, since ca. 17:16, ca. 6 hours ago.

I have re-downloaded all the necessary history data.

I run the strategy tester using symbol USDCHF, using Every Tick Model, and use date from 2008 to now, using period H4 and Spread Current.

This should only create one tick every 4 hours, correct?

 
hansaaa: The log file in experts/logs, right?
In the tester it is in tester/logs. Alert becomes a Print in visual mode. Both do nothing in optimization mode.
 
hansaaa:

I am looking in C:\Program Files\MetaTrader\experts\logs

It shows what I posted above. No entry, since ca. 17:16, ca. 6 hours ago.

I have re-downloaded all the necessary history data.

I run the strategy tester using symbol USDCHF, using Every Tick Model, and use date from 2008 to now, using period H4 and Spread Current.

This should only create one tick every 4 hours, correct?

No, you will get thousands of ticks for each 4 hour period . . .

Right click on the log entries in the journal and then click open, it will show you the log files . . .

Reason: