Why stop loss is executed at bar's Low instead of specified value?
Author: balram79
Creation Date: 8/14/2019 9:03 PM
profile picture

balram79

#1
I spend quite a bit of time looking for a solution to a problem I am having with stop loss. I am tried to write the code for a scenario where I enter into a trade when a bar meets a criteria (high volume and close>open). I calculate a value of stop loss=(high+low)/2 (example = $55) using the bar when the trade was entered. I am trying to get backtesting to execute the stoploss at this value of $55 if the next bar falls below this value but since wealthlab forces until the next bar is complete the low of the next bar (example $52) is used as the value where the trade is executed instead of doing it at my stoploss value of $55. Any suggestions of how to get code to use $55 instead of $50?
profile picture

Cone

#2
Is it possible that the next bar's open is below the stop value? In this case, it's correct for the stop to trigger at the opening price.

If that's not it, and even though the middle of the entry bar doesn't seem like the greatest place to put a stop loss, it's probably best if you post your snippet of code. It should look something like this:

CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).