Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

user defined method

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

    user defined method

    The following compiles without issue within a strategy:

    Code:
    CrossAbove(SMA(14), SMA(12), 8);
    However, within a user defined method (UDM), the same code will not compile.

    I have passed the IDataSeries into the UDM, and manually created Indicators within the UDM


    Code:
    	public string getSummary(IDataSeries o, IDataSeries h, IDataSeries l, IDataSeries c, IDataSeries v){
    		string retVal = "";
    		op = o;
    		hi = h;
    		lo = l;
    		cl = c;
    		vol = v;
    		
    		retVal += getClose().ToString("F2")  + ",\t";
    		retVal += tRSI.RSI(cl, 14, 0)[0].ToString("F2") + ",\t";
    		CrossAbove( tSMA.SMA(cl, 20), tSMA.SMA(cl, 40), 5 );
    		retVal += tSMA.SMA(cl, 20);
    		
    		return(retVal);
    	}
    the above getSummary is within a class in

    Code:
    namespace NinjaTrader.Strategy
    any ideas why CrossAbove() is not available? What am I missing?

    #2
    Hello caliope,

    Thank you for your post.

    Please take a look at the information at the following link on accessing class instances: http://www.ninjatrader.com/support/f...25&postcount=5

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    85 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    48 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    29 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    32 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    67 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X