Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal


Martin - expert for MetaTrader 5

| English Русский 中文 Deutsch 日本語 Português

Published by:
Vladimir Karputov
votes: 18
2017.11.03 11:52
Martin.mq5 (18.64 KB)view

Author of the ideaVladimir Khlystov, mq5 code authorbarabashkakvn.

Description from the author of the idea:


The Expert Advisor was created at the request of one of the forum participants.

A comment by vvx080: The idea is to create a grid of stop orders, e.g. we first set two orders sell and buy; once one of the orders triggers the second one should be deleted. If the trade is unprofitable, after 10 points we open an opposite order with the doubled lot. If it is unprofitable again, after 20 points we open another opposite order twice as large as the previous one. If again the trade is negative, after 30 points we open an opposite order twice as large as the previous one, and so on.

Under such conditions, there should be a lot of coincidence for the deposit to be completely lost. In case of a positive trade movement, we use a good trailing so that we could catch 300 profit points. No stop loss and take profit are used for orders, trades are closed at a common profit. This strategy is not afraid of trends or flat. During trend the total profit is trailed.

Here is the preliminary calculation of lots and deposit:

  1. sell 0. 1 -10p = -1,
  2. buy 0. 2 -20p = -3
  3. sell 0. 4 -30p = -12
  4. buy 0. 8 -40p = -32
  5. sell 1. 6 -50p = -87
  6. buy 3. 2 -60p = -213
  7. sell 6. 4 -70p = -514
  8. buy 12. 8 -80p = -1194
  9. sell 25;6 -90p = - 2886

I think a deposit of 3000 should be enough, but the strategy can hardly reach the 8th or 9th order. I might be wrong somewhere, but the idea is like that. The Expert Advisor will be more accurate.

The EA uses a lot increase, but it cannot be called a pure martingale. Moreover, the EA does get out of flat, while many martingales cannot do.

Please add your comments and ideas to improve the strategy. However, please do not post "martingale is bad" ideas without checking the EA at least on a demo and without understanding its operating principle.

Expert Advisor parameters

  • InpStep - step between positions.
  • InpProfitClose - minimum profit, at which all positions will be closed.
  • InpLot - position volume.

Testing results on EURUSD:

Martin test

Translated from Russian by MetaQuotes Software Corp.
Original code:

AlexSTAL_ZigZagProf_channel AlexSTAL_ZigZagProf_channel

A channel based on peaks and troughs of AlexSTAL_ZigZagProf.

ForceTrend ForceTrend

It is a simple trend indicator with the color indication of active trend direction.

Report Report

The MetaTrader 4/5 library allows generating reports based on the trading history.

Chart Save Template Chart Save Template

The script saves current chart settings to a template with the specified name.