CustomTimeFrameNewChartEventArgs.CustomBars
property · CustomTimeFrameNewChartEventArgs · cAlgo.API Since 5.3
DesktopCLICloud
Gets custom bars for the newly opened custom time frame chart.
Environment behaviour
CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.
Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.
Definition
public CustomBars CustomBars {get;}
customTimeFrameNewChartEventArgs.CustomBars: CustomBars
Returns CustomBars
Examples
protected override void OnStart()
{
var customTimeFrame = TimeFrameManager.Custom.Add("My Time Frame");
customTimeFrame.NewChart += OnCustomTimeFrameNewChart;
}
private void OnCustomTimeFrameNewChart(CustomTimeFrameNewChartEventArgs args)
{
var symbol = args.CustomBars.Symbol;
args.CustomBars.AppendBar(new CustomBar(Server.Time, symbol.Bid, symbol.Bid, symbol.Bid, symbol.Bid, 0));
}
def on_start(self):
customTimeFrame = api.TimeFrameManager.Custom.Add("My Time Frame")
customTimeFrame.NewChart += self.on_custom_time_frame_new_chart
def on_custom_time_frame_new_chart(self, args):
symbol = args.CustomBars.Symbol
args.CustomBars.AppendBar(CustomBar(api.Server.Time, symbol.Bid, symbol.Bid, symbol.Bid, symbol.Bid, 0))