Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

lost in multi-time-frame ....

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

    lost in multi-time-frame ....

    i'm trying to change the Keltner channel to an indicator that uses 2min data on my volume charts.... i've already done this successfully with an HMA and SMA both having bollinger bands but for some reason i can't understand how to come up with or diff[0] properly ?

    here's what i've tried so far and either get "can't apply indexing to a double" or "High doesn't exist in this context"

    else if (State == State.Configure)
    { AddDataSeries(BarsPeriodType.Minute, 2); }

    else if (State == State.DataLoaded)
    {
    diff = new Series<double>(this);
    emaDiff = EMA(diff, Period);
    emaClose = EMA(BarsArray[1],Period);
    }
    }
    protected override void OnBarUpdate()
    {

    /// diff[0] = High[0] - Low[0]; /// ORIGINAL;

    /// diff[0] = High[1][0] - Low[1][0]; ///// nope indexing
    /// diff[0] = BarsArray[1]High[0] - BarsArray[1]Low[0]; //// not working either indexing

    diff = High (BarsArray[1])[0] - Low (BarsArray[1])[0]; //// High doesn't exist in this context

    double middle = emaClose[0];
    double offsetOne = emaDiff[0] * OffsetOne;
    double offsetTwo = emaDiff[0] * OffsetTwo;

    double upper = middle + offsetOne;
    double lower = middle - offsetOne;
    double upper2 = middle + offsetTwo;
    double lower2 = middle - offsetTwo;

    Midline[0] = middle;

    if ( PlotBands1 )
    { Upper[0] = upper;
    Lower[0] = lower; }

    if ( PlotBands2 )
    { Upper2[0] = upper2;
    Lower2[0] = lower2; }

    it seems to me that there shouldn't be any difference between the original argument and the one with [1][0] in it. What am i missing ?
    i also tried the argument in the State.DataLoaded section with the same results...
    thanks,
    w

    #2
    Hello stafe ,

    I believe you are just missing the spelling here, the multi series Series<T> objects are all plural such as Highs or Lows.

    If you wanted to do the equivalent of the original diff it would look like this:


    Code:
    /// diff[0] = High[0] - Low[0]; /// ORIGINAL;
    
    
    /// diff[0] = Highs[0][0] - Lows[0][0]; /// Multi-ORIGINAL;
    
    
    /// diff[0] = Highs[1][0] - Lows[1][0]; /// Secondary

    As a side note it looks like you are currently allowing this logic to calculate for the Primary and Secondary. If you meant to isolate this to a specific serires and its frequency be sure to use a BarsInProgress condition. if(BarsInProgress == 0) { }




    I look forward to being of further assistance.

    Comment


      #3
      ok, whew, , , thought i was losing it more than i was... it's just like Plot vs Plots calls... 'doh

      and i'm understanding that if i want the logic to apply only to the secondary bar series (2min) i would wrap the logic in - - if(BarsInProgress == 1) { indicator logic }

      Comment


        #4
        Hello stafe,

        Yes that is correct, if you want to isolate logic that would be the BarsInProgress property. All the indexes are 0 based so 0 would be the primary and 1 the secondary.


        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        657 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        373 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        579 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X