就写这个,剩下两个基本思路一样,照着写就行
//以多单为例
variable:n=0;
if 开多条件 and holding=0 then begin
下单语句;
n:=h;
end
//赋值开仓时的最高价
if h>n then n:=h;//记录开仓后的最高价
cond1:=(n-enterprice)/enterprice>0.01 ;//记录的最高价和开仓价做比对,记录是否盈利1%
if cond1 and (n-c)/c>0.5 then 平仓语句;//盈利1%以及回撤50%时平仓