PINE LIBRARY
Deep AI

Library "Deeptest"
Comprehensive quantitative backtesting library with 112+ metrics: Sharpe/Sortino ratios, drawdown analysis, Monte Carlo simulation, Walk-Forward Analysis, VaR/CVaR, benchmark comparison, and interactive table rendering for TradingView strategies
version 1.0.1 (01.01.2026)
============================================================================
CHANGELOG
============================================================================
v1.0.1 (01.01.2026)
- Added textSize parameter to runDeeptest() for controlling table text size
- New values: size.auto, size.small, size.tiny, size.normal, size.large
- Applies to all tables: main, stress test, drawdowns, recoveries, trades
v1.0.0 (31.12.2025)
- Initial release
- 112+ backtesting metrics
- Monte Carlo simulation and Walk-Forward Analysis
- Interactive table rendering with tooltips
============================================================================
TABLE OF CONTENTS
============================================================================
SECTION 1: File Header & Metadata
SECTION 2: Constants & Configuration
SECTION 3: Type Definitions
SECTION 4: Core Calculation Functions - Array Utilities
SECTION 5: Core Calculation Functions - Return Extraction
SECTION 6: Core Calculation Functions - Sharpe & Sortino
SECTION 7: Core Calculation Functions - Performance Metrics
SECTION 8: Core Calculation Functions - Drawdown Analysis
SECTION 9: Core Calculation Functions - Recovery Analysis
SECTION 10: Core Calculation Functions - Trade Analysis
SECTION 11: Core Calculation Functions - Statistical Distribution
SECTION 12: Core Calculation Functions - Risk Metrics
SECTION 13: Core Calculation Functions - Benchmark Comparison
SECTION 14: Core Calculation Functions - Time-Based Metrics
SECTION 15: Core Calculation Functions - Rolling Statistics
SECTION 16: Core Calculation Functions - Strategy Integration
SECTION 17: Core Calculation Functions - Walk Forward Analysis
SECTION 18: Core Calculation Functions - Monte Carlo Simulation
SECTION 19: Core Calculation Functions - Out-of-Sample Analysis
SECTION 20: Formatting Utilities - Value Formatting
SECTION 21: Formatting Utilities - Duration Formatting
SECTION 22: Formatting Utilities - Frequency Formatting
SECTION 23: Formatting Utilities - Date Formatting
SECTION 24: Tooltip Builders - Main Table Metrics
SECTION 25: Tooltip Builders - Complementary Metrics
SECTION 26: Tooltip Builders - Stress Test Metrics
SECTION 27: Tooltip Builders - Period Analysis Cards
SECTION 28: Table Rendering - Structure Helpers
SECTION 29: Table Rendering - Main Deeptest Table
SECTION 30: Table Rendering - Cell Renderers - Complementary Row
SECTION 31: Table Rendering - Stress Test Table
SECTION 32: Table Rendering - Period Analysis Cards
SECTION 33: Main Entry Point
============================================================================
API REFERENCE
============================================================================
Main Export:
------------
runDeeptest() - Complete backtest analysis orchestrator
============================================================================
KEY FEATURES
============================================================================
- Comprehensive backtesting metrics (112+ functions)
- Rolling window analysis with statistical distributions
- Advanced risk metrics (Sharpe, Sortino, Calmar, Martin, VaR, CVaR)
- Drawdown and recovery analysis
- Monte Carlo simulation and Walk-Forward Analysis
- Trade analysis (top/worst trades, consecutive streaks)
- Benchmark comparison (Alpha, Beta, R², Buy & Hold)
- Interactive table rendering with tooltips
============================================================================
USAGE EXAMPLE
============================================================================
╔══════════════════════════════════════════════════════════════════════════════╗
║ PROGRESSIVE USAGE EXAMPLES ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Three examples demonstrating increasing complexity: ║
║ 1. MINIMAL - "Hello World" with basic MA crossover ║
║ 2. BALANCED - Production ready with risk management & filters ║
║ 3. PROFESSIONAL - Full-featured with trailing stops & session filters ║
╚══════════════════════════════════════════════════════════════════════════════╝
╔══════════════════════════════════════════════════════════════════════════════╗
║ EXAMPLE 1: MINIMAL (The "Hello World") ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ The simplest possible integration - just 3 lines to get started: ║
║ 1. Import the library ║
║ 2. Write your strategy logic ║
║ 3. Call runDeeptest() ║
╚══════════════════════════════════════════════════════════════════════════════╝
//version=6
strategy("MA Crossover [Minimal]", overlay=true)
// ═══════════════════════════════════════════════════════════════════════════
// ⮟ Import Deeptest (Direct import - no namespace prefix needed)
// ═══════════════════════════════════════════════════════════════════════════
import Fractalyst/Deeptest/1 as *
// ────────────────────────────────────────────────────────────────────────────
// Strategy Logic: Simple Moving Average Crossover
// ────────────────────────────────────────────────────────────────────────────
fastMA = ta.sma(close, 10) // Fast MA: 10 periods
slowMA = ta.sma(close, 30) // Slow MA: 30 periods
// Plot MAs for visualization
plot(fastMA, "Fast MA", color=color.blue)
plot(slowMA, "Slow MA", color=color.orange)
// Entry: Long when fast MA crosses above slow MA
if ta.crossover(fastMA, slowMA)
strategy.entry("Long", strategy.long)
// Exit: Close when fast MA crosses below slow MA
if ta.crossunder(fastMA, slowMA)
strategy.close("Long")
// ═══════════════════════════════════════════════════════════════════════════
// ⮟ Run backtest analysis (all parameters use smart defaults)
// ═══════════════════════════════════════════════════════════════════════════
DT.runDeeptest()
╔══════════════════════════════════════════════════════════════════════════════╗
║ EXAMPLE 2: BALANCED (Production Ready) ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Adds essential production features: ║
║ • User-configurable inputs ║
║ • ADX trend filter to avoid choppy markets ║
║ • Stop loss / Take profit for risk management ║
║ • Custom backtest parameters ║
╚══════════════════════════════════════════════════════════════════════════════╝
//version=6
strategy("MA Crossover [Balanced]", overlay=true)
import Fractalyst/Deeptest/1 as *
// ────────────────────────────────────────────────────────────────────────────
// INPUT PARAMETERS
// ────────────────────────────────────────────────────────────────────────────
fastLen = input.int(10, "Fast MA Period", minval=1)
slowLen = input.int(30, "Slow MA Period", minval=1)
riskPct = input.float(2.0, "Risk %", minval=0.1) / 100
slPct = input.float(5.0, "Stop Loss %", minval=0.1) / 100
tpPct = input.float(10.0, "Take Profit %", minval=0.1) / 100
adxThresh = input.int(20, "ADX Trend Threshold")
// ────────────────────────────────────────────────────────────────────────────
// INDICATORS
// ────────────────────────────────────────────────────────────────────────────
fastMA = ta.sma(close, fastLen)
slowMA = ta.sma(close, slowLen)
adx = ta.adx(14)
[diPlus, diMinus] = ta.dmi(14, 14)
// ────────────────────────────────────────────────────────────────────────────
// FILTERS
// ────────────────────────────────────────────────────────────────────────────
trendConfirmed = adx > adxThresh and diPlus > diMinus
// ────────────────────────────────────────────────────────────────────────────
// STRATEGY LOGIC
// ────────────────────────────────────────────────────────────────────────────
// Entry: MA crossover + trend confirmation
if ta.crossover(fastMA, slowMA) and trendConfirmed
strategy.entry("Long", strategy.long)
// Exit: MA crossunder
if ta.crossunder(fastMA, slowMA)
strategy.close("Long")
// Risk management: Stop loss and take profit
if strategy.position_size > 0
strategy.exit("RM", "Long",
stop=strategy.position_avg_price * (1 - slPct),
limit=strategy.position_avg_price * (1 + tpPct))
// ═══════════════════════════════════════════════════════════════════════════
// ⮟ Run backtest with custom parameters
// ═══════════════════════════════════════════════════════════════════════════
DT.runDeeptest(
riskPerTrade = 1.0, // ← 1% risk per trade
targetMaxDDPct = 15.0, // ← 15% max drawdown target
showStressTest = true, // ← Enable stress test table
showPeriodCards = true, // ← Enable period cards
wfaWindows = 12, // ← Walk-forward windows
mcSimulations = 1000, // ← Monte Carlo runs
bullColor = color.new(#00b9ff, 0),
bearColor = color.new(#ff0051, 0),
benchmarkSymbol = "SPX", // ← Compare to S&P 500
periodCardMode = "drawdowns", // ← Show drawdown periods
tradeSortBy = "return" // ← Sort by return %
)
╔══════════════════════════════════════════════════════════════════════════════╗
║ EXAMPLE 3: PROFESSIONAL (Full-Featured) ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Complete professional implementation: ║
║ • Organized input groups for better UX ║
║ • Multiple filters: ADX trend, ATR volatility, Session timing ║
║ • Trailing stop to lock in profits ║
║ • Position highlighting for visual feedback ║
║ • Full parameter customization with inline documentation ║
╚══════════════════════════════════════════════════════════════════════════════╝
//version=6
runDeeptest(targetMaxDDPct, bullColor, bearColor, tableBg, headerBg, borderColor, textPrimary, textMuted, textSize, showComplementaryRow, showStressTestTable, showDrawdownRecoveryCards, showTradeCards)
Parameters:
targetMaxDDPct (float)
bullColor (color)
bearColor (color)
tableBg (color)
headerBg (color)
borderColor (color)
textPrimary (color)
textMuted (color)
textSize (string)
showComplementaryRow (bool)
showStressTestTable (bool)
showDrawdownRecoveryCards (bool)
showTradeCards (bool)
ThresholdConfig
ThresholdConfig - Configuration for metric thresholds and corresponding colors
Fields:
sharpeExc (series float)
sharpeGood (series float)
sharpeOk (series float)
sharpeBear (series color)
sharpeNeutral (series color)
sharpeOrange (series color)
sharpeBull (series color)
ddSevere (series float)
ddMod (series float)
ddMild (series float)
ddSevereColor (series color)
ddModColor (series color)
ddOrange (series color)
ddGoodColor (series color)
rorHigh (series float)
rorMod (series float)
rorLow (series float)
rorHighColor (series color)
rorModColor (series color)
rorOrange (series color)
rorLowColor (series color)
r2Poor (series float)
r2Mod (series float)
r2Good (series float)
r2PoorColor (series color)
r2ModColor (series color)
r2Orange (series color)
r2GoodColor (series color)
kurtHigh (series float)
kurtMod (series float)
kurtOk (series float)
kurtHighColor (series color)
kurtModColor (series color)
kurtOrange (series color)
kurtGoodColor (series color)
skewVNeg (series float)
skewModNeg (series float)
skewPos (series float)
skewVPos (series float)
skewVNegColor (series color)
skewModNegColor (series color)
skewNeutral (series color)
skewPosColor (series color)
payoffPoor (series float)
payoffBE (series float)
payoffGood (series float)
payoffPoorColor (series color)
payoffBEColor (series color)
payoffOrange (series color)
payoffGoodColor (series color)
pfPoor (series float)
pfBE (series float)
pfGood (series float)
pfPoorColor (series color)
pfBEColor (series color)
pfOrange (series color)
pfGoodColor (series color)
ulcerHigh (series float)
ulcerLow (series float)
ulcerHighColor (series color)
ulcerModColor (series color)
ulcerOrange (series color)
ulcerLowColor (series color)
wrLow (series float)
wrOk (series float)
wrHigh (series float)
wrLowColor (series color)
wrOkColor (series color)
wrOrange (series color)
wrHighColor (series color)
cagrPoor (series float)
cagrOk (series float)
cagrGood (series float)
cagrPoorColor (series color)
cagrOkColor (series color)
cagrOrange (series color)
cagrGoodColor (series color)
pInsig (series float)
pMod (series float)
pSig (series float)
pInsigColor (series color)
pModColor (series color)
pOrange (series color)
pSigColor (series color)
calmarPoor (series float)
calmarBE (series float)
calmarGood (series float)
calmarPoorColor (series color)
calmarBEColor (series color)
calmarOrange (series color)
calmarGoodColor (series color)
betaHigh (series float)
betaLow (series float)
betaHighColor (series color)
betaLowColor (series color)
betaGoodColor (series color)
Stats
Stats - Comprehensive backtest statistics container
Fields:
totalTrades (series int)
winTrades (series int)
lossTrades (series int)
evenTrades (series int)
winRate (series float)
lossRate (series float)
avgWinPct (series float)
avgLossPct (series float)
avgTradePct (series float)
profitFactor (series float)
payoffRatio (series float)
expectancy (series float)
grossProfit (series float)
grossLoss (series float)
netProfit (series float)
netProfitPct (series float)
compEffect (series float)
sharpe (series float)
sortino (series float)
calmar (series float)
martin (series float)
maxDrawdown (series float)
maxDrawdownPct (series float)
currentDrawdown (series float)
currentDrawdownPct (series float)
avgDrawdownPct (series float)
maxEquity (series float)
minEquity (series float)
cagr (series float)
monthlyReturn (series float)
maxConsecWins (series int)
maxConsecLosses (series int)
avgTradeDuration (series float)
avgWinDuration (series float)
avgLossDuration (series float)
timeInMarketPct (series float)
tradesPerMonth (series float)
tradesPerYear (series float)
skewness (series float)
kurtosis (series float)
var95 (series float)
cvar95 (series float)
ulcerIndex (series float)
riskOfRuin (series float)
pValue (series float)
zScore (series float)
alpha (series float)
beta (series float)
buyHoldReturn (series float)
equityRSquared (series float)
firstTradeTime (series int)
lastTradeTime (series int)
tradingPeriodDays (series float)
RollingWindowSummary
RollingWindowSummary - Summary of metrics for a single rolling analysis window
Fields:
windowIndex (series int)
startTrade (series int)
endTrade (series int)
effectiveCount (series int)
minValue (series float)
maxValue (series float)
metricValue (series float)
RollingStats
RollingStats - Statistical distribution of rolling window metrics
Fields:
windowSize (series int): Number of trades in rolling window
expectancyMin (series float): Minimum rolling expectancy
expectancyMax (series float): Maximum rolling expectancy
sharpeMin (series float): Minimum rolling Sharpe
sharpeMax (series float): Maximum rolling Sharpe
sortinoMin (series float): Minimum rolling Sortino
sortinoMax (series float): Maximum rolling Sortino
expectancyWindows (array<RollingWindowSummary>): Per-window summaries for expectancy
sharpeWindows (array<RollingWindowSummary>): Per-window summaries for Sharpe
sortinoWindows (array<RollingWindowSummary>): Per-window summaries for Sortino
expectancyMean (series float): Mean expectancy across rolling windows
expectancyStdDev (series float): Standard deviation of expectancy
expectancyPct90 (series float): 90th percentile expectancy
expectancyPct50 (series float): 50th percentile expectancy (median)
expectancyPct10 (series float): 10th percentile expectancy
sharpeMean (series float): Mean Sharpe across rolling windows
sharpeStdDev (series float): Standard deviation of Sharpe
sharpePct90 (series float): 90th percentile Sharpe
sharpePct50 (series float): 50th percentile Sharpe
sharpePct10 (series float): 10th percentile Sharpe
sortinoMean (series float): Mean Sortino across rolling windows
sortinoStdDev (series float): Standard deviation of Sortino
sortinoPct90 (series float): 90th percentile Sortino
sortinoPct50 (series float): 50th percentile Sortino
sortinoPct10 (series float): 10th percentile Sortino
Comprehensive quantitative backtesting library with 112+ metrics: Sharpe/Sortino ratios, drawdown analysis, Monte Carlo simulation, Walk-Forward Analysis, VaR/CVaR, benchmark comparison, and interactive table rendering for TradingView strategies
version 1.0.1 (01.01.2026)
============================================================================
CHANGELOG
============================================================================
v1.0.1 (01.01.2026)
- Added textSize parameter to runDeeptest() for controlling table text size
- New values: size.auto, size.small, size.tiny, size.normal, size.large
- Applies to all tables: main, stress test, drawdowns, recoveries, trades
v1.0.0 (31.12.2025)
- Initial release
- 112+ backtesting metrics
- Monte Carlo simulation and Walk-Forward Analysis
- Interactive table rendering with tooltips
============================================================================
TABLE OF CONTENTS
============================================================================
SECTION 1: File Header & Metadata
SECTION 2: Constants & Configuration
SECTION 3: Type Definitions
SECTION 4: Core Calculation Functions - Array Utilities
SECTION 5: Core Calculation Functions - Return Extraction
SECTION 6: Core Calculation Functions - Sharpe & Sortino
SECTION 7: Core Calculation Functions - Performance Metrics
SECTION 8: Core Calculation Functions - Drawdown Analysis
SECTION 9: Core Calculation Functions - Recovery Analysis
SECTION 10: Core Calculation Functions - Trade Analysis
SECTION 11: Core Calculation Functions - Statistical Distribution
SECTION 12: Core Calculation Functions - Risk Metrics
SECTION 13: Core Calculation Functions - Benchmark Comparison
SECTION 14: Core Calculation Functions - Time-Based Metrics
SECTION 15: Core Calculation Functions - Rolling Statistics
SECTION 16: Core Calculation Functions - Strategy Integration
SECTION 17: Core Calculation Functions - Walk Forward Analysis
SECTION 18: Core Calculation Functions - Monte Carlo Simulation
SECTION 19: Core Calculation Functions - Out-of-Sample Analysis
SECTION 20: Formatting Utilities - Value Formatting
SECTION 21: Formatting Utilities - Duration Formatting
SECTION 22: Formatting Utilities - Frequency Formatting
SECTION 23: Formatting Utilities - Date Formatting
SECTION 24: Tooltip Builders - Main Table Metrics
SECTION 25: Tooltip Builders - Complementary Metrics
SECTION 26: Tooltip Builders - Stress Test Metrics
SECTION 27: Tooltip Builders - Period Analysis Cards
SECTION 28: Table Rendering - Structure Helpers
SECTION 29: Table Rendering - Main Deeptest Table
SECTION 30: Table Rendering - Cell Renderers - Complementary Row
SECTION 31: Table Rendering - Stress Test Table
SECTION 32: Table Rendering - Period Analysis Cards
SECTION 33: Main Entry Point
============================================================================
API REFERENCE
============================================================================
Main Export:
------------
runDeeptest() - Complete backtest analysis orchestrator
============================================================================
KEY FEATURES
============================================================================
- Comprehensive backtesting metrics (112+ functions)
- Rolling window analysis with statistical distributions
- Advanced risk metrics (Sharpe, Sortino, Calmar, Martin, VaR, CVaR)
- Drawdown and recovery analysis
- Monte Carlo simulation and Walk-Forward Analysis
- Trade analysis (top/worst trades, consecutive streaks)
- Benchmark comparison (Alpha, Beta, R², Buy & Hold)
- Interactive table rendering with tooltips
============================================================================
USAGE EXAMPLE
============================================================================
╔══════════════════════════════════════════════════════════════════════════════╗
║ PROGRESSIVE USAGE EXAMPLES ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Three examples demonstrating increasing complexity: ║
║ 1. MINIMAL - "Hello World" with basic MA crossover ║
║ 2. BALANCED - Production ready with risk management & filters ║
║ 3. PROFESSIONAL - Full-featured with trailing stops & session filters ║
╚══════════════════════════════════════════════════════════════════════════════╝
╔══════════════════════════════════════════════════════════════════════════════╗
║ EXAMPLE 1: MINIMAL (The "Hello World") ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ The simplest possible integration - just 3 lines to get started: ║
║ 1. Import the library ║
║ 2. Write your strategy logic ║
║ 3. Call runDeeptest() ║
╚══════════════════════════════════════════════════════════════════════════════╝
//version=6
strategy("MA Crossover [Minimal]", overlay=true)
// ═══════════════════════════════════════════════════════════════════════════
// ⮟ Import Deeptest (Direct import - no namespace prefix needed)
// ═══════════════════════════════════════════════════════════════════════════
import Fractalyst/Deeptest/1 as *
// ────────────────────────────────────────────────────────────────────────────
// Strategy Logic: Simple Moving Average Crossover
// ────────────────────────────────────────────────────────────────────────────
fastMA = ta.sma(close, 10) // Fast MA: 10 periods
slowMA = ta.sma(close, 30) // Slow MA: 30 periods
// Plot MAs for visualization
plot(fastMA, "Fast MA", color=color.blue)
plot(slowMA, "Slow MA", color=color.orange)
// Entry: Long when fast MA crosses above slow MA
if ta.crossover(fastMA, slowMA)
strategy.entry("Long", strategy.long)
// Exit: Close when fast MA crosses below slow MA
if ta.crossunder(fastMA, slowMA)
strategy.close("Long")
// ═══════════════════════════════════════════════════════════════════════════
// ⮟ Run backtest analysis (all parameters use smart defaults)
// ═══════════════════════════════════════════════════════════════════════════
DT.runDeeptest()
╔══════════════════════════════════════════════════════════════════════════════╗
║ EXAMPLE 2: BALANCED (Production Ready) ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Adds essential production features: ║
║ • User-configurable inputs ║
║ • ADX trend filter to avoid choppy markets ║
║ • Stop loss / Take profit for risk management ║
║ • Custom backtest parameters ║
╚══════════════════════════════════════════════════════════════════════════════╝
//version=6
strategy("MA Crossover [Balanced]", overlay=true)
import Fractalyst/Deeptest/1 as *
// ────────────────────────────────────────────────────────────────────────────
// INPUT PARAMETERS
// ────────────────────────────────────────────────────────────────────────────
fastLen = input.int(10, "Fast MA Period", minval=1)
slowLen = input.int(30, "Slow MA Period", minval=1)
riskPct = input.float(2.0, "Risk %", minval=0.1) / 100
slPct = input.float(5.0, "Stop Loss %", minval=0.1) / 100
tpPct = input.float(10.0, "Take Profit %", minval=0.1) / 100
adxThresh = input.int(20, "ADX Trend Threshold")
// ────────────────────────────────────────────────────────────────────────────
// INDICATORS
// ────────────────────────────────────────────────────────────────────────────
fastMA = ta.sma(close, fastLen)
slowMA = ta.sma(close, slowLen)
adx = ta.adx(14)
[diPlus, diMinus] = ta.dmi(14, 14)
// ────────────────────────────────────────────────────────────────────────────
// FILTERS
// ────────────────────────────────────────────────────────────────────────────
trendConfirmed = adx > adxThresh and diPlus > diMinus
// ────────────────────────────────────────────────────────────────────────────
// STRATEGY LOGIC
// ────────────────────────────────────────────────────────────────────────────
// Entry: MA crossover + trend confirmation
if ta.crossover(fastMA, slowMA) and trendConfirmed
strategy.entry("Long", strategy.long)
// Exit: MA crossunder
if ta.crossunder(fastMA, slowMA)
strategy.close("Long")
// Risk management: Stop loss and take profit
if strategy.position_size > 0
strategy.exit("RM", "Long",
stop=strategy.position_avg_price * (1 - slPct),
limit=strategy.position_avg_price * (1 + tpPct))
// ═══════════════════════════════════════════════════════════════════════════
// ⮟ Run backtest with custom parameters
// ═══════════════════════════════════════════════════════════════════════════
DT.runDeeptest(
riskPerTrade = 1.0, // ← 1% risk per trade
targetMaxDDPct = 15.0, // ← 15% max drawdown target
showStressTest = true, // ← Enable stress test table
showPeriodCards = true, // ← Enable period cards
wfaWindows = 12, // ← Walk-forward windows
mcSimulations = 1000, // ← Monte Carlo runs
bullColor = color.new(#00b9ff, 0),
bearColor = color.new(#ff0051, 0),
benchmarkSymbol = "SPX", // ← Compare to S&P 500
periodCardMode = "drawdowns", // ← Show drawdown periods
tradeSortBy = "return" // ← Sort by return %
)
╔══════════════════════════════════════════════════════════════════════════════╗
║ EXAMPLE 3: PROFESSIONAL (Full-Featured) ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Complete professional implementation: ║
║ • Organized input groups for better UX ║
║ • Multiple filters: ADX trend, ATR volatility, Session timing ║
║ • Trailing stop to lock in profits ║
║ • Position highlighting for visual feedback ║
║ • Full parameter customization with inline documentation ║
╚══════════════════════════════════════════════════════════════════════════════╝
//version=6
runDeeptest(targetMaxDDPct, bullColor, bearColor, tableBg, headerBg, borderColor, textPrimary, textMuted, textSize, showComplementaryRow, showStressTestTable, showDrawdownRecoveryCards, showTradeCards)
Parameters:
targetMaxDDPct (float)
bullColor (color)
bearColor (color)
tableBg (color)
headerBg (color)
borderColor (color)
textPrimary (color)
textMuted (color)
textSize (string)
showComplementaryRow (bool)
showStressTestTable (bool)
showDrawdownRecoveryCards (bool)
showTradeCards (bool)
ThresholdConfig
ThresholdConfig - Configuration for metric thresholds and corresponding colors
Fields:
sharpeExc (series float)
sharpeGood (series float)
sharpeOk (series float)
sharpeBear (series color)
sharpeNeutral (series color)
sharpeOrange (series color)
sharpeBull (series color)
ddSevere (series float)
ddMod (series float)
ddMild (series float)
ddSevereColor (series color)
ddModColor (series color)
ddOrange (series color)
ddGoodColor (series color)
rorHigh (series float)
rorMod (series float)
rorLow (series float)
rorHighColor (series color)
rorModColor (series color)
rorOrange (series color)
rorLowColor (series color)
r2Poor (series float)
r2Mod (series float)
r2Good (series float)
r2PoorColor (series color)
r2ModColor (series color)
r2Orange (series color)
r2GoodColor (series color)
kurtHigh (series float)
kurtMod (series float)
kurtOk (series float)
kurtHighColor (series color)
kurtModColor (series color)
kurtOrange (series color)
kurtGoodColor (series color)
skewVNeg (series float)
skewModNeg (series float)
skewPos (series float)
skewVPos (series float)
skewVNegColor (series color)
skewModNegColor (series color)
skewNeutral (series color)
skewPosColor (series color)
payoffPoor (series float)
payoffBE (series float)
payoffGood (series float)
payoffPoorColor (series color)
payoffBEColor (series color)
payoffOrange (series color)
payoffGoodColor (series color)
pfPoor (series float)
pfBE (series float)
pfGood (series float)
pfPoorColor (series color)
pfBEColor (series color)
pfOrange (series color)
pfGoodColor (series color)
ulcerHigh (series float)
ulcerLow (series float)
ulcerHighColor (series color)
ulcerModColor (series color)
ulcerOrange (series color)
ulcerLowColor (series color)
wrLow (series float)
wrOk (series float)
wrHigh (series float)
wrLowColor (series color)
wrOkColor (series color)
wrOrange (series color)
wrHighColor (series color)
cagrPoor (series float)
cagrOk (series float)
cagrGood (series float)
cagrPoorColor (series color)
cagrOkColor (series color)
cagrOrange (series color)
cagrGoodColor (series color)
pInsig (series float)
pMod (series float)
pSig (series float)
pInsigColor (series color)
pModColor (series color)
pOrange (series color)
pSigColor (series color)
calmarPoor (series float)
calmarBE (series float)
calmarGood (series float)
calmarPoorColor (series color)
calmarBEColor (series color)
calmarOrange (series color)
calmarGoodColor (series color)
betaHigh (series float)
betaLow (series float)
betaHighColor (series color)
betaLowColor (series color)
betaGoodColor (series color)
Stats
Stats - Comprehensive backtest statistics container
Fields:
totalTrades (series int)
winTrades (series int)
lossTrades (series int)
evenTrades (series int)
winRate (series float)
lossRate (series float)
avgWinPct (series float)
avgLossPct (series float)
avgTradePct (series float)
profitFactor (series float)
payoffRatio (series float)
expectancy (series float)
grossProfit (series float)
grossLoss (series float)
netProfit (series float)
netProfitPct (series float)
compEffect (series float)
sharpe (series float)
sortino (series float)
calmar (series float)
martin (series float)
maxDrawdown (series float)
maxDrawdownPct (series float)
currentDrawdown (series float)
currentDrawdownPct (series float)
avgDrawdownPct (series float)
maxEquity (series float)
minEquity (series float)
cagr (series float)
monthlyReturn (series float)
maxConsecWins (series int)
maxConsecLosses (series int)
avgTradeDuration (series float)
avgWinDuration (series float)
avgLossDuration (series float)
timeInMarketPct (series float)
tradesPerMonth (series float)
tradesPerYear (series float)
skewness (series float)
kurtosis (series float)
var95 (series float)
cvar95 (series float)
ulcerIndex (series float)
riskOfRuin (series float)
pValue (series float)
zScore (series float)
alpha (series float)
beta (series float)
buyHoldReturn (series float)
equityRSquared (series float)
firstTradeTime (series int)
lastTradeTime (series int)
tradingPeriodDays (series float)
RollingWindowSummary
RollingWindowSummary - Summary of metrics for a single rolling analysis window
Fields:
windowIndex (series int)
startTrade (series int)
endTrade (series int)
effectiveCount (series int)
minValue (series float)
maxValue (series float)
metricValue (series float)
RollingStats
RollingStats - Statistical distribution of rolling window metrics
Fields:
windowSize (series int): Number of trades in rolling window
expectancyMin (series float): Minimum rolling expectancy
expectancyMax (series float): Maximum rolling expectancy
sharpeMin (series float): Minimum rolling Sharpe
sharpeMax (series float): Maximum rolling Sharpe
sortinoMin (series float): Minimum rolling Sortino
sortinoMax (series float): Maximum rolling Sortino
expectancyWindows (array<RollingWindowSummary>): Per-window summaries for expectancy
sharpeWindows (array<RollingWindowSummary>): Per-window summaries for Sharpe
sortinoWindows (array<RollingWindowSummary>): Per-window summaries for Sortino
expectancyMean (series float): Mean expectancy across rolling windows
expectancyStdDev (series float): Standard deviation of expectancy
expectancyPct90 (series float): 90th percentile expectancy
expectancyPct50 (series float): 50th percentile expectancy (median)
expectancyPct10 (series float): 10th percentile expectancy
sharpeMean (series float): Mean Sharpe across rolling windows
sharpeStdDev (series float): Standard deviation of Sharpe
sharpePct90 (series float): 90th percentile Sharpe
sharpePct50 (series float): 50th percentile Sharpe
sharpePct10 (series float): 10th percentile Sharpe
sortinoMean (series float): Mean Sortino across rolling windows
sortinoStdDev (series float): Standard deviation of Sortino
sortinoPct90 (series float): 90th percentile Sortino
sortinoPct50 (series float): 50th percentile Sortino
sortinoPct10 (series float): 10th percentile Sortino
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
🚀 Deepex builds next-gen trading AI. We created Paradigm 🤖 — an intelligent system that analyzes markets, finds high-probability setups, and helps traders trade smarter 📊. 7+ years, consistent positive performance. Integrated with TradingView & Google
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
🚀 Deepex builds next-gen trading AI. We created Paradigm 🤖 — an intelligent system that analyzes markets, finds high-probability setups, and helps traders trade smarter 📊. 7+ years, consistent positive performance. Integrated with TradingView & Google
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.