pinbar 同花顺公式编写
时间: 2023-08-21 20:39:28 浏览: 162
pinbar 是一种常见的技术分析图形,其特征是长影线和短实体,通常用于判断市场趋势的反转和价格的支撑或阻力位。以下是 pinbar 的同花顺公式编写方法:
1. 定义变量
```
var H, L, C, O, Body, Upper, Lower, Len, Len1, Len2, Len3, Len4;
```
2. 计算实体、影线和长度
```
H = REF(HIGH,1);
L = REF(LOW,1);
C = REF(CLOSE,1);
O = REF(OPEN,1);
Body = ABS(C - O);
Upper = H - MAX(O, C);
Lower = MIN(O, C) - L;
Len = ABS(H - L);
Len1 = ABS(C - H);
Len2 = ABS(O - H);
Len3 = ABS(C - L);
Len4 = ABS(O - L);
```
3. 判断 pinbar 条件
```
Cond1 = Body < Len * 0.3;
Cond2 = Len1 < Len * 0.3;
Cond3 = Len2 < Len * 0.3;
Cond4 = Len3 < Len * 0.3;
Cond5 = Len4 < Len * 0.3;
Cond6 = Lower < Len * 0.1;
Cond7 = Upper < Len * 0.1;
Cond8 = REF(Body, 1) > REF(Len, 1) * 0.5;
Pinbar = Cond1 AND (Cond2 OR Cond3) AND (Cond4 OR Cond5) AND Cond6 AND Cond7 AND Cond8;
```
4. 输出结果
```
SETSTYLE(Pinbar, DRAWSTYLE_HISTOGRAM);
SETBKCOLOR(Pinbar, RGB(128, 128, 128));
```
以上是 pinbar 的同花顺公式编写方法,可以根据自己的需求进行调整和优化。
阅读全文