I have a strategy which enters positions using the EnterLongLimit & EnterShortLimit methods.
My strategy with stop losses is to only add a stoploss if the position has moved into a profit on the previous bar. I then set the profit to be the avg entry price.
However, i keep on having the stoploss triggerred inside the same 1 minute bar as the position was enterred, even when I add some code trying to prevent this (stipulating only SetStopLoss() when BarsSinceEntry() is greater than 0).
The code is here:
// Introduce stoploss on pos if sitting on profit
if (Position.MarketPosition == MarketPosition.Short && Position.GetProfitLoss(Close[1], PerformanceUnit.Points)>=0)
{SetStopLoss(short_position_name,CalculationMode.P rice, Position.AvgPrice,true);}
if (Position.MarketPosition == MarketPosition.Long && BarsSinceEntry(long_position_name)>1 && Position.GetProfitLoss(Low[0], PerformanceUnit.Points )>=0)
{SetStopLoss(long_position_name,CalculationMode.Pr ice, Position.AvgPrice,true);}
Any advice much appreciated as usual!! :-)
Ben
I have tried to exclude the stoploss from doing this

Comment