runmode:0;
input:length(14);
testhigh:=(high+low+close)*2/3-low;
testlow:=(high+low+close)*2/3-high;
upperband:=ref(hhv(testhigh,length),1);
lowerband:=ref(llv(testlow,length),1);
entrylongcond:=high>=upperband;
entryshortcond:=low<=lowerband;
if holding=0 then begin
if entrylongcond then
buy(1,1,limitr,max(open,upperband));
if entryshortcond then
buyshort(1,1,limitr,min(open,lowerband));
end
if holding>0 then begin
if entryshortcond then begin
sell(1,holding,limitr,min(open,lowerband));
buyshort(1,1,limitr,min(open,lowerband));
end
end
if holding<0 then begin
if entrylongcond then begin
sellshort(1,holding,limitr,max(open,upperband));
buy(1,1,limitr,max(open,upperband));
end
end
盈亏:asset-500000,noaxis,coloryellow,linethick2;
[此贴子已经被作者于2011-10-23 18:12:04编辑过]