バー

cBots (自動売買)

Summary

Represents the Bars interface – the collection of Bar objects.

Signature

1
public abstract interface Bars

 

Namespace

cAlgo.API

Examples

 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 cAlgo.API;
 using System;
 namespace cAlgo
 {
     // A sample indicator that shows how to use Bars
     [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class BarsSample : Indicator
     {
         private TextBlock _barTicksNumberTextBlock, _barsStateTextBlock;
         [Output("Range", LineColor = "RoyalBlue")]
         public IndicatorDataSeries Range { get; set; }
         [Output("Body", LineColor = "Yellow")]
         public IndicatorDataSeries Body { get; set; }
         protected override void Initialize()
         {
             // Bars events
             Bars.BarOpened += Bars_BarOpened;
             Bars.Tick += Bars_Tick;
             Bars.HistoryLoaded += Bars_HistoryLoaded;
             Bars.Reloaded += Bars_Reloaded;
             var grid = new Grid(2, 2)
             {
                 BackgroundColor = Color.DarkGoldenrod,
                 HorizontalAlignment = HorizontalAlignment.Right,
                 VerticalAlignment = VerticalAlignment.Top,
                 Opacity = 0.5
             };
             grid.AddChild(new TextBlock
             {
                 Text = "Bar Ticks #",
                 Margin = 5
             }, 0, 0);
             _barTicksNumberTextBlock = new TextBlock
             {
                 Text = "0",
                 Margin = 5
             };
             grid.AddChild(_barTicksNumberTextBlock, 0, 1);
             grid.AddChild(new TextBlock
             {
                 Text = "Bars State",
                 Margin = 5
             }, 1, 0);
             _barsStateTextBlock = new TextBlock
             {
                 Margin = 5
             };
             grid.AddChild(_barsStateTextBlock, 1, 1);
             IndicatorArea.AddControl(grid);
         }
         private void Bars_Reloaded(BarsHistoryLoadedEventArgs obj)
         {
             _barsStateTextBlock.Text = "Reloaded";
         }
         private void Bars_HistoryLoaded(BarsHistoryLoadedEventArgs obj)
         {
             _barsStateTextBlock.Text = "History Loaded";
         }
         private void Bars_Tick(BarsTickEventArgs obj)
         {
             _barTicksNumberTextBlock.Text = Bars.TickVolumes.LastValue.ToString();
         }
         private void Bars_BarOpened(BarOpenedEventArgs <span="n">obj)
         {
             _barsStateTextBlock.Text = "New Bar Opened";
         }
         public override void Calculate(int index)
         {
             Range[index<span="p">] = Bars.HighPrices[index<span="p">] - Bars.LowPrices[index<span="p">];
             Body[index<span="p">] = Math.Abs(Bars.ClosePrices[index<span="p">] - Bars.OpenPrices[<span="n">index<span="p">]);
         }
     }
 }

Methods

Last

Summary

Gets the last bar in the chart.

Signature

1
public abstract Bar Last(int index<span="p">)

 

Parameters

NameTypeDescription
indexint 

Return Value

Bar

LoadMoreHistory

Summary

Loads more historical bars. Method returns the number of loaded bars that were added to the beginning of the collection.

Signature

1
public abstract int LoadMoreHistory<span="p">()

 

Return Value

int

LoadMoreHistoryAsync (2)

LoadMoreHistoryAsync (1 of 2)

Summary

Loads more historical bars asynchronously.

Signature

1
public abstract void LoadMoreHistoryAsync<span="p">()

 

Return Value

void

LoadMoreHistoryAsync (2 of 2)

Summary

Loads more historical bars asynchronously.

Signature

1
public abstract void LoadMoreHistoryAsync<span="p">(Action<BarsHistoryLoadedEventArgs<span="o">> callback<span="p">)

 

Parameters

NameTypeDescription
callbackActionThe callback that will be called after history loaded

Return Value

void

GetPrices

Summary

Returns a data series from current Bars based on passed PriceType.

Signature

1
public abstract DataSeries GetPrices<span="p">(PriceType priceType<span="p">)

 

Parameters

NameTypeDescription
priceTypePriceTypePrice Type

Return Value

DataSeries

Properties

Item

Signature

1
public abstract Bar Item {get<span="p">;}

 

Return Value

Bar

LastBar

Summary

Gets the last bar in the chart.

Signature

1
public abstract Bar LastBar {<span="k">get<span="p">;}

 

Return Value

Bar

Count

Summary

Gets the number of bars.

Signature

1
public abstract int Count {<span="k">get<span="p">;}

 

Return Value

int

TimeFrame

Summary

Get the timeframe.

Signature

1
public abstract TimeFrame TimeFrame {<span="k">get<span="p">;}

 

Return Value

TimeFrame

SymbolName

Summary

Gets the symbol name.

Signature

1
public abstract string SymbolName <span="p">{<span="k">get<span="p">;}

 

Return Value

string

OpenPrices

Summary

Gets the Open price bars data.

Signature

1
public abstract DataSeries OpenPrices <span="p">{<span="k">get<span="p">;}

 

Return Value

DataSeries

HighPrices

Summary

Gets the High price bars data.

Signature

1
public abstract DataSeries <span="n">HighPrices <span="p">{<span="k">get<span="p">;}

 

Return Value

DataSeries

LowPrices

Summary

Gets the Low price bars data.

Signature

1
public abstract DataSeries <span="n">LowPrices <span="p">{<span="k">get<span="p">;}

 

Return Value

DataSeries

ClosePrices

Summary

Gets the Close price bars data.

Signature

1
public abstract DataSeries <span="n">ClosePrices <span="p">{<span="k">get<span="p">;}

 

Return Value

DataSeries

TickVolumes

Summary

Gets the Tick volumes data.

Signature

1
public <span="k">abstract <span="n">DataSeries <span="n">TickVolumes <span="p">{<span="k">get<span="p">;}

 

Return Value

DataSeries

MedianPrices

Summary

Gets the Median prices data (High + Low) / 2.

Signature

1
public <span="k">abstract <span="n">DataSeries <span="n">MedianPrices <span="p">{<span="k">get<span="p">;}

 

Return Value

DataSeries

TypicalPrices

Summary

Gets the Typical prices data (High + Low + Close) / 2.

Signature

1
public <span="k">abstract <span="n">DataSeries <span="n">TypicalPrices <span="p">{<span="k">get<span="p">;}

 

Return Value

DataSeries

WeightedPrices

Summary

Gets the Weighted prices data (High + Low + 2 * Close) / 4.

Signature

1
public abstract <span="n">DataSeries <span="n">WeightedPrices <span="p">{<span="k">get<span="p">;}

 

Return Value

DataSeries

OpenTimes

Summary

Gets the open bar time data.

Signature

1
public abstract <span="n">TimeSeries <span="n">OpenTimes <span="p">{<span="k">get<span="p">;}

 

Return Value

TimeSeries

Events

HistoryLoaded

Summary

Occurs when more history is loaded due to chart scroll on the left or due to API call.

Signature

1
public <span="k">abstract <span="k">event <span="n">Action<span="o"><<span="n">BarsHistoryLoadedEventArgs<span="o">> <span="n">HistoryLoaded<span="p">;

 

Reloaded

Summary

Occurs when bars are refreshed due to reconnect.

Signature

1
public <span="k">abstract <span="k">event <span="n">Action<span="o"><<span="n">BarsHistoryLoadedEventArgs<span="o">> <span="n">Reloaded<span="p">;

 

Tick

Summary

Occurs when a new Tick arrives.

Signature

<span="normal">1
public <span="k">abstract <span="k">event <span="n">Action<span="o"><<span="n">BarsTickEventArgs<span="o">> <span="n">Tick<span="p">;

 

BarOpened

Summary

Occurs when the last bar is closed and a new bar is opened.

Signature

<span="normal">1
public <span="k">abstract <span="k">event <span="n">Action<span="o"><<span="n">BarOpenedEventArgs<span="o">> <span="n">BarOpened<span="p">;

 

BarClosed

Summary

Occurs when a new bar is opened; the event is called for the previous (closed) bar.

Signature

<span="normal">1
public <span="k">abstract <span="k">event <span="n">Action<span="o"><<span="n">BarClosedEventArgs<span="o">> <span="n">BarClosed<span="p">;

 

  • Bar Events