Closed trades reference
The 19 functions and 1 value of trades.closed: signature, effects, phase, cost and tested examples.
Facts about each closed trade of the simulated account, by index.
Functions#
trades.closed.capital_held#
trades.closed.capital_held()
The capital held by closed trades: always 0, because a closed trade holds none.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
trades.closed.entry_comment#
trades.closed.entry_comment([index])
The comment of the order that opened closed trade number index.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a text.
trades.closed.entry_index#
trades.closed.entry_index([index])
The bar index at which closed trade number index was entered.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a whole number.
trades.closed.entry_key#
trades.closed.entry_key([index])
The key of the order that opened closed trade number index.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a text.
trades.closed.entry_price#
trades.closed.entry_price([index])
The price at which closed trade number index was entered.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
trades.closed.entry_time#
trades.closed.entry_time([index])
The time at which closed trade number index was entered.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a time.
trades.closed.exit_comment#
trades.closed.exit_comment([index])
The comment of the order that closed trade number index.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a text.
trades.closed.exit_index#
trades.closed.exit_index([index])
The bar index at which closed trade number index was exited.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a whole number.
trades.closed.exit_key#
trades.closed.exit_key([index])
The key of the order that closed trade number index.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a text.
trades.closed.exit_price#
trades.closed.exit_price([index])
The price at which closed trade number index was exited.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
trades.closed.exit_time#
trades.closed.exit_time([index])
The time at which closed trade number index was exited.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a time.
trades.closed.fees#
trades.closed.fees([index])
The fees charged to closed trade number index.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
trades.closed.max_drawdown#
trades.closed.max_drawdown([index])
The largest fall of closed trade number index below its entry price, in account money; shown as a positive number.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
trades.closed.max_drawdown_percent#
trades.closed.max_drawdown_percent([index])
The largest fall of closed trade number index below its entry price, as a percentage of the value at entry.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
trades.closed.max_runup#
trades.closed.max_runup([index])
The largest rise of closed trade number index above its entry price, in account money.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
trades.closed.max_runup_percent#
trades.closed.max_runup_percent([index])
The largest rise of closed trade number index above its entry price, as a percentage of the value at entry.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
trades.closed.profit#
trades.closed.profit([index])
The profit of closed trade number index, in account money.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
- Examples: Trade tally.
trades.closed.profit_percent#
trades.closed.profit_percent([index])
The profit of closed trade number index as a percentage of its value at entry.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
trades.closed.size#
trades.closed.size([index])
The size of closed trade number index: positive for a long trade, negative for a short one.
- Effects: reads the simulated account, so it is not moved across an order call.
- Phase: every bar.
- Cost: reads the account figure of the bar.
- Returns: a number.
Values#
trades.closed.first_index