Can I close all positions attached to a strategy?
Thanks and regards,
drolles
Close all positions attached to a strategy
Re: Close all positions attached to a strategy
If not a in-build method, possible workaround:
Code: Select all
if (PositionSide != 0)
{
if (PositionSide == 1)
{
//long_exit_orders_market[exit_counter].Send();
long_exit_order.Send(CurrentPosition.OpenLots);
exit_counter++;
}
else if (PositionSide == -1)
{
//short_exit_orders_market[exit_counter].Send();
short_exit_order.Send(CurrentPosition.OpenLots);
exit_counter++;
}
}
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Close all positions attached to a strategy
Hello drolles,
You can use Sell and BuyToCover order commands for closing the position.
You can use Sell and BuyToCover order commands for closing the position.