1,怎么引用自己写的模块?2,想看具体的数据,怎么看?比如
n1=8000
close = history_bars(context.rb,n1, 'self', 'close',True)
def cal_macd_system(data=close,short=12,long=26,m=9):
'''
data是包含高开低收成交量的标准dataframe
short,long,m分别是macd的三个参数
返回值是包含原始数据和diff,dea,macd三个列的dataframe
'''
diff=close.ewm(adjust=False,alpha=2/(short+1),ignore_na=True).mean()-\
close.ewm(adjust=False,alpha=2/(long+1),ignore_na=True).mean()
dea=diff.ewm(adjust=False,alpha=2/(m+1),ignore_na=True).mean()
macd=2*(diff-dea)
return macd
macd=cal_macd_system()
print(macd)
想看MACD
#引用模块公式
import jzt_MyPython1
在需要地方使用
jzt_MyPython1.cal_macd_system(.......)