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

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?

Pernyataan Penyangkalan