Close All trades when total profit is > x
Created at 02 Jun 2014, 10:10
Close All trades when total profit is > x
02 Jun 2014, 10:10
Hi,
Im running a system that has max 5 trades open. Im looking for a command or robot that will close all trades when combined profit or loss for that matter reaches a certain point.
Can anyone help me pls?
Thanks once again!
davidp13
02 Jun 2014, 21:39
Guess this can work...
public class CloseProfitablePositions : Robot
{
protected override void OnTick()
{
if (Account.Equity - Account.Balance > 250)
{
foreach (var position in Account.Positions)
{
Trade.Close(position);
}
}
//Close on negative
if (Account.Equity - Account.Balance < -100)
{
foreach (var position in Account.Positions)
{
Trade.Close(position);
}
}
}
}
@davidp13