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 SnailHorn, Yesterday, 10:49 PM
          1 response
          10 views
          0 likes
          Last Post SnailHorn  
          Started by manueldecastro, Yesterday, 10:26 AM
          4 responses
          20 views
          0 likes
          Last Post manueldecastro  
          Started by TraderIqbal, 10-20-2023, 10:12 AM
          2 responses
          119 views
          0 likes
          Last Post Funnywo
          by Funnywo
           
          Started by Creamers, 04-27-2024, 05:32 AM
          12 responses
          72 views
          0 likes
          Last Post Creamers  
          Started by fredericlebre, Today, 01:19 AM
          0 responses
          10 views
          0 likes
          Last Post fredericlebre  
          Working...
          X