我想在图表中打印出一些轴心点。但我对时间变量有困难
two_points =[(lastDate,lastPivot),(yesterday,lastPivot)]
mpf= mpf.plot(dfnew_plot,type='candle',alines= two_points)
但时间变量lastDate和Dayed的格式不同:
最后日期=
2021-01-15 00:00:00
昨天=
2021-01-30
lastDate = 2021-01-15 00:00:00
yesterday= 2021-01-30
如何正确设置lastDate和Dayed的格式
最终结果图如下所示。实际上,有时代码正常工作,有时则不正常:
mpf.plot(dfnew_plot,volume=True,style='starsandstripes',datetime_format=' %d-%m',alines=
two_points,addplot=apdict\
,xrotation=45,title=(stock),type='candle',\
ylabel='ROC5= '+(ROC5) +' ' +'ROC20= '+(ROC20)+ ' ' +'ROCmean= '+(ROCmean),figscale=1.5)
问题出在周末。昨天的变量大于上一个指数日期。因此,最后绘制日期(lastDate)小于日期(昨天)。非常感谢你的支持
相关问题 更多 >
编程相关推荐