Dependence first order volume from PROFIT_MAX parameter, exchange rules for trade pair and trade conditions #57
Replies: 8 comments 15 replies
-
And the following graph demonstrates the dependence of the cycle income (assuming one grid order and TP is executed) on the value of the PROFIT_MAX parameter. Conclusion - practically does not depend. The step_size constraint and the current price are decisive. The smaller the value of the parameter, the more effective the strategy will be in a side market. Limitation - a sufficient amount of the deposit to place the grid, taking into account the size of the first order. |
Beta Was this translation helpful? Give feedback.
-
Hi! The short answer is I don't know. This isn't about that. This is an illustration of some of the dependencies found as a result of development, the abstracts are as follows:
These findings became the basis for calculating the size of the first order in the grid. As a result, under certain conditions, its volume may be larger than those following it, which at first glance contradicts the idea of grid orders, but increases the likelihood of TP execution. Now the calculation has become a little more accurate, but the idea is the same. if not additional_grid and not grid_update and not GRID_ONLY and 0 < PROFIT_MAX < 100:
try:
profit_max = min(PROFIT_MAX, max(PROFIT, f2d(100 * self.atr() / self.get_buffered_ticker().last_price)))
except statistics.StatisticsError as ex:
self.message_log(f"Can't get ATR value: {ex}, use default PROFIT value", LogLevel.WARNING)
profit_max = PROFIT
self.message_log(f"Profit max for first order volume is set {profit_max}%", LogLevel.DEBUG)
k_m = 1 - profit_max / 100
amount_first_grid = max(amount_min, (step_size * base_price / ((1 / k_m) - 1)) / base_price)
amount_first_grid = self.round_truncate(amount_first_grid, base=True, _rounding=ROUND_CEILING)
else:
amount_first_grid = amount_min Regards, Jerry. |
Beta Was this translation helpful? Give feedback.
-
Hi! The step_size constraint applies in any case, including in a Direct cycle. If the step_size is comparable to the size of the first grid order, then when the first grid order is executed and a TP is placed, there will be a huge GAP between the remaining grid orders and this TP. I limit the maximum GAP by the PROFIT_MAX parameter, which is used to calculate the size of the first order. Please note - this limitation only affects for large step_size! For most pairs on binance it is small and does not affect the size of the first order. There is another limitation on the exchange, this is MIN_NOTIONAL For Binance, this is a stricter limit than step_size. PROFIT_MAX is a parameter that the user sets, adjusting the probability of TP execution.
If we sell You can change code and try on testnet, wich available for Binance, Bitfinex and OKX. Regards, Jerry. |
Beta Was this translation helpful? Give feedback.
-
OK, the last sentence is true. And for But there is another consideration; even with this limitation, the volume of the first order is a small part of the total deposit. With small price fluctuations, often only the first few grid orders are fulfilled and the greater the volume of the deposit involved in the turnover, the greater the absolute profit. Therefore, the same method for calculating the volume of the first grid order is used for different types of cycle. Regards, Jerry. |
Beta Was this translation helpful? Give feedback.
-
And in the general case, this is also not true, since there is also a restriction on the price step and Regards, Jerry. |
Beta Was this translation helpful? Give feedback.
-
I don't plan to make changes to this part yet. But you can fork strategy and change it freely to suit your needs. And the expression Regards, Jerry. |
Beta Was this translation helpful? Give feedback.
-
Hi! And one more consideration - for calculating TP parameters, it does not matter whether it is Direct or Reverse cycle. Buy or Sell only. Regards, Jerry. |
Beta Was this translation helpful? Give feedback.
-
Colored lines are calculated for different base price levels
In a normal state, a strategy (let's say in Buy mode) has several buy orders and one sell order. The current price is between them. The closer a sell order is to the grid, the more likely it is to be filled, and it requires a smaller price change. But the profit of the cycle will be less. To adjust the profit parameter for the current cycle, the Bollinger Band indicator and two parameters that set its minimum and maximum values are used - PROFIT and PROFIT_MAX
However, to calculate the volume of the first order, I need to take into account the exchange limit for the trading pair, namely stepSize defines the intervals that a quantity can be increased/decreased by
The graph above shows this relationship. If the volume of the first order is too small, the gap between the grid and TP will be too large to meet this limit. This will result in an infinite (very long) downtime for the strategy while waiting for the price to change. Therefore, the volume of the first one is calculated in such a way that when it is executed, the TP order is separated from the grid within the PROFIT_MAX limit
Keep these limitations in mind when setting the PROFIT (0.1 - 0.25) and PROFIT_MAX (0.5 - 0.85) parameters.
Beta Was this translation helpful? Give feedback.
All reactions