Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I use OrderFlowCumulativeDelta on multiple time frames?

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

    How do I use OrderFlowCumulativeDelta on multiple time frames?

    Let's use a multi-timeframe setup. The chart on my screen will be a 1-minute chart, and I would like to obtain cumulative delta values from both a 3 minute and a 5 minute chart.

    After reading the documentation I am left a little confused. This is what I have, simplified:

    Code:
    private OrderFlowCumulativeDelta cumulativeDelta1;
    private OrderFlowCumulativeDelta cumulativeDelta2;

    Code:
    if (State == State.Configure)
    {
    
    AddDataSeries(Data.BarsPeriodType.Tick, 1);
    AddDataSeries(Data.BarsPeriodType.Minute, 3);
    AddDataSeries(Data.BarsPeriodType.Minute, 5);
    
    }
    Code:
    if (State == State.DataLoaded)
    {
    
    cumulativeDelta1 = OrderFlowCumulativeDelta(Closes[2], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0);
    cumulativeDelta2 = OrderFlowCumulativeDelta(Closes[3], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0);
    
    }

    Code:
    protected override void OnBarUpdate()
    {
    
    if (BarsInProgress == 0) // my 1 minute chart?
    {
          // I do not want to do anything here(?)
    }
    else if (BarsInProgress == 2) // my 3 minute chart?
    {
         // I want to get the cumulative delta of the 3 minute chart. is that here?
        Print("Delta1 Close: " + cumulativeDelta1.DeltaClose[0]);
    }
    else if (BarsInProgress == 3) // my 5 minute chart?
    {
        // I want to get the cumulative delta of the 5 minute chart. is that here?
        Print("Delta2 Close: " + cumulativeDelta2.DeltaClose[0]);
    }
    
    }



    And what's going on in your example where this happens. Do I need to do it twice? And if so, where?

    Code:
    cumulativeDelta1.Update(cumulativeDelta1.BarsArray[1].Count - 1, 1);
    cumulativeDelta2.Update(cumulativeDelta2.BarsArray[1].Count - 1, 1);

    My goal is to be able to use both Cumulative Delta's to make a decision:


    Code:
    if(
        cumulativeDelta1 > ABC
        cumulativeDelta2 > XYZ
    ) {
        // do something
    }
    Thanks,
    Phil

    Last edited by torch2k; 05-21-2021, 06:26 AM. Reason: added goal

    #2
    Hello torch2k,

    Thanks for your post.

    Typically you would access the current value of the two cumulative deltas in BarsInProgress 0 where you are making your decisions to trade. You would not need a BarsInProgress 2 or 3 unless you wanted to do something when those barsArrays call the OnBarUpdate().

    Yes, you do need to update both instances of the cumulative delta and as the help guide example shows, that should be done when the tick data series (BarsInprogress 1) calls OnBarUpdate().

    With reference to the second example in the help guide you would want something like:

    if (BarsInProgress == 0)
    {

    if( cumulativeDelta1 > ABC cumulativeDelta2 > XYZ )
    {
    // do something
    }
    else if (BarsInProgress == 1) // update/sync the cumulative delta
    {
    cumulativeDelta1.Update(cumulativeDelta1.BarsArray[1].Count - 1, 1);
    cumulativeDelta2.Update(cumulativeDelta2.BarsArray[1].Count - 1, 1);
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    591 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    553 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X