Fix Pine Script DCA Strategy with Multi-Cycle Order Logic

Job ID: 39570530

Budget: $30 – $250 USD

I need an experienced Pine Script developer to fix an issue in a DCA-based TradingView strategy that uses multiple sub-cycles (SC1, SC2, etc.).

The strategy is designed to:

Open base orders and safety orders per sub-cycle

Close each sub-cycle independently upon reaching its target

Then initiate a new sub-cycle with a new base order

The issue:
Currently, when a sub-cycle closes (e.g., SC1), the base order of the next sub-cycle (SC2) incorrectly references and closes SC1's base order and safety orders. This misaligns order tracking and creates incorrect profit/loss readings and cycle behavior.

What I need:

Analyze the existing strategy code

Identify and fix the cycle isolation logic

Ensure each sub-cycle’s base and safety orders are independent and correctly tracked

Maintain existing DCA logic without introducing bugs

Provide clean, well-commented code and help with basic testing/validation

Ideal Developer:

Strong Pine Script (v5) experience

Prior work with DCA, grid, or multi-order strategies

Attention to detail and clean coding habits

Able to communicate clearly and provide updates

Please provide examples of past Pine Script work or similar fixes, and an estimated timeframe and budget.