کد را کامل بنویس
- User
کد را کامل بنویس
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
کد را کامل بنویس
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
کد کامل Pine Script با تغییرات مورد نظر:
//@version=5
indicator("Combined Trading Signals-01 [ Azari BTC ] 2025", shorttitle="CTS", overlay=true)
// تنظیمات قابل تغییر
ema_short = input.int(9, title="EMA کوتاه", minval=1)
ema_long = input.int(21, title="EMA بلند", minval=1)
rsi_length = input.int(14, title="طول RSI", minval=1)
rsi_overbought = input.int(70, title="RSI اشباع خرید", minval=50, maxval=100)
rsi_oversold = input.int(30, title="RSI اشباع فروش", minval=1, maxval=50)
macd_fast = input.int(12, title="MACD سریع", minval=1)
macd_slow = input.int(26, title="MACD کند", minval=1)
macd_signal = input.int(9, title="MACD سیگنال", minval=1)
volume_ma_length = input.int(20, title="طول میانگین حجم", minval=1)
// ورودی برای تست سیگنالهای قوی ریلکستر
use_relaxed_strong_signals = input.bool(false, title="استفاده از سیگنالهای قوی ریلکستر (فقط برای تست)", confirm=true)
// محاسبه اندیکاتورها
ema_s = ta.ema(close, ema_short)
ema_l = ta.ema(close, ema_long)
rsi = ta.rsi(close, rsi_length)
[macd_line, signal_line, histogram] = ta.macd(close, macd_fast, macd_slow, macd_signal)
volume_ma = ta.sma(volume, volume_ma_length)
volume_condition = volume > volume_ma * 1.2
// شرایط خرید
ema_bullish = ema_s > ema_l and ema_s[1] <= ema_l[1] // تقاطع صعودی EMA
rsi_bullish = rsi < rsi_oversold and rsi[1] >= rsi_oversold // خروج از اشباع فروش
macd_bullish = macd_line > signal_line and macd_line[1] <= signal_line[1] // تقاطع صعودی MACD
price_above_ema = close > ema_l // قیمت بالای EMA بلند
// شرایط فروش
ema_bearish = ema_s < ema_l and ema_s[1] >= ema_l[1] // تقاطع نزولی EMA
rsi_bearish = rsi > rsi_overbought and rsi[1] <= rsi_overbought // خروج از اشباع خرید
macd_bearish = macd_line < signal_line and macd_line[1] >= signal_line[1] // تقاطع نزولی MACD
price_below_ema = close < ema_l // قیمت زیر EMA بلند
// سیگنالهای نهایی (ترکیبی)
buy_signal = (ema_bullish or macd_bullish) and rsi < 60 and price_above_ema and volume_condition
sell_signal = (ema_bearish or macd_bearish) and rsi > 40 and price_below_ema and volume_condition
// سیگنالهای قوی (اصلی - سختگیرانه)
strong_buy_strict = ema_bullish and macd_bullish and (rsi < rsi_oversold) and volume_condition
strong_sell_strict = ema_bearish and macd_bearish and (rsi > rsi_overbought) and volume_condition
// سیگنالهای قوی ریلکستر (فقط برای تست)
strong_buy_relaxed = (ema_s > ema_l) and (macd_line > signal_line) and (rsi < 50)
strong_sell_relaxed = (ema_s < ema_l) and (macd_line < signal_line) and (rsi > 50)
// انتخاب سیگنال قوی بر اساس ورودی کاربر
strong_buy = use_relaxed_strong_signals ? strong_buy_relaxed : strong_buy_strict
strong_sell = use_relaxed_strong_signals ? strong_sell_relaxed : strong_sell_strict
// نمایش EMAها
plot(ema_s, color=color.blue, linewidth=2, title="EMA کوتاه")
plot(ema_l, color=color.red, linewidth=2, title="EMA بلند")
// نمایش سیگنالها
plotshape(buy_signal, style=shape.triangleup, location=location.belowbar,
color=color.green, size=size.small, title="سیگنال خرید")
plotshape(sell_signal, style=shape.triangledown, location=location.abovebar,
color=color.red, size=size.small, title="سیگنال فروش")
// نمایش سیگنالهای قوی
plotshape(strong_buy, style=shape.triangleup, location=location.belowbar,
color=color.lime, size=size.normal, title="خرید قوی")
plotshape(strong_sell, style=shape.triangledown, location=location.abovebar,
color=color.maroon, size=size.normal, title="فروش قوی")
// نمایش وضعیت هر شرط به صورت جداگانه (دایرههای کوچک)
plotshape(ema_bullish, title="EMA Bullish", location=location.top, color=color.blue, style=shape.circle, size=size.tiny)
plotshape(macd_bullish, title="MACD Bullish", location=location.top, color=color.orange, style=shape.circle, size=size.tiny)
plotshape(rsi < rsi_oversold, title="RSI < Oversold", location=location.top, color=color.purple, style=shape.circle, size=size.tiny)
plotshape(volume_condition, title="Volume High", location=location.top, color=color.gray, style=shape.circle, size=size.tiny)
plotshape(ema_bearish, title="EMA Bearish", location=location.bottom, color=color.blue, style=shape.circle, size=size.tiny)
plotshape(macd_bearish, title="MACD Bearish", location=location.bottom, color=color.orange, style=shape.circle, size=size.tiny)
plotshape(rsi > rsi_overbought, title="RSI > Overbought", location=location.bottom, color=color.purple, style=shape.circle, size=size.tiny)
// رنگآمیزی پسزمینه بر اساس روند
bgcolor(ema_s > ema_l ? color.new(color.green, 95) : color.new(color.red, 95))
// جدول اطلاعات
var table info_table = table.new(position.top_right, 2, 11, bgcolor=color.white, border_width=1)
if barstate.islast
table.cell(info_table, 0, 0, "اندیکاتور", text_color=color.black, bgcolor=color.gray)
table.cell(info_table, 1, 0, "وضعیت", text_color=color.black, bgcolor=color.gray)
table.cell(info_table, 0, 1, "EMA", text_color=color.black)
table.cell(info_table, 1, 1, ema_s > ema_l ? "صعودی" : "نزولی",
text_color=ema_s > ema_l ? color.green : color.red)
table.cell(info_table, 0, 2, "RSI", text_color=color.black)
table.cell(info_table, 1, 2, str.tostring(math.round(rsi, 2)),
text_color=rsi > 70 ? color.red : rsi < 30 ? color.green : color.black)
table.cell(info_table, 0, 3, "MACD", text_color=color.black)
table.cell(info_table, 1, 3, macd_line > signal_line ? "صعودی" : "نزولی",
text_color=macd_line > signal_line ? color.green : color.red)
table.cell(info_table, 0, 4, "حجم", text_color=color.black)
table.cell(info_table, 1, 4, volume_condition ? "بالا" : "عادی",
text_color=volume_condition ? color.green : color.gray)
// بخش اشکالزدایی برای سیگنالهای قوی
table.cell(info_table, 0, 5, "--- سیگنال خرید قوی ---", text_color=color.black, bgcolor=color.new(color.gray, 80))
table.cell(info_table, 1, 5, "", text_color=color.black, bgcolor=color.new(color.gray, 80))
table.cell(info_table, 0, 6, "EMA Cross", text_color=color.black)
table.cell(info_table, 1, 6, str.tostring(ema_bullish), text_color=ema_bullish ? color.green : color.red)
table.cell(info_table, 0, 7, "MACD Cross", text_color=color.black)
table.cell(info_table, 1, 7, str.tostring(macd_bullish), text_color=macd_bullish ? color.green : color.red)
table.cell(info_table, 0, 8, "RSI < 30?", text_color=color.black)
table.cell(info_table, 1, 8, str.tostring(rsi < rsi_oversold), text_color=(r