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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Good day !!!
Please help in writing code for closing min and max orders in a grid EA when a certain level of drawdown is reached
I wrote two functions to calculate the profit of max and min orders
I have also written a function calculating the amount of these orders. There seems to be no problem here.
The question is how to close only these two orders I have found the ClosseAll() function.
The question is how to change the OrderTicket() function which closes all orders
to attach variables max_ticket and min_ticket which determine tickets of only min and max orders in the grid
Or do YOU have YOUR solution to this issue
and fix it.
Sorry, I'm writing it wrong again. Let me try again)
There is a grid of open orders. I need to find the opening price (OrderOpenPrice) of the order closest to the current price. In order to continue to build the grid, but my orders are almost chaotically built.
I understand how to write the overshoot, but I'm unable to express it correctly in the language (I'm like a dog, I understand everything)).
If you have examples or link to examples, post them, please. MQL4
in a loop:
before loop initialize previous_value=DBL_MAX a nearest_order=0
How is it different, by the way, apart from the fact that it is called implicitly when the object is created?
and plus when you call it in the constructor no memory is allocated yet, it doesn't compile:
but in the constructor body, no problem:
about base class constructors - they can be called explicitly:
Fix that, too.
About the slippage I already have at the beginning of the advisor
and fix that.
fix this
Only maximal orders are closed according to the closing results
in the loop:
initialise previous_value=DBL_MAX a nearest_order=0 before the loop
and correct this
and fix that.
For errors in the log
About the slippage I already have at the beginning of the EA
This slippage is exactly for this function...so you don't have to go through BUY or SELL
This slippage is just for this function...so you don't have to go through BUY or SELL
You don't need to multiply by a point here
possible loss of data due to type conversion NEVALASHKA.mq4 376 13
I get a warning at compile time
There is no need to multiply by a point
possible loss of data due to type conversion NEVALASHKA.mq4 376 13
I get a warning at compile time
Do not multiply MODE_SPREAD - Spread in pips
you can check
and make like this