- ago
Hi,
I want to limit the numbers of shares I can purchase based on the BuyingPower. How can I do that?
Thanks,
Mike
0
607
Solved
8 Replies

Reply

Bookmark

Sort
Cone8
 ( 6.17% )
- ago
#1
Using what sizing method?
Give a specific example of how and when the number of shares would be limited and limited on what Buying Power basis?
0
- ago
#2
Originally, I was using Percent of Equity. The back testing of my logic worked the way I expected it to. I put in code to detect when I'm running the back-tester vs SM. So, when I run the strategy in the SM, it skips all bars except the last bar. It produced a signal to buy, but TDA failed to buy it because the number of shares was too much. It looked like it was based on my total account value.

Since I was having this problem, I was trying to figure out a method to determine the number of shares to buy on the fly based on the buying power. Is the buying power the available cash in the account?

I'd like to use Percent of Equity.
0
Cone8
 ( 6.17% )
- ago
#3
QUOTE:
is buying power the available cash in the account?
You know it is. You've even posted the results.

QUOTE:
skips all bars except the last bar
To be clear to the casual reader, that's because you selected the "Live Trading" preference.

QUOTE:
based on total account value
Percent of equity is based on [the specified percentage of] the total account value, correct. How else would you do it? You didn't provide an example.
0
- ago
#4
Here's an example of how I would like to do it. I don't know if it's possible.
When it's time to place a ***LIVE*** buy limit order, I'd like to determine the number of shares based on the BuyingPower. It all depends on the cash available in the account. The account value will not help me.

CODE:
// Pseudocode // shares are defined as double in the case of fractional shares. // percentage_of_cash_available is a user-defined value shares = ((BuyingPower * percentage_of_cash_available) / target_price) t = PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, target_price, shares);


Notice I add shares as an extra argument. OR somehow set the number of shares I want to buy without adding that extra argument.

Does this make sense?
0
Cone8
 ( 6.17% )
- ago
#5
Not to me. A numeric example, please. Use these numbers.

AccountValue: 50,000
BuyingPower: 20,000
CashAvailable: 25,000 (I guess this could be different than BuyingPower in a cash account due to day trading rules).

How is percentage_of_cash_available calculated? Do the calculation based on your user-defined number.

Complete the example and calculate the number of shares.
0
- ago
#6
I have to admit, if doesn't make sense to you, then my thinking could be wrong.

But, let's try an example.
Let's use BuyingPower of $20,000.
I'll use 50% (percent of buying power) of the BuyingPower, so $10k.
Let's assume a share of stock is going for a target price of $20.
shares = ((20000.0 * .5) / 20.00) = 500
What's shown above gives you a fixed number of shares.
However, the number of shares could increase if, for example, the order is filled at $18.
shares = (20000 * .5) /18.00) = 555

I guess what I really want is the system to use either a user-defined percentage of my available cash or buying power. If the program can't allow me to do it, I understand and I'll just use Percent of Equity and that will have to do.
0
Cone8
 ( 6.17% )
- ago
#7
What's confusing me is the use of "available cash or buying power".

Look, let's say you have $25K Cash Available.
Let's say 20% of Cash Available sizing.
The first position will be 20% * 25K = $5,000. That will leave you with $20K. The next 20% position would be $4,000. The next position would be $3,200. etc. Is that really what you want? Gradually smaller positions?

The idea of % of Equity using account value is because we assume that each trade has the same probability to gain/win. If you use smaller and smaller positions just because you bought positions already, it's pretty likely to have a negative effect. But if that's what you want test, go for it.
0
Best Answer
- ago
#8
The available cash and buying power are one in the same.

Thank you for your responses and your hard work to create this software your team has written. It works very well.

To conclude, I’m just going to use the percent of equity for my position sizing and leave it at that.

1

Reply

Bookmark

Sort