OPEN-SOURCE SCRIPT

Scalping Strategy

//version=5
strategy("Scalping Strategy", overlay=true)

// EMA settings
emaShort = ta.ema(close, 9)
emaLong = ta.ema(close, 21)

// RSI settings
rsi = ta.rsi(close, 14)
rsiOversold = 30
rsiOverbought = 70

// Entry conditions
longCondition = ta.crossover(emaShort, emaLong) and rsi < rsiOversold
shortCondition = ta.crossunder(emaShort, emaLong) and rsi > rsiOverbought

// Exit conditions
exitLongCondition = ta.crossunder(emaShort, emaLong) or rsi > rsiOverbought
exitShortCondition = ta.crossover(emaShort, emaLong) or rsi < rsiOversold

// Risk management: stop loss and take profit
stopLossPercent = 0.003 // 0.3% of the entry price
takeProfitPercent = 0.006 // 0.6% of the entry price

// Long trade setup
if (longCondition)
strategy.entry("Buy", strategy.long)
strategy.exit("Exit Buy", "Buy", stop=close * (1 - stopLossPercent), limit=close * (1 + takeProfitPercent))

// Short trade setup
if (shortCondition)
strategy.entry("Sell", strategy.short)
strategy.exit("Exit Sell", "Sell", stop=close * (1 + stopLossPercent), limit=close * (1 - takeProfitPercent))

// Plot EMAs on the chart for visual reference
plot(emaShort, title="9 EMA", color=color.green, linewidth=2)
plot(emaLong, title="21 EMA", color=color.red, linewidth=2)
Moving AveragesPine utilitiesTrend Analysis

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?

คำจำกัดสิทธิ์ความรับผิดชอบ