Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

    The Daily Range Projections indicator displays support and resistance levels based on the volatility of the prior N days. The noise bands show how far noise trader typically drive prices. A breakout from these levels will indicate participation from higher timeframe traders, bringing Range Projections, i.e. profit target bands, into play.

    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 rdtdale, Today, 01:02 PM
        0 responses
        1 view
        0 likes
        Last Post rdtdale
        by rdtdale
         
        Started by alifarahani, Today, 09:40 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by RookieTrader, Today, 09:37 AM
        4 responses
        18 views
        0 likes
        Last Post RookieTrader  
        Started by PaulMohn, Today, 12:36 PM
        0 responses
        6 views
        0 likes
        Last Post PaulMohn  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        40 views
        0 likes
        Last Post love2code2trade  
        Working...
        X