Quantity delta evaluation is a well known method utilized by many merchants to get predictive indicators in the marketplace. As a helpful addition to the entire buying and selling quantity on a single bar or particular time interval, quantity delta is a distinction between purchase and promote volumes on the identical span. It is a signed worth.

Because of availability of tick historical past in MetaTrader 5, it is potential to calculate quantity delta for alternate devices. If a tick is marked by TICK_FLAG_BUY, its quantity ought to be counted as optimistic, and if a tick is marked by TICK_FLAG_SELL, it is destructive. It is a most dependable methodology, as a result of it is not an estimation, however offers precise quantity delta. Which is why we point out it first, out of the listing of different strategies of estimation. If you want, it may be listed as 0-th, only for reference.

### 0. Delta by Tick Flags

This strategy is implemeted in a number of merchandise supporting quantity delta evaluation, similar to customized charts mills (PointFigureKagiCharts, RenkoFromRealTicks) and indicators (VolumeDeltaWaves, VolumeDeltaScanner, VolumeDeltaPercentRange).

Sadly, it doesn’t work for Foreign exchange, CFDs and different non-exchange symbols, the place actual volumes are unavailable. For such environments we must always implement an algorithm (or a set of algorithms) of quantity delta estimation based mostly on accessible tick properties.

The merchandise talked about above present a number of appropriate strategies to select from, however since they attempt to approximate the delta utilizing some assumptions on oblique price-volume interconnections, they could work good beneath one situations and never beneath the others.

Lets us think about the accessible strategies. If you happen to give you one other algorithm, be at liberty to counsel it.

### 1. Ask or Bid change

It appears logical that if Ask worth strikes up between 2 consecutive ticks, there was a purchase commerce and quantity delta ought to be incremented by 1 (we are able to solely rely ticks when actual volumes are lacking). Equally, if Bid worth strikes down between 2 consecutive ticks, there was a promote commerce and quantity delta ought to be decremented by 1. If each Ask and Bid have been modified in reverse instructions concurrently, the impact is neutralized: +1 and -1 offers 0.

Right here is the way it seems to be on a customized Level And Determine chart generated for EURUSD. Please observe that the delta is displayed by the use of a particular indicator CustomVolumeDelta.

For BTCUSD this algorithm is illustrated by VolumeDeltaScanner indicator. Internally, each implementations share the identical supply code.

### 2. Common worth change (Ask + Bid) / 2

If the sum of Ask and Bid costs strikes up or down with a tick, this may be thought-about on account of purchase or promote commerce respectively. Therefore the delta ought to be elevated or decreased.

Right here is how the delta seems to be for this methodology on the identical EURUSD PnF customized chart:

And right here is how BTCUSD laid out:

One necessary factor to notice: totally different algorithms produce totally different outcomes, and it’s best to manually estimate which one seems to be extra right. The choice is restricted to market, image, dealer, and doubtless different circumstances.

This turns into much more apparent as we transfer to the subsequent methodology.

### 3. Chart’s constructing worth change (Bid or Final)

The underlying worth kind used to kind candles is taken into account in MT5 as a number one/base worth. One can rely its upward change as a purchase, and downward change as a promote. For some devices this ought to be a preferrable methodology, whereas for some others it could produce unusual outcomes.

For EURUSD PnF we bought the next display:

However on the BTCUSD chart we see apparent optimistic bias within the delta.

All potential skewness of the quantity deltas is defined by underlying tick movement for particular instrument (from a specific dealer), there isn’t any bug within the algorithm. That is the results of the specificity of the ticks: upward ticks arrive a lot regularly then downward ticks. For instance, MT5 will get 10 ticks the place the worth goes 1 level up in each tick, then MT5 will get 1 tick the place the worth goes 10 factors down. All algorithms of quantity delta calculation based mostly on worth transfer, will rely this as (+10 -1), which provides +9, even supposing worth is retraced and even could go down (therefore we might suppose that the quantity delta ought to be close to zero, however that is not the case). In accordance with some researches, this difficulty could principally have an effect on the strategy 3: delta by Bid or Final.

Anybody prepared to examine such knowledge singularity can export tick historical past to a csv file, import it to Excel (or different e-table software program) and carry out calculations by built-in formulae. Alternatively, you possibly can obtain the script TickFlow.mq5 (see under), and let it accumulate the delta for you.

### Taking worth delta into consideration

To make the image extra satisfactory from person’s viewpoint, a particular choice may be launched – identify it UsePriceChangeInDelta – to take worth distance between ticks into consideration when estimating quantity delta. In different phrases, the quantity added or subtracted to/from the cumulative delta is an element of factors/pips.

Right here is how BTCUSD chart modifications when this feature is enabled in VolumeDeltaScanner:

Now it seems to be extra legitimate.

But this feature could have its personal drawbacks, so it ought to be enabled just for these symbols for which the dealer sends such oddly biased quotes/ticks. The principle disadvantage is that the *quantity delta turns into extra dependent from worth motion*, and fewer helpful compared to different strategies, the place quantity delta can and in lots of circumstances does certainly present divergence with worth, giving up predictive insights – this appears to be the principle energy of the quantity evaluation.

The truth that a knowledge feed could have peculiarities is one the explanation why the merchandise ought to present many alternative modes of the delta calculation. And a dealer ought to select an acceptable one.

The script TickFlow.mq5 permits you to select a date vary (Begin, Cease) to course of, or decide up the datetime of a single bar the place the script was dropped on chart (if DropTarget is true). The script loops by way of all ticks within the vary or within the scope of the chosen bar, and accumulates quantity delta utilizing an algorithm in calcDelta perform. At the moment it is Bid worth change, however may be changed with another directions.

lengthy calcDelta(const MqlTick &t, const MqlTick &p) { const lengthy v = (lengthy)MathMax(t.quantity, 1); if(t.bid > p.bid) return v; else if(t.bid < p.bid) return -v; return 0; }

The script outputs collected stats to the log.