看上去很简单的代码,但如何用VB实现呢,无从下手,请高手帮忙!
variable:tr=0,up=0,dn=0;TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR1,20);
median:= (high + low) / 2;
up:= median+atr * 3;
dn:= median-atr * 3;
tr:=if(c>ref(up,1),1,if(c<ref(dn,1),-1,tr));
flag:=tr<0 and ref(tr,1)>0;
flagh:=tr>0 and ref(tr,1)<0;
dn:=if(tr>0 and dn<ref(dn,1),ref(dn,1),dn);
up:=if(tr<0 and up>ref(up,1),ref(up,1),up);
up:=if(flag,median + atr * M,up);
dn:=if(flagh,median - atr * M,dn);
outtr:=tr;
outup:=up;
outdn:=dn;
supertren:if(outtr=1,outdn,outup);