Class RiskConfig
java.lang.Object
com.wualabs.qtsurfer.engine.strategy.RiskConfig
The risk half of an
ExecutionConfig: the opt-in guards that stop a strategy from buying
straight back in after a loss, from holding too many positions at once, or from losing more than
a day's budget.
Every knob is OFF by default, so a strategy that configures none of them behaves exactly as it
did before the guards existed. Unlike BacktestConfig these apply live as well as in a
backtest — the funnel enforces them on both paths, which is what makes them execution
configuration rather than backtest configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintHow many instruments the strategy may hold a funded position in at once. 0 (the default) means no cap.intHow many consecutive losing cycles trip the re-entry guard. 0 (the default) disables the streak trigger; 1 means a single losing cycle trips it.doubleHow much realised, post-fee loss the strategy may take in one UTC day of engine clock before new entries are refused, as a positive amount in the output currency. 0 (the default) means no cap.longHow long, in milliseconds of engine clock, new entries stay blocked after the losing cycle that tripped the guard. 0 (the default) means no cooldown.Optional macro-reset seam: while set, a tripped guard stays tripped until this returnstrue— ScalpingV2's "fail" state, which only clears on a full macro-cycle reset.voidsetMaxConcurrentPositions(int maxConcurrentPositions) How many instruments the strategy may hold a funded position in at once. 0 (the default) means no cap.voidsetMaxConsecutiveLosses(int maxConsecutiveLosses) How many consecutive losing cycles trip the re-entry guard. 0 (the default) disables the streak trigger; 1 means a single losing cycle trips it.voidsetMaxDailyLoss(double maxDailyLoss) How much realised, post-fee loss the strategy may take in one UTC day of engine clock before new entries are refused, as a positive amount in the output currency. 0 (the default) means no cap.voidsetReentryCooldownMs(long reentryCooldownMs) How long, in milliseconds of engine clock, new entries stay blocked after the losing cycle that tripped the guard. 0 (the default) means no cooldown.voidsetReentryResetCondition(BooleanSupplier reentryResetCondition) Optional macro-reset seam: while set, a tripped guard stays tripped until this returnstrue— ScalpingV2's "fail" state, which only clears on a full macro-cycle reset.
-
Constructor Details
-
RiskConfig
public RiskConfig()
-
-
Method Details
-
getMaxConsecutiveLosses
public int getMaxConsecutiveLosses()How many consecutive losing cycles trip the re-entry guard. 0 (the default) disables the streak trigger; 1 means a single losing cycle trips it. -
getReentryCooldownMs
public long getReentryCooldownMs()How long, in milliseconds of engine clock, new entries stay blocked after the losing cycle that tripped the guard. 0 (the default) means no cooldown. Measured from signal timestamps, so a backtest replaying historical stamps sees the same behaviour as a live run. -
getReentryResetCondition
Optional macro-reset seam: while set, a tripped guard stays tripped until this returnstrue— ScalpingV2's "fail" state, which only clears on a full macro-cycle reset. Not a reflected@StrategyProperty: it is a live predicate wired programmatically, not a scalar.null(the default) means no macro gate. -
getMaxConcurrentPositions
public int getMaxConcurrentPositions()How many instruments the strategy may hold a funded position in at once. 0 (the default) means no cap. Counted as locked balances, so adding to a position already held (a DCA entry) is not a new position. -
getMaxDailyLoss
public double getMaxDailyLoss()How much realised, post-fee loss the strategy may take in one UTC day of engine clock before new entries are refused, as a positive amount in the output currency. 0 (the default) means no cap. Measured as the day's cumulative net, so a later win that recovers the day lifts the block. -
setMaxConsecutiveLosses
public void setMaxConsecutiveLosses(int maxConsecutiveLosses) How many consecutive losing cycles trip the re-entry guard. 0 (the default) disables the streak trigger; 1 means a single losing cycle trips it. -
setReentryCooldownMs
public void setReentryCooldownMs(long reentryCooldownMs) How long, in milliseconds of engine clock, new entries stay blocked after the losing cycle that tripped the guard. 0 (the default) means no cooldown. Measured from signal timestamps, so a backtest replaying historical stamps sees the same behaviour as a live run. -
setReentryResetCondition
Optional macro-reset seam: while set, a tripped guard stays tripped until this returnstrue— ScalpingV2's "fail" state, which only clears on a full macro-cycle reset. Not a reflected@StrategyProperty: it is a live predicate wired programmatically, not a scalar.null(the default) means no macro gate. -
setMaxConcurrentPositions
public void setMaxConcurrentPositions(int maxConcurrentPositions) How many instruments the strategy may hold a funded position in at once. 0 (the default) means no cap. Counted as locked balances, so adding to a position already held (a DCA entry) is not a new position. -
setMaxDailyLoss
public void setMaxDailyLoss(double maxDailyLoss) How much realised, post-fee loss the strategy may take in one UTC day of engine clock before new entries are refused, as a positive amount in the output currency. 0 (the default) means no cap. Measured as the day's cumulative net, so a later win that recovers the day lifts the block.
-