Техническое задание
I currently have a functioning trading bot that needs these improvements and overall optimization to work flawlessly in backtesting, since currently it mainly works well only in live trading.
Separate Grid Spacing Settings for Long and Short Positions:
• Requirement: It should be possible to set different spacing between grid levels for buy (long) and sell (short) positions. For example, long positions can be opened every 0.02% price drop, while short positions every 0.03% price rise.
Dynamic Grid Adjustment and Flexibility:
• The system must be designed to allow dynamic changes to grid spacing in the future using an external indicator (e.g., volatility indicator like ATR). When the spacing value changes, the bot must automatically update (move or replace) existing pending orders (limit orders). All problems that come with this dynamic adjustment need to be cleared and resolved.
Compatibility with All Financial Instruments:
• Requirement: The bot's logic needs to be fixed to work seamlessly on all financial instruments, including indices (e.g., S&P 500), not just currency pairs. This includes standardizing the calculation of pip/point sizes and nominal values.
Unique "Magic Number":
The bot must assign a unique identification number ("Magic Number") to each of its positions and pending orders, which is specific to each chart it runs on. All bot functions must work exclusively on positions with this specific number, preventing different bots on the same account from interfering with each other's operations (e.g., preventing the EUR/USD bot from accidentally closing positions of the GBP/JPY bot).
Stop Loss and Trailing Stop Loss Enhancement:
• Requirement: The stop loss system needs to be completely redesigned. Currently it's limited only by a global stop loss price that is the same for all positions, which needs to be changed.
-
Individual Stop Loss in pips/points: Each position must have its own Stop Loss set a specific number of pips away from the entry price (replacing the current global stop loss system).
-
Trailing Stop Loss Enhancement: The Trailing Stop Loss needs to be fixed - currently it doesn't remain constant at the highest position. A condition in pips for activation needs to be added alongside the grids. The trailing stop should:
- Only activate after the position moves favorably by a specified number of pips
- Once activated, properly follow the price movement while maintaining the specified distance in pips from the most favorable price reached
- Remain constant at the highest favorable position achieved
These optimizations are essential for ensuring the bot performs consistently in both live trading and backtesting environments.