MA Rebound Continuation
Trend-continuation entry that requires a pullback to touch a moving average and then reclaim it, with an asymmetric exit buffer and a long-horizon trend gate. Ships no tuned period or buffer values.
Trend-continuation entry that requires a pullback to touch a moving average and then reclaim it, with an asymmetric exit buffer and a long-horizon trend gate. Ships no tuned period or buffer values.
Buying a pullback in an uptrend is the most commonly stated and least commonly specified rule in technical trading. "Wait for a bounce off the MA" hides three separate questions: how close to the MA counts as a touch, how far above it counts as a bounce, and how far below it counts as a failure. This package makes all three explicit and asymmetric. The entry needs a touch on the previous bar followed by a reclaim on the current bar, so a bar that merely drifts above the average is not a signal. The exit uses a separate, usually wider buffer, because a break that is only as wide as the entry tolerance produces constant whipsaw exits. A long-horizon filter on top of the same window suppresses the entire structure when price is below its long average. WHEN TO USE THIS • An agent has to answer "is this dip buyable, or is the trend finished?" • You want a continuation entry that is conditional on a prior touch, not a generic "price above average" filter that fires every bar. • You need an exit rule that is provably different from the entry rule. Not appropriate for a range-bound market - the long-horizon filter will keep the structure silent, which is the intended behaviour but looks like a bug if you do not expect it. WHAT THIS PACKAGE DELIBERATELY DOES NOT CONTAIN This is a framework release, not the tuned production build. Specifically: • No position sizing and no stop distance. The ATR or percentage stop you pair with this is not part of the package. • No multi-symbol scanning. One symbol, one timeframe, one decision per call. • No tuned period or buffer values. The window length in particular is the single most over-fitted number in this family, so it ships as an input. • No default thresholds in code. scripts/ma_rebound.py raises PARAM_INCOMPLETE rather than falling back to a number. A silent default would make you believe you are running a calibrated system when you are running someone else's parameters. Every decision boundary is an input. That is the whole contract. DECISION CONTRACT • action: Condition • long: Long-horizon filter is up and previous close was within the touch tolerance of the average and current close is above it by at least the bounce buffer • exit: Current close is below the average by at least the break buffer • flat: Everything else, including insufficient history The response also carries ma, deviation and trend_up so a caller can log why the decision came out the way it did instead of guessing from reason. OUTPUT SCHEMA { "action": "long", "price": 63180.5, "ma": 62840.1, "deviation": 0.00542, "trend_up": true, "reason": "rebound off the average: deviation 0.54% clears the 0.80% buffer" } action is the only field you must branch on. reason is meant for logs and for an agent to quote back to a human — do not parse it. RUN IT python3 scripts/ma_rebound.py \ --params references/params-example.json \ --symbol BTC/USDT \ --interval 1h references/params-example.json holds round, obviously-illustrative numbers. They exist so the command runs on the first try, not because they are good. Feeding position state in: python3 scripts/ma_rebound.py --params my.json --state '{"avg_entry": 61250.5, "layers": 2}' CALIBRATING THE THRESHOLDS 1. ma_period - the pullback horizon. A short window turns this into a scalper and the touch condition fires constantly; a long window makes the entry rare. Sweep a coarse grid, then check whether the selected value sits on a plateau or on a spike. Pick the middle of the plateau, never the peak. 2. rebound_buffer - how much evidence counts as a bounce. Too small and every lower wick triggers it; too large and you only ever enter after the move is over. 3. breakout_buffer - the exit tolerance. Deliberately wider than the entry buffer in the reference shape, because exits are evaluated on a single close and a symmetric buffer guarantees churn. Validate out of sample in time order: calibrate on the earlier ~70% of bars, then confirm the same parameters on the final ~30% without touching them. Report both blocks separately; a single blended number hides the failure. KNOWN LIMITS • The long-horizon filter uses a hard-coded 200-bar comparison when enough history is present. If you feed fewer bars the filter silently turns permissive, so pass enough history for your chosen period plus the filter window. • The touch condition is evaluated on closes only. Intrabar wicks that pierce the average and recover within the same bar are invisible. • No volatility adjustment: the same buffer means different things in a quiet and a violent regime. • Signals are evaluated on the last closed bar. The still-forming bar is ignored, so the decision for the current bar does not repaint. DISCLAIMER This is a decision framework for research and education. It is not investment advice, not a profit claim, and not a backtest result. Crypto derivatives can lose more than the deposit. You are responsible for the parameters you choose and for every order your executor places.
ipfs://bafkreiapqnuutmgyrejejyibae24wirbmcf55zxi42qn2ybmzaevcce62a
The primary-document hash is the SHA-256 of the plaintext primary Markdown file. The content-commitment hash covers the verified SkillRoot structure, or plaintext ZIP for older Skills; it is not the hash of the downloaded file.
Opaque identifiers and fingerprints are hidden from the primary experience but remain available for exact verification.
0x33f5ee2471461fc347fd25313f0546a14e3329269a92d5c642348cd2e8acea8e0xcab7401fd3e1f0354ec7a2cd599b25a5115f5de5d2182f9495d717cc37c3a004