Stop loss below the low of the entry bar-1
Author: Jim0000076
Creation Date: 12/14/2012 9:06 AM
profile picture

Jim0000076

#1
I am trying to work out the code for putting a stop loss (limit) below the low of the bar before the entry bar (i.e. entry bar minus 1). Any help would be much appreciated, it seems like a simple problem but I don't seem to be able to work it out.

Thanks in advance.

Jim

profile picture

Eugene

#2
CODE:
Please log in to see this code.
profile picture

Jim0000076

#3
Thanks Eugene, do you also know the code for putting reversing a position at the same bar as the stoploss and at the same price - i.e. for a stop and reverse.


Thanks in advance,

Jim
profile picture

Eugene

#4
Yes Jim, I happen to know it:

Knowledge Base > WealthScript Techniques | Creating a Stop-And-Reverse (SAR) system

See "Another example".
profile picture

Jim0000076

#5
Thanks Eugene, you are awesome.

Jim

profile picture

Jim0000076

#6
Eugene,

I have tried using this code for a stop loss (i.e. representing sell if price hits entry price less 5%)

CODE:
Please log in to see this code.


But when the Stop Loss is triggered the actual sell price is the price at close not the Stop Loss value, do you know why this could be?

Thanks in advance

Jim
profile picture

Eugene

#7
Jim,

You are closing out all positions for the price of the last position's entry price minus 5%. However, the price for the bunch is determined based on the last position. Is there a reason to do it this way? There are multiple positions?

As to the actual exit price, it is not the price at close. It could either be the stop price or open price at bar+1, whichever is lower.
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).