-
Notifications
You must be signed in to change notification settings - Fork 6
/
Accum_Dist__BuyPr.Indicator.CS
46 lines (39 loc) · 1.42 KB
/
Accum_Dist__BuyPr.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
using System;
using System.Drawing;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
public class Accum_Dist__BuyPr : IndicatorObject
{
private LWAccDis m_lwaccdis1;
private VariableSeries<Double> m_accdstbuypr;
private IPlotObject Plot1;
public Accum_Dist__BuyPr(object ctx) :
base(ctx){
alertlength = 14;
}
[Input]
public int alertlength { get; set; }
protected override void Create(){
m_lwaccdis1 = new LWAccDis(this);
m_accdstbuypr = new VariableSeries<Double>(this);
Plot1 = AddPlot(new PlotAttributes("AccDst-BuyPr", 0, Color.Yellow, Color.Empty, 0, 0, true));
}
protected override void CalcBar(){
m_accdstbuypr.Value = m_lwaccdis1[0];
Plot1.Set(0, m_accdstbuypr.Value);
if (((Bars.Close.LowestBar(alertlength) == 0)
&& PublicFunctions.DoubleGreater(m_accdstbuypr.LowestBar(alertlength), 0)))
{
Alerts.Alert("Bullish divergence - new low not confirmed");
}
else{
if (((Bars.Close.HighestBar(alertlength) == 0)
&& PublicFunctions.DoubleGreater(m_accdstbuypr.HighestBar(alertlength), 0)))
{
Alerts.Alert("Bearish divergence - new high not confirmed");
}
}
}
}
}