FirstTickOfBar
Previous Topic  Next Topic 

Definition

Indicates if the incoming tick is the first tick of a new bar. This property is only of value in strategies that run tick by tick which is when the CalculateOnBarClose property is set to false.


Property Value

This property returns true if the incoming tick is the first tick of a new bar; otherwise, false.


Syntax

FirstTickOfBar


Property Of

Custom Indicator, Custom Strategy


Examples

// On a tick by tick strategy the only way you know when a bar is closed is when
// the FirsTickOfBar is true.
protected override void OnBarUpdate()
{
    // Only process entry signals on a bar by bar basis (not tick by tick)
    if (FirstTickOfBar)
    {
        if (CCI(20)[1] < -250)
            EnterLong();
       
        return;
    }

    // Process exit signals tick by tick
    if (CCI(20)[0] > 250)
        ExitLong();
}