Les voy a pegar el codigo del trading view y lo parametros de riesgo quisiera poder modificarlos ya sea tamaño de operacion
reduccion maxima en dolares
ganancia maxima en dolares
y los demas factores
le dejo el codigo del trading view y algunas capturas de los valores ajustables segun la cuenta
Es un bot que opera el Nass100 en ftmo
opera la vela de la apertura de new york es decir 16 y30 en el broker de ftmo
en 5 min es decir la vela finaliza 16 y35
si esa vela tiene un cuerpo mayor en volumen que las sumas de sus mechas se entra si es verde al alza 30 pips de sl y 120 de tp
de igual forma si es roja a la baja 30 pips de sl y 120 de tp
proteccion del capital a los 75 puntos se activa el be
a los 115 puntos de activa la proteccion de 110 puntos
tiene un filtro de volumen una sma de 20 periodos y multiplicador de volumen medio de 1.5
igual otro filtro que la vela debe medir minimo 40 puntos
/@version=6
strategy("NY Open 5m USD Monthly Limit + BE + Vol v6", overlay=true, initial_capital=10000, default_qty_type=strategy.fixed, default_qty_value=1, pyramiding=0)
// --- CONFIGURACIÓN DE RIESGO Y LÍMITES EN DÓLARES ---
group_risk = "Gestión de Riesgo y Límites"
slPoints = input.float(30.0, title="Stop Loss Inicial (en Puntos)", minval=1.0, group=group_risk)
tpPoints = input.float(120.0, title="Take Profit (en Puntos)", minval=1.0, group=group_risk)
beTriggerPoints = input.float(75.0, title="Puntos para activar Break-Even", minval=1.0, group=group_risk)
useSecondBE = input.bool(false, title="Activar 2da Protección de Capital", group=group_risk)
be2TriggerPoints = input.float(100.0, title="Puntos para Activar 2da Protección", minval=1.0, group=group_risk)
be2LockPoints = input.float(30.0, title="Puntos a Asegurar en 2da Protección", minval=0.0, group=group_risk)
contractQty = input.int(3, title="Cantidad de Contratos / Lotes", minval=1, group=group_risk)
group_monthly = "Control Mensual en Dólares (USD)"
maxMonthlyLoss = input.float(-300.0, title="Pérdida Máxima Mensual (USD)", step=10.0, group=group_monthly)
maxMonthlyWin = input.float(1500.0, title="Ganancia Máxima Mensual (USD)", step=50.0, group=group_monthly)
// --- CONFIGURACIÓN DE FILTRO DE VOLUMEN Y RANGO DE VELA ---
group_volume = "Filtro de Volumen y Volatilidad"
useVolFilter = input.bool(true, title="Activar Filtro de Volumen", group=group_volume)
volMaLen = input.int(20, title="Longitud SMA Volumen", minval=1, group=group_volume)
volMultiplier = input.float(1.2, title="Multiplicador de Volumen Medio", minval=0.1, step=0.1, group=group_volume)
useRangeFilter = input.bool(true, title="Activar Filtro de Rango Mínimo", group=group_volume)
minCandleRange = input.float(15.0, title="Rango Mínimo de la Vela (en Puntos)", minval=0.0, step=1.0, group=group_volume)
// --- CONTROL DIARIO (MÁXIMO 1 TRADE POR DÍA) ---
var int tradesToday = 0
currentDay = dayofmonth(time)
var int lastDay = na
if na(lastDay) or currentDay != lastDay
lastDay := currentDay
tradesToday := 0
canTradeToday = (tradesToday == 0)
// --- CONTROL MENSUAL ESTRICTO EN DÓLARES (USD) ---
var float startOfMonthEquity = strategy.initial_capital
var int currentMonth = month(time)
if month(time) != currentMonth
currentMonth := month(time)
startOfMonthEquity := strategy.equity
monthlyPnLDollar = strategy.equity - startOfMonthEquity
canTradeMonthly = (monthlyPnLDollar > maxMonthlyLoss and monthlyPnLDollar < maxMonthlyWin)
// --- DETECCIÓN DIRECTA DE LA VELA DE LAS 09:30 (APERTURA NY EN 5M) ---
isTargetBar = (hour(time) == 9 and minute(time) == 30)
// --- CÁLCULO DE LA VELA DE ANÁLISIS ---
body = math.abs(close - open)
upper_wick = high - math.max(open, close)
lower_wick = math.min(open, close) - low
total_wicks = upper_wick + lower_wick
candleRange = high - low
isGreen = close > open
isRed = close < open
validCandle = body > total_wicks
// --- CÁLCULO DEL FILTRO DE VOLUMEN Y RANGO ---
volMA = ta.sma(volume, volMaLen)
validVolume = not useVolFilter or (volume > volMA * volMultiplier)
validRange = not useRangeFilter or (candleRange >= minCandleRange)
// --- VARIABLES PARA GESTIÓN DE BREAK-EVEN ---
var float entryPrice = na
var float slPrice = na
var float tpPrice = na
var bool isShort = false
// --- CIERRE FORZOSO A LAS 12:00 PM (MEDIODÍA NY) ---
isCloseTime = (hour(time) >= 12)
if strategy.position_size != 0 and isCloseTime
strategy.close_all(comment="Cierre 12 PM NY")
// --- SEÑALES DE ENTRADA (INCLUYENDO FILTROS) ---
longSignal = canTradeToday and canTradeMonthly and isTargetBar and validCandle and validVolume and validRange and isGreen
shortSignal = canTradeToday and canTradeMonthly and isTargetBar and validCandle and validVolume and validRange and isRed
// --- EJECUCIÓN DE OPERACIONES ---
if strategy.position_size == 0
if longSignal
entryPrice := close
slPrice := entryPrice - slPoints
tpPrice := entryPrice + tpPoints
isShort := false
strategy.entry("Long NY", strategy.long, qty=contractQty)
strategy.exit("TP/SL Long", "Long NY", stop=slPrice, limit=tpPrice)
tradesToday += 1
else if shortSignal
entryPrice := close
slPrice := entryPrice + slPoints
tpPrice := entryPrice - tpPoints
isShort := true
strategy.entry("Short NY", strategy.short, qty=contractQty)
strategy.exit("TP/SL Short", "Short NY", stop=slPrice, limit=tpPrice)
tradesToday += 1
// --- GESTIÓN DE BREAK-EVEN Y PROTECCIÓN AVANZADA ---
if strategy.position_size != 0
if not isShort
if high >= (entryPrice + beTriggerPoints)
slPrice := math.max(slPrice, entryPrice)
if useSecondBE and high >= (entryPrice + be2TriggerPoints)
slPrice := math.max(slPrice, entryPrice + be2LockPoints)
strategy.exit("TP/SL Long", "Long NY", stop=slPrice, limit=tpPrice)
else
if low <= (entryPrice - beTriggerPoints)
slPrice := math.min(slPrice, entryPrice)
if useSecondBE and low <= (entryPrice - be2TriggerPoints)
slPrice := math.min(slPrice, entryPrice - be2LockPoints)
strategy.exit("TP/SL Short", "Short NY", stop=slPrice, limit=tpPrice)
// --- SEÑALES VISUALES ---
plotshape(longSignal, title="Señal Long NY", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(shortSignal, title="Señal Short NY", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)