龙头通道源代码通达信:
通道:(WMA(WMA(HIGH,25),25)-WMA(WMA(LOW,25),25))*1+WMA(WMA(HIGH,25),25),DOTLINE,COLORYELLOW;龙头:WMA(WMA(LOW,25),25)-(WMA(WMA(HIGH,25),25)-WMA(WMA(LOW,25),25))*1,COLORRED,LINETHICK2;通道2:EMA(龙头,25),COLORCYAN,LINETHICK2;DRAWBAND(龙头,RGB(55,0,0),通道2,RGB(0,91,0));DRAWKLINE(HIGH,OPEN,LOW,CLOSE);STICKLINE(龙头>LOW AND 龙头< HIGH,龙头,MIN(MIN(OPEN,CLOSE),龙头),3,0),COLORBLUE;STICKLINE(龙头>MIN(CLOSE,OPEN) AND 龙头< MAX(CLOSE,OPEN),龙头,MIN(OPEN,CLOSE),0,0),COLORBLUE;STICKLINE(龙头>HIGH,OPEN,CLOSE,3,0),COLORBLUE;STICKLINE(龙头>HIGH,HIGH,LOW,0,0),COLORBLUE;STICKLINE(NOT(龙头>HIGH),OPEN,CLOSE,3,0),COLORRED;STICKLINE(NOT(龙头>HIGH),HIGH,LOW,0,0),COLORRED;lijin4:=100*WMA(WMA(CLOSE-REF(CLOSE,1),6),6)/WMA(WMA(ABS(CLOSE-REF(CLOSE,1)),6),6);lijin5:=LLV(lijin4,2)=LLV(lijin4,7) AND COUNT(lijin4< 0,2) AND CROSS(lijin4,MA(lijin4,2));lijin6:=龙头>HIGH AND lijin5 AND LOW<=龙头 AND CLOSE!=LOW;lijin7:=(HIGH+LOW+CLOSE)/3;lijin8:=VOL/IF(HIGH=LOW,4,HIGH-LOW);lijin9:=IF(CAPITAL=0,lijin8*(lijin7-MIN(CLOSE,OPEN)),lijin8*IF(HIGH=LOW,1,MIN(OPEN,CLOSE)-LOW));lijin10:=IF(CAPITAL=0,lijin8*(MIN(OPEN,CLOSE)-LOW),lijin8*IF(HIGH=LOW,1,lijin7-MIN(CLOSE,OPEN)));lijin11:=IF(CAPITAL=0,lijin8*(HIGH-MAX(OPEN,CLOSE)),lijin8*IF(HIGH=LOW,1,HIGH-MAX(OPEN,CLOSE)));lijin12:=IF(CAPITAL=0,lijin8*(MAX(CLOSE,OPEN)-lijin7),lijin8*IF(HIGH=LOW,1,MAX(CLOSE,OPEN)-lijin7));lijin13:=(lijin9+lijin10-(lijin11+lijin12))/IF(CAPITAL=0,10000,10000);lijin14:=SMA(IF(CLOSE>=REF(CLOSE,1),lijin13,(-lijin13)/100),2,1);lijin15:=SMA(lijin14*120/FROMOPEN*5,2,1);lijin16:=SMA(lijin15,5,1);lijin17:=SMA(lijin16,5,1);lijin18:=CURRBARSCOUNT=1 AND CLOSE< REF(CLOSE,1);lijin19:=REF(lijin14,1)-lijin18;lijin20:=CLOSE>OPEN AND lijin19< 0.02 AND MA(CLOSE,5)>MA(CLOSE,60) AND CLOSE/REF(CLOSE,1)>=1.02 AND HIGH< 通道;lijin21:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;lijin22:=SMA(lijin21,3,1);lijin23:=SMA(lijin22,3,1);lijin24:=3*lijin22-2*lijin23;lijin25:=MA(CLOSE,5);lijin26:=MA(CLOSE,10);lijin27:=MA(CLOSE,20);lijin28:=MA(CLOSE,30);lijin29:=MA(CLOSE,60);lijin30:=lijin25/LOW;lijin31:=HIGH/lijin25;lijin32:=lijin30>1.1 AND CLOSE>OPEN;lijin33:=lijin31>1.1 AND CLOSE< OPEN;lijin34:=lijin30>1.05 AND CLOSE>OPEN AND CLOSE< lijin25 AND CLOSE< lijin26 AND CLOSE< lijin27 AND CLOSE< lijin29;lijin35:=lijin31>1.05 AND CLOSE< OPEN;lijin36:=lijin29/CLOSE;lijin37:=lijin32>0 AND lijin34>0 AND lijin36>1.5 AND lijin24>lijin22;STICKLINE(lijin37,OPEN,CLOSE,2,0),COLORFF00FF;lijin38:=HIGH>lijin26*1.15 AND CLOSE< OPEN;CTA:=REF(C,1)< 龙头 AND REF(C,2)< 龙头 AND O< 龙头 AND C>龙头;卖:DRAWICON(FILTER(lijin38>0,1),HIGH*1.02,6);买:DRAWICON(CTA,LOW*1.02,15);通达信dll龙头通道C++源代码:#include <vector>
#include <cmath>
#include <algorithm>
struct KLine {
double high;
double low;
double open;
double close;
double volume;
};
// 计算加权移动平均线 (WMA)
double WMA(const std::vector<double>& data, int period) {
double sum = 0.0;
double weightSum = 0.0;
for (int i = 0; i < period; ++i) {
double weight = (period - i);
sum += data * weight;
weightSum += weight;
}
return sum / weightSum;
}
// 计算指数移动平均线 (EMA)
double EMA(const std::vector<double>& data, int period) {
double alpha = 2.0 / (period + 1);
double ema = data[0];
for (size_t i = 1; i < data.size(); ++i) {
ema = alpha * data + (1 - alpha) * ema;
}
return ema;
}