Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to save first tick of the session or bar.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to save first tick of the session or bar.

    Hello.
    How to save to variable first price on the session or first price on the bar?

    #2
    Hello Czarek,

    You can use Bars.IsFirstBarOfSession to know if a bar is the first bar of a session.
    http://ninjatrader.com/support/helpG...rofsession.htm

    You can use IsFirstTickOfBar in real-time when using Calculate as .OnEachTick or .OnPriceChange to know if this is the first tick of the bar.
    http://ninjatrader.com/support/helpG...ttickofbar.htm

    The link below has examples of setting variables.
    http://ninjatrader.com/support/helpG...urceManagement
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello.
      Thanks for you reply.
      I still do not know what represent first tick price of the bar?
      For example last price (closing price ) of former bar is Close[0]
      What what is the first price of the first bar or current bar?

      Comment


        #4
        Hello Czarek,

        If you are looking at a 10 minute chart, then the first bar of the session would be the first 10 minutes of the trading session. So the ES contracts first bar of session would be the bar with a close time of 5:10PM Chicago time and an open time of 5:00PM. This is Bars.IsFirstBarOfSession.

        The first tick of a bar is the first traded price of that bar, which would be the same as the Open of that bar. This is IsFirstTickOfBar.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          I would like to save first tick of the bar price to variable.
          if (IsFirstTickOfBar)
          { myvariable == ????}
          Other words, I would like to catch and save first price of the bar.

          Comment


            #6
            Hello Czarek,

            Thanks for your reply.

            To capture the price of the first tick of the first bar of the session, you will need to run your code with the calculate mode Calculate.OnEachTick. You can then capture using:

            if (Bars.IsFirstBarOfSession && IsFirstTickOfBar)
            {
            myvariable = Close[0]; // On a tick basis Close[0] is the price level of the tick
            }

            Please note that if you are looking at historical data, the above code will return the close value of the bar and not the first tick of the bar because historical data only consists of the OHLC of the finished bar and not of each tick that made up the bar. To see the correct historical tick values you would need to enable Tick Replay or add a 1 tick data series.
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kazisl, Today, 06:41 PM
            0 responses
            1 view
            0 likes
            Last Post kazisl
            by kazisl
             
            Started by einstein, Today, 06:20 PM
            0 responses
            2 views
            0 likes
            Last Post einstein  
            Started by op1031, Today, 05:51 PM
            0 responses
            3 views
            0 likes
            Last Post op1031
            by op1031
             
            Started by nighttrader99, Today, 04:34 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Started by Simon Investimens, Today, 02:51 PM
            1 response
            15 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Working...
            X