Been struggling for 3 weeks to get this basic EA to work - please help - page 2

 
GumRai:

Close[0] is the current Bid price. Bar[0] hasn't closed yet so it can only be the last available price

It may be that what you are actually trying to do is

 which is the last completed bar closed higher than the previous bar's close

Thank you that helped.  I also wanted one trade per currency pair and found the code posted by WHRoeder elsewhere.  My code now looks like this and it is working.  Thank you for everyone's help.  I plan to add to this and want to eventually turn it into a more complex EA as my skills improve.

//+------------------------------------------------------------------+
//| mo_bidir_v0_1.mq4                                                |
//|                                                                  |
//| - Works best in 5M timeframe                                     |
//| - Bug fix to stop_loss in line 22 2010.04.07                     |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010 - Monu Ogbe"

#define magicNumber  1234
#define IDENT  "mo_bidir_v0_1"

extern double  lots           = 0.01;

 int    pos,result,total;
 
int start(){
   total=0;
   for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
        OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
    &&  OrderMagicNumber()  == magicNumber             // my magic number
    &&  OrderSymbol()       == Symbol() ){              // and my pair.
      total++;
    }
if(total < 1)
     {
     if(Close[1]>Close[2])
         result=OrderSend(Symbol(), OP_BUY, lots , Ask, 3, 0, 0, IDENT, magicNumber, 0, Blue);
         
     if(Close[1]<Close[2])
         result=OrderSend(Symbol(), OP_SELL, lots , Bid, 3, 0, 0, IDENT, magicNumber, 0, Red);
   } 
   return(0);
}
Reason: