Above average volume previous bar


Category:
0
0

Hello Pete,

I hope you are doing well.

I wanted to follow up on the following code you posted for the following request: https://www.hahn-tech.com/ans/above-average-volume-watch-list-column/

input length = 14;
plot data = volume > Average(volume, length);
data.SetDefaultColor(Color.BLACK);
AssignBackgroundColor(if data then Color.GREEN else Color.RED);

Is it possible to modify this code with the following for a watchlist column filter, please?

  1. Background color turns green if previous bar is above average.
  2. Keep the background color black (instead of red) if the above parameter isn’t met.
  3.  Can this be added as a chart label as well?

I appreciate any help you can provide.

thanks in advance,

Luis

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on July 12, 2024 9:59 am
30 views
0
Private answer

There is hardly any difference between your request and the previous so this is very close to being a duplicate question. But I decided to approve this question and created a solution which is designed to serve the interests of the majority of our viewers. Which means I have adjusted the color and the way the values are displayed so that it will work on a wide variety of settings which users of Thinkorswim may adjust to control the "look and feel" of the platform.

This solution works equally well as both a custom watchlist column or a chart study.

There are no such things as "filters" in custom watchlists on Thinkorswim. We can display values, but we cannot filter the contents of the watchlist based on those values. So if you refer to this solution as a "filter", that terminology is a bit misleading. The official term for this, as given by Thinkorswim, is a "Custom Quote Field". But most folks tend to understand it more clearly when it is described as a "custom watchlist column".

input length = 14;
def priorBarSignal = volume[1] > Average(volume[1], length);
AddLabel(yes, if priorBarSignal then Concat("Prior Vol > Avg: ", volume[1]) else Concat("Prior Vol < Avg: ", volume[1]), if priorBarSignal then Color.GREEN else Color.GRAY);

For those interested in adapting this to show the signal based on the current bar instead of the previous then you can user the other solution which I have included below:

input length = 14;
def priorBarSignal = volume > Average(volume, length);
AddLabel(yes, if priorBarSignal then Concat("Vol > Avg: ", volume[1]) else Concat("Vol < Avg: ", volume[1]), if priorBarSignal then Color.GREEN else Color.GRAY);

Marked as spam
Posted by (Questions: 37, Answers: 4116)
Answered on July 12, 2024 10:10 am