Autoback Grid Lab [trade_lexx]

Introduction
First of all, it is important to understand that Autoback Grid Lab is a powerful professional tool for backtesting and optimization, created specifically for traders using both grid strategies and regular take profit with stop loss.
The main purpose of this script is to save you weeks and months of manual testing and parameter selection. Instead of manually testing one combination of settings after another, Autoback Grid Lab automatically tests thousands of unique strategies on historical data, providing you with a comprehensive report on the most profitable and, more importantly, sustainable ones.
If you want to find mathematically sound, most effective settings for your grid strategy on a specific asset and timeframe, then this tool was created for you.
Key Features
My tool has functionality that transforms the process of finding the perfect strategy from a routine into an exciting exploration.
🧪 Mass testing of thousands of combinations
The script is able to systematically generate and run a huge number of unique combinations of parameters through the built-in simulator. You set the ranges, and the indicator does all the work, testing all possible options for the following grid settings:
* Number of safety orders (SO Count)
* Grid step (SO Step)
* Step Multiplier (SO Multiplier) for building nonlinear grids
* Martingale for controlling the volume of subsequent orders
* Take Profit (%)
* Stop Loss (%), with the possibility of calculating both from the entry point and from the dynamic breakeven line
* The volume of the base order (Volume BO) as a percentage of the deposit
🏆 Unique `FinalScore` rating system
Sorting strategies by net profit alone is a direct path to self—deception and choosing strategies that are "tailored" to history and will inevitably fail in real trading. To solve this problem, we have developed FinalScore, a comprehensive assessment of the sustainability and quality of the strategy.
How does it work?
FinalScore analyzes each combination not one by one, but by nine key performance metrics at once, including Net Profit, Drawdown, Profit Factor, WinRate, Sharpe coefficients, Sortino, Squid and Omega. Each of these indicators is normalized, that is, reduced to a single scale. Then, to test the strategy for strength, the system performs 30 iterations, each time assigning random weights to these 9 metrics. A strategy gets a high FinalScore only if it shows consistently high results under different evaluation criteria. This proves her reliability and reduces the likelihood that her success was an accident.
📈 Realistic backtesting engine
The test results are meaningless if they do not take into account the actual trading conditions. Our simulator simulates real trading as accurately as possible, taking into account:
* Leverage: Calculation of the required margin to open and hold positions.
* Commission: A percentage commission is charged each time an order is opened and closed.
* Slippage: The order execution price is adjusted by a set percentage to simulate real market conditions.
* Liquidation model: This is one of the most important functions. The script continuously monitors the equity of the account (capital + unrealized P&L). If equity falls below the level of the supporting margin (calculated from the current value of the position), the simulator forcibly closes the position, as it would happen on a real exchange. This eliminates unrealistic scenarios where the strategy survives after a huge drawdown.
🔌 Integration with external signals
The indicator operates in two modes:
1. `No Signal': Standard mode. The trading cycle starts immediately as soon as the previous one has been closed. Ideal for testing the "pure" mechanics of the grid.
2. `External Signal`: In this mode, a new trading cycle will start only when a signal is received from an external source. You can connect any other indicator (such as the RSI, MACD, or your own strategy) to the script and use it as a trigger to log in. This allows you to combine the power of a grid strategy with your own entry points.
📊 Interactive and informative results panel
Upon completion of the calculations, a detailed table with the TOP N best strategies appears on the screen, sorted according to your chosen criterion. For each strategy in the rating, you will see not only the key metrics (Profit, Drawdown, duration of transactions), but also all the parameters that led to this result. You can immediately take these settings and apply them in your trading.
Application Options: How To Solve Your Problems
Autoback Grid Lab is a flexible tool that can be adapted to solve various tasks, from complete grid optimization to fine—tuning existing strategies. Here are some key scenarios for its use:
1. Complete Optimization Of The Grid Strategy
This is the basic and most powerful mode of use. You can find the most efficient grid configuration for any asset from scratch.
* How to use: Set wide ranges for all key grid parameters ('SO Count`, SO Step, SO Multiplier, Martingale, TP, etc.).
* In the `No Signal` mode: You will find the most stable grid configuration that works as an independent, constantly active strategy, regardless of which-or entrance indicators.
* In the `External Signal` mode: You can connect your favorite indicator for input (for example, RSI, MACD or a complex author's script) and find the optimal grid parameters that best complement your input signals. This allows you to turn a simple signaling strategy into a full-fledged grid system.
2. Selecting the Optimal Take Profit and Stop Loss for Your Strategy
Do you already have an entry strategy, but you are not sure where it is best to put Take Profit and Stop Loss? Autoback Grid Lab can solve this problem as well.
* How to use:
1. Disable optimization of all grid parameters (uncheck SO Count, SO Step, Martingale, etc.). Set the Min value for SO Count to 0.
2. Set the ranges for iteration only for 'Take Profit` and `Stop Loss'.
3. Turn on the External Signal mode and connect your indicator with input signals.
* Result: The script will run your historical entry signals with hundreds of different TP and SL combinations and show you which stop order levels bring maximum profit with minimal risk specifically for your entry points.
3. Building a Secure Network with Risk Management
Many traders are afraid of grid strategies because of the risk of large drawdowns. With the help of the optimizer, you can purposefully find the parameters for such a grid, which includes mandatory risk management through Stop Loss.
* How to use: Enable and set the range for Stop Loss, along with other grid parameters. Don't forget to test both types of SL calculations (`From entry point` and `From breakeven line`) to determine which one works more efficiently.
* Result: You will find balanced strategies in which the grid parameters (number of orders, martingale) and the Stop Loss level are selected in such a way as to maximize profits without going beyond the acceptable risk level for you.
How To Use The Indicator (Step-By-Step Guide)
Working with the Autoback Grid Lab is a sequential process consisting of four main steps: from initial setup to analysis of the finished results. Follow this guide to get the most out of the tool.
Step 1: Initial Setup
1. Add the indicator to the chart of your chosen asset and timeframe.
2. Open the script settings. The first thing you should pay attention to is the ⚙️ Optimization Settings ⚙️ group.
3. Set the `Bars Count'. This parameter determines how much historical data will be used for testing.
* Important: The more bars you specify, the more statistically reliable the backtest results will be. We recommend using the maximum available value (25,000) to test strategies at different market phases.
* Consider: The indicator performs all calculations on the last historical bar. After applying the TradingView settings, it will take some time to load all the specified bars. The results table will appear only after the data is fully loaded. Don't worry if it doesn't appear instantly. And if an error occurs, simply switch the number of combinations to 990 and back to 1000 until the table appears.
Step 2: Optimization Configuration
At this stage, you define the "universe" of parameters that our algorithm will explore.
1. Set the search ranges (🛠 Optimization Parameters 🛠 group).
For each grid parameter that you want to optimize (for example, SO Count or `Take Profit'), you must specify three values:
* Min: The minimum value of the range.
* Max: The maximum value of the range.
* Step: The step with which the values from Min to Max will be traversed.
*Example:* If you set Min=5, Max=10, and Step=1 for SO Count, the script will test strategies with 5, 6, 7, 8, 9, and 10 safety orders.
* Tip for users: To get the first results quickly, start with a larger step (for example, TP from 0.5% to 2.5% in 0.5 increments instead of 0.1). After you identify the most promising areas, you can perform a deeper analysis by expanding the ranges around these values.
2. Set Up Money Management (Group `💰 Money Management Settings 💰`).
Fill in these fields with the values that best match your actual trading conditions. This is critically important for obtaining reliable results.
* Capital: Your initial deposit.
* Leverage: Leverage.
* Commission (%): Your trading commission as a percentage.
* Slippage (%): Expected slippage.
* Liquidation Level (%): The level of the supporting margin (MMR in %). For example, for Binance Futures, this value is usually between 0.4% and 2.5%, depending on the asset and position size. Specify this value for your exchange.
3. Select the Sorting Criterion and the Direction (Group `⚙️ Optimization Settings ⚙️').
* `Sort by': Specify the main criteria by which the best strategies will be selected and sorted. I strongly recommend using finalScore to find the most balanced and sustainable strategies.
* `Direction': Choose which trades to test: Long, Short or Both.
Step 3: Start Testing and Work with "Parts"
The total number of unique combinations generated based on your ranges can reach tens of millions. TradingView has technical limitations on the number of calculations that the script can perform at a time. To get around this, I implemented a "Parts" system.
1. What are `Part` and `Combinations in Part'?
* `Combinations in Part': This is the number of backtests that the script performs in one run (1000 by default).
* `Part`: This is the number of the "portion" of combinations that you want to test.
2. How does it work in practice?
* After you have everything set up, leave Part:1 and wait for the results table to appear. You will see the TOP N best strategies from the first thousand tested.
* Analyze them. Then, to check the next thousand combinations, just change the Part to 2 in the settings and click OK. The script will run a test for the next batch.
* Repeat this process by increasing the Part number (`3`, 4, 5...), until you reach the last available part.
* Where can I see the total number of parts? In the information row below the results table, you will find Total parts. This will help you figure out how many more tests are left to run.
Step 4: Analyze the Results in the Table
The results table is your main decision—making tool. It displays the best strategies found, sorted by the criteria you have chosen.
1. Study the performance metrics:
* Rating: Position in the rating.
* Profit %: Net profit as a percentage of the initial capital.
* Drawdown%: The maximum drawdown of the deposit for the entire test period.
* Max Length: The maximum duration of one transaction in days, hours and minutes.
* Trades: The total number of completed trades.
2. Examine the winning parameters:
* To the right of the performance metrics are columns showing the exact settings that led to this result ('SO Count`, SO Step, TP (%), etc.).
3. How to choose the best strategy?
* Don't chase after the maximum profit! The strategy with the highest profit often has the highest drawdown, which makes it extremely risky.
* Seek a balance. The ideal strategy is a compromise between high profitability, low drawdown (Drawdown) and the maximum length of trades acceptable to you (Max Length).
* finalScore was created to find this balance. Trust him — he often highlights not the most profitable, but the most stable and reliable options.
Detailed Description Of The Settings
This section serves as a complete reference for each parameter available in the script settings. The parameters are grouped in the same way as in the indicator interface for your convenience.
Group: ⚙️ Optimization Settings ⚙️
The main parameters governing the testing process are collected here.
* `Enable Optimizer': The main switch. Activates or deactivates all backtesting functionality.
* `Direction': Determines which way trades will be opened during the simulation.
* Long: Shopping only.
* Short: Sales only.
* Both: Testing in both directions. Important: This mode only works in conjunction with an External Signal, as the script needs an external signal to determine the direction for each specific transaction.
* `Signal Mode`: Controls the conditions for starting a new trading cycle (opening a base order).
* No Signal: A new cycle starts immediately after the previous one is completed. This mode is used to test "pure" grid mechanics without reference to market conditions.
* External Signal: A new cycle begins only when a signal is received from an external indicator connected via the Signal field.
* `Signal': A field for connecting an external signal source (works only in the `External Signal` mode). You can select any other indicator on the chart.
* For Long** trades, the signal is considered received if the value of the external indicator ** is greater than 0.
* For Short** trades, the signal is considered received if the value of the external indicator ** is less than 0.
* `Bars Count': Sets the depth of the history in the bars for the backtest. The maximum value (25000) provides the most reliable results.
* `Sort by`: A key criterion for selecting and ranking the best strategies in the final table.
* FinalScore: Recommended mode. A comprehensive assessment that takes into account 9 metrics to find the most balanced and sustainable strategies.
* Profit: Sort by net profit.
* Drawdown: Sort by minimum drawdown.
* Max Length: Sort by the minimum length of the longest transaction.
* `Combinations Count': Indicates how many of the best strategies (from 1 to 50) will be displayed in the results table.
* `Close last trade`: If this option is enabled, any active trade will be forcibly closed at the closing price of the last historical bar. For grid strategies, it is recommended to always enable this option in order to get the correct calculation of the final profit and eliminate grid strategies that have been stuck for a long time.
Group: 💰 Money Management Settings 💰
The parameters in this group determine the financial conditions of the simulation. Specify values that are as close as possible to your actual values in order to get reliable results.
* `Capital': The initial deposit amount for the simulation.
* `Leverage`: The leverage used to calculate the margin.
* `Slippage` (%): Simulates the difference between the expected and actual order execution price. The specified percentage will be applied to each transaction.
* `Commission` (%): The trading commission of your exchange as a percentage. It is charged at the execution of each order (both at opening and closing).
* `Liquidation Level' (%): Maintenance Margin Ratio. This is a critical parameter for a realistic test. Liquidation in the simulator occurs if the Equity of the account (Capital + Unrealized P&L) falls below the level of the supporting margin.
Group: 🛠 Optimization Parameters 🛠
This is the "heart" of the optimizer, where you set ranges for iterating through the grid parameters.
* `Part`: The portion number of the combinations to be tested. Start with 1, and then increment (`2`, 3, ...) sequentially to check all generated strategies.
* `Combinations in Part': The number of backtests performed at a time (in one "Part"). Increasing the value may speed up the process, but it may cause the script to error due to platform limitations. If an error occurs, it is recommended to switch to the step below and back.
Three fields are available for each of the following parameters (`SO Count`, SO Step, SO Multiplier, etc.):
* `Min`: Minimum value for testing.
* `Max': The maximum value for testing.
* `Step`: The step with which the values in the range from Min to Max will be iterated over.
There is also a checkbox for each parameter. If it is enabled, the parameter will be optimized in the specified range. If disabled, only one value specified in the Min field will be used for all tests.
* 'Stop Loss': In addition to the standard settings Min, Max, Step, it has an additional parameter:
* `Type`: Defines how the stop loss price is calculated.
* From entry point: The SL level is calculated once from the entry price (base order price).
* From breakeven line: The SL level is dynamically recalculated from the average position price after each new safety order is executed.
Group: ⚡️Filters⚡️
Filters allow you to filter out those results from the final table that do not meet your minimum requirements.
For each filter (`Max Profit`, Min Drawdown, `Min Trade Length`), you can:
1. Turn it on or off using the checkbox.
2. Select the comparison condition: Greater (More) or Less (Less).
3. Set a threshold value.
*Example:* If you set Less and 20 for the Min Drawdown filter, only those strategies with a maximum drawdown of less than 20% will be included in the final table.
Group: 🎨 Visual Settings 🎨
Here you can customize the appearance of the results table.
* `Position': Selects the position of the table on the screen (for example, Bottom Left — bottom left).
* `Font Size': The size of the text in the table.
* `Header Background / Data Background`: Background colors for the header and data cells.
* `Header Font Color / Data Font Color`: Text colors for the header and data cells.
Important Notes and Limitations
So that you can use the Autoback Grid Lab as efficiently and consciously as possible, please familiarize yourself with the following key features of its work.
1. It is a Tool for Analysis, not for Signals
It is extremely important to understand that this script does not generate trading signals in real time. Its sole purpose is to conduct in—depth research (**backtesting**) on historical data.
* The results you see in the table are a report on how a particular strategy would have worked in the past.
* The script does not provide alerts and does not draw entry/exit points on the chart for the current market situation.
* Your task is to take the best sets of parameters found during optimization and use them in your real trading, for example, when setting up a trading bot or in a manual trading system.
2. Features Of Calculations (This is not a "Repainting")
You will notice that the results table appears and is updated only once — when all historical bars on the chart are loaded. It does not change in real time with each tick of the price.
This is correct and intentional behavior.:
* To test thousands, and sometimes millions of combinations, the script needs to perform a huge amount of calculations. In the Pine Script™ environment, it is technically possible to do this only once, at the very last bar in history.
* The script does not show false historical signals, which then disappear or change. It provides a static report on the results of the simulation, which remains unchanged for a specific historical period.
3. Past Results do not Guarantee Future Results.
This is the golden rule of trading, and it fully applies to the results of backtesting. Successful strategy performance in the past is not a guarantee that it will be as profitable in the future. Market conditions, volatility and trends are constantly changing.
My tool, especially when sorting by finalScore, is aimed at finding statistically stable and reliable strategies to increase the likelihood of their success in the future. However, it is a tool for managing probabilities, not a crystal ball for predicting the future. Always use proper risk management.
4. Dependence on the Quality and Depth of the Story
The reliability of the results directly depends on the quantity and quality of the historical data on which the test was conducted.
* Always strive to use the maximum number of bars available (`Bars Count: 25,000`) so that your strategy is tested on different market cycles (rise, fall, flat).
* The results obtained on data for one month may differ dramatically from the results obtained on data for two years. The longer the testing period, the higher the confidence in the parameters found.
Conclusion
The Autoback Grid Lab is your personal research laboratory, designed to replace intuitive guesses and endless manual selection of settings with a systematic, data—driven approach. Experiment with different assets, timeframes, and settings ranges to find the unique combinations that best suit your trading style.
Yalnızca davetli komut dosyası
Bu komut dosyasına yalnızca yazar tarafından onaylanan kullanıcılar erişebilir. Kullanmak için izin istemeniz ve almanız gerekir. Bu izin genellikle ödeme yapıldıktan sonra verilir. Daha fazla ayrıntı için aşağıdaki yazarın talimatlarını izleyin veya doğrudan trade_lexx ile iletişime geçin.
TradingView, yazarına tam olarak güvenmediğiniz ve nasıl çalıştığını anlamadığınız sürece bir komut dosyası için ödeme yapmanızı veya kullanmanızı ÖNERMEZ. Ayrıca topluluk komut dosyaları bölümümüzde ücretsiz, açık kaynaklı alternatifler bulabilirsiniz.
Yazarın talimatları
Uyarı: Erişim talebinde bulunmadan önce lütfen yalnızca davetli komut dosyaları kılavuzumuzu okuyun.
t.me/TradeLexx_websitebot/aboutme?startapp=_utmTradingView
Feragatname
Yalnızca davetli komut dosyası
Bu komut dosyasına yalnızca yazar tarafından onaylanan kullanıcılar erişebilir. Kullanmak için izin istemeniz ve almanız gerekir. Bu izin genellikle ödeme yapıldıktan sonra verilir. Daha fazla ayrıntı için aşağıdaki yazarın talimatlarını izleyin veya doğrudan trade_lexx ile iletişime geçin.
TradingView, yazarına tam olarak güvenmediğiniz ve nasıl çalıştığını anlamadığınız sürece bir komut dosyası için ödeme yapmanızı veya kullanmanızı ÖNERMEZ. Ayrıca topluluk komut dosyaları bölümümüzde ücretsiz, açık kaynaklı alternatifler bulabilirsiniz.
Yazarın talimatları
Uyarı: Erişim talebinde bulunmadan önce lütfen yalnızca davetli komut dosyaları kılavuzumuzu okuyun.
t.me/TradeLexx_websitebot/aboutme?startapp=_utmTradingView