-
Notifications
You must be signed in to change notification settings - Fork 6
/
Cust_Gradient_Bnd.Indicator.CS
73 lines (63 loc) · 2.41 KB
/
Cust_Gradient_Bnd.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
70
71
72
73
using System;
using System.Drawing;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
[SameAsSymbol(true)]
public class Cust_Gradient_Bnd : IndicatorObject
{
private FastK m_fastk1;
private IPlotObject Plot1;
private IPlotObject Plot2;
private IPlotObject Plot3;
private IPlotObject Plot4;
public Cust_Gradient_Bnd(object ctx) :
base(ctx){
dncolor = Color.Magenta;
upcolor = Color.Cyan;
upperbound = 100;
}
[Input]
public double lowerbound { get; set; }
[Input]
public double upperbound { get; set; }
[Input]
public Color upcolor { get; set; }
[Input]
public Color dncolor { get; set; }
protected override void Create(){
m_fastk1 = new FastK(this);
Plot1 =
AddPlot(new PlotAttributes("Plot1", EPlotShapes.BarHigh,
Color.White, Color.Empty, 0,
0,
true));
Plot2 =
AddPlot(new PlotAttributes("Plot2", EPlotShapes.BarLow,
Color.White, Color.Empty, 0,
0,
true));
Plot3 =
AddPlot(new PlotAttributes("Plot3", EPlotShapes.LeftTick,
Color.White, Color.Empty, 0,
0,
true));
Plot4 =
AddPlot(new PlotAttributes("Plot4", EPlotShapes.RightTick,
Color.White, Color.Empty, 0,
0,
true));
}
protected override void StartCalc(){
m_fastk1.stochlength = 14;
}
protected override void CalcBar(){
var m_formula = m_fastk1[0];
var m_colorlevel = PublicFunctions.GradientColor(m_formula, lowerbound, upperbound, dncolor, upcolor);
Plot1.Set(0, Bars.High[0], m_colorlevel);
Plot2.Set(0, Bars.Low[0], m_colorlevel);
Plot3.Set(0, Bars.Open[0], m_colorlevel);
Plot4.Set(0, Bars.Close[0], m_colorlevel);
}
}
}