You would need to use recursion to maintain the low of the candlestick bar that is the same as your EntryPrice()... Then you would add something like "or price <= stopLoss" to your closing conditional clause... There are several trailing stoploss scripts here in the forums that can be adapted to your needs... Using ATR or a fixed amount or percentage is far easier than low prior to entry, but it is possible...