It is no problem to place GTC orders outside market hours, because that's a purpose of these orders. But your code is wrong. Look in the examples about how to set the trade mode to GTC.