Inside Candle by Harshini
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Harshini_A_L

//@version=5
indicator('Inside Candle by Harshini', overlay=true)

fastAverage = ta.sma(close, 20)
if (high < high[1] and low > low[1] )
    var insidedescription = " Inside candle formation, you can buy/sell based on the next candle close"
    label.new(bar_index, high + 10 , "INS", style=label.style_label_down, color=color.yellow, size = size.small, tooltip = insidedescription)

inside_bar = high[1] < high[2] and low[1] > low[2]

// Entry conditions
long_condition = false
if inside_bar and close > high[1] and (high > fastAverage)
    long_condition := true

short_condition = false
if inside_bar and close < low[1] and (low < fastAverage)
    short_condition := true

// Plotting
//plotshape(insidebar, title="Inside Bar", text="Inside Bar", style=shape.diamond, location=location.abovebar, color=color.blue, size=size.tiny)
plotshape(long_condition, title="Buy Signal", text="Buy", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(short_condition, title="Sell Signal", text="Sell", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)

