I need help throwing alerts once a trade has been executed.

 
My ea is about openning trades once a an iput percantage change in the daily change is hit.  I needut to throw an alert when a trade is openned and closed
Files:
 
Nickson Ndurere Wangeci I needut to throw an alert when a trade is openned and closed

You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
          No free help (2017)

 
//---BUYYYYYYYYYY   
    if(Trade1 == true && current_market_change == Percent1_Up && current_market_change > 0 && Percent1_Up > 0 && PositionSelect(_Symbol) == 0) 
    {
    TYBset_TPA1= currentAsk + (TakeProfit1 * _Point);
    TYBset_SLA1= currentAsk - (StopLoss1 * _Point);    
    myTradingControlPanel.PositionOpen(_Symbol, ORDER_TYPE_BUY, Lot1, currentAsk, TYBset_SLA1, TYBset_TPA1, Comment1); // Open a Buy position
    StopLevel(TrailingStop_inPoints1); 
    
    //for(int i=0; i<1; i++) 
    //{
    //if(orderType==ORDER_TYPE_BUY   )
    //  {
    //   Alert("Buy1 Trade openned on input %", Percent1_Up);
    //   SendMail("Buy1 Trade", "Trade 1 (Buy1) has been openned");
    //   SendNotification("Buy1 Trade openned " );
    //   break;      
    //  }
    //}   
    }
    
    
    //---SELLLLLLLLLL
    if(Trade1 == true && current_market_change == Percent1_Down && current_market_change < 0 && Percent1_Down < 0 && PositionSelect(_Symbol) == 0) 
    {
    TYSset_TPA1= currentAsk - (TakeProfit1 * _Point);
    TYSset_SLA1= currentAsk + (StopLoss1 * _Point);   
    myTradingControlPanel.PositionOpen(_Symbol, ORDER_TYPE_SELL, Lot1, currentAsk, TYSset_SLA1, TYSset_TPA1, Comment1); // Open a Sell position
    StopLevel(TrailingStop_inPoints1);
    
    //for(int i=0; i<1; i++) 
    //{
    //if(PositionSelect(_Symbol) == 1 && m_position.PositionType()) {
    //Alert("Sell1 Trade openned on input %", Percent1_Down);
    //SendMail("Sell1 Trade", "Trade 1 (Sell2) has been openned");
    //SendNotification("Sell2 Trade openned " );    
    //}
    //}
    }

How do i make this ea throw an alert once only when the trade is executed and make the condition false once executed

void OnTrade() 
   {
   //ulong ticket = HistoryOrderGetTicket(ORDER_TICKET);
   ulong type_of_order = ORDER_TYPE;
   double open_price = ORDER_PRICE_OPEN;
   //string symbol = ORDER_SYMBOL;
   double pos_tp =ORDER_TP;
   double pos_sl = ORDER_SL;
   double lot_size = ORDER_VOLUME_INITIAL;
   Alert("Trade type: ", type_of_order, " Market: ", _Symbol, " Executuion price:  ", m_position.PriceOpen(), " Volume: ", m_position.Volume() , "Take profit: ", m_position.TakeProfit(), " Stop Loss: ", m_position.StopLoss());
   
   }

Then my ontrade function throws 7 notifications per trade event. How do i stop this redundancy?

 
  1. Nickson Ndurere Wangeci #: How do i make this ea throw an alert once only when the trade is executed and make the condition false once executed

    When you open an order, Alert. What condition?

  2.    ulong type_of_order = ORDER_TYPE;
       double open_price = ORDER_PRICE_OPEN;
       //string symbol = ORDER_SYMBOL;
       double pos_tp =ORDER_TP;
       double pos_sl = ORDER_SL;
       double lot_size = ORDER_VOLUME_INITIAL;

    Perhaps you should read the manual. Those (in red) are constants. Use them in proper functions to get the values.
       How To Ask Questions The Smart Way. (2004)
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

Reason: