#property strict #property indicator_chart_window int corner=CORNER_RIGHT_UPPER,xDistance=270; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping CreatePanel(); //--- 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); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- if(id==CHARTEVENT_OBJECT_CLICK && (sparam=="HEADER" || sparam=="MAIN")) { if(corner==CORNER_RIGHT_UPPER) { corner=CORNER_LEFT_UPPER; xDistance=10; } else { corner=CORNER_RIGHT_UPPER; xDistance=270; } CreatePanel(); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CreatePanel() { ObjectCreate("HEADER",OBJ_RECTANGLE_LABEL,0,0,0); ObjectSet("HEADER",OBJPROP_CORNER,corner); ObjectSet("HEADER",OBJPROP_XDISTANCE,xDistance); ObjectSet("HEADER",OBJPROP_YDISTANCE,30); ObjectSet("HEADER",OBJPROP_XSIZE,260); ObjectSet("HEADER",OBJPROP_YSIZE,30); ObjectSet("HEADER",OBJPROP_BORDER_TYPE,BORDER_FLAT); ObjectSet("HEADER",OBJPROP_COLOR,clrWhite); ObjectSet("HEADER",OBJPROP_BGCOLOR,clrBlack); //Main Panel ObjectCreate("MAIN",OBJ_RECTANGLE_LABEL,0,0,0); ObjectSet("MAIN",OBJPROP_CORNER,corner); ObjectSet("MAIN",OBJPROP_XDISTANCE,xDistance); ObjectSet("MAIN",OBJPROP_YDISTANCE,59); ObjectSet("MAIN",OBJPROP_XSIZE,260); ObjectSet("MAIN",OBJPROP_YSIZE,600); ObjectSet("MAIN",OBJPROP_BORDER_TYPE,BORDER_FLAT); ObjectSet("MAIN",OBJPROP_COLOR,clrWhite); ObjectSet("MAIN",OBJPROP_BGCOLOR,clrMidnightBlue); } //+------------------------------------------------------------------+
Raphael Schwietering:
Hi,
how can i change position of this?
Now i want to say this objects on upper left side or upper right side. Can we do this or did i have to change all x and y distance positions?
//+------------------------------------------------------------------+ //| ee.mq4 | //| Copyright 2017, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2017, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ input string cor="0,1,2,3"; input int WhatCorner=0;// int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- ObjectCreate("HEADER",OBJ_RECTANGLE_LABEL,0,0,0); ObjectSet("HEADER",OBJPROP_CORNER,WhatCorner); ObjectSet("HEADER",OBJPROP_XDISTANCE,270); ObjectSet("HEADER",OBJPROP_YDISTANCE,30); ObjectSet("HEADER",OBJPROP_XSIZE,260); ObjectSet("HEADER",OBJPROP_YSIZE,30); ObjectSet("HEADER",OBJPROP_BORDER_TYPE,BORDER_FLAT); ObjectSet("HEADER",OBJPROP_COLOR,clrWhite); ObjectSet("HEADER",OBJPROP_BGCOLOR,clrBlack); //Main Panel ObjectCreate("MAIN",OBJ_RECTANGLE_LABEL,0,0,0); ObjectSet("MAIN",OBJPROP_CORNER,WhatCorner); ObjectSet("MAIN",OBJPROP_XDISTANCE,270); ObjectSet("MAIN",OBJPROP_YDISTANCE,59); ObjectSet("MAIN",OBJPROP_XSIZE,260); ObjectSet("MAIN",OBJPROP_YSIZE,600); ObjectSet("MAIN",OBJPROP_BORDER_TYPE,BORDER_FLAT); ObjectSet("MAIN",OBJPROP_COLOR,clrWhite); ObjectSet("MAIN",OBJPROP_BGCOLOR,clrMidnightBlue); } //+------------------------------------------------------------------+
Mehmet Bastem:
Have to change x and y distances as well.
#property strict enum ENUM_CORNER { ENUM_CORNER_LEFT_UPPER=CORNER_LEFT_UPPER, //Left upper corner ENUM_CORNER_RIGHT_UPPER=CORNER_RIGHT_UPPER, //Right upper corner ENUM_CORNER_LEFT_LOWER=CORNER_LEFT_LOWER, //Left lower corner ENUM_CORNER_RIGHT_LOWER=CORNER_RIGHT_LOWER //Right lower corner }; input ENUM_CORNER Corner=ENUM_CORNER_RIGHT_UPPER; int xDistance,yDistHeader,yDistMain; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping xDistance=(Corner==ENUM_CORNER_LEFT_UPPER || Corner==ENUM_CORNER_LEFT_LOWER)?10:270; if(Corner==ENUM_CORNER_LEFT_UPPER || Corner==ENUM_CORNER_RIGHT_UPPER) { yDistHeader=30; yDistMain=59; } else { yDistHeader=645; yDistMain=616; } CreatePanel(); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CreatePanel() { ObjectCreate("HEADER",OBJ_RECTANGLE_LABEL,0,0,0); ObjectSet("HEADER",OBJPROP_CORNER,Corner); ObjectSet("HEADER",OBJPROP_XDISTANCE,xDistance); ObjectSet("HEADER",OBJPROP_YDISTANCE,yDistHeader); ObjectSet("HEADER",OBJPROP_XSIZE,260); ObjectSet("HEADER",OBJPROP_YSIZE,30); ObjectSet("HEADER",OBJPROP_BORDER_TYPE,BORDER_FLAT); ObjectSet("HEADER",OBJPROP_COLOR,clrWhite); ObjectSet("HEADER",OBJPROP_BGCOLOR,clrBlack); //Main Panel ObjectCreate("MAIN",OBJ_RECTANGLE_LABEL,0,0,0); ObjectSet("MAIN",OBJPROP_CORNER,Corner); ObjectSet("MAIN",OBJPROP_XDISTANCE,xDistance); ObjectSet("MAIN",OBJPROP_YDISTANCE,yDistMain); ObjectSet("MAIN",OBJPROP_XSIZE,260); ObjectSet("MAIN",OBJPROP_YSIZE,600); ObjectSet("MAIN",OBJPROP_BORDER_TYPE,BORDER_FLAT); ObjectSet("MAIN",OBJPROP_COLOR,clrWhite); ObjectSet("MAIN",OBJPROP_BGCOLOR,clrMidnightBlue); } //+------------------------------------------------------------------+
Why not use an app-dialog window which you can move around and minimize?
#property strict #include <Controls\Dialog.mqh> CAppDialog gui; void OnTick(){} int OnInit() { if(!gui.Create(0, "GUI", 0, 10, 10, 310, 310)) return INIT_FAILED; return INIT_SUCCEEDED; } void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { gui.ChartEvent(id, lparam, dparam, sparam); } void OnDeinit(const int reason) { gui.Destroy(); }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
how can i change position of this?
Now i want to say this objects on upper left side or upper right side. Can we do this or did i have to change all x and y distance positions?