TradingView
thequantscience
7 Jan 2024 pukul 10.40

Hulk Grid Algorithm V2 - The Quant Science 

Bitcoin / TetherUSBinance

Deskripsi

It's the latest proprietary grid algorithm developed by our team. This software represents a clearer and more comprehensive modernization of the deprecated Hulk Grid Algorithm. In this new release, we have optimized the source code architecture and investment logic, which we will describe in detail below.

Overview
Hulk Grid Algorithm V2 is designed to optimize returns in sideways market conditions. In this scenario, the algorithm divides purchases with long orders at each level of the grid. Unlike a typical grid algorithm, this version applies an anti-martingale model to mitigate volatility and optimize the average entry price. Starting from the lower level, the purchase quantity is increased at each new subsequent level until reaching the upper level. The initial quantity of the first order is fixed at 0.50% of the initial capital. With each new order, the initial quantity is multiplied by a value equal to the current grid level (where 1 is the lower level and 10 is the upper level).

Example: Let's say we have an initial capital of $10,000. The initial capital for the first order would be $50 * 1 = $50, for the second order $50 * 2 = $100, for the third order $50 * 3 = $150, and so on until reaching the upper level.



All previously opened orders are closed using a percentage-based stop-loss and take-profit, calculated based on the extremes of the grid.



Set Up
As mentioned earlier, the user's goal is to analyze this strategy in markets with a lack of trend, also known as sideways markets. After identifying a price range within which the asset tends to move, the user can choose to create the grid by placing the starting price at the center of the range. This way, they can consider trading the asset, if the backtesting generates a return greater than the Buy & Hold return.

Grid Configuration
To create the grid, it's sufficient to choose the starting price during the launch phase. This level will be the center of the grid from which the upper and lower levels will be calculated. The grid levels are computed using an arithmetic method, adding and subtracting a configurable fixed amount from the user interface (Grid Step $).

Example: Let's imagine choosing 1000 as the starting price and 50 as the Grid Step ($). The upper levels will be 1000, 1050, 1100, 1150, 1200. The lower levels will be 950, 900, 850, 800, and 750.




Markets
This software can be used in all markets: stocks, indices, commodities, cryptocurrencies, ETFs, Forex, etc.

Application
With this backtesting software, is possible to analyze the strategy and search for markets where it can generate better performance than Buy & Hold returns. There are no alerts or automatic investment mechanisms, and currently, the strategy can only be executed manually.

Design
Is possible to modify the grid style and customize colors by accessing the Properties section of the user interface.
Komentar
ks1267
What is the mid price should I set?
khagiang369
error....
thequantscience
Hello @khagiang369. If the software generates an error pop up, means you have wrongly configured the settings. Please, if you need help during the configuration refer to the official documentation which you can find after the description of this script.
HermanBrummer
Looks interesting, but see this error.

! Study Error
Error on bar 0: Invalid 'qty' value
(-1.000000) in the 'strategy.entry() ' call.
Use a positive number less or equal to
1000000000000.000000.
ti
thequantscience
Hello, before you comment hastily, generating negative expectations in readers and damaging our work, you should first understand how this script works. The script does not generate console errors, has no bugs and works perfectly. We therefore ask you to refer to the official documentation and take time to get to know the script before making hasty judgements. Furthermore, when you comment referring to some error, you should explain more deeply where this error was generated. The error you refer to shows an invalid amount entered, this happens when the user uses a larger size than the initial capital or when during backtesting the equity goes below zero and the script has no more capital to invest.
AllegoryCo
price_level = input.float(defval = 1, step = 0.00000001,title = "Price Level", group = "GRID CONFIGURATION", confirm = true) mid_start = price_level stop_loss = input.float(defval = 2.00, step = 0.10, title = "Stop Loss", group = "GRID CONFIGURATION", confirm = true) take_profit = input.float(defval = 2.00, step = 0.10, title = "Take Profit", group = "GRID CONFIGURATION", confirm = true) size_grid = input.float(defval = 200.00, step = 1.00, title = "Grid Step ($)", group = "GRID CONFIGURATION", confirm = true)
Lebih lanjut