Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Max/Min Value for Custom Indicator

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

    Max/Min Value for Custom Indicator

    Not seeing any posts or info on plotting a Max/Min value for an indicator here really, just stuff on Max/Min for price.

    All I am doing is creating a BollingerBand Width and plotting the Max/Min of that indicator over x amount of bars, similar to a Donchian Channel.

    Here is the code logic. Everything compiles, but it is just plotting 0 for the Max & Min values

    Code:
    			else if (State == State.DataLoaded)
    			{
    				max = MAX(Plot0,150);
    				min = MIN(Plot0,150);
    			}
    			
    		}
    
    		protected override void OnBarUpdate()
    		{
    			if (CurrentBar < Period) 
    			{
    				return;	
    			}
    
    			double max0 = max[0];
    			double min0	= min[0];
    				
    			Plot0[0] = (Bollinger(Deviation,Period).Upper[0] - Bollinger(Deviation,Period).Lower[0])/Bollinger(Deviation,Period).Middle[0]*100;
    			Upper[0]	= max0;
    			Lower[0]	= min0;
    						
    		}
    Attached Files

    #2
    Hello EC_Chris,

    Thank you for the post.

    I see that you are passing the Plot0 to the Min and Max but you are setting Plot0 after using Min and Max. Could you try adjusting where Plot0 is being set and see if this resolved the 0 values?


    Code:
    Plot0[0] = (Bollinger(Deviation,Period).Upper[0] - Bollinger(Deviation,Period).Lower[0])/Bollinger(Deviation,Period).Middle[0]*100;
    
    double max0 = max[0];
    double min0	= min[0];
    		
    Upper[0]	= max0;
    Lower[0]	= min0;
    I look forward to being of further assistance.

    Comment


      #3
      Ah, dumb mistake there on my part. thought I had tried that.

      Thanks for your help!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      637 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      571 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X