OPEN-SOURCE SCRIPT

RedK Bar Strength Inspector / Bar Strength Index (BSI)

Summary
=========

The Bar Strength Inspector / Bar Strength Index (BSI) is an indicator that evaluates each price bar against a user-selectable set of "strength categories" - BSI then calculates a combined score from these categories and provides an index - plotted as a centered oscillator - roughly similar to the way Relative Strength Index (RSI) works, which can be used to evaluate the strength of price move and the possibilities of trend continuation or reversal.

Background
=============
BSI is like a Swiss-army knife with many components - so apologies upfront if this guide gets long - and i know i will still miss few pieces that needs explaining. please alert me if something is not clear.

BSI is an advanced / re-built version of my Ultimate Trader Oscillator (UTO)

I continue to believe that one of the best trading tools that i can use, is a tool that can automate the visual inspection of the price chart - a tool that simulates (and quantifies in numbers/score) the way we visually look at a certain price bar, and make a judgement that "this is a strong bar, so I expect the trend down to possibly reverse" - BSI is a an attempt to achieve that. An attempt to answer a simple question (in a quantifiable manner):
how strong / weak is this price bar - how does it compare to previous bars ? what is the average of that strength (or weakness) for the last few bars ?(based on the trader's preferred timeframe)

How does BSI work
====================

* BSI will inspect and evaluate each bar against various (selectable) strength categories.
* BSI will give a -100/+100 score against each "strength category", then combine these scores into an index and create an average of that index
* the average index (also called BSI) will be calculated for both a short and long lengths
* the short length represents "local / short-term" strength - plotted as a blue/orange line (with an additional signal line to make easier to "read")
* the long-term reflects the broader bias (sentiment) - plotted as green/red area (or mountain)

How is BSI different from UTO
=============================

- I wrote BSI from the ground up to validate each scoring calculation and the resulting outcomes - so i would consider BSI to be more accurate than UTO
- i wrote BSI in a way to make it a lot more flexible. BSI allows me to choose which category to include in the "inspection"
- the strength categories are streamlined to reflect single bar strength, strength from bar-to-bar, and relative strength (range and volume) - they have also been chosen in a way that map to commonly used Technical Analysis concepts, to increase the value of BSI and the ability to compare with other common indicators (for example, BoP, Stochastic, Relative Volume and RSI)
- added the table view - which i use mainly to track the action within the current bar - and to learn more about how to evaluate strength vs weakness with various chart patterns
- UTO still represents the foundation of this work - but i will not update UTO any longer so all changes will be applied to the BSI- i have been using both UTO and BSI to guide my trading for the past few months.
- couple of other features in BSI:
- support for instruments with no volume data (even if the user chooses volume) - number of inspection categories will show as "7" in that case
- ability to plot the individual category scores, and the total weighted score (for the selected categories) - these plots are hidden by default
- ability to see the total score for all 8 (or 7 in case no volume data) categories regardless of how many are active - but only in the table view
- ability to be used as both a lower (independent) and a top indicator (on the price chart) -- see below examples.


Structure of the BSI Strength Categories
=====================================

  • The first 3 inspected strength categories focus on "single bar strength", they evaluate how the bar closes compared to the low, the Balance of Power (BoP) and the relative BoP
  • The next 3 categories focus on evaluating the bar-to-bar strength: how the bar closes compared to the low of the 2-bar range, how the bar closes compared to prior close - and the relative "shift"
  • The last 2 "strength" categories evaluate the relative range of bar compared to recent average range and the relative volume.


Understanding the bar inspection & scoring approach
==================================

* During inspection for each category, a score is calculated with a value between 0 to 100, then it will be made "directional" - which means that +100 represents highest possible strength score and a value of -100 is the highest possible "weakness" score
* Note that a 0 score doesn't mean "weak" - but rather "neutral" - this can be a bit confusing until we get used to the way BSI scoring works.
* Example: in relative volume, a bar associated with the lowest volume observed during the lookback length, will have a 0 relative volume score -- while a bar associated with the highest volume observed will have either a +100 or a -100 score (depending on whether it's an up or down bar) - same thing for relative range.. and so on

Here are the 8 strength categories evaluated by the BSI

1 Bar closing score
2 Body : Spread (BoP) ratio
3 Relative BoP
4 2-bar Closing Score
5 2-bar Shift Ratio (Shift : 2R)
6 Relative Shift
7 Relative Range
8 Relative Volume


Specific meaning of keywords / concepts (within BSI context):
======================================================
Relative : compared to recently observed values (= within Lookback # bars)
Shift : the change in closing value vs prior bar
Bar Spread : high - low
Range : True Range ..... as in the tr() Pine function, so not to be confused with "spread"

More detailed notes about scoring and calculations for each strength category are included within the code

BSI Settings:
=============

Here is a chart showing the main sections in the BSI Settings box and how to configure it to your preference
ảnh chụp nhanh

Using the BSI:
================
- I use BSI for 2 main scenarios
(1) Guiding my Day-to-day trading: the usage here is roughly similar to a volume-weighted dual-period RSI .. with a lot more options - picking and choosing between the 8 strength categories in BSI allows for 255 variations of "strength evaluations" - a trader can choose to focus only on "single bar strength" score categories, so only picks the top 3 in the settings - another trader wants to track only the strength reflected by the relative range and relative volume, so picks the lower 2 categories. another trader wants to use BSI as a volume weighted Balance of Power.. and so on. Many combinations are possible.

i have added couple of charts that explain some of the "signals" we can expect from BSI (below chart) - note that i use the "Green/Red mountain plot" as the "prevailing sentiment" - as it confirms the longer term strength (or weakness). the BSI line plot reflects the short term strength and not necessarily tied directly to how the price is moving (see example in the chart - and also compare to how RSI works)

- 2 important points here if you plan to use BSI in trading: set BSI up on a 1-min or 5-min chart and watch how it works to learn how it evaluates each bar - and always use BSI in combination with other indicators that you are familiar with to validate and confirm any signals
(Important note: do not react to the values in the table as they change in real time - i found that to be very tempting - rather look at the broader context and the flow of the BSI / sentiment) - you can also test BSI with Paper Trading in TV - it's like a new car that you need some time to get used to :)

(2) Use BSI to help learn chart / pattern analysis - watch BSI print scores against the various categories in real time to hone your chart (pattern) reading skills and how to evaluate strength of various bar shapes - for example, a bar that closes at the high but does not reach the mid point of the prior bar - strong or weak ? how about a doji or a hammer ? ...etc

Chart showing main usage scenarios
ảnh chụp nhanh

Example BSI in real time:
======================

ảnh chụp nhanh

I hope this work helps few fellow traders hone their trading skills, or help inspire other ideas - please let me know if you have feedback or suggestions.


barscoringbarstrengthinspectorbopBSICentered OscillatorsOscillatorsredkstrengthUTOVolume

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm