如果是一分钟周期,前三分钟的第二分钟是最低点,那么怎么可能在第三分钟的时候止损???
nn:barslast(date<>ref(date,1));
l3:min(min(ref(l,nn),ref(l,nn-1)),ref(l,nn-2));
if c<l3 then sell(1,0,market);
这个止损条件不行呀????
//开盘后前三根1分钟K线最高价上开多,前三根1分钟K线最低价下止损模型--涨停价多单止盈,收盘前2分钟全部平仓;
//适用于1分钟周期
M:=BARSLAST(DATE<>REF(DATE,1) )+1;
h3:=VALUEWHEN(TIME<=090300,HHV(HIGH,M));
l3:=VALUEWHEN(TIME<=090300,LLV(LOW,M));
//假设涨停价为 昨收的百分之4.8
upstop :=ref(c,1)*(1+0.048);
//建立多头进场条件
long:=CLOSE>h3 AND TIME<145000 AND TIME>090300;
if long then
begin
sellshort(holding < 0, 0, limitr, h3);
buy(holding = 0, 1, limitr, h3);
end
//建立多头止损条件
nn:barslast(date<>ref(date,1));
h3:max(max(ref(h,nn),ref(h,nn-1)),ref(h,nn-2));
//建立多头止盈条件(涨停价多单止盈,不开空仓)
if holding>0 and TIME<145700 AND TIME>090300 then sell(c>upstop-3*mindiff,0,thisclose);
//收盘前2分钟平仓
if time > 145700 then
begin
sell(holding > 0, 0, thisclose);
sellshort(holding < 0, 0, thisclose);
end
资产:ASSET,LINETHICK0;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
你这个只是算出最大值,没止损啊
5楼啊,不是给你了