Is there a possibility with the Interactive Brokers broker connection to allocate a strategy a percentage of the available account value.
Example:
A strategy should use 40% of the available account value. The rest is used for other purposes.
So far I have only found that it uses the entire Account Value.
Example:
A strategy should use 40% of the available account value. The rest is used for other purposes.
So far I have only found that it uses the entire Account Value.
Rename
MetaStrategy?
Hi Eugene, I don't think using a Metastrategy would enforce any kind of limit such that only 40% of an IB account value would ever be used in trading.
The best you could do is use a Trading Threshold (Trading Preferences) that would shut down any new entries when Buying Power reaches a certain level.
The best you could do is use a Trading Threshold (Trading Preferences) that would shut down any new entries when Buying Power reaches a certain level.
I'll try to describe it in a little more detail with an example:
The account balance at IB is 150,000 USD. The strategy is to use 40% of it, i.e. 60,000 USD.
The strategy is EOD and buys market on open. It trades 20% of equtiy per position, so 5 positions. Each position size should therefore be calculated with 12,000 USD (20% of 60,000).
Can I set this with the Interactive Broker connector?
The account balance at IB is 150,000 USD. The strategy is to use 40% of it, i.e. 60,000 USD.
The strategy is EOD and buys market on open. It trades 20% of equtiy per position, so 5 positions. Each position size should therefore be calculated with 12,000 USD (20% of 60,000).
Can I set this with the Interactive Broker connector?
Not directly. What you can do is configure Preferences > Trading with the Trading Threshold of 60K.
The threshold doesn't change the value reported by the broker to use for the % of equity sizing.
How about just setting the sizing to 40% * 20% = 8% of the account value?
How about just setting the sizing to 40% * 20% = 8% of the account value?
You might set 60K to the starting captial in the strategy setup and disable Use Broker-reported Account Value in the preferences. Additionally you can set the position sizer to 20% of equity. Then you can adjust the capital on daily basis or whenever you like. What do you think?
I think this works. But then I would also have to set Date Range to the current date.
If you use 8% of the account value along with the Broker reported Account value preference, you don't have to worry about the dates or the strategy equity being out of sync. 🤷
Cone, do you mean that the 8% is entered in the strategy at sizing positions?
For the % of equity sizing.
If you want $12K sizes based on 20% sizing of 40% of a $150K account, the answer is to use 8% of equity sizing. You'll have to control the total number of trades put on with other options (or just not placing more trades).
This is the answer if you don't care what affects the total account value. Let's say your other strategy that's using the other $90K gets chopped to $40K. Well, the sizing for the strategy operating with $60K is going to drop to $8K (8% of 100K).
If you want to totally isolate the strategy allocation so that other strategies won't affect it, then you do with MIH suggested and battle with keeping everything in sync.
.. but you don't need to worry about the dates too much. Just specify the date when you start trading in the strategy and exit at the beginning of Execute() if the bar is before that date so that the equity is sync'd on that date. Example:
If you want $12K sizes based on 20% sizing of 40% of a $150K account, the answer is to use 8% of equity sizing. You'll have to control the total number of trades put on with other options (or just not placing more trades).
This is the answer if you don't care what affects the total account value. Let's say your other strategy that's using the other $90K gets chopped to $40K. Well, the sizing for the strategy operating with $60K is going to drop to $8K (8% of 100K).
If you want to totally isolate the strategy allocation so that other strategies won't affect it, then you do with MIH suggested and battle with keeping everything in sync.
.. but you don't need to worry about the dates too much. Just specify the date when you start trading in the strategy and exit at the beginning of Execute() if the bar is before that date so that the equity is sync'd on that date. Example:
CODE:
//execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { if (bars.DateTimes[idx] <_startTrading) return; if (!HasOpenPosition(bars, PositionType.Long)) { //code your buy conditions here } else { //code your sell conditions here } } //declare private variables below DateTime _startTrading = new DateTime(2023, 1, 30);
Your Response
Post
Edit Post
Login is required