Can a stop be activated more than once for the same trade?
Author: thetraderman
Creation Date: 4/8/2011 9:00 AM
profile picture

thetraderman

#1
I have a question regarding stops. When I run my back test I notice that my logging shows that the stop logic passes through twice. Not all the time just sometimes. Once at one bar and the next time 2 bars later. I use the bar+1 concept to make sure I don't peak. However when I look at the chart it only shows one stop arrow on the second stop loss loop. Also when I look at the trade window it again shows only one stop loss entry. Unfortunately there is no time associated with the stop in the trade window just the time of the initial long trade execution.

My question is it normal for WL to simulate possibly not all the shares sold on the first stop so it executes a remaining sell to get rid of the rest or is there a problem with my logic. It is only 100 shares and again I see only one set of arrows and only one stop in the trade window. Is going through the stop multiple times dangerous?

I appreciate any help you can provide.

Thanks
profile picture

Eugene

#2
Sets of arrows, some unknown logic, and something passing through sometimes... Sounds almost like the beginning of a mystery movie. ;)

Could you please share the strategy code and fill in the other important details as per this checklist?

How to report a Problem?
profile picture

thetraderman

#3
I didn't add the code because I wanted to spare you the time of looking through it. I really appreciate your help.

WL Version 6.1.27
Minute chart for a 3 day span. No streaming data. This is the actual buy/sell/short/cover code. There is other code which I removed which is unrelated i.e. print statements to make it as readable as possible.

Thanks for your help!

CODE:
Please log in to see this code.

profile picture

Cone

#4
QUOTE:
My question is it normal for WL to simulate possibly not all the shares sold on the first stop so it executes a remaining sell to get rid of the rest or is there a problem with my logic.
Wealth-Lab sells Positions, not shares. However, if enter once, but use SplitPosition, then there could be multiple Positions. That said, signals are executed by your logic and stops are executed on the bar passed to the signal. Almost surely the script's logic is faulty
profile picture

thetraderman

#5
Thanks. Off hand can you see what's wrong with my script? In other words ActivePositions loop, etc correct? I hate looking for something in more detail when it could just be a conceptual issue.
profile picture

Cone

#6
It's hard to tell what you're seeing without having all the code, but I'd guess that by the script's design, you're opening more than one position at a time. Therefore you're managing multiple positions - possibly a long and short position simultaneously.

If you post all the code so that I can run it, then I can be precise, otherwise it's guesswork.
profile picture

thetraderman

#7
You are correct that I'm trying to do longs and shorts but only one at a time. Go long exit, then short exit, etc. I can't attach the code here for two reasons. The whole thing is several thousand lines way to big and also this is a proprietary indicator. The whole thing is very complicated. Can I email it to you if you promise not to share it? I really do appreciate your help.

Thanks.
profile picture

Cone

#8
I can't support troubleshooting large strategies, but you should determine if the strategy is opening long and short positions simultaneously by going through the Trade list, reading chart, or adding some debugging code. Based on the visible logic, it looks like a high probability, so this is something that the designer of a very complicated script should be able to resolve.

Incidentally, this for loop does nothing:
CODE:
Please log in to see this code.
You could use it, however, to determine how many active longs and shorts there are:
CODE:
Please log in to see this code.
If this outputs something, then you'll be one your way.
profile picture

thetraderman

#9
Are you available sometime for a brief phone conversation? I am seeing some weird results aside from this discussion and I'm sure it is me but I can't put an handle on it. It does not have to be today but if possible I would really appreciate it.
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).