OPEN-SOURCE SCRIPT

Daily Chart Strategy with Advanced Indicators

//version=5
indicator("Daily Chart Strategy with Advanced Indicators", overlay=false)

// Input Parameters for Indicators
atrLength = input.int(14, title="ATR Length")
superTrendFactor = input.float(3.0, title="SuperTrend Factor")
superTrendPeriod = input.int(10, title="SuperTrend Period")
hmaLength = input.int(21, title="Hull Moving Average Length")
connorsRsiLength = input.int(3, title="Connors RSI Length")
vwapSource = input(close, title="VWAP Source")

// ATR Calculation for Volatility Management
atr = ta.atr(atrLength)

// SuperTrend Calculation
[superTrendUpper, superTrendLower] = ta.supertrend(superTrendFactor, superTrendPeriod)
trendUp = not na(superTrendLower) and close > superTrendLower
trendDown = not na(superTrendUpper) and close < superTrendUpper

// Hull Moving Average (HMA) Calculation
hma = ta.hma(close, hmaLength)

// Connors RSI Calculation (Simplified Version)
connorsRsi = ta.rsi(close, connorsRsiLength)

// VWAP Calculation
vwap = ta.vwap(vwapSource)

// Entry Conditions
longCondition = trendUp and (connorsRsi < 20) and (close > vwap) and (hma > hma[1])
shortCondition = trendDown and (connorsRsi > 80) and (close < vwap) and (hma < hma[1])

// Plotting Indicators on Chart
plot(hma, title="Hull Moving Average", color=color.blue, linewidth=2)
plot(vwap, title="VWAP", color=color.orange, linewidth=2)
plot(superTrendLower, title="SuperTrend Lower", color=color.green, linewidth=1, style=plot.style_stepline)
plot(superTrendUpper, title="SuperTrend Upper", color=color.red, linewidth=1, style=plot.style_stepline)

// Plot Buy and Sell Signals Globally
plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// Execute Long Trade
if (longCondition)
label.new(bar_index, low, text="LONG", color=color.green, textcolor=color.white, style=label.style_label_up, size=size.small)
entryPrice = close
stopLoss = entryPrice - (2 * atr)
takeProfit = entryPrice + (6 * atr)
// Plotting SL and TP Levels
line.new(bar_index, stopLoss, bar_index + 5, stopLoss, color=color.red, width=1, style=line.style_dashed)
line.new(bar_index, takeProfit, bar_index + 5, takeProfit, color=color.green, width=1, style=line.style_dashed)

// Execute Short Trade
if (shortCondition)
label.new(bar_index, high, text="SHORT", color=color.red, textcolor=color.white, style=label.style_label_down, size=size.small)
entryPrice = close
stopLoss = entryPrice + (2 * atr)
takeProfit = entryPrice - (6 * atr)
// Plotting SL and TP Levels
line.new(bar_index, stopLoss, bar_index + 5, stopLoss, color=color.red, width=1, style=line.style_dashed)
line.new(bar_index, takeProfit, bar_index + 5, takeProfit, color=color.green, width=1, style=line.style_dashed)

// Alerts for Entry Conditions
alertcondition(longCondition, title="SuperTrend Long", message="SuperTrend turned bullish with Connors RSI in oversold territory - Long Opportunity")
alertcondition(shortCondition, title="SuperTrend Short", message="SuperTrend turned bearish with Connors RSI in overbought territory - Short Opportunity")
Bands and ChannelsBill Williams IndicatorsBreadth Indicators

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm