strategy.opentrades.entry_bar_index
Bar index of the first entry fill of open trade trade_num (0: the account holds one position per symbol); na when there is none.
strategy.opentrades.entry_bar_index(trade_num: int) -> int
Parameters
trade_numint: Which open trade: only 0 exists (the account holds one position per symbol); another number gives na.
Example
barsIn = bar_index - strategy.opentrades.entry_bar_index(0)