The classical Martingale : what we should exactly NOT do !
Forums › ProRealTime English forum › General trading discussions › The classical Martingale : what we should exactly NOT do !
- This topic has 16 replies, 6 voices, and was last updated 6 years ago by conwol.
-
-
05/30/2016 at 1:21 PM #8378
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.
12345678910111213141516171819202122Defparam cumulateorders = falseOnce n = 1IF time = 090000 THEN// MARTINGALEIF PositionPerf(1) <0 THENn = n*2ELSIF PositionPerf(1)>=0THENn =1ENDIF// ENTREEbuy n shares at marketENDIFset stop loss 0.0030set target profit 0.0030Graph n // pour visualiser la taille de "n"05/30/2016 at 2:52 PM #8388very interesting…
02/04/2018 at 1:34 PM #61420A 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: Evertytime n=n+11234567891011121314// MARTINGALEOnce n = 1IF PositionPerf(1) <0 THENn = n+1ELSIF PositionPerf(1)=0 THENn = n+1ELSIF PositionPerf(1) <0 THENn = n+1ENDIF// maincode with martingaleIf mycondition thenbuy n contracts at marketEndif02/04/2018 at 1:59 PM #61422Eversione 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!
02/04/2018 at 2:27 PM #61427Well, 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 increase with every new position1234567891011121314// MARTINGALEOnce n = 1IF PositionPerf(1) <0 THENn = n+1ELSIF PositionPerf(1)=0 THENn = n+1ELSIF PositionPerf(1) <0 THENn = n+1ENDIF// maincode with martingaleIf mycondition thenbuy n contracts at marketEndifDid I ?
02/04/2018 at 2:39 PM #61428There’s an error within the IF…ENDIF block, you always check if positionperf is < 0!
02/04/2018 at 2:43 PM #61430Sorry, not always < 0, but the third IF should probably read > 0.
And n=n+1 for the three cases is not logically correct.
02/04/2018 at 2:52 PM #61436That’s how it should work?
Martingale, allways n=n+11234567891011121314// MARTINGALEOnce n = 1IF PositionPerf(1) <0 THENn = n+1ELSIF PositionPerf(1) =0 THEN // special case, very raren = n+1ELSIF PositionPerf(1) >0 THENn = n+1ENDIF// maincode with martingaleIf mycondition thenbuy n contracts at marketEndif02/04/2018 at 4:24 PM #61442I love the comment in line 5, it still yields n = n + 1!
1 user thanked author for this post.
02/04/2018 at 6:20 PM #61466It’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.
1 user thanked author for this post.
02/05/2018 at 12:55 AM #61505Furthermore 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.
02/24/2018 at 3:16 PM #63807I 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.02/24/2018 at 3:30 PM #63808For 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
tuesday eleven o clock on dax12345678910111213141516171819202122232425262728293031// maincode tuesday eleven o`clock on daxonce n = 1TradingDayLong = dayofweek = 2TradingTimeLong = time = 110000 // gmt+1 !!c = close>openc1 = cci[14]>-90c2 = ExponentialAverage [1] (close) > ExponentialAverage [10] (close)IF TradingDayLong and TradingTimeLong ThenIF c and c1 and c2 thenIF PositionPerf(1) <0 THENn = n+1ELSIF PositionPerf(1) =0 THEN // special case, very raren = n+1ELSIF PositionPerf(1) >0 THENn = n+1ENDIFbuy n contracts at marketEndifENDIFSet Stop pLoss 40Set Target pProfit 40Did I program this correctly?
02/24/2018 at 3:35 PM #63809Yes I know classic Martingale doubled, but n+1 is a variant and there are even more variants…
look here … attached or herehttps://de.wikipedia.org/wiki/Martingalespiel
02/24/2018 at 3:39 PM #63811and 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
-
AuthorPosts