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 Hwop38, 05-04-2026, 07:02 PM
          0 responses
          154 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          307 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          244 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          345 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          176 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Working...
          X