Trades left open by SplitPosition
Author: akardar1
Creation Date: 2/28/2017 8:59 PM
profile picture

akardar1

#1
Hi WL,

I am trying to split a position;
I would like to exit half with a target, and half with a trailing stop.
If the target is not met, both will exit at the trailing stop.
When I look at the list of trades, I see the positions have successfully been split.
But...some trades exit on target, some trades exit on the trailing stop.
and a large portion of trades are still "open".
Am I doing something wrong here ?

CODE:
Please log in to see this code.


profile picture

akardar1

#2
Attaching screenshot
profile picture

Eugene

#3
Hi AK,

I wonder where have you learnt this bad thing? Not from us technicians:
CODE:
Please log in to see this code.

On the forum we teach constantly to avoid peeking. Same does the WealthScript Programming Guide. Let's have it once more: you shouldn't use "bar" with anything other than AtClose - and certainly never with AtLimit/AtStop where it must always be "bar+1".

QUOTE:
and a large portion of trades are still "open".

That's right. None of your exits is set up to exit the split position "s" at all.
profile picture

akardar1

#4
QUOTE:
I wonder where have you learnt this bad thing?


I've 100 % sure this is ingrained in my subconscious, so I am not sure why or how I posted an example with "SellAtLimit(bar".
I checked my strategies and found another instance of this bad thing...and have exterminated it.

QUOTE:
and a large portion of trades are still "open".

Of course, thanks, I am new to splitting positions.
I also found this very useful post..
https://www.wealth-lab.com/Forum/Posts/RSI-scale-out-system-RevC-in-simulation-mode-31313
profile picture

Eugene

#5
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).