¡Ayuda! - ¿Cómo hacer stop final no tomar pérdidas cuando beneficio negativo?
Estoy de vuelta probando usando la demo comercial de MB. El código estándar de final de recorrido no tendrá en cuenta el cambio de comisión y orden.
¿Alguien había intentado con éxito tener el trailing stop no tomar pérdidas con beneficio negativo?
código típico de final de recorrido:
void ShortTrailingStop ()
{
int scnt;
int stotal = OrdersTotal ();
para (scnt = stotal-1; scnt gt; = 0; scnt--)
{
OrderSelect (scnt, SELECT_BY_POS, MODE_TRADES);
if (OrderType () lt; = OP_SELL OrderSymbol () == Símbolo ())
{
if (OrderType () == OP_SELL)/se abre la posición corta
{
if (TrailingStopgt; 0)
{
if ((OrderOpenPrice () - Ask) gt; (Point * TrailingStop))
{
if ((OrderStopLoss () gt; (Ask (Point * TrailingStop))) || (OrderStopLoss () == 0))
{
OrderModify (OrderTicket (), OrderOpenPrice (), Ask (Point * TrailingStop), OrderTakeProfit (), 0, Red);
return (0);
}
}
}
}
}
}
}