Experts: Martin for small deposits

 

Martin for small deposits:

Martingale based Expert Advisor specially designed for small deposits.


Author: Vladimir Karputov

 

I do not know if it is possible for this EA to exit at X dollars above the "high water mark" of the equity...instead of the generic "close all" set to minumum profit. I can always calculate it manually with this current EA (great EA)..but to introduce "high water mark thinking" would be revolutionary! Also wouldn't it be awesome to automate the steps with ATR? instead of manually and statically setting them? This would allow this EA to become "self-adjusting" during the slow times.

mb

 
where is the StopLoss ??
 
forexprofitid :
where is the StopLoss ??

Martingale has no Stop Loss. For Martingale there is only a natural Stop Loss - this is the drain of the deposit.

 

Hi,thanks for EA

it would be possible to separate the entry parameter to just sell, or just buy? ATT

 

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. 

Void CloseAllPositions()
  {
   for(int i=PositionsTotal()-1;i>=0;i--) // returns the number of current positions
      if(m_position.SelectByIndex(i))     // selects the position by index for further access to its properties
         if(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)
            m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol
   }
 
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!!!

Reason: