Skip to main content

Inside Candle Strategy

How to Automate strategy by Power of Stocks | Inside Candle Strategy​

In this article, we will explore a popular trading strategy known as the Inside Candle strategy, conceptualised by the renowned trader Mr. Subasish Pani, commonly referred to as 'Power of Stocks'.Β 

This strategy is highly effective and widely used by traders for its simplicity and profitability. We will not only explain the strategy in detail but also guide you on how to automate it using AlgoTest without any coding.

Free Pinescript - Inside Candle Strategy​

To learn how to add this pinescript in TradingView, click here.

// This Pine Scriptβ„’ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Β© JOJO
//@version=5
indicator("Inside Candle Indicator", overlay=true)
RiRe = input.float(2, title='Risk Reward Ratio')
var float insideCandleHigh = na
var float insideCandleLow = na
var int insideCandleC = 0
var int longC = 0
var int shortC = 0
var float longTar = na
var float shortTar = na
if dayofweek != dayofweek[1]
insideCandleHigh := na
insideCandleLow := na
insideCandleC := 0
longC := 0
shortC := 0
longTar := na
shortTar := na
long_exit = (close < insideCandleLow or close > longTar) and longC == 1
short_exit = (close > insideCandleHigh or close < shortTar) and shortC == 1
if short_exit or long_exit
insideCandleC := 0
shortC := 0
longC := 0
insideCandleHigh := na
insideCandleLow := na
inside_candle = high < high[1] and low > low[1] and insideCandleC == 0
if inside_candle
insideCandleC := 1
longC := 0
shortC := 0
insideCandleHigh := high[1]
insideCandleLow := low[1]
long = insideCandleC == 1 and high > insideCandleHigh and longC == 0 and shortC == 0
if long
longC := 1
longTar := high + (high - insideCandleLow)* RiRe
short = insideCandleC == 1 and low < insideCandleLow and longC == 0 and shortC == 0
if short
shortC := 1
shortTar := low - (insideCandleHigh - low) * RiRe
plotshape(inside_candle, title='Inside Candle', text = 'Baby Candle')
plotshape(long, title='Long Entry', style=shape.arrowup, location=location.abovebar, color=color.green, text='Long Entry', textcolor=color.green)
plotshape(short, title='Short Entry', style=shape.arrowdown, location=location.abovebar, color=color.green, text='Short Entry', textcolor=color.green)
plotshape(long_exit, title='Long Exit', style=shape.arrowdown, location=location.belowbar, color=color.red, text='Long Exit', textcolor=color.red)
plotshape(short_exit, title='Short Exit', style=shape.arrowdown, location=location.belowbar, color=color.red, text='Short Exit', textcolor=color.red)
alertcondition(long, 'Long Entry', 'Long Entry')
alertcondition(long_exit, 'Long Exit', 'Long Exit')
alertcondition(short, 'Short Entry', 'Short Entry')
alertcondition(short_exit, 'Short Exit', 'Short Exit')

Understanding the Inside Candle Strategy​

Introduction to the Strategy​

The Inside Candle strategy revolves around identifying specific candle patterns on the trading chart. It involves two main components: the mother (or alert) candle and the baby candle.

The Mother Candle​

The mother candle is any significant candle formed on the trading chart. It doesn't matter whether it's a green or red candle. This candle sets the boundaries for the subsequent trading action.

The Baby Candle​

The baby candle is the next candle that forms entirely within the high and low range of the mother candle. The formation of a baby candle within these boundaries signals a potential trading opportunity.

Trading Rules​

Long Entry: When a candle breaks above the high of the mother candle, initiate a long trade (buy).

Short Entry: When a candle breaks below the low of the mother candle, initiate a short trade (sell).

Stop Loss: The stop loss for a long trade is the low of the mother candle, and for a short trade, it's the high of the mother candle.

Risk to Reward Ratio: The recommended risk to reward ratio is 1:2, meaning for every unit of risk, the target profit is double that amount.

Practical Application on TradingView​

Setting Up the Strategy​

  1. Mother Candle Identification: Identify a significant candle on the trading chart.

  2. Baby Candle Formation: Ensure the next candle forms entirely within the high and low range of the mother candle.

Example on TradingView​

Long Trade Example​

  • Identify the mother candle.

  • Wait for a baby candle to form within the mother candle.

  • Once a subsequent candle breaks the high of the mother candle, initiate a long trade.

Short Trade Example​

  • Identify the mother candle.

  • Wait for a baby candle to form within the mother candle.

  • Once a subsequent candle breaks the low of the mother candle, initiate a short trade.

Automating the Inside Candle Strategy on Algo Test​

Setting Up the Automation​

  1. Code Integration
  • Go to the provided link with the strategy code.

  • Copy the code and paste it into Trading View's Pine Editor.

  • Add the script to your chart.

  1. Creating Signals on Algo Test
  • Navigate to the Algo Test dashboard.

  • Create a new signal using TradingView indicators.

  • Configure the entry and exit conditions for both long and short trades.

  • Copy the generated JSON block and paste it into TradingView alerts.

Configuring Alerts​

  • Long Entry Alert: Set the condition to trigger when a candle breaks the high of the mother candle.

  • Long Exit Alert: Set the condition to trigger based on your exit strategy (e.g., hitting the target profit).

  • Short Entry Alert: Set the condition to trigger when a candle breaks the low of the mother candle.

  • Short Exit Alert: Set the condition to trigger based on your exit strategy.

Backtesting and Live Trading​

  • Backtesting: Test the strategy with historical data to ensure its effectiveness.

  • Live Trading: Join the live trading session on the specified date to see the strategy in action.

Key Points to Remember​

  • Time Frame: The strategy is best implemented on a 15-minute time frame.

  • Entries: Limit the number of entries to two or three per day to avoid over-trading.

  • Risk Management: Stick to the recommended risk to reward ratio to maximize profitability.

Conclusion​

The Inside Candle strategy is a powerful yet simple trading approach that can yield significant profits when executed correctly. Automating this strategy on Algo Test ensures precision and efficiency, allowing you to focus on other aspects of trading.

By following the steps outlined in this article, you can implement and automate the Inside Candle strategy, leveraging its potential to enhance your trading performance.

We hope you found this guide helpful. If you have any strategies you'd like us to automate or if you have any questions, please let us know in the comments. Don't forget to like this video and subscribe to our channel for more insightful content. Happy trading!