[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1033

 
Got it))) Off to read! ))))
 
fergios:
I'm not throwing away my code, I'm taking some downloaded one! Which also doesn't work!

Here's a working one, checked it out.

In some dtCs we first open a trade only afterwards modification (setting of stops and takeaways).

 
costy_:

Here's a working one, checked it out.

In some dc's, you open a trade first, only then modify it (set stop trails).


I forgot to add the library

 
fergios: Well I won't throw away my code, I'll take some downloaded one! Which also doesn't work!
but... this one (slightly modified) is used in the Ttauso Championship - although it only takes 5th place... but that's because of the lack of modification of lots...
 
Vinin:


The library forgot to add

Oops, without it.
Files:
botp1ma.mq4  8 kb
 
Anyway thanks guys, if I couldn't figure out that it was working, you should read it doubly)
 
and ObjectsTotal() are the objects of all graphs or the current graph?
 
eddy:
and ObjectsTotal() are objects of all charts or the current one?

Current.

ObjectsTotal Returns the total number of objects of the specified type on the chart.

Check out https://book.mql4.com/ru/functions/objects https://docs.mql4.com/ru/objects/ObjectsTotal

The mcool4 language is bound to one window, the current one.

 
Roman.:


This loop serves to hold order modification ffs (if the order modification in the real market failed at first try (it happens) and the possible error is not critical: e.g., 136 - no price - wait for a new tick), i.e., this loop holds control until the previously selected order is modified or a critical error is received - all this may happen within several ticks or even seconds (tens of seconds).i.e., if a trade criterion to open an order has triggered at this time, the order will not open as the control is held by the function of modification of all selected orders until it finishes, after which, if the condition of opening the next order in the Expert Advisor is still active, the next order will try to be opened on the next tick - this is just an example... "If the trade operation is successful, then the break operator in block 6-7 terminates execution of the while loop that causes termination of the current iteration of the for loop (and the next iteration starts processing the next order) - all this time the function holds control until the last order to be modified is executed. If the trade operation is unsuccessful, errors are handled. If the error is not critical, the attempt to repeat the trading operation is repeated. If the error is estimated as critical, control is transferred outside the modification loop for processing the next order (in the for loop), after which other Expert Advisor functions are executed.

I think I've explained it in a bit of a sloppy way, but it's understandable. :-)))


Thanks, that clarifies what is going on there.
 
costy_:

In scripts and Expert Advisors, it is possible to keep the loop unfinished for a long time without fear of slowing down the interface.

I.e. in indicator while (true) will hang, because Sleep doesn't work.

Look at the script below to see more clearly


Thank you!