Questions from Beginners MQL5 MT5 MetaTrader 5 - page 895
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
It depends on the volume!
It is clear that the bias will be towards a larger lot, but it is still an average price, as if the formula were applied to a hedge account
double average_op = (op1 * lot1 + op2 * lot2 + opN * lotN) / (lot1 + lot2 + lotN);
Or not?
Change! There will be a closing of the previous position and an opening of a new one. But it's on the FORTS!
I meant FORTS) If you closed at 4657, then opened at 4657
It is clear that the bias will be towards a larger lot, but it is still an average price, as if the formula were applied to a hedge account
Or is it?
I think so:) Check if you're not sure!
I think so:) Check if you're not sure!
Not sure, but check how. Maybe someone who knows for sure will drop by)
I meant FORTS) If it closed at 4657, then it opened at 4657
Well, if the closing price is exactly the same as the position price, then yes, but it's like a broken clock that shows the exact time twice a day. More often than not, the price of the position after reopening will not match the price of the position before clearing.
Not sure, but check how. Maybe someone who knows for sure will drop by)
Um... make 3 trades on demo with different lots and see the price of the position, then do the same using the formula... and that's it :)
More often than not, the price of the position after reopening will not match the price of the position before clearing.
Here's the deal... So if the modify \n function calculates the \n price relative to the position price, then my \n may not be where it should be after clearing. How do I set the \n correctly then?
So... So, if the modification function calculates the price of the spot relative to the price of the position, then after clearing my spot may not be where it should be. How can I set the spot correctly?
The TP stays in the same place! Just the price of the position will change. I.e., the position is closed - you get a profit/loss on the position, and the position is reopened (at the same volume as it was). But, if the position had an TP or SL - it will remain at the same level as it was before closing. But if you want to calculate the TP after the clearing, then yes - the price of the position will throw a surprise.
In that case, you need to look for trades to close the position. And watch whether the position was reopened. In short, in this case, before modification, you need to check all trades for closing by clearing. Or just store in a variable the initial price of the position... Well, it all depends on the task.
The TA will stay in the same place! It is just the price of the position that will change. I.e. the position is closed - you make a profit/loss on the position, and the position is reopened (at the same volume as it was). But, if the position had an TP or SL - it will remain at the same level as it was before closing. But if you want to calculate the TP after the clearing, then yes - the price of the position will throw a surprise.
In that case, you need to look for trades to close the position. And watch whether the position was reopened. In short, in this case, before modification, you need to check all trades for closing by clearing. Or just store in a variable the initial price of the position... Well, it all depends on the task.
Surprise, that's for sure). T\P is modified according to the condition: if t\n != position price + N. For me it would be easier to store in a variable, but after reopening, there may still be new trades. How, then, to calculate the average price of trades comprising the position, made before and after clearing, in order to calculate tron from it? More precisely, how do I find the trades that occurred before the reopening and combine them with the trades made after clearing?
Surprise, that's for sure). T\p is modified by the condition: if t\n != price of position + N. For me it would be easier to store in a variable, but after reopening, there may still be new trades. How, then, to calculate the average price of trades comprising the position, made before and after clearing, in order to calculate tron from it? More precisely, how do I find the trades that were before the reopening and combine them with the trades made after clearing?
The position identifier will not change. Use it to search for trades.