Download MetaTrader 5

My position doens't close

To add comments, please log in or register
Gouveiaa
123
Gouveiaa 2016.09.01 17:55 
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
123
Gouveiaa 2016.09.05 20:11  
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?
Alain Verleyen
Moderator
31134
Alain Verleyen 2016.09.06 14:20  
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 ?

Gouveiaa
123
Gouveiaa 2016.09.06 18:55  
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
Bernhard Schweigert
6592
Bernhard Schweigert 2016.09.10 09:54  
post the code for the close function, so we can not know
Gouveiaa
123
Gouveiaa 2016.09.10 10:54  
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
To add comments, please log in or register