-
Notifications
You must be signed in to change notification settings - Fork 6
/
Consecutive_Ups.Indicator.CS
48 lines (40 loc) · 1.25 KB
/
Consecutive_Ups.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
using System;
using System.Drawing;
namespace PowerLanguage.Indicator
{
[SameAsSymbol(true)]
public class Consecutive_Ups : IndicatorObject
{
private ISeries<Double> m_price;
private VariableObject<int> m_value1;
private IPlotObject Plot1;
public Consecutive_Ups(object ctx) :
base(ctx){
consecutivebarsup = 3;
}
[Input]
public double consecutivebarsup { get; set; }
protected override void Create(){
m_value1 = new VariableObject<int>(this);
Plot1 = AddPlot(new PlotAttributes("ConsecUp", EPlotShapes.Point, Color.Yellow, Color.Empty, 4, 0, true));
}
protected override void StartCalc(){
m_price = Bars.Close;
}
protected override void CalcBar(){
if (PublicFunctions.DoubleGreater(m_price[0], m_price[1])){
m_value1.Value ++;
}
else{
m_value1.Value = 0;
}
if (PublicFunctions.DoubleGreaterEquals(m_value1.Value, consecutivebarsup)){
Plot1.Set(0, Bars.High[0]);
Alerts.Alert();
}
else{
Plot1.Reset();
}
}
}
}