Orphaned Positions
Author: BigReturns
Creation Date: 1/14/2014 9:57 PM
profile picture

BigReturns

#1
Hey guys, I ran into a orphan issues with the WS extension that may be more of a WL than WS issue.

I am starting the trade on a exact date using
QUOTE:
int startbar = DateTimeToBar(new DateTime(2014,1,10), false);
with a 50K portfolio.

When I ran it yesterday I got 2 trade alerts:

Alert Time Symbol Action/Qty Order Price Trade Type Strategy Name
1/13/2014 REGN Buy 25 Limit 274.05 Buy| Double Strike 2.0 (NASDAQ)
1/13/2014 VIP Buy 568 Limit 12.48 Buy| Double Strike 2.0 (NASDAQ)

REGN was processed fine in both WS and WL. WS processed the VIP signal fine while WL didn't execute.

So I did some basic troubleshooting. Here is what I checked.

1) Pricing. VIP opened at $12.28 and Closed at $12.45. The limit price $12.48 should have executed.
2) Available Funds. There plenty of funds for this to execute.
3) Slippage. Thought maybe this was do to the slippage, which I typically set .015% so I turned it off. It made no difference.

None of these issues seemed to solve the limit buy not executing.

I also checked Friday alerts, and I had more orders that had a limit buy and the stock traded lower than the limit orde and WL didn't trigger/process the buy order.

Any thoughts on why I would be seeing this? Any other settings I should check?

(I can repost this in WL if this is just a WL question.)
profile picture

vk

#2
I don't have the means to check exactly what happened here but you might want to search the forum for "orphaned" and might find some explanation here.
Some other quick thoughts that come to my mind:
1. Not enough cash to take another position?
2. Too many limit orders and no prioritize settings. WS will execute the first once to come, however WL (when using EOD data) will not know which one was first and will pick it randomly.

VK
profile picture

BigReturns

#3
Thanks for the thoughts.

To answer your questions there were only 2 limit orders representing ~28.5% of the portfolio value so there is plenty of cash to process the order.
profile picture

BigReturns

#4
Never mind - I found the issue.

It was a user error in fabricating data in developing your own indicators. :-)
profile picture

Eugene

#5
That's right, your system had only 2 outstanding limit orders yesterday (both filled by WS) so neither cash nor priority don't seem to be the problem. Double check that the data for the last bar looks like the following:

Date Open High Low Close Volume Adj Close*
Jan 14, 2014 12.28 12.69 12.17 12.45 2,677,800 12.45

Chances are there was an incorrect price adjustment applied this evening that corrupted the last bar of your local data, making the trade disappear, but I wouldn't count on that...

IMHO, the symptom makes me think that the problem can potentially be caused by:

1. A peeking-into-the-future condition in your trading system's logic
2. Relying on an "unstable indicator", not protecting yourself with loading enough seed data (WealthScript Programming Guide > Indicators > Stability of Indicators)

P.S. To anyone else interested in the subject, all known reasons behind getting orphaned positions in WS are summed up in the WealthSignals Publisher's online manual:

Orphaned positions

UPDATE

QUOTE:
Never mind - I found the issue.

Was working on my post before your post #4 appeared.