Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator in Market Analyzer

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

    Indicator in Market Analyzer

    Hello All-

    I have a created an indicator that will plot a colored diamond under candlesticks on the chart if certain price action requirements occurred in the 2 previous closed bars.

    The indicator works just fine on the the charts. However, what I ultimately want to do is use the Market Analyzer and add my custom indicator in a column there in order to look at just one window instead of having to have all the charts up for the different instruments.

    I can't seem to figure out or find out how to do this.

    I know how to add the indicator column to the Market Analyzer buts that as far as I can get.

    On the charts the plotted diamonds will be one of 4 different colors depending on the previous price action. I thought I could somehow number each one of the different price action patterns and have that number appear in an added column in the Market Analyzer.

    Hopefully this makes sense, I can clarify anything that doesn't. Let me know.

    Thank you,

    Nick


    #2
    Hello njmeyer713,

    From the given details the only item that I could say may be wrong would be that you would need to use a single Plot when using the analyzer column. The plotted value could be a simple 1,2,3,4 depending on which diamond was being shown. That would allow you to use the conditions in the column to color it.

    The plot also needs to be consistent so if the diamonds only occasionally get plotted on the chart you would have to keep persisting the last plot value for each new bar. What I mean would simply be the following before setting the plot to one of the four choices.

    Value[0] = Value[1];

    That sets the current plot value to the last plot value to carry it over, it can still be reset on this bar but it starts with the previous value. That lets the analyzer show a value constantly so the conditions can work.

    Comment


      #3
      Jesse-

      Thank you for the response.

      Here are 2 of the 4 price action scenarios I have.

      // Set 1
      if ((High[1] <= High[2])
      && (Low[1] >= Low[2])
      && (GetCurrentBid(0) >= (High[1] + (-4 * TickSize)) ))
      {
      Draw.Diamond(this, @"AAATOS Diamond_1", false, 0, (Low[0] + (-100 * TickSize)) , Brushes.Green);
      Trade = 1;
      }


      // Set 2
      if ((High[1] <= High[2])
      && (Low[1] >= Low[2])
      && (GetCurrentBid(0) <= (Low[1] + (4 * TickSize)) ))
      {
      Draw.Diamond(this, @"AAATOS Diamond_2", false, 0, (Low[0] + (-100 * TickSize)) , Brushes.Green);
      Trade = 2;
      }


      What I want to happen is if the conditions in Set 1 are met, I want the column I added in the Market Analyzer for the various instruments to show a 1.

      If the conditions in Set 2 are met I want the column to show a 2.

      My initial attempts have been to get '"Trade" to show up in the drop down menu under Indicator in the Properties screen when I add my AAATOS indicator as a column in the Market Analyzer.

      I appreciate your response above but I need more direction on what code and where to put it in the NinjaScript Editor.

      Let me know what I can further clarify is needed.


      Thank you,

      Nick

      Comment


        #4
        Hey Jesse-

        I was hoping you could get back to me today. I'd like to keep programming and then test this indicator.

        Thank you!

        Nick

        Comment


          #5
          Hello njmeyer713,

          As long as Trade is a plot you could do that with the code you provided. As previously mentioned, if the condition is not true for every bar then you need to carry over the previous value so it shows up in the analyzer. You would need to make sure Trade is a Plot for it to show up in the indicator column of the market analyzer. if it is the only plot you don't need to select it but just the indicator.




          Comment


            #6
            Jesse-

            Thank you for the response. I can't figure out how to add Trade as a plot. In the code provided I believe that Trade is an int variable.

            I know how to add an AddPlot in the State.Defaults but I don't know how to get it to plot the value either 1,2,3,4 of Trade.

            Thank you,

            Nick

            Comment


              #7
              Hello njmeyer713,
              You can use AddPlot and the just set the plot using Value[BarsAgo]. The plot could be set below each area where Trade is set.

              For example:

              Code:
              Trade = 1;
              would become
              Code:
              Trade = 1;
              Value[0] = 1;
              You would also need this code before //set 1

              Code:
              if(CurrentBar < 1) return;
              
              Value[0] = Value[1];
              //set 1

              https://ninjatrader.com/support/help...ghtsub=addplot

              Comment


                #8
                Jesse-

                Thank you!

                I am making progress on it now.

                Another question, if none of the 4 conditions were met/true how could I get the indicator to show a 0? I believe based on what you have provided so far, if the conditions are not met, then it will plot the same value as the last one. Is this correct? If so, can we get it to plot a 0 instead?

                Thank you again,

                Nick

                Comment


                  #9
                  Hello njmeyer713,

                  You could add another condition for that. If you have a condition which will always be true if the others are not then that would create a continuous plot. One item to keep in mind would be that if the conditions to set the value to 1 is true for 1 bar and then is no longer true you may not see that in the analyzer depending on the bar frequency, the analyzer generally works best to show values which remain the same for a period of time so you can actually observe it in the window.

                  You could make your conditions into else statements to create a set of conditions which fall through to a default:

                  Code:
                  // Set 1
                  if ((High[1] <= High[2])
                  && (Low[1] >= Low[2])
                  && (GetCurrentBid(0) >= (High[1] + (-4 * TickSize)) ))
                  {
                  Draw.Diamond(this, @"AAATOS Diamond_1", false, 0, (Low[0] + (-100 * TickSize)) , Brushes.Green);
                  Trade = 1;
                  }
                  else if ((High[1] <= High[2])
                  && (Low[1] >= Low[2])
                  && (GetCurrentBid(0) <= (Low[1] + (4 * TickSize)) ))
                  {
                  Draw.Diamond(this, @"AAATOS Diamond_2", false, 0, (Low[0] + (-100 * TickSize)) , Brushes.Green);
                  Trade = 2;
                  }
                  else {
                    Trade = 0;
                  }
                  If set 1 and 2 are false then by default the third else is true making the plot 0.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  647 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  369 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  108 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  572 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  573 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X