Carpe Diem Trading Algo - CoreCarpe Diem Trading Algo - CORE is the central signal engine of the Carpe Diem suite, built to select, track, and score multiple entry methods inside one unified framework. It is designed for traders who want one clean BUY/SELL stream that adapts to the market regime instead of juggling separate indicators.
CORE is inspired by well‑known technical analysis ideas (trend vs range regimes, Z‑Score, Stoch, structure breaks, money flow, ATR‑based risk), but every component is implemented from scratch and then extended, so it is not a wrapper or clone of any public script. What you see on the chart is a custom architecture that combines these concepts into a single regime‑aware, multi‑engine signal and risk/EDGE system.
At the base layer, CORE uses a custom range/regime engine that classifies price into bullish, bearish, or neutral conditions using an ATR‑normalized oscillator around a regime moving average. It measures the distance between price and a configurable MA, normalizes that distance by ATR, smooths it, and then applies a dead zone and “avoid ranging / only ranging” options to define where the system is allowed to trade. All signal engines run through this regime layer, so the same method behaves differently in clean trends vs choppy ranges instead of firing blindly in all conditions.
On top of the regime filter, CORE offers eight interchangeable signal engines that all feed the same BUY/SELL plots, each using classic ideas in a bespoke way:
DER Color‑Match: builds bullish/bearish pressure from weighted positive and negative returns, then creates a separate spike line and requires color‑matched agreement between signal and spike to confirm entries; this is a custom directional returns model, not a port of any public “DER” or “delta” script.
Z‑Score: computes the Z‑score of price over a configurable lookback, smooths it and uses zero‑line crosses only when they align with the background regime; this is a tailored Z‑score implementation inside the CORE regime system, not a direct copy of any existing Z‑score indicator.
TPR (Trend–Pullback–Resume): detects trend extensions away from the regime MA, waits for a controlled pullback into ATR‑scaled proximity bands, then looks for a resume of momentum with strict timeouts for each phase; this three‑stage pattern is coded specifically for CORE and is not based on any one published script.
WTMF Blend: combines a WaveTrend‑style oscillator and a Money Flow measure into a single normalized blend with configurable weights and a “lock‑until‑opposite” behavior; the formulas and blending logic are customized, and CORE does not reuse a public WaveTrend or money‑flow script.
MSB Structure Break & Retest: tracks swing highs/lows, detects breaks using either closes or wicks, and optionally waits for an ATR‑scaled retest window with relaxed or strict modes; it is built specifically for this algo and is not a clone of any existing “MSB/CHOCH” script.
Stoch Regime: uses a centered, sensitivity‑controlled Stoch K/D pair that is only allowed to signal in alignment with the bullish/bearish background regime; this is a custom, regime‑aware Stoch implementation rather than a direct lift of any public Stoch strategy.
Spike Thresholds: computes ATR‑normalized deviation from a moving average, smooths it, and uses separate long/short thresholds to detect spikes that also agree with the regime filter; it is a bespoke spike engine, not a republish of classic “spike” indicators.
Trajectory Momentum: measures ATR‑normalized momentum between fast and slow EMAs plus EMA‑smoothed acceleration, with the option to “lock until opposite” so trends are not exited on every minor correction; this is a custom trajectory design, not a copy of a known open‑source trend tool.
In addition to the main engines, CORE includes proprietary extension/exhaustion markers that run in the background as context only. They use a custom half‑cycle calculation with a configurable half‑length and ATR‑based bands around a composite price (close/open/high/low/median/typical/weighted/average) to track where price is pressing into statistically extended zones. When enabled, these markers plot small X’s at potential extension highs/lows and can trigger optional alerts, giving you an exhaustion layer that is designed specifically for CORE’s regime logic rather than copied from any public “exhaustion” or “extension band” script.
CORE also includes a dedicated DER Spike Strength filter that is unique to this script. It measures both distance and slope between the DER signal and its spike line, builds adaptive baselines over a dynamic lookback, and then derives dynamic thresholds that can gate DER entries or even invalidate an existing DER state when strength fades. You can choose whether strength is only an entry qualifier or also a post‑entry filter.
To evaluate methods over time, CORE runs an internal EDGE tracker that converts trade outcomes into an R‑based score per method and per context. For each BUY or SELL trigger, the script simulates a position with ATR‑based TP and SL, tracks how price evolves over a fixed evaluation window, and assigns an outcome within a bounded R range, including penalties for unresolved trades or both TP and SL being touched in the same bar. Those outcomes feed exponential moving statistics and are mapped into a 0–100 EDGE value. The EDGE model itself is a completely proprietary scoring framework that was designed specifically for CORE.
The risk panel in the top‑right is a persistent table rather than a simple label. For every engine, it shows the last persistent state (BUY, SELL, or FLAT) according to that engine’s logic and the current regime, plus a compact EDGE number that represents the recent average R performance of that engine in context (trend vs. range, long vs. short). The panel uses this EDGE value to drive a traffic‑light color scheme for each engine’s main cell: high EDGE values are shown with a green background to indicate lower historical risk and better recent performance, low EDGE values are shown with a red background to indicate higher historical risk and weaker recent performance, and mid‑range EDGE values are shown in a more neutral tone between those extremes. Cells that are still warming up, or for engines that are not currently being computed, are displayed in a neutral gray so you can immediately distinguish between active, proven engines and inactive or unready rows. This lets you read the panel as “Which engine currently carries the most favorable risk profile here?” instead of only seeing raw signals, and you can use it to avoid running a method that is currently underperforming in this regime while rotating toward engines that have demonstrated stronger recent R outcomes. Optional alerts can fire when the selected engine’s risk state flips between favorable and unfavorable zones so you are notified when the underlying EDGE profile for your chosen method materially changes.
Because this is a vendor‑grade, invite‑only tool, CORE also includes an automatic profile system to help avoid overfitting without forcing you to retune everything manually. Timeframe‑aware defaults adjust core inputs such as range length, dead‑zone size, DER length, Z‑Score lookback, and adaptive strength parameters depending on your chart resolution, and those defaults are further modified by profile (Conservative, Balanced, or Aggressive) and asset preset (Crypto, FX, Indices, or Stocks). You can override any parameter, but the auto profile is designed to give you robust starting points that already respect volatility and instrument behavior.
Usage guidelines:
Use the risk/EDGE panel as a live risk dashboard: focus on engines whose cells show strong green tones with higher EDGE numbers when you want to lean into the current regime, and treat red or gray cells with low EDGE as higher‑risk engines to deprioritize until their recent performance improves.
Choose a signal engine that matches your style (for example, DER or Trajectory for momentum, TPR or MSB for swing structure, or Stoch or Z‑Score for regime‑aware mean reversion).
Keep the range/regime and dead‑zone filters enabled if you want fewer but higher‑quality signals that avoid sideways noise.
Optionally enable extension/exhaustion markers as a context layer to highlight areas where price is statistically stretched, then combine that information with the main BUY/SELL engine (for example, taking TPR or Trajectory signals that align with exhaustion at the edge of a regime zone).
By default, signals are confirmed at bar close to avoid intrabar repaint of entries; you can still enable debug or extra plots for research, but the standard template is the clean BUY/SELL output with the risk/EDGE panel and, optionally, the extension markers.
Final points —
The source code is invite‑only because the combination of the regime engine, DER + adaptive strength framework, multi‑engine signal routing, proprietary extension/exhaustion context, and the fully proprietary R‑based EDGE and risk panel is original to the Carpe Diem suite. While CORE uses well‑known concepts, the way they are integrated and extended in this script is proprietary and not a reproduction of any specific open‑source indicator or strategy
Pine Script® indicator






















