Not able to solve this 4001 Error

 

hello here is the mql5 code
i am getting 4001 error continuously  and i am running this OnCalculate

bool PlotTrend(const long              chart_ID=0,
               string                  name="trendline",
               const int               subwindow=0,
               datetime                time1=0,
               double                  price1=0,
               datetime                time2=0,
               double                  price2=0,             
               const color             clr=clrBlack,
               const ENUM_LINE_STYLE   style=STYLE_SOLID,
               const int               width=2,
               const bool              back=true,
               const bool              selection=false,
               const bool              ray=false,
               const bool              hidden=true)
{
   ResetLastError();
   bool jop = ObjectCreate(chart_ID,name,OBJ_TREND,subwindow,time1,price1,time2,price2);

   if(GetLastError()!=0 )
     {
     Print("HHH = ",GetLastError());
     }
   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
   ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
   ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
   ObjectSetInteger(chart_ID,name,OBJPROP_RAY,ray);
   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
   return(true);
}
 
abhi163: i am getting 4001 error continuously  and i am running this OnCalculate

Obviously, your code is irrevalent to terminal internal errors. Restart the terminal.

 

still after restart 

same error is coming 

Reason: