Click or drag to resize

Open High Low Close Prices

BarOpen, BarHigh, BarLow, BarClose and BarVolume - these indicators return opening, high, low and closing prices of the bar respectively and its volume.

Chart Example

Base Functions 001

Implementation and Usage

To implement such prices in a strategy use instrument subscription Bars.

Constructors:

BarOpen

BarHigh

BarLow

BarClose

BarVolume

The value of the indicators is updated by the bar prototype of method Add():

Add

Add

Use Open, High, Low, Close and Volume properties to get the current value of the corresponding indicator.

Example

The example below shows how to implement BarClose indicator in a strategy:

C#
 1public partial class InstrumentExecutor : InstrumentExecutorBase
 2{
 3-    #region LocalVariables
 4 
 5     //BarClose indicator
 6     BarClose barClose;
 7     //BarClose chart line
 8     Line barCloseLine;
 9 
10     #endregion
11
12-    #region Events
13 
14     public override void OnInit()
15     {
16         //init BarClose indicator
17         barClose = new BarClose();
18         //init BarClose line
19         barCloseLine = Charting.CreateLine("BarClose", "", Symbol, Pens.Black, LineStyle.Line, Charting.PriceChart, 1);
20     }
21 
22     public override void OnBarClose()
23     {
24         //update BarClose value
25         barClose.Add(Bars.Current.Open, Bars.Current.High, Bars.Current.Low, Bars.Current.Close, Bars.Current.Volume);
26         //get BarClose statistic and chart
27         barCloseLine.Draw(CurrentTime, barClose.Close);
28     }
29 
30     #endregion
31}