Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cant get bar colors on indicator to save

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

    Cant get bar colors on indicator to save

    Hello, I am having trouble getting a bar color setting to save. When I save workspace, the bar colors for this indicator revert back to original once I close out of the workspace. Help!
    Attached Files

    #2
    Hi A Derpy Cucumber

    If you serialize the Positive and Negative bar colours in Properties:

    Add this after your "Positive Bar Color" at for example line 165

    Code:
    [Browsable(false)]
    public string PositiveBarColorSerializable
    {
    get { return Serialize.BrushToString(PositiveBarColor); }
    set { PositiveBarColor = Serialize.StringToBrush(value); }
    }


    and then add this after your "Negative Bar Color" :

    Code:
    [Browsable(false)]
    public string NegativeBarColorSerializable
    {
    get { return Serialize.BrushToString(NegativeBarColor); }
    set { NegativeBarColor = Serialize.StringToBrush(value); }
    }


    So you should then have this:

    Code:
    [NinjaScriptProperty]
    [XmlIgnore]
    [Display(Name = "Positive Bar Color", Description = "Color of bars with a positive value", Order = 5, GroupName = "RSI Histogram")]
    public Brush PositiveBarColor
    { get; set; }
    
    [Browsable(false)]
    public string PositiveBarColorSerializable
    {
    get { return Serialize.BrushToString(PositiveBarColor); }
    set { PositiveBarColor = Serialize.StringToBrush(value); }
    }
    
    [NinjaScriptProperty]
    [XmlIgnore]
    [Display(Name = "Negative Bar Color", Description = "Color of bars with a negative value", Order = 6, GroupName = "RSI Histogram")]
    public Brush NegativeBarColor
    { get; set; }
    
    [Browsable(false)]
    public string NegativeBarColorSerializable
    {
    get { return Serialize.BrushToString(NegativeBarColor); }
    set { NegativeBarColor = Serialize.StringToBrush(value); }
    }


    Hope this helps​​
    Last edited by dj22522; 03-30-2024, 05:28 PM.

    Comment


      #3
      Hello A Derpy Cucumber,

      Thanks for your post.

      dj22522 has provided some excellent information regarding this topic that you could review.

      User-defined brush properties could be serialized so that the values are saved when the workspace or indicator template is saved.

      See the help guide documentation below for more information.

      Working with Brushes: https://ninjatrader.com/support/help...definedbrushes
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment


        #4
        dj22522 This worked brilliantly. Thank you so very much for your help. I owe you one!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X