//+------------------------------------------------------------------+
//|                                              LABEL && BUTTON.mq5 |
//|                                  Copyright 2026, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
	string font = "Segoe UI",
			 name = "LABEL",
			 text = "MN1";
	int	 size = 17,
			 x		= 50;
	uint 	 iw	= 0,
			 ih	= 0;
//---
   TextSetFont(font,-10*size,FW_NORMAL,0);
	TextGetSize(text,iw,ih);
//---
	//for(int r = ObjectsTotal(0,-1,-1) - 1; r > -1; r--)
   //ObjectDelete(0,ObjectName(0,r));
	//ChartRedraw();
//---
	ObjectCreate	 (0,name,OBJ_LABEL,        	0,0,0);
   ObjectSetInteger(0,name,OBJPROP_CORNER,   	CORNER_RIGHT_LOWER);
   ObjectSetInteger(0,name,OBJPROP_ANCHOR,   	ANCHOR_LEFT_UPPER);
   ObjectSetInteger(0,name,OBJPROP_XDISTANCE,	iw + x);
   ObjectSetInteger(0,name,OBJPROP_YDISTANCE,	ih);
   ObjectSetString (0,name,OBJPROP_TEXT,			text);
   ObjectSetString (0,name,OBJPROP_FONT,     	font);
   ObjectSetInteger(0,name,OBJPROP_FONTSIZE, 	size);
	ObjectSetInteger(0,name,OBJPROP_BACK,			false);
   ObjectSetInteger(0,name,OBJPROP_HIDDEN,   	false);
//---
	name = "BUTTON";
	ObjectCreate	 (0,name,OBJ_BUTTON,				0,0,0);
	ObjectSetInteger(0,name,OBJPROP_CORNER,		CORNER_RIGHT_LOWER);
   ObjectSetInteger(0,name,OBJPROP_XDISTANCE,	iw + x);
   ObjectSetInteger(0,name,OBJPROP_YDISTANCE,	ih);
	ObjectSetInteger(0,name,OBJPROP_XSIZE,			iw);
   ObjectSetInteger(0,name,OBJPROP_YSIZE,			ih);
	ObjectSetInteger(0,name,OBJPROP_BORDER_COLOR,clrRed);
	ObjectSetInteger(0,name,OBJPROP_BGCOLOR,     ChartGetInteger(0,CHART_COLOR_BACKGROUND));
	ObjectSetInteger(0,name,OBJPROP_BACK,			true);
   ObjectSetInteger(0,name,OBJPROP_HIDDEN,		false);
//---
	ChartRedraw();

  }
//+------------------------------------------------------------------+
