My position doens't close

 
Hi, so instead of putting a Take profit in points, I used another expression
if(LongPositionOpen() == true && rate[1].close > BBMidle[1])
      {
             trade.PositionClose(_Symbol);
      }

And I have this, I have no Take Profit, but I have a Stop Loss

 if(!PositionSelect(_Symbol))
   { 
      
      request.action = TRADE_ACTION_DEAL;               // Immediate order execution
      request.price = NormalizeDouble(ask,_Digits);     // Lastest Ask price
      request.symbol=position_symbol;
      request.sl = NormalizeDouble(ask - STP*_Point,_Digits);                            // Stop Loss
      request.tp = 0;                          // Take Profit
      request.symbol = _Symbol;                         // Symbol
      request.volume = Lot;                             // Number of lots to trade
      request.magic = 0;                                // Magic Number
      request.type = ORDER_TYPE_BUY;                    // Buy Order
      request.type_filling = ORDER_FILLING_FOK;         // Order execution type
      request.deviation=5;                              // Deviation from current price
      return(OrderSend(request,result));               // Send order

      
   } 
The expert recognizes the Stop Loss but the position, when open, doesn't close when
rate[1].close > BBMidle[1])


Can someone help me? Regards

 
Gouveiaa:
Hi, so instead of putting a Take profit in points, I used another expression

And I have this, I have no Take Profit, but I have a Stop Loss

The expert recognizes the Stop Loss but the position, when open, doesn't close when


Can someone help me? Regards

Anyone?
 
Gouveiaa:
Anyone?

Your problem is not clear.

The expert recognizes the Stop Loss but the position, when open, doesn't close when

Where is the relevant code ?

 
Alain Verleyen:

Your problem is not clear.

Where is the relevant code ?

When the EA opens the position it recognizes the Stop Loss ( no problema till there) but I want the other peace of code this one  rate[1].close > BBMidle[1]) to be my take produto, to close the position
 
post the code for the close function, so we can not know
 
Bernhard Schweigert:
post the code for the close function, so we can not knowI 
I don't have one, my Long Position Open Can close the position with the Stop Loss, and Im trying to make the  rate[1].close > BBMidle[1]) my take profit
Reason: