Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1481

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
Thank you for the valuable information.
Please advise, how to store in a variable which expression happens to be true? To be more precise - what is the minimum calculated in the function with respect to a candle of what timeframe? How to save the identifier of this timeframe in a variable?
Thank you
Just declare bool variables
Just declare bool variables
Thank you for the useful information.
Could you please tell me how to save a 5 digit value in yellow variable if the test is done on a minute chart
Thank you.
Good afternoon! Can you tell me how to bind text to a line in mql4, so that when the latter is moved, the inscription is also shifted, like in the screenshots. I know that there are two ways to bind an object : in pixels to the corner of the screen and in time/price coordinates. In the first case, I get a static text, and in the second case, it's not quite what I want. With the price coordinate (vertical binding) is clear - I take the line price and add a _Point pair to it, so the text would be a bit higher than the line. But what about time? I do not want to bind to the last bar because different shift of the chart will pull the text to the right - to the left. Here I would like to make a rigid horizontal binding to the right edge of the screen, but I do not understand how.
Do you draw the lines yourself or the indicator?
The line is created by the indicator when it is loaded. The text is needed to show information about this level directly above the line, rather than displaying it in Alert (Alert works).
The line is created by the indicator when it is loaded. Text is needed to show information about this level directly above the line, rather than displaying it in Alert (Alert works).
Post the line creation code
int OnInit()
{
//Create line "name_line" if it does not exist yet
if(ObjectFind(0, name_line) == -1)
{
//If price is not specified, set it to the current Ask price
if(!price_line)
price_line = SymbolInfoDouble(Symbol(), SYMBOL_ASK);
//reset error value
ResetLastError();
//create a line
if(!ObjectCreate(0, name_line, OBJ_HLINE, 0, 0, price_line))
Print("Line Line. Error ", GetLastError());
//
ObjectSet(name_line, OBJPROP_COLOR, color_line); //Line colour
ObjectSet(name_line, OBJPROP_STYLE, style_line); //Line style
ObjectSet(name_line, OBJPROP_WIDTH, width_line); //line thickness
ObjectSet(name_line, OBJPROP_BACK, back_line); //Front/back
ObjectSet(name_line, OBJPROP_SELECTABLE, selection_line);//The object can be clicked with the mouse.
ObjectSet(name_line, OBJPROP_SELECTED, selection_line); //The object is selected. O is not selected at creation
}
return(INIT_SUCCEEDED);
}
Catch
Catch
Wow, that's a lot! I thought it was just a couple of lines of code. Thank you! (laughs)
Just declare bool variables
Could you please also tell me how to save a 5 digit blue value in a yellow variable if the test takes place on a 1 minute chart
Thank you