Update little code to work on new MT4 - page 2

 

Works! Now the final one, how do I set expiry time so indicator stops working at certain date and time?

Thank you so much!

 
rommark2:
Works! Now the final one, how do I set expiry time so indicator stops working at certain date and time? Thank you so much!

In a similar way :

if (TimeCurrent()>=StrToTime("2016.01.01")) return(0);

replace the date with the one you want to use (metatrader uses that format of date - yyyy.mm.dd)

 
mladen:
In a similar way :

if (TimeCurrent()>=StrToTime("2016.01.01")) return(0);

replace the date with the one you want to use (metatrader uses that format of date - yyyy.mm.dd)

Added the code, even tried put 2014 in the year and yet indicator works and doesnt say "expired"

Ideas?

Thanks!

 
rommark2:
Added the code, even tried put 2014 in the year and yet indicator works and doesnt say "expired"

Ideas?

Thanks!

place it at the first line of start(). Add this code :

if (TimeCurrent()>=StrToTime("2014.01.01"))

{

Comment("time exprired");

return(0);

}

 
mladen:
place it at the first line of start(). Add this code :

if (TimeCurrent()>=StrToTime("2014.01.01"))

{

Comment("time exprired");

return(0);

}

What if I want put both protections:

User

Time

on one indicator and say if one of the protections fails indicator will not work?

Thanks!

 

Here is what I tried and I am failing

if ((AccountNumber()!=800262....) | (TimeCurrent()>=StrToTime("2017.01.01")))

{

Comment("Illegal account");

return(0);

}

 
rommark2:
Here is what I tried and I am failing

if ((AccountNumber()!=800262....) | (TimeCurrent()>=StrToTime("2017.01.01")))

{

Comment("Illegal account");

return(0);

}

"|" is binary OR

You need a boolean OR "||".

Replace "|" with "||" and it will work (and for testing replace 2017 with some value before today)

 

All good, thank you so much!!!

 
rommark2:
All good, thank you so much!!!

Happy coding

 

Hello Mladen

please reply for this Mq4

https://www.mql5.com/en/forum/184806

if not possible then also reply

waiting for ur reply

Thanks in ADV