t3 = axMiddle.text(left, top-2*height, 'MA(20)', color='r', fontsize=textsize, transform=axMiddle.transAxes) s = '%s O:%1.2f H:%1.2f L:%1.2f C:%1.2f, V:%1.1fM Chg:%+1.2f' %( time.strftime('%d-%b-%Y'), vopens[-1], vhighs[-1], vlows[-1], vcloses[-1], vvolumes[-1]*1e-6, vcloses[-1]-vopens[-1]) t4 = axMiddle.text(0.4, top, s, fontsize=textsize, transform=axMiddle.transAxes) # now do the moviing average. I'll use a convolution to simulate a # real moving average ma5 = movavg(vopens, 5) ma20 = movavg(vopens, 20) axMiddle.plot(vind[5-1:], ma5, 'b', linewidth=1) axMiddle.plot(vind[20-1:], ma20, 'r', linewidth=1) axMiddle.set_ylim((20, 32)) axMiddle.set_yticks((25,30)) # Now do the volume overlay bars = volume_overlay(axMiddleVol, opens, closes, volumes, alpha=0.5) axMiddleVol.set_ylim((0, 3*max(vvolumes))) # use only a third of the viewlim if 1: ############### Lower axes #################
color='r', fontsize=textsize, transform=axMiddle.transAxes) s = '%s O:%1.2f H:%1.2f L:%1.2f C:%1.2f, V:%1.1fM Chg:%+1.2f' % ( time.strftime('%d-%b-%Y'), vopens[-1], vhighs[-1], vlows[-1], vcloses[-1], vvolumes[-1] * 1e-6, vcloses[-1] - vopens[-1]) t4 = axMiddle.text(0.4, top, s, fontsize=textsize, transform=axMiddle.transAxes) # now do the moviing average. I'll use a convolution to simulate a # real moving average ma5 = movavg(vopens, 5) ma20 = movavg(vopens, 20) axMiddle.plot(vind[5 - 1:], ma5, 'b', linewidth=1) axMiddle.plot(vind[20 - 1:], ma20, 'r', linewidth=1) axMiddle.set_ylim((20, 32)) axMiddle.set_yticks((25, 30)) # Now do the volume overlay bars = volume_overlay(axMiddleVol, opens, closes, volumes, alpha=0.5) axMiddleVol.set_ylim( (0, 3 * max(vvolumes))) # use only a third of the viewlim if 1: ############### Lower axes #################