I need an indicator that plots 3 lines

 

I need an indicator that plots 3 lines: a horizontal line from daily open to close, another line certain number of points above the daily open &  another line certain number of points below the daily open.

Be able to set number of days which to draw lines. Simple.

Be able to set number of points to draw a line above and below the daily open

 

You copy pasting job from freelance to forum?

Are you the developer?
 

No, I'm not a developer. I paid someone to do the job but the code is giving me errors when I compile it.


#property indicator_chart_window

#property indicator_buffers 3 // Increase buffers to 3

#property indicator_plots   3 // Increase plots to 3

#property indicator_label1  "Daily open line"

#property indicator_label2  "Above Open line"

#property indicator_label3  "Below Open line"

#property indicator_type1   DRAW_ARROW

#property indicator_type2   DRAW_LINE

#property indicator_type3   DRAW_LINE

#property indicator_style1  STYLE_DOT

#property indicator_style2  STYLE_SOLID

#property indicator_style3  STYLE_SOLID

#property indicator_color1  clrGold

#property indicator_color2  clrRed

#property indicator_color3  clrBlue


input int TimeShift = 0; // Time shift (in hours)

double openLine[];

double aboveOpen[];

double belowOpen[];


int OnInit() { 

    SetIndexBuffer(0, openLine, INDICATOR_DATA); 

    SetIndexBuffer(1, aboveOpen, INDICATOR_CALCULATIONS);

    SetIndexBuffer(2, belowOpen, INDICATOR_CALCULATIONS);

    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[])

{

    if (Bars(_Symbol, _Period) < rates_total) 

        return(-1);


    for (int i = (int)MathMax(prev_calculated - 1, 0); i < rates_total && !IsStopped(); i++)

    {

        string stime = TimeToString(time[i] + TimeShift * 3600, TIME_DATE);

        openLine[i] = (i > 0) ? (TimeToString(time[i - 1] + TimeShift * 3600, TIME_DATE) == stime) ? openLine[i - 1] : open[i] : open[i];

        

        aboveOpen[i] = openLine[i] + 100 * Point; // Line 100 points above the daily open

        belowOpen[i] = openLine[i] - 100 * Point; // Line 100 points below the daily open

    }

    return (rates_total);

}


 
Teboho_Mosikidi #:

#property indicator_chart_window

#property indicator_buffers 3 // Increase buffers to 3

#property indicator_plots   3 // Increase plots to 3

#property indicator_label1  "Daily open line"

#property indicator_label2  "Above Open line"

#property indicator_label3  "Below Open line"

#property indicator_type1   DRAW_ARROW

#property indicator_type2   DRAW_LINE

#property indicator_type3   DRAW_LINE

#property indicator_style1  STYLE_DOT

#property indicator_style2  STYLE_SOLID

#property indicator_style3  STYLE_SOLID

#property indicator_color1  clrGold

#property indicator_color2  clrRed

#property indicator_color3  clrBlue


input int TimeShift = 0; // Time shift (in hours)

double openLine[];

double aboveOpen[];

double belowOpen[];


int OnInit() { 

    SetIndexBuffer(0, openLine, INDICATOR_DATA); 

    SetIndexBuffer(1, aboveOpen, INDICATOR_CALCULATIONS);

    SetIndexBuffer(2, belowOpen, INDICATOR_CALCULATIONS);

    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[])

{

    if (Bars(_Symbol, _Period) < rates_total) 

        return(-1);


    for (int i = (int)MathMax(prev_calculated - 1, 0); i < rates_total && !IsStopped(); i++)

    {

        string stime = TimeToString(time[i] + TimeShift * 3600, TIME_DATE);

        openLine[i] = (i > 0) ? (TimeToString(time[i - 1] + TimeShift * 3600, TIME_DATE) == stime) ? openLine[i - 1] : open[i] : open[i];

        

        aboveOpen[i] = openLine[i] + 100 * Point; // Line 100 points above the daily open

        belowOpen[i] = openLine[i] - 100 * Point; // Line 100 points below the daily open

    }

    return (rates_total);

}

Try compiling this

#property indicator_chart_window

#property indicator_buffers 3 // Increase buffers to 3

#property indicator_plots   3 // Increase plots to 3

#property indicator_label1  "Daily open line"

#property indicator_label2  "Above Open line"

#property indicator_label3  "Below Open line"

#property indicator_type1   DRAW_ARROW

#property indicator_type2   DRAW_LINE

#property indicator_type3   DRAW_LINE

#property indicator_style1  STYLE_DOT

#property indicator_style2  STYLE_SOLID

#property indicator_style3  STYLE_SOLID

#property indicator_color1  clrGold

#property indicator_color2  clrRed

#property indicator_color3  clrBlue



input int TimeShift = 0; // Time shift (in hours)

double openLine[];

double aboveOpen[];

double belowOpen[];



int OnInit() { 

    SetIndexBuffer(0, openLine, INDICATOR_DATA); 

    SetIndexBuffer(1, aboveOpen, INDICATOR_CALCULATIONS);

    SetIndexBuffer(2, belowOpen, INDICATOR_CALCULATIONS);

    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[])

{

    if (Bars(_Symbol, _Period) < rates_total) 

        return(-1);



    for (int i = (int)MathMax(prev_calculated - 1, 0); i < rates_total && !IsStopped(); i++)

    {

        string stime = TimeToString(time[i] + TimeShift * 3600, TIME_DATE);

        openLine[i] = (i > 0) ? (TimeToString(time[i - 1] + TimeShift * 3600, TIME_DATE) == stime) ? openLine[i - 1] : open[i] : open[i];

        

        aboveOpen[i] = openLine[i] + 100 * Point(); // Line 100 points above the daily open

        belowOpen[i] = openLine[i] - 100 * Point(); // Line 100 points below the daily open

    }

    return (rates_total);

}

You should contact with developer who did this for another issues next time. 
 
Can't thank you enough. Thank you.
Reason: