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

Issue With Pivot Points - Reproducible

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

    #16
    Hello,

    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: http://www.ninjatrader.com/support/h...nt7/pivots.htm

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

    Comment


      #17
      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!

      Comment


        #18
        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, 11:39 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by KirkHammett, Today, 03:23 AM
        0 responses
        2 views
        0 likes
        Last Post KirkHammett  
        Started by eleven, Yesterday, 10:06 PM
        0 responses
        35 views
        0 likes
        Last Post eleven
        by eleven
         
        Started by ezrollin, Yesterday, 08:12 PM
        7 responses
        72 views
        0 likes
        Last Post bltdavid  
        Started by kyamato, 11-23-2021, 10:51 PM
        6 responses
        91 views
        0 likes
        Last Post jeronymite  
        Started by fscabrera03, Yesterday, 07:14 PM
        0 responses
        49 views
        0 likes
        Last Post fscabrera03  
        Working...
        X