How to manually enter but exit automatically?
Author: electricessence
Creation Date: 7/20/2017 6:48 PM
profile picture

electricessence

#1
I'm having trouble understanding these details:

1) Is Wealth-Lab aware of my active positions from Fidelity?

2) Assuming I make a strategy that only has code for 'selling'/'stopping', can I manually enter a position knowing it will automatically exit for me?

3) I noticed that "Auto-Trading" only has "Off" and "Paper Accounts". What do I need to change to allow it to trade live?
profile picture

Eugene

#2
1. Your Strategy is not aware of your ATP trades, if you mean this. Otherwise please clarify.

2. This question is raised from time to time. Check this out, it might help:

Exit Only Strategy

3. Are you logged in to your live Fidelity account? You should then be able to choose "All live accounts", I guess.
profile picture

electricessence

#3
1. ATP or web, regardless. Just want to know if I have an existing position (not order) does WL know that account has X number of shares?
profile picture

electricessence

#4
Ok I think I get the limitations...
profile picture

Eugene

#5
Strategies always execute in a theoretical backtest mode so there's no direct access to the real positions in your account. For more detail please refer to the Wealth-Lab User Guide > Orders > Portfolio Synch.
profile picture

Cone

#6
QUOTE:
3) I noticed that "Auto-Trading" only has "Off" and "Paper Accounts". What do I need to change to allow it to trade live?
This means you do not have the Auto-Trading entitlement. You must call Fidelity Active Trader Support to find out if you qualify and/or request it.

QUOTE:
2) Assuming I make a strategy that only has code for 'selling'/'stopping', can I manually enter a position knowing it will automatically exit for me?
Indeed, you can create an "exit strategy" for those account positions. Here's an example about how you'd do that. It assumes that you're using an intraday chart and have entered a position prior to "today". This script requires one bar today to run, so it will not generate an exit order at the open.

One-Time Setup
1. Strike Ctrl+Shift+S to open a new Strategy from code.
2. Data Range: Use 500 fixed bars
3. Position Size: Raw Profit Shares/Contracts: Enter the number of shares for the Position in your account. This is only required if for some reason you haven't properly set up Portfolio Sync
4. Replace the code in the Editor with the following. This is a sample script that will exit a long position upon detecting the Close Crossing Under the 20-bar moving average. (Your job will be to change the exit condition/indicator(s) to suit your needs.)

CODE:
Please log in to see this code.

4. Save the Strategy. Let's call it "My Exit Script".
5. Close the Strategy.
6. Associate the strategy to the account holding your position. There are 2 ways:

Method 1:
In Preferences > Trading, select the account as the "Default Account".

Method 2:
Open the Strategy Explorer (Ctrl + O), navigate to and select "My Exit Script", then click "Set Account..." This associates "My Exit Script" with a specific account, which does not have to be the Default Account in Method 1.

That's the end of the 1-time set-up.

Employment
1. Log in to Fidelity
2. Open "My Exit Script", choose the symbol to trade in the Data tree, and check your Data Scale, Range, and Sizing.
3. Enable Streaming
4. If you have the entitlement, open the Orders tool (Ctrl+R) and enable Auto-Trading: Live Accounts.
5. From the Strategy Window's Alerts view, enable the Auto-Stage/Place button. This button will change to Auto-Place if you did the previous step.

Assuming you don't have Auto-Trade, the exit order(s) will be staged in the Orders tool when an Alerts is triggered. In this case you must manually select the order and click Place Selected.

As Eugene, suggested, please review Wealth-Lab User Guide > Orders > Portfolio Synch, as well as the linked topic Preferences > Trading > Exit Orders (Sell and Cover...). The latter will be important in order to ensure that you exit all of the shares in your account in case the Position size in the Sizing control does not match the shares you have in the account.
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).