掘金社区

老师,帮我改成掘金量化的Python语言Pinned highlighted

巴菲特 发表在策略研究 2020-12-14 23:56:33

策略研究
515
1
0

MACD指标,
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
MACD:=2*(DIFF-DEA);
MACD1:=REF(MACD,1);

A1:=MACD>0 && REF(MACD,1)<0 && REF(MACD,2)<=0;
A2:=MACD<0 && REF(MACD,1)>=REF(MACD1,1) && MACD>=MACD1 && REF(MACD,2)<=REF(MACD1,2) && REF(MACD,3)<=REF(MACD1,3);

B1:=MACD<0 && REF(MACD,1)>0 && REF(MACD,2)>=0;
B2:=MACD>0 && REF(MACD,1)<=REF(MACD1,1) && MACD<=MACD1 && REF(MACD,2)>=REF(MACD1,2) && REF(MACD,3)>=REF(MACD1,3);

开仓条件:如果没有多单,满足A1或A2在K线走完后开多单,有空单则先平仓在开仓
如果没有空单,满足B1或B2在K线走完后开空单,有多单则先平仓在开仓
谢谢

评论: 1

Looks like your connection to 掘金量化社区 - 量化交易者的交流社区 was lost, please wait while we try to reconnect.