Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
stops processing orders

Hi,

I've been playing around with a simple breakout algo, it is in very early stages and needs a lot more work to be anywhere near useful, however, I have the issue of half way through each test, it holds a position and stops placing any new trades.

Could anyone shine any light on why this is happening? Apologies if it's an obvious issue.

  • the zigzag indicator was borrowed from someone on this community, apologies, i cant remember who

Thanks,
g.

1 response

context.profit_value and context.stop_value both end up with nan. Once that happens they never change and the position is never exited.
I will leave it to you to figure out how to avoid that situation. You probably should rework your code to calculate from cost_basis which will never be nan.

cost_basis = context.portfolio.positions[security].cost_basis