How to recieve the date of a particular condition in an indicator?

 

Like, in a Moving Average, if the 2 lines cross, i try to take the time of their meet, and try to use in a condition. There is an option called iTime for that, but what about the date??...how can i take out the date too??

 
kmnatarajan:

Like, in a Moving Average, if the 2 lines cross, i try to take the time of their meet, and try to use in a condition. There is an option called iTime for that, but what about the date??...how can i take out the date too??

Print(TimeToStr(crossingtime,TIME_DATE),"  ",TimeToStr(crossingtime,TIME_SECONDS));

Is this what you mean ??

 
kmnatarajan:

Like, in a Moving Average, if the 2 lines cross, i try to take the time of their meet, and try to use in a condition. There is an option called iTime for that, but what about the date??...how can i take out the date too??

  1. If it crossed on bar iShift, then the time is Time[iShift] or iTime(..., iShift) Both are a datetime which include both the time and the date. Use TimeToStr or the time functions

  2. deVries: Is this what you mean ??
    TimeToStr(crossingtime, TIME_MINUTES|TIME_SECONDS)

 

hmmm, i think i wasn't clear....i have an indicator, and i want the order to be placed only when that condition is met, and not always when the condition is true.

Which is why, i thought i could use the time of the meeting condition to be placed in the EA, ....

 
kmnatarajan:

hmmm, i think i wasn't clear....i have an indicator, and i want the order to be placed only when that condition is met, and not always when the condition is true.

Which is why, i thought i could use the time of the meeting condition to be placed in the EA, ....

There is no distinction between date and time, they are the same and are represented using datetime type variables. The condition may never be met though, one one tick it may be one side of the condition and on the next tick it may be other side of the condition, it might "jump over" . . .
 
RaptorUK:
There is no distinction between date and time, they are the same and are represented using datetime type variables. The condition may never be met though, one one tick it may be one side of the condition and on the next tick it may be other side of the condition, it might "jump over" . . .

HMMM...OK...i get it...thanks for the reply...
Reason: