Indicador HeikenAshiHistogram codigo de conversión MT4 a Prorealtime

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #218830 quote
    JankarlJankarl
    Participant
    New

    Hola Adjunto el codigo para convertir.

    //+——————————————————————+
    //| HeikenAshiHistogram.mq4
    //| Copyright http://www.pointzero-indicator.com
    //+——————————————————————+

    #property copyright “Copyright © Pointzero-indicator.com”
    #property link “http://www.pointzero-indicator.com”

    #property indicator_separate_window
    #property indicator_buffers 3
    #property indicator_color1 DodgerBlue
    #property indicator_color2 Red
    #property indicator_color3 Teal
    #property indicator_width1 2
    #property indicator_width2 2
    #property indicator_width3 1
    #define MaMetod 2

    //——————————-
    // External variables
    //——————————-
    extern int AvPeriod = 5;

    //——————————-
    // Buffers
    //——————————-

    double FextMapBuffer1[];
    double FextMapBuffer2[];
    double FextMapBuffer3[];
    double FextMapBuffer4[];
    double FextMapBuffer5[];

    //+——————————————————————+
    //| Custom indicator initialization function |
    //|——————————————————————|
    int init()
    {
    // Total buffers
    IndicatorBuffers(5);

    // Visible buffers
    SetIndexStyle(0,DRAW_HISTOGRAM, 0);
    SetIndexBuffer(0, FextMapBuffer1);
    SetIndexStyle(1,DRAW_HISTOGRAM, 0);
    SetIndexBuffer(1, FextMapBuffer2);
    SetIndexStyle(3,DRAW_LINE, 0);
    SetIndexBuffer(2,FextMapBuffer3);

    // Internal
    SetIndexBuffer(3,FextMapBuffer4);
    SetIndexBuffer(4,FextMapBuffer5);

    // My name
    IndicatorShortName(“Heiken Ashi Histogram”);
    Comment(“Copyright © http://www.pointzero-indicator.com”);
    return(0);
    }

    //+——————————————————————+
    //| Custom indicator deinitialization function |
    //+——————————————————————+
    int deinit()
    {
    return(0);
    }

    //+——————————————————————+
    //| Custom indicator iteration function |
    //+——————————————————————+
    int start()
    {
    // Start, limit, etc..
    int start = 0;
    int limit;
    int counted_bars = IndicatorCounted();
    if(Bars<=10) return(0);

    // nothing else to do?
    if(counted_bars < 0)
    return(-1);

    // do not check repeated bars
    limit = Bars – 1 – counted_bars;
    if(counted_bars==0) limit-=1+1;

    // 1) Check heiken ashi for past to present
    for(int pos = limit; pos >= start; pos–)
    {
    // Open and close
    double open = iCustom(Symbol(), 0, “Heiken Ashi”, 2, pos);
    double close = iCustom(Symbol(), 0, “Heiken Ashi”, 3, pos);

    // Median
    FextMapBuffer4[pos] = (open + close) / 2;

    // Difference
    FextMapBuffer5[pos] = MathAbs(FextMapBuffer4[pos] – FextMapBuffer4[pos+1]);

    // If bearish
    if(open > close)
    {
    FextMapBuffer2[pos] = FextMapBuffer5[pos];
    FextMapBuffer1[pos] = 0;

    // If bullish
    } else {

    FextMapBuffer1[pos] = FextMapBuffer5[pos];
    FextMapBuffer2[pos] = 0;
    }
    }

    // Apply average
    for(int i=0; i < Bars; i++) FextMapBuffer3[i] = iMAOnArray(FextMapBuffer5, Bars, AvPeriod, 0, MaMetod, i);
    return(0);
    }

     

    El indicador se utiliza de la siguiente manera.

    Se entra largo o corto cuando una de la velas cruza por encima de la media en la siguiente vela. Si es verde se entra largo y si es roja en entra en corto.

    Muchas gracias de antemano

    imagen-heiken-Asi-histogran.pdf
    #218853 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Publica solo en el idioma del foro en el que publicas. Por ejemplo, inglés solo en foros en inglés y español solo en foros en español (Lo moví del foro en inglés).

    Gracias 🙂

    #220903 quote
    JankarlJankarl
    Participant
    New

    Ok. Pido disculpas por el error. Es la primera vez que entre y de golpe solicite tres codigos.

    Saludos y muchas gracias de antemano por el gran trabajo desempeñado.

    #220912 quote
    NicolasNicolas
    Keymaster
    Legend

    Aquí está el código de este indicador con histograma suavizado Heikin Ashi:

    AvPeriod=5
    
    if barindex>AvPeriod then
    xClose = (open+high+low+close)/4
    if BarIndex=0 THEN
    xOpen = open
    xHigh = high
    xLow = low
    else
    xOpen = (xOpen[1] + xClose[1])/2
    endif
    
    Buffer4 = (xopen + xclose) / 2
    Buffer5 = abs(Buffer4-Buffer4[1])
    
    if (open>close) then
    r=255
    g=0
    else
    r=0
    g=255
    endif
    
    once avg = close
    
    avg = avg[1] + (buffer5 - avg[1]) / AvPeriod
    endif
    
    return avg style(line), buffer5 style(histogram) coloured(r,g,0)
    
    #220960 quote
    JankarlJankarl
    Participant
    New

    Hola Nicolás.

    Muchas gracias por la conversión. Eres un crack.

    Saludos

Viewing 5 posts - 1 through 5 (of 5 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

Indicador HeikenAshiHistogram codigo de conversión MT4 a Prorealtime


ProBuilder: Indicadores y Herramientas

New Reply
Author
author-avatar
Jankarl @jankarl Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by JankarlJankarl
3 years ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 08/09/2023
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...