Hello,
I'm playing around with trailing stops, and I'm noticing some weird triggering behavior. Take the given backtest as an example, on day 1 (2015-02-18) it buys CFI, so at the beginning of day 2 it sets a trailing stop at 20.42. The stop is immediately triggered, even though I don't see any indication that the stop should be triggered (i.e. in this notebook code):
sid = symbols(['CFI'],symbol_reference_date='2015-02-18')
pricing = get_pricing(sid,start_date='2015-02-18',end_date='2015-02-19',frequency='minute')
pricing['price']
import matplotlib.pyplot as plt
plt.plot(pricing['price'].index,pricing['price'].values)
Perhaps I'm misunderstanding how stops are triggered? I should note that when it is first observed to be triggered, data for CFI is not populated, so maybe its being errantly triggered due to lack of data? Even then, the last known price is greater than the trigger that was set. Any thoughts?