Strategy · Pine Script v6 · On the chart

Crypto Mean Reversion

by femibol

A long-only strategy ported from a bot, intended for five-minute crypto charts.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code160
Settings19inputs
LicenceNone stated
Last update6 weeks ago14 Sep 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  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

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

Crypto Mean Reversion buys dips when a reversal candle appears, a three-day trend gate is satisfied, and one of three paths holds: Z-score with RSI, Z-score with the lower Bollinger Band, or RSI with the lower band, each with its own volume floor. Exits use an ATR stop, a target at the SMA or a multiple of risk, a mean-cross exit, an overbought exit and a time limit. Presets and a date range are included.

Details

Published by

femibol on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Mean reversion, Scalping

Markets

Crypto

Timeframes

M1-M5

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

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

SettingTypeDefaultVariable
Setting chainstringBot live configpreset
Limit backtest to date rangeboolfalseuseRange
Starttimetimestamp("1 Jan 2025 00:00 +0000")rangeStart
Endtimetimestamp("1 Jan 2027 00:00 +0000")rangeEnd
Lookback (SMA / Z / BB / volume)int20lookback
Entry Z-scorefloat-1.2entryZIn
Mean-cross exit Zfloat0.3exitZIn
RSI oversoldfloat45rsiOSIn
RSI overboughtfloat55rsiOB
Bollinger stdfloat2.0bbStd
Vol floor — path 1 (Z+RSI)float1.1volFloor1In
Vol floor — path 2 (Z+BB)float1.3volFloor2
Show all 19 settings
SettingTypeDefaultVariable
Vol floor — path 3 (RSI+BB)float1.5volFloor3
Trend gate lookback bars (864 = 3d on 5m)int864trendBars
Trend gate min % gainfloat2.0trendMinIn
ATR stop multiplefloat2.0atrMult
Time exit (bars)int20maxHoldBars
Min hold (bars) before signal exitsint1minHoldBars
Enable 3-day trend gatebooltrueuseTrendIn
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

Ruckard Scalping 03

by ruckard
13 stars

This strategy trades both long and short on the price chart. It enters long after a five percent or larger drop over the last thirty minutes and short after a matching rise. Two dollar-cost-averaging adds increase size when price moves against the position. A

Strategy v4 ScalpingMean reversion
Updated 1 year ago · None stated GitHub repository of Ruckard Scalping 03
12 stars

This is a Pine Script strategy that executes a fixed historical backtest on BTC-USD. It places multiple manual trades using strategy.order at specific timestamps and prices, with corresponding close conditions based on time. Some trades are long and some are s

Strategy v4 Mean reversionScalping
Updated 5 years ago · None stated GitHub repository of Lazarus3 BTC Backtest

Enhanced DCA Strategy

by SynergOps
7 stars

The Enhanced DCA Strategy invests a fixed dollar amount at regular intervals (daily, weekly or monthly) into the asset after start date, deducting trading fees and tracking total invested, units acquired, current value, profit, ROI, Sharpe ratio, Sortino ratio

Strategy v6 ScalpingMean reversion Repaints
Updated 1 year ago · MPL-2.0 GitHub repository of Enhanced DCA Strategy
7 stars

This strategy plots RSI on the price chart and enters a long when RSI falls below the oversold level or a short when it rises above the overbought level, only while flat. It exits with a take profit and stop loss measured in pips from the current close. Inputs

Strategy v6 Oscillators & momentumScalping
Updated 3 months ago · None stated GitHub repository of XAUUSD 1-Minute Scalping Strategy
5 stars

Greeffer's Scalping Strategy combines multi-timeframe Exponential Moving Averages, Bollinger Bands, and Donchian Channels to execute dip-buying trades directly on the price chart. It triggers long entries when price dips below both the lower Donchian Channel a

Strategy v5 Moving averagesVolatility & bands
Updated 4 years ago · None stated GitHub repository of Greeffer's Scalping Strategy

More strategys

Trade Your Charts With a Regulated Broker

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

Compare brokers