请老师把公式给改成通信达能用的,万分感谢!!
[其 他] 6402
//攻击形态综合预警 //------------------------------- Params GlobalVars Integer lastBar(0); Vars Begin if(lastBar==CurrentBar) Return; //保证每根K线仅预警一次 lastBar=CurrentBar; Numeric AvgBody = AverageFC(Abs(C[1]-O[1]),200); Numeric tickPrice = MinMove*PriceScale; //最小变动价位 Numeric avgHL = AverageFC(H[1]-L[1],200); String chartName=SymbolName; if(BarType==6) { chartName+="日线"; } else { chartName+=Text(BarInterval); chartName+="分钟"; } //长阳长阴 if(C[1]-O[1]>3*AvgBody) { Alert(chartName+"长阳线"); } if(O[1]-C[1]>3*AvgBody) { Alert(chartName+"长阴线"); } //一阳破三阴 Bool b3Dn = True; Numeric lastHighPrice=0; for(int i=2;i<=4;i++) { //前三根任意一根不是阴线,就不满足条件 lastHighPrice=max(lastHighPrice,H[i]); if(C[i]>=O[i]-0.5*tickPrice) { b3Dn=False; Break; } } if(b3Dn && C[1]>lastHighPrice && L[1]<H[2]) { Alert(chartName+"一阳破三阴"); } Bool b3Up = True; Numeric lastLowPrice=L[2]; for(int i=2;i<=4;i++) { //前三根任意一根不是阳线,就不满足条件 lastLowPrice=min(lastLowPrice,L[i]); if(C[i]<O[i]+0.5*tickPrice) { b3Up=False; Break; } } if(b3Up && C[1]<lastLowPrice && H[1]>L[2]) { Alert(chartName+"一阴破三阳"); } //3K反转 Numeric lineFrom = min(C[2],O[2]); Numeric lineLength = lineFrom-L[2]; if(lineLength>avgHL && C[1]>H[2] && L[2]<L[3]) { Alert(chartName+"3K反转(阳)"); } lineFrom = max(C[2],O[2]); lineLength =H[2]-lineFrom; if(lineLength>avgHL && C[1]<L[2] && H[2]>H[3]) { Alert(chartName+"3K反转(阴)"); } //口吞宝剑 lineFrom = max(C[2],O[2]); lineLength =H[2]-lineFrom; if(lineLength>avgHL && C[1]>H[2] && O[1]<H[2]) { Alert(chartName+"口吞宝剑(阳)"); } lineFrom=min(C[2],O[2]); lineLength=lineFrom-L[2]; if(lineLength>avgHL && C[1]<L[2] && O[1]>L[2]) { Alert(chartName+"口吞宝剑(阴)"); } //五连阳五连阴 Integer upCount=0; Integer dnCount=0; for(int i=1;i<=5;i++) { if(C[i]>O[i]+0.5*tickPrice) { upCount++; } if(C[i]<O[i]-0.5*tickPrice) { dnCount++; } } if(upCount==5) { Alert(chartName+"五连阳"); } if(dnCount==5) { Alert(chartName+"五连阴"); } End |