This for MT5 but it contains an example of editable edits and a button.
//+------------------------------------------------------------------+ //| muhChart.mq5 | //+------------------------------------------------------------------+ #property copyright "Copyright 2017, МегаКурец Software Corp." #include <Canvas\Canvas.mqh> CCanvas muhCanvas; #define X 768 #define Y 512 int Xyu[X], kYp[X]; color muhEditBorderColor=clrDimGray; color muhEditBackgroundColor=clrBlack; color muhEditColorColor=clrSilver; double A1, OMEGA1, PHI1, BETA1, A2, OMEGA2, PHI2, BETA2; int OnInit() { if(ObjectFind(0,"BUTTon")<0) { ObjectCreate(0,"BUTTon",OBJ_BUTTON,0,0,0); ObjectSetInteger(0,"BUTTon",OBJPROP_CORNER,CORNER_RIGHT_UPPER); ObjectSetInteger(0,"BUTTon",OBJPROP_XDISTANCE,64); ObjectSetInteger(0,"BUTTon",OBJPROP_YDISTANCE,24); ObjectSetInteger(0,"BUTTon",OBJPROP_XSIZE,32); ObjectSetInteger(0,"BUTTon",OBJPROP_YSIZE,32); ObjectSetString(0,"BUTTon",OBJPROP_TEXT,"#"); ObjectSetInteger(0,"BUTTon",OBJPROP_FONTSIZE,18); ObjectSetInteger(0,"BUTTon",OBJPROP_COLOR,clrSilver); ObjectSetInteger(0,"BUTTon",OBJPROP_ZORDER,1000); ObjectSetInteger(0,"BUTTon",OBJPROP_STATE,false); } EditElementCreate("muhEditA1","A1",168,24,48,24,muhEditBorderColor,muhEditBackgroundColor,muhEditColorColor); EditElementCreate("muhEditBETA1","β1",168,56,48,24,muhEditBorderColor,muhEditBackgroundColor,muhEditColorColor); EditElementCreate("muhEditOMEGA1","ω1",168,88,48,24,muhEditBorderColor,muhEditBackgroundColor,muhEditColorColor); EditElementCreate("muhEditPHI1","φ1",168,120,48,24,muhEditBorderColor,muhEditBackgroundColor,muhEditColorColor); EditElementCreate("muhEditA2","A2",168,160,48,24,muhEditBorderColor,muhEditBackgroundColor,muhEditColorColor); EditElementCreate("muhEditBETA2","β2",168,192,48,24,muhEditBorderColor,muhEditBackgroundColor,muhEditColorColor); EditElementCreate("muhEditOMEGA2","ω2",168,224,48,24,muhEditBorderColor,muhEditBackgroundColor,muhEditColorColor); EditElementCreate("muhEditPHI2","φ2",168,256,48,24,muhEditBorderColor,muhEditBackgroundColor,muhEditColorColor); muhCanvas.CreateBitmapLabel(0,0,"muhChart",12,24,X,Y,COLOR_FORMAT_XRGB_NOALPHA); muhCanvas.Fill(1,1,clrBlack); muhCanvas.TextOut(24,24,"x=А1*e^(-β1*t)*sin(ω1*t+φ1)+А2*e^(-β2*t)*sin(ω2*t+φ2)",clrSilver,0); muhCanvas.TextOut(24,48,"x - ценичката, t - временцето",clrSilver,0); muhCanvas.TextOut(24,72,"А - началната амплитудка, β - коефициентченцето на затихване",clrSilver,0); muhCanvas.TextOut(24,96,"ω - началната кръгова честотичка, φ - началната фазичка",clrSilver,0); muhCanvas.TextOut(24,120,"е - на Непер чисълцето",clrSilver,0); muhCanvas.Line(0,0,X-1,0,clrDimGray); muhCanvas.Line(0,Y-1,X,Y-1,clrDimGray); muhCanvas.Line(0,0,0,Y-1,clrDimGray); muhCanvas.Line(X-1,0,X-1,Y-1,clrDimGray); muhCanvas.Update(); ChartRedraw(); return(INIT_SUCCEEDED); } void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { if(id==CHARTEVENT_OBJECT_CLICK && sparam=="BUTTon") { muhCanvas.Resize(X,Y); muhCanvas.Fill(1,1,clrBlack); muhCanvas.Line(0,0,X-1,0,clrDimGray); muhCanvas.Line(0,Y-1,X,Y-1,clrDimGray); muhCanvas.Line(0,0,0,Y-1,clrDimGray); muhCanvas.Line(X-1,0,X-1,Y-1,clrDimGray); A1=StringToDouble(ObjectGetString(0,"muhEditA1e",OBJPROP_TEXT)); BETA1=StringToDouble(ObjectGetString(0,"muhEditBETA1e",OBJPROP_TEXT)); OMEGA1=StringToDouble(ObjectGetString(0,"muhEditOMEGA1e",OBJPROP_TEXT)); PHI1=StringToDouble(ObjectGetString(0,"muhEditPHI1e",OBJPROP_TEXT)); A2=StringToDouble(ObjectGetString(0,"muhEditA2e",OBJPROP_TEXT)); BETA2=StringToDouble(ObjectGetString(0,"muhEditBETA2e",OBJPROP_TEXT)); OMEGA2=StringToDouble(ObjectGetString(0,"muhEditOMEGA2e",OBJPROP_TEXT)); PHI2=StringToDouble(ObjectGetString(0,"muhEditPHI2e",OBJPROP_TEXT)); for(int i=0; i<X; i++) { Xyu[i]=i; kYp[i]=256-(A1*pow(M_E,-1*BETA1*i)*sin(sqrt(pow(OMEGA1,2)-pow(BETA1,2))*i+PHI1)+A2*pow(M_E,-1*BETA2*i)*sin(sqrt(pow(OMEGA2,2)-pow(BETA2,2))*i+PHI2)); } muhCanvas.Polyline(Xyu,kYp,clrSilver); muhCanvas.Update(); ObjectSetInteger(0,"BUTTon",OBJPROP_STATE,false); } ChartRedraw(); } void OnDeinit(const int reason) { muhCanvas.Destroy(); ObjectsDeleteAll(0,"muhEdit"); ObjectDelete(0,"BUTTon"); } bool EditElementCreate(string име, string величина, int отстояниеХ, int отстояниеУ, int дължина, int височина, color цвятГраница, color цвятФон, color цвятЦвят) { if(ObjectFind(0,име+"d")<0) { if(!ObjectCreate(0,име+"d",OBJ_EDIT,0,0,0)) return(false); else { ObjectSetInteger(0,име+"d",OBJPROP_CORNER,CORNER_RIGHT_UPPER); ObjectSetInteger(0,име+"d",OBJPROP_XDISTANCE,отстояниеХ); ObjectSetInteger(0,име+"d",OBJPROP_YDISTANCE,отстояниеУ); ObjectSetInteger(0,име+"d",OBJPROP_XSIZE,дължина); ObjectSetInteger(0,име+"d",OBJPROP_YSIZE,височина); ObjectSetInteger(0,име+"d",OBJPROP_BORDER_COLOR,цвятГраница); ObjectSetInteger(0,име+"d",OBJPROP_BGCOLOR,цвятФон); ObjectSetInteger(0,име+"d",OBJPROP_COLOR,цвятЦвят); ObjectSetInteger(0,име+"d",OBJPROP_FONTSIZE,12); ObjectSetString(0,име+"d",OBJPROP_TEXT,величина); ObjectSetInteger(0,име+"d",OBJPROP_ALIGN,ALIGN_CENTER); ObjectSetInteger(0,име+"d",OBJPROP_READONLY,true); ObjectSetInteger(0,име+"d",OBJPROP_SELECTABLE,false); } } if(ObjectFind(0,име+"e")<0) { if(!ObjectCreate(0,име+"e",OBJ_EDIT,0,0,0)) return(false); else { ObjectSetInteger(0,име+"e",OBJPROP_CORNER,CORNER_RIGHT_UPPER); ObjectSetInteger(0,име+"e",OBJPROP_XDISTANCE,отстояниеХ-дължина-4); ObjectSetInteger(0,име+"e",OBJPROP_YDISTANCE,отстояниеУ); ObjectSetInteger(0,име+"e",OBJPROP_XSIZE,дължина); ObjectSetInteger(0,име+"e",OBJPROP_YSIZE,височина); ObjectSetInteger(0,име+"e",OBJPROP_BORDER_COLOR,цвятГраница); ObjectSetInteger(0,име+"e",OBJPROP_BGCOLOR,цвятФон); ObjectSetInteger(0,име+"e",OBJPROP_COLOR,цвятЦвят); ObjectSetInteger(0,име+"e",OBJPROP_FONTSIZE,12); ObjectSetString(0,име+"e",OBJPROP_TEXT,""); ObjectSetInteger(0,име+"e",OBJPROP_ALIGN,ALIGN_CENTER); ObjectSetInteger(0,име+"e",OBJPROP_READONLY,false); ObjectSetInteger(0,име+"e",OBJPROP_SELECTABLE,false); } } return(true); } //+------------------------------------------------------------------+
It can draw sinusoids in case you wonder what it does.
kypa:
This for MT5 but it contains an example of editable edits and a button.
It can draw sinusoids in case you wonder what it does.
Hi Kypa,
Thank you very much for your suggestions. I will try to implement it in MT4.
Best Regards,
Naren
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
Hello,
I want to create an Input box in the chart.
For example I need a Label called Lot size and an Input Box wherein I key in the Lot size.
Also I should be able to retrieve this Lot size Value and use this in Placing an order.
Now I need a input box in the chart to define my Lot size.
Could anyone able to help me on this.
Many Thanks in Advance.
Best Regards,
Naren