Issues using Mode OnEachTick
06.07.2021 03.23

NinjaTrader 8 Programming Strategies Guide

NinjaCoding friend

Dear all, hope you are fine.

How can I get the event of the first closed bar of a session using OnEachTick as mode.

The method executes a lot of times, not just one time as I need:

protected override void OnBarUpdate()

{

if(IsFirstTickOfBar)

{

                            if(Bars.IsFirstBarOfSession)

{

                                 Print( "This is the close of the first bar of the session and im printing this one time" );

                                                }

                       }

              }


This code prints several times on the first 3 bar close of the session.

Can you help me please?

Thank you!