Hello,
depending on the exit condition it is not rare that the exit price of a position differs from the bar close price when the position get closed.
(often the exit is made before the last bar ends)
As it seems that the “exitprice” command doesn’t exist then does anyone know how to get it?
Many thanks?
Oli
exitprice doesn’t exist, as there are other ways to exit a trade:
- SELL or EXITSHORT to exit a Long or Short trade at market (when a candle closes);
- SELL AT myExitPrice STOP/LIMIT or EXITSHORT AT myExitPrice STOP/LIMIT if you prefer to exit exactly at a price (use STOP or LIMIT according to where the current price is sitting compared to myExitPrice);
- using SET STOP PRICE myExitPrice or SET TARGET PRICE myExitPrice.
Bear that there is no guarantee that the exit price will exactly mirror CLOSE, due to slippage that may occur at anytime.
Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums. Thanks 🙂
I moved it from the French forum.
Hi there Oli,
You can use TradePrice for that.
Please be aware that TradePrice is given from indeed the last TradePrice. This can also be an Entry. As far as I recall it even can be a lastly set Limit or Stop Price (not Target or StopLoss). Thus in brief, it goes like this :
If Not OnMarket and OnMarket[1] then
LastExitPrice = TradePrice
endif
Regards,
Peter