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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        36 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        14 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        19 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X