用高山趋势公式中的三根线编一个预警公式,谢谢! 1、二根快线DIF(红)和DEA1(白)线上穿趋势线DEA2(绿)后,在绿色趋势上第一次回踩趋势线死叉后 再金叉时预警(若要设置周期的话就设15个K线内上穿趋势线到二根快线在趋势线上金叉预警,其实就 是要求选出二根快线上穿趋势线后在趋势线上第一次回踩后的第一次金叉的股票)。 2、同时要求10均线的趋势向上。 高山趋势公式源码: M:=10000; N1:=2; B:=5; 零轴基准线:=EMA(C,M); X00:=C; X01:=0.7522406533*X00+0.3609454219*REF(X00,1)-0.03309329629*REF(X00,2)- 0.04241822779*REF(X00,3)-0.026737249*REF(X00,4)-0.007010041271*REF(X00,5)- 0.002652859952*REF(X00,6)-0.0008415042966*REF(X00,7)-0.0002891931964*REF (X00,8)-0.0000956265934*REF(X00,9)-0.0000321286052*REF(X00,10)- 0.0000106773454*REF(X00,11)-0.0000035457562*REF(X00,12)-0.0000011670713*REF (X00,13); X02:=0.7522406533*X01+0.3609454219*REF(X01,1)-0.03309329629*REF(X01,2)- 0.04241822779*REF(X01,3)-0.026737249*REF(X01,4)-0.007010041271*REF(X01,5)- 0.002652859952*REF(X01,6)-0.0008415042966*REF(X01,7)-0.0002891931964*REF (X01,8)-0.0000956265934*REF(X01,9)-0.0000321286052*REF(X01,10)- 0.0000106773454*REF(X01,11)-0.0000035457562*REF(X01,12)-0.0000011670713*REF (X01,13); X03:=0.7522406533*X02+0.3609454219*REF(X02,1)-0.03309329629*REF(X02,2)- 0.04241822779*REF(X02,3)-0.026737249*REF(X02,4)-0.007010041271*REF(X02,5)- 0.002652859952*REF(X02,6)-0.0008415042966*REF(X02,7)-0.0002891931964*REF (X02,8)-0.0000956265934*REF(X02,9)-0.0000321286052*REF(X02,10)- 0.0000106773454*REF(X02,11)-0.0000035457562*REF(X02,12)-0.0000011670713*REF (X02,13); AA:=((EMA((((EMA(X01,22)+EMA(X01,23))+EMA(X01,24))/3),2))+(EMA((((EMA (X01,24)+EMA(X01,25))+EMA(X01,26))/3),2))+(EMA((((EMA(X01,26)+EMA(X01,27)) +EMA(X01,28))/3),2))+(EMA((((EMA(X01,28)+EMA(X01,29))+EMA(X01,30))/3),2))+ (EMA((((EMA(X01,30)+EMA(X01,31))+EMA(X01,32))/3),2))+(EMA((((EMA(X01,32)+EMA (X01,33))+EMA(X01,34))/3),2)))/6; BB1:=(X01*5+X02*3+X03*1)/9; CC1:=EMA(EMA(EMA(C,N1),N1),N1); DIF1:=(BB1-零轴基准线)/零轴基准线; DEA11:=(CC1-零轴基准线)/零轴基准线; DEA21:=(AA-零轴基准线)/零轴基准线; {以下为1分钟周期:} A_DIF:=POW((DIF1+1),55)*1000; A_DEA1:=POW((DEA11+1),55)*1000; A_DEA2:=POW((DEA21+1),55)*1000; {以下为5分钟周期:} B_DIF:=POW((DIF1+1),29)*1000; B_DEA1:=POW((DEA11+1),29)*1000; B_DEA2:=POW((DEA21+1),29)*1000; {以下为15分钟周期:} D_DIF:=POW((DIF1+1),17)*1000; D_DEA1:=POW((DEA11+1),17)*1000; D_DEA2:=POW((DEA21+1),17)*1000; {以下为30分钟周期:} E_DIF:=POW((DIF1+1),9)*1000; E_DEA1:=POW((DEA11+1),9)*1000; E_DEA2:=POW((DEA21+1),9)*1000; {以下为60分钟周期:} F_DIF:=POW((DIF1+1),5)*1000; F_DEA1:=POW((DEA11+1),5)*1000; F_DEA2:=POW((DEA21+1),5)*1000; {以下为日周期:} G_DIF:=POW((DIF1+1),3)*1000; G_DEA1:=POW((DEA11+1),3)*1000; G_DEA2:=POW((DEA21+1),3)*1000; {以下为周周期:} H_DIF:=POW((DIF1+1),1)*600; H_DEA1:=POW((DEA11+1),1)*600; H_DEA2:=POW((DEA21+1),1)*600; {以下为月周期:} I_DIF:=POW((DIF1+1),1)*300; I_DEA1:=POW((DEA11+1),1)*300; I_DEA2:=POW((DEA21+1),1)*300; DIF:IF(DATATYPE=1,A_DIF,IF(DATATYPE=2,B_DIF,IF(DATATYPE=3,D_DIF,IF (DATATYPE=4,E_DIF,IF(DATATYPE=5,F_DIF,IF(DATATYPE=6,G_DIF,IF(DATATYPE=7 ,H_DIF, IF(DATATYPE=8 , I_DIF, 0)))))))),COLORRED, LINETHICK1; DEA1:IF(DATATYPE=1,A_DEA1,IF(DATATYPE=2,B_DEA1,IF(DATATYPE=3,D_DEA1,IF (DATATYPE=4,E_DEA1,IF(DATATYPE=5,F_DEA1,IF(DATATYPE=6,G_DEA1,IF (DATATYPE=7,H_DEA1,IF(DATATYPE=8,I_DEA1,0)))))))),COLORWHITE, LINETHICK1; DEA2:IF(DATATYPE=1,A_DEA2,IF(DATATYPE=2,B_DEA2,IF(DATATYPE=3,D_DEA2,IF (DATATYPE=4,E_DEA2,IF(DATATYPE=5,F_DEA2,IF(DATATYPE=6,G_DEA2,IF (DATATYPE=7,h_DEA2,IF(DATATYPE=8,I_DEA2,0)))))))),COLOR00ff00, LINETHICK1; DIF0:=(EMA(EMA(EMA(C,N1),N1),N1)-EMA(C,M))/EMA(C,M); MACD0:=POW(DIF0-DEA21,1)*B*1000; MACD00:=MACD0;
爱约股解答:
{二快线上穿绿线}
M:=10000;
N1:=2;
B:=5;
零轴基准线:=EMA(C,M);
X00:=C;
X01:=0.7522406533*X00+0.3609454219*REF(X00,1)-0.03309329629*REF(X00,2)-
0.04241822779*REF(X00,3)-0.026737249*REF(X00,4)-0.007010041271*REF(X00,5)-
0.002652859952*REF(X00,6)-0.0008415042966*REF(X00,7)-0.0002891931964*REF
(X00,8)-0.0000956265934*REF(X00,9)-0.0000321286052*REF(X00,10)-
0.0000106773454*REF(X00,11)-0.0000035457562*REF(X00,12)-0.0000011670713*REF
(X00,13);
X02:=0.7522406533*X01+0.3609454219*REF(X01,1)-0.03309329629*REF(X01,2)-
0.04241822779*REF(X01,3)-0.026737249*REF(X01,4)-0.007010041271*REF(X01,5)-
0.002652859952*REF(X01,6)-0.0008415042966*REF(X01,7)-0.0002891931964*REF
(X01,8)-0.0000956265934*REF(X01,9)-0.0000321286052*REF(X01,10)-
0.0000106773454*REF(X01,11)-0.0000035457562*REF(X01,12)-0.0000011670713*REF
(X01,13);
X03:=0.7522406533*X02+0.3609454219*REF(X02,1)-0.03309329629*REF(X02,2)-
0.04241822779*REF(X02,3)-0.026737249*REF(X02,4)-0.007010041271*REF(X02,5)-
0.002652859952*REF(X02,6)-0.0008415042966*REF(X02,7)-0.0002891931964*REF
(X02,8)-0.0000956265934*REF(X02,9)-0.0000321286052*REF(X02,10)-
0.0000106773454*REF(X02,11)-0.0000035457562*REF(X02,12)-0.0000011670713*REF
(X02,13);
AA:=((EMA((((EMA(X01,22)+EMA(X01,23))+EMA(X01,24))/3),2))+(EMA((((EMA
(X01,24)+EMA(X01,25))+EMA(X01,26))/3),2))+(EMA((((EMA(X01,26)+EMA(X01,27))
+EMA(X01,28))/3),2))+(EMA((((EMA(X01,28)+EMA(X01,29))+EMA(X01,30))/3),2))+
(EMA((((EMA(X01,30)+EMA(X01,31))+EMA(X01,32))/3),2))+(EMA((((EMA(X01,32)+EMA
(X01,33))+EMA(X01,34))/3),2)))/6;
BB1:=(X01*5+X02*3+X03*1)/9;
CC1:=EMA(EMA(EMA(C,N1),N1),N1);
DIF1:=(BB1-零轴基准线)/零轴基准线;
DEA11:=(CC1-零轴基准线)/零轴基准线;
DEA21:=(AA-零轴基准线)/零轴基准线;
{以下为1分钟周期:}
A_DIF:=POW((DIF1+1),55)*1000;
A_DEA1:=POW((DEA11+1),55)*1000;
A_DEA2:=POW((DEA21+1),55)*1000;
{以下为5分钟周期:}
B_DIF:=POW((DIF1+1),29)*1000;
B_DEA1:=POW((DEA11+1),29)*1000;
B_DEA2:=POW((DEA21+1),29)*1000;
{以下为15分钟周期:}
D_DIF:=POW((DIF1+1),17)*1000;
D_DEA1:=POW((DEA11+1),17)*1000;
D_DEA2:=POW((DEA21+1),17)*1000;
{以下为30分钟周期:}
E_DIF:=POW((DIF1+1),9)*1000;
E_DEA1:=POW((DEA11+1),9)*1000;
E_DEA2:=POW((DEA21+1),9)*1000;
{以下为60分钟周期:}
F_DIF:=POW((DIF1+1),5)*1000;
F_DEA1:=POW((DEA11+1),5)*1000;
F_DEA2:=POW((DEA21+1),5)*1000;
{以下为日周期:}
G_DIF:=POW((DIF1+1),3)*1000;
G_DEA1:=POW((DEA11+1),3)*1000;
G_DEA2:=POW((DEA21+1),3)*1000;
{以下为周周期:}
H_DIF:=POW((DIF1+1),1)*600;
H_DEA1:=POW((DEA11+1),1)*600;
H_DEA2:=POW((DEA21+1),1)*600;
{以下为月周期:}
I_DIF:=POW((DIF1+1),1)*300;
I_DEA1:=POW((DEA11+1),1)*300;
I_DEA2:=POW((DEA21+1),1)*300;
DIF:=IF(DATATYPE=1,A_DIF,IF(DATATYPE=2,B_DIF,IF(DATATYPE=3,D_DIF,IF
(DATATYPE=4,E_DIF,IF(DATATYPE=5,F_DIF,IF(DATATYPE=6,G_DIF,IF(DATATYPE=7
,H_DIF, IF(DATATYPE=8 , I_DIF, 0)))))))),COLORRED, LINETHICK1;
DEA1:=IF(DATATYPE=1,A_DEA1,IF(DATATYPE=2,B_DEA1,IF(DATATYPE=3,D_DEA1,IF
(DATATYPE=4,E_DEA1,IF(DATATYPE=5,F_DEA1,IF(DATATYPE=6,G_DEA1,IF
(DATATYPE=7,H_DEA1,IF(DATATYPE=8,I_DEA1,0)))))))),COLORWHITE, LINETHICK1;
DEA2:=IF(DATATYPE=1,A_DEA2,IF(DATATYPE=2,B_DEA2,IF(DATATYPE=3,D_DEA2,IF
(DATATYPE=4,E_DEA2,IF(DATATYPE=5,F_DEA2,IF(DATATYPE=6,G_DEA2,IF
(DATATYPE=7,h_DEA2,IF(DATATYPE=8,I_DEA2,0)))))))),COLOR00ff00, LINETHICK1;
DIF0:=(EMA(EMA(EMA(C,N1),N1),N1)-EMA(C,M))/EMA(C,M);
MACD0:=POW(DIF0-DEA21,1)*B*1000;
MACD00:=MACD0;
CROSS(DIF>DEA2 AND DEA1>DEA2,0.5);
{在绿线上,第一次金叉}
M:=10000;
N1:=2;
B:=5;
零轴基准线:=EMA(C,M);
X00:=C;
X01:=0.7522406533*X00+0.3609454219*REF(X00,1)-0.03309329629*REF(X00,2)-
0.04241822779*REF(X00,3)-0.026737249*REF(X00,4)-0.007010041271*REF(X00,5)-
0.002652859952*REF(X00,6)-0.0008415042966*REF(X00,7)-0.0002891931964*REF
(X00,8)-0.0000956265934*REF(X00,9)-0.0000321286052*REF(X00,10)-
0.0000106773454*REF(X00,11)-0.0000035457562*REF(X00,12)-0.0000011670713*REF
(X00,13);
X02:=0.7522406533*X01+0.3609454219*REF(X01,1)-0.03309329629*REF(X01,2)-
0.04241822779*REF(X01,3)-0.026737249*REF(X01,4)-0.007010041271*REF(X01,5)-
0.002652859952*REF(X01,6)-0.0008415042966*REF(X01,7)-0.0002891931964*REF
(X01,8)-0.0000956265934*REF(X01,9)-0.0000321286052*REF(X01,10)-
0.0000106773454*REF(X01,11)-0.0000035457562*REF(X01,12)-0.0000011670713*REF
(X01,13);
X03:=0.7522406533*X02+0.3609454219*REF(X02,1)-0.03309329629*REF(X02,2)-
0.04241822779*REF(X02,3)-0.026737249*REF(X02,4)-0.007010041271*REF(X02,5)-
0.002652859952*REF(X02,6)-0.0008415042966*REF(X02,7)-0.0002891931964*REF
(X02,8)-0.0000956265934*REF(X02,9)-0.0000321286052*REF(X02,10)-
0.0000106773454*REF(X02,11)-0.0000035457562*REF(X02,12)-0.0000011670713*REF
(X02,13);
AA:=((EMA((((EMA(X01,22)+EMA(X01,23))+EMA(X01,24))/3),2))+(EMA((((EMA
(X01,24)+EMA(X01,25))+EMA(X01,26))/3),2))+(EMA((((EMA(X01,26)+EMA(X01,27))
+EMA(X01,28))/3),2))+(EMA((((EMA(X01,28)+EMA(X01,29))+EMA(X01,30))/3),2))+
(EMA((((EMA(X01,30)+EMA(X01,31))+EMA(X01,32))/3),2))+(EMA((((EMA(X01,32)+EMA
(X01,33))+EMA(X01,34))/3),2)))/6;
BB1:=(X01*5+X02*3+X03*1)/9;
CC1:=EMA(EMA(EMA(C,N1),N1),N1);
DIF1:=(BB1-零轴基准线)/零轴基准线;
DEA11:=(CC1-零轴基准线)/零轴基准线;
DEA21:=(AA-零轴基准线)/零轴基准线;
{以下为1分钟周期:}
A_DIF:=POW((DIF1+1),55)*1000;
A_DEA1:=POW((DEA11+1),55)*1000;
A_DEA2:=POW((DEA21+1),55)*1000;
{以下为5分钟周期:}
B_DIF:=POW((DIF1+1),29)*1000;
B_DEA1:=POW((DEA11+1),29)*1000;
B_DEA2:=POW((DEA21+1),29)*1000;
{以下为15分钟周期:}
D_DIF:=POW((DIF1+1),17)*1000;
D_DEA1:=POW((DEA11+1),17)*1000;
D_DEA2:=POW((DEA21+1),17)*1000;
{以下为30分钟周期:}
E_DIF:=POW((DIF1+1),9)*1000;
E_DEA1:=POW((DEA11+1),9)*1000;
E_DEA2:=POW((DEA21+1),9)*1000;
{以下为60分钟周期:}
F_DIF:=POW((DIF1+1),5)*1000;
F_DEA1:=POW((DEA11+1),5)*1000;
F_DEA2:=POW((DEA21+1),5)*1000;
{以下为日周期:}
G_DIF:=POW((DIF1+1),3)*1000;
G_DEA1:=POW((DEA11+1),3)*1000;
G_DEA2:=POW((DEA21+1),3)*1000;
{以下为周周期:}
H_DIF:=POW((DIF1+1),1)*600;
H_DEA1:=POW((DEA11+1),1)*600;
H_DEA2:=POW((DEA21+1),1)*600;
{以下为月周期:}
I_DIF:=POW((DIF1+1),1)*300;
I_DEA1:=POW((DEA11+1),1)*300;
I_DEA2:=POW((DEA21+1),1)*300;
DIF:=IF(DATATYPE=1,A_DIF,IF(DATATYPE=2,B_DIF,IF(DATATYPE=3,D_DIF,IF
(DATATYPE=4,E_DIF,IF(DATATYPE=5,F_DIF,IF(DATATYPE=6,G_DIF,IF(DATATYPE=7
,H_DIF, IF(DATATYPE=8 , I_DIF, 0)))))))),COLORRED, LINETHICK1;
DEA1:=IF(DATATYPE=1,A_DEA1,IF(DATATYPE=2,B_DEA1,IF(DATATYPE=3,D_DEA1,IF
(DATATYPE=4,E_DEA1,IF(DATATYPE=5,F_DEA1,IF(DATATYPE=6,G_DEA1,IF
(DATATYPE=7,H_DEA1,IF(DATATYPE=8,I_DEA1,0)))))))),COLORWHITE, LINETHICK1;
DEA2:=IF(DATATYPE=1,A_DEA2,IF(DATATYPE=2,B_DEA2,IF(DATATYPE=3,D_DEA2,IF
(DATATYPE=4,E_DEA2,IF(DATATYPE=5,F_DEA2,IF(DATATYPE=6,G_DEA2,IF
(DATATYPE=7,h_DEA2,IF(DATATYPE=8,I_DEA2,0)))))))),COLOR00ff00, LINETHICK1;
DIF0:=(EMA(EMA(EMA(C,N1),N1),N1)-EMA(C,M))/EMA(C,M);
MACD0:=POW(DIF0-DEA21,1)*B*1000;
MACD00:=MACD0;
AAA:=DIF>DEA2 AND DEA1>DEA2;
CCC:=BARSLAST(AAA=0);
CROSS(COUNT(CROSS(DIF,DEA1) AND CCC>=3,CCC+1),0.5);