PEPPERSTONE:XAUUSD   الذهب / دولار أمريكي
//@version=5
strategy("Gold Trading Strategy", overlay=true)

// Input parameters
k_period = input(14, title="Stochastic %K Period")
d_period = input(3, title="Stochastic %D Period")
smooth_k = input(3, title="Stochastic Smoothing")

sma_50 = ta.sma(close, 50)
sma_200 = ta.sma(close, 200)

= ta.stoch(k_period, d_period, smooth_k)

// Buy condition
buy_condition = ta.crossover(k, d) and k < 20 and close > sma_50 and close > sma_200
if (buy_condition)
strategy.entry("Buy", strategy.long)

// Sell condition
sell_condition = ta.crossunder(k, d) and k > 80 and close < sma_50 and close < sma_200
if (sell_condition)
strategy.entry("Sell", strategy.short)

// Plotting
plot(sma_50, color=color.blue, title="SMA 50")
plot(sma_200, color=color.red, title="SMA 200")
إخلاء المسؤولية

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