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

Drawing in Indicator panel

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

    Drawing in Indicator panel

    Hi

    I am stumped as to how to get an indicator to draw not on the price panel but in its own panel. The code is just a simple narrow range indicator but I want it to print "NR4" in a separate price panel not on the main panel.

    This is the code,

    PHP Code:
    {      
                if (
    CurrentBar 4) return;
                
                
    range1 Math.Abs(High[0]-Low[0]);
                
    range2 Math.Abs(High[1]-Low[1]);
                
    range3 Math.Abs(High[2]-Low[2]);
                
    range4 Math.Abs(High[3]-Low[3]);
                        
                if( 
    range1 range2    && range1 range3    && range1 range4)    
                    
                {
                    
    DrawText("NR4"+CurrentBar,"NR4",0Low[0] - 100Color.BlueViolet);
                    
                }      
                } 
    How do I get it to draw in its own panel?

    And also if you have a value such as in the above example of range1 , range2 etc how do you use the DrawText method to also draw the value on the chart?

    #2
    Originally posted by Tremblinghandtrader View Post
    How do I get it to draw in its own panel?
    I use the following code snippet, but I don't know if that is "the correct" way. Perhaps you find it useful though:

    PHP Code:
    protected override void Initialize()
    {
    DrawOnPricePanel false// don't draw in the price panel

    Regards,

    Comment


      #3
      Yep that was it. I did try that but didn't change the the Y plot values so they showed in the price panel!

      Thanks.

      Just need to figure out how to plot values as text now.

      Comment


        #4
        Ah good that it helped.
        Originally posted by Tremblinghandtrader View Post
        Just need to figure out how to plot values as text now.
        Perhaps you could use Convert.ToString() ?

        For example:
        PHP Code:
        DrawText("NR4"+CurrentBarConvert.ToString(range1), 0Low[0] - 100Color.BlueViolet); 


        Regards,

        Comment


          #5
          Originally posted by J_o_s View Post
          Perhaps you could use Convert.ToString() ?


          Thats it. Thanks heaps.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by usazencort, Today, 01:16 AM
          0 responses
          1 view
          0 likes
          Last Post usazencort  
          Started by kaywai, 09-01-2023, 08:44 PM
          5 responses
          603 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          6 responses
          22 views
          0 likes
          Last Post xiinteractive  
          Started by Pattontje, Yesterday, 02:10 PM
          2 responses
          21 views
          0 likes
          Last Post Pattontje  
          Started by flybuzz, 04-21-2024, 04:07 PM
          17 responses
          230 views
          0 likes
          Last Post TradingLoss  
          Working...
          X