How to use time in streak


Is it possible to incorporate time in your coding ?

I am looking to exit after a certain period of time after entry. So… is it possible to record the entry time and then I can exit after 2 hours (or any time as required). How do I do that?

How to use the “candle time” function?


1 Like

You can create a condition for exiting at a specific time like every day at 2:30 PM but not a specific period of time after entry. But I have noted this requirement.

Candle Time function is used to create condition on the basis of time
For example if you want to set a condition for running a strategy only on thrusday, you can write candle time(dayofweek) equal to 4. Monday is 1, tuesday is 2 and so on.

If you want to exit on the basis of certain information being true at a specific time, you can add that as well. Suppose, you want to exit at 3:15, you can do that as well.