-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathComm_Channel_Index.Indicator.CS
More file actions
77 lines (65 loc) · 2.29 KB
/
Comm_Channel_Index.Indicator.CS
File metadata and controls
77 lines (65 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Drawing;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
public class Comm_Channel_Index : IndicatorObject
{
private VariableSeries<Double> m_ccivalue;
private IPlotObject Plot1;
private IPlotObject Plot2;
private IPlotObject Plot3;
public Comm_Channel_Index(object ctx) :
base(ctx){
overbcolor = Color.Red;
overscolor = Color.Cyan;
length = 14;
oversold = (-1*100);
overbought = 100;
}
[Input]
public int length { get; set; }
[Input]
public double oversold { get; set; }
[Input]
public double overbought { get; set; }
[Input]
public Color overscolor { get; set; }
[Input]
public Color overbcolor { get; set; }
protected override void Create(){
m_ccivalue = new VariableSeries<Double>(this);
Plot1 =
AddPlot(new PlotAttributes("CCI", 0, ColorTranslator.FromWin32(10789024),
Color.Empty, 0, 0, true));
Plot2 =
AddPlot(new PlotAttributes("OverBot", 0, Color.Green,
Color.Empty, 0, 0, true));
Plot3 =
AddPlot(new PlotAttributes("OverSld", 0, Color.Green,
Color.Empty, 0, 0, true));
}
protected override void CalcBar(){
m_ccivalue.Value = Bars.CCI(length);
Plot1.Set(0, m_ccivalue.Value);
Plot2.Set(0, overbought);
Plot3.Set(0, oversold);
if (PublicFunctions.DoubleGreater(m_ccivalue.Value, overbought)){
Plot1.Colors[0] = overbcolor;
}
else{
if (PublicFunctions.DoubleLess(m_ccivalue.Value, oversold)){
Plot1.Colors[0] = overscolor;
}
}
if (this.CrossesOver(m_ccivalue, oversold)){
Alerts.Alert("Indicator exiting oversold zone");
}
else{
if (this.CrossesUnder(m_ccivalue, overbought)){
Alerts.Alert("Indicator exiting overbought zone");
}
}
}
}
}