Stop Loss changing dynamically

Hello guys,

My stop loss is low/high of past five candles and I trade stock on break out after retracement and pull backs. How ever my stop loss is continuously updating as once position is entered, this is causing some issues in back testing. I have attached snippets of code for your reference,

Your help will be deeply appreciated IMG-20181206-WA0008 IMG-20181206-WA0009

@Sdrazisha, it was nice that you added pictures to your post, but for anyone to really be able to help, we need to be able to read/test your code. To that end, copy and paste your code into CODE BLOCKS so we can then copy it out of the forum.

For reference, here are some useful links:

When you post your code in a usable fashion, you will be much more likely to get usable assistance.


One more link how to make a nice, clean and small picture to upload in this forum.
Thank you