cc:=holding/2; if close-enterprice>=X and n<1 then begin sell(1,cc,limit,close);//开多时的盈利减仓 n:=n+1;//止盈一次后n增加至1,后续不再满足条件 end 加载到图表上,只会在历史的某一根K线执行止盈,后续不再止盈。如果想要在最新行情后止盈,需使用后台程序化功能,图表程序化无法实现。 2、历史回测只有开高低收,是看不到盘中立即止盈这个现象的,若想使用这个功能,需后台模拟。方法在于:使用固定时间间隔模式,但是除止盈外的其他条件引用上一周期的信号,称为变相的“走完一根K线” |
variable:kc_holding=0;
if 开仓条件 then
begin
buy();
kc_holding:= holding;
end
if 止盈条件 and kc_holding = holding then
begin
sell(1,holding/2,marketr);
end
if 平仓条件 then sell();