Time[0]

 

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

 
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 ?
 
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].

 
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]?
 
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.
 
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

 
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 ?
 
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

Reason: