Could any one give suggestion on belowcode

 
void CheckForMaTrade()
{
   double UpArrow = ObjectFind(0,"Up Arrow");
   double DownArrow = ObjectFind(0,"Down Arrow");
   double currentbar = iOpen(NULL,0,0);
   double previoustbar = iClose(NULL,0,1);
     
   if (OrdersTotal()== 0){
   if (previoustbar+DownArrow && currentbar==UpArrow+DownArrow){ 
   OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,(Ask - (StopLoss * pips)),(Ask +(TakeProfit * pips)),NULL,MagicNumber,0,clrGreen);
   }
   if (previoustbar+UpArrow && currentbar==UpArrow+DownArrow){
   OrderSend(Symbol(),OP_SELL,LotSize,Bid,3,(Bid + (StopLoss * pips)),(Bid -(TakeProfit * pips)),NULL,MagicNumber,0,clrBlue);
   }
  }
}
 

Use the </> button to insert your code.


 
  1. When you post code please use the CODE button (Alt-S)! (For large amounts of code, attach it.) Please edit your post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  2.  if (OrdersTotal()== 0){
    Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
              Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum

  3.   if (previoustbar+DownArrow
    False is zero, non-zero is true. When will that ever be false?

  4. && currentbar==UpArrow+DownArrow){
    Doubles are rarely equal.
              The == operand. - MQL4 and MetaTrader 4 - MQL4 programming forum

  5. OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,(Ask - (StopLoss * pips)),(Ask +(TakeProfit * pips)),NULL,MagicNumber,0,clrGreen);
    Check your return codes for errors, report them and you would know why.
              What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
    Only those functions that return a value (e.g. iClose, MarketInfo, etc.) must you call ResetLastError before in order to check after.
Reason: