Trading grid
The trading grid is a key parameter of the bot. Without the grid, trading is not possible. In its essence, the trading grid is a plan of actions when the rate changes. The grid is defined by a set of lines (or rows), each of which is defined by the following key parameters:
- «Buy price» - the price at which the BUY orders will be placed
- «Sell price» - the price at which the SELL orders will be placed
- «Start order type» - specifies which order was the first BUY or SELL. The procedures of correct order placing and profit fixing by pairs of trades depend on this parameter.
- «Start order date» - date of placing the start order for the gridline. It affects the calculation of profitability.
- «Start in SELL orders» - volume of funds placed in sell orders at the start.
- «Start in BUY orders» - volume of funds, placed in buy orders at the start
The window with the trading grid setup looks like this:
In addition to the main columns, the window contains columns:
- «№» - sequence number of the row for this bot
- «Status» - a column for displaying the status of the row. There are the following options:
- Indicates that this line will be the nearest to the order triggering if the rate goes up
- Indicates that this line will be the nearest to the order triggering if the rate goes down
- Indicates that there are warnings on the line. Additionally, a brief warning text is displayed, for example, "No orders" - denotes that there is an enabled grid line, but there are no orders placed on it on the exchange. It is necessary to check the settings and errors and correct the problem manually. Sometimes the warning appears due to an error, sometimes due to problems with communication with the exchange, sometimes with the loading of the exchange.
- «Line is active» - means, that the line is included in work, trade is carried out on it, orders are placed, availability of orders on an exchange is checked. If the flag is removed, trading and checks on the line are not carried out.
- «In position» - a calculation field, which reflects the pairing of orders. If the current order on the exchange by type matches with the starting order, the field will be "False", if different, then "True".
- «In orders SELL» - the amount in SELL orders on the exchange at the moment
- «In orders BUY» - the amount in BUY orders on the exchange at the moment
- «Set SELL» - the field for displaying the intermediary amount to be set in SELL orders. The amount in this field is used to check the correctness of calculation, distribution or manual setting. If everything is correct and it is necessary to set the amount specified in this field, the user should press the button for setting start orders or the apply amounts button on the trading grid panel. After that, commands will be created to change the amounts on the exchange, which will be executed in the processing of the general queue of commands of the current bot.
- «Set BUY» - a field for displaying the intermediate amount to be set in BUY orders. Usage is similar to the "Set SELL" field.
- «ID» - code of the grid string in the database
- «BUY correction» - the accumulated correction of the sum of purchase as a result of roundings. Occurs because of restrictions of the exchange on the size of the exposed order and on step of change of its size. It is critical for small order amounts The field is auxiliary and is used at the next calculation of the order amount.
- «SELL correction» - accumulated correction of the selling amount as a result of rounding. This field appears due to limitations of the exchange on the order size and on the step of change in its size. This is critical for small order amounts. This field is auxiliary and is used in the next order amount calculation.
- «Last order BUY size» - the last value of the placed BUY order. This field is auxiliary and is used when archiving the bot.
- «Last order SELL size» - the last value of the placed SELL order. This field is auxiliary and is used when archiving the bot
- - adding a new grid line manually
- - change the selected grid line manually. Identical to double-clicking on the grid line except for the fields "Row active", "Buy price", "Sell price", "Type on start" - these fields are edited in the table
- - deleting the selected grid line
- - updating the trade grid from the database
- - starting the trading grid generator
- - launching the setup and distribution of the trading grid sums wizard
- - launching the cutting wizard for the trading grid sums
- - turning on (setting the "Line is active" field to "True") the selected grid lines
- - turning off (setting the "Line is active" field to "False") the selected grid lines
- - placing start orders
- -Applying new amounts to orders. Tasks are created to cancel orders placed (if they exist) and to place them with a new amount (if the amount is not zero).
- - Cancellation of all orders in the exchange on the selected rows of the grid
- - clearing of information in the fields "Start order date", "Start in SELL orders", "Start in BUY orders" on the selected grid lines
- - clearing of information in the "Set SELL" and "Set BUY" fields on the selected grid lines
When creating a bot, the trading grid is empty. There are two ways to create it:
- Manual - each grid line is set manually
- With the trading grid generator - the main way
- «№» - sequential number of the line in the grid
- «Line is active» - sign of the active row in the grid
- «Buy price» - the price at which the buy orders will be placed
- «Sell price» - the price, at which the Sell orders will be placed
- «Start order type» - SELL or BUY
- «Start date» - date of trade start on this line. This field can be left blank, since it's filled in automatically, when placing the start order. If necessary, you can change it manually.
- «Set SELL ()» - new amount of orders to sell. The base currency of the trading pair and the second currency of the trading pair are specified in brackets. When specifying the amounts, recalculation is performed automatically.
- «Set BUY ()» - new amount of orders to buy. The base currency of the currency pair and the second currency are specified in brackets. When specifying the amounts, recalculation is performed automatically.
- «Currency rates to USDT at start» - rates of base and second currency pair to USDT at the moment of start. It is set either manually, or when creating a start order, or when adding an amount to the grid line (the rate is averaged). It is used to calculate the field "At start USDT" in the table of bots.
- «Set current exchange rates to USDT» - the button sets the current base and second currency rates to USDT.
The following parameters must be specified:
- «Grid step (percentage)» - percentage of change for each next step.
- «Grid range (percent)» - the half range in percent from the starting point up and down. The final range will be equal to twice the half range.
- «Grid steps up» - the number of grid lines to be built up from the starting point. By default, the percentage, range, and starting point are calculated automatically when you specify the percentage, range, and starting point. It is possible to change manually to generate the exact number of steps.
- «Grid steps down» - the number of grid lines to be built down from the starting point. By default, it is calculated automatically when percentage, range and starting point are specified. It is possible to change manually to generate the exact number of steps.
- «Grid start point (price)» - the price from which all grid calculations are made.
- «Get current price» button - sets the value of the current rate of the trading pair in the "Grid start point (price)" field.
- «Clear grid first» - parameter that specifies whether to completely delete all existing bot grid lines before generation.
- «Generate» button generates grid lines according to the specified parameters and performs merge of the current grid and the generated one. The merge is performed as follows: if the row of the new grid exists in the current grid by signs of equality of fields ("Sell price" and "Buy price"), then the existing row remains in the final grid, otherwise the new one is added. If the attribute "Clear grid first" is set to "True", then the merge result will always be equal to the new grid. After generation in the bot fields the parameters are saved:
- «Trading grid start point (symbol price)»
- «Trade grid step (%)»
- «Trade grid range (% up and down from starting point)»
you can transfer the appropriate number of coins to the setting field, correcting for rounding. This is the total amount that will be distributed evenly according to the following settings.
Apply to:
- «All grid lines» - to all rows of the bot's trading grid
- «All active grid lines» - to all rows of the bot's trading grid, where the "Line is active" field is set to "True"
- «All selected grid lines» - to all rows of the bot's trading grid, which are selected in the trading grid before opening of the amount editor
Do with a new amount:
- «Replace current amount» - for each line that hits the "Apply to" filter, the amount calculated as a result of the distribution will be replaced
- «Add to current amount» - for each line that falls under the "Apply to" filter, the amount calculated as a result of the distribution will be added to the amount already placed in the orders
- «Subtract from the current amount» - for each line that falls under the "Apply to" filter, the amount calculated as a result of the distribution will be subtracted from the amount already placed in the orders
Action with start sum:
- «Do not change» - the starting amount will not be changed
- «Change according to the action for the grid line» - the action will be taken from the "Do with new amount" parameter
Press the «Set amount» button to perform the allocation
The distribution result should be checked in the "Set SELL" and "Set BUY" columns. If the result is satisfactory, then to reflect it on the exchange, you must either set the start orders on the button or apply with the button .The following fields must be configured in the parameters:
- «Cut percent» - the percentage that will be calculated from the selected base to calculate the amount of cutting
- «Cut base» - this is what the percentage will be calculated from. It can be:
- Start sum - sum of start orders of the type that were at the start (BUY or SELL)
- Open orders sum - amount of currently placed orders on the exchange
- Profit (amount of open orders minus the amount of start orders)
- «Action with start sum» - the parameter, which determines whether the sum of the start orders should be changed. Can take values:
- Change
- Do not change
For example, having specified the parameter "Change" it is possible to cut the start orders together with the exposed at the moment and then it will turn out that the sum exposed in the very beginning is withdrawn, but it is necessary to consider that thus percent of profitability in statistics will also change. IMPORTANT!!! - if you change the starting sum, it will be impossible to rollback the change.
- «Apply to» is a parameter that shows to which rows of the grid you want to apply cutting. It can take a value of:
- «All grid lines» - to all rows of the bot's trading grid
- «All active grid lines» - to all rows of the bot's trading grid, where the "Line is active" field is set to "True"
- «All selected grid lines» - to all rows of the bot's trading grid, which are selected in the trading grid before opening of the amount editor
To pre-calculate the cutting, click on the "Calculate" button. The table will display all rows to be cut, the cut amounts, the amounts before and after the start amounts and current orders are cut, and the released equivalent in USDT at the current exchange rate. The bottom line will be the sum of all lines.
It is necessary to check and make sure that you are satisfied with this cutting option, and then click the "Cut sum" button. The result will be a specified amount in the "Set SELL" and "Set BUY" fields of each row of the trading grid, as well as the changed starting amount: