通达信CYC指标图(cyc指标公式源码?)
1. cyc指标公式源码?
Cyc指标(Cycle Indicator)是一种用于研究股票、期货、外汇等市场的技术指标。它的计算方法比较复杂,涉及到多个参数和数学公式。以下是Cyc指标的计算公式源码,供参考:
```
// 计算Cyc指标
double[] Cyc(double[] close, int n, double w) {
// 初始化变量
double[] cycle = new double[close.Length];
double[] trend = new double[close.Length];
double[] deviation = new double[close.Length];
double[] period = new double[close.Length];
double[] smooth = new double[close.Length];
double[] dc = new double[close.Length];
double[] cyc = new double[close.Length];
double[] sum1 = new double[close.Length];
double[] sum2 = new double[close.Length];
double[] sum3 = new double[close.Length];
double[] sum4 = new double[close.Length];
double[] sum5 = new double[close.Length];
double[] sum6 = new double[close.Length];
double[] sum7 = new double[close.Length];
double[] sum8 = new double[close.Length];
double[] sum9 = new double[close.Length];
// 计算周期
for (int i = n + 1; i < close.Length; i++) {
// 计算价格波动率
double sum = 0;
for (int j = i - n; j <= i; j++) {
sum += Math.Abs(close[j] - close[j - 1]);
}
deviation[i] = sum / n;
// 计算周期
if (deviation[i] != 0) {
period[i] = 0.5 / (deviation[i] / close[i - 1]);
} else {
period[i] = period[i - 1];
}
}
// 计算趋势
for (int i = n + 1; i < close.Length; i++) {
if (i == n + 1) {
trend[i] = 0.5 * (close[i] - close[i - n]);
} else {
trend[i] = (1 - w) * trend[i - 1] + w * 0.5 * (close[i] - close[i - n]);
}
}
// 计算平滑系数
for (int i = n + 1; i < close.Length; i++) {
smooth[i] = 0.15 * period[i] + 0.85 * smooth[i - 1];
}
// 计算DC
for (int i = n + 1; i < close.Length; i++) {
dc[i] = 0.5 * (1 + Math.Cos(2 * Math.PI / smooth[i]));
}
// 计算Cyc
for (int i = n + 1; i < close.Length; i++) {
sum1[i] = 0.0962 * close[i] + 0.5769 * close[i - 2] - 0.5769 * close[i - 4] - 0.0962 * close[i - 6];
sum2[i] = 0.075 * sum1[i] + 0.54 * sum1[i - 1] + 0.54 * sum1[i - 2] + 0.075 * sum1[i - 3];
sum3[i] = sum2[i] - dc[i] * sum2[i];
sum4[i] = 0.0962 * sum3[i] + 0.5769 * sum3[i - 2] - 0.5769 * sum3[i - 4] - 0.0962 * sum3[i - 6];
sum5[i] = 0.075 * sum4[i] + 0.54 * sum4[i - 1] + 0.54 * sum4[i - 2] + 0.075 * sum4[i - 3];
sum6[i] = sum5[i] - dc[i] * sum5[i];
sum7[i] = 0.0962 * sum6[i] + 0.5769 * sum6[i - 2] - 0.5769 * sum6[i - 4] - 0.0962 * sum6[i - 6];
sum8[i] = 0.075 * sum7[i] + 0.54 * sum7[i - 1] + 0.54 * sum7[i - 2] + 0.075 * sum7[i - 3];
sum9[i] = sum8[i] - dc[i] * sum8[i];
cyc[i] = 0.2 * sum9[i] + 0.8 * cyc[i - 1];
}
return cyc;
}
```
其中,参数`close`表示收盘价序列,`n`表示周期长度,`w`表示趋势平滑系数。该源码中包含了Cyc指标的完整计算过程,可以直接调用该方法进行计算。
2. cyc指标公式源码?
Cyc指标(Cycle Indicator)是一种用于研究股票、期货、外汇等市场的技术指标。它的计算方法比较复杂,涉及到多个参数和数学公式。以下是Cyc指标的计算公式源码,供参考:
```
// 计算Cyc指标
double[] Cyc(double[] close, int n, double w) {
// 初始化变量
double[] cycle = new double[close.Length];
double[] trend = new double[close.Length];
double[] deviation = new double[close.Length];
double[] period = new double[close.Length];
double[] smooth = new double[close.Length];
double[] dc = new double[close.Length];
double[] cyc = new double[close.Length];
double[] sum1 = new double[close.Length];
double[] sum2 = new double[close.Length];
double[] sum3 = new double[close.Length];
double[] sum4 = new double[close.Length];
double[] sum5 = new double[close.Length];
double[] sum6 = new double[close.Length];
double[] sum7 = new double[close.Length];
double[] sum8 = new double[close.Length];
double[] sum9 = new double[close.Length];
// 计算周期
for (int i = n + 1; i < close.Length; i++) {
// 计算价格波动率
double sum = 0;
for (int j = i - n; j <= i; j++) {
sum += Math.Abs(close[j] - close[j - 1]);
}
deviation[i] = sum / n;
// 计算周期
if (deviation[i] != 0) {
period[i] = 0.5 / (deviation[i] / close[i - 1]);
} else {
period[i] = period[i - 1];
}
}
// 计算趋势
for (int i = n + 1; i < close.Length; i++) {
if (i == n + 1) {
trend[i] = 0.5 * (close[i] - close[i - n]);
} else {
trend[i] = (1 - w) * trend[i - 1] + w * 0.5 * (close[i] - close[i - n]);
}
}
// 计算平滑系数
for (int i = n + 1; i < close.Length; i++) {
smooth[i] = 0.15 * period[i] + 0.85 * smooth[i - 1];
}
// 计算DC
for (int i = n + 1; i < close.Length; i++) {
dc[i] = 0.5 * (1 + Math.Cos(2 * Math.PI / smooth[i]));
}
// 计算Cyc
for (int i = n + 1; i < close.Length; i++) {
sum1[i] = 0.0962 * close[i] + 0.5769 * close[i - 2] - 0.5769 * close[i - 4] - 0.0962 * close[i - 6];
sum2[i] = 0.075 * sum1[i] + 0.54 * sum1[i - 1] + 0.54 * sum1[i - 2] + 0.075 * sum1[i - 3];
sum3[i] = sum2[i] - dc[i] * sum2[i];
sum4[i] = 0.0962 * sum3[i] + 0.5769 * sum3[i - 2] - 0.5769 * sum3[i - 4] - 0.0962 * sum3[i - 6];
sum5[i] = 0.075 * sum4[i] + 0.54 * sum4[i - 1] + 0.54 * sum4[i - 2] + 0.075 * sum4[i - 3];
sum6[i] = sum5[i] - dc[i] * sum5[i];
sum7[i] = 0.0962 * sum6[i] + 0.5769 * sum6[i - 2] - 0.5769 * sum6[i - 4] - 0.0962 * sum6[i - 6];
sum8[i] = 0.075 * sum7[i] + 0.54 * sum7[i - 1] + 0.54 * sum7[i - 2] + 0.075 * sum7[i - 3];
sum9[i] = sum8[i] - dc[i] * sum8[i];
cyc[i] = 0.2 * sum9[i] + 0.8 * cyc[i - 1];
}
return cyc;
}
```
其中,参数`close`表示收盘价序列,`n`表示周期长度,`w`表示趋势平滑系数。该源码中包含了Cyc指标的完整计算过程,可以直接调用该方法进行计算。
3. cyc指标公式源码?
Cyc指标(Cycle Indicator)是一种用于研究股票、期货、外汇等市场的技术指标。它的计算方法比较复杂,涉及到多个参数和数学公式。以下是Cyc指标的计算公式源码,供参考:
```
// 计算Cyc指标
double[] Cyc(double[] close, int n, double w) {
// 初始化变量
double[] cycle = new double[close.Length];
double[] trend = new double[close.Length];
double[] deviation = new double[close.Length];
double[] period = new double[close.Length];
double[] smooth = new double[close.Length];
double[] dc = new double[close.Length];
double[] cyc = new double[close.Length];
double[] sum1 = new double[close.Length];
double[] sum2 = new double[close.Length];
double[] sum3 = new double[close.Length];
double[] sum4 = new double[close.Length];
double[] sum5 = new double[close.Length];
double[] sum6 = new double[close.Length];
double[] sum7 = new double[close.Length];
double[] sum8 = new double[close.Length];
double[] sum9 = new double[close.Length];
// 计算周期
for (int i = n + 1; i < close.Length; i++) {
// 计算价格波动率
double sum = 0;
for (int j = i - n; j <= i; j++) {
sum += Math.Abs(close[j] - close[j - 1]);
}
deviation[i] = sum / n;
// 计算周期
if (deviation[i] != 0) {
period[i] = 0.5 / (deviation[i] / close[i - 1]);
} else {
period[i] = period[i - 1];
}
}
// 计算趋势
for (int i = n + 1; i < close.Length; i++) {
if (i == n + 1) {
trend[i] = 0.5 * (close[i] - close[i - n]);
} else {
trend[i] = (1 - w) * trend[i - 1] + w * 0.5 * (close[i] - close[i - n]);
}
}
// 计算平滑系数
for (int i = n + 1; i < close.Length; i++) {
smooth[i] = 0.15 * period[i] + 0.85 * smooth[i - 1];
}
// 计算DC
for (int i = n + 1; i < close.Length; i++) {
dc[i] = 0.5 * (1 + Math.Cos(2 * Math.PI / smooth[i]));
}
// 计算Cyc
for (int i = n + 1; i < close.Length; i++) {
sum1[i] = 0.0962 * close[i] + 0.5769 * close[i - 2] - 0.5769 * close[i - 4] - 0.0962 * close[i - 6];
sum2[i] = 0.075 * sum1[i] + 0.54 * sum1[i - 1] + 0.54 * sum1[i - 2] + 0.075 * sum1[i - 3];
sum3[i] = sum2[i] - dc[i] * sum2[i];
sum4[i] = 0.0962 * sum3[i] + 0.5769 * sum3[i - 2] - 0.5769 * sum3[i - 4] - 0.0962 * sum3[i - 6];
sum5[i] = 0.075 * sum4[i] + 0.54 * sum4[i - 1] + 0.54 * sum4[i - 2] + 0.075 * sum4[i - 3];
sum6[i] = sum5[i] - dc[i] * sum5[i];
sum7[i] = 0.0962 * sum6[i] + 0.5769 * sum6[i - 2] - 0.5769 * sum6[i - 4] - 0.0962 * sum6[i - 6];
sum8[i] = 0.075 * sum7[i] + 0.54 * sum7[i - 1] + 0.54 * sum7[i - 2] + 0.075 * sum7[i - 3];
sum9[i] = sum8[i] - dc[i] * sum8[i];
cyc[i] = 0.2 * sum9[i] + 0.8 * cyc[i - 1];
}
return cyc;
}
```
其中,参数`close`表示收盘价序列,`n`表示周期长度,`w`表示趋势平滑系数。该源码中包含了Cyc指标的完整计算过程,可以直接调用该方法进行计算。
4. cyc指标公式源码?
Cyc指标(Cycle Indicator)是一种用于研究股票、期货、外汇等市场的技术指标。它的计算方法比较复杂,涉及到多个参数和数学公式。以下是Cyc指标的计算公式源码,供参考:
```
// 计算Cyc指标
double[] Cyc(double[] close, int n, double w) {
// 初始化变量
double[] cycle = new double[close.Length];
double[] trend = new double[close.Length];
double[] deviation = new double[close.Length];
double[] period = new double[close.Length];
double[] smooth = new double[close.Length];
double[] dc = new double[close.Length];
double[] cyc = new double[close.Length];
double[] sum1 = new double[close.Length];
double[] sum2 = new double[close.Length];
double[] sum3 = new double[close.Length];
double[] sum4 = new double[close.Length];
double[] sum5 = new double[close.Length];
double[] sum6 = new double[close.Length];
double[] sum7 = new double[close.Length];
double[] sum8 = new double[close.Length];
double[] sum9 = new double[close.Length];
// 计算周期
for (int i = n + 1; i < close.Length; i++) {
// 计算价格波动率
double sum = 0;
for (int j = i - n; j <= i; j++) {
sum += Math.Abs(close[j] - close[j - 1]);
}
deviation[i] = sum / n;
// 计算周期
if (deviation[i] != 0) {
period[i] = 0.5 / (deviation[i] / close[i - 1]);
} else {
period[i] = period[i - 1];
}
}
// 计算趋势
for (int i = n + 1; i < close.Length; i++) {
if (i == n + 1) {
trend[i] = 0.5 * (close[i] - close[i - n]);
} else {
trend[i] = (1 - w) * trend[i - 1] + w * 0.5 * (close[i] - close[i - n]);
}
}
// 计算平滑系数
for (int i = n + 1; i < close.Length; i++) {
smooth[i] = 0.15 * period[i] + 0.85 * smooth[i - 1];
}
// 计算DC
for (int i = n + 1; i < close.Length; i++) {
dc[i] = 0.5 * (1 + Math.Cos(2 * Math.PI / smooth[i]));
}
// 计算Cyc
for (int i = n + 1; i < close.Length; i++) {
sum1[i] = 0.0962 * close[i] + 0.5769 * close[i - 2] - 0.5769 * close[i - 4] - 0.0962 * close[i - 6];
sum2[i] = 0.075 * sum1[i] + 0.54 * sum1[i - 1] + 0.54 * sum1[i - 2] + 0.075 * sum1[i - 3];
sum3[i] = sum2[i] - dc[i] * sum2[i];
sum4[i] = 0.0962 * sum3[i] + 0.5769 * sum3[i - 2] - 0.5769 * sum3[i - 4] - 0.0962 * sum3[i - 6];
sum5[i] = 0.075 * sum4[i] + 0.54 * sum4[i - 1] + 0.54 * sum4[i - 2] + 0.075 * sum4[i - 3];
sum6[i] = sum5[i] - dc[i] * sum5[i];
sum7[i] = 0.0962 * sum6[i] + 0.5769 * sum6[i - 2] - 0.5769 * sum6[i - 4] - 0.0962 * sum6[i - 6];
sum8[i] = 0.075 * sum7[i] + 0.54 * sum7[i - 1] + 0.54 * sum7[i - 2] + 0.075 * sum7[i - 3];
sum9[i] = sum8[i] - dc[i] * sum8[i];
cyc[i] = 0.2 * sum9[i] + 0.8 * cyc[i - 1];
}
return cyc;
}
```
其中,参数`close`表示收盘价序列,`n`表示周期长度,`w`表示趋势平滑系数。该源码中包含了Cyc指标的完整计算过程,可以直接调用该方法进行计算。