以下为本人为文华财经行情分析软件写的混沌交易之基本分形公式

[复制链接]
查看275 | 回复0 | 2021-8-22 16:25:49 | 显示全部楼层 |阅读模式

以下是以下为本人为文华财经行情分析软件写的混沌交易之基本分形公式(无源码的请下载附件导入)

TMP:=OPEN-CLOSE;
 DRAWLINE(TMP>0.0001,HIGH,TMP>0.0001,OPEN,COLORCYAN);
 DRAWLINE(TMP>0.0001,LOW,TMP>0.0001,CLOSE,COLORCYAN);
 DRAWLINE(TMP<-0.0001,HIGH,TMP<-0.0001,CLOSE,COLORRED);
 DRAWLINE(TMP<-0.0001<CLOSE,LOW,TMP<-0.0001,OPEN,COLORRED);
 DRAWLINE(ABS(TMP)<0.0001,LOW,ABS(TMP)<0.0001,OPEN,COLORWHITE);
 DRAWLINE(ABS(TMP)<0.0001,HIGH,ABS(TMP)<0.0001,OPEN,COLORWHITE);
 STICKLINE(TMP>0,OPEN,CLOSE,COLORCYAN,0);
 STICKLINE(TMP<=0,OPEN,CLOSE,COLORRED,1);
 VAR1:=HIGH>=REFX(HIGH,1) && HIGH>=REFX(HIGH,2) && HIGH=HHV(HIGH,3);
 VAR2:=LOW<=REFX(LOW,1) && LOW<=REFX(LOW,2) && LOW = LLV(LOW,3);
 STICKLINE(VAR1,OPEN,CLOSE,COLORMAGENTA,0);
 STICKLINE(VAR2,OPEN,CLOSE,COLORGREEN,0);
 STICKLINE(CROSS(HIGH,REF(HIGH,BARSLAST(VAR1))),REF(HIGH,BARSLAST(VAR1)),1.002*REF(HIGH,BARSLAST(VAR1)),COLORWHITE,0);
 STICKLINE(CROSS(REF(LOW,BARSLAST(VAR2)),LOW),REF(LOW,BARSLAST(VAR2)),0.998*REF(LOW,BARSLAST(VAR2)),COLORYELLOW,0);
 DRAWTEXT(VAR1,1.02*HIGH,'----');
 DRAWTEXT(VAR2,1.02*LOW,'----');
 DRAWTEXT(CROSS(HIGH,REF(HIGH,BARSLAST(VAR1))),1.004*REF(HIGH,BARSLAST(VAR1)),'涨');
DRAWTEXT(CROSS(REF(LOW,BARSLAST(VAR2)),LOW),1.004*REF(LOW,BARSLAST(VAR2)),'跌');

文华财经用鳄鱼线指标(主图)

var1:=(HIGH+LOW)/2;
 Lip:REF(SMA(var1,5,1),3),COLORGREEN;
 Tooth:REF(SMA(var1,8,1),5),COLORRED;
 Jaw:REF(SMA(var1,13,1),8),COLORBLUE;

//{平衡线}
P1:=REF(HIGH,1)>HIGH AND REF(HIGH,1)>Jaw;
 BBUY:REF(REF(HIGH,1),BARSLAST(P1)),COLORWHITE;

STICKLINE(CROSS(HIGH,BBUY) AND LOW>BBUY,(HIGH+LOW)/2,(HIGH+LOW)/2,COLORWHITE,0);
 STICKLINE(CROSS(HIGH,BBUY) AND LOW<=BBUY,BBUY,BBUY,COLORWHITE,0);
 P2:=REF(LOW,1)<LOW AND REF(LOW,1)<Jaw;
 BSELL:REF(REF(LOW,1),BARSLAST(P2)),COLORMAGENTA;


 STICKLINE(CROSS(BSELL,LOW) AND HIGH<BSELL,(HIGH+LOW)/2,(HIGH+LOW)/2,COLORMAGENTA,0);
 STICKLINE(CROSS(BSELL,LOW) AND HIGH>=BSELL,BSELL,BSELL,COLORMAGENTA,0);

