1) Condition set (define conditions that have to be met to triger action)
2) Modification of StopLoss based on market condition:
2.2 Resets the stop loss to the original value when all positions are closed
is the sequence of of 1) and 2) important or not at all? Meaning shall I first place SetStopLoss (2) under OnBarUpdate() or rather list the Condition set (1). Or maybe the sequence doesnt matter at all because they are actioned independently one from another regardless of their sequence under OnBarUpdate()?
Example:
OnBarUpdate()
if (Close[0] > Position.AvgPrice * 1.12)
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice);
}
if (ema21(21)[0] > sma89(89).Plot0[0]
{
EnterLong(DefaultQuantity, "");
}
Question:
Is SetStopLoss actioned 1st compared to EnterLong or they ar independent one from another and doesn't affect one another in any way?
In other words if SetStopLoss followed the EnterLong in such code would it change anything?
Comment