Download MetaTrader 5
To add comments, please log in or register
What are the latest MQL5.community news? The Wall section will tell you!
Somsri Sarkar
1846
Somsri Sarkar 2016.11.29 16:02 

Hi

I have following code for adding time gaps between alerts, otherwise tick by tick it creates many continuous alerts.

static datetime TimeStamp;

if(TimeStamp != iTime(Symbol(),PERIOD_M15,0) && some conditions)
{
Alert
TimeStamp = iTime(Symbol(),PERIOD_M15,0);
}

But in this code, when then a condition satisfies at 11:14 on next time it show alert at 11:15 because code it used 15 minute time gap.

Is there any way to make time gap of 15 minutes from the current time after the condition satisfies?

Thank you in advance.

Regards

whroeder1
14225
whroeder1 2016.11.29 17:09  
Somsri Sarkar: is there any way to make time gap of 15 minutes from the current time after the condition satisfies?
Just do it. TimeCurrent - Date and Time - MQL4 Reference
honest_knave
Moderator
1861
honest_knave 2016.11.29 18:20  
static datetime TimeStamp;

if(TimeCurrent() >= TimeStamp && some conditions)
{
Alert
TimeStamp = TimeCurrent() + 900; // 15 minutes == 900 seconds
}
Somsri Sarkar
1846
Somsri Sarkar 2016.11.30 05:26  
honest_knave:
static datetime TimeStamp;

if(TimeCurrent() >= TimeStamp && some conditions)
{
Alert
TimeStamp = TimeCurrent() + 900; // 15 minutes == 900 seconds
}

Hi, Thank you it worked!

whroeder1
14225
whroeder1 2016.11.30 13:43  
Somsri Sarkar: Hi, Thank you it worked!
  1. Of course it worked. But you learned nothing. You should have been able to substitute TimeCurrent for iTime yourself.
  2. honest_knave: All you did was help him with his current problem (gave him a fish.) What are you going to do with his next N problems?  If you look in the archives, you will find dozens of comments that my terse comments force the poster to learn, and that they are grateful (teach him to fish.)
honest_knave
Moderator
1861
honest_knave 2016.11.30 14:04  
whroeder1:
  1. Of course it worked. But you learned nothing. You should have been able to substitute TimeCurrent for iTime yourself.
  2. honest_knave: All you did was help him with his current problem (gave him a fish.) What are you going to do with his next N problems?

I doubt the OP will be back to ask how they can adjust their alert for 5 minutes (if they are, you will have my apologies).

Therefore the OP most likely has learned something.

I gave them a tool. You gave them instructions on how to make a tool.

honest_knave
Moderator
1861
honest_knave 2016.11.30 14:15  
whroeder1:
  1. Of course it worked. But you learned nothing. You should have been able to substitute TimeCurrent for iTime yourself.
  2. honest_knave: All you did was help him with his current problem (gave him a fish.) What are you going to do with his next N problems?  If you look in the archives, you will find dozens of comments that my terse comments force the poster to learn, and that they are grateful (teach him to fish.)

And how many people never posted again, or gave up completely?

whroeder1
14225
whroeder1 2016.11.30 14:58  
honest_knave: And how many people never posted again, or gave up completely?

If there are any, they really didn't want to succeed at FX, and were just wasting everyone's time.

I try to treat everyone here as an adult. If they act like an adult, I will try to help.

If they just want a freebe, or start whining when they don't get it, then they need to grow up. They've wasted our time with their post, so they don't deserve niceness.

honest_knave
Moderator
1861
honest_knave 2016.11.30 15:40  

The OP concisely explained their problem, posted an attempt at coding it themselves, and was generally polite and courteous. I don't see the issue.

I think we'll have to respectfully agree to disagree on this one. 

whroeder1
14225
whroeder1 2016.11.30 17:32  
honest_knave: The OP concisely explained their problem, posted an attempt at coding it themselves, and was generally polite and courteous. I don't see the issue.
Yes he did. I didn't comment on him, I commented on you. I gave you something to think about and three times you had to get the last word in. You are the issue.
Alain Verleyen
Moderator
30243
Alain Verleyen 2016.11.30 17:48  
Hey kids, may I suggest you to stop this useless (sic) discussion.
/
To add comments, please log in or register