الذهب / دولار أمريكي

Pwpetch004

92
//version=5
strategy("Fibonacci and Volume Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)

// Input for volume threshold
volThreshold = input.int(100000, title="Volume Threshold", minval=1)

// Calculate the highest high and lowest low over the past 24 hours (24 bars on a 1-hour chart)
highLevel = ta.highest(high, 24)
lowLevel = ta.lowest(low, 24)

// Calculate Fibonacci levels
fib382 = lowLevel + (highLevel - lowLevel) * 0.382
fib618 = lowLevel + (highLevel - lowLevel) * 0.618

// Plot Fibonacci levels
plot(fib382, color=color.blue, linewidth=1, title="Fib 38.2%")
plot(fib618, color=color.red, linewidth=1, title="Fib 61.8%")

// Check 24-hour volume
vol24hr = ta.sma(volume, 24)
highVolume = vol24hr > volThreshold

// Long condition: Price above 38.2% Fibonacci level with high volume
longCondition = close > fib382 and highVolume
if (longCondition)
strategy.entry("Long", strategy.long)

// Short condition: Price below 61.8% Fibonacci level with high volume
shortCondition = close < fib618 and highVolume
if (shortCondition)
strategy.entry("Short", strategy.short)

// Plot volume for reference
plot(vol24hr, color=color.purple, title="24-Hour SMA Volume")
hline(volThreshold, "Volume Threshold", color=color.gray)

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.