// version=5
strategy("Strategia EMA Cross + RSI", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// --- Input Utente ---
emaVeloceLen = input.int(9, title="Periodo EMA Veloce")
emaLentaLen = input.int(21, title="Periodo EMA Lenta")
rsiLen = input.int(14, title="Periodo RSI")
rsiSoglia = 50
// --- Calcoli ---
emaVeloce = ta.ema(close, emaVeloceLen)
emaLenta = ta.ema(close, emaLentaLen)
rsiVal = ta.rsi(close, rsiLen)
// --- Condizioni di Ingresso ---
longCondition = ta.crossover(emaVeloce, emaLenta) and rsiVal > rsiSoglia
shortCondition = ta.crossunder(emaVeloce, emaLenta) and rsiVal < rsiSoglia
// --- Esecuzione Ordini ---
if (longCondition)
strategy.entry("Long", strategy.long, comment="Incrocio Rialzista")
if (shortCondition)
strategy.entry("Short", strategy.short, comment="Incrocio Ribassista")
// --- Visualizzazione Grafica ---
plot(emaVeloce, color=color.blue, title="EMA Veloce")
plot(emaLenta, color=color.orange, title="EMA Lenta")
plotshape(longCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Segnale Long")
plotshape(shortCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Segnale Short")
strategy("Strategia EMA Cross + RSI", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// --- Input Utente ---
emaVeloceLen = input.int(9, title="Periodo EMA Veloce")
emaLentaLen = input.int(21, title="Periodo EMA Lenta")
rsiLen = input.int(14, title="Periodo RSI")
rsiSoglia = 50
// --- Calcoli ---
emaVeloce = ta.ema(close, emaVeloceLen)
emaLenta = ta.ema(close, emaLentaLen)
rsiVal = ta.rsi(close, rsiLen)
// --- Condizioni di Ingresso ---
longCondition = ta.crossover(emaVeloce, emaLenta) and rsiVal > rsiSoglia
shortCondition = ta.crossunder(emaVeloce, emaLenta) and rsiVal < rsiSoglia
// --- Esecuzione Ordini ---
if (longCondition)
strategy.entry("Long", strategy.long, comment="Incrocio Rialzista")
if (shortCondition)
strategy.entry("Short", strategy.short, comment="Incrocio Ribassista")
// --- Visualizzazione Grafica ---
plot(emaVeloce, color=color.blue, title="EMA Veloce")
plot(emaLenta, color=color.orange, title="EMA Lenta")
plotshape(longCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Segnale Long")
plotshape(shortCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Segnale Short")
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
