کد ترکیب این اندیکاتور ها را برام بنویس برای تریدینگ ویو
- User
کد ترکیب این اندیکاتور ها را برام بنویس برای تریدینگ ویو
Assistant
اینجا کد Pine Script کاملی برای TradingView هست که ترکیب چندین اندیکاتور رو برای سیگنالهای دقیقتر استفاده میکنه:
//@version=5 indicator("Combined Trading Signals", 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) // محاسبه اندیکاتورها 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 = ema_bullish and macd_bullish and rsi_bullish and volume_condition strong_sell = ema_bearish and macd_bearish and rsi_bearish and volume_condition // نمایش 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="فروش قوی") // رنگآمیزی پسزمینه بر اساس روند 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, 6, 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) // هشدارها alertcondition(buy_signal, title="سیگنال خرید", message="سیگنال خرید تولید شد!") alertcondition(sell_signal, title="سیگنال فروش", message="سیگنال فروش تولید شد!") alertcondition(strong_buy, title="خرید قوی", message="سیگنال خرید قوی تولید شد!") alertcondition(strong_sell, title="فروش قوی", message="سیگنال فروش قوی تولید شد!")نحوه استفاده:
- کد رو کپی کنید
- در TradingView بخش Pine Editor رو باز کنید
- کد رو paste کنید و Save کنید
- به چارت اضافه کنید
ویژگیهای کد:
- سیگنالهای معمولی: مثلثهای کوچک سبز/قرمز
- سیگنالهای قوی: مثلثهای بزرگتر با رنگهای پررنگتر
- جدول اطلاعات: نمایش وضعیت فعلی همه اندیکاتورها
- رنگ پسزمینه: سبز برای روند صعودی، قرمز برای نزولی
- هشدارها: قابلیت تنظیم Alert برای سیگنالها
تنظیمات قابل تغییر:
- طول EMAها
- سطوح RSI
- پارامترهای MACD
- حساسیت حجم
میتونید پارامترها رو بر اساس استراتژی و تایم فریم خودتون تنظیم کنید.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.