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

My intraday scalper algorithm, checks a bid and offer, calculated from a prior period of 5 minutes. If the current price, is outside the constructed bid and offer quotes it is considered a "trade." If the current price is within the bid and offer quotes, there is "no trade." Every new rolling 5 minute iteration, results in a refreshed bid and offer price.

Because I am relatively new to Python, I am unable to create a proper loop or set the condition such that the bid and offer quotes, remains the bid and offer quote, and does not refresh until a trade occurs. Can someone please provide advice on how to do this?