Can Anyone make an Exact Copy of Pine Indicator!

 

Hello,
   Hope you are fine. I have an indicator that I created myself in Trading View. I want to use this same in MT5 terminal because I have to open both MT5 terminal and Trading View simutaneously. Previously I posted about this and I have been told to Learn the code. I removed all errors and issues that were creating this indicator to compile. Now what I have made is just a scrap. Basically I am not a coder even I made Pine Indicator after lots of hours work. Can anyone make for me exact copy of this indicator for MT5 terminal. It will help me a alot. I have attached all files. Thanks in Advance.


PS: I attached original indicator of Pine Indicator as txt file

 

Here is the Pine Script:

[Copyright Muhammad Fraz Trading View Version 1]

study("MF_Vix_Fix_For_Market_Top_and_Bottom", overlay=false)

pd = input(22, title="LookBack Period Standard Deviation High?Low?")

bbl = input(20, title="Bollinger Band Length")

mult = input(2.0, minval=1, maxval=5, title="Bollinger Band Standard Deviation Up?Down?")

lb = input(50, title="Look Back Period Percentile High?Low?")

ph = input(.99, title="Highest Percentile Top- 0.90=90%, 0.95=95%, 0.99=99%")

ph2 = input(.85, title="Highest Percentile Bottom- 0.90=90%, 0.95=95%, 0.99=99%")

pl = input(1.15, title="Lowest Percentile Top- 1.10=90%, 1.05=95%, 1.01=99%")

pl2 = input(1.01, title="Lowest Percentile Bottom- 1.10=90%, 1.05=95%, 1.01=99%")

wfmt = input(true, title="Show Market Top?")

wfmb = input(true, title="Show Market Bottom?")

hp = input(false, title="Show High Range For Market Top- Based on Percentile and LookBack Period?")

hp2 = input(false, title="Show High Range For Market Bottom- Based on Percentile and LookBack Period?")

sd = input(false, title="Show Standard Deviation Line For Market Top?")

sd2 = input(false, title="Show Standard Deviation Line For Market Bottom?")

pmn = input(true, title="Show Percentile Meter Normalized- Based on Both Percentile Difference?")

pme = input(true, title="Show Percentile Meter Extremes?- Based on Both Percentile Difference?")


wvf = ((lowest(close, pd)-high)/(lowest(close, pd)))*100

wvf2 = ((highest(close, pd)-low)/(highest(close, pd)))*100


sDev = mult * stdev(wvf, bbl)

sDev2 = mult * stdev(wvf2, bbl)

midLine = sma(wvf, bbl)

midLine2 = sma(wvf2, bbl)

lowerBand = midLine - sDev

upperBand = midLine + sDev

lowerBand2 = midLine2 - sDev2

upperBand2 = midLine2 + sDev2


rangeHigh = (highest(wvf, lb)) * ph

rangeLow = (lowest(wvf, lb)) * pl

rangeHigh2 = (highest(wvf2, lb)) * ph2

rangeLow2 = (lowest(wvf2, lb)) * pl2


col = wvf <= lowerBand or wvf <= rangeLow ? red : gray

col2 = wvf2 >= upperBand2 or wvf2 >= rangeHigh2 ? lime : gray

diffpmn = (wvf2 + wvf)/2

diffpme = wvf2 + wvf


plot(wfmt and wvf ? wvf : na, title="MF Vix Fix For Market Top", style=histogram, linewidth=4, color=col)

plot(hp and rangeHigh ? rangeHigh : na, title="Range High Percentile For Market Top", style=line, linewidth=4, color=orange)

plot(hp and rangeLow ? rangeLow : na, title="Range Low Percentile For Market Top", style=line, linewidth=4, color=orange)

plot(sd and lowerBand ? lowerBand : na, title="SD Band Top", style=line, linewidth=3, color=yellow)

plot(wfmb and wvf2 ? wvf2 : na, title="MF Vix Fix For Market Bottom", style=histogram, linewidth=4, color=col2)

plot(hp2 and rangeHigh2 ? rangeHigh2 : na, title="Range High Percentile For Market Bottom", style=line, linewidth=4, color=orange)

