-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathChaos_Alligator.Indicator.CS
More file actions
73 lines (58 loc) · 1.94 KB
/
Chaos_Alligator.Indicator.CS
File metadata and controls
73 lines (58 loc) · 1.94 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
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;
namespace PowerLanguage.Indicator
{
[SameAsSymbol(true)]
public class Chaos_Alligator : IndicatorObject
{
private ISeries<Double> m_avg_price;
private IPlotObject Plot1;
private IPlotObject Plot2;
private IPlotObject Plot3;
public Chaos_Alligator(object ctx) :
base(ctx){
lipoffset = 3;
lip = 5;
teethoffset = 5;
teeth = 8;
jawoffset = 8;
jaw = 13;
}
[Input]
public int jaw { get; set; }
[Input]
public int jawoffset { get; set; }
[Input]
public int teeth { get; set; }
[Input]
public int teethoffset { get; set; }
[Input]
public int lip { get; set; }
[Input]
public int lipoffset { get; set; }
protected override void Create(){
Plot1 =
AddPlot(new PlotAttributes("BLblue", 0, Color.Red,
Color.Empty, 0, 0, true));
Plot2 =
AddPlot(new PlotAttributes("BLred", 0, Color.Blue,
Color.Empty, 0, 0, true));
Plot3 =
AddPlot(new PlotAttributes("BLgreen", 0, Color.Lime,
Color.Empty, 0, 0, true));
}
protected override void StartCalc(){
m_avg_price = new Lambda<Double>(_bb => ((Bars.High[_bb] + Bars.Low[_bb])/((2))));
}
protected override void CalcBar(){
var m_value1 = m_avg_price.Average(jaw, jawoffset);
var m_value2 = m_avg_price.Average(teeth, teethoffset);
var m_value3 = m_avg_price.Average(lip, lipoffset);
if (Bars.CurrentBar >= 21){
Plot1.Set(0, m_value1);
Plot2.Set(0, m_value2);
Plot3.Set(0, m_value3);
}
}
}
}