OPEN-SOURCE SCRIPT

Breakout HANMANT

//version=5
indicator("Breakout", overlay=true)

// Define the condition for the previous candle
prevCandleOpen = ta.valuewhen(barstate.islast, open[1], 0)
prevCandleClose = ta.valuewhen(barstate.islast, close[1], 0)
prevCandleHigh = ta.valuewhen(barstate.islast, high[1], 0)
prevCandleLow = ta.valuewhen(barstate.islast, low[1], 0)

// Define the condition for the latest candle
latestCandleHigh = high
latestCandleLow = low

// Check for long condition
longCondition1 = (latestCandleHigh > math.max(prevCandleOpen, prevCandleClose, prevCandleHigh))
longCondition2 = (latestCandleLow > math.min(prevCandleOpen, prevCandleClose, prevCandleLow))
longCondition = longCondition1 and longCondition2

// Check for short condition
shortCondition1 = (latestCandleLow < math.min(prevCandleOpen, prevCandleClose, prevCandleLow))
shortCondition2 = (latestCandleHigh < math.max(prevCandleOpen, prevCandleClose, prevCandleHigh))
shortCondition = shortCondition1 and shortCondition2

// Plot the conditions
plotshape(longCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="Long")
plotshape(shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="Short")

//version=5
indicator("Inside Candle Strategy", overlay=true)

// Identify the previous candle's high and low
prevHigh = high[1]
prevLow = low[1]

// Identify the current candle's high and low
currHigh = high
currLow = low

// Check if the current candle is an inside candle
isInsideCandle = (currHigh < prevHigh) and (currLow > prevLow)

// Plotting the inside candle
bgcolor(isInsideCandle ? color.new(color.blue, 90) : na)

// Long and Short conditions
longCondition = isInsideCandle and (currHigh > currHigh[1])
shortCondition = isInsideCandle and (currLow < currLow[1])

// Generate signals
plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="Long")
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="Short")

// Alerts
Candlestick analysis

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité