v2
Added:
TradeMetrics(startDate, initial_capital, trade_size, Long_entry_bool, Short_entry_bool, Long_exit_bool, Short_exit_bool)
: Calculates key trading performance metrics based on entry, exit, and trade size logic.
Parameters:
startDate (simple float): (simple float): Timestamp of the starting date for the equity calculation.
initial_capital (simple float): (simple float): The starting capital for trade calculations.
trade_size (simple float): (simple float): The proportion of capital allocated per trade.
Long_entry_bool (bool): (series bool): Boolean condition indicating a long entry signal.
Short_entry_bool (bool): (series bool): Boolean condition indicating a short entry signal.
Long_exit_bool (bool): (series bool): Boolean condition indicating a long exit signal.
Short_exit_bool (bool): (series bool): Boolean condition indicating a short exit signal.
Returns: (tuple): A tuple containing:
- signal (int): Current trade signal (-1 for short, 1 for long, 0 for neutral).
- closed_trades_count (int): Total number of closed trades.
- closed_long (int): Total number of closed long trades.
- closed_short (int): Total number of closed short trades.
- win_trades (int): Total number of winning trades.
- win_long (int): Total number of winning long trades.
- win_short (int): Total number of winning short trades.
- gross_profit (float): Total gross profit from all trades.
- gross_losses (float): Total gross losses from all trades.
- gross_L_profit (float): Gross profit from long trades.
- gross_L_losses (float): Gross losses from long trades.
- gross_S_profit (float): Gross profit from short trades.
- gross_S_losses (float): Gross losses from short trades.
TradeMetricsTable(initial_capital, closed_trades_count, closed_long, closed_short, win_trades, win_long, win_short, gross_profit, gross_losses, gross_L_profit, gross_L_losses, gross_S_profit, gross_S_losses)
: Generates a visual table displaying trade performance metrics for all trades, long trades, and short trades.
Parameters:
initial_capital (simple float): (simple float): The starting capital for trade calculations.
closed_trades_count (int): (series int): Total number of closed trades.
closed_long (int): (series int): Total number of closed long trades.
closed_short (int): (series int): Total number of closed short trades.
win_trades (int): (series int): Total number of winning trades.
win_long (int): (series int): Total number of winning long trades.
win_short (int): (series int): Total number of winning short trades.
gross_profit (float): (series float): Total gross profit from all trades.
gross_losses (float): (series float): Total gross losses from all trades.
gross_L_profit (float): (series float): Gross profit from long trades.
gross_L_losses (float): (series float): Gross losses from long trades.
gross_S_profit (float): (series float): Gross profit from short trades.
gross_S_losses (float): (series float): Gross losses from short trades.
Returns: (table): A table object displaying detailed trade metrics, including:
- Total trades, winning trades, and losing trades.
- Gross and net profit/loss in absolute and percentage terms.
- Profit factor, average trade metrics, and win/loss ratios.
- Metrics categorized by all trades, long trades, and short trades.