Bitcoin

Boot2

29
//version=5
strategy("Auto Trader Bot by ZSoft [Daily Analytics]", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

// تنظیمات کاربر
vwmaLength = input.int(31, title="VWMA Length")
vwmaOffsetRatio = input.float(0.989, title="VWMA Offset Ratio")
emaBaseLength = input.int(19, title="EMA Base Length")
emaOffsetRatio = input.float(0.912, title="EMA Offset Ratio")
rsiThreshold = input.int(52, title="RSI Threshold")
ema15mLength = input.int(30, title="15m EMA Length")
tradeStartHour = input.int(9, title="Trade Start Hour")
tradeEndHour = input.int(19, title="Trade End Hour")

// اندیکاتورها
vwma = ta.vwma(close, vwmaLength)
vwmaLine = vwma * vwmaOffsetRatio
emaLen = math.round(emaBaseLength * emaOffsetRatio)
emaLine = ta.ema(close, emaLen)
rsiVal = ta.rsi(close, 25)
ema15m = request.security(syminfo.tickerid, "15", ta.ema(close, ema15mLength))

// امتیاز سیگنال
score = 0
score += close < vwmaLine ? 1 : 0
score += close < emaLine ? 1 : 0
score += close < ema15m ? 1 : 0
score += rsiVal < rsiThreshold ? 1 : 0
score += rsiVal < 30 ? 1 : 0

// تحلیل زمانی
inTime = (hour >= tradeStartHour and hour <= tradeEndHour)

// آنالیز سود/ضرر روزانه
var float dayProfit = na
var int today = na
if na(today) or dayofyear != today
today := dayofyear
dayProfit := 0.0

// فقط وقتی روز جدید شروع بشه، سود روزانه آپدیت بشه
if strategy.closedtrades > 0
lastTradeDay = dayofyear(time[strategy.closedtrades - 1])
if lastTradeDay == today
dayProfit += strategy.closedtrades.profit(strategy.closedtrades - 1)

// شروع ترید فقط وقتی:
allowTrade = (dayProfit >= 0) and inTime

longCond = score >= 4 and allowTrade
shortCond = score <= 1 and allowTrade

if longCond
strategy.entry("LONG", strategy.long)
if shortCond
strategy.entry("SHORT", strategy.short)

// نمایش سود روز و امتیاز
plot(score, title="Signal Score", style=plot.style_columns, color=color.new(color.lime, 0))
plot(dayProfit, title="Daily Profit", color=color.new(color.yellow, 0), linewidth=2)

// نمایش روی چارت
label.new(bar_index, high,
text="Profit Today: $" + str.tostring(dayProfit, "#.##") + "\nScore: " + str.tostring(score),
style=label.style_label_down, textcolor=color.white, color=color.gray, size=size.small)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.