New Indicator... Maybe.

With that in mind, I present a new take on trying to recognize trends and important points in volume analysis, and the effects that that change can have as it applies to potential levels of support, accumulation, and distribution.

I would also like to ask the community if this is indeed a new approach, or if this has been tried and failed before. The wisdom of the many is indeed vast, though often unasked.

This started as the Psychological Line Indicator. For those who know it, feel free to skip down to the Modifications section below.

The PLI is arrived at by taking the number of bars that were up bars over the last n bars and calculating the ratio of that number to n:

This is an interesting indicator in that it ignores the price information in bars and only considers the direction moved, and gives an interesting picture of market movement.

Volume is as an important indicator of trend strength, and the idea to combine volume and movement is not a new one. Many have tried to combine volume and price movement into a strength or momentum or force indicator. Some are more successful than others. This one may or may not be an improvement on any of them.

Starting with a sum of the volume for up bars and dividing by the total volume gave a satisfyingly simple plot.

This plotted over the PLI provided little insight as the two tracked nearly identically for some tickers and varied widely for others. The theory I started working on is that when up the ratio of up-candle volume to total volume outpaces the ratio of up-candles to total bars , then there the number of people buying in hoping the price will go up is larger than the number of people holding or selling out of positions. This is perhaps a simplistic view. If the up volume on up candles does not move up as much as the PLI for the bar, then the interest in pushing the price higher is absent, and while the close was up, it was not supported on strong volume.

The difference between these two is then calculated as a ratio:

Several attempts at refining the ratio of up volume to total volume were tried. Particular interest was given to scenarios which followed on from the thought that only the volume between the open and the high (of an up bar, so the close is necessarily between the open and the high) actually contributes to pushing the price higher, only that volume is considered 'strong' up-candle volume. Strong upward volume was calculated this way:

This number was then used in the same way as (2.) above as the numerator for the calculation of the Indicator (3.)

Some attempts were made to remove 'weak' portions of volume from the total volume, but all of them turned out to be poorer than this method. They are included in the indicator code for those who wish to pursue this avenue and make potential improvements to the signals given by this indicator.

Though it is not intended to be used as a stand-alone indicator, the Indicator plot crossovers were used to assess timing by backtesting a strategy. This was a long-only test, with no short positions entered. The entry condition was a crossover above zero, along with the two bars preceding the positive value being both negative (to reduce chop).

SPY was chosen for the first test at a timeframe of 1 year at 1 day. With a setting of n=12, a total profit of $2,501 was realized. When set to n=13, the total profit was $2,496. Each of those was on a standard lot size of 100 which did not get reintroduced into the position.

Trading TSLA on a 30 day 30 minute chart without extended-trading-hours, again at 100 shares per trade, 17 trades resulted in $21,298 gross profit with n=15.

There is obviously some bias in tuning the back testing, and you may need to find a value that works for whatever ticker you are trading. The indicator was not intended to deliver signals all alone, but in combination with others or as a confirmation to other signals.

The most interesting point in the chart above is the set of positive (green) histogram bars just to the left of the cursor vertical line, about halfway across the image. This shows a divergence in price movement and an influx of volume on positive bars, possibly presaging the move upward that happens at the green histogram bars about 3/4 of the way across the image. The red histogram bars on the far left, or the far right indicate a lack of interest, possibly. The ones on the left are an indication of the larger fall that will come, and the ones on the right in the non-trending marked show that there is a general outflow compared to price. I'd be getting out of this if I were in.

Strategy Backtest 1, SPY 1Y1D n=12

Strategy Backtest 2, TSLA 30D30m n=15

### Link

http://tos.mx/xSDbRO5### Introduction

In a field of financial analysis that has seen an explosion of tinkerers, like myself, there seems likely to have been someone who tried this before. I have not found their efforts, but then again I haven't looked all that hard. Sometime we reinvent the wheel. Such is the nature of this game of trying to make a few cents in the markets.With that in mind, I present a new take on trying to recognize trends and important points in volume analysis, and the effects that that change can have as it applies to potential levels of support, accumulation, and distribution.

