Automating multiple accounts
Author: sedelstein
Creation Date: 2/13/2013 6:24 PM
profile picture

sedelstein

#1
I'm trading a strategy in multiple accounts and want to automate order entry
These different accounts have different amounts of money in them

Right now, if I get n alerts, what I need to do is go into Tools->Preferences and change the account and click Apply

I then change the amount to trade in the Position size box and rerun the strategy

I then stage and place the trades.

I have a routine that reads an excel file that contains the tickers and the position sizes. It's easy enough to generate a set of alerts from that. Is there a way, within a script to specify an account? I didn't see it available in the documentation. If there is another way, please let me know.

Thanks
profile picture

Eugene

#2
There is a better way. Select "Set Account" from the "Open Strategy" dialog:

profile picture

sedelstein

#3
Yes, that is one way, But I would need to close and re-open 3x (once for each account, no?) and then re-run the strategy on the dataset.
profile picture

Eugene

#4
This preference is set once and remembered per each Strategy.
profile picture

sedelstein

#5
Ok, Can you confirm that I understand you correctly?

I should make 3 copies of the strategy, one for each account (and size), then run each of them, and stage/place orders from there

Thanks
profile picture

Cone

#6
That's correct. Just check the Account specified in Alerts to verify where the order will go.
profile picture

sedelstein

#7
Thanks Cone

I just tried it but it didn't seem to work.

I closed out of all my strategies
I then
1. Set account as Eugene specified above
2. Set the position size
3 Ran the strategy
4 Saved the strategy as Strategy_Account1
5. Closed the strategy

I repeated this 3x for each account yet when I reopened and ran again, each of those 3 strategies generated alerts for the last account I set, in the case, account number 3

Not sure why it didn't work

profile picture

Eugene

#8
Works perfectly for me.

1. "Save as..." three times.
2. "Open strategy" > "Set account..." three times
3. Now, open the 3 strategies and find alerts in correct accounts:

profile picture

sedelstein

#9
It took this time. Not sure why but it did

One last question. I am trying to get one of the accounts to default to Margin instead of Cash.

Is there a way to do that? I didn't see how

Thanks again for the help
profile picture

Cone

#10
That should happen automatically for margin accounts. You should have to select Cash if you don't want the trade to be marked Margin.

To be clear, are there two choices, Cash and Margin, but it's defaulting to Cash?
Or, is Cash the only choice?
profile picture

sedelstein

#11
Hi Cone

It's giving me only cash as an option but it is a margin acct.
I forgot to manually change it in the staging process today and my trades have gone in as cash
Fidelity generally journals it over to margin a day or two later
profile picture

Eugene

#12
sedelstein wrote in a duplicate deleted thread:

QUOTE:
My strategy generates alerts which naturally show up in the alerts tab after the strategy has run.

The alerts tab generates orders which can then be placed or staged and is sized accordingly with appropriate number of shares given the fixed dollar amount originally input before the strategy was run

I am trading the strategy in multiple accounts. The account sizes are different so for example if I want to buy IBM, account X might want to buy $100,000, account Y will want to buy $50,000, and account Z will want to buy $25,000

Is there any way to achieve that objective by programming it? Right now, it requires 3 runs changing accounts and sizes each time. In addition, 1 of the account is a margin account and the other two are cash accounts.

Is there a way to use the alert object to do this (or really any way at all) It would help me save a lot of time entering orders.


Eugene answered:

What about assigning an account to a copy of the strategy, and saving the position sizing with a Strategy (Preferences > Save the following items...)?

sedelstein replied:

QUOTE:
I've done that. It requires 3 runs (through the same dataset for that strategy for each account). I am actively trading 4 different strategies. So 12 runs. More as I add strategies.

I have a file with the symbols, strategy, limit prices, shares for the given symbol and the account.

Is there a way to work with that?
profile picture

Eugene

#13
You can save on manual runs by adding the strategies to a workspace. Other than that, I'm not aware of a programmatic way.
profile picture

Petrus3058

#14
Hi sedelstein,
I too have three accounts that I would like to automate and trade based on an excel file of ticker symbols and position sizes. Would you mind sharing your routine that reads an excel file of tickers and position sizes? Can you explain how this is codified? i.e. Is this part of your codified strategy? Any other tips / suggestions on getting this to work would be appreciated.

Thank you,
Petrus3058
profile picture

Eugene

#15
profile picture

Petrus3058

#16
Thank you Eugene.
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).