Convertir codigo de de pine (tradingview) a metatrader 5

MQL5 Experten

Auftrag beendet

Ausführungszeit 15 Tage

Spezifikation

hola buenos dias necesito convertir el siguiente codigo de pine hecho para tradingview a metatrader5, vigilando que la estrategia funcione exactamente igual que en tradingview


//@version=5

strategy("Estrategia de Scalping Optimizada con Apalancamiento", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=5)

 

// Configuración de indicadores

lengthRSI = input.int(14, "Longitud RSI")

upperThresholdRSI = input.int(70, "Umbral Superior RSI")

lowerThresholdRSI = input.int(30, "Umbral Inferior RSI")

rsi = ta.rsi(close, lengthRSI)

 

// Configuración de Bandas de Bollinger para confirmación

lengthBB = input.int(20, "Longitud BB")

multBB = input.float(2.0, "Multiplicador BB")

basisBB = ta.sma(close, lengthBB)

devBB = multBB * ta.stdev(close, lengthBB)

upperBB = basisBB + devBB

lowerBB = basisBB - devBB

 

// Opción para elegir operaciones en largo, corto o ambos

tradeDirection = input.string("both", "Dirección de Operación", options=["long", "short", "both"])

 

// Opción para apalancamiento

leverage = input.float(1.0, "Apalancamiento", minval=1.0, maxval=100.0, step=0.1)

 

// Señales de entrada más selectivas

longCondition = (rsi < lowerThresholdRSI) and (close < lowerBB)

shortCondition = (rsi > upperThresholdRSI) and (close > upperBB)

 

// Gestión de riesgo dinámica basada en la volatilidad

atr = ta.atr(14)

riskPerTrade = input.float(1.0, "Riesgo por Operación (%)", step=0.1)

stopLossATRMultiple = input.float(2.0, "Múltiplo de ATR para Stop Loss", step=0.5)

 

// Cálculo de tamaño de posición basado en el riesgo, ATR y apalancamiento

riskAmount = strategy.equity * riskPerTrade / 100

positionSize = (riskAmount / (atr * stopLossATRMultiple)) * leverage

 

// Ejecución de órdenes con gestión de riesgo basada en la dirección seleccionada

if (tradeDirection == "long" or tradeDirection == "both") and longCondition

    strategy.entry("Compra", strategy.long, qty=positionSize)

    strategy.exit("StopLoss/TakeProfit Compra", "Compra", stop=close - atr * stopLossATRMultiple, limit=close + atr * stopLossATRMultiple * 2)

 

if (tradeDirection == "short" or tradeDirection == "both") and shortCondition

    strategy.entry("Venta", strategy.short, qty=positionSize)

    strategy.exit("StopLoss/TakeProfit Venta", "Venta", stop=close + atr * stopLossATRMultiple, limit=close - atr * stopLossATRMultiple * 2)

 

// Visualización en gráfico

plot(upperBB, "Banda Superior BB", color=color.red)

plot(basisBB, "Banda Media BB", color=color.blue)

plot(lowerBB, "Banda Inferior BB", color=color.green)

hline(upperThresholdRSI, "Umbral Superior RSI", color=color.red)

hline(lowerThresholdRSI, "Umbral Inferior RSI", color=color.green)


Bewerbungen

1
Entwickler 1
Bewertung
(184)
Projekte
317
24%
Schlichtung
23
35% / 13%
Frist nicht eingehalten
23
7%
Frei
Veröffentlicht: 3 Beispiele
2
Entwickler 2
Bewertung
(572)
Projekte
664
32%
Schlichtung
42
45% / 45%
Frist nicht eingehalten
12
2%
Arbeitet
3
Entwickler 3
Bewertung
(511)
Projekte
550
53%
Schlichtung
13
69% / 15%
Frist nicht eingehalten
3
1%
Arbeitet
4
Entwickler 4
Bewertung
(851)
Projekte
1458
72%
Schlichtung
122
29% / 48%
Frist nicht eingehalten
356
24%
Frei
Veröffentlicht: 3 Artikel
5
Entwickler 5
Bewertung
(131)
Projekte
170
39%
Schlichtung
10
40% / 0%
Frist nicht eingehalten
30
18%
Beschäftigt
6
Entwickler 6
Bewertung
(574)
Projekte
945
47%
Schlichtung
309
58% / 27%
Frist nicht eingehalten
125
13%
Frei

Projektdetails

Budget
30 - 200 USD
Ausführungsfristen
von 1 bis 3 Tag(e)