Divergencias con MACD

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #237620 quote
    AbanosAbanos
    Participant
    New

    Buenos días,

     

    estoy intentando programar un indicador que detecte divergencias comparando el MACD y el precio. El siguiente código me da un error que dice: line 1: Characters missing. Suggestion : RETURN, pero cuando añado RETURN al final sigue sin funcionar. Alguien sabría actualizar el código ?

     

    // Parámetros del MACD
    MACD_Line = MACD[12, 26](close)
    Signal_Line = average[9](MACD_Line)

    // Buscar máximos y mínimos en el precio y en el MACD
    Max_Price = highest[5](high)
    Min_Price = lowest[5](low)
    Max_MACD = highest[5](MACD_Line)
    Min_MACD = lowest[5](MACD_Line)

    // Detectar Divergencia Bajista: El precio hace un máximo más alto, pero el MACD no
    Divergencia_Bajista = (high > Max_Price[1]) AND (MACD_Line < Max_MACD[1])

    // Detectar Divergencia Alcista: El precio hace un mínimo más bajo, pero el MACD no
    Divergencia_Alcista = (low < Min_Price[1]) AND (MACD_Line > Min_MACD[1])

    // Mostrar señal de divergencia en el gráfico de precios
    IF Divergencia_Bajista THEN
    DRAWARROW_DOWN(barindex, high, , , 255, 0, 0) // Flecha roja en el gráfico de precios
    ENDIF

    IF Divergencia_Alcista THEN
    DRAWARROW_UP(barindex, low, , , 0, 255, 0) // Flecha verde en el gráfico de precios
    ENDIF

    // Mostrar señal de divergencia en el gráfico del indicador MACD
    IF Divergencia_Bajista THEN
    DRAWLINE(barindex[5], Max_MACD, barindex, MACD_Line, 255, 0, 0) // Línea roja en el gráfico MACD
    ENDIF

    IF Divergencia_Alcista THEN
    DRAWLINE(barindex[5], Min_MACD, barindex, MACD_Line, 0, 255, 0) // Línea verde en el gráfico MACD
    ENDIF

    #237642 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Buenas!
    Tu código tiene bastantes errores. No puedes definir variables que contengan “_”
    Puedes utilizar este código que hay en el archivo: https://www.prorealcode.com/prorealtime-indicators/macd-divergences-on-price-and-indicator/

    #246761 quote
    ZAID72ZAID72
    Participant
    New

    HOLA no quiero abrir otro tema , aprovecho este , es posible buscar divergEncias con RSI , he metido el codigo de ese enlace en la IA y le he dicho si puede cambiar el indicador MACD por el RSI, el codigo que me da no detecta divergencias, en cambio el MACD si las marca en grafico. Gracias

    #246794 quote
    Iván GonzálezIván González
    Moderator
    Legend
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Divergencias con MACD


Soporte Plataforma: Gráficos, Datos y Brokers

New Reply
Author
author-avatar
Abanos @abanos Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Iván GonzálezIván González
1 year, 4 months ago.

Topic Details
Forum: Soporte Plataforma: Gráficos, Datos y Brokers
Language: Spanish
Started: 09/16/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...