Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to display PriorPriorDayOHLC on chart? Indicator available? Modify?

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

    How to display PriorPriorDayOHLC on chart? Indicator available? Modify?

    Hello,
    Is there any Ninja (preferably) or other indicator or method that could be used to display the day prior to the Previous Day's OHLC lines?
    I've searched Ninja add-ons and don't see anything that strikes me would lend itself to this achieving this.

    I've taken a look at and compared the code of the stock Current and Prior Day indicators, and whilst I can follow the principle of what's been done there, it seems to me it doesn't lend itself to easy extension to a further day back, and would perhaps need to use look back period rather than Session Iterator, which would be beyond my pay grade. A minor code tweak to the stock platform PriorOHLC would be desirable. However if there is a Custom Indicator already in existence I'd be willing to take a look.

    If nothing suitable available, I guess I should re-post under Add-on Development for further assistance, or maybe Moderator will do that.
    Any help appreciated
    Kind regards,

    #2
    Hello brucerobinson, thanks for your question.

    You could do something like use a Daily series and access the daily values 2 bars ago E.g.:

    Code:
    else if (State == State.Configure)
                {
                    AddDataSeries(BarsPeriodType.Day, 1);
                }
    
    double open, high, low, close;
            protected override void OnBarUpdate()
            {
                if(BarsInProgress == 1)
                {
                    if(CurrentBars[1] < 2) return; 
    
                    open = Opens[1][2];
                    high = Highs[1][2];
                    low = Lows[1][2];
                    close = Closes[1][2];
                }
            }
    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hello Chris and thanks for the suggestion.
      I understand the idea.
      My understanding of the workings is quite limited, but... if I understand at all, the difference between this and how the Current and Prior work would be an additional Data Series I.e. however they work, they don’t require any additional.
      I don’t know that adding a Day data series would be problematic, I’m just giving consideration to the practical implications in advance. I have 6 charts per instrument that I’d like to do this on, and 16 instruments = 96 extra data series. Each chart has 3-4 data series already in order to get Session OHLC so @ 350 data series already, and an increase of 30%.
      In performance terms, the additional load would be comparatively minimal. Day series updated on price change (which wouldn’t) whereas others 5t, 10s, 1m, 2m, 5m, 60m, 1d updated on price change.

      So, whilst anything that adds a Data Series to my Setup warrants caution, but in context perhaps worse than it looks.
      Any further thoughts, given the context?
      Kind regards,
      Bruce

      Comment


        #4
        Hello brucerobinson,

        This is Jim responding on behalf of Chris who is out of the office at this time.

        It may be more CPU intensive to have the high/low calculated from intraday data and use variables to store the session before last's OHLC than to simply use the added data series. Using the added data series would be easier and would not be as resource intensive when the script is running.

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hello Jim and thanks.
          "It may be more CPU intensive to have the high/low calculated from intraday data and use variables to store the session before last's OHLC" - I'm guessing that's some 'other' way that it could be done (I'm not a coder, so forgive my lack of understanding) but that the way Chris recommended of adding another data series is less resource intensive. That correct?
          If so, I'll see what I can do with the code provided. I guess I try to figure where appropriate to replace in the stock OHLC
          Thanks
          Bruce

          Ah - I’m guessing you meant store the ohlc as ‘variables’ same day as they are made, and then access them two days back two days later, or something like that
          Last edited by brucerobinson; 07-01-2020, 12:03 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by DJ888, Yesterday, 10:57 PM
          0 responses
          6 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Yesterday, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Working...
          X