搜索
产品
社区
市场
新闻
经纪商
更多
CN
开始
社区
/
指标和策略
/
Breakout HANMANT
OPEN-SOURCE SCRIPT
Breakout HANMANT
由nifty_2020提供
关注
关注
16小时前
2
添加到收藏
添加到收藏
//
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精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受
网站规则
约束。 您可以收藏它以在图表上使用。
想在图表上使用此脚本?
添加到收藏
nifty_2020
关注
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在
使用条款
阅读更多信息。