plot(hp2 and rangeLow2 ? rangeLow2 : na, title="Range Low Percentile For Market Bottom", style=line, linewidth=4, color=orange)

plot(sd2 and upperBand2 ? upperBand2 : na, title="SD Band Bottom", style=line, linewidth=3, color=red)

plot(pmn and diffpmn ? diffpmn : na, title="Percentile Meter Normalized", style=line, linewidth=1, color=lime)

plot(pme and diffpme ? diffpme : na, title="Percentile Meter Extremes", style=line, linewidth=1, color=white)

 
Muhammad Fraz: I am not a coder .. Can anyone make for me
  1. 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.     int lowest_index = iLowest(NULL,0,MODE_CLOSE, pd, i);
        double lowest_value = low[lowest_index];
    iLowest indexes as-series, you have not set your accessed arrays to as-series.
 
William Roeder #:
  1. 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. iLowest indexes as-series, you have not set your accessed arrays to as-series.

int OnInit()
{
  SetIndexBuffer(0, WVF,INDICATOR_DATA);
  SetIndexBuffer(1, WVF2,INDICATOR_CALCULATIONS);
  SetIndexBuffer(2, DiffPMN,INDICATOR_CALCULATIONS);
  SetIndexBuffer(3, DiffPME,INDICATOR_CALCULATIONS);
  
  PlotIndexSetInteger(0,PLOT_LINE_WIDTH,4);
  PlotIndexSetInteger(1,PLOT_LINE_WIDTH,4);
  PlotIndexSetInteger(2,PLOT_LINE_WIDTH,1);
  PlotIndexSetInteger(3,PLOT_LINE_WIDTH,1);
  
  ArraySetAsSeries(WVF,true);
  ArraySetAsSeries(WVF2,true);
  ArraySetAsSeries(DiffPMN,true);
  ArraySetAsSeries(DiffPME,true);
  
  IndicatorSetString(INDICATOR_LEVELTEXT,0, "Muhammad Fraz Vix Fix For Market Top");
  IndicatorSetString(INDICATOR_LEVELTEXT,1, "Muhammad Fraz Vix Fix For Market Bottom");
  IndicatorSetString(INDICATOR_LEVELTEXT,2, "Percentile Meter Normalized");
  IndicatorSetString(INDICATOR_LEVELTEXT,3, "Percentile Meter Extremes");
  return(INIT_SUCCEEDED);
}

Ok Thanks sir for your Help ! I will try this step , Yes I have forgot to Set the iLowest as-series. I have to create 2 buffers more to Change the color of the Histogram that will create Signals for Market Top and Market Bottom. But First I have to dealt with these main 4 Buffers to correctly show the calculations as Pine Editor was showing me. Thanks sir again for your Kind Help.
 
Muhammad Fraz #:


Ok Thanks sir for your Help ! I will try this step , Yes I have forgot to Set the iLowest as-series. I have to create 2 buffers more to Change the color of the Histogram that will create Signals for Market Top and Market Bottom. But First I have to dealt with these main 4 Buffers to correctly show the calculations as Pine Editor was showing me. Thanks sir again for your Kind Help.
William Roeder #:
  1. 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. iLowest indexes as-series, you have not set your accessed arrays to as-series.
Sir One more thing, When I apply the code to the Chart, It is disappering and appearing and continously doing  that and It was doing it before I applied,
ArraySetAsSeries
Is there any suggestion further you can provide to improve that code? Thanks in Advance.
 
William Roeder #:
  1. 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. iLowest indexes as-series, you have not set your accessed arrays to as-series.
//+--------------------------------------------------------------------+
//|                                                   Percentile.mq5         |
//|                                          Copyright Muhammad Fraz |
//+--------------------------------------------------------------------+
#property      description "Percentile"
//--- indicator settings
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_plots   4
#property indicator_type1   DRAW_HISTOGRAM
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_type2   DRAW_HISTOGRAM
#property indicator_color2  clrLime
#property indicator_style2  STYLE_SOLID
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrWhite
#property indicator_style3  STYLE_SOLID
#property indicator_type4   DRAW_LINE
#property indicator_color4  clrLime
#property indicator_style4  STYLE_SOLID

