BarOpenedEventArgs
class cAlgo.API
DesktopCLICloud
Provides data for the event when a new bar opened on the chart.
Definition
public class BarOpenedEventArgs
Namespace: cAlgo.API · Group: EventArgs
Examples
using cAlgo.API;
namespace cAlgo
{
// This example shows how to use the Bars object BarOpened event BarOpenedEventArgs
public partial class BarOpenedEventArgsSample : Indicator
{
protected override void Initialize()
{
Bars.BarOpened += Bars_BarOpened;
}
// This method will be called if a new bar opens
// BarOpenedEventArgs has a Bars property the you can use to get Bars object
private void Bars_BarOpened(BarOpenedEventArgs obj)
{
var newOpenedBar = obj.Bars.LastBar; // Or you can use obj.Bars[Bars.Count - 1] or obj.Bars.Last(0)
var closedBar = obj.Bars.Last(1); // Or you can use obj.Bars[Bars.Count - 2]
}
public override void Calculate(int index)
{
}
}
}
import clr
clr.AddReference("cAlgo.API")
from cAlgo.API import *
class Test():
def initialize(self):
api.Bars.BarOpened += self.on_bar_opened
def on_bar_opened(self, args):
# Or you can use args.Bars[Bars.Count - 1] or args.Bars.Last(0)
newOpenedBar = args.Bars.LastBar
# Or you can use args.Bars[Bars.Count - 2]
closedBar = args.Bars.Last(1)
{
"AccessRights": "None",
"TimeZone": "UTC",
"IsOverlay": false
}
Properties
| Name | Description |
|---|---|
BarsDesktopCLICloudBars | Gets the bar data. |