Download MetaTrader 5

Time[0]

To add comments, please log in or register
Share links on the Forum. Now they have Rich Content!
Subgenius
572
Subgenius 2014.03.31 10:15 

How do I add time to Time[0] if it returns 1396270800?


Like 1 hour?


Correct me if im wrong but i may have figured that if one hour is 60seconds*60minutes then thats 3600 seconds added to Time[0].

Refrence: https://docs.mql4.com/predefined/time

Alain Verleyen
Moderator
28627
Alain Verleyen 2014.03.31 10:36  
Subgenius:

How do I add time to Time[0] if it returns 1396270800?


Like 1 hour?


Correct me if im wrong but i may have figured that if one hour is 60seconds*60minutes then thats 3600 seconds added to Time[0].

Refrence: https://docs.mql4.com/predefined/time

So add 3600, what's the problem ?
Tjipke de Vries
6280
Tjipke de Vries 2014.03.31 10:40  
Subgenius:

How do I add time to Time[0] if it returns 1396270800?


Like 1 hour?


Correct me if im wrong but i may have figured that if one hour is 60seconds*60minutes then thats 3600 seconds added to Time[0].

Refrence: https://docs.mql4.com/predefined/time

Time[0] = Time[0] + 3600;
You can't change Time[0] .... it is openingtime of last candel brokertime

You can make a new variable which is calculating

datetime mytime = Time[0] + 3600;

but this is not adding a hour to Time[0].

Subgenius
572
Subgenius 2014.03.31 10:48  
deVries:


You can't change Time[0] .... it is openingtime of last candel brokertime

You can make a new variable which is calculating

but this is not adding a hour to Time[0].

1396270800
+
3600 (seconds)
=1396274400

i got that. infact this is my code on that to close the order in one hour...

//--CLOSE ORDERS
   if(OpenOrdersFound==TRUE && Time[0] >= lastOrderOpenTime + 3600)
      {
      lastOrderCloseTime = lastOrderOpenTime + 3600;
      lastcloseprice = Close[0];
      if(_signal==BUY)
         {
         CloseOrder(BUY);
         DrawCloseArrow(BUY);
         DrawCloseTrendLine(BUY);         
         }
      if(_signal==SELL)
         {
         CloseOrder(SELL);
         DrawCloseArrow(SELL);
         DrawCloseTrendLine(SELL);
         }
      }

I wanted to also count down using Time[0].

What about counting down in minutes from 60 (minutes) from Time[0]?
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.03.31 10:51  
Subgenius:

What about counting down in minutes from 60 (minutes) from Time[0]?

What actually you wanted to achieve here? There must be reasons why.
Subgenius
572
Subgenius 2014.03.31 10:57  
deysmacro:

What actually you wanted to achieve here? There must be reasons why.

I am using Time[0] time when a signal occurs, and I am also passing this to sub routines for closing the order out and place arrows like it was an order dragged from the order history.


What do I want with a count down using the Time[0]? I am sending the time left till the order will close to a label.



The execution is on ticks. I dont know if there is some clever way to do this or not.

It might be overkill

Tjipke de Vries
6280
Tjipke de Vries 2014.03.31 11:01  
Subgenius:

1396270800
+
3600 (seconds)
=1396274400

i got that. I wanted to also count down using Time[0].

What about counting down in minutes from 60 (minutes) from Time[0]?

What's the problem ?
Subgenius
572
Subgenius 2014.03.31 11:05  
deVries:

What's the problem ?

No i think i wont worry about it i just want to show 60-Minute()

i got it


thanks anyway all

/
To add comments, please log in or register