simple print error

 

When I run the code below tick value starts from an irrelevant value at everyrun such as 40064 in first run 23360 in the second run and goes on. I expect 0 1 2 3 ..... what am I missing??

//--------------------------------------------------------------------

// simple.mq4

// To be used as an example in MQL4 book.

//--------------------------------------------------------------------

int Count=0; // Global variable

//--------------------------------------------------------------------

int init() // Spec. funct. init()

{

Alert ("Function init() triggered at start");// Alert

return; // Exit init()

}

//--------------------------------------------------------------------

int start() // Spec. funct. start()

{

double Price = Bid; // Local variable

Count++; // Tick counter

Alert("New tick ",Count," Price = ",Price);// Alert

return; // Exit start()

}

//--------------------------------------------------------------------

int deinit() // Spec. funct. deinit()

{

Alert ("Function deinit() triggered at deinitialization"); // Alert

return; // Exit deinit()

}

//--------------------------------------------------------------------
 

Count will never be displayed as 0. It would go 1, 2, 3... as Count is incremented before the alert.

Are you running it from Strategy Tester?

 
Iceron:

Count will never be displayed as 0. It would go 1, 2, 3... as Count is incremented before the alert.

Are you running it from Strategy Tester?


Yes I am running from strategy tester. Output is in the 'Journal' tab.
 

  1. Count will start at 1, 2, 3.... Each pass in the optimizer, if you change parameters, TF, pairs, or refresh the chart, you will go a deinit/init cycle. This will NOT reload the EA and count will NOT be reset.
  2. In the tester you can create Alerts and Prints so fast that the the Journal Tab will skip groups of entries but they will be in the actual file.
 
Ok I found the log under tester/logs many thanks...