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

BackBrushes Visibility

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

    BackBrushes Visibility

    Suggestions on how to approach toggling the visibility of BackBrushes series?

    #2
    Hello drmartell,

    The BackBrush is the color of the chart behind the current bar.

    The BackBrushes collection is a series that contains a color for the chart background under each bar on the chart.



    Can you clarify what you are trying to do?
    Are you wanting to remove the coloring from a bar after it has been set?

    For this you could use Reset().


    Or you could set the color for that bar to Brushes.Emtpy.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you yes, and how about restoring it though?

      I would like to be able to toggle the visibility of the entire series.

      (I understand that the entire series is technically always visible, but I would like to toggle the changes that have been made to the background by an indicator on and off)

      Comment


        #4
        toggle the opacity between 0 and 100

        Comment


          #5
          OK, I still could use some help with this. The opacity appears to be read only and I haven't had luck creating a BrushSeries to store values for later retrieval.

          Perhaps there is another approach.

          Comment


            #6
            If I remember right you have to create a Clone()
            Modify the opacity of the Clone()
            freeze the brush and then Swap it back.
            I will see if I can find some code where I did this before.
            or possibly one of the Ninja support people will chime in with an example.

            Comment


              #7
              I was able to get it working using a string series with these bits:

              private Series<string> myBackBrushes;
              ..

              myBackBrushes = new Series<string>(this, MaximumBarsLookBack.Infinite);
              ..

              if (colorCondition)
              myBackBrushes[1] = myColor.ToString();
              ..

              "Hiding"
              for (int i = 1; i < BackBrushes.Count-1; i++)
              {
              BackBrushes[i] = Brushes.Transparent;
              }
              ..

              "Restoring"
              for (int i = 1; i < BackBrushes.Count-1; i++)
              {
              var converter = new System.Windows.Media.BrushConverter();
              var brush = (Brush)converter.ConvertFromString(myBackBrushes[i]);
              brush.Freeze();
              BackBrushes[i] = brush;
              }

              Not sure about the necessity of calling Freeze in this case.
              Last edited by drmartell; 05-24-2017, 12:56 PM.

              Comment


                #8
                Hello drmartell,

                When the disable is triggered you would need to loop through all bars on the chart and set the BackBrushes[barsAgo index] for that bar either to a brush or Brushes.Empty.
                Last edited by NinjaTrader_ChelseaB; 05-24-2017, 02:04 PM.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hello drmartell,

                  When the disable is triggered you would need to loop through all bars on the chart and set the BackBrushes[barsAgo index] for that bar either to a brush or Brushes.Empty, or use the Reset() with that bar number.
                  Thank you, any obvious improvement then to the solution I've come to so far? (above)

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by poplagelu, Today, 05:00 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post poplagelu  
                  Started by fx.practic, 10-15-2013, 12:53 AM
                  5 responses
                  5,407 views
                  0 likes
                  Last Post Bidder
                  by Bidder
                   
                  Started by Shai Samuel, 07-02-2022, 02:46 PM
                  4 responses
                  98 views
                  0 likes
                  Last Post Bidder
                  by Bidder
                   
                  Started by DJ888, Yesterday, 10:57 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by MacDad, 02-25-2024, 11:48 PM
                  7 responses
                  161 views
                  0 likes
                  Last Post loganjarosz123  
                  Working...
                  X