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

 
Sepulca:


The easiest option is to use OPENPRICE as "apply to" in the EMA, and gradually sliding down to CLOSEPRICE, try to use other intermediate slightly smoothed PRICE

If I understand you correctly, then in the EMA settings I set the parameters to apply to the price opening? If so, how will the program switch the calculation to the price close? Or do you use two sliders at once?
 
Sepulca:


The easiest option is to use OPENPRICE in the EMA as "apply to" and gradually slide down to CLOSEPRICE to try and use other intermediate slightly smoothed PRICE

Tried everything. The EA still creates false signals when deviating by two or three points within a sideways trend and the program recognizes it as a trend. I need some kind of filter that will cut off the movements of two or three points.
 

Guys, please advise me, I don't understand the language very well.

I have an Expert Advisor that opens trades depending on the volume of the current bar. How to make it close at stop on the same bar, it will not open another position on the same bar. Thank you in advance.

I understand that we should somehow mark the bar at which the order is opened and, when opening a new order, check if the previous order is opened in this bar. In practice, I do not know how to do it easily.

 
oDin48:

Guys, please advise me, I don't understand the language very well.

I have an Expert Advisor that opens trades depending on the volume of the current bar. How to make it close at stop on the same bar, it will not open another position on the same bar. Thank you in advance.

I understand that we should somehow mark the bar at which the order is opened and, when opening a new order, check if the previous order is opened in this bar. In practice, I do not know how to do it easily.

Use iBarShift () to check the bar at which the last order was closed (by a stop). In the time parameters of this function, substitute the time of closing of the position that was closed at stop.
 
Forexman77:

I tried everything. The mashka still creates false signals by deviating two or three points in a sideways direction, and the program recognizes it as a trend. I need some kind of filter that will cut off movements of two or three points.
Use a delta of 2 to 3 pips when checking for a MAC deviation
 
artmedia70:

Good man, could you write 2-3 lines of code (what it would look like approximately). As there are no examples on this subject in the textbook...

 
oDin48:

Good man, could you write 2-3 lines of code (what it would look like approximately). As there are no examples on this subject in the textbook...

Exactly in the textbook you will find, but it's better to read, study first! And then go for the dunks!
 
oDin48:

Good man, could you write 2-3 lines of code (what it would look like approximately). As there are no examples on this topic in the textbook...

Yes, I am kind... sometimes ... Hence the question - are you learning mql4 programming ? Or are you just begging?

Algorithm function:

1. Find the last closed order;

2. Check if it was closed by a stop. (there are several variants, the simplest one is suitable only for a tester);

3. Convert its time of closing to the bar number;

4. Return the number of the bar at which it was closed.


All of the above steps are performed in one loop of the function, which will return the bar number.

Next, from the body of the Expert Advisor, at the time when the next position needs to be opened, you call your function and check if the last closed position was closed on the zero bar. If not, you open the next position.

Start writing the code. What you do not understand - we will give you hints / corrections ... But it is a bearish favour to write it for you ;)

 
borilunad:
Exactly in the textbook you will find, but it's better to read, study first! And then it's off to the ladies!


Duck, I'm trying. =) I built my Expert Advisor in parts from the tutorial and from knowledge of pascal (primitive, but for the first program this is OK). I understand the logic of the program. But with all the nuances I do not understand the first time ...

Thought to save time.

 
artmedia70:

3. Convert its closing time into a bar number;


In essence, the only question is to assign a bar number and write the number to a variable, which can then be compared to the current value.

I will write the rest myself.

Reason: