[PEL] 复制代码 ma3:ma(c,10);
ma4:=ma(c,20),;
majc:cross(ma3,ma4);
masc:cross(ma4,ma3);
PARTLINE(ma4>ma3 or masc, ma4,COLORGREEN);
PARTLINE(ma4<ma3 or majc , ma4, COLORRED);
DRAWTEXT(majc,h,'买入',COLORRED);
DRAWTEXT(masc,h,'卖出',COLORGREEN);
LEN1:=SUMBARS(MAJC,1);
LEN2:=SUMBARS(MASC,1);
kd:=ma3>ma4 and COUNT(CROSS(C,MA3),LEN1)=1;
kk:=ma3<ma4 and COUNT(CROSS(MA3,C),LEN2)=1;
if kd then
begin
sellshort(holding<0,holding,market);
buy(holding=0,1,market);
end
if kk then
begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end
图表程序化的代码如上。
“红色提示买入预警 绿色提示卖出预警 ”这个预警仅仅是在图表上做文字的输出。 |