MQL4 - automated forex trading   /  

Articles

Login | Register | Language: ru cn en
Buy Expert Advisors in MetaTrader Market and Let Them Trade For You

Articles  Trading  What is Martingale and Is It Reasonable to Use It? To post a new article, please log in or register


Automated trading in
and Trade on the Go!
and Trade on the Go!

This article is about
MetaTrader 4
Download MT 4 - 455 Kb

and Trade on the Go!

and Trade on the Go!

What is Martingale and Is It Reasonable to Use It? [ ru ]


What Is Martingale?

If you write "martingale" in a search engine box, it will return a large number of pages with the description of this system. It is interesting that among others you will meet web-sites of online casinos, which assure that this system works, all you need is entering your credit card number to start scooping up money. What is strange - are the casinos ready to give their money such easily? If the Martingale really works so good, then why have not all the casinos turned bankrupt yet?

So, what is Martingale? Here is the definition from Wikipedia:

The Martingale is a betting system in gambling. The meaning is the following:
  • A game starts with a certain minimal bet;
  • After each each loss the bet should be increased so, that the win would recover all previous losses plus a small profit;
  • In case of win a gambler returns to the minimal bet.
(Translated from Russian Wikipedia by MetaQuotes Software Corp.)
More information is here: http://en.wikipedia.org/wiki/Martingale_system

Where Is Martingale Used?

The simplest gamble for analyzing the Martingale is chuck-farthing. The chances to win and to lose are equal - the gambler wins if a coin comes up heads and loses if the coin comes up tails. The Martingale system for this game works in such a way:

  • Start the game with a small bet;
  • After each loss double the bet;
  • In case of win return to the minimal bet.

The Martingale can also be used in playing the roulette, betting on red or black. The chances are less than 50/50, because there is also Zero, still very close to it.

As applied to trading, the following variant of the game can be used. Analogous to tossing a coin we open a position in any direction (short or long) with stop-loss and take-profit equally distant from the trade price. As we open the position in a random direction, the probability of profit and loss is analogous - 50/50. So in this article I will describe only the classical problem of tossing a coin with doubling the bet at a loss.


Mathematical Part

Let us conduct a mathematical calculation of the dependence of the loss probability on the possible profit at the game with a coin using the Martingale system. Let us introduce the following symbols:

  • Set – a set of tosses, ending by a winning one. I.e. all tosses except the last one are losing. At the first toss the bet is minimal, at each next toss in the set the bet is doubled;
  • Q – initial deposit;
  • q – price of the starting bet;
  • k – maximal number of tosses (losing) in the set, leading to bankruptcy (suppose after k toss the deposit is equal to zero).

As we double the bet after each losing toss, we can derive the following equation:

Each set with the amount of tosses less than k-1 returns the profit q. As the probability of winning at a toss = ½, the average set length is 2*. Let us label by P(N) – the probability that we will not turn bankrupt within N tosses. As N tosses constitute approximately N/2 sets (the average set length is 2), and the probability to win in the set is (1/2)^k-1 , then
We get the function of the win dependence on N. But the total number of tosses (N) is not informative enough, so let us try to bind N with an expected profit. Suppose, in the result we want to double our capital. As in set each we win q=Q/(2^k-1), the total profit is calculated according to the rule of the compound interest (more information about compound interest is here):

After simple transformations we get the following formula for N:

After calculating the probability of the profit P(N) using the equities (1)-(2) we get the following results:
If we consider N a noninteger (do not round off the results of the equity (2) to a whole number), then P(N) does not depend on k and is equal to 1/2 (you can easily verify it, inserting (2) into (1) and using the simplest properties of logarithms). I.e. using the Martingale does not provide any advantages; we could as well bet all our capital Q and the winning probability would be the same (1/2).

Conclusions of the Mathematical Part

Frankly speaking, at the beginning of preparing calculations for this article I expected that the Martingale would increase the probability of loss. It appeared to be wrong and the risk of loss is not increased. Still this article very vividly describes the meaninglessness of using the Martingale.


Expert Advisor

After getting the above formulas, the first thing I did was writing a small program, emulating the process of playing chuck-farthing and composing the statistics of the losing probability (P) dependence on the coefficient k. After the check I found that the program results (it can be called "an experiment") coincide with mathematical calculations.
Of course, the ideal variant would be writing an Expert Advisor, trading by the same rules as in chuck-farthing and making sure that theoretical and experimental data are identical. But it is impossible because the starting bet is calculated using the formula:


