How to resize the chart using MQL5?.

 

if the chart height is 250 pixels and width is 450 pixels when my indicator applies to the chart, I want my indicator to resize the chart height to 450 pixels and width to 720 pixels. How can I achieve this?

I have tried to do this way, but nothing is working. it is possible to resize the chart size using mql5?


//+------------------------------------------------------------------+
//|                                                 Chart Height.mq5 |
//|                                          Copyright, H A T LAKMAL |
//|                                           https://t.me/Lakmal846 |
//+------------------------------------------------------------------+
#property copyright "Copyright, H A T LAKMAL"
#property link      "https://t.me/Lakmal846"
#property version   "1.00"
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

// Variable
long chartHeight, ChartWidth;

int OnInit()
  {
//--- indicator buffers mapping

   chartHeight = ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS);
   ChartWidth =  ChartGetInteger(0,CHART_WIDTH_IN_PIXELS);
   
   Comment("Chart Height in Pixels -: ", chartHeight , "\n", "Chart Width in pixels -: ", ChartWidth);
   
   if(chartHeight < 250 || ChartWidth < 450)
     {
      // Resise the chart
      PlaySound("Ok.wav");
      ChartSetInteger(0,CHART_HEIGHT_IN_PIXELS,450);
      ChartSetInteger(0,CHART_WIDTH_IN_PIXELS,720);
     }
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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 value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+


 

 
Hapu Arachchilage Tharindu Lakmal:

if the chart height is 250 pixels and width is 450 pixels when my indicator applies to the chart, I want my indicator to resize the chart height to 450 pixels and width to 720 pixels. How can I achieve this?

I have tried to do this way, but nothing is working. it is possible to resize the chart size using mql5?



 

the width size in pixels is read only , so is the height in pixels unless you want to resize an indicator subwindow

Chart Properties - Chart Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5

Documentation on MQL5: Constants, Enumerations and Structures / Chart Constants / Chart Properties
Documentation on MQL5: Constants, Enumerations and Structures / Chart Constants / Chart Properties
  • www.mql5.com
Identifiers of ENUM_CHART_PROPERTY enumerations are used as parameters of functions for working with charts . The abbreviation of r/o in the ...