HHN:=ref(HHV(HIGH,20),1);
HLN:=ref(LLV(LOW,20),1);
IF H>=HHN then
begin
sellshort(holding<0,0,thisclose);
buy(holding=0,1,thisclose);
end
IF L<=HLN then
begin
sell(holding>0,0,thisclose);
buyshort(holding=0,1,thisclose);
end
现在我需要使信号点位更精确一点,并且不同品种上HHN LLN需要取不同的值,例如CU ZN上取10周期, RU RB上取20周期。
我修改成如下写法:(没信号显示了,应该是“不同品种下HHN HLN取不同的值”的写法有问题,请帮助修改,谢谢)
//不同品种下HHN HLN取不同的值
variable:con:=0;
if STRCMP(STRLEFT(STKLABEL,2) ,'CU')=0 then con:=1;
if STRCMP(STRLEFT(STKLABEL,2) ,'ZN')=0 then con:=1;
HHN:=ref(HHV(HIGH,10),1);
HLN:=ref(LLV(LOW,10),1);
if con=0 then exit;
variable:con:=0;
if STRCMP(STRLEFT(STKLABEL,2) ,'RU')=0 then con:=2;
if STRCMP(STRLEFT(STKLABEL,2) ,'RB')=0 then con:=2;
HHN:=ref(HHV(HIGH,20),1);
HLN:=ref(LLV(LOW,20),1);
if con=0 then exit;
//定义确定的myprice
IF H>=HHN then
begin
myprice:=HHN;
end
IF open>=HHN then
begin
myprice:=open;
end
IF L<=HLN then
begin
myprice:=HLN;
end
IF open<=HLN then
begin
myprice:=open;
end
//公式主体
IF H>=HHN then
begin
sellshort(holding<0,0,limitr,myprice);
buy(holding=0,1,limitr,myprice);
end
IF L<=HLN then
begin
sell(holding>0,0,limitr,myprice);
buyshort(holding=0,1,limitr,myprice);//thisclose
end
修改为以下
variable:con:=0;
if STRCMP(STRLEFT(STKLABEL,2) ,'CU')=0 then con:=1;
if STRCMP(STRLEFT(STKLABEL,2) ,'ZN')=0 then con:=1;
if STRCMP(STRLEFT(STKLABEL,2) ,'RU')=0 then con:=2;
if STRCMP(STRLEFT(STKLABEL,2) ,'RB')=0 then con:=2;
if con=0 then exit;
HHN:=ref(HHV(HIGH,10*con),1);
HLN:=ref(LLV(LOW,10*con),1);
高!
请问单字母代码品种的限定应该如何写法?
variable:con:=0;
if STRCMP(STRLEFT(STKLABEL,1) ,'M')=0 then con:=1;
if STRCMP(STRLEFT(STKLABEL,1) ,'P')=0 then con:=1;
if con=0 then exit;
这样写好象是不对的
写M 会取到MF ME
写P 会取到PB PTA
四周规则能写成VBA模板吗,方便大家学习
HHN:=ref(HHV(HIGH,20),1);
HLN:=ref(LLV(LOW,20),1);
IF H>=HHN then
begin
sellshort(holding<0,0,thisclose);
buy(holding=0,1,thisclose);
end
IF L<=HLN then
begin
sell(holding>0,0,thisclose);
buyshort(holding=0,1,thisclose);
end