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
If we are talking about versatility, it is desirable to be able to change the volume of a position not only in increments, but also in lots. I.e. approximately like this:
1) Open a position with a certain lot: PositionOpen(...,lot,....); /this function is unambiguous and does not change, it remains as it is now/
2) Change position volume, e.g. increase:
a) PositionIncrease(..., 2, mode_lot_change,....) - increase of the position volume by 2 lots; /for the case when it is convenient to change it in lots.
b) PositionIncrease(..., 2, mode_multiply_change,....) - increase volume of position by 2 times; /for the case when it is convenient to change it in times/
CTrade has a set of methods, according to the help:"Operations with positions". There they are: position opening, position closing, change of SL or TP of a position. We suggest to complete it. To reverse a position means to execute an opposite trade with a larger volume than the current one, so that the direction of the open position is reversed. To reduce a position is to reduce the volume of the open position. To increase is the opposite.
Я за то чтобы в библиотеку включались универсальные вещи, которые устраивают всех (чтобы потом не пришлось переопределять функционал стандартных классов).
PositionOpen() is such universal method of CTrade class that allows not only opening a position but also increasing (decreasing) its volume or reversing it. Just call it with the appropriate order_type in the direction of the position to add, in the opposite direction to cut, or double the volume in the opposite direction to flip.
I mean the same thing. Maybe there should be specialised functionality for trimming or flipping, but obviously not in CTrade (if we're talking about a standard library).
If the question was about any of "expert" classes, I personally wouldn't mind.
1. Please, return the leverage 1:500 (preferably 1:200), I have been waiting for such a gift from you for a couple of weeks.
2. I have another question: if my account is 1:500 and the maximum leverage available in the tester is 1:100, what parameters will the tester consider?
I REALLY REALLY WANT IT!
PositionOpen() is a universal method of CTrade class that allows you not only to open a position, but also to increase (decrease) the size of the existing one or to reverse it. Just call it with the appropriate order_type in the direction of the position to add, in the opposite direction to trim the required volume, or double the volume in the opposite direction to flip.
Let's see what needs to be done to reverse a position, for example so that its volume is doubled.
1) Determine if there is an open position.
2) Determine the direction of the open position.
3) Determine the volume of the open position.
4) Determine how much money is needed to open the opposite position with 3 times the volume (or close the same position first, and then open a double position).
5) Determine if the necessary funds are available.
6) Determine the minimum multiple of a lot.
7) Determine the closest volume in multiple to the necessary one.
8) Check again if there are enough funds.
9) Remove SL and TP from the existing position using PositionModify.
10) Set allowable slippage.
11) Open the opposite position.
12) Determine the opening price resulting from the reversal.
13) Set the new SL and TP using PositionModify.
As I was writing this, I made a few mistakes.
This is a piece of code that tens of thousands of people have to write all over again with mistakes. Why, when you can do it once in a library?
This is code that not everyone would be able to correctly oritize as a new method of a derived class. Why, if the developers can do it correctly?
It is an inconvenient thing. Why write a heap of code when you may use one ready-made function PositionReverse and one string?
I mean the same thing. You may need to write specialized trimming or flipping functionality, but obviously not in CTrade (if we're talking about the standard library).
And where, that it should be available to an average user and be present in help? Why not in CTrade (assuming that these methods won't cause problems)?
After all, you can open a trade without PositionOpen. Why have they introduced this method in Ctrade? I think that this wrapper was introduced for convenience, because it takes into account many things that are not obvious to a beginner user.
Let's see what needs to be done to reverse a position, for example so that its volume is doubled.
1) Determine whether there is an open position.
3) Determine the volume of the open position.
4) Determine how much money is needed to open the opposite position with 3 times the volume (or close the same position first, and then open a double position).
5) Determine if the necessary funds are available.
6) Determine the minimum multiple of a lot.
7) Determine the closest volume in multiple to the necessary one.
8) Check again if there are enough funds.
9) Remove SL and TP from the existing position using PositionModify.
10) Set allowable slippage.
11) Open the opposite position.
12) Determine the opening price resulting from the reversal.
13) Set the new SL and TP using PositionModify.
While writing this, I've made a few mistakes.
This is a piece of code that tens of thousands of people have to write all over again with mistakes. Why, when you can do it once in a library?
This is code that not everyone can correctly oritize in the form of a new method of a derived class. Why, if the developers can do it correctly?
It is an inconvenient thing. Why write a bunch of code when you can use one ready-made PositionReverse function and one line?
And where, so that it could be available to a common user and be present in the help? Why not in STrade (assuming these methods won't cause problems)?
After all, you can open a trade without PositionOpen. Why have they introduced this method in Ctrade? I think that this wrapper was introduced for convenience, because it takes into account many things that are not obvious to a beginner user.
It's the same for the rollover. Well, you specify "Reverse a position for such and such a symbol" and it's all, and you have it reversed by 100 4-digit points
higher or lower. You may not be happy about this.
But let's examine your arguments one by one.
1) Determine if there is an open position.
I think this will still have to be done before deciding to reverse a position.
2) Determine the direction of an open position.
I think this is also mandatory if you decide to flip. In any case, it is elementary, once the position has been chosen.
3) Determine the volume of the open position.
Similar to point 2.
4) Determine how much money you need to open the opposite position with 3 times the volume (or close with the same volume first and then open with a double).Check for sufficiency of funds before you send a request.
5) Determine if the necessary funds are available.To be combined with point 4.
6) Determine the minimum multiple of the lot
Of course.
7) Determine the volume which is the closest to the necessary multiplicity.
You are opening positions, aren't you? Therefore, you already have this functionality. All you have to do is call the function.
8) Check again whether there are enough funds.
The standard method.
9) Remove SL and TP from the existing position using PositionModify.
You don't need it.
10) Set an allowable slippage.
Sure. The smaller is more accurate entry, but more requotes.
11) Open an opposite position.
This is where we apply PositionOpen.
12) Determine the opening price resulting from the reversal.
It is also quite elementary. We only have to re-select the position.
13) Set new SL and TP using PositionModify.
If you did not calculate and set it immediately, you can do it now.
If you have made a mistake somewhere or forgot something, the developers have taken care of this, first the request parameters are checked for validity using the OrderCheck(m_request,m_check_result) function and, in case of error, the request will not be sent to the server with a corresponding message in the journal.
But how do you want the standard method to decide everything for you: the deviation, the price, the volume and stops?
The roll price, of course, is set by the strategy or the user. However, after the price has been changed, it must be checked because there is slippage and spread. That is why the stop or profit calculated in advance (and specified in the function) may turn out to be different. I mentioned price only because of that, i.e. if new values of stop and profit are specified in the rollover function (if - then checking and setting is not needed). The algorithm is simple - solved automatically by the rollover function - without my involvement. This is convenient.
If an open position exists, which is the case with the proposal, then actions arise that can be carried out without checks. For example:
- You don't have to specify buy or sell when calling the function in question, because the program can automatically detect the direction of the trade for the reversal, for the short and for the increase. There is nothing to check for errors. Here we have: minus one parameter in the function call (without buy/sell). Is it convenient? Yes. Standard method solved it for me.
- the volume of the position is known, which means that according to the user's request, the Pivot or Reduce/Enlarge function can calculate the necessary volume of the transaction for the specified mode (in lots, or in increments) in relation to the already known volume, using the nearest multiple of the minimum lot. These are typical actions and they can be programmed once. They are mainly what I'm talking about.
As for checking for correctness - you are right, it seems, you must do it yourself.
Well, you specified "reverse position for such and such a character" and that's it, and it's reversed by 100 4-digit points
I don't know if it was mentioned or not, but I would like MetaEditor to be able to collapse some parts of code... For example if from bracket to bracket, for, functions, etc.
In other words, as it is implemented in programming environments, such as Visual Studio. Because sometimes you get tired of scrolling through the whole screen in search of something...
This way, you can leave only those code fragments that you are working with open, and the rest of the code is collapsed...
Thanks... :-)
I don't know if this has been mentioned or not, but I would like MetaEditor to be able to collapse some sections of code...
I looked at the topic ofMetaQuotes Software signed a long-term partnership agreement with International Business Times and remembered what I've wanted to suggest for a long time:
1. Add a "Mark as Read" item to the content menu of the "News" tab, with the possibility of applying it to several selected news items at once (now you have to open each news item separately). This will allow to skip "not interesting" news and keep track of new ones.
2 Show the number of new unread news in a tab like it is done in MetaEditor:
This may not be the primary task, but it will add convenience to your work...