help to Complete this indicator to mql4

 

Hi guys I want to convert pinescript v4 indicator to mql4 .. But I am not very good at Mql4.can you help..

#property indicator_chart_window
#property indicator_buffers 7
#property indicator_plots 7

#include <MovingAverages.mqh>
double spike[];
double ma1[];
double ma2[];
double hullma[];
double alma[];
double std[];
double zlsma[];
double dif[];



//////////////----------------Pine Scipt v4 code i want convert to mql4 --------------/////////////


////@version=4
//study("Relative Volatility", shorttitle="Relative Volatility", format = format.volume)
//
//spike = close - open <= 0 ? open - close  : close - open
//
//len = 20
//ma1 = sma(spike,len)
//ma2 = linreg(spike,50,0)
//length = 21
//std = 21
//src = spike
//hullma = wma(2*wma(src, length/2)-wma(src, length), floor(sqrt(length)))
//source = spike
//windowsize = 9
//offset = 0.85
//sigma = 6
//
//lsma2 = linreg(ma2, len, 0)
//a = ma2-lsma2
//zlsma = ma2+a
//
//plot(spike, color= close > open ? #00ffaa : color.red, style=plot.style_columns, title = "Volatility")
//plot(hullma, title = "Filter 1", style = plot.style_area,transp = 70)
//plot(alma(source, windowsize, offset, sigma), style = plot.style_area,transp = 50, title = "Filter 2")
//plot(stdev(spike,std), style = plot.style_area,transp = 70, title = "Filter 3")
//plot(ma1, style = plot.style_area,transp = 60, title = "Filter 4")
////plot(zlsma, color = #b2ebf2, linewidth = 1, title = "ZLSMA")
//plot(ma2, color = #b2ebf2, linewidth = 1, title = "LSMA")
//dif = zlsma - ma2
//plot(dif > 0 ? dif : na , style = plot.style_columns,transp = 40, color = #fff9c4, title = "Trend Columns")
//
//breakavg = crossover(spike,ma2)
//plotshape(breakavg)
//alertcondition(breakavg, "Volatility Above Average")

//////////////----------------Pine Scipt v4 code i want convert to mql4 --------------/////////////




int init()
{
    SetIndexStyle(0, DRAW_COLOR_COLUMNS);
    SetIndexBuffer(0, spike);
    SetIndexLabel(0, "Volatility");
    SetIndexDrawBegin(0, 50);
    
    SetIndexStyle(1, DRAW_LINE);
    SetIndexBuffer(1, hullma);
    SetIndexLabel(1, "Filter 1");
    SetIndexDrawBegin(1, 50);
    
    SetIndexStyle(2, DRAW_LINE);
    SetIndexBuffer(2, alma);
    SetIndexLabel(2, "Filter 2");
    SetIndexDrawBegin(2, 50);
    
    SetIndexStyle(3, DRAW_LINE);
    SetIndexBuffer(3, std);
    SetIndexLabel(3, "Filter 3");
    SetIndexDrawBegin(3, 50);
    
    SetIndexStyle(4, DRAW_LINE);
    SetIndexBuffer(4, ma1);
    SetIndexLabel(4, "Filter 4");
    SetIndexDrawBegin(4, 50);
    
    SetIndexStyle(5, DRAW_LINE);
    SetIndexBuffer(5, zlsma);
    SetIndexLabel(5, "ZLSMA");
    SetIndexDrawBegin(5, 50);
    
    SetIndexStyle(6, DRAW_COLOR_COLUMNS);
    SetIndexBuffer(6, dif);
    SetIndexLabel(6, "Trend Columns");
    SetIndexDrawBegin(6, 50);

    IndicatorShortName("Relative Volatility");
    IndicatorDigits(Digits + 1);
    
    int len = 20;
    int length = 21;
    int windowsize = 9;
    double offset = 0.85;
    int sigma = 6;
    
    for (int i = 0; i < Bars; i++) {
        double open = Open[i];
        double close = Close[i];
        spike[i] = close - open <= 0 ? open - close : close - open;
    }
    
    ma1 = MovingAverage(spike, len, MODE_SMA);
    ma2 = LinearReg(spike, 50, 0);
    
    double src[] = spike;
    hullma = WMA(2 * WMA(src, length / 2) - WMA(src, length), MathFloor(MathSqrt(length)));
    
    alma = ALMA(src, windowsize, offset, sigma);
    
    std = MovingAverage(spike, std, MODE_SMA, length);
    
    lsma2 = LinearReg(ma2, len, 0);
    double a = ma2 - lsma2;
    zlsma = ma2 + a;
    
    for (int i = 0; i < Bars; i++) {
        dif[i] = zlsma[i] - ma2[i] > 0 ? zlsma[i] - ma2[i] : EMPTY_VALUE;
    }
    
    return(INIT_SUCCEEDED);
}

int start()
{
    return(0);
}
 
night owl: I want to convert pinescript v4 indicator to mql4 .. But I am not very good at Mql4.can you help..
  1. Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
              No free help (2017)

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2018)

    We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
              No free help (2017)

  2. Where are your implementations of MovingAverage, LinearReg, WMA, ALMA, and LinearReg?

  3. Why is your code only in OnInit? Where do you set your buffers in OnCalculate?
 
  • Usually people who cannot code do not receive free help on this forum.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free).
  • Finally, you also have the option to hire a programmer in the Freelance section.