- 精华
- 0
- 在线时间
- 335 小时
- UID
- 112550
- 积分
- 263
- 帖子
- 89
- 阅读权限
- 50
- 注册时间
- 2012-9-17
- 最后登录
- 2022-1-19
- 精华
- 0
- UID
- 112550
- 积分
- 263
- 帖子
- 89
- 主题
- 14
- 阅读权限
- 50
- 注册时间
- 2012-9-17
- 最后登录
- 2022-1-19
|
正好有个例子:- Params
- Numeric Leftstrength(3);
- Numeric Rightstrength(3);
- Numeric Length(100);
- Vars
- Numeric HighValue1;
- Numeric HighValue2;
- Numeric HighValueBar1;
- Numeric HighValueBar2;
- Numeric LowValue1;
- Numeric LowValue2;
- Numeric LowValueBar1;
- Numeric LowValueBar2;
- Bool Value1(True);
- Bool Value2(True);
- Numeric offset;
-
- Begin
- Offset = 0.15 * Average(TrueRange(), 5 ) ;
-
- if (SwingHighBar(1,H,Rightstrength+1,Length)<>-1 && SwingLowBar(1,L,Rightstrength+1,Length)<>-1)
- {
- Pivot(High,Length,Leftstrength,Rightstrength,1,1,HighValue1,HighValueBar1);
- Pivot(High,Length,Leftstrength,Rightstrength,2,1,HighValue2,HighValueBar2);
- Pivot(Low,Length,Leftstrength,Rightstrength,1,-1,LowValue1,LowValueBar1);
- Pivot(Low,Length,Leftstrength,Rightstrength,2,-1,LowValue2,LowValueBar2);
- }
- if(HighValue2 <> -1)
- {
- if(( HighValue1 >= HighValue2 - Offset ) && ( HighValue1 <= HighValue2 + Offset ))
- {
- PlotString("Swing","DT",H[HighValueBar1]+ Offset,Yellow,HighValueBar1);
- Value1 = False;
- }
- else if((HighValue1 > HighValue2 && value1))
- {
- PlotString("Swing","HH",H[HighValueBar1]+ Offset,Green,HighValueBar1);
- }
- else if((HighValue1 < HighValue2 && value1))
- {
- PlotString("Swing","LH",H[HighValueBar1]+ Offset,Red,HighValueBar1);
- }
- Value1 = True;
- }
-
-
- if(LowValue2 <> -1 )
- {
- if(( LowValue1 >= LowValue2 - Offset ) && ( LowValue1 <= LowValue2 + Offset ) )
- {
- PlotString("Swing","DB",L[LowValueBar1] - Offset,Yellow,LowValueBar1);
- Value2 = False;
- }
- else if(LowValue1 < LowValue2 && value2)
- {
- PlotString("Swing","LL",L[LowValueBar1] - Offset,Red,LowValueBar1);
- }
- else if(LowValue1 > LowValue2 && value2)
- {
- PlotString("Swing","HL",L[LowValueBar1]- Offset,Green,LowValueBar1);
- }
- Value2 = True;
- }
-
- End
复制代码 |
|