大体都能用吧 估计只有几个变量和数组没定义 定义一下不就成了
Variable: aa(0),bb(0),cc(0),dd(0),ee(0),ff(0),gg(0),hh(0);
IF MA(C,2)<MA(C,5)then aa:=1;
if MA(C,2)>MA(C,5)then aa:=-1;
if C>MA(C,40) then bb:=1;
if C<MA(C,40) then bb:=-1;
if HHVBars(C,50)>LLVBars(C,50) then cc:=1;
if HHVBars(C,50)<LLVBars(C,50) then cc:=-1;
if ((high-low)<MA((high-low),10)) and C>C[1] or ((high-low)>MA((high-low),10)) and C<C[1] then dd:=1;
if ((high-low)<MA((high-low),10)) and C<C[1] or ((high-low)>MA((high-low),10)) and C>C[1] then dd:=-1;
if C>(MA(H,15)+MA(L,15))/2 then ee:=1;
if C<(MA(H,15)+MA(L,15))/2 then ee:=-1;
if C<O and C[1]<O[1] then ff=1; else ff:=0;
if C>O and C[1]>O[1] then ff:=-1;
if L>L[1] and L[1]<LLV(L,3)[2] and C>C[1] and C[1]<C[2]then gg=1; else gg:=0;
if H<H[1] and H[1]>HHV(H,3)[2] and C<C[1] and C[1]>C[2]then gg:=-1;
if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then hh=1; else hh:=0;
if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then hh:=-1;
前面可以如此修改
最后3句:
if aa+bb+cc+dd+ee+ff+gg+hh>0 then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar, '');请解释BUY里面各个参数的含义
if aa+bb+cc+dd+ee+ff+gg+hh<0 then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar, '');请解释SELLSRHOT里面各个参数的含义
SetExitOnClose;请解释该函数的含义
SetExitOnClose;请解释该函数的含义
收盘平仓
Variable: aa(0),bb(0),cc(0),dd(0),ee(0),ff(0),gg(0),hh(0);
IF MA(C,2)<MA(C,5)then aa:=1;
if MA(C,2)>MA(C,5)then aa:=-1;
if C>MA(C,40) then bb:=1;
if C<MA(C,40) then bb:=-1;
if HHVBars(C,50)>LLVBars(C,50) then cc:=1;
if HHVBars(C,50)<LLVBars(C,50) then cc:=-1;
if ((high-low)<MA((high-low),10)) and C>C[1] or ((high-low)>MA((high-low),10)) and C<C[1] then dd:=1;
if ((high-low)<MA((high-low),10)) and C<C[1] or ((high-low)>MA((high-low),10)) and C>C[1] then dd:=-1;
if C>(MA(H,15)+MA(L,15))/2 then ee:=1;
if C<(MA(H,15)+MA(L,15))/2 then ee:=-1;
if C<O and C[1]<O[1] then ff=1; else ff:=0;
if C>O and C[1]>O[1] then ff:=-1;
if L>L[1] and L[1]<LLV(L,3)[2] and C>C[1] and C[1]<C[2]then gg=1; else gg:=0;
if H<H[1] and H[1]>HHV(H,3)[2] and C<C[1] and C[1]>C[2]then gg:=-1;
if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then hh=1; else hh:=0;
if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then hh:=-1;
if aa+bb+cc+dd+ee+ff+gg+hh>0 then buy(1,25%,limitr,close);
if aa+bb+cc+dd+ee+ff+gg+hh<0 then buyshort(1,25%,limitr,close);
通不过
if L>L[1] and L[1]<LLV(L,3)[2] and C>C[1] and C[1]<C[2]then gg=1; else gg:=0;
也通不过
我晕,怎么复制的是原来没修改过的代码
这个是修改过的
Variable: aa=0,bb=0,cc=0,dd=0,ee=0,ff=0,gg=0,hh=0;
IF MA(C,2)<MA(C,5)then aa:=1;
if MA(C,2)>MA(C,5)then aa:=-1;
if C>MA(C,40) then bb:=1;
if C<MA(C,40) then bb:=-1;
if HHVBars(C,50)>LLVBars(C,50) then cc:=1;
if HHVBars(C,50)<LLVBars(C,50) then cc:=-1;
if ((high-low)<MA((high-low),10)) and C>C[1] or ((high-low)>MA((high-low),10)) and C<C[1] then dd:=1;
if ((high-low)<MA((high-low),10)) and C<C[1] or ((high-low)>MA((high-low),10)) and C>C[1] then dd:=-1;
if C>(MA(H,15)+MA(L,15))/2 then ee:=1;
if C<(MA(H,15)+MA(L,15))/2 then ee:=-1;
if C<O and C[1]<O[1] then ff=1; else ff:=0;
if C>O and C[1]>O[1] then ff:=-1;
if L>L[1] and L[1]<ref(LLV(L,3),2) and C>C[1] and C[1]<C[2]then gg:=1; else gg:=0;
if H<H[1] and H[1]>ref(HHV(H,3),2) and C<C[1] and C[1]>C[2]then gg:=-1;
if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then hh=1; else hh:=0;
if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then hh:=-1;
Variable: aa:=0,bb:=0,cc:=0,dd:=0,ee:=0,ff:=0,gg:=0,hh:=0;
IF MA(C,2)<MA(C,5)then aa:=1;
if MA(C,2)>MA(C,5)then aa:=-1;
if C>MA(C,40) then bb:=1;
if C<MA(C,40) then bb:=-1;
if HHVBars(C,50)>LLVBars(C,50) then cc:=1;
if HHVBars(C,50)<LLVBars(C,50) then cc:=-1;
if ((high-low)<MA((high-low),10)) and C>C[1] or ((high-low)>MA((high-low),10)) and C<C[1] then dd:=1;
if ((high-low)<MA((high-low),10)) and C<C[1] or ((high-low)>MA((high-low),10)) and C>C[1] then dd:=-1;
if C>(MA(H,15)+MA(L,15))/2 then ee:=1;
if C<(MA(H,15)+MA(L,15))/2 then ee:=-1;
if C<O and C[1]<O[1] then ff=1; else ff:=0;
if C>O and C[1]>O[1] then ff:=-1;
if L>L[1] and L[1]<LLV(L,3) and C>C[1] and C[1]<C[2]then gg=1; else gg:=0;
if H<H[1] and H[1]>HHV(H,3) and C<C[1] and C[1]>C[2]then gg:=-1;
if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then hh=1; else hh:=0;
if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then hh:=-1;
if aa+bb+cc+dd+ee+ff+gg+hh>0 then buy(1,25%,limitr,close);
if aa+bb+cc+dd+ee+ff+gg+hh<0 then buyshort(1,25%,limitr,close);
收盘前平仓,以股指1分钟周期为例:
if time>151300 and time<=151500 then begin
sell(1,0,market);
sellshort(1,0,market);
end