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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        68 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        151 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X