privatevoid MoveStopToBreakeven()
{
// profit trigger move stop to breakeven
if(Position.MarketPosition == MarketPosition.Long)
{
double profit = GetCurrentBid() - Position.AvgPrice;
if(profit >= TickSize* 8)
{
SetStopLoss("LongEntryGem",CalculationMode.Price,Position.AvgPrice+TickSize* 2,true);
}
}
}
There is something in the help files about resetting the StopLoss to default value after the trade is exited. Is this the right idea:
protectedoverridevoid OnPositionUpdate(IPosition position)
{
if (position.MarketPosition == MarketPosition.Flat)
{
SetStopLoss"LongEntryGem",CalculationMode.Ticks,10,true);
}
}

Comment