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 pechtri, 06-22-2023, 02:31 AM
          10 responses
          124 views
          0 likes
          Last Post Leeroy_Jenkins  
          Started by judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          59 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Yesterday, 06:52 PM
          4 responses
          36 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Yesterday, 07:39 PM
          0 responses
          7 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Yesterday, 03:01 PM
          2 responses
          22 views
          0 likes
          Last Post helpwanted  
          Working...
          X