Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1414
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
I can understand that, thank you. But I still don't understand which stop loss applies if the first EA buys 0.01 lots and the second buys 0.05 lots. Then a position of 0.06 lots is open, right? And which stop loss applies to this position? The first, the second or an aggregated one?
Ok, if that's the case, then I have finally understood the underlying principle of a netting account: There is only one position, which is an aggregate of all previous trades; and whoever was the last to set SL and TP - whether via the OrderSend method or via PositionModify or otherwise - has set SL and TP for the entire position, regardless of whether it suits the other EAs or not.
This means that when using several EAs on one and the same symbol with a netting account, the user must be aware that he must set the SL and TP of the different EAs identically so that they do not function differently than originally planned - unless they have a protective function and only open an "internal" position if no position is open on the respective symbol. And the PositionSelect() you mentioned above is very useful for this.
This means that when using several EAs on one and the same symbol with a netting account, the user must be aware that he must set the SL and TP of the different EAs identically so that they do not function differently than originally planned - unless they have a protective function and only open an "internal" position if no position is open on the respective symbol. And the PositionSelect() you mentioned above is very useful for this.
To be on the safe side, however, I would try this out again to see whether the SL and TP are adopted for another order or whether it is better to change the SL and TP separately afterwards - I have no experience with this!
Yes, you should certainly try everything out. As far as the netting account is concerned, I haven't done that yet, but I have done it with the tradeResult.deal value, which I had saved as positionTicket.
I realised that if I run the EA and also send limit orders and the like between the market orders, which I only use in it (apart from SL and TP), then the ticket of the open position is not identical to tradeResult.deal, but to tradeResult.order. And as described on the position properties page, the ticket of the position can simply change, while POSITION_IDENTIFIER does not change, but remains identical to the ticket of the order that opened the position, i.e. to tradeResult.order of the entry trade.
please, who knows where you can trade USDKZT ?
I have just tried this with the netting account. If you place a 1-lot market sell order with a stop loss at 1.1 EURUSD and then place a 1-lot market sell order with a stop loss at 1.05 EURUSD, then the entire 2-lot netting position has the stop loss at 1.05 EURUSD. This means that if you run two competing EAs on one symbol, which manage or handle the StopLoss and TakeProfit differently, this could lead to chaos. I'd better check in my EA with PositionSelect() whether a position is already open and let my EA wait until there are no more positions before they get tangled up.
I have just worked through The checks a trading robot must pass. The information was very helpful. However, the question of margin calls came up. I don't know if I have understood this correctly.
Currently my EA does two things to avoid margin calls: Before a trade that opens or could open a position, it uses OderCalcMargin(...) and ACCOUNT_MARGIN_FREE to see if the margin can be raised. Then, if a position is to be opened, it checks whether the amount of money in the stop loss exceeds the margin to be paid. And I'm not sure whether I've misunderstood something about the second point.
Suppose the margin is $500, the market is going against my direction and my stop loss would only take effect or trigger at a loss of $1000. If the open P&L value of my position is -750$, i.e. the margin of 500$ is used up, do I get a margin call? So would it make sense to check the SL? - This is something I don't want to try out.
Search for "calculate lotsize": https://www.mql5.com/en/search#!keyword=calculate%20lotsize&module=mql5_module_forum