Price Stats


Price Stats is an indicator based on the statistics shown in MarketSmith charting software when viewing the Track Price information, also known as the "yellow box."

The following stats are available for the most recent price bar:

■ High price
■ Low price
■ Last price
■ Percent change in price from prior bar
■ Closing range within the bar
■ Current volume
Volume % change relative to the 50-day moving average volume

For daily charts:
■ 21-day EMA and % offset of price
■ 50-day SMA and % offset of price
200-day SMA and % offset of price

Here's how to interpret the moving averages:

In the image below the 50-day SMA is 74.58 (8.04%). 74.58 represents the value of the 50-day SMA . 8.04% indicates that the current price is 8.04% above the SMA . A negative % would indicate the current price is the specified % below the SMA .

Catatan Pelepasan: version 2.0

Add support to show price stats for weekly charts:
■ 10-week SMA and % offset of price
■ 40-week SMA and % offset of price
■ Price % off the 52-week high
■ 52-week price range, high to low

Catatan Pelepasan: version 3.0

■ Left/right offset of the Price Stats dialog can now be configured.
■ Minor changes to how the offset is calculated based on the day of the week.
Catatan Pelepasan: version 4.0

■ Choose your preferred font size for the text.
Catatan Pelepasan: version 5.0

■ Update formatting of the volume to make it easier to read.
Catatan Pelepasan: version 6.0

■ Add "Distance to Low" option

Knowing the distance to the low can help when setting a stop. For example, if buying an upside reversal, a logical stop could be set at the low of the bar. At a glance, you can now see the percentage and distance in points from the current price to the low. This allows for a quick determination if low is within your preferred stop range.

Catatan Pelepasan: version 7.0

■ Duplicate labels no longer appear when using the Bar Replay option
■ Code cleanup
Catatan Pelepasan: version 8.0

■ Vertical and horizontal placement of the Price Stats are now configurable.
■ Add 'High to Low' which shows range in price as points and percentage.

The 'High to Low' value may be helpful if you plan to buy on a breakout to a new high. At a glance, you'll know the percentage and distance in points if you opt to use the low of the bar as a stop.
Catatan Pelepasan: version 9.0

What's new:
■ Add 20-week simple moving average to the weekly chart.
Catatan Pelepasan: version 10.0

What's New:
■ Price Stats can be shown in a table with a configurable location.
Catatan Pelepasan: version 11.0

What's New:
■ Computations that return NaN (Not a Number) will now return 0.
Catatan Pelepasan: version 12.0

What's New:
■ Minor updates to the display of 52-week highs and lows.
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Rumah. Anda boleh menyukai skrip ini untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?
30+ years in software dev. Technology author. Growth stock & crypto trader.

If you find my indicators helpful, please consider a donation:

Bitcoin: 36A51Xdi4HVGYxH86kRvQ74Tzp5xWU1HvU


Thanks for sharing this. I find it very useful. Is there a way to display the stats for any bar as you hover over it (i.e. previous days) or will it only display for the last bar?
+1 Balas
JohnMuchow dadoftwins09
Custom indicators do not have a means to determine when a user clicks/hovers over a bar. Hopefully someday...
Amazing Tool but give option or make it automatic for all time frame from 1 min to day or week
+1 Balas
JohnMuchow vikkranntshah
I can look into adding the stats on additional timeframes.
+1 Balas
vikkranntshah JohnMuchow
@JohnMuchow, thank you so much
+1 Balas
Thanks for the script, could you add Relative volume to ?
+1 Balas
JohnMuchow dAyWeeDz
Thanks for the suggestion. I am working on ideas on how to manage a longer list of items. If interested, you can make a local copy and add the relative volume for you own use.
Thank you for this, but a correction (I think) and a few requests, please.

The descriptions says:
In the image below the 50-day SMA is: 74.58 (8.04%). That is, the current price is 74.58 points above the 50-day SMA . Likewise, the current price is 8.04% above the 50-day SMA .
But I don't think you mean the current price is the moving average (e.g. 74.58) above the moving average.

can you add commas to volume total to separate and make more readable?
is it possible to make the box and contents larger for my old eyes?

It is nice having this info close to the current prices, and not have to move your eyes back and forth across the screen
Thanks again
+1 Balas
JohnMuchow latabasco
Thanks for the comments. The description of the points above the moving average is correct. In the line 74.58 (8.04%), that means the price is 74.58 points about the 50-day MA, which is 8.04%.

I can add an option to change the size of the font. Pine Script limits this to pre-determined values, so there are limits to the choices.

As far as using a thousands separator, I looked into that as it's much easier to read. However, there is no built-in function within Pine Script to accomplish that. I would need to write a function to parse and re-build a string adding the commas where needed.
latabasco JohnMuchow
Sorry, old eyes, hard head
as shown in the example:
In the image below the 50-day SMA is: 74.58 (8.04%). That is, the current price is 74.58 points above the 50-day SMA .

If the 50 SMA is 74.58 as stated, and the current price is 74.58 above the 50 SMA, wouldn't that imply the current price is 149.16?
I concur the current price (80.58 as shown) is 8.04% above the 50 SMA, but do not see how the current price (again 80.58) " 74.58 points above the 50-day SMA."
+1 Balas