input int pd = 22;
input int bbl = 20;
input double mult = 2.0;
input int lb = 50;
input double ph = 0.99;
input double ph2 = 0.85;
input double pl = 1.15;
input double pl2 = 1.01;
input ENUM_APPLIED_PRICE applied_price=PRICE_CLOSE;
input bool ShowMarketTop = true;
input bool ShowMarketBottom = true;
input bool ShowPercentileMeterNormalized = true;
input bool ShowPercentileMeterExtremes = true;

double WVF[];
double WVF2[];
double DiffPMN[];
double DiffPME[];

int OnInit()
{
  SetIndexBuffer(0, WVF,INDICATOR_DATA);
  SetIndexBuffer(1, WVF2,INDICATOR_DATA);
  SetIndexBuffer(2, DiffPMN,INDICATOR_DATA);
  SetIndexBuffer(3, DiffPME,INDICATOR_DATA);
  
  PlotIndexSetInteger(0,PLOT_LINE_WIDTH,4);
  PlotIndexSetInteger(1,PLOT_LINE_WIDTH,4);
  PlotIndexSetInteger(2,PLOT_LINE_WIDTH,1);
  PlotIndexSetInteger(3,PLOT_LINE_WIDTH,1);
  
  ArraySetAsSeries(WVF,true);
  ArraySetAsSeries(WVF2,true);
  ArraySetAsSeries(DiffPMN,true);
  ArraySetAsSeries(DiffPME,true);
    
  IndicatorSetString(INDICATOR_LEVELTEXT,0, "Muhammad Fraz Vix Fix For Market Top");
  IndicatorSetString(INDICATOR_LEVELTEXT,1, "Muhammad Fraz Vix Fix For Market Bottom");
  IndicatorSetString(INDICATOR_LEVELTEXT,2, "Percentile Meter Normalized");
  IndicatorSetString(INDICATOR_LEVELTEXT,3, "Percentile Meter Extremes");
  return(INIT_SUCCEEDED);
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
  int limit = rates_total - prev_calculated;
  if (limit <= 0) return(0);
  int i;
  ArrayResize(WVF, limit);
  for (i = 0; i < limit; i++)
{
    int lowest_index = iLowest(NULL,0,MODE_CLOSE, pd, i);
    double lowest_value = low[lowest_index];
    WVF[i] = -100 * ((lowest_value - high[i]) / lowest_value);
}
  
  if (limit <= 0) return(0);
  ArrayResize(WVF2, limit);
  for (i = 0; i < limit; i++)
{
    int highest_index = iHighest(NULL,0,MODE_CLOSE, pd, i);
    double highest_value = high[highest_index];
    WVF2[i] = -100 * ((highest_value - low[i]) / highest_value);
} 
   
  if (limit <= 0) return(0);
  
    ArrayResize(DiffPMN, limit);
  for (i = 0; i < limit; i++)
{
    DiffPMN[i] = -1 * ((WVF[i] + WVF2[i]) / 2.0);
}
  
  if (limit <= 0) return(0);
  
  ArrayResize(DiffPMN, limit);
  for (i = 0; i < limit; i++)
{
    DiffPME[i] = -1 * ((WVF[i] + WVF2[i]));
}

for (i = 0; i < rates_total; i++)
{
if (WVF[i] < 0)
{
WVF[i] = 0;
}
if (WVF2[i] > 0)
{
WVF2[i] = 0;
}
}

  for (i = 0; i < rates_total; i++)
{
  if (!ShowMarketTop)
{
  WVF[i] = 0;
}
  if (!ShowMarketBottom)
{
  WVF2[i] = 0;
}
  if (!ShowPercentileMeterNormalized)
{
  DiffPMN[i] = 0;
}
  if (!ShowPercentileMeterExtremes)
{
  DiffPME[i] = 0;
}
}

return(rates_total);
}

 I made some improvements, But in vain. I dont know How to convert exactly as the original Pinescript that I made... Need some Help for What I have to include in to exactly copy my code of Pinescript. And The the dissappearing and reappearing of the indicator eroor is still present.