int pos=0;
int counted_bars=IndicatorCounted();
actualyear=TimeYear(iTime(NULL,PERIOD_MN1,0));
// if(counted_bars < 0)
// return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
pos = 0;
while(actualyear-TimeYear(iTime(NULL, PERIOD_MN1, pos))<=1)
{
if(actualyear-TimeYear(iTime(NULL, PERIOD_MN1, pos))==1)
{
if(iHigh(NULL,PERIOD_MN1,pos)>highi)
highi=iHigh(NULL,PERIOD_MN1,pos);
if(iLow(NULL,PERIOD_MN1,pos)<lowi)
lowi=iLow(NULL,PERIOD_MN1,pos);
if(TimeMonth(iTime(NULL, PERIOD_MN1, pos))==12)
closei=iClose(NULL,PERIOD_MN1,pos);
}
pos++;
}
- Coding help
- Is it possible?
- Questions from Beginners MQL5 MT5 MetaTrader 5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register