Altering portfolio value or number of shares purch
Author: angel57
Creation Date: 10/19/2008 1:14 AM
profile picture

angel57

#1
During execution of a strategy, is there a way to issue a BuyAtStop and specify either the number of shares to be purchased or reduce the size of the portfolio temporarily to accomplish the same thing? During highly volatile market periods I would like to buy less shares and risk less capital.
profile picture

Eugene

#2
Specify the number of shares to be purchased - no. If you require it, please contact Fidelity and ask.
Reduce the size of portfolio - yes, look for SplitPosition in the QuickRef.
profile picture

Cone

#3
The question is ambiguous. I'm not convinced that it's directed at backtesting.

If it's not, then sure, you can control precisely the amount of shares for any specific alert by setting up the Position Sizing Control in the Wealth-Lab tool that you're using for trading.

Also, there is a Trading Preference (F12) to always exit the total number of shares of a stock in your account, regardless of the size used in the Sizing control.

Try to be more specific about what you're trying to accomplish and where you're trying to do it, so that we can give you the right answer.
profile picture

angel57

#4
Sorry for the ambiguity. I would like to do it for backtesting and eventually for an automated trading strategy. The SplitPosition only applies to exiting part of a position, I am referring to a method of entering the position. The sizing controls in simulation and regular trading are global parameters and cannot be adjusted when issuing a BuyAtStop or any buying/shorting commands. Here is an example of what I am trying to do, and perhaps there is a way to do it. Assume my hypothetical portfolio is $100,000, and I want to invest 100% each time the strategy gets a trigger to buy. I would like to buy on the next bar at the high of the last candle, and set a trailing stop at the low of the last candle. Let's assume the high of the stock is $100 and the low is $99, therefore it will buy 1000 shares with a $1.00 trailing stop. If the stock declines to $99, then I will stop out at $99, and lose $1000 for the trade. However, I would like to cap my loss at $500, so I have 2 choices, set a tighter stop at $99.50, or maintain a larger stop at $1.00 and only purchase 500 shares, or $50,000. My backtesting thus far seems to suggest it is better to keep a wider stop when the market has a higher volatility, so the only way to cap my maximum loss per trade at $500 is to buy less shares during volatile periods, and buy more shares during calmer periods. Any ideas would be appreciated.
profile picture

Eugene

#5
QUOTE:
My backtesting thus far seems to suggest it is better to keep a wider stop when the market has a higher volatility, so the only way to cap my maximum loss per trade at $500 is to buy less shares during volatile periods, and buy more shares during calmer periods. Any ideas would be appreciated.


Based on your description, which looks like a representation of the percent volatility money management, you could take utilize Max Percent Risk in position sizing settings, setting an initial risk level in your Strategy code as a multple of the ATR unit (QuickRef for RiskStopLevel). (When PosSizers finally hit the street, you could express this idea directly in the PosSizer code w/o having to specify the risk level in the Strategy.)
profile picture

angel57

#6
Looks like Max Percent Risk is not adjustable within the code, unless I am misunderstanding its use. So I take it that PosSizers is a new feature in a future release? Will it be in 5.2?
profile picture

Eugene

#7
QUOTE:
Looks like Max Percent Risk is not adjustable within the code, unless I am misunderstanding its use.

What do you mean by adjusting? This option is configured one time = at the time of entry. If adjusting is what you want to do at every bar to load and unload shares based on portfolio risk (or volatility), then:

1. You would need PosSizers.
2. You would need a function like AddPosition to add up to an existing Position - which is not currently on Fidelity's plate, so it's better calling them and demonstrating your demand for it.
3. SplitPosition's already in place, but is not enough.

QUOTE:
Will it be in 5.2?

Since 5.2 is already released (for educational purposes), the next build is going to be marked as 5.3 and, most likely, will not include PosSizers - the new name for $imuscripts.
profile picture

angel57

#8
What I mean by adjusting is when you run a backtest over several months or years, the volatility of a stock changes day to day, week to week, so I want to control the amount I would buy depending on the volatility just prior to making the purchase. So, I guess I have to wait for PosSizers. Thanks for your help, as always. Regarding contacting Fidelity, I see it mentioned a lot in other postings, is there an official place to make these WL requests via web or email, or just call the usual main number and talk to a representative?
profile picture

Cone

#9
QUOTE:
so I want to control the amount I would buy depending on the volatility
If you want constant risk, then you could determine the stop based on volatility, pass it to RiskStopLevel, and use Max % Risk Sizing right now.