OPEN-SOURCE SCRIPT
My script

//version=6
strategy("Ultimate Combined Buy/Sell Strategy - 4$ Profit", overlay=true)
// تنظیمات ورودی
maFastLength = input.int(5, title="Fast MA Length", minval=1)
maSlowLength = input.int(13, title="Slow MA Length", minval=1)
rsiLength = input.int(14, title="RSI Length", minval=1)
bbLength = input.int(20, title="Bollinger Length", minval=1)
bbMult = input.float(2.0, title="Bollinger Multiplier", minval=0.1, step=0.1)
stochK = input.int(14, title="Stochastic K", minval=1)
stochD = input.int(3, title="Stochastic D", minval=1)
stochSmooth = input.int(3, title="Stochastic Smooth", minval=1)
atrThreshold = input.float(0.10, title="ATR Threshold (Pips)", minval=0.01)
volumeLookback = input.int(20, title="Volume Lookback", minval=1)
profitTargetPips = input.float(40, title="Profit Target (Pips)", minval=1)
stopLossPips = input.float(20, title="Stop Loss (Pips)", minval=1)
// محاسبه اندیکاتورها
maFast = ta.sma(close, maFastLength)
maSlow = ta.sma(close, maSlowLength)
rsi = ta.rsi(close, rsiLength)
[macdLine, signalLine, _] = ta.macd(close, 5, 13, 1)
[bbMiddle, bbUpper, bbLower] = ta.bb(close, bbLength, bbMult)
[stochKVal, stochDVal] = ta.stoch(close, high, low, stochK, stochD, stochSmooth)
atr = ta.atr(14)
avgVolume = ta.sma(volume, volumeLookback)
// سیستم امتیازدهی
buyScore = 0.0
sellScore = 0.0
// امتیاز MA
if maFast > maSlow
buyScore := buyScore + 1.5
if maFast < maSlow
sellScore := sellScore + 1.5
// امتیاز RSI
if rsi < 70
buyScore := buyScore + 1.0
if rsi > 30
sellScore := sellScore + 1.0
if rsi < 30
buyScore := buyScore + 1.5 // اشباع فروش
if rsi > 70
sellScore := sellScore + 1.5 // اشباع خرید
// امتیاز MACD
if macdLine > signalLine
buyScore := buyScore + 1.0
if macdLine < signalLine
sellScore := sellScore + 1.0
// امتیاز Bollinger Bands
if close > bbUpper
buyScore := buyScore + 1.0
if close < bbLower
sellScore := sellScore + 1.0
// امتیاز Stochastic
if stochKVal > stochDVal and stochKVal < 80
buyScore := buyScore + 1.0
if stochKVal < stochDVal and stochKVal > 20
sellScore := sellScore + 1.0
// امتیاز ATR
if atr > atrThreshold
buyScore := buyScore + 1.0
sellScore := sellScore + 1.0
// امتیاز Volume
if volume > avgVolume
buyScore := buyScore + 1.0
sellScore := sellScore + 1.0
// تصمیمگیری
buyCondition = buyScore >= 4.5 and buyScore > sellScore
sellCondition = sellScore >= 4.5 and sellScore > buyScore
// ورود به ترید
if buyCondition
strategy.entry("Buy", strategy.long)
if sellCondition
strategy.entry("Sell", strategy.short)
// خروج با هدف سود و حد ضرر
strategy.exit("Exit Buy", "Buy", profit=profitTargetPips * 10, loss=stopLossPips * 10) // هر پیپ = 0.1 دلار با 0.1 لات
strategy.exit("Exit Sell", "Sell", profit=profitTargetPips * 10, loss=stopLossPips * 10)
// رسم سیگنالها (برای نمایش بصری)
plotshape(buyCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(sellCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
// رسم MA
plot(maFast, "Fast MA", color=color.green, linewidth=1)
plot(maSlow, "Slow MA", color=color.red, linewidth=1)
strategy("Ultimate Combined Buy/Sell Strategy - 4$ Profit", overlay=true)
// تنظیمات ورودی
maFastLength = input.int(5, title="Fast MA Length", minval=1)
maSlowLength = input.int(13, title="Slow MA Length", minval=1)
rsiLength = input.int(14, title="RSI Length", minval=1)
bbLength = input.int(20, title="Bollinger Length", minval=1)
bbMult = input.float(2.0, title="Bollinger Multiplier", minval=0.1, step=0.1)
stochK = input.int(14, title="Stochastic K", minval=1)
stochD = input.int(3, title="Stochastic D", minval=1)
stochSmooth = input.int(3, title="Stochastic Smooth", minval=1)
atrThreshold = input.float(0.10, title="ATR Threshold (Pips)", minval=0.01)
volumeLookback = input.int(20, title="Volume Lookback", minval=1)
profitTargetPips = input.float(40, title="Profit Target (Pips)", minval=1)
stopLossPips = input.float(20, title="Stop Loss (Pips)", minval=1)
// محاسبه اندیکاتورها
maFast = ta.sma(close, maFastLength)
maSlow = ta.sma(close, maSlowLength)
rsi = ta.rsi(close, rsiLength)
[macdLine, signalLine, _] = ta.macd(close, 5, 13, 1)
[bbMiddle, bbUpper, bbLower] = ta.bb(close, bbLength, bbMult)
[stochKVal, stochDVal] = ta.stoch(close, high, low, stochK, stochD, stochSmooth)
atr = ta.atr(14)
avgVolume = ta.sma(volume, volumeLookback)
// سیستم امتیازدهی
buyScore = 0.0
sellScore = 0.0
// امتیاز MA
if maFast > maSlow
buyScore := buyScore + 1.5
if maFast < maSlow
sellScore := sellScore + 1.5
// امتیاز RSI
if rsi < 70
buyScore := buyScore + 1.0
if rsi > 30
sellScore := sellScore + 1.0
if rsi < 30
buyScore := buyScore + 1.5 // اشباع فروش
if rsi > 70
sellScore := sellScore + 1.5 // اشباع خرید
// امتیاز MACD
if macdLine > signalLine
buyScore := buyScore + 1.0
if macdLine < signalLine
sellScore := sellScore + 1.0
// امتیاز Bollinger Bands
if close > bbUpper
buyScore := buyScore + 1.0
if close < bbLower
sellScore := sellScore + 1.0
// امتیاز Stochastic
if stochKVal > stochDVal and stochKVal < 80
buyScore := buyScore + 1.0
if stochKVal < stochDVal and stochKVal > 20
sellScore := sellScore + 1.0
// امتیاز ATR
if atr > atrThreshold
buyScore := buyScore + 1.0
sellScore := sellScore + 1.0
// امتیاز Volume
if volume > avgVolume
buyScore := buyScore + 1.0
sellScore := sellScore + 1.0
// تصمیمگیری
buyCondition = buyScore >= 4.5 and buyScore > sellScore
sellCondition = sellScore >= 4.5 and sellScore > buyScore
// ورود به ترید
if buyCondition
strategy.entry("Buy", strategy.long)
if sellCondition
strategy.entry("Sell", strategy.short)
// خروج با هدف سود و حد ضرر
strategy.exit("Exit Buy", "Buy", profit=profitTargetPips * 10, loss=stopLossPips * 10) // هر پیپ = 0.1 دلار با 0.1 لات
strategy.exit("Exit Sell", "Sell", profit=profitTargetPips * 10, loss=stopLossPips * 10)
// رسم سیگنالها (برای نمایش بصری)
plotshape(buyCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(sellCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
// رسم MA
plot(maFast, "Fast MA", color=color.green, linewidth=1)
plot(maSlow, "Slow MA", color=color.red, linewidth=1)
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.