Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

printing indicator

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

    printing indicator

    Hello. I'm making my first indicator an I have a problem. When I use a period distinct to 0 I cannot do that NT print the line. My code is:


    protectedoverridevoid OnBarUpdate()
    {

    Print((Low[
    0]*(1-2*((((High[0]-Low[0])/((High[0]+Low[0])/2))*1000)*0.001))));
    //Print((Low[1]*(1-2*((((High[1]-Low[1])/((High[1]+Low[1])/2))*1000)*0.001))));


    LowerBand.Set(High[0]);
    HigherBand.Set(Close[
    0]);
    }

    In this way it works, but if I quit the slass from
    //Print((Low[1]*(1-2*((((High[1]-Low[1])/((High[1]+Low[1])/2))*1000)*0.001))));
    then don't draw anything. Can You help me?. Thanks.

    #2
    Hello albinez,

    Most likely you are running into this issue here:
    Make sure you have enough bars in the data series you are accessing

    Add the following lines to you OnBarUpdate() method:
    if (CurrentBar < 1) return;

    You should be able to resolve for the snippet you posted.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      It works. Thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      607 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      353 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      560 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      561 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X