Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1414

 
Benjamin Fotteler #:
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?
I think the last one entered.
 

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.

Documentation on MQL5: Trade Functions / PositionSelect
Documentation on MQL5: Trade Functions / PositionSelect
  • www.mql5.com
PositionSelect - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Benjamin Fotteler 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.

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!

 
Hello good afternoon, someone can help me, I can not download any indicator of mql5 for mt5, I give download indicator in mql5 I get a window asking if I have mt5 I give it yes, then automatically opens mt5 in the section of marking or market and does not download anything.
I tried entering the user and password of mql5 in mt5 in the tools section, community, to download them directly by mt5 directly and nothing does not download anything, just makes the same sound when an operation does not enter or there is an error lotaje....

My pc is windows 8.1 32 bit, I do not know if the operating system has something to do.
I appreciate the help thank you very much.
 

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.
 
Benjamin Fotteler #:
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.
Thanks for the test! As I suspected, on a netting account the open positions have no 'memory'. Or you can use a hedging account, where each position has the magic number of 'its' EA, who can then manage it.
 

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.

 
  1. Most brokers no longer issue margin calls, as all positions are (automatically?) closed before an account falls into the red (and you have to add money: the margin call).
  2. Margin is the amount that is regarded as a deposit for an open position, ACCOUNT_MARGIN_FREE is the remainder (unused portion).
  3. A maximum of between 5% and 10% of the account balance (balance) or capital balance (account balance + open positions, equity) should be used for trading in order to prevent positions from being closed due to a lack of capital and losses in positions.
  4. The risk of a position depends on the SL and the lot size, since SL is usually fixed for technical reasons, the lot size is used to calculate the risk:
    Search for "calculate lotsize": https://www.mql5.com/en/search#!keyword=calculate%20lotsize&module=mql5_module_forum
  5. Tip most articles are also available in German, you just have to replace the /en/ in the URL with /de/: https://www.mql5.com/de/articles/2555
Reason: