Modify "Close at Profit"

 

Modification of "Close at Profit", this EA has the option of closing when a currency pair take a benefit = X, now I have done is to do the same but, I separate trade Buy close at X & trade Sell close at X independent. But i dont't see where is the error. I see the text in chart but 0,00 i don't see the correct number.

Every time I'm approaching more and more, write, compile, test, someone give me a little help, today is Saturday and I'm already saturated, thanks.

tomorrow a little more and better.

 
Bellagio:
But i dont't see where is the error.
I see the text in chart but 0,00 i don't see the correct number.
  1. What error? We're not mind readers, you have to learn to think and convey clearly.
  2. What number, where, what is the correct number?
  3. bool CloseDeleteAllCurrentBuy()
    {
        int total  = OrdersTotal();
          for (int cnt = total-1 ; cnt >=0 ; cnt--)
          {
             OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
    
             if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) 
    Why are you selecting the order, not checking it's return value, and then selecting it again?
  4. if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),maxSlippage,Violet))
       return(false);
    
    Always test your return codes and print out WHY they fail. What are Function return values ? How do I use them ? - MQL4 forum

    Why use a function call (MarketInfo(OrderSynmbol(), MODE_BID) when you can use the predefined variable (Bid) or be direction independent OrderClosePrice()
  5. Why write two functions that do the same exact thing (CloseDeleteAllCurrentBuy/Sell)? Also your function only closes open orders so don't call it Delete and you can only close current orders so don't call it Current.
    bool CloseAll(int op){
       for (int cnt = OrdersTotal();-1 ; cnt >=0 ; cnt--)
       if (OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)
        && OrderSymbol() == Symbol()
        && OrderType()   == op)
       {
          if(!OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), maxSlippage, Violet)){
             Alert("OrderClose failed: ", GetLastError());
             return(false);
          }
       }
       return (true);
    }
    Why aren't you using a magic number (zero for manual trading.) Your EA is now incompatible with ever other.
  6. OpenedBuy() always test return codes.