And in the Forex we can "bet" only a sum multiple of 1/10 of a lot. That is why it is impossible to write an Expert Advisor, vividly proving the above formulas. Nevertheless, for completeness of analysis, we still can write an Expert Advisor, using the Martingale. But here the starting bet will be fixed - 0.1 of a lot. Analogous, the bet will be doubled at a loss and return to the starting one at profit. As described in the beginning of the article, a trade will be opened in the following way: a trade is opened in a random direction with the probability 50%, stoploss and takeprofit are fixed and equally distant.


The above screenshot displays the results of testing this Expert Advisor. You see, though the general direction of the curve is upwards, from time to time it suffers large dips. As a result of the last dip the Expert Advisor stops trading, because the balance is not enough for the next bet with a doubled lot. And at the moment of stop the balance is positive - here is the difference from the theoretical calculation in "the mathematical part".


P.S. The files attached contain the screenshot of all necessary mathematical calculations and the Expert Advisor.

Translated from Russian by MetaQuotes Software Corp.

Attachments:
martin.mq4 (2.2 Kb)
solution.jpg (202.3 Kb)
Created: 2007.08.15  Author: Slobodov Gleb
Warning: All rights to these materials are reserved by MetaQuotes Software Corp. Copying or reprinting of these materials in whole or in part is prohibited.
Price Forecasting Using Neural Networks
Price Forecasting Using Neural Networks

Many traders speak about neural networks, but what they are and what they really can is known to few people. This article sheds some light on the world of artificial intelligence. It describes, how to prepare correctly the data for the network. Here you will also find an example of forecasting using means of the program Matlab.

Mathematics in Trading: How to Estimate Trade Results
Mathematics in Trading: How to Estimate Trade Results

We all are aware of that "No profit obtained in the past will guarantee any success in future". However, it is still very actual to be able to estimate trading systems. This article deals with some simple and convenient methods that will help to estimate trade results.

8 comments  To add comments, please, log in or register

It works if the net profit factor is above 1 and the win rate is higher than 50%, martingale is a double or nothing either doubles your money or doubles your losses, so if you have a 60% win rate with 1:1 RR ratio you can use it safely, if not then dont.


Whats funny about forex that you dont start from 50% win rate from the start because the market is changing not a fix probability set like a roulette or blackjack game.So if you start it like a betting system you will have like 40% win rate with 1:1 RR if you take trades random, maybe on the 9999999999999999999999th trade you hit 49.9% but thats still not enough.So it is better to filter out crappy trades first and then increase your win rate to be martingale compatible! And this is the advantage of investing vs gambling, you can filter out bad trades, on the roulette or blackjack you cant filter out bad hands or spins unless you cheat, but surely not the statistical way!!


This is how my 60% win rate, real martingale system looks like, and how it should suppose to look like, on LEVEL 7 settings (2^7)

Here are my martingale type systems:

1) CLASSICAL MARTINGALE AFTER 567 TRADES (60% WR, 1:1 RR)


As you can see after 500 trades it barely hit LEVEL 7 and even if we would lost that we would lose only half of the profit and continue from there to grow it back!

Of course you need a big account for this like one that can support like 10 lot size trades to be only 1% account risk, but statistically its very improbable to blow your account since its only 1% risk versus huge potential gains...The martingale presented in this article is BS with like 40-45% win rate which is sadly not enough, not even 50% is, must be 51 or higher...

2) PROGRESSIVE DYNAMIC GROWTH MARTINGALE (60% WR, 1:1 RR)


3) PROGRESSIVE STATIC GROWTH MARTINGALE (60% WR, 1:1 RR)


4) ANTI MARTINGALE or INVERSE MARTINGALE (60% WR, 1:1 RR)


enjoy and good programming ;)

2013.08.24 05:00 Proximus

its funny the articles that are written on martingale. It is true that without an edge, even 0.50% above 50/50, you would lose over time (over a continuous series of repititions). This was also proven in an article detailing the gambler's fallacy (see follow up also here) . The good news is that the financial markets can only go so far in any particular direction before a pullback. You can use this fact alone to your advantage (edge). I think the largest single direction trend a market ever made was EURUSD 2000 pips without a pullback of at least 38.2%, There was another move of 3600 pips, but there were significant retracements in-between. Even better news is that martingale is not required to become profitable in the markets. There is a spreadsheet where you can work out the numbers yourself and see.


