Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar Graph function not working in Market Analyzer

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

    Bar Graph function not working in Market Analyzer

    I have a very simple mov avg difference that plots just fine on a chart. I wanted to use it in the market analyzer to tell me in the short term whether and instrument short term Hull MovAvg is greater or lesser than a longer term HMA. It works on a chart but when I put it in the market analyzer as an indicator and set the value to chart as a bar graph it doesn't work. Here is the code I am using in the indicator and I am doing this in Version 7.0. By the way I started with trying to paint the background a different color for each condition and that works on a chart, but doesn't work on the MA. Is there some example or method I could use to plot various conditions, (specific to a particular line in the MA rather than all lines)?
    Code:
    		protected override void Initialize()
    		{
    			Add(new Plot(Color.Transparent,  "Hull_MA_Short"));
    			Add(new Plot(Color.Transparent, "Hull_MA_Long"));
    			Add(new Plot(Color.Black, PlotStyle.Bar,"HMA_Diff"));
    			DrawOnPricePanel = false;
    
    			Overlay				= true;	// Plots the indicator on top of price
    			diffSeries1			= new DataSeries(this);
    			diffSeries2			= new DataSeries(this);
    		}
    
    		/// <summary>
    		/// Called on each bar update event (incoming tick)
    		/// </summary>
    protected override void OnBarUpdate()
    		{
    			double value1 = 2 * WMA(Inputs[0], (int)(Period_S / 2))[0];
    			double value2 = WMA(Inputs[0], Period_S)[0];
    			diffSeries1.Set(value1 - value2);
    
    			Value_S.Set(WMA(diffSeries1, (int) Math.Sqrt(Period_S))[0]);
    
    			double value3 = 2 * WMA(Inputs[0], (int)(Period_L / 2))[0];
    			double value4 = WMA(Inputs[0], Period_L)[0];
    			diffSeries2.Set(value3 - value4);
    
    			Value_L.Set(WMA(diffSeries2, (int) Math.Sqrt(Period_L))[0]);
    			
    			Value_Diff.Set(Value_S[0] - Value_L[0]);
    			double value5 = Value_Diff[0];
    			
    		if (value5 > 0)	
    			{
    			BackColor = Color.PaleGreen;
    			}
    			else BackColor = Color.LightSalmon;	
    			}
    I am plotting "HMA_Diff" which is the third plot statement in the code above.
    Thanks
    DaveN

    #2
    DaveN,

    Can you please clarify what exactly you mean by "does not work"? What happens instead? Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I also have a problem with the BarGraph setting. Does this setting apply to every column?

      I changed the Type property of the NetChange column to BarGraph and nothing displays in this NetChange column. I have a second NetChange column that has no problem displaying a text value when the Type property is set to Regular.

      Comment


        #4
        Hello,

        Thank you for the question.

        The value would be in percent by default, if you are using percent you would need to change the "Max bar graph display value".

        I tried "1" and I am able to see the bars for the percentages, if the value is too small I.E. less than 10%, you could use 0.1 instead to view a 10% range instead of 100%.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          That did the trick. Thanks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by warreng86, 11-10-2020, 02:04 PM
          4 responses
          1,355 views
          0 likes
          Last Post mathewlo  
          Started by Perr0Grande, Today, 08:16 PM
          0 responses
          2 views
          0 likes
          Last Post Perr0Grande  
          Started by elderan, Today, 08:03 PM
          0 responses
          5 views
          0 likes
          Last Post elderan
          by elderan
           
          Started by algospoke, Today, 06:40 PM
          0 responses
          10 views
          0 likes
          Last Post algospoke  
          Started by maybeimnotrader, Today, 05:46 PM
          0 responses
          12 views
          0 likes
          Last Post maybeimnotrader  
          Working...
          X