OPEN-SOURCE SCRIPT

myc 15min

200
//version=5
strategy("MultiSymbol Smart Money EA sin Lotes ni Pares", overlay=true)

// Parámetros de la estrategia RSI
RSI_Period = input.int(14, title="RSI Periodo", minval=1)
RSI_Overbought = input.float(70, title="RSI sobrecompra")
RSI_Oversold = input.float(30, title="RSI sobreventa")

// Valores fijos para Stop Loss y Take Profit en porcentaje
FIXED_SL = input.float(0.2, title="Stop Loss en %", minval=0.0) / 100
FIXED_TP = input.float(0.6, title="Take Profit en %", minval=0.0) / 100

// Cálculo del RSI
rsi = ta.rsi(close, RSI_Period)

// Condiciones de compra y venta basadas en el RSI
longCondition = rsi <= RSI_Oversold
shortCondition = rsi >= RSI_Overbought

// Precio de entrada
longPrice = close
shortPrice = close

// Ejecutar las operaciones
if (longCondition)
strategy.entry("Compra", strategy.long)

if (shortCondition)
strategy.entry("Venta", strategy.short)

// Fijar el Stop Loss y Take Profit en base al porcentaje de la entrada
if (strategy.position_size > 0) // Si hay una posición larga
longStopLoss = longPrice * (1 - FIXED_SL)
longTakeProfit = longPrice * (1 + FIXED_TP)
strategy.exit("Salir Compra", from_entry="Compra", stop=longStopLoss, limit=longTakeProfit)

if (strategy.position_size < 0) // Si hay una posición corta
shortStopLoss = shortPrice * (1 + FIXED_SL)
shortTakeProfit = shortPrice * (1 - FIXED_TP)
strategy.exit("Salir Venta", from_entry="Venta", stop=shortStopLoss, limit=shortTakeProfit)

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.