[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 138

 

Given:

2 intersecting lines on the graph from time to time. (Let them be simple MAs with different periods). The point of intersection itself is not difficult to detect in the real time. But how to detect past crossovers and consider them...

The question:

How do I determine the time and bar when they intersect? (there are many intersections, and the condition requires investigating at least 5 intersections before the last one)

How and where to record information about these intersections? (I understand to use an array, but I don't know how)

Objective:

I want to search for specific bars between intersections. For example the condition: Between the 2nd and 3rd backward MA crossing there should be a bar that is not breached by at least 4 subsequent bars. And between the 2nd and 1st crossing some other condition. If the 1st and 2nd condition is met we set the order, if not we wait.

I hope the question is clear.

 
ivandread:

Given:

2 intersecting lines on the graph from time to time. (Let them be simple MAs with different periods). The point of intersection itself is not difficult to detect in the real time. But how to detect past crossovers and consider them...

The question:

How do I determine the time and bar when they intersect? (there are a lot of intersections, and the condition requires investigating at least 5 intersections before the last one)

How and where to record information about these intersections? (I understand to use an array, but I don't know how)

Objective:

I want to search for specific bars between intersections. For example the condition: Between the 2nd and 3rd backward MA crossing there should be a bar that is not breached by at least 4 subsequent bars. And between the 2nd and 1st crossing some other condition. If the 1st and 2nd condition is met we set the order, if not we wait.

I hope this question is clear.

Pattern_v_1_01.mq4

This indicator searches for certain bar patterns and sets a fractal.

 
Lisi4ka330:
I tried it differently, see if you like it...

You're beautiful and you did it perfectly ! Everything is working as it should.
 
alex12:

I can't get the EA to open 2 buy orders above and below price at once with Pending Orders.

It only opens bystop.

Please give me the correct code to make my EA open 2 buy pending orders simultaneously bypass and bylimit.

More than one order is opened only in the tester; on demo and real account more than one opens after some time, if the conditions have not changed, especially if the pending orders are placed close to the price. The market is always on the move. We should place one by one and set conditions for each of them separately.

And the condition is if there is no order and when one is set, there is already an order. That is why the second one will not open. We should not set the SL and TP. We do not need them yet and you will burden the broker with unnecessary work. You will do it later, if you need it.

 

Good afternoon. Question regarding the accuracy of the calculation of mat operations in the indicator and the Expert Advisor.

If the same numbers are divided by each other, then for some reason they will be different in the indicator and in the Expert Advisor (in one case it will be 0, and in the other one 1). I have the feeling that the Expert Advisor starts rounding them much earlier than the final result. Please advise how to remove this nuance and make the EA roundoff only at the very end.

 

dzhini:

If the same numbers are divided by each other, they will be different in the indicator and in the Expert Advisor for some reason (in one case it will be 0, and in the other it will be 1). It feels like the Expert Advisor starts rounding them much earlier

It feels like you are dividing integers.
 
sergeev:
it feels like you're dividing whole numbers.

No, I did. Also, a small error in the calculations starts to pop up with fractional values of indicators as well, and only in places where division is used. From which I can surmise that there may be problems with rounding.... Or is it just me speculating...?
 
dzhini:
Or is it just me speculating...?

100%

nothing just happens. look for integer variables if you don't use rounding/normalisation functions

 
sergeev:

100%

nothing just happens. look for integer variables if you don't use rounding/normalisation functions


Then how do you explain the fact that at the same point in time the values of the indicator and the EA are different? The Expert Advisor is still used as a calculating machine, so it is possible to compare the result of their work. Are there any peculiarities in the mathematical calculations of the EA and indicators?
 
dzhini:

Then how do you explain that at the same point in time the values of the indicator and the EA are different?

it means that you are counting differently.

Do Comment or Print and see at what point in the formula there is a discrepancy

Are there any differences in the mathematical calculations of the Expert Advisor and indicators?

No.