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, 12:39 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,404 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        95 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        7 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        159 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        8 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X