Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

parse the color code from serializable value to use as a condition for entry

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

    parse the color code from serializable value to use as a condition for entry

    Hi,
    I would like to get a value of a serializable color from indicator and if color changes from say red to green enter long. the print statement for this value shows: Buy: <SolidColorBrush xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">#FF008000</SolidColorBrush> So if I can say if previous value one color and current value new color then enter long. I have no control over the indicator so I cannot add a public variable for it, I need to read the value and compare to previous value

    #2
    Hello set2win,

    Is this a property set in the Indicator window for the indicator?

    Is this from PlotBrushes?

    Is this from BarBrushes?

    Where are you trying to get this color from?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      public string BuyingColorSerializable
      {
      get
      {
      return Serialize.BrushToString(this.BuyArea);
      }
      set
      {
      this BuyArea = Serialize.StringToBrush(value);
      }
      }
      I can add it as an indicator so can I do something with Plot?

      Comment


        #4
        Hello set2win,

        Try printing it:

        private MyIndicatorName myIndy;

        myIndy = MyIndicatorName();

        Print(myIndy.BuyArea);
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          yes printing BuyArea does show the color code. But I need the value serialzed as I need to know when the color changes. I can't index the BuyArea, cant apply indexing to media.brush is compilation error. Could I use if ( (MyIndy.Value [0] && MyIndy.BuyArea == green) && (MyIndy.Value[1] && MyIndy.BuyArea == red) Disregard the color coding at this point.
          Last edited by set2win; 03-31-2022, 02:21 PM.

          Comment


            #6
            Hello set2win,

            I'm not sure I understand.

            Serializing means making the input savable in XML like workspaces and templates.
            This means making a savable string for a public variable so its saved in XML.

            Below is a link to the help guide on serializing brush inputs.
            https://ninjatrader.com/support/help...th_brushes.htm

            A Brush is not collection and cannot be indexed. Are asking about PlotBrushes which is a collection.

            If you need to know when the color changes then you need implement INotifyChanged with an OnPropertyChanged handler.

            Or you could save the value, and check to see if its changed.

            Checking the color would be similar to MyIndy.BuyArea == Brushes.Green. You have to compare like types with like types.

            MyIndy.Value[0] is likely a double and not a bool. 'if ( (MyIndy.Value [0]' <-- this doesn't make sense. This must be compared with a number.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I think all I need is Value[0] > Value[1] && Value[1] < Value[2] as that is what is changing the color.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              81 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              149 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              79 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              52 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              59 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X