以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  大神文化财经源码改成金字塔,谢谢  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=182788)

--  作者:秉蠡春秋
--  发布时间:2020/10/30 17:39:21
--  大神文化财经源码改成金字塔,谢谢
HX:=HHV(HIGH,3);
LX:=LLV(LOW,3);
H1:=IFELSE(HX<REF(HX,1)&&HX<REF(HX,2)&&HX<REF(HX,4)&&LX<REF(LX,1)&&LX<REF(LX,3)&&LX<REF(LX,5)&&OPEN>CLOSE&&(HHV(OPEN,0)-CLOSE)>0,REF(HX,4),0);
L1:=IFELSE(LX>REF(LX,1)&&LX>REF(LX,3)&&LX>REF(LX,5)&&HX>REF(HX,1)&&HX>REF(HX,2)&&HX>REF(HX,4)&&OPEN<CLOSE&&(CLOSE-LLV(OPEN,0))>0,REF(LX,4),0);
H2:=VALUEWHEN(H1>0,H1);
L2:=VALUEWHEN(L1>0,L1);
K1:=IFELSE(CLOSE>H2,-3,IFELSE(CLOSE<L2,1,0));
K2:=VALUEWHEN(K1<>0,K1);
G:=IFELSE(K2=1,H2,L2);
G1:=VALUEWHEN(ISLASTBAR,G);
DRAWNUMBER(LX>0,G1,G1,0,COLORCYAN);
TMP:=K2;
W1:=K2;
W2:=OPEN-CLOSE;
HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE);
LT:=IFELSE(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,COLORCYAN,1);
//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(TMP=1&&REF(TMP,1)=1,G,TMP=1&&REF(TMP,1)=1,REF(G,1),COLORCYAN);
DRAWLINE(TMP=-3&&REF(TMP,1)=-3,G,TMP=-3&&REF(TMP,1)=-3,REF(G,1),COLORRED);
DRAWSL(K2=1,G,0,1,0,COLORCYAN);
DRAWSL(K2=-3,G,0,1,0,COLORRED);
//DRAWTEXT(CROSS(TMP,0),HX,\'卖\');
//DRAWTEXT(CROSS(0,TMP),LX,\'买\');
MA55:=MA(CLOSE,55);
//DRAWTEXT(CROSS(TMP,0)&&CLOSE<=MA55,HX,\'卖↓\');
//DRAWTEXT(CROSS(0,TMP)&&CLOSE>=MA55,LX,\'买↑\');








HH: =HV(H,20);
LL: =LV(L,20);
DRAWICON(CROSS(C,HH), C, 4),VALIGN0;
DRAWICON(CROSSDOWN(C,LL), C, 5);
  
KK:COUNT(K2=1&&CROSSDOWN(C,LL),BARSLAST(CROSS(K2=1,0.5))+1  ),NODRAW;
SS:COUNT(K2=-3&&CROSS(C,HH),BARSLAST(CROSS(K2=-3,0.5))+1  ),NODRAW;

K2=1&&CROSSDOWN(C,LL),SK(KK);
K2=-3&&CROSS(C,HH),BK(SS);
K2=-3,BP(SKVOL);
K2=1,SP(BKVOL);
TRADE_AGAIN(100);


--  作者:FireScript
--  发布时间:2020/11/2 11:16:35
--  
 HX:=HHV(HIGH,3);
LX:=LLV(LOW,3);
H1:=IFELSE(HX<REF(HX,1) and HX<REF(HX,2) and HX<REF(HX,4) and LX<REF(LX,1) and LX<REF(LX,3) and LX<REF(LX,5) and OPEN>CLOSE and (HHV(OPEN,0)-CLOSE)>0,REF(HX,4),0);
L1:=IFELSE(LX>REF(LX,1) and LX>REF(LX,3) and LX>REF(LX,5) and HX>REF(HX,1) and HX>REF(HX,2) and HX>REF(HX,4) and OPEN<CLOSE and (CLOSE-LLV(OPEN,0))>0,REF(LX,4),0);
H2:=VALUEWHEN(H1>0,H1);
L2:=VALUEWHEN(L1>0,L1);
K1:=IFELSE(CLOSE>H2,-3,IFELSE(CLOSE<L2,1,0));
K2:=VALUEWHEN(K1<>0,K1);
G:=IFELSE(K2=1,H2,L2);
G1:=VALUEWHEN(ISLASTBAR,G);
DRAWNUMBER(LX>0,G1,G1,0,COLORCYAN);
TMP:=K2;
W1:=K2;
W2:=OPEN-CLOSE;
HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE);
LT:=IFELSE(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,COLORCYAN,1);
//STICKLINE(W1<=0,OPEN,CLOSE,COLORRED,1);
//STICKLINE(W2>0 and W1<=0,OPEN,CLOSE,COLORRED,0);
//STICKLINE(W2>0 and W1>0,OPEN,CLOSE,COLORCYAN,0);
DRAWLINE(TMP=1 and REF(TMP,1)=1,G,TMP=1 and REF(TMP,1)=1,REF(G,1),COLORCYAN);
DRAWLINE(TMP=-3 and REF(TMP,1)=-3,G,TMP=-3 and REF(TMP,1)=-3,REF(G,1),COLORRED);
DRAWSL(K2=1,G,0,1,0,COLORCYAN);
DRAWSL(K2=-3,G,0,1,0,COLORRED);
//DRAWTEXT(CROSS(TMP,0),HX,\'卖\');
//DRAWTEXT(CROSS(0,TMP),LX,\'买\');
MA55:=MA(CLOSE,55);
//DRAWTEXT(CROSS(TMP,0) and CLOSE<=MA55,HX,\'卖↓\');
//DRAWTEXT(CROSS(0,TMP) and CLOSE>=MA55,LX,\'买↑\');








HH: =REF(HHV(H,20),1);
LL: =REF(LLV(L,20),1);
DRAWICON(CROSS(C,HH), C, 4),VALIGN0;
DRAWICON(CROSS(LL,C), C, 5);
 
KK:COUNT(K2=1 and CROSS(LL,C),BARSLAST(CROSS(K2=1,0.5))+1  ),NODRAW;
SS:COUNT(K2=-3 and CROSS(C,HH),BARSLAST(CROSS(K2=-3,0.5))+1  ),NODRAW;

IF K2=1 and CROSS(LL,C) AND HOLDING=0 THEN BUYSHORT(1,kk,MARKET);
IF K2=-3 and CROSS(C,HH) AND  HOLDING=0 THEN  BUY(1,SS,MARKET);

IF K2=-3 THEN  SELLSHORT(1,HOLDING,MARKET);
IF K2=1 THEN SELL(1,HOLDING,MARKET);;



不能保证完全一致,毕竟是其他软件环境下编写的代码,代码规范和后台机制上都有差异。我们肯定无法对其他软件代码规范也了如指掌。