My algorithm won't make trades. I don't know why. Is my structure wrong?
My algorithm won't make trades. I don't know why. Is my structure wrong?
Two reason why it maybe isn't trading...
First, add the timezone in your 'get_datetime' function. Otherwise it defaults to UTC.
time = get_datetime('US/Eastern')
Second, it appears your condition
current_returns_abs>=(2*real_avg_returns)
is never True for these particular stocks over these dates. Take that out of the 'if' statement (leaving only the time) and you get trades. Maybe logically that statement can never be True (didn't look that closely at the code) but also possible just not True very often?