Welcome to the BEST forum for traders

Did you know we're sharing tons of exclusive content here?
Our community is growing quickly. Take a look around and say "Hello".

  • Forums
  • Pinescript
  • when we have several tp , how to find out that each one is closed?

when we have several tp , how to find out that each one is closed?

Jun 5, 2022 - 10:18 AM

Viewed 361 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/57737 COPY
  • thank you for your attention. I know there may be better ways. But I want to know after which a position is opened, and the information about it and the closing commands of the position are calculated in several tps. Know that for example Is tp 1 closed or not? When I use close, unfortunately it compares the closing price of the candlestick, not the current price.

        if tradeOn_short ==true and tp1Close_short == false
        strategy.close(id="Si", when=close>stop, comment="LOSS")            //close Unsuccessful entry
        //tp1 Go to identify
        strategy.exit ("SiT1", from_entry="Si", stop=stop, limit=tp1 , qty_percent=50) 
        tp1Close_short  :=close <tp1  
    
    0
  • You can use multiple strategy.exit to have multiple TP levels exited at real-time price
    strategy.close indeed is not needed unless you want to exit a trade at candle close

    0
CONTENTS