Refering to Time 1 minute ago?

 

Hi,

I'm trying to refer to a piece of data just once every minute.

Something like if time>time[1] ...

In mql4 how would I write that condition? I've tried multiple ways and can't get it to work. I've looked through the documentation all morning (and searched the internet) and cannot find this basic example or this piece of info that tells me how to refer to past time periods.

Thanks

 
moneycode:

Hi,

I'm trying to refer to a piece of data just once every minute.

Something like if time>time[1] ...

In mql4 how would I write that condition? I've tried multiple ways and can't get it to work. I've looked through the documentation all morning (and searched the internet) and cannot find this basic example or this piece of info that tells me how to refer to past time periods.

Time 1 minute ago is . . .

TimeCurrent() + (PERIOD_M1 * 60);
 
RaptorUK:

Time 1 minute ago is . . .



Fiver dude
 
RaptorUK:

Time 1 minute ago is . . .

1 minute ago is :

TimeCurrent() - (PERIOD_M1 * 60);
 

Or quick style.

int NextRun;

 
int start()
{
 if(TimeCurrent>=NextRun)
   {
     // do something here then
      
     NextRun=TimeCurrent+60;
   }
return(0);
}

Whatever you place in place of the comment "do something here" will run every minute.

 
angevoyageur:

1 minute ago is :


oops . . . yep, of course it is . . . answer in haste repent at leisure
 
tonny:

Or quick style.

Whatever you place in place of the comment "do something here" will run every minute.

No, it won't . . . if there are no ticks for 5 minutes then it won't run for 5 minutes.
 
tonny:

Or quick style.

Whatever you place in place of the comment "do something here" will run every minute.


That one did work too, ( I just had to add () after the TimeCurrent, which I guess was okay to do)

The time all the way over to the right shows 60 second intervals which is what I wanted.

If there is a pause for no ticks as Raptor noted, that wouldn't affect my purpose.

My purpose was to verify my indicator parameters at specific trade bars in back-test mode, and I didn't want to fill up the print log with multiple prints from the same bar.

Also in determining a Mean and other calculations from the data, I didn't want multiple entries from the same bar to throw off my results.


print out

 
moneycode:

That one did work too, ( I just had to add () after the TimeCurrent, which I guess was okay to do)

The time all the way over to the right shows 60 second intervals which is what I wanted.

If there is a pause for no ticks as Raptor noted, that wouldn't affect my purpose.

My purpose was to verify my indicator parameters at specific trade bars in back-test mode, and I didn't want to fill up the print log with multiple prints from the same bar.

Also in determining a Mean and other calculations from the data, I didn't want multiple entries from the same bar to throw off my results.






Reason: