At me such problem is not put profit target on a signal! and the stop loss and exit work fine here is the code
EMA3 = EMA(Low, Convert.ToInt32(VFAST));
EMA4 = EMA(High, Convert.ToInt32(VFAST));
double DELTA = Math.Round(Math.Abs((Close[0]-Open[0])/TickSize),0);
//Print(DELTA);
if (Position.MarketPosition == MarketPosition.Long && Close[0] < EMA3[0])
{
SetProfitTarget(CalculationMode.Price, Close[0]+(DELTA*2)*TickSize);
SetStopLoss(@"", CalculationMode.Price, Close[0]-DELTA*TickSize, false);
}
if (Position.MarketPosition == MarketPosition.Short && Close[0] > EMA4[0])
{
SetProfitTarget(CalculationMode.Price, Close[0]-(DELTA*2)*TickSize);
SetStopLoss(@"", CalculationMode.Price, Close[0]+DELTA*TickSize, false);
}
On the first screenshot, the result of the job profit is the target and the stop loss. In the second screenshot, only one stop loss, which works fine on the strategy! Tell me how to solve the problem so that stop loss and profit target are set only on signal.
Comment