Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Questions about an implementation of VWAP trading

I have questions when I look at the implementation of this algorithm:VWAP sample backtesting. The algorithm is it the
price of the security is .5% less than the 3-day volume weighted average price AND we haven't reached our maximum short, then we call the order command and sell 100 shares. Similarly, if the stock is .5% higher than the 3-day average AND we haven't reached our maximum long, then we call the order command and buy 100 shares. The order's code is here:

if price < vwap * 0.995 and notional > context.min_notional:
order(context.aapl,-100)
elif price > vwap * 1.005 and notional < context.max_notional:
order(context.aapl,+500)

The confusing part for me is that when the price is less than 0.995 VWAP, I will short 100 shares, what if it continues to drop until 2% lower than VWAP, I short another 100 shares until it reached the short limit?