forked from suspended/cAlgoRobotsIndicators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path100Pip.Indicator
106 lines (81 loc) · 3.04 KB
/
100Pip.Indicator
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, AutoRescale = false, AccessRights = AccessRights.None)]
public class EnvelopeChannels : Indicator
{
public int LineBold;
public Colors LineColor;
[Parameter("Show 100PipsLevels", DefaultValue = 1)]
public bool Set100Levels { get; set; }
[Parameter("Show 50PipsLevels", DefaultValue = 0)]
public bool Set50Levels { get; set; }
[Parameter("Show 25PipsLevels", DefaultValue = 0)]
public bool Set25Levels { get; set; }
[Parameter("MinLevel", DefaultValue = 0, MinValue = 0)]
public int MinLevel { get; set; }
[Parameter("MaxLevel", DefaultValue = 200, MinValue = 2)]
public int MaxLevel { get; set; }
// line bold
[Parameter("Line bold", DefaultValue = 2, MinValue = 1, MaxValue = 5)]
public int L1 { get; set; }
// ===== linr color
[Parameter(DefaultValue = 1)]
public bool SetBlue { get; set; }
[Parameter(DefaultValue = 0)]
public bool SetRed { get; set; }
[Parameter(DefaultValue = 0)]
public bool SetWhite { get; set; }
[Parameter(DefaultValue = 0)]
public bool SetBlack { get; set; }
[Parameter(DefaultValue = 0)]
public bool SetGreen { get; set; }
public override void Calculate(int index)
{
LineBold = L1;
if (SetBlue)
{
LineColor = Colors.DodgerBlue;
}
if (SetRed)
{
LineColor = Colors.Red;
}
if (SetWhite)
{
LineColor = Colors.White;
}
if (SetBlack)
{
LineColor = Colors.Black;
}
if (SetGreen)
{
LineColor = Colors.YellowGreen;
}
if (Set100Levels && MinLevel < MaxLevel)
{
for (int i = MinLevel; i < MaxLevel; i++)
{
ChartObjects.DrawHorizontalLine("Level" + i, i * 100 * Symbol.PipSize, LineColor, LineBold, LineStyle.Solid);
}
}
if (Set25Levels && MinLevel < MaxLevel)
{
for (int i = MinLevel; i < MaxLevel; i++)
{
ChartObjects.DrawHorizontalLine("Lh1" + i, i * 100 * Symbol.PipSize + 25 * Symbol.PipSize, Colors.Red, 1, LineStyle.DotsRare);
ChartObjects.DrawHorizontalLine("Lh3" + i, i * 100 * Symbol.PipSize + 75 * Symbol.PipSize, Colors.Red, 1, LineStyle.DotsRare);
}
}
if (Set50Levels && MinLevel < MaxLevel)
{
for (int i = MinLevel; i < MaxLevel; i++)
{
ChartObjects.DrawHorizontalLine("Lh2" + i, i * 100 * Symbol.PipSize + 50 * Symbol.PipSize, Colors.YellowGreen, 1, LineStyle.Lines);
}
}
}
}
}