One robot influences other - HOW TO STOP?
One robot influences other - HOW TO STOP?
22 Jan 2017, 10:36
Hi all. I have multiple robots in my test environment and have noticed that certain robots impacts open positions they should not. Now other than using lables or position ID, how else can one stop it form happening. A code example of an exit strategy is below. What can I add, like maybe robot name, to stop this from happening?
foreach (var position in Positions)
{
if (MarketSeries.OpenTime.LastValue.Hour == 20 && MarketSeries.OpenTime.LastValue.DayOfWeek == DayOfWeek.Friday)
{
ClosePosition(position);
}
}
Thanks
Replies
FMogyi
26 Jan 2017, 15:02
Hi,
If you use more cBots simultaneously you should use Label parameter (means cBot ID) when managing your positions and orders.
Here is an example for closing:
//
var positions = Positions.FindAll(Label, Symbol); // cBot gets own positions only.
foreach (var position in positions)
{
TradeResult result = ClosePosition(position);
if (!result.IsSuccessful)
{
Print("*** ClosePos Err: {0} {1} {2} {3}", position.Id, position.Label, position.TradeType, result.Error);
error++;
}
else if (debug)
Print("--> {0} ClosePosition Ok.", position.Id);
}
}
Best Regards
@FMogyi
davidp13
22 Jan 2017, 19:33
I figured that I wll use the Robot name, equal that to the comment of the trade and then filter that with a unique lable. Not elegant at all, but what can I do...
@davidp13