金字塔加仓原则:1盈利的情况下加仓,2加仓量依次减少。
加仓的例子:
VARIABLE:ss=10;
if buycond and (holding=0 or OPENPROFIT>0) and ss>=1 then begin
buy(1,ss,marketr);
ss:=ss-1;
end
if sellcond then begin
sell(1,holding,marketr);
ss:=10;
end
减仓的请参考上边学习编写。
VARIABLE:ss=10;//ss手数初始值是10,就是第一次下单10,手 这个自己可以调
if buycond and (holding=0 or OPENPROFIT>0) and ss>=1 then begin
buy(1,ss,marketr);
ss:=ss-1;//是每次加仓比上次开仓少1手,可以改成其他数字,改成2就是每次必上次少2手
end
if sellcond then begin
sell(1,holding,marketr);
ss:=10;//平仓后把手数重置为10,第一次开仓是10手
end
ss-1是指加仓量递减,4楼例子有说明的加仓原则的
ss:=10; //ss再次赋值为10,是因为平仓之后必须重置全局变量,否则后续再开仓之后的加仓就不能正常递减。
条件恒成立
前边已经写过了if 开多条件 then buy(1,ss,marketr)
这种buy第一个参数就可以写1了
建议您先从简单的学起