trader117: Good afternoon. How can I calculate a single Stop Loss for a series of orders with exact magic numbers, so that this series of orders can close at breakeven. For example, there are 3 orders: 1 Buy lot 1.3320 with magic 1, 1 Buy lot 1.3345 with magic 2 and 1 Buy lot 1.3360 with magic 3. How should I calculate the total Stop Loss for all orders so that if there is a move against the price the orders are closed without losing?
What is the reason of averaging the Stop Loss? As soon as one position is closed by a SL, all other positions are immediately closed by Close! No need to lose precious pips!
borilunad: What is the point of averaging StopLoss? As soon as I close one position at SL, the others are immediately closed at Close! No need to lose precious pips!
On the one hand, yes, but on the other hand I see an immediate vulnerability: an order may not be closed by an EA for many reasons, and a Stop Loss will be closed anyway, otherwise this is a serious reason to complain to the broker. + Disconnection will not allow an order to be closed. Anyone else have any ideas to implement this algorithm for the total SL for the order pyramid?
On the one hand yes, but I see an immediate vulnerability in the fact that closing an order by an EA may not be executed for a variety of reasons, and a stop loss will close anyway, otherwise this is already a serious reason for a claim against the broker. + Disconnection will not allow an order to be closed. Who else has ideas to implement this algorithm for common SL for a pyramid of orders?
I'm not saying don't put SL on others! They will close and you will lose even less than the average SL! So, on the Real, you will not close at the same time, but one by one! Therefore, economical to close the rest of Close after closing one position on SL! Yes, and weigh the code uchuchitimo, because SL established repeatedly, and each time to conduct the calculation of the averaging? And every time you add a position, again recalculate and reset the SL, and I repeat, you will only lose on it, not win!
I can't get a handle on it, I don't know what the problem is. The task is as follows: find the bar of a given time on the minutes. If the time has not yet arrived, look for it in yesterday, otherwise look for it in today's day. I have written the following script:
The algorithm there is as follows. We look at the difference between the current time and the given time, and if it is less than zero, we shift a day back. Then we divide the difference by 60 and round upwards, this will be the number of the bar on M1 and look at its time. It does not coincide with the one set in the externs. Where is this algorithmic error?
I can't get a handle on it, I don't know what the problem is. The task is as follows: find the bar of a given time on the minutes. If the time has not yet arrived, look for it in yesterday, otherwise look for it in today's day. I have written the following script:
This is what it outputs:
The algorithm there is as follows. We look at the difference between the current time and the given time, and if it is less than zero, we shift a day back. Then we divide the difference by 60 and round upwards, this will be the number of the bar on M1 and look at its time. It does not coincide with the one set in the externs. Where is this algorithmic error?
Volatility is low at night, there are minutes when not a single trade goes through, so there is no bar. Look at the history to see if all the bars are present.
I can't get a handle on it, I don't know what the problem is. The task is as follows: find the bar of a given time on the minutes. If the time has not yet arrived, look for it in yesterday, otherwise look for it in today's day. I have written the following script:
This is what it outputs:
The algorithm there is as follows. We look at the difference between the current time and the given time, and if it is less than zero, we shift a day back. Then we divide the difference by 60 and round upwards, this will be the number of the bar on M1 and look at its time. It does not coincide with the one set in the externs. Where is this algorithmic error?
Are you practising, or did iBarShift() not like it?
Please give me the number/address of the demo server for MT4 from MetaQuotes. I have just downloaded MT4 from MetaQuotes website and it is on TeleTrade-Demo (Company Teletrade D.J.), but I want to connect to MQ and work on their quotes.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Good afternoon. How can I calculate a single Stop Loss for a series of orders with exact magic numbers, so that this series of orders can close at breakeven. For example, there are 3 orders: 1 Buy lot 1.3320 with magic 1, 1 Buy lot 1.3345 with magic 2 and 1 Buy lot 1.3360 with magic 3. How should I calculate the total Stop Loss for all orders so that if there is a move against the price the orders are closed without losing?
What is the point of averaging StopLoss? As soon as I close one position at SL, the others are immediately closed at Close! No need to lose precious pips!
On the one hand, yes, but on the other hand I see an immediate vulnerability: an order may not be closed by an EA for many reasons, and a Stop Loss will be closed anyway, otherwise this is a serious reason to complain to the broker. + Disconnection will not allow an order to be closed. Anyone else have any ideas to implement this algorithm for the total SL for the order pyramid?
On the one hand yes, but I see an immediate vulnerability in the fact that closing an order by an EA may not be executed for a variety of reasons, and a stop loss will close anyway, otherwise this is already a serious reason for a claim against the broker. + Disconnection will not allow an order to be closed. Who else has ideas to implement this algorithm for common SL for a pyramid of orders?
I can't get a handle on it, I don't know what the problem is. The task is as follows: find the bar of a given time on the minutes. If the time has not yet arrived, look for it in yesterday, otherwise look for it in today's day. I have written the following script:
This is what it outputs:
The algorithm there is as follows. We look at the difference between the current time and the given time, and if it is less than zero, we shift a day back. Then we divide the difference by 60 and round upwards, this will be the number of the bar on M1 and look at its time. It does not coincide with the one set in the externs. Where is this algorithmic error?
I can't get a handle on it, I don't know what the problem is. The task is as follows: find the bar of a given time on the minutes. If the time has not yet arrived, look for it in yesterday, otherwise look for it in today's day. I have written the following script:
This is what it outputs:
The algorithm there is as follows. We look at the difference between the current time and the given time, and if it is less than zero, we shift a day back. Then we divide the difference by 60 and round upwards, this will be the number of the bar on M1 and look at its time. It does not coincide with the one set in the externs. Where is this algorithmic error?
Look at the history to see if all the bars are present.
You can cycle from the found value in while() to the bar you are looking for. I'll give it a try.
I can't get a handle on it, I don't know what the problem is. The task is as follows: find the bar of a given time on the minutes. If the time has not yet arrived, look for it in yesterday, otherwise look for it in today's day. I have written the following script:
This is what it outputs:
The algorithm there is as follows. We look at the difference between the current time and the given time, and if it is less than zero, we shift a day back. Then we divide the difference by 60 and round upwards, this will be the number of the bar on M1 and look at its time. It does not coincide with the one set in the externs. Where is this algorithmic error?
Practising, or didn't like iBarShift()?