Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to use Draw.HorizontalLine in the indicator panel from a strategy

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

    How to use Draw.HorizontalLine in the indicator panel from a strategy

    I'm trying to draw a horizontal line in the indicator panel from my strategy but it always get put in the 1st chart area where the prices are. I dont see any way in the documentation to change it to another panel.

    protected override void OnBarUpdate()
    {
    Draw.HorizontalLine(this,"line"+CurrentBar.ToStrin g(),4000,Brushes.DeepPink);
    }

    #2
    The trick is on IsOverlay (Bool)
    You can change in the State == State.SetDefaults.

    Code:
    if (State == State.SetDefaults)
    {
    IsOverlay = true;
    
    }
    When it is true, it will appear on your 1st chart which is with the bar chart.

    Comment


      #3
      Hello kazisl,

      Thanks for your post.

      In order to draw in an indicator panel, as forum member cincai advised, you would need to have the strategy create its own indicator panel. IsOverlay tells the strategy to create an indicator panel and any "Plots" created by the strategy would be sent to that panel. Please note that to use Draw methods to draw objects in that indicator panel, you would also have to use DrawOnPricePanel = false as this would direct draw objects to the strategy-created indicator panel.

      You would not be able to draw in a panel that was not created by the strategy.

      References;
      https://ninjatrader.com/support/help...?isoverlay.htm
      https://ninjatrader.com/support/help...pricepanel.htm
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Got it, I see, It draws on the indicator panel now. Is there a way to draw on both price panel and indicator panel in the same strategy since that boolean can only be changed at the beginning?

        Comment


          #5
          Hello kazisl,

          Thanks for your reply.

          Even though the bool is set in OnStateChange(), you can set it in OnBarUpdate() as well.

          Just before you want to draw on the price panel set DrawOnPricePanel = true, then your draw code for the price panel, then back to DrawOnPricePanel = false for your indicator panel drawing.


          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by timmbbo, Yesterday, 10:27 PM
          1 response
          6 views
          0 likes
          Last Post tgn55
          by tgn55
           
          Started by zacharydw00, Yesterday, 11:13 PM
          0 responses
          2 views
          0 likes
          Last Post zacharydw00  
          Started by luxurious_04, Yesterday, 10:55 PM
          0 responses
          1 view
          0 likes
          Last Post luxurious_04  
          Started by 7robert, Yesterday, 07:48 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_EricB  
          Started by saltminer, Yesterday, 06:32 PM
          0 responses
          6 views
          0 likes
          Last Post saltminer  
          Working...
          X