Skip to content

BarsTickEventArgs

Summary

Provides data for the tick bar event.

Signature

1
public class BarsTickEventArgs

Namespace

cAlgo.API

Properties

Name Description
Bars { get; } Gets the Bar objects data.
IsBarOpened { get; } Defines if current tick is the first tick of a new bar.

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
 using cAlgo.API;
 using cAlgo.API.Internals;
 namespace cAlgo
 {
     // This sample indicator shows how to use Tick
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class TickSample : Indicator
     {
         private Ticks _ticks;
         [Parameter("Symbol Name", DefaultValue = "EURUSD")]
         public string InputSymbolName { get; set; }
         protected override void Initialize()
         {
             // Getting a symbol ticks data
             _ticks = MarketData.GetTicks(InputSymbolName);
             // Subscribing to upcoming ticks
             _ticks.Tick += Ticks_Tick;
         }
         private void Ticks_Tick(TicksTickEventArgs obj)
         {
             // Printing Last tick inside Ticks collection
             Print("Bid: {0} | Ask: {1} | Time: {2}", obj.Ticks.LastTick.Bid, obj.Ticks.LastTick.Ask, obj.Ticks.LastTick.Time);
         }
         public override void Calculate(int index)
         {
         }
     }
 }

See Also


Last update: July 1, 2022

Comments