# Trade Management And Scaling

Version 5 changes important trade lifecycle behavior. Existing Version 4 trade-management assumptions should be rechecked before live use.

## Multi-Level Partial Close[​](#multi-level-partial-close "Direct link to Multi-Level Partial Close")

Version 5 supports PC1, PC2, and PC3:

* PC1: `PartialClosePercentage` and `PC_Value`.
* PC2: `PC_Level2_Percentage` and `PC_Level2_Value`.
* PC3: `PC_Level3_Percentage` and `PC_Level3_Value`.

Each trigger can be configured by the selected partial-close method. A value of `0` for a later level is used to keep that level off.

## Exit Templates After Partial Close[​](#exit-templates-after-partial-close "Direct link to Exit Templates After Partial Close")

`TMExitTemplate` controls what happens to the remainder after partial-close events.

Available templates include:

* `TM_EXIT_TEMPLATE_PARTIAL_ONLY`: partial close only, remainder unchanged.
* `TM_EXIT_TEMPLATE_PARTIAL_TO_BE`: move remainder to break even.
* `TM_EXIT_TEMPLATE_PARTIAL_TO_CANDLE`: arm candle trailing.
* `TM_EXIT_TEMPLATE_PARTIAL_TO_SWING`: arm swing trailing.
* `TM_EXIT_TEMPLATE_PARTIAL_TO_BE_CANDLE`: move to break even and arm candle trailing.
* `TM_EXIT_TEMPLATE_PARTIAL_TO_BE_SWING`: move to break even and arm swing trailing.

## Conditional Trailing Activation[​](#conditional-trailing-activation "Direct link to Conditional Trailing Activation")

`TrailActivationCondition` can delay trailing until a lifecycle event has happened.

Available conditions include:

* `TRAIL_CONDITION_NONE`: price-distance logic only.
* `TRAIL_CONDITION_AFTER_BE`: after break even.
* `TRAIL_CONDITION_AFTER_PC1`: after PC1.
* `TRAIL_CONDITION_AFTER_BE_or_PC1`: after break even or PC1.
* `TRAIL_CONDITION_AFTER_BE_and_PC1`: after break even and PC1.

The trailing distance and activation values still come from the trailing method settings.

## Conditional Scale-In[​](#conditional-scale-in "Direct link to Conditional Scale-In")

`MultiTradeMode` controls when a same-direction additional trade is allowed.

Available modes include:

* `MT_Disabled`: no scaling.
* `MT_Free`: any valid same-direction signal can scale in.
* `MT_AfterBE`: only after an existing same-direction trade reaches break even.
* `MT_AfterPC1`: only after PC1 has occurred.
* `MT_AfterBE_or_PC1`: break even or PC1 is enough.
* `MT_AfterBE_and_PC1`: both break even and PC1 are required.

`MaxOpenTrades` is still the ceiling, even when scale-in conditions are met.

## Pending Order Lifecycle[​](#pending-order-lifecycle "Direct link to Pending Order Lifecycle")

Version 5 pending-order behavior includes:

* `CancelAfterBars`: cancel pending orders after the configured number of bars.
* `PendingEMAInvalidationMode`: cancel pending orders when a closed bar invalidates against the chosen EMA.
* `EnablePendingOrderHistory`: optional pending-order history logging.

EMA invalidation modes include:

* `PENDING_EMA_INVALIDATION_NONE`
* `PENDING_EMA_INVALIDATION_FAST`
* `PENDING_EMA_INVALIDATION_SLOW`
* `PENDING_EMA_INVALIDATION_SLOWEST`

## What To Recheck When Upgrading[​](#what-to-recheck-when-upgrading "Direct link to What To Recheck When Upgrading")

Recheck these before live use:

* partial-close percentages and trigger values
* whether trailing starts immediately or after a lifecycle condition
* whether scale-in is disabled, free, or conditional
* maximum open trades
* pending-order cancellation rules
* Magic Number ownership
* Smart Risk protection behavior
