[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 375

 
Egregor:
Good day! Can somebody of the programming wizards please advise how to check opening of orders by the colour of a bar in the code of an EA? For example, a red bar is sell, and a green bar is buy. It is necessary to confirm market entry along with other signals.

the colour of the bar is simply finding the price of the Klose relative to the price of the Open bar .

If Klose is above the Open, the candlestick is bullish, colour one

If Klose is below Open, the candlestick is bearish, colour two

For the analysis, use this way to poll the array

if (Close[1]>Open[1]) //

if (Close[1]<Open[1]) //

 

I have a question about arrays.

Given 2 two-dimensional arrays - mas1[i, 0]=Close[i];

mas1[i, 1]=i;

и

mas2[i, 0]=Open[i];

mas2[i, 1]=i;

How do I make a third array out of these two -

- mas3[i, 0] = |Close[i] - Open[i]|;

mas3[i, 0] = i;

I can't get anything to work for some reason... Help who knows arrays!

 
ruslanchik:
Sorry, I'm a little slow.


Have you tried looking at the documentation?

Usually helps.

 
-xlapex-:

I have a question about arrays.

Given 2 two-dimensional arrays - mas1[i, 0]=Close[i];

mas1[i, 1]=i;

и

mas2[i, 0]=Open[i];

mas2[i, 1]=i;

How to make a third array of these two -

- mas3[i, 0] = |Close[i] - Open[i]|;

mas3[i, 0] = i;

I can't get anything to work for some reason... Help who knows arrays!


see the function here https://docs.mql4.com/ru/math/MathAbs

Judging by your questions - you're interested in MQL4 syntax and what's in the language, you haven't tried to read the documentation - https://docs.mql4.com/ru/

 
Vinin:


Have you tried looking at the documentation?

Usually helps.

You mean the Sergei Kovalev S.K. Help? ???
 
ruslanchik:
you mean the sergei kovalev s.k. Help? ???

No, I mean the documentation.
 
Vinin:

No, I mean the documentation.

How can a standard reference help with a non-standard question?

I don't understand why you're trying to dissuade me from asking stupid (irrelevant) questions.

 
ruslanchik:

how can a standard reference help with a non-standard question?

I do not understand you dissuade me from asking stupid (irrelevant) questions why do you need it (branch)


The standard help helps with non-standard questions (they just don't appear anymore)
 
sergeev:

the colour of the bar is simply finding the price of the Klose relative to the price of the Open bar .

If Klose is above the Open, the candlestick is bullish, colour one

If Klose is below Open, the candlestick is bearish, colour two

For the analysis, use this way to poll the array


Thank you!
 
abolk:


see the function here https://docs.mql4.com/ru/math/MathAbs

Here I have applied the MathAbs function, Alert shows zero and zero, but I would like the difference module and bar index...

int start()
{
int mas1[30,2],mas2[30,2],mas3[30,2],ind_1;
{
for (int i=1;i<=count_bars;i++)
{
mas1[i, 0]=Close[i];
mas1[i, 1]=i;
mas2[i, 0]=Open[ i];
mas2[i, 1]=i;

mas3[i, 0] = MathAbs(Close[ i]-Open[ i]);
mas3[i, 1] = i;

ArraySort( mas3);
mod_1=mas3[2, 0];
ind_1=mas3[2, 1];

Alert( mod_1," ",ind_1);
}
}

return(0);
}