-
Notifications
You must be signed in to change notification settings - Fork 6
/
First_Bar_of_Week.Indicator.CS
41 lines (34 loc) · 1.24 KB
/
First_Bar_of_Week.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
using System.Drawing;
namespace PowerLanguage.Indicator
{
[SameAsSymbol(true)]
public class First_Bar_of_Week : IndicatorObject
{
private IPlotObject Plot1;
private IPlotObject Plot2;
public First_Bar_of_Week(object ctx) :
base(ctx) {}
protected override void Create(){
Plot1 =
AddPlot(new PlotAttributes("Plot1", EPlotShapes.BarHigh,
Color.Cyan, Color.Empty, 0, 0,
true));
Plot2 =
AddPlot(new PlotAttributes("Plot2", EPlotShapes.BarLow,
Color.Cyan, Color.Empty, 0, 0,
true));
}
protected override void CalcBar()
{
EResolution resolution = Bars.Info.Resolution.Type;
if (resolution == EResolution.Quarter ||
EResolution.Week <= resolution && resolution <= EResolution.Year) return;
if ( Bars.Time[0].DayOfWeek < Bars.Time[1].DayOfWeek )
{
Plot1.Set(0, Bars.High[0]);
Plot2.Set(0, Bars.Low[0]);
Alerts.Alert();
}
}
}
}