Errors, bugs, questions - page 3143
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
Good afternoon! Does the code need the line PositionSelectByTicket... If so, how do I write the ticket correctly inside it, using PositionGetTicket(i) or leave thePositionGetInteger(POSITION_TICKET) ? Thank you in advance!
Don't be rude... Doesn't the documentation clearly state
If the position is already selected, why re-select it with the PositionSelectByTicket function
Not to be rude... Doesn't the documentation clearly state
If the position is already selected, why re-select it with the PositionSelectByTicket function
Hi, is the PositionSelectByTicket line required in the code... If so, how to correctly write a ticket inside it, through PositionGetTicket(i) or leavePositionGetInteger(POSITION_TICKET) ? Thanks in advance!
Thank you for your answer! I started wondering, because having looked in the <Trade/Trade.mqh> library, the PositionClose(const ulong ticket,const ulong deviation) function also uses PositionSelectByTicket. And the PositionClose( const ulong ticket,const ulong deviation ) function itself is often used by coders in combination with the loop for(int i = PositionsTotal()-1; i >= 0; i--) , looping through all the positions. And I'm wondering if I'm using an extra one somewhere.
The PositionClose(const ulong ticket,const ulong deviation) function in the library receives a ticket of the position to be closed, but nobody knows how the ticket was received or if the position exists.
Therefore PositionSelectByTicket mostly checks if there is something to close. And why have you decided that all positions are often closed in the loop? Not necessarily...
The PositionClose(const ulong ticket,const ulong deviation) function in the library receives a ticket of the position to be closed, but nobody knows how the ticket was received and whether the position exists.
Therefore PositionSelectByTicket mainly checks if there is something to close. And why have you decided that all positions are often closed in the loop? Not necessarily...
Hello
Can you please help me
with the code.
Made an indicator in the tester works properly
When I put it on the chart it does not show correctly
Can't figure out why it's wrong.
What is returned to MqlTradeCheckResult structure?
It is written in the documentation that "The amount of margin required for the required trade operation".
Field
Description
retcode
Return code
balance
Balance value that will be after the trade is executed
equity
Value ofequity, which will be after the execution of the trade
profit
Value of floating profit that will be after the execution of the trade
margin
The amount of margin required for the required trade operation
margin_free
The amount of equity that will be left after the execution of the required trade
margin_level
The level of margin to be set after the execution of the required trade
comment
Comment to the response code, error description
But what is actually obtained is the size of the total margin, current and plus the one that will be taken after the operation is executed.
Here is the script
and the result of execution
While there are no open positions in the account my_check_result.margin equals margin for the open position with lot 0.01, and when there is already 0.01 in the account the margin for lot 0.02
But what you actually get is the size of the total margin, current and plus that which will be taken after this operation is done.
Right.
Right.
Let it be so, but then it should be the same in the documentation.
If balans is the value of the balance that will be after the trade is done
then margin - should be. Margin value, which will be after the trade is executed