I need to find out what i am missing here. Thanks for the help

 
int SendScreenShot(const long _chat_id,
                        const string _symbol,
                        const ENUM_TIMEFRAMES _period,
                                int x_axis,
                                int y_axis,
                                bool current_chart,
                                string token)
{
CCustomBot bot;
bot.Token(token);

int result=0;
long chart_id;
if(!current_chart)
chart_id=ChartOpen(_symbol,_period);
else
chart_id=ChartFirst();

if(chart_id==0)
return(ERR_CHART_NOT_FOUND);

if(!current_chart)
ChartSetInteger(ChartID(),CHART_BRING_TO_TOP,true);

//--- updates chart
int wait=60;
while(--wait>0)
{
if(SeriesInfoInteger(_symbol,_period,SERIES_SYNCHRONIZED))
        break;
Sleep(500);
}
string filename;
if(!current_chart)
{
ChartRedraw(chart_id);
Sleep(500);
ChartSetInteger(chart_id,CHART_SHOW_GRID,false);
ChartSetInteger(chart_id,CHART_SHOW_PERIOD_SEP,false);
filename=StringFormat("%s%d.gif",_symbol,_period);
}
else
{
        filename=StringFormat("%s%d.gif",Symbol(),Period());
}

if(FileIsExist(filename))
FileDelete(filename);

if(!current_chart)
ChartRedraw(chart_id);

Sleep(100);

//if (photosend == 0)
   {
   if(ChartScreenShot(chart_id,filename,x_axis,y_axis,ALIGN_RIGHT))
      {
      Sleep(100);
      
      bot.SendChatAction(_chat_id,ACTION_UPLOAD_PHOTO);
      
      //--- waitng 30 sec for save screenshot
      wait=60;
      while(!FileIsExist(filename) && --wait>0)
        Sleep(500);
      
      //---
      if(FileIsExist(filename))
        {
        string screen_id;
        result=bot.SendPhoto(screen_id,_chat_id,filename,_symbol+"_"+StringSubstr(EnumToString(_period),7));
        //photosend = 1;
        
        
        }
      
      }
    }  

if(!current_chart)
ChartClose(chart_id);

return(result);
}
I need to find out what i am missing, the following function takes screenshot of the chart in mt4 and posting it in the Telegram group. the problem is it takes screenshots of all open charts. But i need to take the screenshot of the First chart i.e., ChartFirst() only, as and when call the function it should take only one screenshot and post it to telegram, can some one point out the missing element here. thanks in advance