我现在想交易的程序很简单大致啥意思是:交易商品A,主趋势为多,交易数B:入场点位C:程序化做如下保护:【1】商品在C位置开多,手数为B;
【2】商品在C位置下跌0.5%,平多开空,手数为B
【3】商品又反弹至C位置,平空开多,手数为2B;
【4】商品又从C位置下跌0.5%,平多开空,手数为4B;
【5】商品再次反弹至C位置,平空开多,手数为8B
【6】商品如果在从C下跌0.5%,则全部平仓。
举例:交易品种:白糖 SR1505 0.5% 入场点4600 手数5手 方向做多
【1】当SR1505商品指数等于4600时,开多5手
【2】下跌至4577,平多开空5手
【3】反弹至4600,平空开多10手
【4】下跌至4577,平多开空20手
【5】反弹至4600,平空开多40手
【6】下跌至4577,平多。全部平仓
如上的交易策略, 目前手里有一个前期编辑的策略,帮忙检查看看问题在哪里?
VARIABLE:n=0,b=5;//假设初始手数5;
x:=4670;//假如是4670
if x-l>=0.005*x and holding>0 then sell(1,HOLDING,market);
if x-l>=0.005*x and holding=0 then begin//x是入场价格
buyshort(1,b,market);
b:=2*b;
end
if x-l>=0.005*x then n:=1;
if n=1 and h=x and holding<0 then sellshort(1,holding,market);
if n=1 and h=x and holding=0 then BEGIN
buy(1,1,market);
b:=2*b;
end