Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Understanding Boundary Conditions in Back Testing

Algorithms that execute Buy or Sell orders based on daily closing prices may be a bit optimistic.

The first problem (at least in Equity Securities) is that Market Makers will often close up or down a price with very low volume to balance their position. If you subscribe to intra-day trading data, you will see this in the Time and Sales Log (sometimes identified with a special acronym like "NBDLT").

The second problem with closing prices occurs when there is a large bid or offer volume available. Even though a price may have been executed, your algorithm may not necessarily have been a benefactor.

Establishing a boundary upon which your program clearly crosses is more accurate then assuming it has participated in a price simply because a security has traded there. For example - a boundary condition may be, "Buy at $x, if $close < $x". In this case, you can be more certain that the routine will have been properly executed since the security traded below your Boundary Condition.