Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Function the returns/accepts a data series for NT8, syntax help.

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

    Function the returns/accepts a data series for NT8, syntax help.

    I'm stuck on a bit of syntax from an older NT7 indicator.

    An older function from NT7 was defined as:
    Code:
    public [COLOR=#e74c3c]IDataSeries[/COLOR] KVOLfunc([COLOR=#e74c3c]IDataSeries [/COLOR]TPYDAY,[COLOR=#e74c3c]IDataSeries [/COLOR]TPTOYDAY,int fastX,int trigLen,int slowX)
    {
    
    SVOL.Set(TPTOYDAY[0]>=TPTOYDAY[0] ? +Volume[0] : -Volume[0]);
    KVOL.Set(EMA(SVOL,fastX)[0]-EMA(SVOL,slowX)[0]);
    return KVOL;
    }
    To convert this to NT8, I am aware the set() method no longer works and has to be defined explicitly with assignment...

    But my question is about the highlighted sections above. How do you describe these data series for this function? I was trying to find syntax help HERE, but I have not been able to work it out.

    #2
    Originally posted by soon123
    For
    Code:
    public IDataSeries KVOLfunc (....)
    No need ,IDataSeries.
    If you are return a double value why have to do so.
    You can put it as double type function.
    Thank you sir!

    That was it. I'm needing to modify an already declared dataseries with that function, I just didn't understand the syntax. What wound up compiling was:
    Code:
    public ISeries<double> KVOLfunc(ISeries<double> TPYDAY, ISeries<double> TPTOYDAY,int fastX,int trigLen,int slowX)
    {
            SVOL[0] = (TPTOYDAY[0]>=TPTOYDAY[0] ? +Volume[0] : -Volume[0]);
            KVOL[0] = (EMA(SVOL,fastX)[0]-EMA(SVOL,slowX)[0]);
            return KVOL;
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    82 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    43 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Working...
    X