Generating orders from a text file
Author: MikeCaron
Creation Date: 5/21/2009 11:08 AM
profile picture

MikeCaron

#1
Every day I have 50+ orders I queue up pre-market based on WL5 strategies that look at overbought or oversold triggers based on limit prices. The strategies write this data out to a text file and then I verify in the morning the news reports to make sure that there are no earnings surprises before submitting the orders. I am using Active Trader Pro right now for the order submission and creating watchlists, but it is labor intensive and error prone.

I believe I can use the order system in WL5 and a script to read in the orders from a text file so that the orders are queued up based on Chapter 11 in the User Guide. It does seem like there are a couple of caveats:

- I must trade under one SSN in an active WL session
- I can not specify when to use margin or cash in a margin account
- I need auto-trading enabled (is this true even if manually staging and then manually pushing the orders out?)

Some things that are not clear from the documentation are:

- How to I specify the account? It appears that I set the context for the account first, then run the script (which would read a file with the trade information specified) by selecting any symbol in my dataset, which should then queue up the trades in WL.

If the above is true, then I could have different scripts that deal with the different accounts.

If the above is true, then is there a way to determine in the script which account is selected to prevent generating orders for the wrong account?

I figure the text file will have the number of shares, the limit price, the type of order (short/long) and the symbol on each line, with one order per line.

Also, is there anything I failed to take into account?

Thanks!
profile picture

Cone

#2
QUOTE:
I am using Active Trader Pro right now for the order submission and creating watchlists, but it is labor intensive and error prone.
Why would you do that?

Solution: Stage all the Alerts in the Orders tool, and then delete the ones you don't want to enter. Very simple. Forget about reading the text file, but you can save it for future reference if you want.

QUOTE:
How to I specify the account?
See Set Account in the Strategy Explorer, Reference section. This should sufficiently answer all the rest of the questions you had.

QUOTE:
Also, is there anything I failed to take into account?
Doing it the easy way?

----------
If you're trading accounts for other SSNs, then it's probably best to get a computer for each one. You could switch user sessions too, but that seems error prone to me.
profile picture

MikeCaron

#3
Well, I think I ended up with this approach because of the following:

- I did not know how much to allocate to each trade until I know how many symbols were to be potentially traded. I use a constant dollar approach, but the dollar amount varies each day based on number of potential trades.

- I manually filter out multiple symbols in the same industry. For instance, today I had 8 GOLD stocks that were identified as Short candidates. I guess I could encode those rules such as recent volatility and EPS.

I could have two scripts -- one that dumps out the data as I do now and then do my manual filtering. This will give me the amount per trade. Then run the second script that will actually place the orders after updating the amount per trade.

BTW, today I had 88 trade potentials, only 14 of them being Long Limit orders. I only entered 14 of the trades today and only 4 of those have kicked in so far.

Thanks for your thoughts.
profile picture

Cone

#4
QUOTE:
I use a constant dollar approach, but the dollar amount varies each day based on number of potential trades.
PosSizers can help with that later, but you can edit the number of shares in an Alert or in a Staged order in the Orders tool.

QUOTE:
I manually filter out multiple symbols in the same industry.
Yup, PosSizers could help there too. You could probably do something with global variables and Position.Priority, but it might be messy.

Unfortunately for you, PosSizers aren't ready yet, but they'll definitely save you a bunch of work when they are!
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).