-
Notifications
You must be signed in to change notification settings - Fork 6
/
Chaos_Fractals.Indicator.CS
62 lines (53 loc) · 1.88 KB
/
Chaos_Fractals.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
using System;
using System.Drawing;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
[SameAsSymbol(true)]
public class Chaos_Fractals : IndicatorObject
{
private SwingHigh m_swinghigh1;
private SwingLow m_swinglow1;
private IPlotObject Plot1;
private IPlotObject Plot2;
public Chaos_Fractals(object ctx) :
base(ctx){
strength = 2;
}
[Input]
public int strength { get; set; }
protected override void Create(){
m_swinghigh1 = new SwingHigh(this);
m_swinglow1 = new SwingLow(this);
Plot1 =
AddPlot(new PlotAttributes("BuyFractal", EPlotShapes.Point,
Color.Lime, Color.Empty, 1, 0,
true));
Plot2 =
AddPlot(new PlotAttributes("SellFractal", EPlotShapes.Point,
ColorTranslator.FromWin32(15224816), Color.Empty, 1,
0,
true));
}
protected override void StartCalc(){
m_swinghigh1.instance = 1;
m_swinghigh1.price = Bars.High;
m_swinghigh1.strength = strength;
m_swinghigh1.length = 80;
m_swinglow1.instance = 1;
m_swinglow1.price = Bars.Low;
m_swinglow1.strength = strength;
m_swinglow1.length = 80;
}
protected override void CalcBar(){
var m_value1 = m_swinghigh1[0];
var m_value2 = m_swinglow1[0];
if (PublicFunctions.DoubleGreater(m_value1, -1)){
Plot1.Set(0, m_value1);
}
if (PublicFunctions.DoubleGreater(m_value2, -1)){
Plot2.Set(0, m_value2);
}
}
}
}