| # | price | key gap | grid tp |
|---|---|---|---|
| 12 | 4900.55 | — | — |
| 11 | 4867.00 | 33.55 | 2.86 |
| 10 | 4822.00 | 45.00 | 4.00 |
| 9 | 4775.00 | 47.00 | 4.20 |
| 8 | 4730.00 | 45.00 | 4.00 |
| 7 | 4682.00 | 48.00 | 4.30 |
| 6 | 4635.00 | 47.00 | 4.20 |
| 5 | 4595.00 | 40.00 | 3.50 |
| 4 | 4554.00 | 41.00 | 3.60 |
| 3 | 4513.00 | 41.00 | 3.60 |
| 2 | 4470.00 | 43.00 | 3.80 |
| field | ● Minh | ● VAT 28/04 | ● VAT | ● Platform Y |
|---|---|---|---|---|
| account | 159956839 | 159994119 | 183970898 | 183853975 |
| 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