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
The result is still the same! With the last variant only the last open position is closed!
I did it as instructed. And a miracle happened. All open positions are closed by the signal of the indicator! But why?
The result is still the same! With the last variant only the last open position is closed!
I did it as instructed. And a miracle happened. All open positions were closed according to the indicator signal! But why?
I usually implement this kind of functionality:
As you can see, functions are written that perform quite specific actions. And then these functions are combined in such a way as to implement the desired tactics of working with positions.Please, Igor, describe your function in more details. I want to understand it, but because of my modest knowledge I may lose my train of thought at the very beginning.
This was an example pulled from a working EA. Function assignment:
Tactics:
You see how easy it is? :-)
Hello everyone! Merry Christmas!
Another problem has come up. I have looked through the theory, but have not found a way out yet. For some reason, I need to close opened positions in my Expert Advisor using the function instead of using stops (Stop Loss and Take Profit). I have done it. It worked! However...
When trying to insert into an Expert Advisor the library for calculating lots (B-lots), I found out that it started working in an unknown manner! If I had not used MM, the balance curve (after optimization) went steadily upwards with a hardly noticeable drawdown, after adding MM I suddenly had a sharp plummet! Moreover! Even if we remove the B-lots library and simply increase the lot size from 0.1 to 0.2, we again see a sharp pull-down. Even when the initial deposit is increased in several times ..... I.e., it's neither the library nor the deposit size - the drawdown was miserable to begin with... . I enter the market like this:
Everything is clear and understandable here. Then I close positions using OrderClose(. ...) function. Like this:When I initially set the lot=0.1, the design works fine! When I try to change the lot size (increase) or when I try to enable the MM library, the operation is broken! I cannot understand why? I used "Lots" instead of OrderLots(), but nothing has changed. Please, tell me.
With the initial lot=0.1 the design works fine! When I try to change the lot size (increase) or when I try to enable the MM library - the operation is broken! I cannot understand why? I used "Lots" instead of OrderLots(), but nothing has changed. Please, advise?
Are the orders opened/closed at the same time as before?
No. By increasing the lot from 0.1 to 0.2 trades start to occur more often, more than twice as often ! With the same external parameters ... It's strange. But I'm not too lazy! I did it like this:
I removed closing of positions using the OrderClose function, and provided for normal closing by Stop Loss and Take Profit in the ticket=OrderSend(... ... ...) function. In this case the MM block worked as it should! It seems it's all about the function
Maybe the value of "tp" should be changed accordingly when increasing the lot?The error is in the code. Where - I do not know, because there is not even a code. Call the clairvoyants from the next branch ;)