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

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?

כתב ויתור