#property copyright "I drink Sprite 2019, Jim, No rights reserved."
#property link      "www.forexfactory.com"
#property version   "1.10 Edit by Coder: Nicholishen"
#property indicator_chart_window
#include <chartobjects/chartobjectslines.mqh>
#include <arrays/list.mqh>
#include <trade/trade.mqh>
input int lines = 20;
input int interval = 100;
input ENUM_LINE_STYLE line_style = STYLE_DOT;
input int line_width = 1; 
input color line_color = C'47,151,255';
const string prefix = "__gridlines__";
 
class GLine : public CChartObjectHLine {
   static int s_inst;
public:
   bool Create(double price) {
      string name = prefix + string(++s_inst);
      if (!CChartObjectHLine::Create(0, name, 0, price))
         return false;
      bool mod_settings = (
            this.Color(line_color)
         && this.Style(line_style)
         && this.Width(line_width)
      );
      return mod_settings;
   }
};
int GLine::s_inst = 0;
CList g_lines;
//+------------------------------------------------------------------+
int OnInit()
{
   ObjectsDeleteAll(0, prefix);
   CSymbolInfo si;
   si.Name(_Symbol);
   si.RefreshRates();
   double base_price = si.Ask();
   int multipler = (int)pow(10, si.Digits());
   double pip_value = si.Point();
   long temp_price = (long)(base_price * multipler);
   temp_price = temp_price - temp_price % 1000;
   base_price = temp_price * pip_value;
   for (int i=0; i<lines; i++) {
      double p1 = base_price + i * interval * pip_value;
      double p2 = base_price - i * interval * pip_value;
      GLine *line1 = new GLine();
      GLine *line2 = new GLine();
      g_lines.Add(line1);
      g_lines.Add(line2);
      if (!line1.Create(p1) || !line2.Create(p2))
         return INIT_FAILED;
    }
    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[])
{
    return (rates_total);
}
//+------------------------------------------------------------------+