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

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
is this a joke?
You have it in black and white for(;;)
Well yes, only there is a way out of it: when magic does not equal order magic.
Try this
What if there is a grid of orders?
Does anyone have a function to calculate the sum of all swaps of a grid of orders for a magic order and a financial instrument.
Thanks for the help!!!
What do you need it for?
When closing a large grid of orders with a long grid life, order swaps eat into profits and distort the result very much.
I want to compensate for the loss on swaps with this function.
When closing a large grid of orders with a long grid life, order swaps eat into profits and distort the result very much.
I want to compensate for the loss on swaps with this function.
Try this
But I need it to pass through all orders. The mage itself is set at the moment of creation only to the stopper. We can't understand that the stopper is created by OrderType() because it hasn't been there yet; we have a preliminary record of order type in order.cmd for that. And here we need two loops: one nested in the other, so that one iteration of the variable magic is checked with all orders from OrdersTotal(). I have it all implemented, only there is an endless loop, I don't know why ...
Is the grid closed at profit or at breakeven?
Yes, at a certain level of drawdown, there is a loss to zero and to no loss there is an ugly loss due to swaps
This is fine, I had if (order.cmd == OP_SELLSTOP || OP_BUYSTOP)
But I need all orders to be passed. The mage itself is set when only the stopper is created. We can't know that the stopper is created by OrderType() since it hasn't been there yet, we need to write the order type in order.cmd beforehand. And here we need two loops: one nested in the other, so that one iteration of the magic variable is checked with all orders from OrdersTotal()
Yes, at a certain level of drawdown, there is a loss to zero and to no loss there is an ugly loss due to swaps