| field | ● Mi | ● V1 | ● V2 | ● PY |
|---|---|---|---|---|
| on/off | On | On | On | On |
| init lot | 0.06 | 0.15 | 0.15 | 0.06 |
| grid ratio | 10.0 | 10.0 | 10.0 | 10.0 |
| dca dist | 1.0 | 1.0 | 1.0 | 1.0 |
| dca sl | 15.0 | 15.0 | 15.0 | 15.0 |
| power 1 | 4.0 | 4.0 | 4.0 | 4.0 |
| power 2 | 8.0 | 8.0 | 8.0 | 8.0 |
| power 3 | 16.0 | 16.0 | 16.0 | 16.0 |
| min count | 3 | 3 | 3 | 7 |
| anchor key | 5000.23 | 4950.11 | 4900.55 | — |
When price sits inside a gap (lo, hi), open both BUY and SELL with a small TP equal to (hi−lo)/scalpRangeRatio − 0.5. No SL. Skips if a same-direction order already lives within the same distance.
Both directions fill simultaneously. HasPositionNearby blocks duplicates within the same distance window.
When price is within dcaEntryDistance of a key, fire a counter-trend order sized as positionCount × initLot × power. Each key may only be DCA’d once per side. Requires minCountDca existing positions to arm.
Gates: must have cnt ≥ minCountDca open, key not in dcaHistory, and no DCA already being tracked.
Once a DCA leg exists and aggregate profit covers any prior SL losses (slLoss1 + slLoss2), a peak trail of cnt dollars closes all same-side positions when price pulls back from the high-water mark.
On close, ClearDcaState wipes history, slLoss1, slLoss2, and the peak. Cycle restarts clean.
slLoss1 (negative)dcaHistory kept — key still lockeddcaPower2|slLoss1|slLoss2dcaPower3|slLoss1| + |slLoss2|ClearDcaState