RISE Framework Specification - End-to-End Workflow
Spec ID: 40
Version: 1.0
Document ID: caishen-rise-workflow-v1.0
Last Updated: 2025-01-31
What the Fractal Breakout Workflow Enables Users to Create:
Desired Outcomes:
┌─────────────────────────────────────────────────────────────────────────────┐
│ FRACTAL BREAKOUT TRADING WORKFLOW │
└─────────────────────────────────────────────────────────────────────────────┘
Phase 1: Data Acquisition
PDS → Fetch price data from broker/source
↓
Phase 2: Analysis
ADS → Build ChaosDataBuilder with all indicators
CDS → Calculate fractals, alligator, AO, AC
IDS → Generate indicator values
↓
Phase 3: Signal Detection
ADS → Detect initiating fractal signals
CDS → Identify divergence patterns
↓
Phase 4: Strategy Creation
User → Confirms fractal breakout setup
SDS → Creates BDBO strategy with breakout level
THS → Saves market snapshot
↓
Phase 5: Monitoring
Loop → Price updates trigger CDB recalculation
SDS → Checks if price broke through fractal level
↓
Phase 6: Execution
SDS → State advances on breakout detection
Order → Entry order submitted to broker
↓
Phase 7: Management
SDS → Tracks order status
THS → Records all state changes
↓
Phase 8: Completion
SDS → Strategy closed after fill or cancellation
BITT → Timeline preserved for review
1. Scheduler triggers PDSEngine update
2. PDSEngine fetches latest bars from ForexConnect
3. Price data saved to JSON files
4. PDSService reads from cache/files
ForexConnect API
│
▼
PDSEngine2203.exe
│
▼
/cdb-dto/{pov}.json
│
▼
PDSService.GetPriceHistory()
Input:
- Instrument: "EUR/USD"
- Timeframe: "H4"
- DateRange: "LAST to LAST"
Output:
- PriceHistoryBase with 300+ bars
- OHLCV data normalized
1. ADSService receives GetCDB request
2. Fetches PriceHistoryBase from PDS
3. Calculates Alligator (SMMA 13/8/5 shifted 8/5/3)
4. Calculates Awesome Oscillator (5/34 SMA diff)
5. Calculates Accelerator (AO - SMA5(AO))
6. Detects Fractals (N-bar high/low patterns)
7. Determines Zones (green/red based on AO+AC direction)
8. Calculates Gator mouth openness
9. Detects divergence patterns
10. Assembles ChaosDataBuilder
Jaw = SMMA(MedianPrice, 13).Shift(8) # Blue
Teeth = SMMA(MedianPrice, 8).Shift(5) # Red
Lips = SMMA(MedianPrice, 5).Shift(3) # Green
MedianPrice = (High + Low) / 2
AO = SMA(MedianPrice, 5) - SMA(MedianPrice, 34)
AC = AO - SMA(AO, 5)
FractalBear = High where High > all surrounding N highs
FractalBull = Low where Low < all surrounding N lows
If AO rising AND AC rising: Zone = Green (buy momentum)
If AO falling AND AC falling: Zone = Red (sell momentum)
Else: Zone = Gray (neutral)
ChaosDataBuilder:
- Instrument: "EUR/USD"
- Timeframe: "H4"
- ChartBars: [BarChaosItem...] with all indicators
- TrendLastWave: "UP" or "DOWN"
- NbBarMouthIsOpen: count of bars
- MarketOverViewer: divergence state
An Initiating Fractal is a fractal that forms after a period of consolidation within the Alligator mouth, indicating potential trend start.
def detect_initiating_fractal(cdb: ChaosDataBuilder) -> FractalSignal:
"""
1. Find most recent fractal (buy or sell)
2. Check if prior bars were inside Alligator mouth
3. Check if current bars are breaking out of mouth
4. Validate with AO direction
"""
recent_fractals = [b for b in cdb.chart_bars if b.fractal_buy or b.fractal_sell]
if not recent_fractals:
return None
last_fractal = recent_fractals[-1]
# Check if mouth was closed before fractal
mouth_closed_before = all(
abs(b.lips - b.teeth) < threshold
for b in bars_before_fractal
)
# Check if mouth is opening now
mouth_opening = abs(current.lips - current.teeth) > abs(prior.lips - prior.teeth)
if mouth_closed_before and mouth_opening:
return FractalSignal(
direction="BUY" if last_fractal.fractal_buy else "SELL",
price=last_fractal.fractal_buy or last_fractal.fractal_sell,
date=last_fractal.dt
)
CheckLastFractalInitiatingInfoResultPlus:
- HasSignal: bool
- Direction: "BUY" or "SELL"
- BreakoutPrice: decimal
- FractalDate: DateTime
- ValidationScore: int (1-10)
- ResultString: "EUR/USD H4: BUY signal at 1.0850"
NewBDBBOEntryStrategyUI:
- Instrument: (from chart)
- Timeframe: (from chart)
- BreakoutPrice: (from fractal level)
- Direction: (from fractal type)
- MaxPipRisk: (user configurable, default 120)
- MaxPUI: (periods until invalid, default 1000)
- Note: (optional)
SDSService.CreateBdboStrategy({
BdboStrategyDto: {
Instrument: "EUR/USD",
Timeframe: "H4",
BreakoutPrice: 1.0850,
BuySell: "S",
Active: true,
MPR: 120,
MaxPUI: 1000
}
})
CreateBDBOStrategyResponse:
- Success: true
- BdboStrategyDto: (with Idug assigned)
- Message: "Strategy created"
THSComponent.Create(dto, "BDBBO.Created"):
- Saves current CDB as JSON snapshot
- Records strategy parameters
- Links snapshot to strategy via CorrelationId
Every N minutes:
1. PDSEngine updates price data
2. ADSService rebuilds CDB
3. For each active strategy for this POV:
- Check if price broke through breakout level
- Update strategy state if triggered
def check_breakout(strategy: BDBOStrategy, bar: BarChaosItem) -> bool:
if strategy.buy_sell == "S": # Sell strategy
if bar.low < strategy.breakout_price:
return True # Price broke below fractal high
if strategy.buy_sell == "B": # Buy strategy
if bar.high > strategy.breakout_price:
return True # Price broke above fractal low
return False
def is_strategy_still_valid(strategy: BDBOStrategy, bars_since_creation: int) -> bool:
if bars_since_creation > strategy.max_pui:
return False # Too many periods passed
if strategy.ceoc >= strategy.max_eoc:
return False # Too many order cancellations
return True
On breakout detection:
1. Strategy.State = PriceBrokeOut
2. Entry order submitted to broker
3. Strategy.State = Placed (awaiting fill)
4. Order response recorded
BDBOOrderRequest:
- StrategyIdug: (strategy ID)
- Instrument: "EUR/USD"
- Side: "Sell"
- OrderType: "Stop"
- Price: 1.0850
- Quantity: (calculated from risk)
def calculate_quantity(
breakout_price: float,
stop_loss_pips: int,
max_risk_usd: float,
pip_value: float
) -> float:
risk_pips = stop_loss_pips
quantity = max_risk_usd / (risk_pips * pip_value)
return round(quantity, 2)
BDBOOrder states:
- Pending: Order submitted, awaiting fill
- Filled: Order executed
- Canceled: Order canceled (by user or system)
- Rejected: Broker rejected order
Placed → PriceBrokeOut (when price crosses breakout)
PriceBrokeOut → Filled (when order filled)
Filled → Closed (when trade closed)
Alternative paths:
Placed → EntryOrderCanceled (order canceled before fill)
EntryOrderCanceled → Placed (new order at adjusted price)
Placed → Deactivated (max cancels exceeded or timeout)
vBDBOStrategyOrderingHistory:
- StrategyIdug: (parent strategy)
- EventType: "Placed", "Filled", "Canceled"
- Price: (execution/order price)
- Dt: (event timestamp)
- Message: (broker response)
On position close:
1. Record exit price and P&L
2. Update BDBOTrade with close data
3. Set Strategy.State = Closed
4. Save final THS snapshot
THSComponent.Create(dto, "BDBBO.Closed"):
- Market state at close
- Full trade metrics
- Links to entry snapshot for comparison
BITT stores:
- Entry timeline point (strategy creation)
- State change timeline points
- Exit timeline point
- CDB snapshots at each point
Timeline: EUR/USD H4 Sell Fractal Breakout
T+0h (Jan 30, 2025 14:00):
- Price forms fractal high at 1.0850
- ADS detects initiating fractal signal
- User creates BDBO strategy: Sell @ 1.0850
- State: Created → Placed
- THS snapshot saved
T+4h (Jan 30, 2025 18:00):
- H4 bar closes at 1.0845
- Price has not broken through 1.0850
- Strategy remains in Placed state
T+8h (Jan 30, 2025 22:00):
- H4 bar closes at 1.0855
- Price touched 1.0850 but bounced
- Strategy still waiting
T+24h (Jan 31, 2025 14:00):
- H4 bar closes at 1.0830
- Low was 1.0820, broke through 1.0850
- State: Placed → PriceBrokeOut
- Entry order triggered
T+24h+5min:
- Order filled at 1.0848
- State: PriceBrokeOut → Filled
- BDBOTrade created
T+48h (Feb 1, 2025 14:00):
- Target reached at 1.0750
- Position closed
- State: Filled → Closed
- P&L: +100 pips
- Final snapshot saved
The Fractal Breakout Workflow transforms market analysis into actionable trading:
This workflow embodies the RISE principle of advancing patterns - each phase naturally leads to the next, creating inevitable progression toward the desired outcome of executed, profitable trades.