Strategy · Pine Script v4 · Own pane

Overbought

by kat3samsin

This strategy identifies overbought conditions in uptrends for long entries.

View on GitHub

GitHub stars2on the repository
Pine versionv4older, still runs
Lines of code36
Settings6inputs
LicenceMIT
Last update5 years ago17 Mar 2021

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

36 lines of Pine Script v4 from scripts/overbought.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

overbought.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © kat3samsin

//@version=4
strategy("Overbought", overlay=false, process_orders_on_close=true)

//rsi
_rsi = rsi(close, 14)

//sma
_sma50 = sma(close, 50)
_sma200 = sma(close, 200)

//ALMA
windowsize = input(title="Window Size", type=input.integer, defval=15)
ALMAoffset = input(title="ALMAOffset", type=input.float, defval=0.85)
sigma = input(title="Sigma", type=input.float, defval=6)
ALMA15 = alma(close, windowsize, ALMAoffset, sigma)

//stochastics
periodK = input(14, title="Stoch K", minval=1)
periodD = input(3, title="Stoch D", minval=1)
smoothK = input(3, title="Stoch Smooth", minval=1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, periodD)

//only execute on uptrend
OBEntry = _rsi >= 70 and close > _sma50 and _sma50 > _sma200 and k > d
OBExit = crossunder(close, ALMA15)

strategy.entry(id="OB", long=true, qty=strategy.equity/close, when=OBEntry)
strategy.close(id="OB", when = OBExit)

plot(_rsi, color=color.green, linewidth=1)
plot(k, color=color.blue)
plot(d, color=color.orange)

Overview

Overbought calculates RSI with 14 periods, 50 and 200 period SMAs, ALMA smoothed close, and Stochastics with customizable K D and smooth periods. Entries occur when RSI exceeds 70 price exceeds SMA50 the 50 SMA exceeds the 200 SMA and Stochastics K exceeds D. Positions exit when close crosses under ALMA15. The strategy plots RSI in green Stoch K in blue and Stoch D in orange on a separate pane. Adjustable settings include ALMA window offset and sigma plus Stochastics periods. It sizes positions to equity with no stop loss.

Details

Published by

kat3samsin on GitHub

Type

Strategy, Pine Script v4

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Window Sizeint15windowsize
ALMAOffsetfloat0.85ALMAoffset
Sigmafloat6sigma
Stoch Kint14periodK
Stoch Dint3periodD
Stoch Smoothint3smoothK
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.

Similar Pine Scripts

330 stars

MACD + Divergences [Alorse] is a momentum strategy that calculates the MACD oscillator and identifies regular and hidden divergences using pivot high and low points. It filters trade signals with dual Exponential Moving Averages (EMA 150 and 600) to ensure tra

Strategy v4 Oscillators & momentumDivergence Repaints
Updated 2 months ago · None stated GitHub repository of MACD + Divergences [Alorse]

MACD Crossover (tutorial)

by pineforge-4pass
193 stars

This strategy calculates the Moving Average Convergence Divergence indicator and plots the MACD line, signal line, and histogram in a separate pane. It enters long positions when the MACD line crosses above the signal line and enters short positions when it cr

Strategy v6 Oscillators & momentumMoving averages
Updated 2 days ago · Apache-2.0 GitHub repository of MACD Crossover (tutorial)

ADX Strategy

by hasnocool
106 stars

An ADX-based trend-following strategy that enters long positions when the positive directional indicator (DI+) crosses above the Average Directional Index (ADX) while ADX remains below a preset threshold and a fast EMA is above a slow EMA. It allows adding to

Strategy v4 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of ADX Strategy

EMA Ribbon MACD

by iamrichardD
57 stars

This strategy combines an EMA ribbon with MACD confirmation and plots in a separate pane. It enters when ribbon alignment, optional MACD zero or signal crosses, volume, smart-money, and multi-timeframe filters agree, then exits with percentage stop loss and ta

Strategy v6 TrendMoving averages
Updated 1 year ago · Apache-2.0 GitHub repository of EMA Ribbon MACD

This strategy evaluates the dynamic relationship between price and a chosen moving average across six diagnostic dimensions: trend, respect, extension, compression, acceleration, and exhaustion. It plots a normalized relationship oscillator bounded between -10

Strategy v6 TrendMoving averages
Updated 3 days ago · MIT GitHub repository of Market–Average Relationship Engine [WavesUnchained]
7 stars

This strategy combines the Moving Average Convergence Divergence oscillator with an Exponential Moving Average trend filter. It enters long positions when the MACD histogram crosses above zero while price stays above the long-term EMA filter. Long trades close

Strategy v5 TrendOscillators & momentum
Updated 1 year ago · MPL-2.0 GitHub repository of MACD EMA Filter Strategy

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers