Page 1 of 1

Close position if bot does not trade for x hours

Posted: Mon Jan 22, 2018 11:57 am
by giannia

I would like to write a custom script safety that does the thing on subject. I need advice, I cannot find a method to read the last trade date.

The logic should be:

main() {
if (a position IS open)
if (hours(current_date - last_trade_date) > max_hours)
ExitPosition() ;

Thank you for any help!