I need 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=ChartID();

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 help with this function. it takes screenshot of all open charts in the account. i want to take only the First chart screenshot only. i.e., ChartFirst(). can someone help me to do that. here is the function. Thanks for your help
 

It doesn't take screenshots of all open charts in the account.

Find the chartID you want to take a screenshot from and use that ID in the call.

Documentation on MQL5: Chart Operations / ChartOpen
Documentation on MQL5: Chart Operations / ChartOpen
  • www.mql5.com
ChartOpen - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
if (TimeCurrent() >= lastscreenshotsend + 21600  )
  //if (lastscreenshotsend + 3600 != Time[0] )
     {
     photosend == 0;
     
      string token = "1454697537:AAG7f8tMvGXSh9G-dmTIZCPhMeB_jBQSwsQ";  
     SendScreenShot(-1001331438105,"Contact : Telegram @vickyjackakash"+ "\n" +
                   "Deposit : $ "+DoubleToString(openingdeposit,2)+ "\n" +
                  "Last Week Profit : "+DoubleToStr(AccountLastWeekProfit()*100/Deposit,2)+" % - $ "+DoubleToString(AccountLastWeekProfit(),2)+ "\n" +
                  "This Week Profit : "+DoubleToString(Perc,2)+" % - $ "+ DoubleToString(AccountWeekProfit(),2)+ "\n" +
                  //"Balance : $ "+DoubleToString(AccountBalance(),2)+ "\n" +
                  "Account Number: "+AccountNumber()+ "\n" +
                  "Account Name: "+AccountName()+ "\n" +AccountServer()+ "\n" +WindowExpertName()+ "\n" +"Time Frame ",PERIOD_M15,1366,768,true,"1454697537:AAG7f8tMvGXSh9G-dmTIZCPhMeB_jBQSwsQ");
                  //ObjectSetText("Vendokho51ia","Last Week Profit - "+DoubleToStr(AccountLastWeekProfit()*100/Deposit,2)+ " % - $ "+ DoubleToString(AccountLastWeekProfit(),2),11,"Rockwell",clrLime);
                  //   ObjectSetText("Vendokho51sa","Earned So Far this Week - "+DoubleToString(Perc,2)+" % - $ "+ DoubleToString(AccountWeekProfit(),2),11,"Rockwell",clrYellow);
     //SendScreenShot(618256809,Symbol(), PERIOD_M15,1366,768,TRUE,token);
     //1001331438105
     
     lastscreenshotsend = TimeCurrent();
     }
Marco vd Heijden:

It doesn't take screenshots of all open charts in the account.

Find the chartID you want to take a screenshot from and use that ID in the call.


here is how i call it, it takes screenshot of all open charts
 
int SendScreenShot(const long _chat_id,
                        const string _symbol,
                        const ENUM_TIMEFRAMES _period,
                                int x_axis,
                                int y_axis,
                                bool current_chart,
                                string token)

Here see the parameters the second one should be Symbol() the third PERIOD_CURRENT.

But when i look at your call its a string with 

"Contact : Telegram @vickyjackakash"

It doesn't make any sense.

 
SendScreenShot(618256809,Symbol(), PERIOD_M15,1366,768,TRUE,token);
Marco vd Heijden
:

Here see the parameters the second one should be Symbol() the third PERIOD_CURRENT.

But when i look at your call its a string with 

It doesn't make any sense.


this is the normal call, even in this call, it takes screenshot of all open charts and posts in telegram, but i want to post the first open chart only SendScreenShot(618256809,Symbol(), PERIOD_M15,1366,768,TRUE,token);
Documentation on MQL5: Chart Operations / ChartOpen
Documentation on MQL5: Chart Operations / ChartOpen
  • www.mql5.com
ChartOpen - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Maybe you can try to start with SendPhoto() in stead of SendScreenshot().

You can make a screenshot of the chart you desire, then save it as a file, and then send that file as a photo to your channel.

 
Marco vd Heijden:

Maybe you can try to start with SendPhoto() in stead of SendScreenshot().

You can make a screenshot of the chart you desire, then save it as a file, and then send that file as a photo to your channel.

I will try bro. Thank you