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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        44 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        56 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        35 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        95 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        57 views
        0 likes
        Last Post PaulMohn  
        Working...
        X