Hello. In principle, the Expert Advisor works. When selecting certain parameters shows profit. The disadvantage is that the number of lots in one direction is not regulated when the number of positions is greater than 1. " InpMaxPositions = 1; // Maximum number of positions in one direction " If the value "1" will be one lot. If the value is "2", the number of open lots will be more than 2. It can be 10 or 20 as far as the deposit allows. For example, if InpMaxPositions = 2; then 2 lots will be opened.
The system doesn't sound very convincing. Could there be some other way to limit lots to one side?
For example, just a new parameter: maximum total volume of a position (or positions) opened by the Expert Advisor?
what you suggested to limit the number of lots-. normal variant. Could you tell me the code fragment and where to insert it?
You just need to take into account that the number of lots and the number of positions are not the same at some brokers. My broker always has one position in one direction. Within this position there can be as many lots as you want. For example, I opened a buy position of 0.5 lots, then added another 0.2 lots. As a result, there will be one position 0.7 lots, not 2 positions.
The system doesn't sound very convincing. Is there any other way to limit lots to one side?
For example, just a new parameter: the maximum total volume of a position (or positions) opened by the Expert Advisor?
Well, then, we need to write version 3 - in which there will be a check for the maximum total volume of position(s).
If you write the third variant, it will be more flexible and perfect EA than it was. If you will improve this development, please take into account one more thing.
. In this type of accounts, when opening an opposite position, the old position is closed. In this Expert Advisor, for example, with an open position on buy 5 lots (5 lots are accumulated by adding one lot each time the conditions for buy appear), then with a position on sell closes not one lot but the entire position. so there would be 4 lots. . Price often reverses and these 4 lots can be recouped.
If you write the third variant, it will be more flexible and perfect EA than it was. If you will improve this development, please take into account one more point.
. In this type of accounts, when opening an opposite position, the old position is closed. In this Expert Advisor, for example, with an open position on buy 5 lots (5 lots are accumulated by adding one lot each time the conditions for buy appear), then with a position on sell closes not one lot but the entire position. so there would be 4 lots. . Price often reverses and these 4 lots can be recouped.
Added: I don't like to support two systems in one code - often the code can grow unnecessarily and become hard to read. Besides, I am not interested in nettnig on Forex, and netting on the stock exchange is not available to me. This is such a collision.
Do not underestimate yourself, your programs work well on the stock exchange, at least on a demo account. Regarding netting accounts on Forex. Brokers with Russian jurisdiction in the majority have netting accounts, so the interest to them has reasons. If it is not difficult to implement your proposal - introduce a new parameter: the maximum total volume of position (or positions) opened by the Expert Advisor. Thank you.
I have already introduced it. Awaiting publication code Previous Candle Breakdown 3
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Previous Candle Breakdown 2:
"Previous Candle Breakdown" Expert Advisor.
Author: Vladimir Karputov