http://en.wikipedia.org/wiki/Snow_roller "A snow roller is a rare meteorological phenomenon
in which large snowballs are formed naturally as chunks of snow are blown
along the ground by wind, picking up material along the way, in much the
same way that the large snowballs used in snowmen are made." image source: wikipedia Linear growth of losses vs. quadratic growth of profitsImagine a grid of buy-stop orders above current price and sell-stop orders below current price, all orders having the same volume V and are placed in equal distances d and we have the simple rule that orders that have been triggered will be replaced with new stop-orders (buy above, sell below) as soon as price has moved away a distance > d in either direction: If price is moving up and triggering buy-orders the empty places below the price will now be filled with sell orders, if it moves down, triggering sell orders, then new buy-stop orders above the price will be placed. A simple Metatrader 4 EA will be provided here to assist in placing the orders and calculating and plotting the profit in real time. Limit orders and pyramiding lossesAt a first glance this might look like yet another variant of the infamous grid system which is responsible for uncounted losses and margin calls. The conventional grid trading systems make use of limit orders for market entry and exit, they immediately scale out a constant volume V as soon as price moves into trading direction a fixed grid distance d and they scale into the losing trade the same volume V every time price moves another d against the trading direction, hoping price will eventually return and allow to scale out again. This method will produce a constant stream of linear growing profits, only interrupted by occasional bankrupts due to the quadratic growth of accumulated losses if market price decides to NOT return to where it has been before.Some people claim to be able to overcome this drawback by simply running the same grid into the opposite direction on the same instrument at the same time, applying what they falsely call "hedging", but it turns out that this is obviously a fatal fallacy. Naturally you can not hedge a quadratically growing loss on one side with an only linearly growing profit on the other side. Furthermore it turns out that these two superimposed grids on the same instrument, if all orders and market exposure is simply added together you will again end up with the very same grid of limit orders, only this time you have created a grid that will automatically switch net trading direction always to your disadvantage and will always pyramid up the losses, no matter where the market decides to go. Congratulations! You have just doubled your chances to receive margin call from 50% to 100%. Stop orders and pyramiding profitsBack to the system proposed in the first paragraph. We will not take profit every d pips, instead we will let our profits run and even add to the winner the constant volume V every d pips, and we will not accumulate floating losses if market goes against us, instead we will have stop orders immediately scale out the same volume V every d pips if price reverses and goes against us.I will refer to this system with only stop-orders as an anti-grid in contrast to what is commonly understood as a grid. This name is natural as it will express the same relationship that is found between martingale and anti-martingale and in the same way a conventional grid is related to a martingale-like bet progression, the anti-grid is related to anti-martingale. If we start our anti-grid and price now goes up n * d pips and then returns n * d pips to where it started we will have made a loss proportional to n * d * V. It will have triggered our stop-loss¹ n times, each time giving us the same loss of V times our fixed distance d. The conventional Grid would instead have scaled into a (dangerously losing) sell n times and on the (lucky) way down taken profit n times the amount of V * d, which is the exact opposite of our system. The conventional gridder² may now laugh about us because he is making small profits while we are making small losses. But what if price, instead of being so friendly to always come back to the gridder's comfort-zone (more on this later), just one time decides to start trending? His laughter would soon die in his throat! Parabolas in the chartAs time goes by and price is moving up and down in its daily range, day in and day out, trending or ranging, our anti-grid will produce a more or less constant stream of stop-loss hits¹ with always the same amount of loss, thus we can regard our losses as growing linearly with time. If we plot our account equity (realized + floating) into a chart we will see a more or less straight line pointing downwards, occasionally interrupted by impressive spikes pointing upwards.A very similar line can be witnessed in a conventional grid. Here this line is going slowly upwards, occasionally interrupted by nasty downward spikes that have the potential to wipe out the entire account. The conventional gridder, blinded by some protective mechanisms in his brain, his hopes and greed and the ability of mainstream retail trading platforms like Metatrader to make an account statement still look positive even if it is on the brink of margin call, will see his upwards directed line of realized profits and completely ignore the scary drawdown-spikes in floating losses that often go far beyond his initial starting capital. Now what has this all to do with parabolas in the chart? We already know that our losses are growing linearly with time. We can describe this simply as loss ~ t where the proportionality constant would depend on grid spacing, spread, lot size and certain (hopefully more or less constant) properties of the price series. But what about the profits? Since we never close a winning trade we will end up with as many profitable trades as price has gone away from our starting price in multiples of our grid spacing d. This is clearly not a function of time, price may move anywhere or just keep ranging, but we might want to know how far price would have to move to compensate our losses. Let n be the number of levels we want price to move. We can easily see that the floating profit would have the following proportion: profit ~ (1 + 2 + 3 + ... + n) which can be written as profit ~ n * (n +1) / 2 which is a quadratic function, and for our needs and simplicity's sake we just may approximate this with the much simpler expression profit ~ n² and since n * d ≈ (p - p0) we can again make a little approximation and write this as profit ~ (p - p0)² Now we want to know where our break-even point is, our losses will grow and so will the needed break even price move away over time. Lets see how the function might look like. Break even is defined as: profit = loss and if we substitute profit and loss with the above equations and introduce some proportionality constant a we now can see that there is a simple function that will express the relationship between the elapsed time since our anti-grid started and the price move that is now needed to break even: (p - p0)² = a * t this is a quadratic equation and we can solve for p: p = p0 ± √(a * t) Now we have something that we can plot into the chart, or at least imagine how it would look like in a price chart: It is a horizontal parabola, having its vertex at the starting point of our anti-grid and opening to the right! The same calculations apply to conventional grids also, only profit becomes loss and loss becomes profit here, the parabola remains (almost) the same. (almost because the spread is always working towards increasing the loss, so we might arrive at different values for a.) The constant a is something that needs to be determined experimentally, it depends on our grid spacing, the spread and the "roughness" of the price curve, its fractal dimension. the term a * t expresses the linear growth of losses that have to be overcome by a price movement p - p0 and the pyramided (quadratic) profits (p - p0)² that come along with it. This is an interesting finding! We can now come to the following conclusions:
Snow rollersAnd what has all this to do with snow rollers?
The mass of a snow roller, the distance it must have been rolled is
proportional to the square of the number of its layers and the energy
you would need to unroll it back up the hill or the potential energy
that is released when rolling downhill is proportional to the square of
the distance it has rolled, just like the losses of the grid or the
profits of the anti-grid are proportional to the square of the distance
price has moved.The Expert AdvisorAttached at the end of this page is an Expert-Advisor for Metatrader 4. Many people don't like to read instructions, but please read at least this part of the document completely and carefully, you must completely understand it. This EA is not an automated strategy! It is a trade management EA! It has start and stop buttons. You decide about the begin and the end of a pyramiding cycle. Don't even try to run an automated backtest. You can to some degree simulate manual trading in visual testing mode but automated tests don't make any sense. The EA will help automatically placing the stop-orders for the anti-grid, plotting the profit into a candle-chart and closing all trades either with a mouse click or automatically when a certain line drawn into the chart is reached. It will allow you to either trade the anti-grid bidirectionally to profit from a breakout in any direction or in a certain trading direction only. You must enable "allow DLL imports" and uncheck "confirm DLL calls" or the EA will not work. It needs to import the PostMessage() function from the Windows API to update the equity chart. The EA has 4 modes: "stopped", "long", "short" or "bidirectional". If you attach the EA to a chart the first time it will be stopped which is also displayed in the upper left corner and you will see 3 green text labels in the upper right corner. These 3 labels are the 3 start buttons. To activate one of them first double-click to select it and then drag it a few pixels away (I'm sorry, but this is the only way to make buttons in mql4). The EA will then immediately switch into the selected trading mode (which is also displayed in the upper left corner) and begin to place the pending orders and trade until you stop it (you will now see a red stop-button in the upper right corner). If you double-click and drag the red stop button it will immediately close all open trades and switch back into the stopped mode. The current mode and state of the EA is stored in global variables, so it will survive a restart of MT4 without any problems. The EA has a few hidden extra features: It will plot a realtime equity chart, updated on every tick, containing all profits and losses (floating + realized). To view this chart chose File | Open Offline from the Metatrader menu and select the chart with the name starting with "snow". It will always be a H1 chart, no matter which timeframe you have put your EA on. If you draw a line (or two) into the chart and write the word stop into its description then the EA will recognize this line (these lines) and close all trades and stop trading as soon as price crosses this line. (After such a line has been hit it will rename it to stop triggered and the line will be inactive, so don't forget to change it back to stop if you want to use the same line a second time. You can enable "show object descriptions" in the chart properties to always see the descriptions of the lines directly in the chart) Trading with this EATrading with this EA basically works like this: You put it onto a chart and have it waiting in stopped mode and as soon as you see a setup (an imminent breakout or a bounce) you start the appropriate mode (long, short or bi) and then monitor the price chart and the profit chart and wait for the best possible exit where you then will actuate the stop button to close all trades. Alternatively you may make use of the stop line as described above to stop it automatically at a certain level.Please test the EA on demo for a few weeks before you take it live to get an impression of how big the losses and the profits will be. ______ ¹ A sell-stop while being long or a buy-stop while being short is equal to a stop-loss order, so we can for the purpose of trading replace all combinations of entry and exit orders, no matter how complicated, with a flat model of simple pending buy and sell orders and for the purpose of making it more descriptive when thinking about it we may think of it as individual trades with their own take-profit and/or stop-loss orders and it will not make any difference. ² gridder: retail trader slang, a trader trading one or more conventional limit-order grids, in most cases without fully understanding them and usually compensating this knowledge gap with permanent whining about non-"hedging" and FIFO rules and other non-problems. The .ex4 version will run standalone, no additional files are needed. If you use the .mq4 instead to compile from source and get any compile errors then make sure you have all the latest versions of all needed include files (also downloadable from this website, see the site navigation to the left). Even if you don't get errors it is a good idea to have all files always at the latest versions, so check the version numbers from time to time and if you update one of them, update all the others too. The file dates and numbers below next to the downloads are only some internal counter of this website CMS, they are not the official file version numbers. current EA version number is: 2010.6.11.1 |