OPEN-SOURCE SCRIPT

Buying & Selling Pressure

מעודכן
Buying and selling pressure is a volatility indicator which denotes the balance between buyers and sellers inside candlestick.
You set the length to average it just like ATR. But This offers further break down of participants of the market.
Pretty much at any condition of the market the indicator can filter out interesting details to make trading decisions faster or confirm them.

So keep it simple we have two lines
🟢 Green → buying pressure
🔴 Red → selling pressure

If green is rising → Price most likely will grow
If green is rising and red is falling → Price will grow at higher probability
If red is rising → Price most likely will fall
If red is rising and green is falling → Price will fall at higher probability

When they both grow or fall → wait till one of them goes opposite way.

╳ Crossings can indicate turning points for bigger price swings.
Technically by very act of intersecting means that Buying and Selling Pressure are equal.

Can be used for Demand/Supply analysis and evaluate the support/resistance levels.
הערות שחרור
Fixed
הערות שחרור
Added background colors depending on relationship between average BP and SP
הערות שחרור
UPDATE:
Now when Buying Pressure falls, it turns 🔵 blue.
Selling Pressure turns 🟠 orange once it falls accordingly.
It is important to document these crucial changes of bullish and bearish incentive of the market.
הערות שחרור
Now BSP is based on candle's actual body without excluding wick measurement out of formula.
It was very sensitive to market noises, giving us confusing signals. Eliminating wicks metrics contributed to more accurate capture of bullish and bearish market and their timing.
For example capture of covid19 lockdown 📉 bearish wave.
תמונת-בזק
הערות שחרור
Thanks to bipinkaswala for noticing bug.

הערות שחרור
Summarized formula of BP and SP. Also enabled consideration of wicks. Was a bad idea taking them down out of formula. Added tracking by def.
הערות שחרור
Added switch for considering wicks in the formula. Some people thought it was a good idea using the indicator without wicks to eliminate noises in certain conditions of the market.
הערות שחרור
Added:
  • Ability to change the type of MA
  • Removed maxval limits
  • Separate fills coloring different stages of the market
הערות שחרור
Added:
  • ATR for a better visualization of candle proportions
  • Ability to change ATR Length


For example, default settings of BSP together with ATR changed to 200 would look like:
תמונת-בזק
הערות שחרור
Minor bug fix
הערות שחרור
Added averaging of Upper Wick and Lower Wick (UW & LW)
With SAME arguments for all:
  • Value of ATR will always be more than BP OR SP because buying and selling pressure are parts of a bar
  • Upper and Lower Wicks (LW and UW) will always be smaller their correspondent BP and SP


Meaning that if ATR (twice the default argument of BSP averaging) can represent mathematical max of given Volatility.
Meanwhile darkened Lower & Upper Wicks zone
suppose to represent Volatility floor.
Made them all black because their crossings aren't as significant as their levels. However, we would still consider that in this instance the measurement of Lower Wick is above Higher Wick
Therefore, we can observe how Buying & Selling Pressure emerge from Upper & Lower Wicks to ATR levels
BSP & ULW are averaged equally. Ability to change ATR is also present.

Also added another averaging type called "SWMA"
הערות שחרור
Update:
Added other components of Candle Metrics to complete Volatility picture.

1. Average Wick Range (grey step line):
2. Total Wicks Range (black step line)
3. Average Body Range (black line)
4. Dots indicate metrics of Higher Wick
5. Crosses (+) indicate metrics of Lower Wick
הערות שחרור
UPD:
Added switches in User Inputs section for:
  • ATR
  • Average Body Range ABR (Black line tends to have direct correlation with ATR)
  • Average Higher and Lower Wicks HW LW
  • Average Total Wicks Range TWR (Grey Step line to differ from ABR)

Average Wick Range is not displayed by default due to discovering alternative way of outputting Elements of Candle Metrics.
Set length of 14 periods for all components to align with default arguments for majority Volatility indicators.

The closer Average Body Range approaches ATR levels of the same period, the more confident candlestick of any direction tends to become. (As greater Body Range portion occupies the True Range)
תמונת-בזק

Similarly, Buying or Selling Pressure trending together with Average Body Range indicates candle takeover by either one of them.
תמונת-בזק

Hence, the Total Wicks Range (TWR) would most likely show inverse correlation to Average Body Range (ABR) dynamics. (ATR = Total Wick Range + Average Body Range + gaps if any. If one of the components becomes bigger the other gets relatively smaller accordingly)
תמונת-בזק

Alternatively, specific mode allows to view BSP together with Higher & Lower Wicks and look for correlation between them. (Usually at some phase during uptrend BP>SP and BP>BP[1], HW gets bigger than LW indicating probability of going opposite direction, resulting in SP>BP. Same with downtrend - during rise of sizes of red candles (SP), the LW gets relatively bigger and at some point has potential of causing BP > SP).
תמונת-בזק
הערות שחרור
  • Now all Volatility components are averaged by a single input argument
  • Added BSP background colors (Not activate in default settings)
  • Average Wick Range can be added separately from Higher & Lower WR
  • Organized the Inputs into 3 sections of Candle Metrics: BSP, ATR & ABR, Wicks Ranges
הערות שחרור
Added a feature to adjust Buying and Selling Pressure to their relativity.
BP and SP multiplied by averaged ratio of their direct relationship. For example, BP = BP x MA(BP/SP). The lower the MA, the more sensitive it gets. Adjusting output to their interdependence increases the responsiveness to ongoing formation of the candles. Also it is a measure to reduce lagging and false signals. Not recommended to view other components of Candle Metrics with enabled Relativity Mode because the difference will be vast. I added ATR alongside with BSP to show the reason visually.
Original:
תמונת-בזק
Relativity Mode:
תמונת-בזק
הערות שחרור
  • Darkened area on exhaustion of bulls and bears. תמונת-בזק
  • Updated BP:SP relativity formula and default settings תמונת-בזק
    In this mode turn off other candle ranges due to vast differences in scale.
  • Added zone of ATR and Average Wick Range (AWR) תמונת-בזק
הערות שחרור
  • Replaced BG highlights with Bar Color
  • Changed the color of bullish exhaustion to violet (Better delivers a sense of transformation than previous color in use)
  • Eliminated unnecessary lines
הערות שחרור
Fixed small bug
הערות שחרור
  • Added "Linear Regression" and 4-polar "Gaussian" to the available averaging type options
  • Added dynamics of 1% of the closing price to maximize awareness of the Candle Metrics figures.
הערות שחרור
Shifting 4 to the 10th-order Polar Gaussian Filter

Enhanced smoothing technique that removes noise without sacrificing the filter’s ability to detect significant price changes. This balance of averaging and responsiveness is specifically designed to capture the unique oscillations within candle fragments.

תמונת-בזק
הערות שחרור
  • BSP now operates exclusively in "Raw" mode. Removed the ability to use conditional classification before averaging by period. Since bullish and bearish candles each have parts of both, it was essential to average them specifically on periodic basis, so transition in volatility and incentive shifts are captured smoothly. For non-periodic separate averaging of bullish and bearish bars by past occurrence count - use "Average Bullish & Bearish Percentage Change" indicator.
  • Added ability to customize shaded BSP highs.
ATRBODYbuyingpressureCandlestick AnalysisincentivemetricsmultitimeframeOscillatorsrangesellingpressurevolatiltywicks

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?

כתב ויתור