-
Notifications
You must be signed in to change notification settings - Fork 6
/
ADX.Indicator.CS
51 lines (42 loc) · 1.47 KB
/
ADX.Indicator.CS
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
using System;
using System.Drawing;
namespace PowerLanguage.Indicator
{
public class ADX : IndicatorObject
{
private Function.ADX m_adx1;
private VariableSeries<Double> m_adxvalue;
private IPlotObject Plot1;
public ADX(object ctx) :
base(ctx){
length = 14;
}
[Input]
public int length { get; set; }
protected override void Create(){
m_adx1 = new Function.ADX(this);
m_adxvalue = new VariableSeries<Double>(this);
Plot1 =
AddPlot(new PlotAttributes("ADX", 0, Color.Cyan,
Color.Empty, 0, 0, true));
}
protected override void StartCalc(){
m_adx1.Length = length;
m_adxvalue.DefaultValue = 0;
}
protected override void CalcBar(){
m_adxvalue.Value = m_adx1[0];
Plot1.Set(0, m_adxvalue.Value);
if (PublicFunctions.DoubleGreater(m_adxvalue.Value, m_adxvalue[1])
&&PublicFunctions.DoubleLessEquals(m_adxvalue[1], m_adxvalue[2])){
Alerts.Alert("Indicator turning up");
}
else{
if (PublicFunctions.DoubleLess(m_adxvalue.Value, m_adxvalue[1])
&&PublicFunctions.DoubleGreaterEquals(m_adxvalue[1], m_adxvalue[2])){
Alerts.Alert("Indicator turning down");
}
}
}
}
}