Its all started 6 months back i started working on this script.Finally got something with no repainting.Stop loss is using ATR and 2 level of profit taking.You can check with replay function. www.tradingview.com