(self)
| 112 | |
| 113 | |
| 114 | def demo_plot(self): |
| 115 | frame = TechWidget(self, 80, 4, 3, 1) |
| 116 | ax_candles, ax_rsi, ax_volume = frame |
| 117 | |
| 118 | # 把窗口传给techplot, 连接信号 |
| 119 | # 事件处理 |||| 绘图,数据的分离。 |
| 120 | # twins窗口。 |
| 121 | # rangew |
| 122 | # 事件从techplot传到PYQT |
| 123 | |
| 124 | try: |
| 125 | kwindow = widgets.CandleWindow("kwindow", price_data, 100, 50) |
| 126 | frame.add_widget(0, kwindow, True) |
| 127 | signal = indicator.TradingSignal(zip(zip(entry_x,entry_y),zip(exit_x,exit_y)), c=colors, lw=2) |
| 128 | frame.add_indicator(0, signal) |
| 129 | |
| 130 | # 指标窗口 |
| 131 | frame.add_indicator(0, indicator.MA(price_data.close, 20, 'MA20', 'y', 2)) |
| 132 | frame.add_indicator(0, indicator.MA(price_data.close, 30, 'MA30', 'b', 2)) |
| 133 | frame.add_indicator(1, indicator.RSI(price_data.close, 14, name='RSI', fillcolor='b')) |
| 134 | frame.add_indicator(2, indicator.Volume(price_data.open, price_data.close, price_data.vol)) |
| 135 | frame.draw_window() |
| 136 | except Exception, e: |
| 137 | print "----------------------" |
| 138 | print e |
| 139 | |
| 140 | return frame |
| 141 | |
| 142 | |
| 143 |
no test coverage detected