Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

LastBarOfSession price mismatch

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

    LastBarOfSession price mismatch

    Hello.
    tf 15min

    Code:
    LastBarOfSession:
    Session               Close OnChart   Close[0] NT8 script 
    14.02.2017           2335,75                 2337,0
    15.02.2017           2350,5                   2350,5
    16.02.2017           2346,0                   2345,5
    17.02.2017           2348,5                   2348,0

    #2
    Hello nordseven, and thank you for your question. I see that you are reporting Russel 15 minute data, and that the number showing on your chart is not matching the number showing up in a test script you are using. Would it be possible to send a stripped down version of this test script our way?
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Code:
      public class FFFF : Indicator
      	{
      		
       		protected override void OnStateChange()
      		{
      			if (State == State.SetDefaults)
      			{
      				Description									= @"fffff";
      				Name										= "FFFF";
      				Calculate									= Calculate.OnBarClose;
      				IsOverlay									= false;
      				DisplayInDataBox							= true;
      				DrawOnPricePanel							= true;
      				DrawHorizontalGridLines						= true;
      				DrawVerticalGridLines						= false;
      				PaintPriceMarkers							= true;
      				ScaleJustification							= NinjaTrader.Gui.Chart.ScaleJustification.Right;
      				//Disable this property if your indicator requires custom values that cumulate with each new market data event. 
      				//See Help Guide for additional information.
      				IsSuspendedWhileInactive					= true;
      				if (State == State.SetDefaults)
      				Index						= 1;
      				Period						= 3;
      
      				AddPlot(new Stroke(Brushes.Green, 2), PlotStyle.Line, "pltFFF0");
      				
      			}
      			else if (State == State.Configure)
      			{
      				AddDataSeries(Data.BarsPeriodType.Day, 1);
      				
      				arr = new double[Period];
      			}
      		}
      
      		protected override void OnBarUpdate()
      		{
      			
      			if (CurrentBars[Index] < Period) {  return; }
      			
      		
      			if (BarsInProgress == 1) { return; } 
      			
      			
      			if(Bars.IsFirstBarOfSession && IsFirstTickOfBar) {
      				
      				DateTime fb = Time[0];
      				DateTime lb = Time[1];
      				DateTime Day0 = Times[Index][0]; //prev. day close.
      				DateTime Day1 = Times[Index][1];
      				
      				double a = Closes[Index][0];
      			}
      			
      			if(Bars.Count-2 == CurrentBar) {
      				double b = Close[0];
      			}
      		}

      Comment


        #4
        This is ES03-17 Close values

        Comment


          #5
          Originally posted by nordseven View Post
          Hello.
          tf 15min

          Code:
          LastBarOfSession:
          Session               Close OnChart   Close[0] NT8 script 
          14.02.2017           2335,75                 2337,0
          15.02.2017           2350,5                   2350,5
          16.02.2017           2346,0                   2345,5
          17.02.2017           2348,5                   2348,0

          The difference can be easily explained.

          The column "Close on Chart" shows the last traded price at 4:00 PM CT.

          The column "Close[0] NT8 script" shows the settlement price that comes as the daily close.


          For futures contracts, daily data providers usually supply the settlement price, which for ES would be the volume weighted average price of all trades occuring between 3:14:30 PM and 3:15:00 PM CT.

          Actually, you should see this as an advantage. When you call daily data, you will be able to access the settlement price. When you call intraday data, you will be able to access the regular close (last price traded prior to the break at 3:15 PM CT) or the last traded price at 4:00 PM CT.

          There is no mismatch and nothing is wrong, You are just retrieving the data as it is usually supplied.

          Comment


            #6
            Hello Nordseven,

            Harry is correct, thank you Harry.

            OHLC values on a daily charts are going to be put out by the exchange, and more information on that can be found on their respective websites.

            If you would prefer to use the electronic data rather than exchange settlement prices, you could use a minute series of 1440 period, as there are 1440 minutes in a day.

            Code:
            AddDataSeries(Data.BarsPeriodType.Minute, 1440);
            I have provided a link to the CME settlement procedures.


            Please let us know if we may be of further assistance.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Hello everyone.

              So you want to say that it is normal that the closing price of the lastBarOfSession in the session schedule does not coincide with the closing price of the lastBarOfSession in the script?
              What if I do not know how to program? It turns out that I can see in the chart are not a reliable data?
              I do not use daily OHLC, I use the firstBarOfSession and calling from them close price of previous bar, this is last bar of previous session.
              After that how i can be sure what i see real data on the chart?
              And dosent matter right or not Harry. Thank you.

              Comment


                #8
                Originally posted by nordseven View Post
                Hello everyone.

                So you want to say that it is normal that the closing price of the lastBarOfSession in the session schedule does not coincide with the closing price of the lastBarOfSession in the script?
                What if I do not know how to program? It turns out that I can see in the chart are not a reliable data?
                I do not use daily OHLC, I use the firstBarOfSession and calling from them close price of previous bar, this is last bar of previous session.
                After that how i can be sure what i see real data on the chart?
                And dosent matter right or not Harry. Thank you.
                Hi nordseven,

                This has nothing to do with the script. It has to do something with data.

                - Please open a daily chart. You will easily notice that the bar close for every daily bar is the settlement price.

                - Please open an intraday chart, for example a 1440 min chart. You will easily notice that the bar close for the last bar of the trading day is the last traded price.

                This is how data for futures is supplied. It has nothing to do with any script.

                In a script it is your choice whether you call the daily data (from daily bars) or intraday data (from intraday bars). In fact in your script you have added a bar series of daily bars. If you add those daily bars your script will return the settlement price. If you add 1440 min bars instead, your script will return the last traded price. Your script just returns what you have coded.
                Last edited by Harry; 02-21-2017, 10:52 AM.

                Comment


                  #9
                  Is "AddDataSeries", additional timeframes are not calculated from the current timeframe?
                  I opened the schedule, at 1440 minutes, the same values on chart.
                  What values will give me "AddDataSeries 1440" if the session will be shorter?

                  Comment


                    #10
                    Hello nordseven,

                    Your script is getting the daily settlement put out by the exchange, as you reference,

                    Code:
                    AddDataSeries(Data.BarsPeriodType.Day, 1);
                    If you were to look at a daily chart you would see the same settlement.

                    If you wanted your script to output the last electronic closing price, you should use,

                    Code:
                    AddDataSeries(Data.BarsPeriodType.Minute, 1440);
                    Please let us know if you need further assistance.
                    Alan P.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by nordseven View Post
                      Is "AddDataSeries", additional timeframes are not calculated from the current timeframe?
                      I opened the schedule, at 1440 minutes, the same values on chart.
                      What values will give me "AddDataSeries 1440" if the session will be shorter?
                      AddDataSeries can be used to add any bar types calculated from daily data, minute data or tick data. It is your choice.

                      AddDataSeries adds 1440 min bars. If you select a shorter session, NinjaTrader will truncate the 1440 min bar (at least with default settings). For example if you select a regular trading hours template for the added minute bar series, the 1440 min bar will effectively become a 405 min bar (8:30 AM to 3:15 PM).

                      Please open the Help Guide and search for "AddDataSeries" for further details.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by arvidvanstaey, Today, 02:19 PM
                      2 responses
                      7 views
                      0 likes
                      Last Post arvidvanstaey  
                      Started by jordanq2, Today, 03:10 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post jordanq2  
                      Started by traderqz, Today, 12:06 AM
                      10 responses
                      18 views
                      0 likes
                      Last Post traderqz  
                      Started by algospoke, 04-17-2024, 06:40 PM
                      5 responses
                      46 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by mmckinnm, Today, 01:34 PM
                      3 responses
                      6 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Working...
                      X