Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawHorizontalLine() problem

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

    DrawHorizontalLine() problem

    Hello!

    Could you please tell me how to draw the line in the second panel in the strategy where strategy indicator is?
    I use the method below and see no line drawn.
    Note, that a simple strategy method call like: DrawHorizontalLine("Trend Up", true, 100, Color.Green, DashStyle.Solid, 2);
    draws the line on the strategy chart, but this is not what I need. I need to draw the line on other indicator panels.

    Thanks!

    Code:
    protected override void Initialize()
     {
     Add(ROC(EMA(this.period2), this.period1));
    }
    
    protected override void OnBarUpdate()
            {
                ROC(EMA(this.period2),  this.period1).DrawHorizontalLine("Trend Up", true,      100,  Color.Green, DashStyle.Solid, 2);
    }

    #2
    Hello Corrado,

    You should try using DrawOnPricePanel = false; in your Initialize() method.

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      DrawHorizontalLine() in strategy

      Originally posted by NinjaTrader_RyanM View Post
      Hello Corrado,

      You should try using DrawOnPricePanel = false; in your Initialize() method.

      http://www.ninjatrader.com/support/h...pricepanel.htm
      NinjaTrader_RyanM,

      No, unfortunately this still doesn't work in the STRATEGY.
      Try the code below:

      Code:
      protected override void Initialize()
      {
      Add(ROC(fast));
       ROC(fast).DrawOnPricePanel = false;
       }
      
      protected override void OnBarUpdate()
      {
                  ROC(fast).DrawHorizontalLine("Trend Up", true, 70,  Color.Green, DashStyle.Solid, 3);
      }

      Comment


        #4
        What you'll have to do is draw the horizontal line in your indicator script. Set DrawOnPricePanel = false there. You can assign specific panels for indicators and when that setting is false it will draw on the indicator panel.

        Please see strategy plot sample here:
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_RyanM View Post
          What you'll have to do is draw the horizontal line in your indicator script. Set DrawOnPricePanel = false there. You can assign specific panels for indicators and when that setting is false it will draw on the indicator panel.

          Please see strategy plot sample here:
          http://www.ninjatrader-support.com/v...ead.php?t=6651
          NinjaTrader_RyanM, thanks for trying to help but I think there is a little misunderstanding here.

          What I want is just to draw the line in the indicator(s) on other then main chart panel while back testing or optimizing a strategy. Your recommendation still did not provide a graceful solution yet. I realize if i write an indicator myself I can program it to do anything including drawing lines. But I want to use existing indicators, change their properties and run their methods for that goal.
          The link you gave me has a limitation of the method not to be used in the strategy back testing, therefore it doesn't work for me.

          Comment


            #6
            As far as I can tell the level of plot control you're looking for is not available with a strategy. I will have someone review this thread and get back to you Monday in case I'm overlooking something.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              NinjaTrader_RyanM, Thank you.

              Comment


                #8
                Corrado, as Ryan pointed out, you would need to set this in the called indicator's Initialize() method.

                Comment

                Latest Posts

                Collapse

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