if (IsFlat)
{
SetStopLoss(CalculationMode.Ticks, SL);
}
else if (IsLong)
{
// Once the price is greater than 25% of PT ticks, set stop loss to breakeven
if (Close[0] > Position.AveragePrice + (0.25 * PT * TickSize))
{
SetStopLoss(CalculationMode.Price, Position.AveragePrice);
Draw.Diamond(this, ""+CurrentBar, true, 0, Position.AveragePrice - (0), Brushes.Magenta);
}
if (Close[0] > Position.AveragePrice + (0.5 * PT * TickSize))
{
SetStopLoss(CalculationMode.Price, Position.AveragePrice + 10 * TickSize);
Draw.Diamond(this, ""+CurrentBar, true, 0, Position.AveragePrice + 10 * TickSize, Brushes.Chartreuse);
}
}
Comment