bool SimpleTimer(int iTimeMode = PERIOD_M1, int iPeriod = 1){ int iTimeTick = MarketInfo(Symbol(), MODE_TIME); static int iTimerID[]; static int iTimer[]; int iPosition = 0; int iSecondsMode = 0; if (iTimeMode < 0){ iSecondsMode = iTimeMode*(-1)*iPeriod; } else { iSecondsMode = iTimeMode*60*iPeriod; } iPosition = posIntArray(iSecondsMode, iTimerID); if (iPosition == -1){ ArrayResize(iTimerID, ArraySize(iTimerID)+1); iPosition = ArraySize(iTimerID)-1; ArrayResize(iTimer, iPosition+1); iTimerID[iPosition] = iSecondsMode; iTimer[iPosition] = iTimeTick+iSecondsMode; } if (iTimeTick >= iTimer[iPosition]){ iTimer[iPosition] = iTimeTick+iSecondsMode; return(TRUE); } return(FALSE); } int posIntArray(int iNeedle, int iArray[]){ for (int i = 0; i < ArraySize(iArray); i++){ if (iNeedle == iArray[i]){ return(i); } } return(-1); } void myfunction(){ if (SimpleTimer(5,1) == FALSE){ return; } //do something }hth Russell
Russell:
hth Russell
hth Russell
Thanks Russel, I will study this piece of code.
Regards
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
Hi,
I want my EA to perform the same task (looking on Internet for a file) at the same moment every hour (XXH with 59MN for example).
My problem is that my EA works on H1 time frame so 59MN doesn't exist if I use the information from the chart.
Until now, all my attempts to use server time were unsuccessful.
Anyone have an idea o know better how to use server time ?
Thanks for your help.