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 อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