OPEN-SOURCE SCRIPT

Milamar Trading OS v6.11

469

// Changelog v6.11
// - Converts Replay build back to a pure indicator()
// - Removes all external order calls for fast Replay stepping
// - Simulates Paper Entry, TP1, TP2, SL, BE and HEALTH_EXIT internally
// - Keeps Trade Health v2.1 recommendations and Performance Modes
// - Keeps stable BACKTEST / Replay config anchor from v6.10.1 base
// - Routes A+ Entry-Zone alerts through the final setupState transition so alerts and Info Table share one status source
// - Gates A+ Entry-confirmed alerts to the actual active/fill event instead of the pre-fill confirmation state
//
// Changelog v6.10.1
// - Fixes BACKTEST / Replay config anchor so activeConfigStart never depends on last_bar_time
// - Adds optional Backtest Start Mode AUTO_08 / MANUAL
// - Keeps Performance Mode FULL / BACKTEST_FAST / ENGINE_ONLY unchanged
// - Adds DEBUG_COUNTERS-only Config Start Debug row
//
// Changelog v6.10
// - Adds Performance Mode: FULL / BACKTEST_FAST / ENGINE_ONLY
// - Replaces per-key config parsing with one-pass active-asset parser
// - Gates heavy visuals, event labels and cockpit updates by performance mode
// - Reduces heavy Paper Engine updates with entry-state keys
// - Adds v6.9.1 Health fixes: TOT priority, no same-bar Health BE, robust day type mapping
//
// Changelog v6.9
// - Adds context-aware Trade Health Engine v2.1
// - Adds Health phases PRE_TP1 / RUNNER_AFTER_TP1 / CLOSED
// - Uses dynamic age profiles for With-Day-Type, Balanced, Against-Day-Type and Neutral trades
// - Scores Progress, Efficiency, Momentum, Age, Price Position and Context from 0 to 100
// - Adds hard PRE_TP1 exit rules and BE protection rules
// - Disables Health hard exits after TP1; runner continues classically to TP2 or BE
// - Expands cockpit Health debug with phase, expected TP1 progress, MFE/MAE ratio and minutes since best MFE
//
// Changelog v6.8
// - Adds Trade Health Engine v1 for active trades
// - Adds Trade Health mode input: OFF / ANALYSE / AUTO PAPER
// - Calculates Health Score, status, recommendation and reason from trade age, MFE, MAE, TP1 progress and momentum
// - Decouples Trade Health recommendations from current open PnL
// - Evaluates setup delivery / trade structure instead of Dollar profit or loss
// - Supports exactly three recommendations: Halten, SL auf BE, Hart raus
// - Applies Trade Health recommendations automatically only in BACKTEST when mode is AUTO PAPER
// - Routes internal TP/SL State Engine through the active Paper SL after Trade Health moves SL to BE
// - Stores active Paper Stop hits at Entry as BE instead of classic SL
// - Makes Paper BE a terminal cockpit exit and stops Trade Health after Paper close
// - Uses fixed Paper quantities so Health BE before TP1 closes the full open position
// - Uses a single full-position BE stop before TP1 to prevent leftover Paper positions
// - Waits for the real configured Entry fill before starting Paper state
// - Shows Trade Health as Exit Grund for Health-managed exits and keeps Laufzeit in Review
// - Maps Health Status TOT directly to Hart raus / HEALTH_EXIT unless SL or TP2 is hit on the same bar
// - Freezes final Health Score, Status, Recommendation and Reason after Paper close
// - Places Paper Entries as pending internal triggers at the configured Entry price
// - Keeps STATE_CONFIRMED until the Entry trigger is filled by price
// - Keeps STATE_CONFIRMED until the configured Entry price is actually filled
// - Starts Trade Age, MFE, MAE, Acceptance and Trade Health only after the real Entry fill
// - LIVE mode shows recommendations without changing orders
// - Adds Health Managed Outcome and Original Outcome comparison
// - Adds Trade Health cockpit rows and Trade Health alerts
// - Tuning #1: makes Trade Health escalation more conservative and prefers SL auf BE before Hart raus
// - Aborts stale Confirmation when max bars expire or price moves too far against the touched Entry
//
// Changelog v6.7
// - Adds Master Alert mode using Any alert() function call
// - Adds alert mode input: LIVE / BACKTEST / AUS
// - Standardizes alert payloads with Asset, Quality, Direction, Config, Time and State
// - Adds Confirmation Close Rule: Entry can only confirm on barstate.isconfirmed
// - Allows intrabar confirmation preview without STATE_CONFIRMED / STATE_ACTIVE transition
// - Adds BACKTEST-only Paper Trading simulation; LIVE remains visual / alert-only
// - Uses automatic Paper quantity: MNQ = 2 contracts, MBT = 5 contracts
// - Simulates Entry, TP1 partial and runner internally
// - Closes 50% at TP1, activates Break-even, then manages the runner to TP2 / BE / SL
// - Tracks Paper Trade data: Qty, MFE, MAE, BE status and Outcome
// - Makes the Trading Cockpit state-aware: Setup, Trade and Review phases show only relevant rows
//
// Changelog v6.6
// - Improves Info Table status guidance for Setup, Touch, Confirmation and Trade phases
// - Shows Confirmation Score as current / required score
// - Updates displayed Confirmation Score live from SETUP AKTIV onward without changing entry logic
// - Adds Explain Preview text in the Grund row as first step toward the Explain Engine
// - Adds Akzeptanz Engine after Entry to observe first post-entry momentum without exits
// - Keeps State Machine, Freshness, Confirmation formula and TP/SL Engine unchanged
//
// Changelog v6.5.2
// - Uses the current chart bar as activation anchor for pasted configs in LIVE and BACKTEST
// - Hard-resets the full trade state machine on config changes
// - Blocks setup, touch, confirmation and TP/SL evaluation before the active config bar
// - Prevents old Entry / TP / SL values from surviving a pasted config change
//
// Changelog v6.5.1
// - Makes TP/SL execution deterministic and blocks same-bar exit checks after Entry
// - Adds Entry / Exit Bar, Price, Reason and Trigger debug fields
// - Treats provided paste configs as complete asset replacements with missing values set to 0
// - Scopes activeConfigKey to the active asset config only
// - Adds Config Status validation to the Info Table
//
// Changelog v6.5
// - Adds MNQ / MBT config paste inputs for daily config updates without Pine Editor changes
// - Parses pasted config text with hardcoded defaults as fallback
// - Includes pasted config text in activeConfigKey for clean state resets
// - Reframes SETUP INVALIDIERT as a protective state instead of a loss / error state
//
// Changelog v6.4
// - Simplifies trader-facing inputs into Betrieb, Confirmation and Reset / Debug groups
// - Removes manual Backtest date/time inputs and Backtest Config-ID
// - Anchors LIVE and BACKTEST automatically to the chart day at 08:00 Madrid
// - Stabilizes Trade Plan Box rendering for Replay
// - Separates Entry Touch from Confirmation conditions
// - Keeps CONFIG ID as reset trigger and preserves shared Trading Logic
//
// Changelog v6.3
// - Adds LIVE / BACKTEST operating mode
// - Introduces activeConfigStart as shared time source for all engines
// - Adds central alert gate for LIVE and BACKTEST
// - Keeps one shared Trading Logic for both modes
//
// Changelog v6.2
// - Adds score-based Confirmation Engine in STATE_TOUCHED
// - Keeps A+ levels, Entry, SL, TP1 and TP2 unchanged
// - Adds Confirmation mode, score, minimum score and timeout feedback
// - Renames previous A Watchlist trades to B Watchlist trades
// - Keeps trade start in the State Machine / Trade Engine
//
// Changelog v6.1 RC1
// - Adds single-source setup state machine
// - Moves setup availability before all dependent logic
// - Freshness starts only after structural setup activation
// - TP1/TP2 before Entry consumes setup only after ARMED and not on Entry-touch bar
// - Preserves daily config values, A+/B levels, SL, TP1 and TP2
//
// Changelog v6.0 RC1
// - Based on v5.1.2 MASTER
// - Adds Config-driven Setup Availability Engine
// - Fixes Freshness Anchor: tracking starts at CONFIG_START_TIME
// - Keeps Entry Touch / Confirmation phases and US Open Filter
//
// Changelog v5.1.2
// - Added US Open Filter 15:25-15:45 Madrid
// - Blocks Entry Confirmation during US Cash Open
// - Adds US Open status and alert
//
// Changelog v5.1.0
// - Added central runtime variable section
// - Added Freshness Engine v2
// - Tracks highest high / lowest low since CONFIG_ID
// - Blocks Entry if TP1 or TP2 was reached before Entry
// - Adds setup freshness to panel
// - Preserves v5.0 core behaviour
// =====================================================

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.