RT
开多后,用开仓的那根K线和开仓前2个K线的最低价做固定止损。帮忙写一个例子谢谢
cc:=ref(c,2);
if 条件 then
begin
buy(holding=0,1,market);
sell(holding>1,0,limit,if(c>cc,cc,c));
end
不是这个意思吧?谢谢
是开仓这个K线和开仓前2个K线比较,这3个K线的哪个LOW最小,用哪个LOW的价格做止损。
variable:p=0;//记录开仓K线和开仓前2个K线的最低价
lo2:=ref(llv(low,2),1);//前两跟K线的最低价
if con and holding=0 then
begin
buy(1,1,market);
p:=min(lo2,low);
end
if holding>0 and low<p then sell(1,1,market);