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

Change the DrawRegion

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

    Change the DrawRegion

    Hello,
    I'm attempting to change the DrawRegion of my indicator according to the values of the WilliamsR. Unfortunately I'm missing something. I'm not getting any Opacity change. It stays green. Anyone know how to do this. Here is the code:
    // Calculate Williams value
    double value1 = WilliamsR(14)[0];
    double value2 = WilliamsR(150)[0];

    if (value2 > -50
    && value1 < -75)
    {
    DrawRegion("Region", CurrentBar, 0, Upper, Lower, Color.Empty, Color.Red, Opacity);
    }
    else
    {
    DrawRegion("Region", CurrentBar, 0, Upper, Lower, Color.Empty, Color.Green, Opacity);
    }

    Upper.Set(VMA(High, Length, Volatility)[0]);
    Lower.Set(VMA(Low, Length, Volatility)[0]);

    #2
    Hello,

    Thanks for the forum post.

    What is the variable Opacity set too?

    -Brett

    Comment


      #3
      The variable opacity is set to 2.

      Comment


        #4
        areaOpacity
        Sets the level of transparency for the fill color. Valid values between 0 - 10. (0 = completely transparent, 10 = no opacity)


        Try setting it to 0.


        -Brett

        Comment


          #5
          Brett, thanks for the reply but, still no change.

          Comment


            #6
            Would need to add Prints then to find out how Opacity is getting set to something other then 0. As you need 0 for it to be completely transparent.

            You sure you dont have any manually drawn regions right correct?

            Finally this only sets the fill. If it the fill or the outline that you can see or both?

            -Brett

            Comment


              #7
              It's been a while since I've done this and used Print to find my error. Could you give me a quick reminder how to do that?

              Comment


                #8
                Ok I remembered the Print(). It shows that that I should be getting a red color at the right times, but I'm not getting it. I'll keep checking.

                Comment


                  #9
                  Ok I've viewed it in real time and it's changing, but it changes the entire channel history instead of creating a new color at the new bar. Can you point me in the direction of a method that would keep the color change historically.

                  Comment


                    #10


                    You want to make sure that setting isnt changing you need to find the code that is changing it if its changing.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by bortz, 11-06-2023, 08:04 AM
                    47 responses
                    1,605 views
                    0 likes
                    Last Post aligator  
                    Started by jaybedreamin, Today, 05:56 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post jaybedreamin  
                    Started by DJ888, 04-16-2024, 06:09 PM
                    6 responses
                    18 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by Jon17, Today, 04:33 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post Jon17
                    by Jon17
                     
                    Started by Javierw.ok, Today, 04:12 PM
                    0 responses
                    13 views
                    0 likes
                    Last Post Javierw.ok  
                    Working...
                    X