ho:=HIGH>REF(HIGH,1) AND HIGH>REF(HIGH,2) AND HIGH>=REFX(HIGH,1) AND IFELSE(HIGH=REFX(HIGH,2),HIGH>REFX(HIGH,3),HIGH>REFX(HIGH,2));
 fxh:=CROSS(ho,0.9);
 hh:=REF(HIGH,BARSLAST(fxh));
 lo:=LOW<REF(LOW,1) AND LOW<REF(LOW,2) AND LOW<=REFX(LOW,1) AND IFELSE(LOW=REFX(LOW,2),LOW<REFX(LOW,3),LOW<REFX(LOW,2));
 fxl:=CROSS(lo,0.9);
 ll:=REF(LOW,BARSLAST(fxl));
 //DRAWSL(ll,LOW,0,2,0, COLORGREEN);
 //DRAWSL(hh,HIGH,0,2,0, COLORRED);
 //SFX: hh, POINTDOT,ColorEA91B5;
 STICKLINE(CLOSE,hh,hh,COLORRED,0);
 //XFX: ll, POINTDOT,Color3791B5;
 STICKLINE(CLOSE,ll,ll,COLORYELLOW,0);

Y:=(HIGH+LOW)/2;
 //AO:=MA(Var1,5)-MA(Var1,34);
 AC:=MA(Y,5)-MA(Y,34)-MA(MA(Y,5)-MA(Y,34),5);
 ac1:=REF(AC,1);
 //{STICKLINE(AC>ac1,20,ac+20,8,0),colorRED;}
 //{STICKLINE(AC<ac1,20,ac+20,8,0),colorgreen;}
 Var1:=(HIGH+LOW)/2;
 AO:=MA(Var1,5)-MA(Var1,35);

ao1:=REF(AO,1);
 //{STICKLINE(Ao>ao1,0,ao,8,0),colorRED;}
 //{STICKLINE(Ao<ao1,0,ao,8,0),colorgreen;}

STICKLINE(AC>ac1 AND AO>ao1,HIGH,LOW,COLORRED,0);
 m:=IFELSE(CLOSE>OPEN,0,1);
 STICKLINE(AC>ac1 AND AO>ao1 AND CLOSE<OPEN,CLOSE,OPEN,colorred,1);
 STICKLINE(AC>ac1 AND AO>ao1 AND CLOSE>OPEN,CLOSE,OPEN,colorred,0);
 STICKLINE(AC>ac1 AND AO<ao1 OR AC<ac1 AND AO>ao1,HIGH,LOW,COLORLIGHTGREY,0);
 STICKLINE((AC>ac1 AND AO<ao1 OR AC<ac1 AND AO>ao1) AND CLOSE>OPEN,CLOSE,OPEN,COLORLIGHTGREY,0);
 STICKLINE((AC>ac1 AND AO<ao1 OR AC<ac1 AND AO>ao1) AND CLOSE<OPEN,CLOSE,OPEN,COLORLIGHTGREY,1);
 STICKLINE(AC<ac1 AND AO<ao1,HIGH,LOW,COLORGREEN,0);
 STICKLINE(AC<ac1 AND AO<ao1 AND CLOSE>OPEN,CLOSE,OPEN,COLORGREEN,0);
 STICKLINE(AC<ac1 AND AO<ao1 AND CLOSE<OPEN,CLOSE,OPEN,COLORGREEN,1);

R1:=REF(SMA(Y,8,1),5);
 R2:=IFELSE(C<R1,0,R1);
 R3:=IFELSE(C>R1,0,R1);

