HELP ! EA is not taking any Trades - page 2

 
please checkmyedited comment above I noticed the error as well
 
bool bull,bear; 
if(ROC_2<=0 && ROC_1>0)bull;
if(ROC_2>=0 && ROC_1<0)bear;

    // Buy Rules
        if (Bull)
        if (sell_hmaprevious!=EMPTY_VALUE && sell_hmacurrent==EMPTY_VALUE && buy_hmacurrent!=EMPTY_VALUE)
        
          {
        if (OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Ask - stopLoss * Point, Ask + takeProfit * Point, "1", 12345, 0, Green)) {
            Print("Buy order succeeded!");
        }
    }
    
    

   // Sell Rules
        if(Bear)
        if(buy_hmaprevious!=EMPTY_VALUE && buy_hmacurrent==EMPTY_VALUE && sell_hmacurrent!=EMPTY_VALUE)
        
         {
        if (OrderSend(Symbol(), OP_SELL, lots, Bid, 3, Bid + stopLoss * Point, Bid - takeProfit * Point, "2", 12345, 0, Red)) {
            Print("Sell order succeeded!");
 
Jefferson Metha:
#property copyright ""
#property link      ""
#property version   "1.00"
#property strict
int RPeriod=20;
bool UsePercent=false;

//Custom function
int Cross(){
    double
    ROC_2=iCustom(NULL,0,"ROC1",RPeriod,UsePercent,0,2),
    ROC_1=iCustom(NULL,0,"ROC1",RPeriod,UsePercent,0,1);

bool bull,bear; 
if(ROC_2<=0 && ROC_1>0) bull;
if(ROC_2>=0 && ROC_1<0) bear;
  
   
}
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{


    //Buy: when current line is up and blue and previous line is down and red
    
    double buy_hmacurrent = iCustom(NULL, 0, "hma-trend-indicator", 30,3,0, 0, 0);

    double buy_hmaprevious = iCustom(NULL, 0, "hma-trend-indicator", 30,3,0, 0, 1);



    //Sell: when current line is down and red and previous line is up and blue
    
    double sell_hmacurrent = iCustom(NULL, 0, "hma-trend-indicator", 30, 3, 0, 1, 0);

    double sell_hmaprevious = iCustom(NULL, 0, "hma-trend-indicator", 30, 3, 0, 1, 1);
    
  
   
    // Here, we fetch the current 3-period ATR value
    double atr = iATR(NULL, 0, 14, 0);
     
     
     
    // Since the stop loss will be a multiple of this ATR value,
    // we define this multiple. 2.5 times the ATR value
    // is often a good start:
    double atrMultiple = 3;
     
     
     
    // Now, we set our stop loss.
    // We multiply the ATR value by the ATR multiple
    // and divide by the Point constant
    // in order to get a value in points:
    int stopLoss = (int)(atr * atrMultiple / Point);
     
     
     
    // And, since we have a dynamic stop loss value,
    // it makes sense to use the same pips amount as our take profit
    int takeProfit = stopLoss;
    
    
    
    // Dynamic lot sizes based on our stop loss
    double lots = calculateLotSize(stopLoss);
    
    
    
    // Buy Rules
        if (Bull)
        if (sell_hmaprevious!=EMPTY_VALUE && sell_hmacurrent==EMPTY_VALUE && buy_hmacurrent!=EMPTY_VALUE)
        
          {
        if (OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Ask - stopLoss * Point, Ask + takeProfit * Point, "1", 12345, 0, Green)) {
            Print("Buy order succeeded!");
        }
    }
    
    

   // Sell Rules
        if(Bear)
        if(buy_hmaprevious!=EMPTY_VALUE && buy_hmacurrent==EMPTY_VALUE && sell_hmacurrent!=EMPTY_VALUE)
        
         {
        if (OrderSend(Symbol(), OP_SELL, lots, Bid, 3, Bid + stopLoss * Point, Bid - takeProfit * Point, "2", 12345, 0, Red)) {
            Print("Sell order succeeded!");
        }
    }
   
}
//+------------------------------------------------------------------+

/**
 * Calculate the amount of lots needed based on stop loss
 *
 * @return  double
 */
double calculateLotSize(int StopLossPoints)
{
    // 1% risk per trade
    int risk = 2;
    
    double lotStep = MarketInfo(Symbol(), MODE_LOTSTEP);
    double minLot  = MarketInfo(Symbol(), MODE_MINLOT); 
    double maxLot  = MarketInfo(Symbol(), MODE_MAXLOT);
    double tickVal = MarketInfo(Symbol(), MODE_TICKVALUE);

    double lotSize = AccountBalance() * risk / 100 / (StopLossPoints * tickVal);

    return MathMin(
        maxLot,
        MathMax(
            minLot,
            NormalizeDouble(lotSize / lotStep, 0) * lotStep // This rounds the lotSize to the nearest lotstep interval
        )
    ); 
}

'Bull' - undeclared identifier    Automate V0.mq4    93    13
'Bear' - undeclared identifier    Automate V0.mq4    105    12
expression has no effect    Automate V0.mq4    15    25
expression has no effect    Automate V0.mq4    16    25
'}' - not all control paths return a value    Automate V0.mq4    19    1

 
fiehejulien:

'Bull' - undeclared identifier    Automate V0.mq4    93    13
'Bear' - undeclared identifier    Automate V0.mq4    105    12
expression has no effect    Automate V0.mq4    15    25
expression has no effect    Automate V0.mq4    16    25
'}' - not all control paths return a value    Automate V0.mq4    19    1

Get rid of cross function, and insert it inside the OnTick function. 

its that am not with my text editor, but are u posiive ugot the parameters of ROC correctly. coz wen i did it on friday still there was no trade going thru. 

so i believe that ur cross function has an error 

Reason: