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

Highlighting The Indicator Panel

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

    Highlighting The Indicator Panel

    Hi there,

    I'm wondering if anyone knows how you could get the entire indicator panel to be highlighted a specific color that is triggered by a plot crossing another plot.

    I've got a custom indicator with 2 plots: Slow, Slow 2

    I was thinking that the Region Highlight X drawing tool would be the best way to achieve this.

    I put together this code in the OnBarUpdate section:

    if (CurrentBar > 0)
    {
    if (slow[0] > slow2[0])
    {
    Draw.RegionHighlightX(this, "RegionAbove" + CurrentBar, CurrentBar - 1, CurrentBar, Brushes.Cyan);
    }
    else if (slow[0] < slow2[0])
    {
    Draw.RegionHighlightX(this, "RegionBelow" + CurrentBar, CurrentBar - 1, CurrentBar, Brushes.DeepPink);
    }
    }
    }
    }
    }
    }


    But for some reason, the drawing tool isn't updating.

    Is there anything wrong with this code that could be causing it not to update accordingly?

    And lastly, if you think that the Region Highlight X drawing tool isn't the best way to achieve this effect, could you recommend what would work better?

    Your help is much appreciated.

    #2
    Have you looked at BackBrushAll or ChartBackground?

    Comment


      #3
      Hi Bltdavid, thanks for your response.

      I haven't heard of this before, when I follow your links it says "page not found"

      Comment


        #4
        Which browser are you using?
        Which version of Windows?

        The links are valid and properly created.

        Your browser/Windows combination is tickling
        a bug in NT's forum software.

        I've seen the bug manifest in Chrome on
        Windows 7 and Windows 11. I created the
        links by replying on Windows 7 using Firefox.

        Right now as I type this, on Win7, the links work
        fine in Firefox but fail in Chrome -- I can reproduce
        this forum software bug at will on my side.

        After clinking on a link ...
        Look carefully at the address, do you see the
        '.htm' extension in the URL and then garbage
        after that? The forum software has appended
        those garbage characters to the web address.

        See if you can fix the web address by deleting
        the garbage characters.

        I've provided you the best hints I can, from
        here on, it's up to you to figure out how to help
        yourself further.

        Comment


          #5
          Oh I understand, perfect! Thanks so much for your help, it is truly appreciated

          Comment


            #6
            Originally posted by bltdavid View Post
            The forum software has appended
            those garbage characters to the web address.
            It's also possible that Chrome itself is appending the extra
            characters to the web address -- but I doubt it.

            Here's why:

            In Chrome, I hover over the link and Chrome shows me the
            link address in the lower left, and this preview is correct -- but
            when I click on the link, the actual web address that Chrome
            uses shows garbage characters appended.

            Maybe Chrome is doing this, or maybe it's the forum software.

            But the NT forum software has always been crappy, many bugs
            in their forum software (like this one) have been around for years,
            so I'm inclined to think Chrome (with all their testing resources
            and millions of users) is not the problem.

            Bummer.
            Last edited by bltdavid; 12-21-2023, 08:21 AM.

            Comment


              #7
              All good, I managed to fix the issue by using Firefox.

              I'm wondering if it's possible to integrate a piece of code that allows me to adjust the opacity of the BackBrush colors. Do you know if thats possible?

              Comment


                #8
                It probably depends on your skills as a C# programmer.



                But from a NinjaScript point of view, yes, it's possible.

                Opacity is associated with the Brush color, it's not a
                NinjaScript concept -- BackBrush just holds the Brush
                you give it and paints the bar background with the
                color inside that Brush. Easy peasy.

                If that Brush's color has it's Opacity adjusted, well,
                BackBrush doesn't really know or care about that.

                Comment


                  #9
                  Hello RoswellTrader,

                  You can find details about making custom brushes in the following link. After making a brush with opacity you need to Freeze() the brush before it can be used.

                  Code:
                  myBrush = new SolidColorBrush(Color.FromArgb(100, 56, 120, 153));
                  myBrush.Freeze();


                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by lightsun47, Today, 03:51 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post lightsun47  
                  Started by 00nevest, Today, 02:27 PM
                  1 response
                  9 views
                  0 likes
                  Last Post 00nevest  
                  Started by futtrader, 04-21-2024, 01:50 AM
                  4 responses
                  45 views
                  0 likes
                  Last Post futtrader  
                  Started by Option Whisperer, Today, 09:55 AM
                  1 response
                  14 views
                  0 likes
                  Last Post bltdavid  
                  Started by port119, Today, 02:43 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post port119
                  by port119
                   
                  Working...
                  X