Get time elapsed in a bar
Created at 02 Mar 2020, 12:13
Get time elapsed in a bar
02 Mar 2020, 12:13
Is there a way to send a command once a certain amount of time has elapsed in a bar? Also, can I get the bar duration?
If I'm reading right OnBar() just works at the start and I've been unable to find an efficient workaround. The only thing that comes to mind is telling the function to work every X time but there has to be a more elegant solution that doesn't tie me to a specific bar duration.
PanagiotisCharalampous
03 Mar 2020, 09:56
Hi OnigottoA,
You can record the time on bar opening and use the Timer and check how much time has elapsed from the bar opening. To get the bar duration just subtract the opening times of two consecutive bars.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous