ExitOnSessionCloseSeconds

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Strategy >

ExitOnSessionCloseSeconds

Previous page Return to chapter overview Next page

Definition

The number of seconds before the actual session end time that the "IsExitOnSessionCloseStrategy" function will trigger.

The time from which this property will be calculated is taken from the Trading Hours EOD property set in the strategy's Trading Hours template. The ExitOnSessionCloseSeconds property can either be set programatically in the OnStateChange() method or be driven by the UI at run time.

 

Note: This is a real-time only property, it will not have any effect on your ExitOnSessionClose time in backtesting processing historical data.

 

Property Value

An int representing the number of seconds.  Default value is 30.

 

Warning: This property should ONLY bet set from the OnStateChange() method during State.SetDefaults or State.Configure

 

 

Syntax

ExitOnSessionCloseSeconds

 

Examples

ns

protected override void OnStateChange()
{
    if (State == State.SetDefaults)
    {
        // Triggers the exit on close function 30 seconds prior to trading day end
        IsExitOnSessionCloseStrategy = true;
        ExitOnSessionCloseSeconds = 30;
    }
}