Grid Bot Auto

xxattaxx-DisDev Actualizado   
This script is an auto-adjusting grid bot simulator. This is an improved version of the original Grid Bot Simulator. The grid bot is best used 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. Unlike the previous version, the upper and lower limits are calculated automatically. Grid levels are determined by four factors: Smoothing, Laziness, Elasticity, and Grid Intervals.

A moving average (or linear regression) is applied to each close price as a basis. Options for smoothing are Linear Regression, Simple Moving Average, Exponential Moving Average, Volume-Weighted Moving Average, Triple-Exponential Moving Average.

Laziness is the percentage change required to reach the next level. If laziness is 1.5, the price must move up or down by 1.5% before the grid will change. This concept is based on Alex Grover’s Efficient Trend Step. This allows the grids to be based on even price levels, as opposed to jagged moving averages.

Elasticity is the degree of “stickiness” to the current price trend. If the smoothing line remains above (or below) the current grid center without reverting but still not enough to reach the next grid level, the grid line will start to curve toward the next grid level. Elasticity is added to (or subtracted from) the gridline by a factor of minimum system ticks for the current pair. Elasticity of zero will keep the gridlines horizontal. If elasticity is too high, the grid will distort.

Grid Intervals:
Grid intervals are the percentage of space between each grid.

Laziness = 4%, Elasticity = 0. Price must move at least 4% before reaching the next level. With zero elasticity, gridlines are straight.

Laziness = 5%, Elasticity = 100. For each bar at a new grid level, the grid will start “curve” toward the next price level (up if price is greater than the middle grid, down if less than middle grid). Elasticity is calculated by the user-inputted “Elasticity” multiplied by the minimum tick for the current pair (ELSTX = syminfo.mintick * iELSTX)

Try experimenting with different combinations of the Smoothing Length, Smoothing Type, Laziness, Elasticity, and Grid Intervals to find the optimum settings for each chart. Lower-priced pairs (e.g. XRP/ADA/DODGE) will require lower Elasticity. Also note that different exchanges may have different minimum tick values. For example, minimum tick for BITMEX:XBTUSD and BYBIT:BTCUSD is .5, but BINANCE:BTCUSDT and COINBASE:BTCUSD is .01.

 DODGEUSDT, 5min. Laziness: 4%, Elasticity 2.5

Number of Grids: 2. Laziness: 3.75%. Elasticity: 150. Grid Interval 2%.

Settings Overview

Smoothing Length: Smoothing period

Smoothing Type: Linear Regression, Simple Moving Average, Exponential Moving Average, Volume-Weighted Moving Average, Triple-Exponential Moving Average

Laziness: Percentage required for price to move until it reaches the next level. If price does not reach the next level (up or down), the grid will remain the same as previous grid (because it’s lazy).

Elasticity: Amount of curvature toward the next grid, based on the current price trend. As elasticity increases, gridlines will curve up or down by a factor of the number of ticks since the last grid change.

Grid Interval: Percent between grid levels.

Number of Grids: Number of grids to show.

Cooldown: Number of bars to wait to prevent consecutive signals.

Grid Line Transparency: Lower transparencies brighten the gridlines; higher transparencies dim the gridlines. To hide the gridlines completely, enter 100.

Fill Transparency: Lower transparencies brighten the fill box; higher transparencies dim the fill box. To hide the fill box completely, enter 100.

Signal Size: Make signal triangles large or small.

Reset Buy/Sell Index When Grids Change: When a new grid is formed, resetting the index may prevent false signals (experimental)

Use Highs/Lows 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.

Show Min Tick: If checked, syminfo.mintick is displayed in upper-righthand corner. Useful for estimating Laziness.

Reverse Fill Colors: Default fill for fill boxes is green after buy and red after sell. Check this box to reverse.

Note: The Grid Bot Simulator scripts are experimental and works in progress. Please feel free to comment or contact me if you have suggestions/complaints.

Notas de prensa:
Cleaned code
Notas de prensa:
Added market direction filter. Bot will skip every other signal against market direction (up or down).
Notas de prensa:
Updated to Pinescript version 5.

ETH(ERC20): 0xe5f4aab4dd0f297843146d51605010bf2c2
Script de código abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un gráfico?