Yes TRADEPRICE is the last order price (or last Nth order price) so if the last order was an exit that is what TRADEPRICE will be so this does not work for position price.
You need to record POSITIONPRICE at the close of each bar.
1
2
3
ifonmarketthen
lastprice=positionprice
endif
Then you can buy at that price using a pending order.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.