//{========AO及AC方向========}
DRAWTEXT(ISLASTBAR AND AO>REF(AO,1) AND AC>REF(AC,1),1.0004*R1,'↑↑');
 DRAWTEXT(ISLASTBAR AND AO<REF(AO,1) AND AC<REF(AC,1),1.0004*R1,'↓↓');
 DRAWTEXT(ISLASTBAR AND AO>REF(AO,1) AND AC<REF(AC,1),1.0004*R1,'↑↓');
 DRAWTEXT(ISLASTBAR AND AO<REF(AO,1) AND AC>REF(AC,1),1.0004*R1,'↓↑');

文华财经用AC指标(副图)

//{ Chaos Accelerator/Decelerator Oscillator }
 //{ Measures acceleration -AC}
 //{ Plot AS histogram }
 Y:=(HIGH+LOW)/2;
 AC:=MA(Y,5)-MA(Y,34)-MA(MA(Y,5)-MA(Y,34),5);
 //{Put in the same window AND plot green}
 ACGreen:IFELSE(AC>REF( AC,1) ,AC,0 ),COLORRED;
 STICKLINE(AC<REF(AC,1),0,AC,COLORGREEN,1);
 //{Put in its on window AS a histogram AND plot red}
 ACRed:IFELSE(AC<REF( AC,1) ,AC,0 ),COLORGREEN;
 STICKLINE(AC>REF(AC,1),0,AC,COLORRED,1);
 ac1:=REF(AC,1);
 buy1:=REF(AC,3)<REF(ac1,3) AND REF(AC,2)<REF(ac1,2) AND REF(AC,2)<REF(AC,3) AND REF(AC,1)>REF(ac1,1) AND AC>ac1 AND COUNT(AC>0,4)=4;// {REF(AC,3)>0 AND REF(AC,1)>0 AND REF(AC,2)>0 AND AC>0};
 //DRAWICON(buy1,AC,4);
 DRAWTEXT(buy1,AC, 'B'),COLORWHITE;
 buy2:=COUNT(AC<0,4)=4 AND REF(AC,3)<REF(ac1,3) AND COUNT(AC>ac1,3)=3;
 //DRAWICON(buy2,AC,4);
 DRAWTEXT(buy2,AC, 'B'),COLORWHITE;
 buy3:=REF(AC,3)<REF(ac1,3) AND REF(AC,2)<REF(ac1,2) AND REF(AC,2)<REF(AC,3) AND COUNT(AC>ac1,2)=2 AND REF(AC,1)<0 AND AC>0;
 //DRAWICON(buy3,AC,4);
 DRAWTEXT(buy3,AC, 'B'),COLORWHITE;
 buy4:=REF(AC,4)<REF(ac1,4) AND REF(AC,3)<REF(ac1,3) AND REF(AC,3)<REF(AC,4) AND COUNT(AC>ac1,3)=3 AND REF(AC,1)<0 AND AC>0;
 //DRAWICON(buy4,AC,4) ALIGN0;
 DRAWTEXT(buy4,AC, 'B'),COLORWHITE;


 s1:=REF(AC,3)>REF(ac1,3) AND REF(AC,2)>REF(ac1,2) AND REF(AC,2)>REF(AC,3) AND REF(AC,1)<REF(ac1,1) AND AC<ac1 AND COUNT(AC<0,4)=4;// {REF(AC,3)<0 AND REF(AC,1)<0 AND REF(AC,2)<0 AND AC<0};
 //DRAWICON(s1,AC,5);
 DRAWTEXT(s1,AC, 'S'),COLORWHITE;

s2:=COUNT(AC>0,4)=4 AND REF(AC,3)>REF(ac1,3) AND COUNT(AC<ac1,3)=3;
 //DRAWICON(s2,AC,5);
 DRAWTEXT(s2,AC, 'S'),COLORWHITE;

