Hello. I'm trying to write a condition, but I'm doing something wrong. Please help me figure it out.
When the price crosses the indicator line from bottom to top, I open a buy position.
I am trying to prescribe a condition for the same bar:
If the close price of the current candle is higher than the indicator line and the Bid price on any of the subsequent bars is higher than the indicator line - ...condition 1
How to do it correctly?
if (m_position.Select(_Symbol)) //проверка на наличие позиции
{
Print ("Позиция открыта");
if(m_position.PositionType()==POSITION_TYPE_BUY)
{
Print ("Открыта на покупку");
if (close_1 > Sig_Up[0]) //цена закрытия текущей свечи выше линии индикатора
{
int cl = 4;
if (cl && Bid > Sig_Up[0]) // Bid больше линии индикатора
{
....
}
}
}
}
Don't do anything with the numbering of the bars. I.e. the code from a four with the first bar for a five will also have the first bar without numbering reversal?
and don't do anything with the numbering of the bars. I.e. the code from four with the first bar for five will also be with the first bar without numbering reversal?
From the documentation
shift
[in] The index of the time series value to be obtained (shifted relative to the current bar by the specified number of bars back).
A shift of 0 relative to the current bar will be the current bar. And if it is 1, it will be the previous one.
Hello. I'm trying to write a condition, but I'm doing something wrong. Please help me figure it out.
When the price crosses the indicator line from bottom to top, I open a buy position.
I am trying to prescribe a condition for the same bar:
If the close price of the current candle is higher than the indicator line and the Bid price on any of the subsequent bars is higher than the indicator line - ...condition 1
How to do it correctly?
the terminal has a sample of Moving Average.mq5
If I understand correctly, you need it like this ?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
What the code would look like in Mql5
What the code would look like in Mql5
It looks like this
Screw in the necessary checks yourself.How would the code look like in Mql5
You can also do this
you can do that too:
Hello. I'm trying to write a condition, but I'm doing something wrong. Please help me figure it out.
When the price crosses the indicator line from bottom to top, I open a buy position.
I am trying to prescribe a condition for the same bar:
If the close price of the current candle is higher than the indicator line and the Bid price on any of the subsequent bars is higher than the indicator line - ...condition 1
How to do it correctly?
you can do it that way:
Don't do anything with the numbering of the bars. I.e. the code from a four with the first bar for a five will also have the first bar without numbering reversal?
and don't do anything with the numbering of the bars. I.e. the code from four with the first bar for five will also be with the first bar without numbering reversal?
From the documentation
[in] The index of the time series value to be obtained (shifted relative to the current bar by the specified number of bars back).
A shift of 0 relative to the current bar will be the current bar. And if it is 1, it will be the previous one.
you can do it that way:
Close[shift] has square brackets. failed.
From the documentation
Relative to the current bar, shift 0 and it will be the current bar. And if it is 1, it will be the previous one.
Am I right in understanding that the time series numbering in 5 is the same as in 4?
Close[shift] has square brackets. failed.
It worked, here is code from@fxsaber
you can now write Close[1] > Close[2 ].
Hello. I'm trying to write a condition, but I'm doing something wrong. Please help me figure it out.
When the price crosses the indicator line from bottom to top, I open a buy position.
I am trying to prescribe a condition for the same bar:
If the close price of the current candle is higher than the indicator line and the Bid price on any of the subsequent bars is higher than the indicator line - ...condition 1
How to do it correctly?
the terminal has a sample of Moving Average.mq5
If I understand correctly, you need it like this ?