Hi, it's not easy. To start, add a text input object. Then you need to track the text input event in the function "OnChartEvent". Then change the input variable and restart the indicator.
You'll have to deal with it if you want to do it.
The function creates an object if it doesn't already exist.
//redraw the rectangle using the new coordinates. if it doesn't exist, then create it void RedrawEdit(long eChartId, int eWindow, string eName, long eXdistance, long eYdistance, long eXsize, long eYsize, ENUM_BASE_CORNER eCorner, ENUM_ALIGN_MODE eAlign, bool eReadOnly, string eText, string eFont, int eSize, color eColor, color eColorBG, color eColorBR) { if(ObjectFind(eChartId,eName)==-1) { if(!ObjectCreate(eChartId,eName,OBJ_EDIT,eWindow,0,0)) return; //angle of the graph, relative to which the coordinates of the point will be determined ObjectSetInteger(eChartId,eName,OBJPROP_CORNER,eCorner); //text font ObjectSetString(eChartId,eName,OBJPROP_FONT,eFont); //font size ObjectSetInteger(eChartId,eName,OBJPROP_FONTSIZE,eSize); //how to align text in an object ObjectSetInteger(eChartId,eName,OBJPROP_ALIGN,eAlign); //read-only mode ObjectSetInteger(eChartId,eName,OBJPROP_READONLY,eReadOnly); //in the foreground ObjectSetInteger(eChartId,eName,OBJPROP_BACK,false); ObjectSetInteger(eChartId,eName,OBJPROP_SELECTABLE,false); ObjectSetInteger(eChartId,eName,OBJPROP_SELECTED,false); ObjectSetInteger(eChartId,eName,OBJPROP_HIDDEN,true); ObjectSetInteger(eChartId,eName,OBJPROP_ZORDER,0); } if(ObjectFind(eChartId,eName)==-1) return; //coordinate system if(ObjectGetInteger(eChartId,eName,OBJPROP_XDISTANCE)!=eXdistance) ObjectSetInteger(eChartId,eName,OBJPROP_XDISTANCE,eXdistance); if(ObjectGetInteger(eChartId,eName,OBJPROP_YDISTANCE)!=eYdistance) ObjectSetInteger(eChartId,eName,OBJPROP_YDISTANCE,eYdistance); //dimensions if(ObjectGetInteger(eChartId,eName,OBJPROP_XSIZE)!=eXsize) ObjectSetInteger(eChartId,eName,OBJPROP_XSIZE,eXsize); if(ObjectGetInteger(eChartId,eName,OBJPROP_YSIZE)!=eYsize) ObjectSetInteger(eChartId,eName,OBJPROP_YSIZE,eYsize); //background color if(ObjectGetInteger(eChartId,eName,OBJPROP_BGCOLOR)!=eColorBG) ObjectSetInteger(eChartId,eName,OBJPROP_BGCOLOR,eColorBG); //frame color if(ObjectGetInteger(eChartId,eName,OBJPROP_BORDER_COLOR)!=eColorBR) ObjectSetInteger(eChartId,eName,OBJPROP_BORDER_COLOR,eColorBR); //text color if(ObjectGetInteger(eChartId,eName,OBJPROP_COLOR)!=eColor) ObjectSetInteger(eChartId,eName,OBJPROP_COLOR,eColor); //установим текст if(ObjectGetString(eChartId,eName,OBJPROP_TEXT)!=eText) ObjectSetString(eChartId,eName,OBJPROP_TEXT,eText); }
Call the function something like this
RedrawEdit(ChartID(),0,"InputName",359,1,55,18,CORNER_RIGHT_UPPER,ALIGN_RIGHT,false,IntegerToString(InputValue),"Arial",9,C'0x2E,0x2F,0x2E',C'0xF5,0xF5,0xF5',C'0x98,0xA6,0xB4');
1587
thanks for you...
i thought that adding a simple things("OnChartEvent") to the chart is an easy task..
i will tray to deal with it..
as you said (You'll have to deal with it if you want to do it.)
..thank again
abd-:
as you said (You'll have to deal with it if you want to do it.)
I wanted to say that this needs to be studied
Events are tracked in this function
void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam) { //text input event if(id==CHARTEVENT_OBJECT_ENDEDIT) { if(sparam=="InputName")) { //------------------- //Here you can change the parameter and restart the indicator //------------------- } } }
abd-:
am not very good in english..
me too
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 to all
how can we modify variable of an indicator directly on the chart instead of opining the indicator and modify the variable and then click ok....this will save time and at the same time let me learn new feature in mql4
because am not a mql programmer i need some help to add a code to the attached indicator that will make it as in the attached pic(this pic is made using windows paint program not a ready made ind..^_^)
iv searched the forum and found topics ...but it's deal with EA and scripts ..not indicators
any help and suggestions are welcomed