Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1107
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
you cannot execute something long in OnInit - the terminal may unload the code
in the indicator must not run slip
Yeah, I'm dumb... Maybe, instead of an infinite loop in OnInit, return from OnCalculate with the same condition? - there should be a definite number when there is no login, either -1, or 0, or EMPTY_VALUE
Greetings traders and programmers!
Could you please tell me if it is possible to use a non-standard method to calculate the period for the MA(Moving Average) ? I mean the position of the MA on the current (zero) bar will not be determined by the last 20 (for example) bars, but by every 5m of the last 100, or just by specifying the numbers of bars in the history, starting from the current one. And, if there is such a possibility, is it possible to specify the function directly in the indicator code?
Thanks for the information.
Hello. How do I display the triangle symbol down and up?
Here is the code
bool OutText(const string name="Label",
const string text="Label", // text
const int x=0, // X coordinate
const int y=0, // coordinate along the Y axis
const color clr=clrYellow, // colour
const ENUM_ANCHOR_POINT anchor=ANCHOR_LEFT_UPPER, // anchor method
const ENUM_BASE_CORNER corner=CORNER_LEFT_UPPER, // chart corner for anchor
const int font_size=12, // font size
const string font="Arial", // font
const double angle=0.0, // text slope
const bool back=false, // back
const bool selection=false, //select for moving
const bool hidden=true, // hidden in the list of objects
const long z_order=0,
const int sub_window=0, // number of subwindow
const long chart_ID=0 // chart ID
) // click priority
{
//--- reset the error value
ResetLastError();
//--- create a text mark
if(ObjectFind(chart_ID,name)==-1)
{
if(!ObjectCreate(chart_ID,name,OBJ_LABEL,sub_window,0,0))
{
Print(__FUNCTION__, ": failed to create text label! Error code = ",GetLastError());
// return(false);
}
}
//--- set marker coordinates
ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
//--- set the chart angle, relative to which the point coordinates will be determined
ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
//--- set the text
ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
//--- set text font
ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
//--- set font size
ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
//--- set angle of slope of the text
ObjectSetDouble(chart_ID,name,OBJPROP_ANGLE,angle);
//--- set anchoring method
ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set colour
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- display in the foreground (false) or background (true)
ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- switch on (true) or switch off (false) the mode of moving the mark with the mouse
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) the graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the event of the mouse click receipt priority
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
How do I get the triangle symbol up?
What should be written
OutText("LabelBuy1", ">", 100, 20, clrWhite, ANCHOR_UPPER,CORNER_LEFT_UPPER,14, "Arial");
To make a triangle up?
Earlier I asked a question how to simulate Print() function from library side to check data coming into library functions and to search for errors, I was advised to use C++ resources: i.e. to write information into file from library dll side. In general the library can not create a file to write the information there, the file is created neither in the directory project, nor in the folder with the robot, tried to specify the default path does not work, outputting information via cout also does not work, but probably can not because it's not quite a console application. Who can advise?
How do I replace the standard picture in the description with ...
... can I put my own?
How do I replace the standard picture in the description with ...
... can I put my own?
#property icon
How simple it is... Thank you!
Hello!
Could you please tell me how to implement the detection of manually drawn graphical objects on a chart (horizontal or trend line, for example) and then retrieve their properties (price level at the right time)?
Hello!
Could you please tell me how to implement the detection of manually drawn graphical objects on a chart (horizontal or trend line, for example) and then retrieve their properties (price level at the right time)?
Hello!
Could you please tell me how to implement the detection of manually drawn graphical objects on a chart (horizontal or trend line, for example) and then retrieve their properties (price level at the right time)?
They have a standardized prefix, e.g.: Trenler number. You can search as follows: in the loop if(StringFind(ObjectName(0,i), "Trendline")==0) for old ones or for new ones if(StringFind(sparam, "Trendline")==0))