I have a strategy implemented with 2 seperate entries with the same stoploss in the beginning. After my 1st profittarget is met I sell the whole first entry and then I want to set the stoploss of my 2nd entry to breakeven plus some extra. Unfortunately the breakevenpart is not working. I already read some threads but didn't find a solution yet.
This is my code for long entries.
if (buySignal && Position.MarketPosition == MarketPosition.Flat)
{
str_drawID = "Long "+drawID.ToString();
str_buyID1 = "Long1 "+buyID.ToString();
str_buyID2 = "Long2 "+buyID.ToString();
SetStopLoss(str_buyID1,CalculationMode.Ticks, StopLoss,true);
SetProfitTarget(str_buyID1,CalculationMode.Ticks, ProfitTarget);
EnterLong(ProfitBatch,str_buyID1);
SetStopLoss(str_buyID2,CalculationMode.Ticks, StopLoss, true);
SetProfitTarget(str_buyID2,CalculationMode.Ticks, ProfitTarget2);
EnterLong(TrailBatch,str_buyID2);
buyID = buyID+1;
buySignal = false;
}
if (Position.MarketPosition == MarketPosition.Flat)
{
SetStopLoss(CalculationMode.Ticks, StopLoss);
}
else if (Position.MarketPosition==MarketPosition.Long)
{
if (Close[0]>Position.AveragePrice + (ProfitTarget * TickSize))
{
SetStopLoss(str_buyID2,CalculationMode.Ticks, Position.AveragePrice,true);
}

Comment