[Solved] Why does OnCalculate get called every tick, yet prices are only per bar (1M minimal)

Back to topics list To post a new topic, please log in or register
avatar
22
enjoysmath 2015.07.22 01:10
 

A tick seems to occur every second or several times a second in MetaTrader 4.  And every tick OnCalculate() is called.  However, OnCalculate's parameters such as high[i] are such that each index in high represents one minute of data minimally (by setting time frame to 1M).

So what is the deal?  How can you get the highest res tick information?  What am I not understanding?

avatar
Moderator
3416
GumRai 2015.07.22 02:01 #
 
What does "highest res tick information" mean?
avatar
22
enjoysmath 2015.07.22 02:06 #
 
GumRai:
What does "highest res tick information" mean?
If the information changes every second, then I would expect to have a price or currency pair ratio every second, is that possible with MT4, why / why not?
avatar
12995
WHRoeder 2015.07.22 14:08 #
 
enjoysmath:

A tick seems to occur every second or several times a second in MetaTrader 4.  And every tick OnCalculate() is called.  However, OnCalculate's parameters such as high[i] are such that each index in high represents one minute of data minimally (by setting time frame to 1M).

  1. There is the parameters high[] and the The predefined Variables - MQL4 Documentation High[]. Don't get them confused. high[] can be ordered either direction; High[0] is the current bar always.
    Ignore the parameters and just use
    int counted = IndicatorCounted();
    int lookback = ... // iMA(period) has look back of period.
                       // buffer[i+2] has look back of 2
                       // use maximum of all.
    for(int iBar = Bars - MathMax(lookback, counted); iBar >= 0; --iBar) ...
    
    the buffers and The predefined Variables - MQL4 Documentation
  2. It is called every tick because Close[0] and possibly the High or Low have changed.
Back to topics list  

To add comments, please log in or register