how to fix it ?line 4 : return value of 'OrderSend' should be checked

 
    if((Bid > SMA18) && (SMA18 > EMA200))
      {
         /*-- Order Buy --*/
         OrderSend(Symbol(), OP_BUY, Lots,  Ask, Slippage, 0, Ask+TakeProfit*SetPoint, EAComment, EAMagicNumber);
 
      }

line 4 : return value of 'OrderSend' should be checked

 
priyoleksono:

line 4 : return value of 'OrderSend' should be checked

Define a variable : int ticket; before the set of coditions and :  ticket = OderSend(.....
 
oks thanks
 
if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber)
           {
               if(LastOP==0) {LastOP=OrderOpenPrice();}
               if(LastOP>OrderOpenPrice()) {LastOP=OrderOpenPrice();}
               if(LastLots<OrderLots()) {LastLots=OrderLots();}
               LastIsBuy=TRUE;
               iTotalBuy++;
               
               /* Bila mencapai batas OP maksimal, jangan tambah OP lagi */
               if(iTotalBuy==MaxTrade) 
                
                {return(0);}
               
               
           }

How about this ?

line 12 : 'void' function returns a value


 
OrderSend(Symbol(), OP_BUY, Lots,  Ask, Slippage, 0, Ask+TakeProfit*SetPoint, EAComment, EAMagicNumber);
  1. So read the documentation on what it returns and check your return codes for errors, and report them including GLE/LE and your variable values. Don't look at GLE/LE unless you have an error. Don't just silence the compiler, it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles

  2. You buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the spread on close.
    1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not the Ask. Your SL is shorter by the spread and your TP is longer. Don't you want the same/specified amount for either direction?
    2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask reaches it. To trigger at a specific Bid price, add the average spread.
                MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
    3. The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (Control-O) → charts → Show ask line.)
Reason: