Strategy · Pine Script v4 · Own pane

Ribbon

by FranklyBrandon· code credited to MelonLordRoberts

A very small Pine v4 strategy that plots simple moving averages of 5, 8 and 13 bars, each rounded to two decimals, in a separate pane.

View on GitHub

GitHub stars1on the repository
Pine versionv4older, still runs
Lines of code17
Settings0inputs
LicenceNone statedfile: MPL-2.0
Last update3 months ago18 Jul 2026

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

17 lines of Pine Script v4 from Denali.V1/PineScript.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

PineScript.txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MelonLordRoberts

//@version=4
strategy("Ribbon")

sma5 = round(sma(close, 5)*100)/100
sma8 = round(sma(close, 8)*100)/100
sma13 = round(sma(close, 13)*100)/100

plot(sma5, color=color.blue)
plot(sma8, color=color.green)
plot(sma13, color=color.orange)

if (sma5 == sma8 and sma8 == sma13 and sma13 == sma5)
    strategy.order("buy", strategy.long, when = strategy.position_size <= 50)
    strategy.order("sell", strategy.long)

Overview

When all three rounded values are exactly equal, which will be rare, it sends one buy order and a second order that is also long. There are no inputs, no short entries, no stop loss and no take profit. It reads as an early experiment rather than a complete trading system.

Details

Published by

FranklyBrandon on GitHub

Code credit

MelonLordRoberts, as written in the script's header

Type

Strategy, Pine Script v4

Draws

Separate pane below the chart

Category

Moving averages

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss
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

HA UnivLong&Short Futures calculates Heikin Ashi candles and builds a channel using simple moving averages of Heikin Ashi highs and lows. It enters long positions when the upper channel line crosses above the lower channel line and opens short positions on the

Strategy v5 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of HA UnivLong&Short Futures

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 yesterday · Apache-2.0 GitHub repository of MACD Crossover (tutorial)

10PreBuyer

by hasnocool
106 stars

10PreBuyer is a dip-buying strategy that submits limit orders below recent price action using a discounted Hull Moving Average (HMA). It calculates the highest HMA value of high prices over a selected period, multiplied by a percentage discount factor, and pla

Strategy v4 Moving averagesMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of 10PreBuyer

BTC Futures MACD

by iamrichardD
57 stars

This strategy plots a MACD oscillator in a separate pane and trades Bitcoin futures from zero-line and signal-line crosses. Optional early momentum signals, a volume filter, and a trend moving-average filter can confirm entries. It sizes positions as fixed con

Strategy v6 Oscillators & momentumMoving averages Repaints
Updated 1 year ago · Apache-2.0 GitHub repository of BTC Futures MACD
25 stars

This Pine Script strategy calculates Bayesian probabilities of price breaking up or down relative to Bollinger Bands and a Simple Moving Average. It plots these breakout and breakdown probability lines as oscillators in a separate pane. Long entries trigger wh

Strategy v4 Oscillators & momentumVolatility & bands
Updated 6 years ago · None stated GitHub repository of Bayesian BBSMA Oscillator 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