//version=4 strategy("Estrategia de Media Móvil", overlay=true)
// Definir la media móvil ma_length = input(title="Longitud de la media móvil", type=input.integer, defval=20) ma = sma(close, ma_length)
// Definir las condiciones de entrada y salida buy_signal = crossover(close, ma) sell_signal = crossunder(close, ma)
// Ejecutar las operaciones de compra y venta if (buy_signal) strategy.entry("Compra", strategy.long) if (sell_signal) strategy.entry("Venta", strategy.short)
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.