Experts: Martin for small deposits - page 2

 
linus888 # :

Hello Vladimir, thanks for your code. It's interesting. 

I am new to MT5 coding. 

How could i understand the function of void CloseAllPositions ()? 

It seem that the function do not close all position but only the position which hit the take profit pips.

Hope you won't mind to explain me step by step. And how should i change it so that it will close all positions once the biggest opened trade hit the profit pips?

Thanks. 

This function closes ALL positions (taking into account the name "Symbol" and "Magic")

Each line has a description. Start asking what exactly you don't understand. I will answer your questions.

 
Vladimir Karputov #:

This function closes ALL positions (taking into account the name "Symbol" and "Magic")

Each line has a description. Start asking what exactly you don't understand. I will answer your questions.

Hi, thanks for reply.

Will the function will close all open position at the same direction? 

for example the EA opened 0.01, 0.02, 0.04, 0.08 lots.how could I change the code so that once the trade of 0.08 lots take profit, it will close all other open positions (0.01, 0.02, 0.04)?

Thanks. 

 
linus888 # :

Hi, thanks for reply.

Will the function will close all open position at the same direction? 

for example the EA opened 0.01, 0.02, 0.04, 0.08 lots.how could I change the code so that once the trade of 0.08 lots take profit, it will close all other open positions (0.01, 0.02, 0.04)?

Thanks. 

The function 'CloseAllPositions' closes ALL positions opened by the EA. This is clear?

 
Vladimir Karputov #:

The function 'CloseAllPositions' closes ALL positions opened by the EA. This is clear?

but it seem not work.

I have tried this in strategy tester, and only the latest open position been closed.


 
linus888 # :

but it seem not work.

I have tried this in strategy tester, and only the latest open position been closed.


Put a check in the function - if the position was not closed, then print the reason.


And, if you have questions, ALWAYS read the messages in JOURNAL!!!