Strategy · Pine Script v5 · On the chart

Full Candle [Alorse]

by Alorse

This strategy enters long when a bullish candle closes above an EMA and its upper wick is no larger than a set percent of the candle range, and short on the opposite bearish setup.

View on GitHub

GitHub stars330on the repository
Pine versionv5runs as is
Lines of code58
Settings10inputs
LicenceNone statedfile: MPL-2.0
Last update2 months ago25 Aug 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

58 lines of Pine Script v5 from strategies/other/Full Candle.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Full Candle.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © alorse

//@version=5
strategy('Full Candle [Alorse]', overlay=true, pyramiding=0, currency=currency.USD, default_qty_type=strategy.percent_of_equity, initial_capital=1000, default_qty_value=10, commission_type=strategy.commission.percent, commission_value=0.1)

txtVer = '0.0.1'
version = input.string(title='Version', defval=txtVer, options=[txtVer], tooltip='This is informational only, nothing will change.\n\nEntry conditions:\n')
src = input(title='Source', defval=close)


// Moving Averages
lenA = input.int(10, minval=1, title='EMA A Length', group='Moving Averages')
outA = ta.ema(close, lenA)
plot(outA, title='EMA A', color=color.purple)

// Strategy
stratGroup = 'Strategy'
showLong = input.bool(true, title='Long entries', group=stratGroup)
showShort = input.bool(true, title='Short entries', group=stratGroup)
shadowPercent = input.float(5, step=1, title='Shadow Percent', group=stratGroup)

tpGroup = 'Take Profit'
useTP = input.bool(false, title='╔══════   Enable   ══════╗', group=tpGroup)
TPPercent = input.float(1.2, step=0.1, title='Percent', group=tpGroup) * 0.01

longTP = useTP ? strategy.position_avg_price * (1 + TPPercent) : na
shortTP = useTP ? strategy.position_avg_price * (1 - TPPercent) : na

// Stop Loss
slGroup = 'Stop Loss'
useSL = input.bool(false, title='╔══════   Enable   ══════╗', group=slGroup)
SLPercent = input.float(1.8, title='Percent', group=slGroup) * 0.01

longStop = useSL ? strategy.position_avg_price * (1 - SLPercent) : na
shortStop = useSL ? strategy.position_avg_price * (1 + SLPercent) : na

bought = strategy.opentrades[0] == 1 and strategy.position_size[0] > strategy.position_size[1]
entry_price = ta.valuewhen(bought, open, 0)

candleSize = high - low
shadowSize = close > open ? high - close : close - low
sPer = (shadowSize * 100)/candleSize


entryLong = close > open and close > outA and sPer <= shadowPercent
entryShort = close < open and close < outA and sPer <= shadowPercent
exitLong = close > (entry_price + entry_price*0.002) and close > open
exitShort = close < (strategy.position_avg_price - strategy.position_avg_price*0.002) and close < open

if showLong
    strategy.entry('Long', strategy.long, when=entryLong)
    strategy.close('Long', when=exitLong)
    strategy.exit('TP', 'Long', limit=longTP, stop=longStop)
if showShort
    strategy.entry('Short', strategy.short, when=entryShort)
    strategy.close('Short', when=exitShort)
    strategy.exit('TP', 'Short', limit=shortTP, stop=shortStop)

Overview

Full Candle [Alorse] closes a long after price rises a small fixed fraction above the entry bar open on a bullish close, and a short after a similar decline below average price on a bearish close. Optional percent take profit and stop loss are off by default. EMA length, shadow limit, and direction toggles change the filter. It plots the EMA on the price chart and sizes orders as a percent of equity.

Details

Published by

Alorse on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Candlestick patterns, Moving averages

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss

Topics

pinescriptpinescript-indicatorspinescript-strategiestrading-strategiestradingviewtradingview-alerttradingview-strategy

Settings

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

SettingTypeDefaultVariable
VersionstringtxtVerversion
Sourcesourceclosesrc
EMA A Lengthint10lenA
Long entriesbooltrueshowLong
Short entriesbooltrueshowShort
Shadow Percentfloat5shadowPercent
╔══════   Enable   ══════╗boolfalseuseTP
Percentfloat1.2TPPercent
╔══════   Enable   ══════╗boolfalseuseSL
Percentfloat1.8SLPercent
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

257 stars

This overlay strategy marks short-term turning points on the price chart and enters SPY option-style trades from them. It plots simple moving averages of highs and lows, draws up and down reversal arrows, and colors bars when a short-term extreme coincides wit

Strategy v5 TrendMoving averages Repaints
Updated 6 weeks ago · None stated GitHub repository of SPY Options Trading - Alert

This strategy calculates and plots smoothed Heikin-Ashi candles directly onto the main price chart using exponential moving averages of open, high, low, and close prices. It enters a long position after three consecutive bullish smoothed candles with sequentia

Strategy v4 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Abdoli's Heikin Ashi Smoothed Buy & Sell Strategy Rev.4

DI Engulfing A002

by ruckard
13 stars

This strategy executes trades based on candlestick engulfing patterns aligned with a 200-period exponential moving average trend filter. It enters long positions when a bullish engulfing candle follows three consecutive bearish candles while price trades above

Strategy v5 Candlestick patternsTrend
Updated 1 year ago · None stated GitHub repository of DI Engulfing A002
7 stars

This strategy combines Ichimoku Kinko Hyo components, a Stochastic oscillator, and specific candlestick patterns to generate trade signals. It identifies Kumo twists and range breakouts while evaluating candle body shapes using Fibonacci threshold filters. Tra

Strategy v4 TrendOscillators & momentum
Updated 2 years ago · MIT GitHub repository of Soulevement / Ressaut Strategy

Improvisando [Alorse]

by Hugs-4-Bugs
4 stars

This strategy combines candlestick price action with Exponential Moving Average, RSI, and MACD filters to identify short-term trend trades. A long signal occurs when a bullish candle engulfs the previous open while price remains above the EMA, RSI stays below

Strategy v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of Improvisando [Alorse]

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