A separate-pane oscillator that smooths price with a selectable moving average, then scores its direction by looping over a range of lookbacks from a start to an end value.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
320 lines of Pine Script v6 from indicator/olg_7_6_26/LyroRS/15.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
The score is compared with long and short thresholds to mark uptrend and downtrend states. It can also detect divergences between price and the oscillator using adjustable pivot lookbacks and a bar range. A state table and color palettes are available.
Moving average direction score over a lookback range
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Select Moving Average BB
string
ALMA
bench
MA - Length
int
35
length
Source 1
source
close
source
Calculate Divergence
bool
true
calculateDivergence
Threshold Long
int
23
Threshold_L_Fl
Threshold Short
int
2
Threshold_S_Fl
From
int
54
a_
To
int
100
b_
Force Table Overlay
bool
false
fo
enable_table
bool
true
enable_table
For Loop Table
string
Middle Right
pos_table
table_size_input
string
Normal
table_size_input
Show all 20 settings
Setting
Type
Default
Variable
Custom Color Palette
string
Mystic
ColMode
Use Custom Palette
bool
false
cpyn
Custom Up
color
#00ff00
cp_UpC
Custom Down
color
#ff0000
cp_DnC
Lookback Right
int
5
lookbackRight
Lookback Left
int
5
lookbackLeft
Range Upper
int
60
rangeUpper
Range Lower
int
5
rangeLower
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This separate-pane indicator plots a MACD line, a signal line, and a histogram whose colors show whether the histogram is rising or falling above or below zero. The oscillator and signal can each use an SMA or an EMA, and an optional marker highlights MACD and
This indicator computes a scaled Price Percentage Oscillator divergence between fast and slow lookback periods applied to a minimax-transformed stepline of price data. It generates a weighted divergence line using WMA and EMA smoothing, then plots a scaled ver
This indicator plots an RSI and a PMARP line in a separate pane. It calculates RSI from a chosen source and length, then overlays an SMA or EMA signal. Horizontal bull and bear control and critical levels scale the oscillator. Optional arrows mark regular and
The Relative Strength Index indicator calculates momentum based on price changes over a specified length and plots the curve in a separate pane. It includes adjustable upper and lower bands, background color fills, and an optional smoothing moving average or B
This indicator evaluates how price relates to one selected moving-average family rather than treating a crossover as a signal. It scores trend quality, historical respect of the average, extension, compression, acceleration, and exhaustion, then plots a relati
This indicator combines RSI and MFI into a hybrid oscillator scaled to 0-1. It detects divergences by comparing price and MFI slopes from linear regression. The MFI receives extra weight during divergence to amplify the effect. A TMA smooths the hybrid result