Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting Prior Day settlement for NQ

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

    Plotting Prior Day settlement for NQ

    Hi, I tried to make this indicator that would plot the prior day close (Settlement) at Hour 16 Minute 15. I use UniRenko bars and with session template 24 X 7. Just trying to find a way to plot the true settlement price from CME Futures RTH. The indicator dose not want to plot. Any help would be appreciated.
    Thanks,
    Attached Files

    #2
    Originally posted by woodyfox View Post
    Hi, I tried to make this indicator that would plot the prior day close (Settlement) at Hour 16 Minute 15. I use UniRenko bars and with session template 24 X 7. Just trying to find a way to plot the true settlement price from CME Futures RTH. The indicator dose not want to plot. Any help would be appreciated.
    Thanks,

    The session template 24x7 is about the worst to use. It transforms five regular trading days into a Sunday afternoon session, 4 trading day shifted by a few hours and a truncated trading day on Friday. This will just turn out rubbish. Please use the preset trading hours template <instrument settings>.

    NinjaTrader fails when loading a secondary bar series of daily data as you would do with other bar types that are set up intraday. Because of this failure, the NinjaTrader pivots indicator - which actually retrieves yesterday's settlement price - uses BarsArray[1].GetClose to access the settlement price. Please have a look at the code of the pivots indicator.

    That said, the NinjaTrader pivots indicator also has a bug, as it only returns the correct settlement price in 97.5% of all days when applied to historical data.

    Please find below links to indicators that all will display the correct settlement price for CME futures.

    Daily pivots are calculated using the high, low and close from the previous day&#8217;s session, locating intraday support and resistance points.


    Fibonacci levels refer to areas of support or resistance calculated by using the Fibonacci sequence, based on the prior day's high and low.


    The indicators use BarsArray[1].GetClose for the case when not being connected, The code is somewhat difficult to grasp, but does the trick

    Code:
    if(IsConnected())
    {    
       if(tradingDate0[0] > tradingDate1[0]) 
           priorClose = currentDailyClose;
      else
           priorClose = priorDailyClose;
    }    
    else // workaround 
    {
      priorClose = currentHistoricalClose[1];
      count = 0;
      priorDailyBarDate = BarsArray[1].GetTime(BarsArray[1].GetBar(Times[0][1]));
      dailyBarDate = BarsArray[1].GetTime(BarsArray[1].GetBar(Times[0][0]));
      if(priorDailyBarDate == dailyBarDate && BarsArray[1].Count - 2 > CurrentBars[1])
      {    
           while (priorDailyBarDate >= dailyBarDate)
           {    
                 count = count - 1;
                 priorDailyBarDate = BarsArray[1].GetTime(BarsArray[1].GetBar(Times[0][1].AddDays(count)));
                 if (count == -5)
                      break;
           }    
           priorClose = BarsArray[1].GetClose(BarsArray[1].GetBar(Times[0][1].AddDays(count)));
       }
     }

    I am sorry, but this subject is one of the more complex ones.

    Comment


      #3
      Hello woodyfox,

      Thank you for your note.

      I have attached a sample indicator which will plot today's High of both its electronic and pit session. You could use this as a template for using session templates and plotting previous days values based on pit or electronic sessions.

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

      Comment


        #4
        Originally posted by NinjaTrader_AlanP View Post
        Hello woodyfox,

        Thank you for your note.

        I have attached a sample indicator which will plot today's High of both its electronic and pit session. You could use this as a template for using session templates and plotting previous days values based on pit or electronic sessions.

        Please let us know if you need further assistance.
        Very nice. This is what I was looking for.
        Thanks.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        44 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        58 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        35 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        95 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        59 views
        0 likes
        Last Post PaulMohn  
        Working...
        X