s3:=REF(AC,3)>REF(ac1,3) AND REF(AC,2)>REF(ac1,2) AND REF(AC,2)>REF(AC,3) AND COUNT(AC<ac1,2)=2 AND REF(AC,1)>0 AND AC<0;
 //DRAWICON(s3,AC,5);
 DRAWTEXT(s3,AC, 'S'),COLORWHITE;
 s4:=REF(AC,4)>REF(ac1,4) AND REF(AC,3)>REF(ac1,3) AND REF(AC,3)>REF(AC,4) AND COUNT(AC<ac1,3)=3 AND REF(AC,1)>0 AND AC<0;
 //DRAWICON(s4,AC,5) ALIGN0;
 DRAWTEXT(s4,AC, 'S'),COLORWHITE;

文华财经用AO指标(副图)

Y:=(HIGH+LOW)/2;
 AO:=MA(Y,5)-MA(Y,34);
 AOGreen:IFELSE(AO>REF(AO,1),AO,0),COLORRED;
 STICKLINE(AO>=REF(AO,1),0,AO,COLORRED,1);
 AORed:IFELSE(AO<REF( AO,1),AO,0),COLORGREEN;
 STICKLINE(AO<REF(AO,1),0,AO,COLORGREEN,1);
 SignalLine:MA(AO,5),COLORBLUE;
 s1:=CROSS(0,AO);
 //DRAWICON(s1,AO,5),ALIGN0; //文华此函数绘图不佳
DRAWTEXT(s1,AO,'S'),COLORWHITE;
 //----------------------------以上是下穿0信号;
s2:=AO<0 AND REF(AO,1)>REF(AO,2) AND AO<REF(AO,1);
 //DRAWNUMBER(1>0,ao,lu2,0);
 //DRAWICON(s2,AO,5),ALIGN0;
 DRAWTEXT(s2,AO,'S'),COLORWHITE;
 //-----------------------------以上碟型卖出信号;

scount:=BARSLAST(AO<0);//上一次ao>0后到现在的周期数;
 //DRAWNUMBER(1>0,ao-0.1,scount,0);
 sd:=HHV(AO,scount);//求上面周期的最大ao;
 scountd:=HHVBARS(AO,scount);//求最大值到现在的周期数;
 //DRAWNUMBER(1>0,ao-0.3,scountd,0);
 s3:=AO>0 AND REF(AO,1)>REF(AO,2) AND AO<REF(AO,1);//满足峰的条件;
s31:=COUNT(s3,scountd);//满足上面条件的次数;
 //DRAWNUMBER(1>0,ao-0.5,s31,0);
 //DRAWICON(s31>=2 AND s3,AO,5),ALIGN0;
 DRAWTEXT(s31>=2 AND s3,AO,'S'),COLORWHITE;

//----------------------------以上是双峰卖出信号;
b1:=CROSS(AO,0);
 //DRAWICON(b1,AO,4),ALIGN0;
 DRAWTEXT(b1,AO,'B'),COLORWHITE;
 //----------------------------以上是上穿0信号;
b2:=AO>0 AND REF(AO,1)<REF(AO,2) AND AO>REF(AO,1) ;
 //DRAWNUMBER(1>0,AO,lu2,0);
 //DRAWICON(b2,AO,4),ALIGN0;
 DRAWTEXT(b2,AO,'B'),COLORWHITE;
 //-----------------------------以上碟型买入信号;
bcount:=BARSLAST(AO>0);//上一次ao>0后到现在的周期数;
 //DRAWNUMBER(1>0,ao-0.1,bcount,0);
 bd:=LLV(AO,bcount);//求上面周期的最小ao;
 bcountd:=LLVBARS(AO,bcount);//求最小值到现在的周期数;
 //DRAWNUMBER(1>0,AO-0.3,bcountd,0);
 b3:=AO<0 AND REF(AO,1)<REF(AO,2) AND AO>REF(AO,1);//满足峰的条件;
b31:=COUNT(b3,bcountd);//满足上面条件的次数;
 //DRAWNUMBER(1>0,ao-0.5,lu31,0);
 //DRAWICON(b31>=2 AND b3,AO,4),ALIGN0;
 DRAWTEXT(b31>=2 AND b3,AO,'B'),COLORWHITE;
 //----------------------------以上是双峰买进信号;

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则