Plot highs and lows for above average volume bars


Category:
0
0

Greetings again sir,

Im requesting assistance on a script for the daily chart displaying a horizontal line plotting the high and lows of daily candles with minimum of 5mil in vol that can be adjusted.

Thank you

RESOLVED
Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on March 10, 2023 1:36 am
124 views
0
Private answer

I updated the title of your question to include the full context of your request. The title you choose was lacking important details which help the rest of our viewers to find this type of solution using the search function.

And speaking of the rest of our viewers. The solutions provided in this forum are intended to serve the interests of the majority of our viewers. I keeping with this, I have modified your specifications to include a moving average of the volume with two user inputs. One controls the length of that moving average. The other controls the multiplier applied to the average volume.

In this way, the solution is able to quickly and automatically adapt to a wide variety of ticker symbols and time frames. You can adjust those inputs to fit your own specific requirements.

Here is the solution I created:

input averageLength = 14;
input avgVolumeMultiplier = 2.0;
def averageVolume = Average(volume, averageLength);
def targetBar = volume > averageVolume * avgVolumeMultiplier;
rec trackHigh = if targetBar then high else trackHigh[1];
rec trackLow = if targetBar then low else trackLow[1];
plot highVolumeHigh = trackHigh;
highVolumeHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
highVolumeHigh.SetDefaultColor(Color.DARK_GREEN);
plot highVolumeLow = trackLow;
highVolumeLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
highVolumeLow.SetDefaultColor(Color.DARK_RED);

The screenshot below shows the result. I have placed the cross-hairs of the chart over one of the bars which meets the high volume limit. You can see the average volume for that bar is 5.7 million and the bar that generated those lines has a volume of 7.6 million.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on March 10, 2023 1:53 pm
0
what would I add to the script to make these lines extend to the right?
( at March 10, 2023 10:29 pm)
0
We can only do plot statements on Thinkorswim and the only way to get lines like this to extend right is by using drawing tools in place of plot statements. However at this time Thinkorswim does not allow chart studies to create or modify drawing objects on the chart. There is no way to do that for now.
( at March 11, 2023 8:49 am)