请老师帮忙编一下文华的代码 (文华财经WH8赢智V8.2)

投资者咨询:请老师帮忙编一下文华的代码 (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-7-12 9:27
 inputs:
  n1(2),
  n2(2),
  Count(30),
  lots(1);
  
variables:
  a1(0),
  a2(0),
  g1(0),
  g2(0),
  i_count(0);
 
a1=Highest(h,n2); 
a2=Lowest(l,n2);

if(currentbar=1) then begin
  g1=0;
  g2=0;
  i_count=0;
end;

print(text(date),text(Time) ,text(g1),text(g2),text(currentbar));

if(i_count=Count) then begin
  g1=0;
  g2=0;
  i_count=0;   
end;
if(c>a1[1] ) then begin 
  g1=g1-1;
  g2=g2+1;
end;

if(c<a2[1]) then begin  
  g1=g1+1;
  g2=g2-1;
end;

if(g2>n1 and MarketPosition<>1 )then
  buy lots shares next bar at market;
  
if(g1>n1 and MarketPosition<>-1)then 
  sellshort lots shares next bar at market;

i_count=i_count+1;


技术人员回复
日期:2018-7-12 9:51
 请参考:

VARIABLE:G1:=0,G2:=0;
N2:=2;
N1:=2;
A1:=HV(H,N2); 
A2:=LV(L,N2);

IF(BARPOS<=30) THEN BEGIN
  G1:=0;
  G2:=0;
END
IF(C>A1 ) THEN BEGIN 
  G1:=G1-1;
  G2:=G2+1;
END
IF(C<A2) THEN BEGIN  
  G1:=G1+1;
  G2:=G2-1;
END
G2>N1,BPK;
G1>N1,SPK;
AUTOFILTER;