这是一个简单的均线交易示例,您可以参考,根据自己的条件,尝试编写
ma1:=ma(close,5);
ma2:=ma(close,10);
ccm:=cross(ma1,ma2);
cmc:=cross(ma2,ma1);
//顺序必须主要需要根据仓位先平后开的原则
if ccm then
begin
//平空开多
sellshort(holding<0 and ccm,0);
buy(holding<=0,1);
end
//平多开空
if cmc then
begin
sell(holding>0 and cmc,0);
buyshort(holding>=0,1);
end