Experts: Martin for small deposits

 

Martin for small deposits:

Martingale based Expert Advisor specially designed for small deposits.


Author: Vladimir Karputov

 

Hello, Vladimir!

I tested this Expert Advisor a little bit. I ran it in the demo for a day and in the tester. In both the first and the second type of testing, there were questions about the correctness of the code. For example, when the Expert Advisor was on the demo, in some period it opened new positions after closing all positions not with the minimum lot, but with the next step. It certainly raised the balance considerably, but I think the logic failed. And when I was testing with visualisation, it is not uncommon that after opening 2-3 positions and getting the total profit on them more than set in the InpMinProfit variable, the Expert Advisor does not close them, but waits for them all to close at take profit.

Unfortunately, I am not good with OOP and C++ programming, so even seeing the source code I can't understand why this happens.

 

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

 
Good strategy. Which signal does he use to open buys and open sells?
 
sergiomt :
Good strategy. Which signal does he use to open purchases and open sales?

Decision block:

   if(count_buys==0 || count_sells==0) // check the opening of the position "sell"
     {
      if(count_buys==0 && count_sells>0)
        {
         if(m_symbol.Bid()-price_highest_sell>ExtStep)
            need_to_open_a_sell=true;
        }
      else if(count_sells==0 && count_buys>0)
        {
         if(price_lowest_buy-m_symbol.Ask()>ExtStep)
            need_to_open_a_buy=true;
        }
     }

"need_to_open_a_sell" and"need_to_open_a_sell" - trading signals

 
Does not close open positions by the value in the parameter - Min profit for close all.
 
qazzaq12345:
Does not close open positions by the value in the parameter - Min profit for close all.

Please show the Expert Advisor settings and log file. Which positions were not closed?

 
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
   }