Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 27

 
Vitalie Postolache:

What do you mean by separate? You don't need to separate anything, you need to write two loops, basically the same, only in one - OrderClose(), and in the other - the counter of orders. The order selection criterion is the same. If the counter is=0, all orders have been closed and we can play music.

I also noticed that there is a condition

вроде как не относится к какому-то конкретному ордеру, зачем оно в цикле?  


This is what this mess is all about.

Floating closing of all orders on the current symbol when returning to the average

If the counter is=0, there were no orders from the beginning and they have to be bound to the last closed one.

if it is like this with 2 blocks, then it does not fulfill its functions

Files:
 
trader781:

This is what this mess is all about.

Floating closing of all orders on the current symbol when returning to the average

If the counter = 0, then initially there were no orders and they have to be bound to the last closed one.

if it is like this with 2 blocks, then it does not fulfill its functions

Well, first we check if the price has returned to the average price and then we close it. Why check the same condition over and over on each iteration?

Look through the kodobase, there are plenty of examples, why are you always going over the edge?

 
Vitalie Postolache:

Well, first check whether the price has returned to the average and then close. Why check again and again on each iteration, the same condition?

Look through kodobase, there are plenty of examples, why are you always going over the edge?

1) because at 0 bar the iMA value will be jumping constantly, while I count on zero bar every tick (the current version suits me, it's too early to complicate it)

2) If you look in the base you may get a ready and working one, but I'm here to find out what's wrong with me

3) I just want something that is written to work as originally conceived. If you can see HOW to fix it, please let me know. If not, I will keep looking until they explain why it does not work as intended.

 
trader781:

1) because at 0 bar the iMA value will be constantly jumping, while I count on a zero bar every tick (the current version suits me, it's too early to complicate it)

2) If you look in the base you may get a ready and working one, but I'm here to find out what's wrong with me

3) I just want something that is written to work as originally conceived. If you can see HOW to fix it, please let me know. If not - I will keep looking until you explain why it does not work as intended.

How do you want it to work? Can you just say: I want so-and-so, so-and-so, so-and-so...

Otherwise, there are strange empty loops, counters and so on. Just put it in words - maybe your logic was not initially designed correctly and you're building crutches to it...

 
Artyom Trishkin:

What is the intention? Can you just say in words: I want so-and-so, so-and-so, so-and-so...

Otherwise loops are incomprehensible empty, counters, etc. Just tell me in words - maybe your logic is not created correctly from the beginning, and you're crutches to it...

Quite likely.

In general, the planned logic

The Expert Advisor will be attached to the chart and stay there. There will be about a dozen of charts.

It does not work until the tick counter finishes and checks the conditions of trade permission + the number of bars

Each tick is checked for the condition. The current variant is approaching to the MA at distance X

If the price gets within the range of iMA+-X, the Orderclose is triggered

if there are several orders, the orderclose is executed and removed from the current chart and an acoustic signal is given before it; orders on other charts are not considered

an option of default resetting all settings after the last order triggers instead of deleting the EA is under consideration.

The following things you should understand

1) How to close all orders at the current symbol at once if the condition coincides, at best they will close 1 per tick

2) dummy=true when the last order closes and the music goes.

 

Now there is a need to optimise the whole thing

 
Good afternoon.
 

Good afternoon.

I'm not sure if this is the right place to ask this question, but I haven't found anywhere else to get an answer.

Is it possible to implement sending and storing screenshots after editing in the Snagit graphical editor?

And if so, how can this be done?

Sorry if this is off topic.

Thank you!

Sincerely. Igor S.

 

Please, advise, is there a ready-made (built-in) function that allows to get the parameters (OHLC) of M1 price bar of a certain instrument, if its opening time is known?

I couldn't find it in the reference book (probably, I didn't look hard enough).

 
Babu Bonappan:

Please, advise, is there a ready-made (built-in) function that allows to get the parameters (OHLC) of M1 price bar of a certain instrument, if its opening time is known?

I couldn't find it in the reference book (probably, I didn't look hard enough).

CopyRates().
Reason: