- How to get the price on the second X of the 1M candle?
- Indicator for storing price of seconds ago in array. Array doesn't work.
- Price indicator from X seconds ago.
I would like to get the difference from this price from 5 seconds ago with iClose(NULL, PERIOD_M1, 0)...
int OnInit(){ EventSetTimer(1); … } #define MAX_LOOKBACK 100 double price[MAX_LOOKBACK]={0}; int count=0; double price_was(int seconds=5){ int i=count-seconds; if(i <= 0) return EMPTY; return price[i % MAX_LOOKBACK]; } void OnTimer(){ price[ ++count % MAX_LOOKBACK] = iClose(_Symbol, _Period, 0); }
What if there are no ticks during a specific candle period? There can be minutes between ticks during the Asian session, think M1 chart. Larger charts, think weekend, market holiday (country and broker specific), requires knowledge of when your broker stops and starts (not necessary the same as the market.)
Just store it, for later.
What if there are no ticks during a specific candle period? There can be minutes between ticks during the Asian session, think M1 chart. Larger charts, think weekend, market holiday (country and broker specific), requires knowledge of when your broker stops and starts (not necessary the same as the market.)
For what I operate, there are hundreds of ticks per minute...
Thanks...
An what difference does that make?
The code works irrespective of the tick volume.
But if you don't like that method then just use CopyTicks instead with the exact time you want to lookup.

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use