Strategy · Pine Script v5 · Own pane

My Strategy

by g-moe· code credited to goodgains

This strategy calculates the average closing price from a lower 3-minute timeframe and plots the result in a separate pane using array sum on multi-bar aggregate data.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code23
Settings0inputs
LicenceNone statedfile: MPL-2.0
Last update5 months ago27 May 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

23 lines of Pine Script v5 from Tradingview/my-strategy.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

my-strategy.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains


//@version=5
strategy("My strategy", overlay=false, margin_long=100, margin_short=100)

// @keywords: lower-timeframe, security-lower-tf, array-sum, close-average, test-strategy, mtf-data, three-minute-data, pane-plot, experimental, sum-average, multi-bar-aggregate, placeholder-strategy, data-fetch, array-plot, minimal-indicator, timeframe-3, overlay-false, research-script, close-sum, simple-plot

sma1 = request.security_lower_tf(syminfo.tickerid, '3', close)


plot(array.sum(sma1)/5)



// longCondition = ta.crossover(sma1, sma2)
// if (longCondition)
//     strategy.entry("My Long Entry Id", strategy.long)

// shortCondition = ta.crossunder(sma1,sma2)
// if (shortCondition)
//     strategy.entry("My Short Entry Id", strategy.short)

Overview

My Strategy fetches lower-timeframe data via security lower tf and includes commented out crossover conditions for entries and exits that are not active. No stop loss take profit or position sizing rules exist. The script draws the average value separate from the price chart with no user settings adjustable.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Draws

Separate pane below the chart

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 2 days ago · 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 Moving averages 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