Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Interfacing between Strategy and Indicator and Multiple Market Graphs

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

    Interfacing between Strategy and Indicator and Multiple Market Graphs

    My goal is to have a 2 panel chart ES and NQ on the screen using the strategy analyzer.

    I also want to be able to do something like color code a section of a bollinger band from within a strategy interactively on either chart.

    I know how to access multiple market bars from within a strategy, but not how to have both charts plotted when using strategy analyzer so that I can test different strategies.

    Can someone tell me what's the best way to go about this?







    #2
    Hello joejoeagogo,

    There is not currently a way to visualize more than 1 dataseries as bars series in the analyzer. A strategy by nature can only use 1 visual series meaning if you applied the strategy anywhere such as a Chart then it will only use the primary series you selected from the chart. Any additional data the strategy adds would be invisible to the chart. There are some options for plotting secondary data from a strategy which includes multiple panels however those panels would relate to the primary bars meaning they have the same slots for bars as the primary. You can see a sample of plotting to multiple panels here: https://ninjatrader.com/support/help..._a_ninjasc.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Thanks for the quick response,

      Is there a good way to implement the color changing of the indicator from the strategy?

      Basically from a strategy OnBarUpdate function:

      if (some_condition) {
      bollingerband.lowercolor = Brushes.Red;
      } else {
      bollingerband.lowercolor = Brushes.Green;
      }

      etc?

      Comment


        #4
        Hello joejoeagogo,

        You could use PlotColors very similar to the psudocode you provided. With the indicator instance you would call myIndicatorVaraible.PlotBrushes[0][0] = Brushes.Red;

        https://ninjatrader.com/support/help...ub=plotbrushes

        The first [0] would be the index of the plot you wanted to set the brush for

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello joejoeagogo,

          You could use PlotColors very similar to the psudocode you provided. With the indicator instance you would call myIndicatorVaraible.PlotBrushes[0][0] = Brushes.Red;

          https://ninjatrader.com/support/help...ub=plotbrushes

          The first [0] would be the index of the plot you wanted to set the brush for
          Does that allow me to set parts of the indicator line different colors dynamically? How would I set the lower line of this Red when the close is below it/green above it from the strategy?

          I have this indicator bollinger:

          [....]

          else if (State == State.DataLoaded)
          {
          sma = SMA(Period);
          stdDev = StdDev(Period);
          }
          }

          protected override void OnBarUpdate()
          {
          double sma0 = sma[0];
          double stdDev0 = stdDev[0];

          Upper[0] = sma0 + NumStdDev * stdDev0;
          Middle[0] = sma0;
          Lower[0] = sma0 - NumStdDev * stdDev0;

          }

          #region Properties

          [NinjaScriptProperty]
          [XmlIgnore]
          [Display(Name="LowColor", Order=1, GroupName="Parameters")]
          public Brush LowColor
          { get; set; }

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

          Comment


            #6
            Hello joejoeagogo,

            Yes, that sets the brush for the [0] BarsAgo on the plot you specify.

            In the bollinger the Lower plot is the 3rd added so you could use PlotBrushes[2][0] to color the current bars plot value for the Lower plot.

            The first [0] would be the index of the plot you wanted to set the brush for and the second [0] is the BarsAgo.

            Please let me know if I may be of further assistance.

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello joejoeagogo,

              Yes, that sets the brush for the [0] BarsAgo on the plot you specify.

              In the bollinger the Lower plot is the 3rd added so you could use PlotBrushes[2][0] to color the current bars plot value for the Lower plot.

              The first [0] would be the index of the plot you wanted to set the brush for and the second [0] is the BarsAgo.

              Please let me know if I may be of further assistance.
              I got it working.

              Thanks!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              574 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              332 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
              553 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