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 Kaledus, Today, 01:29 PM
    3 responses
    9 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by frankthearm, Yesterday, 09:08 AM
    14 responses
    47 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by gentlebenthebear, Today, 01:30 AM
    2 responses
    13 views
    0 likes
    Last Post gentlebenthebear  
    Started by PaulMohn, Today, 12:36 PM
    2 responses
    17 views
    0 likes
    Last Post PaulMohn  
    Started by Conceptzx, 10-11-2022, 06:38 AM
    2 responses
    56 views
    0 likes
    Last Post PhillT
    by PhillT
     
    Working...
    X