input:n1(5,0,100,1),n2(20,1,100,1),short(12,1,40,1),long(26,1,100,1),m(9,1,60,1),n3(5,0,100,1),n4(20,0,100,1),zsd(1,0,10,1),lots(1,0,10,1);
//参数说明
//n1 n2 exp的两条线的参数
//short long m是macd的相关参数
//n3,n4 5日均线,20日均线
//zsd 1%止损
//lots 手数
WARNING_DISABLE:4;
exp5:=ema(c,n1);
exp20:=ema(c,n2);
DIFF:= EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA:= EMA(DIFF,M);
MACD:=2*(DIFF-DEA);
d_surround:=exp5>exp20 and macd>0;
ma5:=ma(c,n3);
ma20:=ma(c,n4);
if date>extgbdata('liu_1_enterdate') and extgbdata('liu_1_dk')=1 then extgbdataset('liu_1_dk',0);
dk1:c>ma5 and ma20>ref(ma20,1) and d_surround and (extgbdata('liu_1_holding')<=0);
if dk1 then
begin
extgbdataset('liu_1_dk',1);
extgbdataset('liu_1_enterdate',date);
end;
if extgbdata('liu_1_dk')=1 then
begin
if (extgbdata('liu_1_holing')<0) then
begin
sellshort((extgbdata('liu_1_holding')<0),0,market);
EXTGBDATASET('liu_1_holding',0);
end;
if extgbdata('liu_1_holding')=0 then
begin
buy((extgbdata('liu_1_holding')=0),lots,market);
extgbdataset('liu_1_enterprice',c);
extgbdataset('liu_1_holding',10);
end;
end;
dzy:=cross(ma5,c);
if (extgbdata('liu_1_holding')>0) then
begin
if dzy then sell(1,0,market);
extgbdataset('liu_1_holding',0);
end;
一直开多,直到没有资金,都没有出现平多的信号?
用户还是不怎么了解这个函数,这个函数不能这么用。
这种后台记录全局变量的办法不保存历史值,用户是不能用到图表上的