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


Issue With Pivot Points - Reproducible

  • Filter
  • Time
  • Show
Clear All
new posts


    Thank you for your response.

    The Daily bars from Zen-Fire for the 6B 09-13 are using the CME FX Futures RTH hours which are from 7:20 AM to 2 PM CDT. This would be 14:20 to 21:00 CET.

    So in this case the values are zero until the Daily bar loads, however you will see the Pivot points for the previous session until the new session begins. However, if you add your indicator after the session began your 12:40 bar had a value of 0 and not yesterday's value.

    You may wish to use HLCCalculationMode.CalcFromIntradayData or HLCCalculationMode.UserDefinedValues to define your own HLC. Please visit the following link for additional information on the Pivots() method:

    Please let me know if I may be of further assistance.


      Hi Patrick

      Just to let you know that everything works perfectly now, I switched to Intraday for both the Pivot settings on the chart and in my code and the strategy is running smoothly. Thank you very much for taking the time to explain this with such a level of detail.

      Have a great day!


        You cannot access pivots in DailyBars mode from within a strategy

        Failure to load daily data asynchronously via a strategy:

        The problem discussed here is a known limitation of NinjaTrader. When calling the pivots from a strategy, it is not possible to call them in DailyBars mode, even if the daily bars have been properly loaded.

        Therefore you have to call them in CalcFromIntradayData mode.

        This is pretty bad, if you trade futures, because the correct calculation of floor pivots requires the settlement price as input. There is practically no way to calculate the settlement price from intraday data, as it is calculated and published by the exchange. The settlement price is only available via quality daily data such as Kinetick or DTN/IQ.

        However, when a strategy tries to access the pivots in DailyBars mode, the access always fails. Here are a few suggestions, how to solve the problem:

        Solution 1: Recreate the pivots indicator within the strategy

        Copy the code of the pivots indicators directly into the strategy, That way the strategy itself will call the daily bars and calculate the pivots. This should work. Calling an indicator that calls daily bars does not work due to the known synchronization issues.

        Solution 2: Add the daily bars via Add()

        The problem here is that the daily bars are not always added at the correct session break, but that they are sometimes added earlier (only possible on historical data) and sometimes later than the day break. If this is sorted out with NinjaTrader 8, it would be the method of choice of accessing daily data.

        Solution 3: Approximate the settlement price for futures:

        In most cases the regular close is only a few ticks off the settlement price. However, there are exceptions, such as for index futures. On the last business day of the month, the settlement price for index futures is determined via a fair value procedure from the index price at the close of the cash market, which is 15 minutes earlier than on all other days. Otherwise the settlement price can be approximated by calculating the volume weighted average price of the last 30 seconds prior to the regular close.

        If you are lazy, just use the regular close instead of the settlement price. However, if you wish to determine the regular close, you would need a session template that introduces a session break at the time of the close of the regular session. If you use this session template, you will run into other problems, as NinjaTrader will exit all GTD (good-till-day) orders with each session break.

        Therefore I would rather recommend the first solution and copy and paste the pivots code to the strategy.
        Last edited by Harry; 08-10-2013, 12:39 PM.


        Latest Posts


        Topics Statistics Last Post
        Started by ntbone, 09-23-2023, 11:29 PM
        5 responses
        Last Post NinjaTrader_BrandonH  
        Started by derivtrader, 09-22-2023, 12:54 PM
        3 responses
        Last Post Zigfried  
        Started by peterpanou, 09-07-2023, 04:33 PM
        17 responses
        Last Post NinjaTrader_Clayton  
        Started by suraj, 09-21-2023, 08:11 AM
        4 responses
        Last Post suraj
        by suraj
        Started by Spartacus, Today, 07:43 AM
        2 responses
        Last Post Spartacus