  
等级: 版主
- 注册:
- 2021-5-25
- 曾用名:
|
彭:@微信@微信联系人 8/6 13:55:20
MA5:MA(CLOSE,3);
MA10:MA(CLOSE,5);
多:=cross(ma5,ma10);
空:=cross(ma10,ma5);
DRAWTEXT(空 AND C<REF(L,1) ,H+2,'▼'),COLORGREEN;
DRAWTEXT(多 AND C>REF(H,1) ,L-2,'▲'),COLORFF00FF;
//交易条件
jincha:=多 AND C>REF(H,1); //开多平空条件
sicha:=空 AND C<REF(L,1); //开空平多条件
tbuyh:=tbuyholding(1); //多头持仓
tsellh:=tsellholding(1); //空头持仓
//开仓语句
if jincha and tbuyh=0 then tbuy(1,1,mkt); // 开多语句
if sicha and tsellh=0 then tbuyshort(1,1,mkt); // 开空语句
if jincha and tsellh<0 then begin
tsellshort(1,1,mkt); // 平空
tbuy(1,1,mkt); // 开多
end
if sicha and tbuyh>0 then BEGIN
tsell(1,1,mkt); // 平多
tbuyshort(1,1,mkt); // 开空
END
|
|