Strategy · Pine Script v5 · Own pane

CTC BB Hedge Strategy

by wynnforthework

CTC BB Hedge Strategy calculates the Pearson correlation coefficient between the close prices of two symbols to determine market alignment.

View on GitHub

Repaints

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code444
Settings32inputs
LicenceNone stated
Last update1 year ago7 Oct 2025

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

CTC BB Hedge Strategy applies Bollinger Bands to the primary symbol for mean-reversion signals while optionally filtering with a moving average. The strategy supports three trade types using percent of equity, risk-based sizing, or fixed USD amounts and enforces a leverage limit. Traders can choose ATR-based or fixed-percentage take-profit and stop-loss levels. A separate pane displays performance statistics including monthly returns.

Details

Published by

wynnforthework on GitHub

Type

Strategy, Pine Script v5

Draws

Separate pane below the chart

Category

Volatility & bands, Mean reversion

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time
  • The strategy can add several entries in the same direction

Settings

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

SettingTypeDefaultVariable
Symbol 2symbolOKX:ETHUSDTsymbol2
Correlation Thresholdfloat-0.5correlationThreshold
Correlation Lengthint20correlationLen
Trade TypestringTrade %tradeType
long Percentfloat50longPercent
Short Percentfloat50shortPercent
Leverage Limitfloat5leverageLimit
Use ATR TP/SLbooltrueuseAtrTpSl
ATR Lengthint14atrLen
ATR Stoploss Multiplierfloat4.0stopLossAtrMul
ATR Take Profit Multiplierfloat6.0takeProfitAtrMul
Take Profit (%)float20profitPct
Show all 32 settings
SettingTypeDefaultVariable
Stop Loss (%)float15stopLossPct
BB Lengthint20bbLen
BB Multiplierfloat2bbMul
BB MA typestringSMAbbMaType
SD From BasisboolfalsebbSdFromBasis
Use MAbooltrueuseMa
MA Lengthint50maLen
----------- Use Date Range ----------booltrueuse_date_range
From Timetimetimestamp("01 Jan 2018 00:00 +0000")fromTime
To Timetimetimestamp("31 Dec 2099 00:00 +0000")toTime
Show StatsbooltrueshowStats
Show Monthly ReturnsbooltrueshowMonthlyReturns
ModestringSimple Equityi_eq_to_dd
Return Precisionint2i_precision
Headers Colorcolor#D4D4D4i_headers_col
Headers Text Colorcolorcolor.blacki_headers_text_col
Positive Colorcolorcolor.greeni_pos_col
Negative Colorcolorcolor.redi_neg_col
Zero Colorcolor#DDDDDDi_zero_col
Cell Text Colorcolorcolor.whitei_cell_text_col
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

This strategy combines Larry Williams' Vix Fix synthetic volatility indicator with Bollinger Bands. It calculates standard and inverted Williams Vix Fix metrics, displaying them as histogram columns with standard deviation bands in a separate pane. Long entrie

Strategy v4 Volatility & bandsOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Williams Vix Fix Strategy [Alorse]

2xTP, SL to Entry

by hasnocool
106 stars

This strategy executes mean-reversion trades based on Bollinger Bands and the Stochastic Oscillator. Long orders trigger when price dips below the lower band alongside a bullish Stochastic crossover, with an optional oversold threshold. Short orders execute on

Strategy v5 Mean reversionOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of 2xTP, SL to Entry

Greeffer BB Strategy

by SammyEnigma
18 stars

This strategy fades Bollinger Band extremes using the close. It enters short when price crosses above the upper band and the 14-period RSI is above 70, and enters long when price crosses below the lower band and RSI is below 30. It closes half of an open short

Strategy v4 Volatility & bandsOscillators & momentum
Updated 6 years ago · None stated GitHub repository of Greeffer BB Strategy

VT-Lite

by algoboy-kevin
4 stars

VT-Lite is a Pine Script v5 mean-reversion strategy that draws in a separate pane. It sizes equity-percent entries from a short-term EMA and ATR band distance, with a volatility EMA threshold and a choice of close, low, or ATR-band source. It can add reentries

Strategy v5 Mean reversionVolatility & bands
Updated 2 years ago · None stated GitHub repository of VT-Lite

Alpy Vix

by avatar-lavventura
2 stars

This strategy plots the Williams Vix Fix indicator as a histogram in a separate pane to detect potential trend reversals. It calculates the Vix Fix value using a lookback period and standard deviation bands derived from Bollinger Bands on the Vix Fix. Multiple

Strategy v4 Oscillators & momentumVolatility & bands Repaints
Updated 7 months ago · None stated GitHub repository of Alpy Vix

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