使用mpf打印两点。打印MPL财务

2024-09-24 00:22:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在图表中打印出一些轴心点。但我对时间变量有困难

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)

enter image description here


Tags: plot格式type时间pointstwompfcandle
1条回答
网友
1楼 · 发布于 2024-09-24 00:22:10

问题出在周末。昨天的变量大于上一个指数日期。因此,最后绘制日期(lastDate)小于日期(昨天)。非常感谢你的支持

相关问题 更多 >