Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

    BertrandNinjaTrader Customer Service

    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 traderqz, Today, 12:06 AM
          6 responses
          12 views
          0 likes
          Last Post traderqz  
          Started by Skifree, Today, 03:41 AM
          3 responses
          12 views
          0 likes
          Last Post Skifree
          by Skifree
           
          Started by traderqz, Yesterday, 09:06 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by guillembm, Today, 11:25 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by owensd, 04-21-2024, 11:34 PM
          9 responses
          34 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X