2012.05.13 10:30 4evermaat

2

2012.02.07 11:17 joshuadewale
this is a Maringale System and you can use very good. but you sell its helps and then i will send 3 next days EA for you. password PDF for openning is "business".
2012.02.07 11:13 joshuadewale

How to implement profitable martingale:

1 - start with low base lots (0.1 or less)

2 - high win rate.. at least 70%

3 - low consecutive losses (minimize z-score)

4 - semi-martingale.. rather then strictly doubling the number of lots.. allow this factor to be varied based on market/performance.. in my experience, doubling is a very aggressive approach

5 - equity stoploss.. force martingale to reset to minimum lots if a given equity drawdown is observed.. you will take a large hit, but still be in the green & in the game

..I have such a system trading on a live account.. due to the limitations above it is not hugely profitable but has been running for over a year with a constant return on capital

2011.03.31 07:06 supertrade

Hi all, i am a physician involved in Forex as a hobby and playing around with EA builder. However, i have designed an automated trading system with winning rate (65-73%) but most of the won trades is small, while the losing ones are large( from 1 : 2 to 1:3). So, the end of this system is losing but with a very long periods and it could sustain for a period of time without losing the whole account. Simply this EA can survive in ranging to consolidating to moderate trending market conditions but not in a highly trending markets. I have designed an inversed form of this simple EA which can follow the trend very well but lose during the ranging markets. The number of trades on 5 minute charts (around 10/day) or 15 chart (around 7-8/day). I would appreciate your ideas to enhance its performance. Any ideas will be highly considered. Please dont hesitate to share with me your opinions whatever are.


Primarily here i am talking about the ranging EA, the one which could survive in the ranging markets and trying to avoid the aggressive trending conditions.


OK. now, i am thinking of ;

1- I am considering News filter indicators to avoid spike times.

2- using some other indicators to filter the entry and i have found some i could combine. So, i could cut down the number of trades from 10 to 2 or 3 on the 5 minute frame. But selecting only the highly probable ones.

3-considering Hedge or martingale during the highly trend periods.

4-considering using a logical stop loss to cut the nagative trades short without affecting the ones running to my side.

5-Considering using positive progressive betting system instead of martingale. This is based on the high number of my trades are Positive rather than negative.


That is all for now. Please if you have any idea i would appreciate to share it with me to solve this issue.


ESPECIALLY WITH THE BETTING SYSTEM TO CHOOSE AND HOW I COULD USE IT :).

email: mcgene2010atyahoo.com


Hatem






2009.11.20 00:30 McGene4xPro

Simply speaking without a high winrate martingale cannot work...

ES

2008.09.17 08:43 ElectricSavant
Firstly, sooner or later, though the probability be small, you will have enough consecutive losses to bankrupt you. Remember that the probability of any sequence of profits and losses is equal to that of any other sequence. So, for example, you are just as likely to get seven consecutive losses as you are to get six consecutive losses then a win.

Secondly, I'm no mathematician, but it seems to me that you will lose in the long run if for no other reason than that you are paying a spread for each trade. To make the probablility of loss equal to that of gain, you will have to use a single price to calculate the positions of your s/l and t/p, so that the s/l and t/p will be equidistant.  You will either have to pay more for the stoploss than you would take in profit, or for equal loss and gain you will be more likely to hit the stoploss than the takeprofit. If I am wrong here, tell me!

I have seen Martingale system advertised for sale, but having written a simple EA to test the idea, decided not to involve myself in it.  However, Paroli's system, the opposite of Martingale, is attractive, even though it, too, suffers from similar problems.  There is no way you can make something unpredictable into something with a probability greater than 0.5. Trading MUST involve making judgements and using skill to predict; those unwilling to develop the skill will, I believe, fail. You simply have to make winning more probable than losing. If you can do than, perhaps Martingale may enhance your trading.

I have to say I am a complete beginner at EA programming and only have a little experience trading and that was mostly in options.  Automated trading is a fascinating idea and I think I shall enjoy pursuing it.
2008.03.09 15:47 clam0391
8 comments