Eu obtenho lucro não desejado quando estou executando o trailing stop loss porque o código não leva em conta a comissão e a swap,
Eu tentei os seguintes que não funcionam
precisa de ajuda, obrigado!
Vazio LongTrailingStop ()
int lcnt;
int ltotal = OrdersTotal ();
BuyProfit duplo;
para (lcnt = ltotal-1; lcnt gt; = 0; lcnt--)
OrderSelect (lcnt, SELECT_BY_POS, MODE_TRADES);
if (OrderType () lt; = OP_SELL OrderSymbol () == Símbolo ())
if (OrderType () == OP_BUY)/a posição longa é iniciada
if (TrailingStopgt; 0)
if (Bid-OrderOpenPrice () gt; (Ponto * TrailingStop))
if (OrderStopLoss () lt; Bid- (Ponto * TrailingStop))
BuyProfit = (OrderProfit () OrderCommission () OrderSwap ());
OrderModify (OrderTicket (), OrderOpenPrice (), Bid- (Ponto * TrailingStop BuyProfit), OrderTakeProfit (), 0, Verde);
retorno (0);