Hello.
Can I limit the margin used for each individual strategy during live auto-trading?
Can I limit the margin used for each individual strategy during live auto-trading?
Rename
For live trading limitations see what's available in Preferences/Trading Thresholds.
What I need to do is auto-trading 3 different strategies with equal equity assigned to each one: USD 33000.
Strategy A trades a stock list and uses position size of 50% of equity (assigned equity is USD 33000 for each strategy), and Margin of 1.
Strategy B trades a different list of stocks and uses position size of 16% of equity, and Margin of 1.
Strategy C trades a single symbol and uses position size of 90% of its equity with a Margin of 2.
Can I auto-trade all these strategies as mentioned on a single IB account? Margin in IBKR is 10. I want that the auto-trading respects the individual constrains both in size and Margin. Is it possible? How can I do it?
Strategy A trades a stock list and uses position size of 50% of equity (assigned equity is USD 33000 for each strategy), and Margin of 1.
Strategy B trades a different list of stocks and uses position size of 16% of equity, and Margin of 1.
Strategy C trades a single symbol and uses position size of 90% of its equity with a Margin of 2.
Can I auto-trade all these strategies as mentioned on a single IB account? Margin in IBKR is 10. I want that the auto-trading respects the individual constrains both in size and Margin. Is it possible? How can I do it?
You could add some code to your Strategy to look at the balance in the account and if it lower than a certain value don't make the trade. But there's nothing like this built into the Preferences, those are handled at the Account not Strategy level.
This is one of my strategies settings. The thing is that it is optimized to operate with a position size of 50% and a margin of 1, so if all the 7 members of its dataset enter the buy zone, it should buy only 2 stocks.
My IB account has a margin so right now when all the 7 members of this dataset enter the buy zone, Strategy Manager keeps buying far beyond it's assigned USD 16500 (50% of the USD 33000 assigned to the strategy in the account of USD 100000).
Adding an open position threshold is not suitable due to I want to trade 3 different strategies, two of them should open 2 positions at most, but the third strategy can open up to 6 positions of USD 5300 (aprox. 16% of its assigned equity) from a different dataset.
How can I auto trade these 3 strategies using the same individual sizes and keeping each individual size and margin constrains?
These are my Trading Preferences:
My IB account has a margin so right now when all the 7 members of this dataset enter the buy zone, Strategy Manager keeps buying far beyond it's assigned USD 16500 (50% of the USD 33000 assigned to the strategy in the account of USD 100000).
Adding an open position threshold is not suitable due to I want to trade 3 different strategies, two of them should open 2 positions at most, but the third strategy can open up to 6 positions of USD 5300 (aprox. 16% of its assigned equity) from a different dataset.
How can I auto trade these 3 strategies using the same individual sizes and keeping each individual size and margin constrains?
These are my Trading Preferences:
You could save data to a file or use global memory (SetGlobal) to save the trades or just of number of trades created by the strategy. Then, check this file/memory item (GetGlobal) and use it as a condition to enter the trade. Should work.
By the way, you're not using Live Positions, which is fine, but your Backtest will depend on hypothetically entering 2 trades with 50% of equity. With no margin, there's a chance of a NST position (albeit small for intraday trading). I'd recommend setting margin to something like 1.05 - it will rarely be used, but will save you from being out-of-sync with the broker when it is used.
By the way, you're not using Live Positions, which is fine, but your Backtest will depend on hypothetically entering 2 trades with 50% of equity. With no margin, there's a chance of a NST position (albeit small for intraday trading). I'd recommend setting margin to something like 1.05 - it will rarely be used, but will save you from being out-of-sync with the broker when it is used.
I am very basic when coding :-( relying on Building Blocks.
I will add an account cash threshold and simulate the portfolio as a metastrategy with these realistic constrains.
I will add an account cash threshold and simulate the portfolio as a metastrategy with these realistic constrains.
My immediate solution for a safe auto-trading and realistic simulation of this portfolio is. a) Rising the margin to 1:4 on each strategy. b) creating a meta strategy sharing an equity pool and assigning a 1:1 margin to it; and c) adding a cash threshold of -1000 (or up to 1:2 margin) in my trading preferences.
Your Response
Post
Edit Post
Login is required