OPEN-SOURCE SCRIPT
Zaktualizowano

短线交易策略

70
i dont know what is this , just dont follow and let me try it first
Informacje o Wersji
//version=6
indicator("短线交易策略", overlay = true)

// 1. 均线设置
ma_short1 = ta.sma(close, 5)
ma_short2 = ta.sma(close, 10)
ma_mid1 = ta.sma(close, 21)
ma_mid2 = ta.sma(close, 55)

// 绘制均线
plot(ma_short1, color = color.red, title = "5日均线")
plot(ma_short2, color = color.orange, title = "10日均线")
plot(ma_mid1, color = color.blue, title = "21日均线")
plot(ma_mid2, color = color.green, title = "55日均线")

// 2. 成交量设置
volume_ma = ta.sma(volume, 5)
volume_condition = volume > volume_ma * 2

// 3. RSI设置
rsi_length = 14
rsi_value = ta.rsi(close, rsi_length)
rsi_oversold = 30
rsi_overbought = 70

// 4. MACD设置
[macd_line, signal_line, _] = ta.macd(close, 12, 26, 9)
macd_cross_up = ta.crossover(macd_line, signal_line)
macd_cross_down = ta.crossunder(macd_line, signal_line)

// 5. 布林带设置
[bb_upper, bb_middle, bb_lower] = ta.bb(close, 20, 2)

// 绘制布林带
plot(bb_upper, color = color.purple, title = "布林带上轨")
plot(bb_lower, color = color.purple, title = "布林带下轨")

// 辅助条件变量
above_short_ma = close > ma_short1 and close > ma_short2
below_short_ma = close < ma_short1 and close < ma_short2
rsi_is_oversold = rsi_value < rsi_oversold
rsi_is_overbought = rsi_value > rsi_overbought

// 绘制辅助条件变量
plotshape(above_short_ma, title = "价格在短均线上方", location = location.belowbar, color = color.lime, style = shape.labelup, text = "↑")
plotshape(below_short_ma, title = "价格在短均线下方", location = location.abovebar, color = color.red, style = shape.labeldown, text = "↓")
plotshape(rsi_is_oversold, title = "RSI超卖", location = location.belowbar, color = color.lime, style = shape.labelup, text = "O")
plotshape(rsi_is_overbought, title = "RSI超买", location = location.abovebar, color = color.red, style = shape.labeldown, text = "O")

// 6. 买入条件
buy_condition = above_short_ma and rsi_is_oversold and macd_cross_up and volume_condition

// 7. 卖出条件
sell_condition = below_short_ma and rsi_is_overbought and macd_cross_down and volume_condition

// 标记买入和卖出信号
plotshape(series = buy_condition, title = "买入信号", location = location.belowbar, color = color.green, style = shape.labelup, text = "BUY")
plotshape(series = sell_condition, title = "卖出信号", location = location.abovebar, color = color.red, style = shape.labeldown, text = "SELL")

// 提醒设置
alertcondition(buy_condition, title = "买入提醒", message = "价格满足买入条件")
alertcondition(sell_condition, title = "卖出提醒", message = "价格满足卖出条件")

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.