I've made the following update, and now seems to be working fine, thanks guysgaryfritz wrote:GACK!! You are absolutely right, Mark. Either move that line outside the function, or declare it as "static datetime". Moving it outside the function is probably simpler/better.mpetersrx7 wrote:Shelley.
I don't think this will work because you need to move
datetime LastUpdate = 0;
above the function so it gets defined globally. Otherwise, everytime start is called it gets reset to 0.
Sorry about that folks!
I'm trying to test out the code to make sure I didn't screw up again, but for some reason my Empty4 is not behaving. I'll test it when I get things working...
EDIT: Seems to work fine. Just put the datetime declaration before the start() function:
Code: Select all
datetime LastUpdate; int start() { if (TimeCurrent() - LastUpdate < 10) return(0); LastUpdate = TimeCurrent();
Code: Select all
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
datetime LastUpdate;
int start()
{
if (TimeCurrent() - LastUpdate < 60) return(0);
LastUpdate = TimeCurrent();
int limit;
int counted_bars = IndicatorCounted();