Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to draw a line in an optimization indicator?

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

    How to draw a line in an optimization indicator?

    I would like to draw a horizontal line in an indicator panel I am using in my strategy that would show the minimum value before a trade may be taken.

    For example: If the volatility > 1.5...continue with possible trade logic.
    The 1.5 is a variable parameter (MinAtr), but the 1.5 value is constant for the entire optimization run.

    I have the volatility indicator in a separate panel.
    All I want to do is draw a black (or whatever color) line at 1.5 of that panel (3).

    Currently, the following code is used for the indicator & it works.

    ATR(MomBars).Panel = 3;
    Add(ATR(MomBars));

    Thanks.

    #2
    ChuckAllen,

    In Initialize() method you will need to add DrawOnPricePanel = false. Then you can use DrawLine() and it will draw into the indicator panel.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Reply

      I tried that, but I do not see an option in the DrawLine() function that directs the line to a particular indicator panel.

      If I should use DrawOnPricePanel = false, what if I want to add another line or object to the price panel? Or add lines or objects to other panels?

      Could you please add just a small code snip that would make the original question work?

      Thanks.

      Comment


        #4
        You can't choose a panel. It goes to whatever panel the indicator is on. This code needs to be in the indicator script.

        An indicator has no concept of how many panels are on the chart. Your only options are price panel or indicator panel. You have to choose one or the other. All objects from a single script can only populate one panel at a time.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          reply

          Again, could you please supply some small sample?
          I have 3 panels and want to draw a line in the third panel.
          Its NOT a separate indicator, its an optimization that displays various indicators.

          I used your sample to get the indicators into the various panels, but how do I tell the DrawLine() function which indicator or panel?

          Comment


            #6
            As discussed in my last post, you cannot choose which panel. There is no such concept for saying "I want this line on panel 3 and this one on panel 2".

            If you want something in panel 3, you need to put the drawing code directly into the indicator that is going to be placed on panel 3. Again, it is an all or nothing affair. All draw objects from the indicator will either go to the price panel or the indicator panel. You choose panel 3 by simply placing the indicator onto panel 3. There is no such concept as having an indicator on panel 2 and having that indicator's objects draw onto panel 3.
            Josh P.NinjaTrader Customer Service

            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