![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
Локирование с наращиванием лота используется?semblance of
20-40p, messaged meYuri, out of respect for the great work you've done, I'll say that locs don't give any advantage here. I immediately converted your algorithm (not Avalanche) to a net position and got a very close result. I think it (lack of advantages in lots) should be obvious: you save spread and margin. In addition, it saves resources during testing/optimization, because it reduces the loop of open positions. I compared: passes of the net variant are 3 times faster than those of the trailing version. The results differ by 1-3% in favor of the net, which is to be expected in theory. I recommend you to change your code to net if you plan to use it in trading.
.
The rest is trailing. I am not sure if my variant results in more losses on margin and spread - I have not got to such subtleties yet. I'll trust you for now, but I'll try to do as you did and compare.
20-40p, messaged me
Thank you....The rest is trailing...
I tried to at least imagine it and something even started to come out, but very confusing and complicated :)
You netting immediately after 2 differently directed positions appear, but in my case it happens after the aggregate position enters the profit zone.
The balance is trailing. I am not sure if my variant results in more losses on margin and spread - I have not got to such subtleties yet. I'll trust you for now, but I'll try to do as you did and compare.
The trade result (excluding swaps) will be equivalent if
1. your closing also takes place via OrderCloseBy and
2. Your brokerage company does not withhold margin on locked positions (very rare).
Saving resources (fewer orders in the market) when netting is not an option.
If in my variant there will be more losses on margin and spread, I'm not so sure, I haven't reached such subtleties yet.
When you check it, if you make absolutely identical version (it didn't work for me),
My humblest request :)
Please write which "aggregate order" I would need to open instead of . any, starting from the second
2010.03.22 00:38 buy 0.01 1.35339
2010.03.22 08:01 sell 0.02 1.35026
2010.03.23 00:06 buy 0.03 1.35643
2010.03.23 08:37 sell 0.09 1.35026
After your reply, I will make sure to follow up all positions' history.
'
The aim of the Holivar has never been the truth! And I just want to understand . 'pro netting' for these positions. ;)
What is there to understand?
2010.03.22 00:38 buy 0.01
2010.03.22 08:01 sell 0.02 = Close 0.01 buy, Open 0.01 sell
2010.03.23 00:06 buy 0.03 = Close 0.01 sell, Open 0.02 buy
2010.03.23 08:37 sell 0.09 = Close 0.02 buy, Open 0.07 sell
---
Total after 2010.03.23 08:37 0.07 sell
check, among other things, the moment of MC occurrence (from the "A" VC website)
If there are more than two locked positions, the margin requirement is calculated as follows
(open_price1*Lot1+ open_price2*Lot2+...+ open_priceX*Lotx)/(Lot1+Lot2+...+Lotx), where:
Let's take an example:
We bought gold, buy 1 lot at 932.47, sell 0.1 lot at 933.30 and sell 0.1 lot at 935.18.
(932.47*1 + 933.30*0.1 + 935.18*0.1) / (1 + 0,1 + 0,1) = 932.765
The pledge on locked positions turned out to be $932.77.
1. Yes, I wrote as you did, only not immediately, but after entering the profit zone.
2. DC A...and, the collateral is the same, both for 2 differently directed positions of the same lot, and for one.
Damn it, learn how to use the calculator!
Overlapped positions can be closed at any time, you do not have to wait for Breakeven. The gain is in margin release and swap reduction.
Taking into account point 2, there is a gain in swap accrual.
DC A...and, the margin is the same for 2 differently directed positions identical lot sizes that for one.
It's strange, but in your own pictures I see "of different lot sizes". And AI has it a few lines below.
By the way, the formula for calculating the margin for "identical lot sizes" is a special case of the formula for "unequal LOT", taking Lotx - volume of position X in lots as a constant.
"Overlapped positions can be closed at any time, no need to wait for breakeven." You can, but not necessarily.
DC A...i., the margin is the same for 2 differently directed positions with the same lot as it is for one.
Maybe you are right, but I haven't understood swap.
Of course, you don't have to. But there is a reason to keep the overlapped ones to breakeven only if the position control algorithm is much simpler in this variant.
And the overlapped ones should be closed only through OrderCloseBy() in order not to lose an additional spread.