Regime specific position sizer
Position size by market regime; this app feeds it the price instead, so the size never changes.
RegimeSpecificPositionSizer returns a position size, not a signal. It multiplies base_size by a factor picked from the regime number it receives: 2.0 for regime 1, 1.5 for 2, 1.0 for 0, 0.8 for 5, 0.6 for 4, and 0.3 for regime 3 or any other value. The regime is meant to come from ExplosiveRegimeDetector, which outputs 0 to 5, but this app wires the regime input to the close price, which is never 0 to 5, so every bar takes the 0.3 branch.
How to read it
- The line sits in its own pane below the price, not on the candles.
- On SPY one-minute bars with defaults it is flat at 0.075 on every bar, which is 0.3 times the default base_size of 0.25.
- A flat line means the sizer carries no information about the market here; it does not react to trends or volatility.
What it outputs
- Position size
- base_size times a regime factor. Here the regime input is the price, so it reads 0.075 on every bar at defaults.
Settings
- base_size
- Scales every size: each output is base_size times a regime factor. Raising it lifts the flat line in proportion (0.25 gives 0.075, 1.0 gives 0.3 here). Negative values flip the sign of every size.
Pitfalls
- Built as intended it needs an ExplosiveRegimeDetector on its regime input. Wired to the price, as in this app, the regime never matches 0 to 5 and the size never changes.
- The output is a size ratio, not a price: its values sit near 0.0001 of the close, so do not read them against the candles.
- base_size accepts -26 to 26. A negative value flips every size's sign, and values far above 1 are not sensible sizes.