Grid Settings & MMThis script is designed to help you plan your grid trading or when averaging your position in the spot market.
The script has a small error (due to the simplification of the code), it does not take into account the size of the commission.
You can set any values on all parameters on any timeframe, except for the number of orders in the grid (from 2 to 5).
The usage algorithm is quite simple:
1. Connect the script
2. Install a Fibo grid on the chart - optional (settings at the bottom of the description)
3.On the selected pair, determine the HighPrice & LowPrice levels and insert their values
4.Evaluate grid data (levels, estimated profit ’%’, possible profit ‘$’...)
And it's all)
Block of variables for calculating grid and MM parameters
Variables used regularly
--- HighPrice and LowPrice - constant update when changing pairs
--- Deposit - deposit amount - periodically set the actual amount
Variables that do not require permanent changes
--- Grids - set the planned number of grids, default 5
--- Steps - the planned number of orders in the grid, by default 5
--- C_Order - coefficient of increasing the size of orders in the base coin, by default 1.2
--- C_Price - trading levels offset coefficient, default 1.1
--- FirstLevel - location of the first buy level, default 0.5
--- Back_HL - number of candles back, default 150
*** For C_Order and C_Price variables, the value 1 means the same order size and the same distance between buy levels.
The fibo grid is used for visualization, you can do without it, ! it is not tied to the script code !
You can calculate the levels of the Fibo grid using the formula:
(level price - minimum price) / (maximum price - minimum price)
For default values, grid levels are as follows:
1 ... 0.5
2...0.359
3 ... 0.211
4...0.0564
5...-0.1043
Short description:
in the upper right corner
--- indicator of the price movement for the last 150 candles, in % !!! there is no task here to "catch" the peak values - only a relative estimate.
in the upper left corner
--- total amount of the deposit
--- the planned number of grids
--- “cost” of one grid
--- the size of the estimated profit depending on the specified HighPrice & LowPrice
in the lower left corner
--- Buy - price levels for buy orders
--- Amount - the number of purchased coins in the corresponding order
--- Sell - levels of profit taking by the sum of market orders in the grid
--- $$$ - the sum of all orders in the grid, taking into account the last active order
--- TP - profit amount by the amount of orders in the grid
GRID
Dynamic ATH Grid
Indicator to profit all market movements.
The idea behind this indicator is:
- to sell 1% if price reach upside line
- to buy 1% if price reach downside line
This going to take profit from volatility of market.
Use only in the most reliable values, it have risk in less reliable values
- In cases of big crashes / going to 0, it will make loose your capital (exactly as if you have hold )
More indicators will be added.
Thanks for all
ATR Day Grid by RSUATR at the daily and intraday prompt lines, it is recommended to trade within 50%, and if it exceeds 50%, there is a risk of chasing high.
At the minute level,Day-level ATR grid line is displayed.
GRID SPOT TRADING ALGORITHM - GRID BOT TRADING STRATEGYGRID SPOT TRADING ALGORITHM : LONG ONLY STRATEGY OPEN SOURCE
This is a long only strategy for spot assets.
HOW IT WORKS
Grid trading is a trading strategy where an investor creates a so-called "price grid". The basic idea of the strategy is to repeatedly buy at the pre-specified price and then wait for the price to rise above that level and then sell the position (and vice versa with shorting or hedging).
FEATURES
Grids: This algorithm has a total of 10 grids.
Take profit: The trader can increase or decrease the distance between the grids from the User Interface panel, the distance between one grid and another represents the take profit.
Management: The algorithm buys 10% of the capital every time the price breaks down a grid and sells during a rise to the next higher grid. The initial capital is invested in 10 sizes which represent 10% of the capital per trade.
Stop Loss: The algorithm knows no stop loss as long as it is not activated from the User Interface panel. By activating the stop loss from the User Interface panel the algorithm will insert a close condition on all trades which will be calculated from the last lower grid.
Trades: Trades are opened only if the price is within the grid. If the market leaves the grid the algorithm will not buy new positions or sell new positions.
Optimal market conditions: The favorable market for this algorithm is the sideways market.
LIMITATIONS OF THE MODEL
The trader must take into account that this is a static model. It only works perfectly well if the market is in a sideways phase and incurs heavy losses if the market takes a downward trend. The model is unusable for an uptrend. The trader must therefore carefully analyze the market where he intends to use this strategy, making sure that the price is in a sideways phase.
USES
Indispensable research and backtesting tool for those using bots for their investments. The algorithm produces a backtesting of the strategy for past history. It is used by professional traders to understand if this strategy has been profitable on a market and what parameters to use for bots using this strategy (Kucoin, Binance etc.).
If you would like to develop your own algorithm with customized conditions based on a grid strategy, please contact us.
If you need help in using this tool, please contact us without hesitation.
Fibonacci Grid [LuxAlgo]The following indicator returns multiple diagonal lines forming a grid. Each line has 45-degree and is set depending on Fibonacci ratios as well as the maximum and minimum price value over a certain lookback period. These can be used as potential support and resistance.
Users also have the option to set equidistant lines instead of having them determined by Fibonacci ratios.
Settings
Length: Lookback period for determining the maximum/minimum price value used for constructing the grid.
Resolution: Grid resolution, higher values will return more lines (only available when the "Use Fibonacci Ratios" is disabled)
Use Fibonacci Ratios: Set the lines based on Fibonacci Ratios, 6 ratios are used.
Usage
Each individual diagonal line can be used as support/resistance. Two Diagonal lines form channels where the price might evolve until a breakout.
The underlying logic of this grid determined by Fibonacci ratios is that price variations farther away from the main diagonals (in orange) would tend to move inside tighter channels.
Diagonals set using Fibonacci Ratios will form tighter channels when away from the center of the Lookback area. While equidistant lines will keep the same distance between each line.
3commas GRID bot VisualisationHello everyone
This is a grid display indicator for a 3-comma grid bot.
Just enter the upper and lower borders of your grid and the number of grid cells in the indicator settings.
It's simple!
Percentage Range IndicatorThe Percentage Range Indicator is useful for assessing the volatility of pairs for percentage-based grid bots. The higher the percentage range for a given time period, the more trades a grid bot is likely to generate in that period. Conversely, a grid bot can be optimised by using grids that are less than the Percentage Range Indicator value.
I have been using the Percentage Range Indicator based on the one hour time period and 168 periods of smoothing (seven days based on one-hour periods).
Enjoy.
Intraday Grid trading exampleHello everyone,
This was a grid trading example for intraday trading.
Please be advised that every commodity have diferent kind of reaction and rate of change between periods therefore the percentages need to be adjusted acording to the commodities change %.
In order to specify the adjustment rate we add the Zig Zag in the script.
For Example ;
Last 3 days zigzag high points are %25 , %13 and %8 , the average %is about %9 therefore you have to put the adjustment ratios something like;
Z%1 = %3
Z%2 = %6
Z%3 = %9
Feel free to use the script with caution( it was not a investment advice), this was only a example of grid trading strategy on our trading platform.
Regards.
Fear Of Missing Out grid of forex tradingAbstract
This script finds potential safe grids placing limit orders without fear of missing out.
This script computes grids according to power of 1.0025 .
You can reference those price levels for your trading.
Introduction
Grid trading is a popular trading method.
Traders plan several price levels as grids and repeat buying at lower grids and selling at higher grids.
Grids can be round number like multiple of 100 pips.
Grids can also be support and resistance according to price history.
Some traders may think they need to adjust grids to trade.
However, there are several problems in choosing grids.
One problem is rate of change is related and therefore exponential. 20 to 30 is different from 30 to 40.
Another interesting point is there are some special impressing reversal price levels.
Several months ago, I had a question why usdjpy bounced near 108.3 .
After using a calculator, I found that 108.3 = 100 * 1.083 ≒ 100 * pow(1.0025,31) .
1.0025 , as known as 0.25% of change, is a potential stop out zone.
Therefore, we can compute grids and one grid is a little more than 1.0025 times than an another one.
After we finished computing grids, we can consider buy and sell near those grids.
Note that different traders may obtain different grid values.
For example, from 1.0 to 2.0 , it can be splited as 270 grids or 277 grids because pow(1.0025,277)<2 .
Those grids cannot always imply potential reversal points but they can be useful for traders looking for 0.25% profit targets with reducing fearing of buying or selling too early.
Computing grids
This script split from 1.0 to 10.0 into three segments.
One is 1.0 to 2.0 .
The second segment is from 2.0 to 5.0 .
The third segment is from 5.0 to 10.0 .
This script does the same thing for 0.1 to 1.0 , 10.0 to 100.0 , and so on.
For 1.0 to 2.0 and 5.0 to 10.0 , this script split a segment as 270 grids.
For 2.0 to 5.0 , this script split a segment as 360 grids.
The last step is display the next grids to the daily low and daily high.
Maybe also display the grids behind grids shown.
Parameters
x1,x2,x3,x4 : display the next x1,x2,x3,x4 grids to daily high and daily low. 1 means the next grid to daily high and daily low. 2 means the next grid to 1.
x_seg : default 2.0 . This script split from 1.0 to 10.0 into three segments. One is 1.0 to x_seg. The second segment is from x_seg to 10.0/x_seg . The third segment is from 10.0/x_seg to 10.0 .
x_grid1 : how many grids in the first segment
x_grid2 : how many grids in the second segment
x_lowprice : add this number for bigger grid distance. Generally, you don't need this number when trading forex but you may need it in stock trading. For stocks with price between 50 to 100, I recommend you use x_lowprice=100.
Conclusion and suggestions
This script can find potential grids for trading.
If price touches grids usually, we can consider buy and sell after price touches grids.
If price reverses before touching grids usually, we may consider buy and sell before price touches grids.
Those grids can remind us don't buy too much unless the price touches the next grid.
For instruments with less volatility, maybe we need more grids.
For traders with more money, they may also consider more grids for more dedicated range trading to collect more profit.
Reference
Sorry, I forgot them.
Volatility Adjusted Grid [Gann]█ OVERVIEW
Gann Square of 9 is one of the many brilliant concepts from W.D.Gann himself where it revolves around the idea that price is moving in a certain geometrical pattern. Numbers on the Square of 9 spiral tables, especially those lie in every 45degree in the chart act as key vibration levels where prices have tendency to react to (more on the table below).
There are few square of 9 related scripts here in Tradingview and while there's nothing wrong with them, it doesn't address 1 particular issue that i have: The numbers can be too rigid even when scaled based on current price because the levels are fixed, which makes them not tradable on certain timeframes depending on where the price currently sitting.
Heres 5min and 1hour Bitcoin chart to illustrate what i mean: Grey line on the left is based on Volatility Adjusted levels, while red/blue on the right are the standard Gann levels.
You can see that on 1hour chart, it provides a good levels (both Volatility Adjusted and the standard one happened to share the same multiplier in this case),
1Hour Chart:
On 5 min chart tells a different story as the range between blue/red levels can be deemed as to big for a short term trade, while the grey line is adjusted to suit that particular timeframe (You can still adjust to make it bigger/smaller from the settings, more on this below)
5Min Chart:
█ Little bit on Gann Square of 9 table
This is the square of nine table, the numbers highlighted in Red are known as Cardinal Cross and considered to be a major Support/Resistance while those in Blue color are known as Ordinal Cross considered as minor (but still important) Support/Resistance levels
Similarly, this script use these numbers (and certain multipliers) to print out the levels, with Cardinal numbers represented by solid lines and Ordinal numbers by dotted lines.
█ How it Works and Limitations
The Volatility Adjusted grid will go through several iterations of different multipliers to find the Gann number range that is at least bigger than times ATR. Because it's using ATR to determine the range, occasionally you'll notice that the line become smaller as ATR contracting (and vice versa). To overcome this, you can change the size range multiplier from the settings to retrieve the previous range size.
Use the size guide at the bottom left to find the multiplier that suits your need:
1st Row -> Previous Range -- Change Range Size to number lower than this to get a smaller range
2nd Row -> Next Range -- Change Range Size to number higher than this to get a larger range
Example:
Before:
After:
As you'll soon realise, the key here is to find the range that fits the historical structure and suits your own strategy. Enjoy :)
█ Disclaimer
Past performance is not an indicator of future results.
My opinions and research are my own and do not constitute financial advice in any way whatsoever.
Nothing published by me constitutes an investment recommendation, nor should any data or Content published by me be relied upon for any investment/trading activities.
I strongly recommends that you perform your own independent research and/or speak with a qualified investment professional before making any financial decisions.
Any ideas to further improve this indicator are welcome :)
7-RSI strategyHello, I've only been trying to learn PineScript for two months on my own, here I am posting a version of the strategy for a grid bot with 20 orders, order size 5%, earlier I tried to find something similar, but could not. Perhaps others, those who, like me, are just starting to learn PineScript, will find something useful. In the process of using grid bots, I noticed that the RSI indicator is sufficient, so the strategy uses 7 RSI indicators on different timeframes, but it is not necessary to use all 7, usually 3 is enough, therefore, by default, the RSI values are set to limit so that there is no effect on the settings of others. The step between bot orders is set in the settings. The code can of course be simplified, but it's better for understanding, I think.
Gridimus MaximusGridimus Maximus draws N grid lines stepping by price or percent in chosen direction from set price, or draws N grid lines stepping by pivots.
The queue function method used is adapted from an example provided on the PineCoders website, much gratitude to LucF for this gem!
To prevent grid lines out of range from causing chart to rescale right click on chart's price column and enable Scale Price Chart Only.
Pictured example above is using Type Of Increment: Steps By Pivot, Number Of Steps: 5.
Pictured example below is using Type Of Increment: Steps By Price, Number Of Steps: 6, Starts From Price: $10k, Steps By Percent Or Price: $10k.
Pictured example below is using Type Of Increment: Steps By Percent, Number Of Steps: 7, Starts From Price: $10k, Steps By Percent Or Price: 33%.
NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
MA+ ROC MTF DashboardThis is a Multi Timeframe moving average ROC (percent of change) dashboard.
This dashboard shows percent of change of current price to a moving averages on different time frames.
Most left value in the dashboard always represents your chart time frame, while the next 3 represent other time frames which you can set in 'MA+ ROC' settings.
Support User Defined time frames or automatic time frames based on a multiplier value.
Better define same or higher time frames than your chart time frame to get accurate results.
Can work in conjunction with MA+ to display the moving average line, click here:
Like if you Like and follow-up for up coming new indicators: www.tradingview.com
Grid bot development I have completed the next stage of my grid bot which is to isolate the instances in which the market will move sideways in a narrow range.
Rudimentary Grid bot ideaUsing Eulerian principles yet again, this is the beginning of my first grid bot script. Use as static S&R when trading manually. Good for SL and TP setting too.
(IK) Grid ScriptThis is my take on a grid trading strategy. From Investopedia:
"Grid trading is most commonly associated with the foreign exchange market. Overall the technique seeks to capitalize on normal price volatility in an asset by placing buy and sell orders at certain regular intervals above and below a predefined base price."
This strategy is best used on sideways markets, without a definitive up or down major trend. Because it doesn't rely on huge vertical movement, this strategy is great for small timeframes. It only goes long. I've set initial_capital to 100 USD. default_qty_value should be your initial capital divided by your amount of grid lines. I'm also assuming a 0.1% commission per trade.
Here's the basic algorithm:
- Create a grid based on an upper-bound (strong resistance) and a lower-bound (strong support)
- Grid lines are spaced evenly between these two bounds. (I recommend anywhere between 5-10 grid lines, but this script lets you use up to 15. More gridlines = more/smaller trades)
- Identify nearest gridline above and below current price (ignoring the very closest grid line)
- If price crosses under a near gridline, buy and recalculate near gridlines
- If price crosses over a near gridline, sell and recalculate near gridlines
- Trades are entered and exited based on a FIFO system. So if price falls 3 grid lines (buy-1, buy-2, buy-3), and subsequently crosses above one grid line, only the first trade will exit (sell-1). If it falls again, it will enter a new trade (buy-4), and if it crosses above again it will sell the original second trade (sell-2). The amount of trades you can be in at once are based on the amount of grid lines you have.
This strategy has no built-in stop loss! This is not a 'set-it-and-forget-it" script. Make sure that price remains within the bounds of your grid. If prices exits above the grid, you're in the money, but you won't be making any more trades. If price exits below the grid, you're 100% staked in whatever you happen to be trading.
This script is more complicated than my last one, but should be more user friendly. Make sure to correctly set your lower-bound and upper-bound based on strong support and resistance (the default values for these are probably going to be meaningless). If you change your "Grid Quantity" (amount of grid lines) make sure to also change your 'Order Size' property under settings for proper test results (or default_qty_value in the strategy() declaration).
Grid SystemThis script plots a a square composed of 8 equilateral triangles ("grid"). User can set the frequency of calculation/interval by adjusting the 't' parameter.
Steps for calculating grid:
1. Find the highest high and lowest low for last 't' periods.
2. Calculate midpoint for prices during that interval (highest high + lowest low) / 2.
3. Center of the grid = {time , price midpoint}.
Interpretation:
Volatility : If price is volatile for a given period, the area of the grid will expand, since the top and bottom sides are based on the highest high and lowest low for the period. So as range for a given period increases, the grid's area increases.
Support and resistance : The grid's center line often acts as the support / resistance line.
Trend Following : The example chart shows Cognex (CGNX) price using an interval of t=365. When the stock's trend was bullish, the area of the grids became increasingly larger and the y-coordinate of each grid was greater than that of the previous grid.
Grid Bot RSIGrid Bot Simulator. Based on RSI levels.
How it works:
Prices are divided into grids, or trade zones, that are based on RSI levels. Buys will trigger when the RSI crosses into a higher zone, after descending. Sells will trigger when the RSI crosses into a lower zone, after ascending. After triggering, a new signal will not be produced until the RSI progresses into better zone.
Standard Settings :
RSI Length
Number of Grids
RSI Type : Standard RSI or Jurik RSX (based on Everget’s formula)
Show All Grids
Experimental Features (Adjust in settings menu) :
No Trade Zone : RSI Levels where no trades will be signaled. Adjust to prevent over-buying/selling in narrow markets. Default: 35-65:
No Trade Zone (40-60)
Aggression Level : Increase aggressiveness to stack buys/sells at extreme RSI levels:
Aggression = high
Aggression = low
Market Direction : If market is trending up, the bot will skip every other sell ( = more buys than sells). If down, will skip every other buy (more sells than buys). Default: neutral.
Market Direction: down
Market Direction: neutral
Grid Bot SimulatorThis script is a grid bot simulator for ranging/choppy markets. Prices are divided into grids, or trade zones, that will trigger signals each time a new zone is entered. During ranging markets, each transaction is followed by a “take profit.” As the market starts to trend, transactions are stacked (compare to DCA), until the market consolidates. No signals are triggered above the Upper Limit or Below the Lower Limit.
Settings overview:
Upper Limit/Lower Limit : Highest and Lowest values for entire grid.
Number of Grids : Number of trade zones.
Show Grids : Show or hide all gridlines.
Show Only Current Grids : Only display the grids just above and just below the current trade zone.
High/Low for signals : If enabled, signals are triggered as soon as the price touches the next zone. If disabled, signals are triggered after bar closes. Enable this for “Once Per Bar alerts. Disable for “Once Per Bar Close” alerts.
Highlight Trade Zones
The grid bot should work well during ranging/choppy markets. Each zone will have only one trade, and then will immediately take profit in the next zone.
Ranging/Choppy Market
However, trending markets can produce multiple signals in rapid succession:
Trending Market
If the gridlines are compressing the chart space, enable the “Show Only Current Grids” in settings.
Show Only Current Grids disabled
Show Only Current Grids enabled
When changing symbols, adjust the Upper and Lower Limits to accommodate the new symbol. Otherwise, the chart will look compressed.
XBTUSD chart with ETHUSDT settings
The bot is a proof-of-concept and is considered experimental . Possible future updates will include Fibonacci grids and “smart entry/exits,” depending on the current trend. Comments and suggestions are encouraged.
[RS]Supertrend GridDynamic grid system based on supertrend.
note: the input nlines/nfractions are not locked so if values too high might start overlapping line objects.
Grid System With Fake MartingaleThe proposed strategy is based on a grid system with a money management that tries to replicate the effect of a martingale without having to double your position size after each loss, hence the name "fake martingale". Note that a balance using this strategy is still subject to exponential decay, the risk is not minimized, as such, it would be dangerous to use this strategy.
For more information on the martingale and grid systems see:
Strategy Settings
Point determines the "grid" size and should be adjusted accordingly to the scale of the security you are applying the strategy to. Higher value would require larger price movements in order to trigger a trade, generating fewer trades as a result.
The order size determines the number of contracts/shares to purchase.
The martingale multiplier determines the factor by which the position size is multiplied after a loss, using values higher to 2 will "squarify" your balance, while a value of 1 would use a constant position sizing.
Finally, the anti-martingale parameter determines whether the strategy uses a reverse martingale or not, if set to true then the position size is multiplied after each win.
How It Works
Let's illustrate how we replicate a martingale without doubling our exposure with a simple casino example. Imagine you are playing roulette, and that you are betting on colors (black/red), your payout is 1 to 1, in the case you win, you will have your initial stake back plus a profit equal to your initial stake.
If your strategy is to recover any previous losses, you can double your stake each time you lose, once you win you will get back the previous losses plus a profit equal to your original stake, this is the martingale system. So how can we win back previous losses without having to double our stake? We could do that by doubling the payout ratio after a loss, so after a loss, we must use a payout ratio of 2:1, if we lose once again we must use a payout of 4:1...etc, our payout ratio would be subject to exponential growth instead of our stake.
Of course, the payout ratio is fixed with casino games, but in trading, we can manipulate the position of our take profit in order to replicate such effect, this is what this strategy is doing. So after a loss, we place our take profit such that a win recover our losses back plus generate a profit.
Advantages
The advantage of this approach is that unlike the martingale we don't double our position size, which instead can remain constant, this is a huge advantage as a martingale will require a significant capital in order to tank a series of losses.
Disadvantages
The main disadvantage of this method is that the price might never reach our take profit after a long losing streak, our balance would remain in the red and we couldn't do anything about it except reset the strategy.
Frictional costs are still a disadvantage, as such, we would need to place our take profits in order to account for them, while this is still better than purchasing additional shares, it minimizes the chances of the price reaching the take profit.
Conclusions
An alternative money management system replicating the effect of a martingale as been presented, we can see that such a system is far from being perfect, and it would be foolish to use it, however, it stills offer a convenient alternative to less aggressive progressive position sizing systems.
I have been receiving some messages from users criticizing me for exposing the martingale money management system, and I understand why but I can't agree, talking about it allow me to warn users against it, the grid-martingale methodology is will create more harm than anything else, the reward is only one side of the story and should always be compared against the risk, so always take a look at all the statics in a backtest.
Thanks for reading!
Shout-Out
This post was made possible thanks to my patrons:
@Happymono, @AmariMars, @kkhaial, @Nugehe, @LucF, @Nosmok, @iflostio, @DankBeans, @ecletv, @Neverstorm, @alex.crown.jr, @uk503, @xkingshotss, @vsov, @jbelka, @yatrader2, @hughza, @ganh
Grid Like StrategyIt is possible to use progressive position sizing in order to recover from past losses, a well-known position sizing system being the "martingale", which consists of doubling your position size after a loss, this allows you to recover any previous losses in a losing streak + winning an extra. This system has seen a lot of attention from the trading community (mostly from beginners), and many strategies have been designed around the martingale, one of them being "grid trading strategies".
While such strategies often shows promising results on paper, they are often subjects to many frictions during live trading that makes them totally unusable and dangerous to the trader. The motivations behind posting such a strategy isn't to glorify such systems, but rather to present the problems behind them, many users come to me with their ideas and glorious ways to make money, sometimes they present strategies using the martingale, and it is important to present the flaws of this methodology rather than blindly saying "you shouldn't use it".
Strategy Settings
Point determines the "grid" size and should be adjusted accordingly to the scale of the symbol you are applying the strategy to. Higher value would require larger price movements in order to trigger a trade, as such higher values will generate fewer trades.
The order size determines the number of contracts/shares to purchase.
The martingale multiplier determines the factor by which the position size is multiplied after a loss, using values higher to 2 will "squarify" your balance, while a value of 1 would use a constant position sizing.
Finally, the anti-martingale parameter determines whether the strategy uses a reverse martingale or not, if set to true then the position size is multiplied after any wins.
The Grid
Grid strategies are commons and do not present huge problems until we use certain position sizing methods such as the martingale. A martingale is extremely sensitive to any kind of friction (frictional costs, slippage...etc), the grid strategy aims to provide a stable and simple environment where a martingale might possibly behave well.
The goal of a simple grid strategy is to go long once the price crossover a certain level, a take profit is set at the level above the current one and stop loss is placed at the level below the current one, in a winning scenario the price reach the take profit, the position is closed and a new one is opened with the same setup. In a losing scenario, the price reaches the stop loss level, the position is closed and a short one is opened, the take profit is set at the level below the current one, and a stop loss is set at the level above the current one. Note that all levels are equally spaced.
It follows from this strategy that wins and losses should be constant over time, as such our balance would evolve in a linear fashion. This is a great setup for a martingale, as we are theoretically assured to recover all the looses in a losing streak.
Martingale - Exponential Decays - Risk/Reward
By using a martingale we double our position size (exposure) each time we lose a trade, if we look at our balance when using a martingale we see significant drawdowns, with our balance peaking down significantly. The martingale sequence is subject to exponential growth, as such using a martingale makes our balance exposed to exponential decays, that's really bad, we could basically lose all the initially invested capital in a short amount of time, it follows from this that the theoretical success of a martingale is determined by what is the maximum losing streak you can endure
Now consider how a martingale affects our risk-reward ratio, assuming unity position sizing our martingale sequence can be described by 2^(x-1) , using this formula we would get the amount of shares/contracts we need to purchase at the x trade of a losing streak, we would need to purchase 256 contracts in order to recover from a losing streak of size 9, this is enormous when you take into account that your wins are way smaller, the risk-reward ratio is totally unfair.
Of course, some users might think that a losing streak of size 9 is pretty unlikely, if the probability of winning and losing are both equal to 0.5, then the probability of 9 consecutive losses is equal to 0.5^9 , there are approximately 0.2% of chance of having such large losing streak, note however that under a ranging market such case scenario could happen, but we will see later that the length of a losing streak is not the only problem.
Other Problems
Having a capital large enough to tank 9any number of consecutive losses is not the only thing one should focus on, as we have to take into account market prices and trading dynamics, that's where the ugly part start.
Our first problem is frictional costs, one example being the spread, but this is a common problem for any strategy, however here a martingale is extra sensitive to it, if the strategy does not account for it then we will still double our positions costs but we might not recover all the losses of a losing streak, instead we would be recovering only a proportion of it, under such scenario you would be certain to lose over time.
Another problem are gaps, market price might open under a stop-loss without triggering it, and this is a big no-no.
Equity of the strategy on AMD, in a desired scenario the equity at the second arrow should have been at a higher position than the equity at the first arrow.
In order for the strategy to be more effective, we would need to trade a market that does not close, such as the cryptocurrency market. Finally, we might be affected by slippage, altho only extreme values might drastically affect our balance.
The Anti Martingale
The strategy lets you use an anti-martingale, which double the position size after a win instead of a loss, the goal here is not to recover from a losing strike but instead to profit from a potential winning streak.
Here we are exposing your balance to exponential gross but you might also lose a trade at the end a winning streak, you will generally want to reinitialize your position size after a few wins instead of waiting for the end of a streak.
Alternative
You can use other-kind of progressions for position sizing, such as a linear one, increasing your position size by a constant number each time you lose. More gentle progressions will recover a proportion of your losses in a losing streak.
You can also simulate the effect of a martingale without doubling your position size by doubling your target profit, if for example you have a 10$ profit-target/stop-loss and lose a trade, you can use a 20$ profit target to recover from the lost trade + gain a profit of 10$. While this approach does not introduce exponential decay in your balance, you are betting on the market reaching your take profits, considering the fact that you are doubling their size you are expecting market volatility to increase drastically over time, as such this approach would not be extremely effective for high losing streak.
Conclusion
You will see a lot of auto-trading strategies that are based on a grid approach, they might even use a martingale. While the backtests will look appealing, you should think twice before using such kind of strategy, remember that frictional costs will be a huge challenge for the strategy, and that it assumes that the trader has an important initial capital. We have also seen that the risk/reward ratio is theoretically the worst you can have on a strategy, having a low reward and a high risk. This does not mean that progressive position sizing is bad, but it should not be pushed to the extreme.
It is nice to note that the martingale is originally a betting system designed for casino games, which unlike trading are not subject to frictional costs, but even casino players don't use it, so why would you?
Thx for reading
[HM] HORIZONTAL GRID ROUNDED (VOLATILITY BASED)The purpose of this indicator is to draw a horizontal grid having in mind:
- rounded price levels instead tradingview standard grid, zoom-based;
- calculated by volatility, using daily ATR;
- independent of timeframe in use, locked to DAILY calculations.
Further improvements are intended.
Wish this could be useful. Any questions, feel free to comment.