I would also like to ask the community if this is indeed a new approach, or if this has been tried and failed before. The wisdom of the many is indeed vast, though often unasked.

### The Indicator

**Origins**This started as the Psychological Line Indicator. For those who know it, feel free to skip down to the Modifications section below.

The PLI is arrived at by taking the number of bars that were up bars over the last n bars and calculating the ratio of that number to n:

Code:

`(1.) PLI = (count up bars in last n / n) x 100`

This is an interesting indicator in that it ignores the price information in bars and only considers the direction moved, and gives an interesting picture of market movement.

**Volume**Volume is as an important indicator of trend strength, and the idea to combine volume and movement is not a new one. Many have tried to combine volume and price movement into a strength or momentum or force indicator. Some are more successful than others. This one may or may not be an improvement on any of them.

Starting with a sum of the volume for up bars and dividing by the total volume gave a satisfyingly simple plot.

Code:

`(2.) UpVolVSTotalVolume = sum(volume for up bars in last n bars) / Total Volume last n bars`

This plotted over the PLI provided little insight as the two tracked nearly identically for some tickers and varied widely for others. The theory I started working on is that when up the ratio of up-candle volume to total volume outpaces the ratio of up-candles to total bars , then there the number of people buying in hoping the price will go up is larger than the number of people holding or selling out of positions. This is perhaps a simplistic view. If the up volume on up candles does not move up as much as the PLI for the bar, then the interest in pushing the price higher is absent, and while the close was up, it was not supported on strong volume.

**Calculating Deviation between PLI and UpVolume**The difference between these two is then calculated as a ratio:

Code:

`(3.) Indicator = (VolPLIMod - PLI) / (PLI)) * 100`

Several attempts at refining the ratio of up volume to total volume were tried. Particular interest was given to scenarios which followed on from the thought that only the volume between the open and the high (of an up bar, so the close is necessarily between the open and the high) actually contributes to pushing the price higher, only that volume is considered 'strong' up-candle volume. Strong upward volume was calculated this way:

Code:

```
(4.) StrongFraction = (high - open) / (high - low)
(5.) Strong Up Volume = sum (volume x StrongFraction)
```

Some attempts were made to remove 'weak' portions of volume from the total volume, but all of them turned out to be poorer than this method. They are included in the indicator code for those who wish to pursue this avenue and make potential improvements to the signals given by this indicator.

Though it is not intended to be used as a stand-alone indicator, the Indicator plot crossovers were used to assess timing by backtesting a strategy. This was a long-only test, with no short positions entered. The entry condition was a crossover above zero, along with the two bars preceding the positive value being both negative (to reduce chop).

SPY was chosen for the first test at a timeframe of 1 year at 1 day. With a setting of n=12, a total profit of $2,501 was realized. When set to n=13, the total profit was $2,496. Each of those was on a standard lot size of 100 which did not get reintroduced into the position.

Trading TSLA on a 30 day 30 minute chart without extended-trading-hours, again at 100 shares per trade, 17 trades resulted in $21,298 gross profit with n=15.

There is obviously some bias in tuning the back testing, and you may need to find a value that works for whatever ticker you are trading. The indicator was not intended to deliver signals all alone, but in combination with others or as a confirmation to other signals.

### Eye Candy

**Analysis**The most interesting point in the chart above is the set of positive (green) histogram bars just to the left of the cursor vertical line, about halfway across the image. This shows a divergence in price movement and an influx of volume on positive bars, possibly presaging the move upward that happens at the green histogram bars about 3/4 of the way across the image. The red histogram bars on the far left, or the far right indicate a lack of interest, possibly. The ones on the left are an indication of the larger fall that will come, and the ones on the right in the non-trending marked show that there is a general outflow compared to price. I'd be getting out of this if I were in.

**Backtesting**Strategy Backtest 1, SPY 1Y1D n=12

