I set the stop loss in the Initialize section to Variable0 for longs and Variable1 for short:
protected override void Initialize()
{
SetProfitTarget("", CalculationMode.Ticks, Profit1);
SetStopLoss("BCMT3_L", CalculationMode.Price, Variable0, false);
SetStopLoss("BCMT3_S", CalculationMode.Price, Variable1, false);
CalculateOnBarClose = true;
}
private int profit1 = 9; // Default setting for Profit1
private int plus_Offset = 3; // Default setting for Plus_Offset
private double min_Offset = -3.0; // Default setting for Min_Offset
{
EnterLong(DefaultQuantity, "BCMT3_L");
Variable0 = Low[0] + Min_Offset * TickSize;
}
if (Position.MarketPosition == MarketPosition.Long
&& Low[0] > Variable0)
{
Variable0 = Low[0] + Min_Offset * TickSize;
}
Thanks
DaveN

Comment