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

Shading the gap

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

    Shading the gap

    Hello, I am plotting two lines in an indicator that will be displayed below my chart. I want to shade the gap between these 2 lines. I have successfully plotted the lines but I cannot get the shading to work ... I am using the DrawRegion function ... here's my statement:

    DrawRegion("DR1" + CurrentBar,1,0, CCIupper, CCIlower, Color.Empty, Color.Blue, 3);

    Any thoughts on why the shading is not taking place?

    #2
    Hello pman777,

    Thanks for your note.

    The call you have here does seem to be written correctly.

    The CCIupper and CCIlower are both data series correct?

    On the line above please add a print statement:
    Print(CClupper[0].ToString() + " - " + CCllower[0].ToString());

    This will ensure that this is a dataseries, and that the values are values that would be reasonable for the current price of the instrument you are running this on.


    Please let me know the outcome of the print statement.

    I look forward to your reply.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      thank you. yes, these values are data series ... here's is a sampling of the print statement

      20.36 - 9.85
      24.44 - 7.29
      23.76 - 13.82
      20.97 - 17.94
      48.12 - 14.04
      32.76 - 10.06
      23.19 - 11.59
      15.04 - 14.33
      16.51 - 9.71
      22.00 - 15.82
      28.35 - 13.38
      25.99 - 14.06
      34.12 - 13.43
      32.07 - 12.56
      54.64 - 10.31
      45.56 - 8.77
      42.31 - 7.01

      Comment


        #4
        I did another test where I print the lines with shading on the price chart itself (Overlay = true) and the shading does appear. So I believe the syntax is correct, I just cannot get the shading to display with when I run the indicator with "Overlay = false", which is what I need.

        Comment


          #5
          Hi pman777,

          Thanks for the print results.

          Again, everything looks OK here.

          I would like to test your script on my end. Could you please supply me a complete "toy" of this script. A toy is a complete script that is limited to just this issue.

          To export your script do the following:

          1. Click File -> Utilities -> Export NinjaScript
          2. Enter a unique name for the file in the value for 'File name:'
          3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
          4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message

          By default your exported file will be in the following location:

          * (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


          Below is a link to the help guide on Exporting NinjaScripts.
          http://www.ninjatrader.com/support/h...nt7/export.htm


          I look forward to your reply.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            ok ... will do now

            Comment


              #7
              here's a 'toy' version of my code
              Attached Files

              Comment


                #8
                Hi pman777,

                Thanks for the code.

                Also, please let me know the instrument (and expiry) as well as the interval you are using for your testing.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  TF 06-13 133 tick

                  Comment


                    #10
                    sorry, meant "322 tick"

                    Comment


                      #11
                      Hi pman777,

                      Thanks for that info.

                      The issue is the region wants to be drawn on the price panel.

                      Adding DrawOnPricePanel = false; to the initialize of the script resolves this issue when the indicator is added to a different panel other than the primary panel. This, however, causes the same problem if the Overlay is true or if the indicator is manually added to the primary panel.

                      A fix to be able to draw a region no matter what panel it is added to would be to use a public bool labeled place on input series panel. When setting the panel numer also set this to true or false based on if it is the primary panel or not. When true DrawOnPricePanel is true, when false DrawOnPricePanel is false.


                      Please let me know if this does not resolve your inquiry.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        thank you ... that fixed it. Appreciate your time

                        Comment


                          #13
                          Hi pman777,

                          I'm glad that worked for you.

                          Please do not hesitate to contact us for any other NinjaTrader inquiries you may have.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by pman777 View Post
                            I did another test where I print the lines with shading on the price chart itself (Overlay = true) and the shading does appear. So I believe the syntax is correct, I just cannot get the shading to display with when I run the indicator with "Overlay = false", which is what I need.
                            If you want to draw on the indicator panel. you need:
                            Code:
                            DrawOnPricePanel = false;
                            in your code.

                            In my setup, I use it as the default, because it means that it will always draw on the panel that holds the indicator, even if it is the price panel. In other words, false should have been the default in the first place, IMHO.
                            Last edited by koganam; 05-23-2013, 07:25 AM.

                            Comment


                              #15
                              Hi koganam,

                              Thanks for the thoughtful reply. I'll pass that along to our development team.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Max238, Today, 01:28 AM
                              1 response
                              22 views
                              0 likes
                              Last Post CactusMan  
                              Started by giulyko00, Yesterday, 12:03 PM
                              2 responses
                              10 views
                              0 likes
                              Last Post giulyko00  
                              Started by r68cervera, Today, 05:29 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post r68cervera  
                              Started by geddyisodin, Today, 05:20 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post geddyisodin  
                              Started by JonesJoker, 04-22-2024, 12:23 PM
                              6 responses
                              38 views
                              0 likes
                              Last Post JonesJoker  
                              Working...
                              X