My advisor acct has one margin account and one IRA account. The IRA account does not allow short positions so when I send a short order, only 50 shares are filled by the broker and the other 50 shares are rejected (since the IRA account cannot go short).
So now I have a strategy with that shows 100 shares but really only 50 at broker so if I use the
"ChangeMarketPosition" command to adjust the strategy, when I go to COVER 50 shares, they get divided in half and only 25 are "covered" and the IRA buys 25... (since my orders get split at broker)
This results in an essentially flat position, -25 in one account and 25 in other, when really I wanted to close...
How would you suggest resolving this with code?
>> This has already occurred a few times...
Thanks for any suggestions!
Note: edited
IB advisor acct with two sub-accts only one shorting allowed [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: IB advisor acct with two sub-accts only one shorting all
Hello hairyMug,
Have you tried closing the position instead of reversing it? I.e. use Sell instead of SellShort.
Have you tried closing the position instead of reversing it? I.e. use Sell instead of SellShort.
Re: IB advisor acct with two sub-accts only one shorting all
will this work?
if (TradeManager != null )
if( (shortMkt)||(sellMkt ))
{
this.TradeManager.TradingProfiles[0].CurrentAccount = "shortAccount";
}
else
{
this.TradeManager.TradingProfiles[0].CurrentAccount = "advisorAccount";
}
The idea is when the order is NOT short or cover, send the order to the advisor account (which will split 50-50)...
If the order is Short or Cover, then just send it directly to the account that is allowed to short...
Is "this.TradeManager.TradingProfiles[0].CurrentAccount" a useable command and how would I set the broker plugin so this will work?
if (TradeManager != null )
if( (shortMkt)||(sellMkt ))
{
this.TradeManager.TradingProfiles[0].CurrentAccount = "shortAccount";
}
else
{
this.TradeManager.TradingProfiles[0].CurrentAccount = "advisorAccount";
}
The idea is when the order is NOT short or cover, send the order to the advisor account (which will split 50-50)...
If the order is Short or Cover, then just send it directly to the account that is allowed to short...
Is "this.TradeManager.TradingProfiles[0].CurrentAccount" a useable command and how would I set the broker plugin so this will work?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: IB advisor acct with two sub-accts only one shorting all
hairyMug, that will work, but this is unmanaged orders approach. With this approach you are responsible for managing your orders. Please refer to the following post for more information.
Re: IB advisor acct with two sub-accts only one shorting all
"unmanaged" agreed...
I reviewed the referenced link but I am not sure if I need to define two profiles; one for short and one for long OR will it work to just set the current account?
I am not sure that just setting the "currentaccount" would be enough since it seems that it would need to "disconnect" and "reconnect" to set the new account at the broker??
Also, If I use it on a "per-chart" basis and sync the shares like this:
protected override void OnBrokerStategyOrderFilled(bool is_buy, int quantity, double avg_fill_price)
{
base.OnBrokerStategyOrderFilled(is_buy, quantity, avg_fill_price);
if(this.StrategyInfo.MarketPosition != quantity)
ChangeMarketPosition(quantity-this.StrategyInfo.MarketPosition, avg_fill_price, "qtyAdj");
}
Will that keep track of the shares?
Then I can get the number of shares from the strategy to cover/buy ?
Thanks!
I reviewed the referenced link but I am not sure if I need to define two profiles; one for short and one for long OR will it work to just set the current account?
I am not sure that just setting the "currentaccount" would be enough since it seems that it would need to "disconnect" and "reconnect" to set the new account at the broker??
Also, If I use it on a "per-chart" basis and sync the shares like this:
protected override void OnBrokerStategyOrderFilled(bool is_buy, int quantity, double avg_fill_price)
{
base.OnBrokerStategyOrderFilled(is_buy, quantity, avg_fill_price);
if(this.StrategyInfo.MarketPosition != quantity)
ChangeMarketPosition(quantity-this.StrategyInfo.MarketPosition, avg_fill_price, "qtyAdj");
}
Will that keep track of the shares?
Then I can get the number of shares from the strategy to cover/buy ?
Thanks!
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: IB advisor acct with two sub-accts only one shorting all [SOLVED]
You need to have a single broker profile.I reviewed the referenced link but I am not sure if I need to define two profiles; one for short and one for long OR will it work to just set the current account?
Using "currentaccount" is enough for that.I am not sure that just setting the "currentaccount" would be enough since it seems that it would need to "disconnect" and "reconnect" to set the new account at the broker??
If you do that to sync the broker position and positions in the strategies then market position will return you the current strategy position, which will be the same as the broker position.Also, If I use it on a "per-chart" basis and sync the shares like this:
protected override void OnBrokerStategyOrderFilled(bool is_buy, int quantity, double avg_fill_price)
{
base.OnBrokerStategyOrderFilled(is_buy, quantity, avg_fill_price);
if(this.StrategyInfo.MarketPosition != quantity)
ChangeMarketPosition(quantity-this.StrategyInfo.MarketPosition, avg_fill_price, "qtyAdj");
}
Will that keep track of the shares?
Then I can get the number of shares from the strategy to cover/buy ?