'Pine script: sell signal based on candlestick range

I'm currently trying to code an indicator that gives a buy signal when price drops below a specific line. No problem so far. But I need help with my sell signal.

I want the sell signal to come when price moved 1/3 in the oposite direction of the candlestick that I took the trade.

Im very new to coding and Ive been looking around but cant find anything relating to baseing your TP on the range of a candlestick.

Any ideas?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source