xiuzong 发表于 2013-11-11 20:12:24

认真学习,必有所获!

fantasynew 发表于 2013-12-5 12:06:34

这种方法要好标准的上涨下跌趋势才行,不然止损都赔光了

l1395881 发表于 2013-12-30 02:43:20

代码是文华的,需要修改。
HH1:=IF(H<REF(H,2)&&REF(H,1)<REF(H,2),REF(H,2),0);
LL1:=IF(L>REF(L,2)&&REF(L,1)>REF(L,2),REF(L,2),0);
HH2:=VALUEWHEN(HH1>0,HH1);
LL2:=VALUEWHEN(LL1>0,LL1);
K1:=IF(CLOSE>HH2,-3,IF(CLOSE<LL2,1,0));
K2:=VALUEWHEN(K1<>0,K1);
G:=IF(K2=1,HH2,LL2);
G1:=VALUEWHEN(ISLASTBAR,G);
DRAWNUMBER(L>0,G1,G1,0),COLORCYAN;
W1:=K2;
W2:=OPEN-CLOSE;
HT:=IF(OPEN>CLOSE,OPEN,CLOSE);
LT:=IF(OPEN<CLOSE,OPEN,CLOSE);
DRAWLINE(W1=1,HIGH,W1=1,HT),COLORCYAN;
DRAWLINE(W1=1,LOW,W1=1,LT),COLORCYAN;
DRAWLINE(W1=-3,HIGH,W1=-3,HT),COLORRED;
DRAWLINE(W1=-3,LOW,W1=-3,LT),COLORRED;
{STICKLINE(W1>0,OPEN,CLOSE,1,0),COLORCYAN;
STICKLINE(W1<=0,OPEN,CLOSE,COLORRED,1);
STICKLINE(W2>0&&W1<=0,OPEN,CLOSE,COLORRED,0);
STICKLINE(W2>0&&W1>0,OPEN,CLOSE,COLORCYAN,0);}
DRAWLINE(W1=1&&REF(W1,1)=1,G,W1=1&&REF(W1,1)=1,REF(G,1)),COLORGREEN;
DRAWLINE(W1=-3&&REF(W1,1)=-3,G,W1=-3&&REF(W1,1)=-3,REF(G,1)),COLORYELLOW;
DRAWSL(K2=1,G,0,1,2),COLORGREEN;
DRAWSL(K2=-3,G,0,1,3),COLORYELLOW;

jrtj 发表于 2013-12-31 12:15:31

本帖最后由 jrtj 于 2013-12-31 12:21 编辑


一般简单的写法:
阶梯式止损
H1:=IF(l<L and L<L,max(H,H),0);
L1:=IF(H>H and H>H,min(L,L),0);
HR:=VALUEWHEN(H1>0,H1); LR:=VALUEWHEN(L1>0,L1);
K1:=IF(C>HR,-1,IF(C<LR,1,0));
K2:=VALUEWHEN(K1<>0,K1);
G:=IF(K2=1,HR,LR);
STICKLINE(K2>=0,HIGH,LOW,0.3,0),Colorcyan;
STICKLINE(K2>=0,OPEN,CLOSE,7.5,0),Colorcyan;
STICKLINE(K2<=0,HIGH,LOW,0.3,0),colorred;
STICKLINE(K2<=0,OPEN,CLOSE,7.5,0),colorred;
BuyStop: IF(K2<=0,G,INVALID),color6633FF,linethick1,NoDrawInvalid;
SellStop:IF(K2>0,G,INVALID),colorFF9933,linethick1,NoDrawInvalid;
循环的就更好

jrtj 发表于 2013-12-31 12:25:36

本帖最后由 jrtj 于 2013-12-31 15:27 编辑

:D:D循环的

jrtj 发表于 2013-12-31 12:55:19

新年快乐

jrtj 发表于 2013-12-31 12:55:36

本帖最后由 jrtj 于 2013-12-31 15:27 编辑

QQ,天骄大哥。

a13942040710 发表于 2013-12-31 19:07:50

学习,学习{:1_1:}

18012355268 发表于 2014-1-4 13:28:42

:$:$:$:$:$:$:$:$

a13942040710 发表于 2014-1-12 10:55:55

文华指标有问题
页: 1 [2] 3 4
查看完整版本: [程序代码分享] 阶梯式止损