OPEN-SOURCE SCRIPT

Support and Resistance (1 Hour)

//version=5
indicator("Support and Resistance (1 Hour)", overlay=true)

// Define the period for support and resistance (in this case, 50 bars)
length = input.int(50, title="Lookback Period", minval=1)

// Calculate the highest high and lowest low over the lookback period
highestHigh = ta.highest(high, length)
lowestLow = ta.lowest(low, length)

// Plot the support and resistance lines on the chart
plot(highestHigh, title="Resistance", color=color.red, linewidth=2)
plot(lowestLow, title="Support", color=color.green, linewidth=2)

// Add background shading to highlight areas near support and resistance
bgcolor(close >= highestHigh ? color.new(color.red, 90) : na)
bgcolor(close <= lowestLow ? color.new(color.green, 90) : na)

// Display the values of the support and resistance levels
plotchar(highestHigh, title="Resistance Value", location=location.top, color=color.red, offset=-1)
plotchar(lowestLow, title="Support Value", location=location.bottom, color=color.green, offset=-1)
Candlestick analysis

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明