Strategy Backtest 2, TSLA 30D30m n=15

### The Indicator Code

Code:

```
#####################################################
# Psychological Volume Expectation
#
# 2021-01-12.V1 @mashume
# Released under GPL V3 as applicable
# to the UseThinkScript Community
# http://tos.mx/xSDbRO5
#####################################################
declare lower;
input n = 15;
input smoothing = 10;
# Uncomment this if you want to see where the indicator starts the current calculations
# def bar = barnumber();
# addverticalLine(bar == highestall(if !isNan(open) then bar else double.nan ) - n, "BACK LIMIT", color.Blue);
def isUpCandle = if close > open then 1 else 0;
plot PLI = (sum(isUpCandle, n) / n) * 100;
PLI.SetDefaultColor(getColor(3));
PLI.SetLineWeight(2);
plot PLIMA = SimpleMovingAvg(PLI, smoothing);
PLIMA.SetDefaultColor(getColor(8));
PLIMA.Hide();
plot Center = 50;
Center.SetDefaultColor(getColor(7));
Center.SetStyle(CURVe.MEDIUM_DASH);
plot Warning = 80;
Warning.SetDefaultColor(getColor(5));
Warning.SetStyle(CURVE.SHORT_DASH);
plot Opportunity = 20;
Opportunity.SetDefaultColor(getColor(6));
Opportunity.SetStyle(CURVE.SHORT_DASH);
def isUpVolSimple = if close > open then Volume else 0;
plot VolPLI = (sum(isUpVolSimple, n) / sum(Volume, n)) * 100;
VolPLI.SetDefaultColor(getColor(4));
# VolPLI.SetStyle(CURVE.POINTS);
VolPLI.SetLineWeight(2);
####################################
#
# These are experimental alternate calculation methods for volume
# which incorporate the idea of strength or conviction
#
# def isUpVol = if close > open then Volume * ((high - open) / (high - low)) else 0;
# def UpCandleDnVol = if close > open then Volume * ((open - low) / (high - low)) else 0;
# def DnCandleUpVol = if close < open then Volume * ((high - open)/(high - low)) else 0;
# def VolPLIMod = (sum(isUpVol, n) / (sum(Volume, n) - (sum(UpCandleDnVol, n) + sum(DnCandleUpVol)))) * 100;
# VolPLIMod.SetStyle(CURVE.SHORT_DASH);
#
####################################
plot Indicator = (((VolPLI - PLI) / PLI) * 100);
Indicator.SetPaintingStrategy(PaintingStrategy.histogram);
Indicator.SetLineWeight(3);
Indicator.AssignValueColor(if Indicator >= 0 then getColor(9) else getColor(5));
plot cent = 100;
cent.setdefaultcolor(getColor(7));
cent.hide();
plot VolPLIMA = SimpleMovingAvg(VolPLI, n);
VolPLIMA.SetDefaultColor(getColor(9));
VolPLIMA.SetStyle(CURVE.MEDIUM_DASH);
VolPLIMA.Hide();
plot IndicatorMA = MovAvgExponential(Indicator, floor(n/2));
IndicatorMA.SetDefaultColor(getColor(4));
IndicatorMA.SetLineWeight(1);
IndicatorMA.Hide();
AddLabel(Indicator > Indicator[1], "Rising Sentiment Volume", getColor(9));
AddLabel(Indicator < Indicator[1], "Falling Sentiment Volume", getColor(5));
AddLabel(PLI > 80, "PLI Line Warning", getColor(5));
AddLabel(PLI < 20, "PLI Line Opportunity", getColor(9));
plot StartBuy = if Indicator crosses above 0 and indicator [2] < 0 then -20 else double.nan;
StartBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
StartBuy.SetDefaultColor(GetColor(9));
StartBuy.Hide();
plot StartSell = if Indicator crosses below 0 and indicator[2] > 0 then 20 else double.nan;
StartSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
StartSell.SetDefaultColor(GetColor(5));
StartSell.Hide();
```

Last edited: