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

 
ANDREY:

Could you please tell me how to save a 5 digit value of blue in the yellow variable, if the test is done on a minute chart?

Thank you

What is Lou equal to?

if (Bid - iLow( NULL ,PERIOD_H4,1)>=0.0030||Bid - iLow( NULL ,PERIOD_H1,1)>=0.0030||Bid - iLow( NULL ,PERIOD_M30,1)>=0.0030)

this expression only returns "true" or "false"

 
MakarFX:

What does Lou equal?

this expression only returns "true" or "false"

And after opening an order, how do we know which of the 3 if expressions is true?
Thank you

 
ANDREY:

And after opening an order, how do I know which expression of 3 from if is true?
Thanks

In this interpretation you can't...you have to split

if (Bid - iLow( NULL ,PERIOD_H4,1)>=0.0030)
if (Bid - iLow( NULL ,PERIOD_H1,1)>=0.0030)
if (Bid - iLow( NULL ,PERIOD_M30,1)>=0.0030)

I can't see the point...
 
MakarFX:

Not with this interpretation...we have to split

I don't understand the point...

I have a one-minute chart and an order has been opened using one of the expressions in the condition. How do I understand by which expression the order is opened? For example, if it is according to the first expression, then I, for example, place a buy pending order with one of its parameters; if it is according to the second expression, then I place a buy pending order with different parameters; if it is according to the third expression, then I place a sell pending order.

 
ANDREY:

I have a one-minute chart and one of the expressions in the condition opened an order. How do I know by which expression it is opened? If I use the first expression, then I, for example, place a buy pending order with one of its parameters; if I use the second expression, then I place a buy pending order with different parameters; if I use the third expression, then I place a sell pending order.

1) Every 4 hours, all three conditions will be met (when a new low appears).

2) If you see the point, divide

if (Bid - iLow( NULL ,PERIOD_H4,1)>=0.0030)
.....
else
if (Bid - iLow( NULL ,PERIOD_H1,1)>=0.0030)
.....
else
if (Bid - iLow( NULL ,PERIOD_M30,1)>=0.0030)
.....
 
MakarFX:

Catch

There's a lot to learn in the approach to code writing. Special thanks for that. Only you still have horizontal binding of text object by time to the last bar (DoTime = TimeCurrent()+(Period()*60*7). As a result, we have the effect of text shift, when the chart is shifted (screenshots). I just want to avoid it and anchor the X axis to the right border of the screen, say, 20 pixels. I.e. I want this distance to remain unchanged, both when moving the line up/down and when shifting the chart. So far, it hasn't worked. Actually all that's needed is a line of code specifying the position of the text. The rest I understand.

 
Oleksandr Nozemtsev:

There is a lot to learn in the approach to code writing. Special thanks for that. Only you have horizontal binding of text object by time to the last bar (DoTime = TimeCurrent()+(Period()*60*7). As a result, we have the effect of text shift, when the chart is shifted (screenshots). I just want to avoid it and anchor the X axis to the right edge of the screen, say, 20 pixels. I.e. I want this distance to remain unchanged, both when moving the line up/down and when shifting the chart. So far, it hasn't worked. Actually all that's needed is a line of code specifying the position of the text. The rest I understand.

Note the conversion of time and price to XY coordinates in pixels

bool  ChartTimePriceToXY(
   long           chart_id,     // идентификатор графика
   int            sub_window,   // номер подокна
   datetime       time,         // время на графике
   double         price,        // цена на графике
   int&           x,            // координата X для времени на графике
   int&           y             // координата Y для цены на графике
   );

Read the line price, convert it to pixels and assign coordinatesto the Text Label object on the Y axis, and the X axis coordinate remains unchanged.

 
MakarFX:

1) Every 4 hours you will have all three conditions fulfilled (when a new lowe appears)

2) if you see the point, divide

Thanks for the tip.

If you don't split the expressions, but put them in one if()operator with || , thenonly 1 condition will be executed - the first from left to right, which will be true.... if I'm not mistaken.

But as I understand it, with this format it would be impossible for the program to know which particular expression was true.
 
Oleksandr Nozemtsev:
Greetings! Please advise how to bind a text to a line in mql4, so that when the line is moved, the text is also moved,

Line And Text Indicator Ver 1

The indicator moves the text following the line. Insert the name of the line in the input parameter.

 
Alexey Viktorov:

Note the translation of time and price to XY coordinates in pixels

Exactly!