Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IDataSeries referencing and usage

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

    IDataSeries referencing and usage

    Hello,

    I am not very familiar with using IDataSeries in my coding and am encountering some problems when using it. See the code below. In particular, the fastMA and slowMA (which are data series coming from a multi-timeframe indicator called Trend) conditions in the if statement are not producing any values and as a result the code is producing the wrong outcome.

    protectedoverridevoid OnBarUpdate()
    {
    IDataSeries fastMA = Trend(Fast, PeriodType, PeriodValue, Slow, Type).FastMA;
    IDataSeries slowMA = Trend(Fast, PeriodType, PeriodValue, Slow, Type).SlowMA;

    if (CurrentBar < Slow) // Sufficient data check
    return;

    if ((fastMA[0] > slowMA[0] && fastMA[1] <= slowMA[1])
    || (fastMA[
    0] < slowMA[0] && fastMA[1] >= slowMA[1]))
    lookBack =
    1; // Resets lookBack at the start of a new trend
    else
    lookBack++;

    Am I doing something wrong? Do you have any examples I can look at to understand how to implement this code?

    Thanks,

    Stopped

    #2
    Problem solved, no need to reply to this, thanks

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    157 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    91 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    143 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    131 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    107 views
    0 likes
    Last Post CarlTrading  
    Working...
    X