排查没有n笔交易+2

This commit is contained in:
zhangkun9038@dingtalk.com 2025-11-27 12:41:56 +08:00
parent 70eb569362
commit 0178fa3317
2 changed files with 15 additions and 1 deletions

View File

@ -42,6 +42,12 @@
},
"cooldown_volume": 0,
"action_space": "default",
"order_types": {
"entry": "market",
"exit": "market",
"stoploss": "limit",
"stoploss_on_exchange": false
},
"entry_pricing": {
"price_side": "other",
"use_order_book": true,

View File

@ -38,8 +38,8 @@ class StaticGrid(IStrategy):
"""
Static Grid Entry Logic:
- Buy at predefined grid levels: 1500, 1550, 1600, ..., 4500 (step 50)
- Also buy AT CURRENT PRICE and below it
- When price is at or below a grid level, produce buy signal
- Continuous buying at different grid levels as price moves
"""
dataframe['enter_long'] = False
@ -58,6 +58,14 @@ class StaticGrid(IStrategy):
# Generate all grid levels in the range
grid_levels = [LOWER + i * STEP for i in range(int((UPPER - LOWER) / STEP) + 1)]
# IMPORTANT: Add current price as a grid level too (rounded to nearest STEP)
# This ensures we can buy immediately at current price
current_grid_level = round(current_price / STEP) * STEP
if current_grid_level not in grid_levels and LOWER <= current_grid_level <= UPPER:
grid_levels.append(current_grid_level)
grid_levels.sort()
entry_count = 0
# For each grid level, check if price is at or below it