The classical Martingale : what we should exactly NOT do !

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #8378 quote
    Doctrading
    Participant
    Master

    The martingale is a money management strategy, where you increase the size of positions every time you lose, in order to make the gains exceed the past looses.

    This is a well-known strategy, and very risky. The classic martingale doubles the bet with every loss, the stop loss is equal to the take profit.

    So we put successively to progressively losses : n = 1, then 2, then 4, 8, 16, 32, 64.128, 256, 512, 1024, 2048, etc.  

    Here is a typical example of a capital increase of curve with a strategy that follows a martingale.

    There seems to win in the long run, but as you see you have to bet more and more each time you loose (betting n = 1024 !)

    Let’s look closer in losing trade. The strategy shows the increase in size of contracts to a nearly fatal level (n = 1024). In the picture I did set 100.000 capital instead of 10.000, or we should have already lost all.  

    And what would happen if we launched the strategy with a capital x10 times?

    We should have passed the first crash. But soon, with the same catastrophic scenario we lose EVERYTHING.    

    CONCLUSION:

    The martingale is good… when you have a INFINITE money ! So it’s mathematically losing over the long term. For 5, 10 or 20 consecutive losing trades, it may be extremely rare… but it finally happens one day.

    It can happen tomorrow or in 5, 10, 50 or 500 years.  I prefer to lose 10 trades in a row with 1% risk per trade (10% of capital, I am in still in the race !), than attempting a martingale and constantly be very worried because I can loose my capital at any time.

    Of course, the strategy that I did use is very bad… but even with a better strategy it is still risky.

    I think that if you really have a high winning ratio strategy, it could be useful… still risky, but it is worth using it on a small capital.

    Defparam cumulateorders = false
    
    Once n = 1
    
    IF time = 090000 THEN
    
    // MARTINGALE
    IF PositionPerf(1) <0 THEN
    n = n*2
    ELSIF PositionPerf(1)>=0THEN
    n =1
    ENDIF
    
    // ENTREE
    buy n shares at market
    
    ENDIF
    
    set stop loss 0.0030
    set target profit 0.0030
    
    Graph n   // pour visualiser la taille de "n"

    #8388 quote
    deleted190722
    Participant
    New
    very interesting…
    #61420 quote
    JohnScher
    Participant
    Veteran
    A little question about that: If programmed in this way, starting with position = 1, the number of positions would be increased by 1 after each closed position. Did I program this correctly?
    // MARTINGALE
    Once n = 1
    IF PositionPerf(1) <0 THEN
    n = n+1
    ELSIF PositionPerf(1)=0 THEN
    n = n+1
    ELSIF  PositionPerf(1) <0 THEN
    n = n+1
    ENDIF
     
    // maincode with martingale
    If mycondition then
    buy n contracts at market
    Endif
     
    
    #61422 quote
    robertogozzi
    Moderator
    Master
    Eversione should also be aware that there is a limit in how much money the market accepts! Would DAX accept a regular 1024-contract trade (about 300 milion €)? I don’t think so, thus making doubling impossible, hence making it impossible to win!
    #61427 quote
    JohnScher
    Participant
    Veteran
    @robertogozzi Well, hi. I don’t care about the sense of Martingale. I know that never ends well. Clear.   I was just want to know, Did I program this correctly? starting with position = 1, the number of positions would increase by 1 after each closed position.
    // MARTINGALE
    Once n = 1
    IF PositionPerf(1) <0 THEN
    n = n+1
    ELSIF PositionPerf(1)=0 THEN
    n = n+1
    ELSIF  PositionPerf(1) <0 THEN
    n = n+1
    ENDIF
     
    // maincode with martingale
    If mycondition then
    buy n contracts at market
    Endif
    Did I ?
    #61428 quote
    robertogozzi
    Moderator
    Master
    There’s an error within the IF…ENDIF block, you always check if positionperf is < 0!
    #61430 quote
    robertogozzi
    Moderator
    Master
    Sorry, not always < 0, but the third IF should probably read > 0. And n=n+1 for the three cases is not logically correct.
    #61436 quote
    JohnScher
    Participant
    Veteran
    That’s how it should work?  
    // MARTINGALE
    Once n = 1
    IF PositionPerf(1) <0 THEN
    n = n+1
    ELSIF PositionPerf(1) =0 THEN // special case, very rare
    n = n+1
    ELSIF  PositionPerf(1) >0 THEN
    n = n+1
    ENDIF
     
    // maincode with martingale
    If mycondition then
    buy n contracts at market
    Endif
    #61442 quote
    robertogozzi
    Moderator
    Master
    I love the comment in line 5, it still yields n = n + 1!
    JohnScher thanked this post
    #61466 quote
    Nicolas
    Keymaster
    Master
    It’s not working this way since code is read at each bar,your position size will be continuously be calculated even if you are not going to initiate a new order. You should calculate the new size one time before opening your order.
    JohnScher thanked this post
    #61505 quote
    robertogozzi
    Moderator
    Master
    Furthermore that code, JohnScher, wouldn’t double n, just increment it by one (1,2,3,4,5,6,…. not 1,2,4,8,16….). See line 9 of Doctrading‘s code.
    #63807 quote
    JohnScher
    Participant
    Veteran
    I haven’t had much time over the last few weeks to deal with the Martingale issue, but now it’s back on the table. So first answer:   You “love the comment in line 5, it still yields n = n + 1”   Answer: This is exactly what I intend to do! After every order with “n”, a new order “n+1” comes in.
    #63808 quote
    JohnScher
    Participant
    Veteran
    For what I would like to do, increasing the number by 1 after each order, this would be programmed right here? just a small example, I’m more concerned with correct programming  
    // maincode tuesday eleven o`clock on dax
    
    
    once n = 1
    
    TradingDayLong   = dayofweek = 2
    TradingTimeLong  = time = 110000 // gmt+1 !!
    
    
    c = close>open
    c1 = cci[14]>-90
    c2 = ExponentialAverage [1] (close) > ExponentialAverage [10] (close) 
    
    
    IF TradingDayLong and TradingTimeLong Then
    IF c and c1 and c2 then 
    
    IF PositionPerf(1) <0 THEN
    n = n+1
    ELSIF PositionPerf(1) =0 THEN // special case, very rare
    n = n+1
    ELSIF  PositionPerf(1) >0 THEN
    n = n+1
    ENDIF
    
    buy n contracts at market
    Endif
    ENDIF
    
    Set Stop pLoss 40
    Set Target pProfit 40
      Did I program this correctly?
    #63809 quote
    JohnScher
    Participant
    Veteran
    Yes I know classic Martingale doubled, but n+1 is a variant and there are even more variants… look here … attached or here https://de.wikipedia.org/wiki/Martingalespiel
    #63811 quote
    JohnScher
    Participant
    Veteran
    and maybe a pro again for the Martingale. you looked at a simple sine wave… here for example http://mathemio.de/trigonometrische-funktionen-zeichnen/ nothing is more suitable for a Martingale
Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.

The classical Martingale : what we should exactly NOT do !


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
Doctrading @doctrading Participant
Summary

This topic contains 16 replies,
has 6 voices, and was last updated by conwol
7 years, 5 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 05/30/2016
Status: Active
Attachments: 5 files
Logo Logo
Loading...