Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bars.values[1].plot(ax=ax1, color='r', lw=2.)
- # Plot two charts to assess trades and equity curve
- fig = plt.figure()
- fig.patch.set_facecolor('white') # Set the outer colour to white
- ax1 = fig.add_subplot(211, ylabel='Price in $')
- # Plot the AAPL closing price overlaid with the moving averages
- bars.values[1].plot(ax=ax1, color='r', lw=2.)
- signals[['short_mavg', 'long_mavg']].plot(ax=ax1, lw=2.)
- # Plot the "buy" trades against AAPL
- ax1.plot(signals.ix[signals.positions == 1.0].index,
- signals.short_mavg[signals.positions == 1.0],
- '^', markersize=10, color='m')
- # Plot the "sell" trades against AAPL
- ax1.plot(signals.ix[signals.positions == -1.0].index,
- signals.short_mavg[signals.positions == -1.0],
- 'v', markersize=10, color='k')
Add Comment
Please, Sign In to add comment