OPEN-SOURCE SCRIPT

Buy and Sell with Oscillator Divergence

Mis à jour
This exploratory script provides a graphical representation of "Peaks" and "Dips" during market expansion, where traders are likely to take part of their profits. One possible use is with a contrarian entry strategy: selling when buyers have finished taking their profits and buying when sellers have finished taking their profits. This is achieved by comparing the strength of an existing trend by analysing the price and any given oscillator between two consecutive peaks or dips for regular divergences.

The script combines Bollinger Band expansion to detect extreme points. It then compares a single oscillator of choice (e.g., RSI, CCI, Stoch RSI, or MACD) to determine whether the value of the oscillator between two Bollinger Band extremes is increasing or decreasing, thereby detecting possible divergence with the price. Additionally, there is an option to include any other oscillator of choice as an input source for the oscillator, provided that it is loaded on the chart.

In an uptrend, if the price continues to peak higher while the oscillator peaks lower, it indicates signs of bullish exhaustion. Conversely, in a downtrend, if the price keeps dipping lower while the oscillator dips higher, it signals bearish exhaustion.

The above can be used in conjunction with price action analysis to identify entry or exit points near key areas of support or resistance. The script is intended for exploratory and educational purposes, is a work in progress, it requires further tunning, and does not constitute financial advice.
Notes de version
Added a check for volume and relative volatility to filter out signals which happen during low volatility sessions.
Notes de version
-Made some cosmetic changes.
-Added additional BUY, SELL signals to compare divergence between two consecutive BUY or two consecutive SELL signals.
Notes de version
- Fixed some bug in the logic to filter out unnecessary signals.
multitimeframeOscillatorsTrend Analysis

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité