Order Flow Cumulative Delta

View as Markdown

Description

An indicator that accumulates the volume of orders filled at bid and ask prices or up and down ticks throughout the session and compares them to determine buy/sell pressure.

Syntax

OrderFlowCumulativeDelta(CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter)

OrderFlowCumulativeDelta(ISeries\<double\> input, CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter)

Returns Open value

OrderFlowCumulativeDelta(CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter).DeltaOpen[int barsAgo]

OrderFlowCumulativeDelta(ISeries\<double\> input, CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter).DeltaOpen[int barsAgo]

Returns High value

OrderFlowCumulativeDelta(CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter).DeltaHigh[int barsAgo]

OrderFlowCumulativeDelta(ISeries\<double\> input, CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter).DeltaHigh[int barsAgo]

Returns Low value

OrderFlowCumulativeDelta(CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter).DeltaLow[int barsAgo]

OrderFlowCumulativeDelta(ISeries\<double\> input, CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter).DeltaLow[int barsAgo]

Returns Close value

OrderFlowCumulativeDelta(CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter).DeltaClose[int barsAgo]

OrderFlowCumulativeDelta(ISeries\<double\> input, CumulativeDeltaType deltaType, CumulativeDeltaPeriod period, int sizeFilter).DeltaClose[int barsAgo]

Return Value

double; Accessing this method via an index value [int barsAgo] returns the indicator value of the referenced bar.

Parameters

ParameterDescription
inputIndicator source data (Series<T>)
deltaTypeThe type of data to delta calculates on:
• BidAsk
• UpDownTick
periodThe period in which the delta accumulates:
• Session
• Bar
sizeFilterInput to exclude volume less than the selected value

Examples

1// Calling the OrderFlowCumulativeDelta() method directly
2// A 1 tick data series must be added to the OnStateChange() as this indicator runs off of tick data
3else if (State == State.Configure)
4{
5 AddDataSeries(Data.BarsPeriodType.Tick, 1);
6}
7
8// OnBarUpdate() logic
9if (BarsInProgress == 0)
10{
11 // Print the close of the cumulative delta bar with a delta type of Bid Ask and with a Session period
12 Print("Delta Close: " + OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaClose[0]);
13}
14else if (BarsInProgress == 1)
15{
16 // We have to update the secondary series of the cached indicator to make sure the values we get in BarsInProgress == 0 are in sync
17 OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).Update(OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).BarsArray[1].Count - 1, 1);
18}
1// Calling the OrderFlowCumulativeDelta() method by reference
2
3// A 1 tick data series must be added to OnStateChange() as this indicator runs off of tick data
4else if (State == State.Configure)
5{
6 AddDataSeries(Data.BarsPeriodType.Tick, 1);
7}
8else if (State == State.DataLoaded)
9{
10 // Instantiate the indicator
11 cumulativeDelta = OrderFlowCumulativeDelta(CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0);
12}
13
14if (BarsInProgress == 0)
15{
16 // Print the close of the cumulative delta bar with a delta type of Bid Ask and with a Session period
17 Print("Delta Close: " + cumulativeDelta.DeltaClose[0]);
18}
19else if (BarsInProgress == 1)
20{
21 // We have to update the secondary series of the hosted indicator to make sure the values we get in BarsInProgress == 0 are in sync
22 cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);
23}