-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathAccum_Dist__PrVol.Indicator.CS
More file actions
53 lines (45 loc) · 1.63 KB
/
Accum_Dist__PrVol.Indicator.CS
File metadata and controls
53 lines (45 loc) · 1.63 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
using System;
using System.Drawing;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
public class Accum_Dist__PrVol : IndicatorObject
{
private AccumulationDistribution m_accumdist1;
private VariableSeries<Double> m_accdstprvol;
private IPlotObject Plot1;
public Accum_Dist__PrVol(object ctx) :
base(ctx){
AlertLength = 14;
}
[Input]
public int AlertLength { get; set; }
protected override void Create(){
m_accumdist1 = new AccumulationDistribution(this);
m_accdstprvol = new VariableSeries<Double>(this);
Plot1 =
AddPlot(new PlotAttributes("AccDst-PrVol", 0, Color.Blue,
Color.Empty, 0, 0, true));
}
protected override void StartCalc(){
m_accumdist1.AnyVolume = Bars.TrueVolume();
}
protected override void CalcBar()
{
m_accdstprvol.Value = m_accumdist1[0];
Plot1.Set(0, m_accdstprvol.Value);
if ((( Bars.Close.LowestBar(AlertLength) == 0)
&& PublicFunctions.DoubleGreater(m_accdstprvol.LowestBar(AlertLength), 0)))
{
Alerts.Alert("Bullish divergence - new low not confirmed");
}
else{
if (((Bars.Close.HighestBar(AlertLength) == 0)
&& PublicFunctions.DoubleGreater(m_accdstprvol.HighestBar(AlertLength), 0)))
{
Alerts.Alert("Bearish divergence - new high not confirmed");
}
}
}
}
}