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)

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.