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 bortz, 11-06-2023, 08:04 AM
          47 responses
          1,607 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          6 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          15 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X