Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automated Creation of Horizontal Lines in Indicators

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

    Automated Creation of Horizontal Lines in Indicators

    Hello -

    I would like to add horizontal lines programmatically to my indicator rather than hard-coding them.

    Is there a way to do this?

    Thanks,
    Mark

    #2
    Welcome to our forums here Mark - you could use the DrawHorizontalLine command in NinjaScript to achieve this.

    Comment


      #3
      Memory leak when using negative numbers in DrawRegion

      Hello -

      I ended up using DrawRegion instead. It works pretty well and allows me to shade regions.

      My indicator is essentially an oscillator which travels around zero.
      I want to shade the negative regions.

      I ended up doing this:
      //DataSeries: regionLevel 1
      regionLevel1.Set(theTop);
      //the top: a double of 0.01
      //the bottom: a double of -0.01
      DrawRegion("region", CurrentBar, 0, regionLevel1, theBottom, Color.Black, colourLevel1, 5);

      When I use negative values of -0.02 for the top and -0.04 for the bottom, it does not render properly. I get a hack running where I get one portion of the indicator shaded.

      However, when I run this code, NT has some sort of memory leak and it gradually consumed 2.5 GB of ram by EO day today (I have 8 GB of ram). I don't want this to happen. Is there a way to shade below zero regions using DrawRegion without the memory leak?

      System specs:
      Win 7 SP1
      8 GB memory
      NT 7.0.1000.25 (live)

      Thanks,
      Mark
      Attached Files

      Comment


        #4
        Hello Mark,

        Thank you for your response.

        Can you provide the code for DrawRegion that does not work for negative values?

        There should be no issue with negative values, and I am not aware of any memory issues.

        I look forward to assisting you further.

        Comment


          #5
          I figured it out.
          I was instantiating the same Data Series object twice - in 2 separate methods.

          That was the culprit.

          Thanks for your help!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          581 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          338 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
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X