Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 8

 
gyfto:

From my perspective, I think that Close[] can be passed in the loop from Bars-1 to 0, and you can collect this array in dll and work with it there. I haven't tried it yet, but it's coming.

You don't need to pass the array itself. It is enough to pass a pointer to it and its size.

https://docs.mql4.com/ru/array/ArrayCopySeries

https://docs.mql4.com/ru/array/ArrayCopyRates

 

Guys, please give me a simple condition "if currentprice>open price of bar then execute action". I haven't worked with bars yet. And my brain can't get to 4:49

 
oDin48:

Guys, please give me a simple condition "if current price>open bar price, then execute action". I haven't worked with bars yet. And my brain can't get to 4:49



if(Close[0]>Open[0])
    {
  //Ваше действие
    }
 
Hi all .... how can the following expression be shortened : if(a>b && a>c && a>d)
 

Greetings!

I don't know where to ask better, but I decided not to create a new topic after all. I've tried to find one in CodeBase and there seems to be a lot of similar ones, but since I'm not familiar with mql, I realised I won't be able to allocate the functions I need. Can you advise me, if there is a simple EA that keeps track of already opened orders (and newly opened ones) and if one of them closes (by stop, first of all), a new pending order is created with parameters of a closed one (price, take, stop)?

And one more question. We have the i-SignalOfTrade indicator. Since mobile terminals do not provide sound notifications of events, this indicator can be very useful. But it has some extra functions that cannot be disabled if you trade by yourself - it notifies you about such events as creation and modification of pending orders etc. I.e. notification of actions you already know about. I would be grateful if you could help me to disable them (or maybe there is another similar indicator), I only need to leave notification of pending order triggering, take and stop triggering.

 
i999i:
Hi all, .... how can I abbreviate the following expression : if(a>b && a>c && a>d)

You could write if((b-a)*(c-a)*(d-a)>0), but not necessarily faster. Logical AND is binary multiplication, it's just another notation of the same expression, the only difference is the size of the variable types. a>b is a boolean variable, 4 bytes, while b-a, if they are double, then the difference will be double (8 bytes), and this multiplication is at least 2 times longer.

Zhunko:

You don't need to pass the array itself. It's enough to pass a pointer to it and its size.


Invaluable advice.

gyfto:

a>b is a boolean variable, 4 bytes

Let me explain. You can rewrite your expression as if(((a>b)*(a>c)*(a>d)==1), because expressions in brackets take values 0 or 1 (and they, in turn, are defined in define in precompiler as false and true).
 
gyfto:

You can write if((b-a)*(c-a)*(d-a)>0), but not necessarily faster. Logical AND is binary multiplication, it's just another notation of the same expression, the only difference is the size of the variable types. a>b is a boolean variable, 4 bytes, and b-a, if they are double, then the difference will be double (8 bytes), and this multiplication is at least 2 times longer.


Invaluable advice.


gyfto:

You can write if((b-a)*(c-a)*(d-a)>0), but it's not sure it will work faster. Logical AND is binary multiplication, it's just another notation of the same expression, the only difference is the size of the variable types. a>b is a boolean variable, 4 bytes, and b-a, if they are double, then the difference will be double (8 bytes), and this multiplication is at least 2 times longer.


Invaluable advice.

thanks for the tip .... is there any other way to calculate the smallest and largest value from a,b,c?
 
i999i:

Thanks for the tip .... is there any other way to calculate the smallest and largest values from a,b,c?


MathMax(MathMax(a,b),c) and vice versa MathMin. If four values, then int max = MathMax(MathMax(x1, x2), MathMax(x3, x4)). If values are a carload, form an array via ArrayMaximum as well.
 
gyfto:

MathMax(MathMax(a,b),c) and vice versa MathMin. If four values, then int max = MathMax(MathMax(x1, x2), MathMax(x3, x4)). If you need to form an array through ArrayMaximum as well.
.

you'll have to use ArrayMaximum, there are dozens of values ....a ArrayMaximum will be faster than this - a>b && a>c && a>d
 
i999i:

thanks for the advice .... is there any other way to calculate the smallest and largest values from a,b,c?


First, tell me why you need it. You need to know the reason why. Is it just for fun and interest, or is there some purpose behind it?

Reason: