Open trades reference
The 19 functions and 0 values of trades.open: signature, effects, phase, cost and tested examples.
Facts about each open trade of the simulated account, by index.
Functions#
trades.open.capital_held#
trades.open.capital_held()
The capital (margin) held by the open trades together.
- 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.open.entry_comment#
trades.open.entry_comment([index])
The comment of the order that opened open 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.open.entry_index#
trades.open.entry_index([index])
The bar index at which open 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.open.entry_key#
trades.open.entry_key([index])
The key of the order that opened open 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.open.entry_price#
trades.open.entry_price([index])
The price at which open 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.open.entry_time#
trades.open.entry_time([index])
The time at which open 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.open.exit_comment#
trades.open.exit_comment([index])
The comment of the exit of an open trade: always empty, because an open trade has not 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 text.
trades.open.exit_index#
trades.open.exit_index([index])
The exit bar index of an open trade: always na, because an open trade has not 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: na.
trades.open.exit_key#
trades.open.exit_key([index])
The key of the exit of an open trade: always empty, because an open trade has not 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 text.
trades.open.exit_price#
trades.open.exit_price([index])
The exit price of an open trade: always na, because an open trade has not 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: na.
trades.open.exit_time#
trades.open.exit_time([index])
The exit time of an open trade: always na, because an open trade has not 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: na.
trades.open.fees#
trades.open.fees([index])
The fees charged to open trade number index so far.
- 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.open.max_drawdown#
trades.open.max_drawdown([index])
The largest fall of open 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.open.max_drawdown_percent#
trades.open.max_drawdown_percent([index])
The largest fall of open 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.open.max_runup#
trades.open.max_runup([index])
The largest rise of open 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.open.max_runup_percent#
trades.open.max_runup_percent([index])
The largest rise of open 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.open.profit#
trades.open.profit([index])
The profit of open trade number index at the close of the bar, in account money, after its fees and swap.
- 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.open.profit_percent#
trades.open.profit_percent([index])
The profit of open trade number index at the close of the bar, 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.open.size#
trades.open.size([index])
The size of open 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.