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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    569 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    548 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X