| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Martingale with "low" margin hit https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=179 |
Page 1 of 12 |
| Author: | spyderman [ Fri Dec 23, 2011 1:49 am ] |
| Post subject: | Martingale with "low" margin hit |
Some love Martingales...some hate em. I stumbled across this concept on FF and it looked intriguing. It was presented by a member going by bluestrader but he's since gone silent and doesn't appear to ever have gotten anyone to code this. Would love to have you all take a look and see if you think it might have any prospects. I like, or should I say prefer, martingales that work on PA only having to break out from a range rather then have to come back from a potential take off either up or down. Seems to me there's greater chance for success. Anyways, I liked the logic behind how he avoids the "doubling down" effect on margin...if the numbers work out that is. If you start trading .01 lots and double down you're up to 5.12 lots in 10 trades. But if you can start with .01 and multiply each order by just 1.5, you're only up to .38 in 10 trades. You'd have to round some of those up depending on your broker, but you'd still be sitting at only around .60. Hard system to manually trade so would be great to try out on an EA basis. Let's see how she goes. Attached is the short PDF. |
|
| Author: | spyderman [ Fri Dec 23, 2011 11:49 pm ] |
| Post subject: | Re: Martingale with "low" margin hit |
So to flesh this out a little bit let's look at an example. I don't know about you but I found the "language" in the pdf a little difficult to follow. We can start with a buy or sell depending on market direction filters but let's start with a buy: So, we enter a buy trade of .01 lots (or whatever MM dictates) at 1.54750 with a stop loss of 1.53750 (100 pips) and a take profit of 1.55500 (75 pips). At the time of the order a sell stop is placed 25 pips away for .02 lots at 1.54500 with a stop loss at the buys TP or 1.55500 (100 pips) and a take profit at the buy orders SL or 1.53750 (75 pips). If the buy order continues up then so be it and we take 75 pips If the market goes against us the sell order is triggered. At that time a buy stop order for .03 lots is placed at the original buy order settings. Again if price continues down we have a profit of 50 pips (.01 lot at -100 and .02 lots for total of +150 pips) If the market reverses again and the buy stop is hit a sell stop for .05 lots is placed at the original sell levels. If we hit our TP we will have a profit of 100 pips (.01 + .03 lots at a total of +300 and .02 lots at a total of -200) This process continues multiplying the previous lot size by 1.5 (and then rounding up to the next tradeable lot size) until TP is hit. The low multiplier here (1.5 vs. 2.0) is the key to keeping the inevitable blow up at a lower risk. Again with these numbers you can go through 10 cycles and still be at .38 lots. To achieve this and still be in profit when the TP is hit we have to adjust the ratio of the entries and TP/SL's so that the pip count ratio between the buy's stop loss and the sell's take profit is less than your multiplier (and vice versa). In this case the buy's SL of 100 pips divided by the sell's TP of 75 pips is 1.33333. As long as our multiplier is greater than this number we will be in profit at TP level. Compare this to a more typical scenario where we have our TP's and SL's and entries separated by an equal number of pips...say 50. You're long for .01 lot and price moves down. You have to double your lot size at every cycle to just break even when you hit TP. Doubling down you'll be at 5.12 lots in 10 cycles. For added security we could employ an early exit strategy. At some point during the trade it's likely that the trade will be at BE or in profit, although it hasn't hit its TP. If we're pretty deep into our cycles we may want to exit at that point rather than risk price turning again and continuing the cycle. I think this definitely might be worth exploring...any takers? |
|
| Author: | garyfritz [ Sat Dec 24, 2011 2:59 am ] |
| Post subject: | Re: Martingale with "low" margin hit |
I haven't thought through the logic carefully, but it seems like you're doing a nice modification of a basic Martingale, but with lower multipliers. The lower mult slows down the carnage but it doesn't stop it. The thing that scares me about Martingales is that they work fabulously in "normal" conditions -- but we don't always trade in "normal" conditions. Unusual conditions can cause them to blow up and break you. Most Martingales are built on the assumption that "I won't get a lot of losses in a row." Lots of scalping strategies might hit 90% wins, so it's unusual to have more than 2 or 3 losses in a row. But "unusual" doesn't mean "impossible." I just simulated a trading situation, and with 90% wins I never saw more than 4 losses in a row in over 100,000 trials. Then I ran another 100,000 trials and I saw one case with 6 losses. So you might think that designing your Martingale so you can survive 6 or 7 consecutive losses would be safe. **BUT**: trading systems don't always follow exact 90% winning statistics. The market can change suddenly and throw your 90% system into a losing streak far beyond what "90% wins" would suggest. I suspect that's what kills most well-designed Martingales. So what win % would you expect from this approach? How many consecutive losses could you survive? What happens if the market changes and increases your loss %? |
|
| Author: | spyderman [ Sat Dec 24, 2011 4:13 am ] |
| Post subject: | Re: Martingale with "low" margin hit |
Thanks for you insight gary. I agree the martingale angle is a bit scary. As to what the win % might be, it's definitely hard to say at this point. Using the example above the question would be, taking even a random entry how often could the price bounce back and forth between 1.53750 and 1.55500 (our take profit levels) without hitting either one. If we draw a 175 pip box then move it around on a chart, what's the longest period of time we can find where it doesn't get broke. Or maybe someone could come up with an easy test to check for any or all 175 pip ranges over a set period. Based on a brief site check it doesn't look like that would be too prevalent. Especially if you use a little common sense on pairs traded. I'll play around with the box on several pairs this weekend and see what I come up with. |
|
| Author: | garyfritz [ Sat Dec 24, 2011 7:08 am ] |
| Post subject: | Re: Martingale with "low" margin hit |
Oy. This puzzle caught me. Three hours later......... Here's an example of what I mean by "things change." Martingales really only work if your wins and losses are about the same size. (Doesn't work to take a bunch of big losses and then your win is only $1 -- even with large size that doesn't pay back all the losses.) So I took a system that normally runs around 80% wins, but the W:L ratio is small. Martingale didn't work. So I modified it to have W:L closer to 1. Win% dropped to about 50%. Without the Martingale it looked like this: Then I turned on the Martingale: The equity curve looks awesome, as long as you don't look at the soul-eating equity spikes. You end this test with $4500 profit, much better than the $800 profit without the Martingale. But that assumes you didn't go broke when it took 7 losses in a row and traded 128x normal size. AND that 128x trade was right in the middle of a string of 3 losses 1 win, 3 losses 1 win, 7 losses 1 win, 6 losses 1 win, etc. If the single win on either side of the 7-loss streak turned into a loss, you'd have had 12 or even *15* losses in a row. I don't think anybody would survive a 2^15 = 32768x loss... So that's all Martingale 101. You knew that already. The interesting point is to compare the two equity curves. You want the Martingale to help prevent losses like in the early 2011 period. But actually that's **exactly** when the market character changed, which is WHY the original system took losses there. So that's exactly where the Martingale gets murdered. That's the danger of building a Martingale on past data -- you never know if the market will change and invalidate the assumptions you built the Martingale on. ============== So, that said... Your idea is interesting. True, how many times can it bounce between A and B without hitting the TP on one side or another? It may do it enough times to break you, but maybe not with the reduced growth factor you're using. Observations: * Your losses are bigger than your wins (W:L = 75:100 if I understand right), which is usually not a good idea for a Martingale. But I think you don't take a full-size loss until you hit a TP, so that may not be a problem. * Normally you use a 2x multiplier to make back what you lost: lose 1, bet 2 to get it back and win 1. Lose 1, lose 2, lose 4, lose 8, bet 16 to get it all back and win 1. You're using a 1.5x multiplier so it seems like you wouldn't dig yourself out of your hole (which is deeper than it would have been without the Martingale) -- but your example shows your profit increasing with the # of cycles?? Again, I assume that's because you only hit the full SL when you hit a TP. * When the market finally breaks out, all your buys will win and all your sells will lose, or vice versa. So all your sells will take a full 100 pip loss, and all your buys will take a full 75 win. So you have to have at least 100/75 = 1.33x more units on the winning side than on the losing side. With a 1.5x multiplier I think you do. ============== One big problem with Martingales is that you take huge risks to make small profits. In the standard 2x example I gave above, you take huge risks to make a final profit of 1. No problem if you have unlimited funds and can survive any losing streak, but big problem if you can't. But your approach is harder to figure out. (Looong pause while I try to figure this out, give up, and knock out a spreadsheet to do the heavy lifting.) OK, I'm back. This table shows the result of using your setup -- 70pip TP, 100pip SL, 1.5 multiplier -- and taking N losses before finally taking a win. (Actually it's adding on N positions before finally hitting a TP and exiting everything.) The two cases correspond to "exiting in the direction you started" (even number of losses) and "exiting in the other direction" (odd number of losses). Add up all the W/L in all the positions you hold and you have the net profit in pips -- which is shown in the green boxes. Those values are the final profits. I didn't try to figure the mid-trade P/L. BTW these numbers don't match yours exactly because you didn't always multiply by 1.5. E.g. you went from 0.1 to 0.3. The first case is most likely, and the probability drops as you go down the chart. Bottom line, for this example, you end up winning about 55-60 pips per breakout setup, average, for most win% values. Meanwhile, to earn those 55-60 pips you start taking on some massive risk as you stack up losses. With my example above I hit 7 losses in a row. That would have gotten me up to 17x my original size. Better than 128x, but still pretty hairy. And for all that I got a whopping 98.52 pips. Many of those positions would cancel out, so your net exposure isn't as bad as your largest position size. At the larger position sizes, you end up with a net position around 60% of the max size. So after 7 losses I'm taking heat on 60% * 17 = 10.2x my original size. Can you survive that risk? Assuming you can, is it worth the average payback of about 60 pips? Do you have to size your original position so small (in order to survive the occasional losing streak) that the resulting profits just aren't worth the headache? Not sure. Might be to some, might not be to others. ============== So, back to your specific case... I don't know how you'd choose your buy/sell levels, or how you choose your initial direction, or what your expected win% is, or anything like that. The table above applies to any win%, but the final profit depends on how often you have 0 losses, 1 loss, etc. I've attached the spreadsheet I used to generate that table. You can plug in different TP / SL / win% / multiplier values and see how it works. How well you guess the initial direction, and what % of the time you break out of the trap, are almost irrelevant to the final average profit. They just change how often you get a string of losses and start taking on those big positions. Look at those values and decide if the position size you might get stuck with is worth the average profit you get from one of these breakout traps. Now if you'll excuse me, it's midnight and my brain is about to explode... Gary |
|
| Author: | r2997790 [ Sat Dec 24, 2011 9:58 am ] |
| Post subject: | Re: Martingale with "low" margin hit |
Spydr, Gary... great methodical approach, rational and reasoned Martingale analysis too. Great job! Here's an idea to throw into the mix which may or may not be useful to help tame Martingale and extend the life of the strategy before inevitably it blows up... If you have a $ TakeProfit target not a pip TakeProfit then it is possible when you increase your lot size with Martingale to also reduce your tunnel (distance to travel to TakeProfit in pips) as the $ TakeProfit target will get closer as the lot size increases. Cheers -R |
|
| Author: | spyderman [ Sat Dec 24, 2011 2:13 pm ] |
| Post subject: | Re: Martingale with "low" margin hit |
Interesting idea. You could adjust your proposed $TP to the account size like you would with pip size. Gary, Many thanks on the time and effort you've already spent. I enjoyed your analysis and will digest it over the next couple of days. Couple of things jump out. The million dollar question...if we were assuming that risk every time we use the strategy then I think the answer would be an obvious no, it's not worth it. Perhaps the better question is: "Can (or do I want to) survive that risk the one time out of umpteen in order to hit the 60 pip profit multiple times at a much lower risk. How often will my risk escalate to that point. To answer that will obviously require testing, preferably forward. Looking at the E/U daily for 2011 and drawing a rectangular box 175 pips high, there didn't seem to be any instance where PA didn't move out of the box (therefore through our TP) in a matter of a few days. On one of those occasions I broke it down as attached. We see our initial entry of .01 lots entered and price ranging back and forth for a few days hitting our buys and sell before taking profit as it exits. In this scenario we've hit 14 cycles and our last order is for 3.15 lots. Our profit on this order is 48.25 pips. To get that we've stacked up 5.63 lots on the buy side and 3.74 lots on the sell side. Pretty high exposure for the profit but much better then the 163.83 lots you'd have if you doubled each order. To minimize risk, as I mentioned in an earlier post it would be nice to factor in an escape clause so that the ea will exit all trades if you have a certain amount of lots at risk and you hit a risk/profit ratio. For example if you exited at the 1st circle you'd be in profit. If you bailed at the 2nd, perhaps near BE. This could help minimize the "death trade". |
|
| Author: | garyfritz [ Sat Dec 24, 2011 4:49 pm ] |
| Post subject: | Re: Martingale with "low" margin hit |
Yeah, I was thinking about that last night while waiting for my brain to slow down. A strategy that kicked out 60 pips every day or two would be a Great Thing, if you could run it big enough to actually make some money out of it. But if you started with 0.1 lot (to get $60 out of your trap), after 14 misses like your example, your size would be almost 300x your original size, or 30 standard lots. NOT something I'd want to risk. But what if you start with 0.01? If the traps expired fast enough -- or if you ran enough of them simultaneously -- you could pop $6 out of every trap, and your 14-miss case would be up to 3.0 lots. Still a very scary situation (to get $6 !!!) but maybe something you could tolerate. If you ran a bunch of uncorrelated pairs, maybe you could produce enough income to make it worth it, as long as several of them didn't go critical at the same time. Still, it's taking on a lot of risk for a very small reward. I like your idea of bailing when it starts to get out of control, but I've never figured out when you could do that. That would be the ultimate solution: 95% of the time you grab a quick 60 pips, and 5% of the time you find a safe place to exit without a huge loss. I haven't thought through how/where you could do that. I'd have to analyze the open profit at different points in the trap. Let's look at the case where you go long first. You hit the entry and it immediately reverses. You are immediately in a losing position. By the time it reaches the short entry, your original long is 25 pips in the hole. You go short and it reverses again. Your long position gets better but your (larger) short gets worse. Anywhere between the entries, your net position gets worse every time you add a position and reverse. At, say, the midway point your long is 1/2 * 25 = 12.5 pips in the hole, and your short is 1.5 * 12.5 = 18.75 pips negative. Your second long is 2.25 * 12.5 = 28.125 negative and your second short is 3.38 * 12.5 = 42.25 negative. So after the first reversal you're down 12.5 at the midpoint, after the second you're down 31.25, after the third you're down 59.375, after the fourth reversal you're down 101.625, etc. It keeps getting worse and there is no place to exit unscathed, at least in the killing field between the entry points. But that's actually a very good exit. It's a loss, but it doesn't happen very often, and it's very limited. You should only take 3 reversals about 6.25% of the time if you break out 50% of the time. 50% of the time you'll break out with 70, 25% of the time you'll break out with 5, 12.5% of the time you'll break out with 77.5, 6.25% of the time you'll break out with 16.25. But you might hit the midpoint again before you break out, so let's say worst-case you always hit the midpoint and exit after adding your 3rd position. So you make 50%*70+25%*5-25%*59.375 = 21.4+ pips per trade, on average. If you wait for the 4th reversal, it's 50%*70+25%*5+12.5%*77.5-12.5*101.625 = 33+ pips per trade. Average. That sounds unbelievably good. TOO unbelievably good. That's a **GUARANTEED** profit of about 33 pips per trade, with minimal and totally-contained risk exposure. That's a guaranteed risk-free money machine. I don't believe in those. Double-check my logic. Then triple-check your checks. As another option you might be able to get a better exit point outside the entry prices, but if you keep adding your position at the entry price, it might immediately reverse. You might never get to your good exit point, and keep digging yourself deeper in the hole. Risky. You could say "I will never put on more than (say) 3 positions." With a 50% success rate at escaping the trap (without adding an additional position), 3 positions should happen only 12.5% of the time. So you quit adding positions after the 3rd position, which is 2.25x larger than your original. If you eventually break out in the direction of the 3rd add, you're golden: that's the "2" line in the table and you escape with 77.50 pips profit. If you eventually break out in the opposite direction, your 1x and 2.25x positions lose 100 pips, and your 1.5x position makes 75 -- 1.5*75 - (1+2.25)*100 = -212.5 pips. If you have 50% chance of breaking out after any particular addition, then 50% of the time you make 70 (the "0" line in the chart), 25% of the time you make 5 (the "1" line), 12.5% of the time you make 77.50 (the "success" case of the "2" line), and 12.5% of the time you lose -212.5. So over the long haul you average just under 20 pips on EVERY TRADE, and you NEVER take on a position bigger than 2.25x, for a net position heat of about 1.35x your original size. If you step it up a level and never put on more than 4 positions, you're in the "3" line of the table. 50% of the time you make 70, 25% you make 5, 12.5% you make 77.5, 6.25% you make 16.25, 6.25% of the time you lose 75 * (1 + 2.25) - 100 * (1.5 - 3.38) = only -244.25!? Average is about 16.5 pips, biggest position size is 3.38x, net heat of only about 2x?? It looks to me like either of those options (exit at midpoint after Nth reversal, or never put on more than N positions and wait for a breakout) is very workable, they totally limit the risks to a very manageable level, and they GUARANTEE an average trade of about 20-30 pips. I MUST be doing something wrong. |
|
| Author: | spyderman [ Sat Dec 24, 2011 5:39 pm ] |
| Post subject: | Re: Martingale with "low" margin hit |
The only thing I know you're doing wrong is blowing my freakin' mind I'm no coder but it seems pretty straight forward. If we could get someone interested in coding it. Virtually everything could be user inputs: On original order: buy/sell, lot size, entry price, s/l distance, t/p distance EA could place subsequent stop orders automatically with user input of: multiplier ea could have an error check to make sure the multiplier is sufficient to cover the sl/tp range. Bail out: user selects how many cycles before ea looks for a BE or better exit Emergency bail out: user selects how many cycles before a forced bail out at loss. This would give us a good starting point to backtest and more importantly forward test and see if we could work out the kinks or if it is just another pipe dream. I'm going to start trading manually but it takes so long and difficult to accomplish due to not being in front of the screen when an order is hit so you can place the opposite stop order. The results will be in myfxbook sig under "Cry the Blues" |
|
| Author: | garyfritz [ Sat Dec 24, 2011 5:55 pm ] |
| Post subject: | Re: Martingale with "low" margin hit |
I don't believe in forward-testing as a way to see if a system really "works." It takes forever and you might never hit the doomsday scenario until after you go live. At this point I can't do this in Empty4. But I can do it in Tradestation. When I get some copious free time (hah!! in addition to the 6-7 hours of skull-sweat I've put into this already!) I'll code it up in TS and backtest it on several YEARS of data on a bunch of pairs. That will give us way more confidence than forward-testing it for a couple of weeks or months. And when we're talking Martingale, I want to be very VERY confident. Coding the basic 70/100/1.5 example isn't hard. How to decide when to open a trade? I think I'll just do the braindead-simple thing and say "as soon as I close out a trap, open another one centered around the current price." You could do much better than that e.g. if you only opened traps in a strongly trending market, so you hit the 70-pip winners a lot more often, but let's do the worst-case-stupid test first. Later. |
|
| All times are UTC | Page 1 of 12 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|