Strategy · Pine Script v6 · On the chart

ES1! Short 1D MA200 MA5

by luifertorres

A short-only daily strategy for E-mini S&P futures, the mirror of the long version.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code24
Settings0inputs
LicenceMIT
Last update5 days ago24 Oct 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

24 lines of Pine Script v6 from docs/pine-scripts/es1!-short-1d-sma200sma5.pinescript, published under MIT. Keep the author's credit and licence lines when you reuse it.

es1!-short-1d-sma200sma5.pinescript
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © luifertorres

//@version=6
strategy('6 ES1! Short 1D MA200 MA5', overlay = true, initial_capital = 5000, default_qty_type = strategy.fixed, default_qty_value = 1, pyramiding = 999, commission_value = 0, commission_type = strategy.commission.percent, slippage = 2)

// Cálculos de las medias móviles
ma200 = ta.sma(close, 200)
ma5   = ta.sma(close, 5)

// Condiciones para entrada SHORT
isMa200Downtrending = ma200[1] > ma200
isBullishCandle     = close > open
isAboveMa5          = low > ma5

isShort = isMa200Downtrending and isBullishCandle and isAboveMa5

// Entrada en corto si se cumplen las condiciones y la dirección permitida
if isShort
    strategy.entry('SHORT', strategy.short)

// Cerrar posición corta cuando el precio cierre por debajo de MA5
if strategy.position_size < 0 and close < ma5
    strategy.close('SHORT')

Overview

ES1! Short 1D MA200 MA5 enters short when the 200-period SMA is falling, the candle is bullish and the whole bar sits above the 5-period SMA, and it closes the position when price closes below the 5-period SMA. Size is a fixed one contract, with a slippage allowance and no commission. The pyramiding limit is set very high, so repeated entries can stack, and there is no stop loss. It has no adjustable inputs.

Details

Published by

luifertorres on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Mean reversion, Moving averages

Markets

Indices

Timeframes

H4 and above

Risk Notes

  • The strategy can add several entries in the same direction
  • 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

218 stars

The Mean Reversion Strategy Template calculates a baseline mean using SMA, EMA, or VWAP alongside upper and lower deviation bands based on standard deviation, ATR, or percentage offsets. It generates long and short entries when price touches, bounces from, or

Strategy v6 Mean reversionMoving averages
Updated 3 months ago · None stated GitHub repository of Mean Reversion Strategy Template

This strategy draws on the price chart and combines Stochastic RSI, the Money Flow Index, and an exponential moving average to open long or short trades. Longs use the lower oscillator thresholds and shorts use the upper ones, with direction limited to longs,

Strategy v5 Oscillators & momentumMoving averages Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 3 Indicator Strategy (StochRSI, MFI & EMA) With Safety Orders

Bollinger Bands Strategy

by cklose2000
105 stars

This strategy generates buy and sell signals based on Bollinger Band crossovers combined with a simple moving average trend filter. It enters a long position when price crosses above the lower band while trading above the SMA filter line, and enters a short po

Strategy v5 Volatility & bandsMoving averages
Updated 1 year ago · None stated GitHub repository of Bollinger Bands Strategy
53 stars

This strategy identifies long entry opportunities based on short-term price pullbacks below a major trend filter. It enters long when three consecutive lower closes occur below the 200-period simple moving average, followed by the current bar closing back abov

Strategy v6 TrendMoving averages
Updated 2 months ago · MPL-2.0 GitHub repository of Ivan Scherman Pattern - TP/SL

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