Strategy · Pine Script v5 · On the chart

Inside Candle Detector

by might-tree

The Inside Candle Detector identifies inside bar candlestick patterns where the current bar's high is lower than the previous bar's high and its low is higher than the previous bar's low.

View on GitHub

GitHub stars4on the repository
Pine versionv5runs as is
Lines of code30
Settings0inputs
LicenceNone statedfile: MPL-2.0
Last update3 years ago2 Aug 2023

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

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

Inside_Candle_Detector.pine
//Run the following Script on PINE EDITOR or any platform supporting Pine Script

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © might-tree

//@version=5
strategy("Inside Candle Detector", overlay=true, margin_long=100, margin_short=100)

increasingbar = 1
decreasingbar = -1

check_inside_candle() =>
    previousBar = 1
    bodyStatus = (close >= open) ? 1 : -1
    isInsidePattern = high < high[previousBar] and low > low[previousBar]

    isInsidePattern ? bodyStatus : 0

barcolor(check_inside_candle() == increasingbar ? color.rgb(40, 253, 47) : na)
barcolor(check_inside_candle() == decreasingbar ? color.rgb(253, 117, 117) : na)

plotshape(check_inside_candle() == increasingbar, style=shape.triangleup,
                 location=location.abovebar, color=color.rgb(37, 255, 44))

plotshape(check_inside_candle() == decreasingbar, style=shape.triangledown,
                 location=location.belowbar, color=color.rgb(251, 121, 121))

is_inside_candle = check_inside_candle() == increasingbar or check_inside_candle() == decreasingbar

alertcondition(is_inside_candle, title='Inside Candle', message='Inside Candle detected')

Overview

Inside Candle Detector categorizes inside candles as bullish or bearish based on the bar's open and close prices. The script highlights detected patterns directly on the main price chart by applying bar colors and plotting triangular shape markers. Although declared as a strategy, it contains no automated order execution or risk management rules.

Details

Published by

might-tree on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Candlestick patterns

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

Exceeded Candle [Alorse] is a mean-reversion strategy that identifies candlestick engulfing patterns combined with Bollinger Bands filters. It enters a long position when a green candle surpasses the body of the previous red candle while price is below the mid

Strategy v4 Mean reversionCandlestick patterns
Updated 2 months ago · None stated GitHub repository of Exceeded candle [Alorse]
285 stars

Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish

Strategy v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Strategy

ESU2023-10M - V1

by dearvn
257 stars

ESU2023-10M - V1 is an intraday trend-reversal strategy designed for index futures contracts on the price chart. It calculates a 3-period moving average of candle highs and lows alongside specific three-bar price action patterns to detect short-term swing high

Strategy v5 TrendCandlestick patterns
Updated 6 weeks ago · None stated GitHub repository of ESU2023-10M - V1

STRG One Bar Pursuit

by harryguiacorn
219 stars

The STRG One Bar Pursuit strategy identifies single-bar momentum reversals by monitoring shifts between bullish and bearish candlesticks starting from the year 2024. It enters a long position when a bullish candle follows a bearish candle and enters a short po

Strategy v5 Candlestick patternsMean reversion
Updated 1 year ago · None stated GitHub repository of STRG One Bar Pursuit
218 stars

This strategy identifies trade opportunities based on candlestick wick imbalances relative to the Average True Range. It enters positions when candle wicks exceed defined thresholds and filters out doji candles using a minimum body ATR requirement. Exits are h

Strategy v6 Candlestick patternsVolatility & bands Repaints
Updated 3 months ago · None stated GitHub repository of Super Negative R:R Wick 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