Tuor
Tuor

Reputation: 1175

Find position entry price from ID

In Pine, if I made some strategy.order on a previous bar, with id "order ID", is there a function to retreive the entry price of that order on a later bar?

Upvotes: 2

Views: 896

Answers (1)

vitruvius
vitruvius

Reputation: 21294

You can use strategy.closedtrades.entry_price or strategy.opentrades.entry_price.

// Return the entry price for the latest  entry.
entryPrice = strategy.closedtrades.entry_price(strategy.closedtrades - 1)

Upvotes: 2

Related Questions