سیگنال سل و بای را نشان دهد
- 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.
برای نمایش سیگنالهای Buy (خرید) و Sell (فروش) به صورت واضح و دقیق، کد زیر را در TradingView استفاده کنید. این اندیکاتور از ترکیب RSI، MACD، میانگین متحرک و ATR برای تشخیص روند و سیگنالهای معتبر استفاده میکند.
//@version=5
indicator("Advanced Buy/Sell Signals", overlay=true)
// --- تنظیمات اندیکاتورها ---
rsiLength = input.int(14, "RSI Length", minval=1)
macdFast = input.int(12, "MACD Fast Length", minval=1)
macdSlow = input.int(26, "MACD Slow Length", minval=1)
macdSignal = input.int(9, "MACD Signal Length", minval=1)
ma50Length = input.int(50, "MA 50 Length", minval=1)
ma200Length = input.int(200, "MA 200 Length", minval=1)
atrLength = input.int(14, "ATR Length", minval=1)
// --- محاسبه اندیکاتورها ---
// RSI
rsi = ta.rsi(close, rsiLength)
// MACD
[macdLine, signalLine, _] = ta.macd(close, macdFast, macdSlow, macdSignal)
// میانگین متحرک
ma50 = ta.sma(close, ma50Length)
ma200 = ta.sma(close, ma200Length)
// ATR (برای محاسبه ریسک)
atr = ta.atr(atrLength)
// --- تشخیص روند ---
bullishTrend = close > ma50 and close > ma200
bearishTrend = close < ma50 and close < ma200
// --- شرایط سیگنال خرید (Buy) ---
buyCondition =
bullishTrend and
rsi < 30 and
macdLine > signalLine and
close > ma50
// --- شرایط سیگنال فروش (Sell) ---
sellCondition =
bearishTrend and
rsi > 70 and
macdLine < signalLine and
close < ma50
// --- نمایش سیگنالها ---
// سیگنال خرید (مثلث سبز زیر کندل)
plotshape(
series=buyCondition,
title="Buy Signal",
location=location.belowbar,
style=shape.triangleup,
size=size.small,
color=color.green,
text="BUY",
textcolor=color.white
)
// سیگنال فروش (مثلث قرمز بالای کندل)
plotshape(
series=sellCondition,
title="Sell Signal",
location=location.abovebar,
style=shape.triangledown,
size=size.small,
color=color.red,
text="SELL",
textcolor=color.white
)
// --- نمایش میانگین متحرک ---
plot(ma50, color=color.blue, title="MA 50")
plot(ma200, color=color.red, title="MA 200")
// --- رنگ پسزمینه برای نمایش روند ---
bgcolor(
bullishTrend ? color.new(color.green, 90) :
bearishTrend ? color.new(color.red, 90) : na
)
// --- هشدارها ---
alertcondition(buyCondition, title="Buy Alert", message="سیگنال خرید فعال شد!")
alertcondition(sellCondition, title="Sell Alert", message="سیگنال فروش فعال شد!")
اندیکاتورهای استفاده شده:
شرایط سیگنال خرید (Buy):
close > MA50 و close > MA200)شرایط سیگنال فروش (Sell):
close < MA50 و close < MA200)نمایش سیگنالها:
هشدارها:
این اندیکاتور برای تریدهای میانمدت و بلندمدت مناسب است و سیگنالهای دقیقتری نسبت به استفاده از یک اندیکاتور تنها ارائه میدهد. 🚀