set maximum...................
05 Nov 2013, 19:48
how can i set maximum trade volume that the robot is trading ?
and how can i stop the robot if 10 losing trades in a row are closed?
Replies
adaled
06 Nov 2013, 17:42
Maybe this helps for the first request: /forum/calgo-reference-samples/499
Check the forum there should be more code examples.
ten losing trades that the same robot opened? You can use the OnPositionClosed method increase a global variable if the position has a loss and decrease it otherwise. If that variable reaches 10 it means there were 10 consecutive losses. then call the method Stop();
protected override void OnPositionClosed(Position position)
{
if (position.GrossProfit < position.Commissions)
_loss++;
else
_loss--;
if(_loss == 10)
Stop();
}
@adaled

rawand
06 Nov 2013, 15:41
can anyone code this, please?
@rawand