EA to close from old positions

 

I am looking for an EA that, when the margin maintenance rate falls below 100%, closes the positions in order starting with the oldest position until the margin maintenance rate exceeds 100%.

If you know of such an EA or a similar sample code, please let me know.

 
yu kawahara :

I am looking for an EA that, when the margin maintenance rate falls below 100%, closes the positions in order starting with the oldest position until the margin maintenance rate exceeds 100%.

If you know of such an EA or a similar sample code, please let me know.

Advisor Free Margin Close All FIFO

 
Vladimir Karputov #:

Advisor Free Margin Close All FIFO

Did you create it to meet my needs? Thank you very much.
But my environment is MT4 and I can't run mq5. I'm sorry to be selfish..., but I need the code for mq4.
 
yu kawahara # :
Did you create it to meet my needs? Thank you very much.
But my environment is MT4 and I can't run mq5. I'm sorry to be selfish..., but I need the code for mq4.

You are on the MQL5 forum. You wrote your question in one of the main sections of MQL5. That is why you received an answer for MQL5.

Remember: there is ONE, SPECIAL section for the old terminal on the forum: MQL4 and MetaTrader 4 . I will move your topic to the section for the old terminal.

 
Vladimir Karputov #:

You are on the MQL5 forum. You wrote your question in one of the main sections of MQL5. That is why you received an answer for MQL5.

Remember: there is ONE, SPECIAL section for the old terminal on the forum: MQL4 and MetaTrader 4 . I will move your topic to the section for the old terminal.

I'm very sorry...I hadn't checked that there was a forum for MQL4.
Thank you for letting me know.