helpppp! I m new

 
Hi! I m new.. I need help please! I m a begginer of mql..very begginner. My experiment with EA don t work. it open only OP_Buy. Are two days that i try to understand what is the problem. I m blind. Please help! Thank you
 
  1. Help you with what? You haven't stated a problem, you haven't even stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help 2017.04.21

  2. “Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
         How To Ask Questions The Smart Way. 2004
              When asking about code

    Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code.
         How To Ask Questions The Smart Way. 2004
              Be precise and informative about your problem

    We can't see your broken code.

    Fix your broken code.

    With the information you've provided — we can only guess. And you haven't provided any useful information for that.

    How can we know what it's doing and what you want it to do?

 
#property copyright "JimWest"
#property link        "https://www.mql5.com"
#property version    "1.00"
#property strict
//IDEA: EA basato su ARRAY..MAV&MAL..RSI

extern int MagicNumber = 333 ;
extern int StopLoss= 50 ;
extern int TakeProfit= 50 ;
extern double Lotti= 1 ;
double p;

extern int RangeBarre= 6 ;
double HighTotBarre= 0.0 ;
double LowTotBarre= 0.0 ;

extern int PeriodoMaV= 20 ;
extern int PeriodoMaL= 100 ;
double MaV,MaL;

extern int RSI= 50 ;



//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {
p= Point ;
if ( Point == 0.00001 ) p= 0.0001 ;
if ( Point == 0.001 )   p= 0.01 ;
   

   return ( INIT_SUCCEEDED );
  }

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick ()
  { 
  MaV= iMA ( Symbol (), PERIOD_CURRENT ,PeriodoMaV, 0 , 0 , PRICE_CLOSE , 0 );
   MaL= iMA ( Symbol (), PERIOD_CURRENT ,PeriodoMaL, 0 , 0 , PRICE_CLOSE , 0 );
       
         if (OrdiniAperti()== false &&OrdiniApertiMaChiusiSuBarra()== false ){
  
   
   for ( int i= 2 ; i<= RangeBarre+ 1 ; i++){
   if (HighTotBarre<High[i])  HighTotBarre= High[i];
   if (LowTotBarre== 0 ||LowTotBarre>Low[i]) LowTotBarre=Low[i];
     }
  
   
   
   if (High[ 1 ]>HighTotBarre &&Low[ 1 ]>Low[ 2 ]&& Close[ 1 ]>MaL&& MaV>MaL&& Bid<=Open[ 0 ]){
   int ticket;
     ticket= OrderSend ( Symbol (),OP_BUY,Lotti,Ask, 0 ,Bid-StopLoss*p,Bid+TakeProfit*p, "DAJE" ,MagicNumber, 0 ,Blue);  
   
     }
   
   if (Low[ 1 ]<LowTotBarre &&High[ 1 ]<High[ 2 ]&& Close[ 1 ]<MaL&& MaV<MaL&& Bid>= Open[ 0 ]){
   int ticket;
   ticket= OrderSend ( Symbol (),OP_SELL,Lotti,Bid, 0 ,Ask+StopLoss*p,Ask-TakeProfit*p, "DAJE" ,MagicNumber, 0 ,Red);  
    }
   
   }
   
   
   
   
   
   
   
  }
//+-------------BOOL-----------------------------------------------------+

   bool OrdiniAperti()
  {
     for ( int i= OrdersTotal ()- 1 ; i>= 0 ;i--){
       if ( ! OrderSelect (i,SELECT_BY_POS,MODE_TRADES)) continue ;
         if (OrderSymbol()== Symbol ()&& OrderMagicNumber()==MagicNumber){
         return ( true );
        }
        }
         return ( false );
  }

   bool OrdiniApertiMaChiusiSuBarra()
  {
     for ( int i= OrdersHistoryTotal()- 1 ; i>= 0 ;i--){
       if ( ! OrderSelect (i,SELECT_BY_POS,MODE_HISTORY)) continue ;
         if (OrderSymbol()== Symbol ()&& OrderMagicNumber()==MagicNumber&& OrderOpenTime()>=Time[ 0 ]){
         return ( true );
        }
        }
         return ( false );
  }



//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
//---
   
  }

//  Sometimes error 4107
 
  1.      ticket= OrderSend ( Symbol (),OP_BUY,Lotti,Ask, 0 ,Bid-StopLoss*p,Bid+TakeProfit*p, "DAJE" ,MagicNumber, 0 ,Blue);  
    

    Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum 2012.05.20
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 25 March 2014

  2.    for ( int i= 2 ; i<= RangeBarre+ 1 ; i++){
       if (HighTotBarre<High[i])  HighTotBarre= High[i];
       if (LowTotBarre== 0 ||LowTotBarre>Low[i]) LowTotBarre=Low[i];
         }
    You never reset your variables so code breaks on the next new candle. Why roll your own instead of using iHighest?
 
Comments that do not relate to this topic, have been moved to "Off Topic Posts".