Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

be able to change color in exported strategy with indicator

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

    be able to change color in exported strategy with indicator

    HI,
    I have strategy that calls on external indicator, when I export strategy it includes an indicator. Indicator itself has settings to change colors, however when I export the strategy and load it, down there under indicators there is no way to change colors.


    Is there a way export and be able change colors of an indicator in strategy basically?

    #2
    Hello tkaboris,

    The settings would have to be set by the strategy.

    private MyIndicator indy;

    indy = MyIndicator();
    indy.MyProperty = 5;

    You could add public properties to the strategy and use these to set the indicator values.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      HI Chelsea B.

      Still a bit confused. I have in my indicator

      [NinjaScriptProperty]
      [XmlIgnore]
      [Display(Name="DownTrendColor", Description="Color of the down trend line.", Order=6, GroupName="Parameters")]
      public Brush DownTrendColor
      { get; set; }

      [Browsable(false)]
      public string DownTrendColorSerializable
      {
      get { return Serialize.BrushToString(DownTrendColor); }
      set { DownTrendColor = Serialize.StringToBrush(value); }
      }

      [NinjaScriptProperty]
      [XmlIgnore]
      [Display(Name="UpTrendColor", Description="Color of the up trend line.", Order=7, GroupName="Parameters")]
      public Brush UpTrendColor
      { get; set; }

      [Browsable(false)]
      public string UpTrendColorSerializable
      {
      get { return Serialize.BrushToString(UpTrendColor); }
      set { UpTrendColor = Serialize.StringToBrush(value); }
      }

      and in strategy i have
      private BBTrendLine BTL;
      BTL = BBTrendLine(false, Strength, true, false, 60, Brushes.Black, Brushes.Green, Brushes.Black, Brushes.Green,3);

      I need to set Brushes.Black to DownTrendColor and Brushes.Green to UpTrendColor

      Thank you

      Comment


        #4
        Hello tkaboris,

        What is the method signature of this indicator call?
        (So I know what each of the parameters in the indicator method call are)
        You can take a screenshot of this from the intelliprompt.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          its right here
          Click image for larger version

Name:	image.png
Views:	55
Size:	83.3 KB
ID:	1315867

          Comment


            #6
            Hello tkaboris,

            From the signature it looks like you are supplying Brushes.Black as the downTrendColor and Brushes.Green as the upTrendColor.

            When running the strategy is the strategy adding the indicator to the chart with AddChartIndicator() in State.DataLoaded?

            Is the indicator not using the colors supplied by the strategy? (This might indicate a mistake in the code of the indicator)
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Well signature uses downtrendcolor but its parameters are hard coded to black and gree.

              When running the strategy is the strategy adding the indicator to the chart with AddChartIndicator() in State.DataLoaded?
              Yes - AddChartIndicator(BTL);

              Is the indicator not using the colors supplied by the strategy? (This might indicate a mistake in the code of the indicator)
              no setting colors in indicator properties
              ​​Click image for larger version  Name:	image.png Views:	0 Size:	41.3 KB ID:	1315870

              Comment


                #8
                if I load indicator seperatly all is showing fine
                Click image for larger version

Name:	image.png
Views:	59
Size:	287.1 KB
ID:	1315872

                Comment


                  #9
                  Hello tkaboris,

                  An indicator added by a strategy cannot be configured manually.

                  Is the indicator using the brushes supplied by the strategy?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Is the indicator using the brushes supplied by the strategy?
                    No, its not.

                    Comment


                      #11
                      Hello tkaboris,

                      This may mean there is a mistake in the indicator.

                      Where is DownTrendColor used in the indicator code?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        HI here are where its used in indicator
                        DownTrendColor = Brushes.Black;

                        if (ShowHistory)
                        {
                        Draw.ArrowDown(this, "UpTrendBreak" + unique + lineCount.ToString(), true, barsAgo, High[barsAgo] + TickSize, DownTrendColor);
                        }

                        [NinjaScriptProperty]
                        [XmlIgnore]
                        [Display(Name="DownTrendColor", Description="Color of the down trend line.", Order=6, GroupName="Parameters")]
                        public Brush DownTrendColor
                        { get; set; }

                        [Browsable(false)]
                        public string DownTrendColorSerializable
                        {
                        get { return Serialize.BrushToString(DownTrendColor); }
                        set { DownTrendColor = Serialize.StringToBrush(value); }
                        }​​

                        Comment


                          #13
                          Hello tkaboris,

                          It looks like the indicator is overriding whatever the user has set and is assigning DownTrendColor to Brushes.Black which would mean the user selecting the color when manually adding the indicator or when the strategy is adding the indicator will have no effect.

                          If that line is removed, does the behavior still occur?
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            If i comment out DownTrendColor = Brushes.Black; in indicator, standalone indicaotor still works as expected and i I change color it changes it.
                            indicator from strategy still has no parameters to change color.
                            Attached Files

                            Comment


                              #15
                              Hello tkaboris,

                              When you say "strategy still has no parameters to change color" I'm not sure I understand.

                              From your post # 5 it would look like this indicator as 4 parameters for colors in the overload parameters.

                              BTRendLine(bool alertOnBreak, int strength, bool showHistory, bool limitHistory, int limitHistoricalLookback, Brush downTrendColor, Brush upTrendColor, Brush downHistColor, Brush upHistColor, lineWidth)
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by NullPointStrategies, Yesterday, 05:17 AM
                              0 responses
                              61 views
                              0 likes
                              Last Post NullPointStrategies  
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              134 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              75 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              45 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              50 views
                              0 likes
                              Last Post TheRealMorford  
                              Working...
                              X