Hey there, new to usethinkscript. I've been coming up with ideas left and right for indicators these last few months and I think I've finally come up with something that might be useful to some. I call it the "Conviction Index". I also came up with a "volume weighted" Conviction Index. They give you an idea of how much conviction is in a move up or down and can give you a heads up of when to get in or out.

Basically what they do is they determine whether a move has conviction or not by combining change in volume from one period to the next with the change in price of each period. If the

Once it gets those values it sums those values of the last so many periods that you specify (Conviction Length) and by default exponentially smooths it out by the number of periods you specify. On the daily chart I set the conviction length to 6 and the smoothing length to 2. I've also used a conviction length of 18 on the 5 minute chart, but I mainly stick to the exponential smoothing length of 2 for faster signals.

I won't get into the details, but the

I also have an exponentially smoothed typical price tied to the indicator that determines it's colors. When the

I hope someone finds use for this and/or improves upon it if they have ideas. Let me know if you find use for it.

Update: Made a minor mistake and updated this line for both indicators in the coding above from this...

to this...

The change has minimal effect on how the indicators are displayed, but it's what I originally intended the calculation to be.

Basically what they do is they determine whether a move has conviction or not by combining change in volume from one period to the next with the change in price of each period. If the

**volume**of the**current period is greater than**the volume of the**previous period**and the**current period's price closes above it's open**it's value will equal**2 + 2 * the percentage change of the candle's body**. If the volume of the current period**is less than**the volume of the previous period and the current period's price**closes above it's open**it's value will equal**1 + 1 * the percentage change of the body**. If the volume of the current period**is greater than**the volume of the previous period and the current period's price**closes below it's open**it's value will equal**-2 + -2 * the percentage change of the body**. If the volume of the current period**is less than**the volume of the previous period and the current period's price**closes below it's open**it's value will equal**-1 + -1 * the percentage change of the body**.Once it gets those values it sums those values of the last so many periods that you specify (Conviction Length) and by default exponentially smooths it out by the number of periods you specify. On the daily chart I set the conviction length to 6 and the smoothing length to 2. I've also used a conviction length of 18 on the 5 minute chart, but I mainly stick to the exponential smoothing length of 2 for faster signals.

I won't get into the details, but the

**volume weighted conviction index**gets it's values**based off of the values of the volume change from period to period**but works similarly.I also have an exponentially smoothed typical price tied to the indicator that determines it's colors. When the

**smoothed typical price**and the**conviction index**are**both going up**it colors the conviction index**green**. When the smoothed typical price and the conviction index are**both going down**it colors it**red**. When the smoothed typical price and conviction index are**out of sync (ones going up, the other down)**it colors it**yellow**.**Conviction Index**
Code:

```
declare lower;
input ConvictionLength = 18;
input ExponentialSmoothing = yes;
input ExponentialSmoothingLength = 2;
def range = high - low;
def bodytop = if close > open then close else open;
def bodybottom = if close < open then close else open;
def body = bodytop - bodybottom;
def perbody = body / range;
def rangeper = range / low;
def bodyper = rangeper * perbody;
def bullcon = if close > open and volume() > volume()[1] then 2 + 2 * bodyper else if close > open and volume() < volume()[1] then 1 + 1 * bodyper else 0;
def bearcon = if close < open and volume() > volume()[1] then -2 + -2 * bodyper else if close < open and volume() < volume()[1] then -1 + -1 * bodyper else 0;
def convic = if ExponentialSmoothing == yes then ExpAverage(ExpAverage(ExpAverage(Sum(bullcon, ConvictionLength) + Sum(bearcon, ConvictionLength), ExponentialSmoothingLength), ExponentialSmoothingLength), ExponentialSmoothingLength) else Sum(bullcon, ConvictionLength) + Sum(bearcon, ConvictionLength);
def exptypprice = ExpAverage(ExpAverage(ExpAverage((high + low + close) / 3, 3), 3), 3);
plot Zero = 0;
plot ConvictionIndex = convic;
Zero.SetDefaultColor(Color.CYAN);
ConvictionIndex.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
ConvictionIndex.AssignValueColor(if (exptypprice < exptypprice[1] and ConvictionIndex > ConvictionIndex[1]) or (exptypprice > exptypprice[1] and ConvictionIndex < ConvictionIndex[1]) then Color.YELLOW else if exptypprice < exptypprice[1] and ConvictionIndex < ConvictionIndex[1] then Color.LIGHT_RED else Color.LIGHT_GREEN);
```

**Volume Weighted Conviction Index**
Code:

```
declare lower;
input ConvictionLength = 18;
input ExponentialSmoothing = yes;
input ExponentialSmoothingLength = 2;
def range = high - low;
def bodytop = if close > open then close else open;
def bodybottom = if close < open then close else open;
def body = bodytop - bodybottom;
def perbody = body / range;
def rangeper = range / low;
def volchnge = volume() - volume()[1];
def bodyper = rangeper * perbody;
def bullcon = if close > open and volume() > volume()[1] then volchnge * 2 + (volchnge * 2) * bodyper else if close > open and volume() < volume()[1] then volchnge + volchnge * bodyper else 0;
def bearcon = if close < open and volume() > volume()[1] then volchnge * -2 + (volchnge * -2) * bodyper else if close < open and volume() < volume()[1] then volchnge * -1 + (volchnge * -1) * bodyper else 0;
def convic = if ExponentialSmoothing == yes then ExpAverage(ExpAverage(ExpAverage(Sum(bullcon, ConvictionLength) + Sum(bearcon, ConvictionLength), ExponentialSmoothingLength), ExponentialSmoothingLength), ExponentialSmoothingLength) else Sum(bullcon, ConvictionLength) + Sum(bearcon, ConvictionLength);
def exptypprice = ExpAverage(ExpAverage(ExpAverage((high + low + close) / 3, 3), 3), 3);
plot Zero = 0;
plot ConvictionIndex = convic;
Zero.SetDefaultColor(Color.CYAN);
ConvictionIndex.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
ConvictionIndex.AssignValueColor(if (exptypprice < exptypprice[1] and ConvictionIndex > ConvictionIndex[1]) or (exptypprice > exptypprice[1] and ConvictionIndex < ConvictionIndex[1]) then Color.YELLOW else if exptypprice < exptypprice[1] and ConvictionIndex < ConvictionIndex[1] then Color.LIGHT_RED else Color.LIGHT_GREEN);
```

I hope someone finds use for this and/or improves upon it if they have ideas. Let me know if you find use for it.

Update: Made a minor mistake and updated this line for both indicators in the coding above from this...

Code:

`def rangeper = range / low * 100;`

to this...

Code:

`def rangeper = range / low;`

The change has minimal effect on how the indicators are displayed, but it's what I originally intended the calculation to be.

Last edited: