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 DJ888, 04-16-2024, 06:09 PM
        4 responses
        12 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        11 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        7 views
        0 likes
        Last Post nandhumca  
        Started by The_Sec, Today, 03:37 PM
        0 responses
        3 views
        0 likes
        Last Post The_Sec
        by The_Sec
         
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X