Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

V simple but I am not getting it!

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

    V simple but I am not getting it!

    if(Bars.GetDayBar(1) != null)
    Print("The prior trading day's High is: " + Bars.GetDayBar(1).High);//Add your custom indicator logic here.
    myline = Draw.HorizontalLine(this,"tag",Bars.GetDayBar(1).C lose,Brushes.Chartreuse);

    Why do I get an object reference error here?
    I set the object I thought using this
    private DrawingTools.HorizontalLine myline;

    thanks
    Last edited by Mindset; 06-28-2020, 10:43 PM. Reason: typo

    #2
    Hello Mindset,

    This is likely because you are not using curly braces to contain your conditions code. An if statement like you have it will execute 1 line following it. You have 2 lines so only the first sees the variable in the if condition.

    Code:
    if(Bars.GetDayBar(1) != null)
    {
       Print("The prior trading day's High is: " + Bars.GetDayBar(1).High);//Add your custom indicator logic here.
       myline = Draw.HorizontalLine(this,"tag",Bars.GetDayBar(1).C lose,Brushes.Chartreuse);
    }

    Comment


      #3
      oh that's 101 - sorry!But the line still doesn't work lol. No Plot and still the obj ref error
      Last edited by Mindset; 06-29-2020, 09:12 AM.

      Comment


        #4
        I never did get to resolve this but I sorted the indicator out another way

        Comment

        Latest Posts

        Collapse

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