Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    -EC_Chris-
    NinjaTrader Ecosystem Vendor - Emergent Cybernetics

    #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.
    JesseNinjaTrader Customer Service

    Comment


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

      Thanks for your help!
      -EC_Chris-
      NinjaTrader Ecosystem Vendor - Emergent Cybernetics

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rocketman7, Today, 02:12 AM
      5 responses
      22 views
      0 likes
      Last Post rocketman7  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      7 responses
      27 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by samish18, 04-17-2024, 08:57 AM
      17 responses
      65 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by briansaul, Today, 05:31 AM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by PaulMohn, Today, 03:49 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X