Guest User

Untitled

a guest
Jul 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. bars.values[1].plot(ax=ax1, color='r', lw=2.)
  2.  
  3. # Plot two charts to assess trades and equity curve
  4. fig = plt.figure()
  5. fig.patch.set_facecolor('white') # Set the outer colour to white
  6. ax1 = fig.add_subplot(211, ylabel='Price in $')
  7.  
  8. # Plot the AAPL closing price overlaid with the moving averages
  9. bars.values[1].plot(ax=ax1, color='r', lw=2.)
  10. signals[['short_mavg', 'long_mavg']].plot(ax=ax1, lw=2.)
  11.  
  12. # Plot the "buy" trades against AAPL
  13. ax1.plot(signals.ix[signals.positions == 1.0].index,
  14. signals.short_mavg[signals.positions == 1.0],
  15. '^', markersize=10, color='m')
  16.  
  17. # Plot the "sell" trades against AAPL
  18. ax1.plot(signals.ix[signals.positions == -1.0].index,
  19. signals.short_mavg[signals.positions == -1.0],
  20. 'v', markersize=10, color='k')
Add Comment
Please, Sign In to add comment