Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NBarsDown call

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

    NBarsDown call

    Hi:

    I have made several addOns with NT8 and find it quite a useful upgrade. I still remain completely at a loss as to the Class Hierarchy within Ninja.

    While the following function works well within an indicator or strategy, the HighestBar() call fails to compile without the IndicatorBase prefix. No amount of tweaking the using NinjaTrader... namespace declarations would fix the error. Only trial end error found the IndicatorBase.HighestBar().

    Code:
    		private double getRange(int per){
    			// determine the vertical range of the previous period
    			double ttop = hhigh[IndicatorBase.HighestBar(hhigh, per)];
    			double bbot = llow[IndicatorBase.LowestBar(llow, per)];
    			return (ttop - bbot);
    		}
    I am now in the same position with

    Code:
    		public bool isReversalUp( int bAgo ){	// finds reversal up from consecutive lows followed by consecutive highs
    			bool retVal = false;
    			if( ( NBarsDown(bAgo-1, true, true, true)[bAgo] == 1.0) && (NBarsUp(bAgo-1, true, false, true)[bAgo-2] == 1.0 ) )
    					retVal = true;
    			return retVal;
    		}
    NBarsDown() is no where to be found, and no hint or documented reference as to the class or namespace.

    Apologies for sounding frustrated, as I really appreciate this product, but where can I find the NBarsDown() reference?

    #2
    Hello,

    NBarsDown inherits from Indicator, which inherits from IndicatorRenderBase. Since this is actually an indicator method, you will need to obtain an instance of the class itself in order to work with it. There is a good discussion on the thread below which should shed some light on this issue:

    Dave I.NinjaTrader Product Management

    Comment


      #3
      As always, thanks for prompt and excellent reply.

      the following mod to my original code works great.


      Code:
      		public bool isReversalUp( int bAgo ){	// finds reversal up from consecutive lows followed by consecutive highs
      			bool retVal 	= false;
      			Indicator ind 	= new Indicator();	
      			NBarsDown nbd 	= ind.NBarsDown(hhigh, bAgo, true, true, true);
      			NBarsUp nbu 	= ind.NBarsUp(	hhigh, bAgo, true, false, true);;	
      
      			if( ( nbd[bAgo] == 1.0 ) && (nbu[bAgo-2] == 1.0 ) )	retVal = true;
      
      			return retVal;
      		}

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      671 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      379 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      111 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      575 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      582 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X