Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using PriorDayOHLC() and getting error

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

    Using PriorDayOHLC() and getting error

    I am new to NinjaScript and need a little help

    I need to access the prior day's Close (at 16:15 ET for the e-mini) from within a 30-minute bar chart. I believe the easiest way to do this is with PrioDayOHLC().

    I've tried to implement this with the following...

    #region Variables
    private double priorDayClose = PriorDayOHLC().PriorClose[0];
    #endregion

    However, the compiler throws the following error...
    "Cannot implicitly convert type 'double' to 'NinjaTrader.Data.DataSeries'"

    What am I missing here?

    Thanks in advance for your help.

    #2
    Without testing anything

    Declare only your variable:

    Code:
    private double priorDayClose	;

    and in OnBarUpdate()
    Code:
    priorDayClose	= PriorDayOHLC().PriorClose[0];
    But then you should run into indexing problems and new errors. (5>4)

    edit:

    Or move everything to OnBarUPdate as in the documentation

    Comment


      #3
      Ok, that did it! Thanks

      Now I have an issue with...
      DrawTextFixed("text",txtChart,TextPosition.TopLeft , Color.Red, new Font("Arial", 14));

      The compiler spits out...
      "No overload for method 'DrawTextFixed" takes '5' arguments"

      Comment


        #4
        Originally posted by ronb107 View Post
        Ok, that did it! Thanks

        Now I have an issue with...
        DrawTextFixed("text",txtChart,TextPosition.TopLeft , Color.Red, new Font("Arial", 14));

        The compiler spits out...
        "No overload for method 'DrawTextFixed" takes '5' arguments"
        Looks like an Error. You need 8!?

        Comment


          #5
          Thanks Sledge.

          Works great!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          86 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          29 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          32 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          67 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X