Forums › ProRealTime foro Español › Soporte ProBuilder › Elder Impulse System › Reply To: Elder Impulse System
02/16/2025 at 1:59 PM
#243913
A continuación se muestra un fragmento de código ProRealTime que implementa las condiciones descritas
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
// Define the Exponential Moving Average (EMA) EMA13 = ExponentialAverage[13](close) // Define MACD and its Histogram MACDValue = MACD[12,26,9](close) SignalValue = ExponentialAverage[9](MACDValue) MACDHistogram = MACDValue - SignalValue // Conditions for Green Price Bar GreenBar = (EMA13 > EMA13[1]) and (MACDHistogram > MACDHistogram[1]) // Conditions for Red Price Bar RedBar = (EMA13 < EMA13[1]) and (MACDHistogram < MACDHistogram[1]) // Apply coloring to the price bars if GreenBar then DRAWCANDLE(Open, High, Low, Close) COLOURED(0, 128, 0) // Green elsif RedBar then DRAWCANDLE(Open, High, Low, Close) COLOURED(255, 0, 0) // Red else DRAWCANDLE(Open, High, Low, Close) COLOURED(0, 0, 255) // Blue endif RETURN |
Este fragmento de código debe añadirse a un gráfico ProRealTime para colorear automáticamente las barras de precios en función de las condiciones especificadas. La función DRAWCANDLE
se utiliza para dibujar las velas en los colores especificados: verde para condiciones alcistas, rojo para condiciones bajistas y azul cuando no se cumple ninguna de las dos condiciones. Esto debería ayudar a visualizar las tendencias del mercado según los criterios de EMA y histograma MACD descritos.