Download MetaTrader 5

Create a datetime variable and compare it

To add comments, please log in or register
mpantogi
323
mpantogi  

Hello,

I need some help please,

I have an indicator,which it create an object on the chart,which in the parameters it has a time value like this: 2017.09.20 12:00

1.I want to save in a variable the current date and time,which it will have value like this too:2017.09.19 17:00

Then i want to compare that too values,this i can do it,i have done that code.

2.Can i compare it without problem that values?

Thanks

whroeder1
17122
whroeder1  
mpantogi:

I need some help please,

I have an indicator,which it create an object on the chart,which in the parameters it has a time value like this: 2017.09.20 12:00

1.I want to save in a variable the current date and time,which it will have value like this too:2017.09.19 17:00

Then i want to compare that too values,this i can do it,i have done that code.

2.Can i compare it without problem that values?

  1. Help you with what? You haven't stated a problem. Show us your attempt and state the nature of your problem.
              No free help
              urgent help.

  2. You have an indicator. You need to find out the name of the object, or the pattern if it creates multiple objects and find the name of the one you want.
  3. So read the time. Perhaps you should read the manual.
              ObjectGetInteger - Object Functions - MQL4 Reference

  4. Make up your mind, either you know how to compare them ("i have done that code,") or you don't ("Can i compare it.")
mpantogi
323
mpantogi  
whroeder1:
  1. Help you with what? You haven't stated a problem. Show us your attempt and state the nature of your problem.
              No free help
              urgent help.

  2. You have an indicator. You need to find out the name of the object, or the pattern if it creates multiple objects and find the name of the one you want.
  3. So read the time. Perhaps you should read the manual.
              ObjectGetInteger - Object Functions - MQL4 Reference

  4. Make up your mind, either you know how to compare them ("i have done that code,") or you don't ("Can i compare it.")

1.I use EA Builder to develop my Ea ,i don't have good knowledge of custom mql4 code.

2.I know the name of the object.The object on chart has parameters like the picture.I am interesting only for the time parameter.

3.I don't want to know how to get the time value of the object, i will do it that with EA builder much easier.

I want help only, how to set a variable(MyDateTime) ,which can hold a value like this 2017.09.19 17:00.

4.I ask if is possible to be a condition If MyDateTime(2017.09.19 17:00) < ObjectTime(2017.09.20 12:00)  do that......!Can that values be compared?

Files:
Untitled.jpg 67 kb
whroeder1
17122
whroeder1  
mpantogi:

1.I use EA Builder

3.I don't want to know how to get the time value of the object, i will do it that with EA builder much easier. I want help only, how to set a variable(MyDateTime) ,

  1. EA builder, fxDreema, EATree, MQL5 Wizard, etc. are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned to the language up front, and then just wrote it.
    • Since you haven't learned MQL4/5, therefor there is no common language for us to communicate. If you ask for help, how can we? If we suggest a OrderSelect loop with Magic Number and Symbol filtering, to find the current order, can you code that? Doubtful.
                Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum
      We're not going to code it for you and even if we did, would you know where to put it and how to integrate it into "your" code?
      We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own.
    • EA builder makes bad code counting up while closing multiple orders.
      EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time. New candle - MQL4 forum
      EA builder makes bad code, not adjusting for 4/5 digit brokers, TP/SL and slippage.
      EA builder makes bad code, not adjusting for ECN brokers. (pre-Build 500)
      EA builder makes bad code, not checking return codes.
      EATree uses objects on chart to save values - not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)

  2. You know how to get a object's value with EA builder, but you don't know how to assign that value to a variable with EA builder? How can we possibly help you, there is no common language for us to communicate.
mpantogi
323
mpantogi  

Of course there no way to communicate with you,because you told me irrelevant things.If you don't want to help,don't answer.

I choose to build a EA using EA builder and 18.000 lines code builded with that without error look to me very well.

1.I don't ask you to debug me anything.

2.Yes ,i know how to intergrate it into my code

3.No need to suggest me OrderSelect loop with Magic Number and Symbol filtering, No need that.

4.The answer for someone who knows MQL4 is very simple for that i asked.It will be something like this:

Example: for declaration of variables do that: datetime MyDate=0;

               for adding value to my MyDate do that: MyDate=Timecurrent();(added value like this 2017.09.19 17:00)

              Yes or no,if that values can be compared.

Marco vd Heijden
Moderator
6138
Marco vd Heijden  

Yes.

nicholishen
1546
nicholishen  
datetime time = (datetime)ObjectGetInteger(0,"object_name",OBJPROP_TIME);
mpantogi
323
mpantogi  
nicholishen:

Thank you

Jack Thomas
1725
Jack Thomas  

nicholishen:

datetime time = (datetime)ObjectGetInteger(0,"object_name",OBJPROP_TIME);

Why spoon feed the answers to people like that?

The OP already said they were using an EA builder and not actually coding the system.
All they needed to do was look in the MQL documentation and they could have found the answer.


They're just being lazy and wanted other people to do the work for them for free.
whroeder1
17122
whroeder1  

Exactly what I already said

You know how to get a object's value with EA builder, but you don't know how to assign that value to a variable with EA builder? How can we possibly help you, there is no common language for us to communicate.

Until they can state a problem and show us their attempt and state the nature of their problem, they are asking us to code it for them. There are no slaves here; they are wasting everyone's time, how rude is that?
mpantogi
323
mpantogi  
whroeder1:

Exactly what I already said

Until they can state a problem and show us their attempt and state the nature of their problem, they are asking us to code it for them. There are no slaves here; they are wasting everyone's time, how rude is that?

I don't understand your annoyance.So everyone who knows forex and want to automate the strategie must know mql4?We are not all programers.

I ask 2 lines code for help me bust my strategie for some expert.I will be sure for the output that's way,but not if i done it and tring to find the errors for that.


Ιs at the disposal of everyone to help if they want.Of cource there are people @Jack Thomas who get money from programming mql4,so that's why they are annoyed of that.


12
To add comments, please log in or register