OPEN-SOURCE SCRIPT
Blue Dot Red Dot

Inspired by Dr Wish
This script is a confluence indicator designed to identify potential trend reversals or "mean reversion" trade setups. It plots buy (blue) and sell (red) dots directly on your price chart.
The core strategy is to find moments where price is overextended (using Bollinger Bands) and momentum is simultaneously reversing (using the Stochastic Oscillator). A signal is only generated when both of these conditions are met.
Core Components
The script combines two classic technical indicators:
Bollinger Bands (BB):
These create a "channel" around the price based on a simple moving average (the basis) and a standard deviation (dev).
Upper Band: Basis + (2.0 * StdDev)
Lower Band: Basis - (2.0 * StdDev)
In this script, the bands are used to identify when the price has moved significantly far from its recent average, suggesting it's "overbought" (at the upper band) or "oversold" (at the lower band) and may be due for a pullback.
Stochastic Oscillator:
This is a momentum oscillator that compares a closing price to its price range over a certain period.
It consists of two lines: %K (the main, faster line) and %D (a moving average of %K, the slower signal line).
It's used to identify overbought and oversold momentum conditions and, more importantly, momentum shifts, which are signaled by the %K and %D lines crossing.
Signal Logic: How the Dots Are Generated
This script's "secret sauce" is that it demands three specific conditions to be true at the same time before plotting a dot.
🔵 Blue Dot (Buy Signal)
A blue dot will appear below a price bar if all three of these conditions are met:
Stochastic Crossover: The faster %K line crosses above the slower %D line (ta.crossover(k, d)). This signals that short-term momentum is starting to turn bullish.
Was Oversold: On the previous bar, the %K line was below the "Oversold Threshold" (was_oversold = k[1] < oversold). This ensures the bullish crossover is happening from an oversold (or at least bearish) momentum state.
Note: The default oversold threshold is set to 50. This is a key detail. It means the script is looking for a bullish crossover that originates from anywhere in the bottom half of the Stochastic range, not just the traditional "extreme" oversold area (like 20).
Price Extension: Within the last 3 bars (the current bar or the two before it), the price's low must have touched or gone below the lower Bollinger Band (bb_touch_lower). This confirms that the price itself is in an "oversold" or overextended area.
In plain English: A blue dot appears when the price has recently dipped to an extreme low (touching the lower BB) and its underlying momentum has just started to turn back up (Stoch cross from the lower half).
🔴 Red Dot (Sell Signal)
A red dot will appear above a price bar if all three of these conditions are met:
Stochastic Crossunder: The faster %K line crosses below the slower %D line (ta.crossunder(k, d)). This signals that short-term momentum is starting to turn bearish.
Was Overbought: On the previous bar, the %K line was above the "Overbought Threshold" (was_overbought = k[1] > overbought). The default for this is 80, which is a traditional overbought level.
Price Extension: Within the last 3 bars (the current bar or the two before it), the price's high must have touched or gone above the upper Bollinger Band (bb_touch_upper). This confirms that the price itself is in an "overbought" or overextended area.
A red dot appears when the price has recently spiked to an extreme high (touching the upper BB) and its underlying momentum has just started to roll over and turn back down (Stoch cross from the overbought zone).
This script is a confluence indicator designed to identify potential trend reversals or "mean reversion" trade setups. It plots buy (blue) and sell (red) dots directly on your price chart.
The core strategy is to find moments where price is overextended (using Bollinger Bands) and momentum is simultaneously reversing (using the Stochastic Oscillator). A signal is only generated when both of these conditions are met.
Core Components
The script combines two classic technical indicators:
Bollinger Bands (BB):
These create a "channel" around the price based on a simple moving average (the basis) and a standard deviation (dev).
Upper Band: Basis + (2.0 * StdDev)
Lower Band: Basis - (2.0 * StdDev)
In this script, the bands are used to identify when the price has moved significantly far from its recent average, suggesting it's "overbought" (at the upper band) or "oversold" (at the lower band) and may be due for a pullback.
Stochastic Oscillator:
This is a momentum oscillator that compares a closing price to its price range over a certain period.
It consists of two lines: %K (the main, faster line) and %D (a moving average of %K, the slower signal line).
It's used to identify overbought and oversold momentum conditions and, more importantly, momentum shifts, which are signaled by the %K and %D lines crossing.
Signal Logic: How the Dots Are Generated
This script's "secret sauce" is that it demands three specific conditions to be true at the same time before plotting a dot.
🔵 Blue Dot (Buy Signal)
A blue dot will appear below a price bar if all three of these conditions are met:
Stochastic Crossover: The faster %K line crosses above the slower %D line (ta.crossover(k, d)). This signals that short-term momentum is starting to turn bullish.
Was Oversold: On the previous bar, the %K line was below the "Oversold Threshold" (was_oversold = k[1] < oversold). This ensures the bullish crossover is happening from an oversold (or at least bearish) momentum state.
Note: The default oversold threshold is set to 50. This is a key detail. It means the script is looking for a bullish crossover that originates from anywhere in the bottom half of the Stochastic range, not just the traditional "extreme" oversold area (like 20).
Price Extension: Within the last 3 bars (the current bar or the two before it), the price's low must have touched or gone below the lower Bollinger Band (bb_touch_lower). This confirms that the price itself is in an "oversold" or overextended area.
In plain English: A blue dot appears when the price has recently dipped to an extreme low (touching the lower BB) and its underlying momentum has just started to turn back up (Stoch cross from the lower half).
🔴 Red Dot (Sell Signal)
A red dot will appear above a price bar if all three of these conditions are met:
Stochastic Crossunder: The faster %K line crosses below the slower %D line (ta.crossunder(k, d)). This signals that short-term momentum is starting to turn bearish.
Was Overbought: On the previous bar, the %K line was above the "Overbought Threshold" (was_overbought = k[1] > overbought). The default for this is 80, which is a traditional overbought level.
Price Extension: Within the last 3 bars (the current bar or the two before it), the price's high must have touched or gone above the upper Bollinger Band (bb_touch_upper). This confirms that the price itself is in an "overbought" or overextended area.
A red dot appears when the price has recently spiked to an extreme high (touching the upper BB) and its underlying momentum has just started to roll over and turn back down (Stoch cross from the overbought zone).
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.