Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CurrentDayOHL and PriorDayOHLC

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

    CurrentDayOHL and PriorDayOHLC

    Hello, I am trying to use the above with a custom bar type which has Break at EOD disabled.

    The session template is set to for example CME Equities ETH hours - and the incorrect open is given for the CurrentDayOHL

    I tried modifying the above indicators adding a 1 minute data series and using this in the onbarupdate process.

    Strangely it seems to mess up the High Low for CurrentDayOHL and dont think the open is correct.

    Is it going to be a problem in the way the indicator uses the sessioniterator which will be based on the charts Primary Data Series ?
    So the break at eod with the session is going to be an issue.

    Is there a way for the adddataseries to be set to break at eod even though the primary bar series for the chart is at break at eod = false?
    Or does it inherit directly from the primary series.
    Just thinking of some ways around this.

    If i used standard Ninja point and figure with break at eod set to false i would likely see the same issue - main related to the opens and closes of these indicators

    thanks
    Last edited by soulfx; 08-30-2021, 08:28 AM.

    #2
    Hello soulfx,

    Thanks for your post.

    Break at EOD is specific for tick-based bars to break them when they are not complete between session breaks.

    You could use one of the following AddDataSeries() syntax to specify whether isResetOnNewTradingDay is true or false. isResetOnNewTradingDay is equivalent to Break at EOD. This means that if you would like the added series to use Break at EOD, you would set the isResetOnNewTradingDay property to true in the AddDataSeries() method. Alternatively, if you do not want the added series to use Break at EOD, you would set the isResetOnNewTradingDay property to false.

    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName, bool? isResetOnNewTradingDay)
    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)


    See this help guide documentation for more information: https://ninjatrader.com/support/help...dataseries.htm

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Thanks for reply i will try this and see how it looks. To confirm with these overloads of AddDataSeries - i need to hardcode in the script the instrument name and the trading hours Name if i choose the first of the two you showed above? It is unsupported to parameterise these for the indicator ie pass in the instrument name and trading template. It likely will work but not guaranteed? Or has this feature request for this been implemeted?

      Comment


        #4
        Hello soulfx,

        Thanks for your note.

        That is correct. Those values would need to be hardcoded when calling the AddDataSeries() method.

        Note that adding CurrentDayOHL to an added time-based series will give consistent Open, High, and Low plot values. The specific AddDataSeries syntax specifying isResetOnNewTradingDay would not be necessary unless you want the calculated Open value from the unbroken custom bar (when Break At EOD is disabled).

        For example, if the CurrentDayOHL indicator is applied to an added time-based data series (ex: added 1-minute series) in a custom indicator, then we add that custom indicator to a Renko chart with Break at EOD on or off, and we apply the default CurrentDayOHL indicator to a time-based chart (1-minute series), we see the CurrentDayOHL applied to time-based series is accurate for the real session open.

        See the attached image demonstrating this. We have our custom indicator with CurrentDayOHL applied to an added 1-minute time-based series added to the Renko bars in panel 1 on the chart. This indicator prints the OHL values to the Output window. We also have the default CurrentDayOHL indicator applied to 1-minute bars in panel 2. In the image, we see that the prints from the indicator attached to panel 1 (Renko bars) will output the same OHL values as the indicator plots in panel 2 since they are both using a time-based series.

        I am also attaching the script used to test this.

        Let us know if we may assist further.
        Attached Files
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Thanks Brandon, was thinking this through and your approach with an indicator reference and invoking from the 'added series' version.
          I note you did not add in any check for BarsInProgress for the added or primary series.

          i created a version with the same plots as the original currentDayOHL and calling the reference to currentDayOHL for the open high low values.
          The main chart is Renko with break at EOD set to false.
          And i add the updated indicator with the added 1 minute series. Incidentally i did this prior and was highlighting a potential issue as i see here.
          In some days the low or high is not updated for the renko chart as the bars progress - ie for periods > 1 minute.
          It didnt seem to matter if barsinprogress was set to 1 or 0 for updating the plots.

          if you add the plots to your version and update them can you see how the lines show on the renko chart - break at eod = false - plotting the lines instead of just printing the values?

          thanks

          Comment


            #6
            Hello soulfx,

            Plots are always synchronized to the primary data series. If we are adding another data series, those bar closures will be different than the primary data series.

            It would then be recommended to update private variables from BarsInProgress == 1 and then assign the plot values in BarsInProgress == 0.

            For example:

            Code:
            private double valueLow;
            private double valueHigh;
            private double valueOpen;
            
            protected override void OnBarUpdate()
            {
                if (BarsInProgress == 1)
                {
                    valueOpen = CurrentDayOHL1.CurrentOpen[0];
                    valueHigh = CurrentDayOHL1.CurrentHigh[0];
                    valueLow = CurrentDayOHL1.CurrentLow[0];
                }
                else
                {
                    Values[0][0] = valueOpen;
                    Values[1][0] = valueHigh;
                    Values[2][0] = valueLow;
                }
            }
            The result looks like the attached screenshot.

            If you have any additional questions, could you share what you are doing exactly with your code and share the result you see so we can further comment?

            We look forward to assisting.

            Attached Files

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            603 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            349 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            104 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            560 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X