-
Notifications
You must be signed in to change notification settings - Fork 6
/
C_Hammer_HangingMan.Indicator.CS
69 lines (57 loc) · 2.08 KB
/
C_Hammer_HangingMan.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Drawing;
namespace PowerLanguage.Indicator
{
[SameAsSymbol(true)]
public class C_Hammer_HangingMan : IndicatorObject
{
private Function.C_Hammer_HangingMan m_c_hammer_hangingman1;
private VariableObject<int> m_ohammer;
private VariableObject<int> m_ohangingman;
private IPlotObject Plot1;
private IPlotObject Plot2;
public C_Hammer_HangingMan(object ctx) :
base(ctx){
factor = 2;
length = 14;
}
[Input]
public int length { get; set; }
[Input]
public double factor { get; set; }
protected override void Create(){
m_c_hammer_hangingman1 = new Function.C_Hammer_HangingMan(this);
m_ohammer = new VariableObject<int>(this);
m_ohangingman = new VariableObject<int>(this);
Plot1 =
AddPlot(new PlotAttributes("Hammer", EPlotShapes.Point,
Color.Cyan, Color.Empty, 4, 0,
true));
Plot2 =
AddPlot(new PlotAttributes("HangMan", EPlotShapes.Point,
Color.Blue, Color.Empty, 4, 0,
true));
}
protected override void StartCalc(){
m_c_hammer_hangingman1.length = length;
m_c_hammer_hangingman1.factor = factor;
m_c_hammer_hangingman1.ohammer = m_ohammer;
m_c_hammer_hangingman1.ohangingman = m_ohangingman;
m_ohammer.DefaultValue = 0;
m_ohangingman.DefaultValue = 0;
}
protected override void CalcBar(){
m_c_hammer_hangingman1.Call();
if (m_ohammer.Value == 1){
Plot1.Set(0, Bars.High[0]);
Alerts.Alert("Hammer");
}
else{
if (m_ohangingman.Value == 1){
Plot2.Set(0, Bars.Low[0]);
Alerts.Alert("HangingMan");
}
}
}
}
}