I am trying to write code that will essentially move the StopLoss down to the next high or low of prior candle. So if I am short, move the stop to the high of the last candle, and if short, move the high to the low of the last candle.
Here is my starting point.
if (Position.MarketPosition == MarketPosition.Short)
{
SetStopLoss("", CalculationMode.Price, High[0], false);
}
I am not getting the behavior I expect. I don't want to set high to [1] because then the high of the last candle could have been lower than the high of current candle, then I am taken out which I don't want.
When I use the [0], I don't seem to get the behavior I expect, rather I get in the position, then right out.
I'm sure this is simple, so if anyone can help, I would appreciate it.
Also, I have tried adding BarsSinceEntry() to 1, etc.
Thanks,
Comment