Problem with coding on MAC

Back to topics list To post a new topic, please log in or register
avatar
8
chevanton1988 2015.03.23 21:21
 

Hi gurus,

 

I have problem with coding on MAC. I create my expert advisor (MQL4) on PC and test it. It works fine. When I bring my EA on MAC compiler brings me an error, for example:

  1.  iHigh, iClose, iLow, iTime function --> error is "iHigh - function not define"
  2.  OrderSelect error is "wrong parameters count
  3. SELECT_BY_POS error is undeclared identifier
  4. OrderPrint function not defined
I don't know why? Can anybody help me and tell me what is problem?

 

Thank you 

avatar
12983
WHRoeder 2015.03.24 02:44 #
 
chevanton1988: I don't know why? Can anybody help me and tell me what is problem?
Nobody can tell you because there are no mind readers here. Post the code.
avatar
8
chevanton1988 2015.03.24 09:25 #
 
//+------------------------------------------------------------------+
//|                                                   OrdersTool.mqh |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property strict
//+------------------------------------------------------------------+
//|                           MqlOrderActive                         |
//+------------------------------------------------------------------+
/*
struct MqlOrderActive
  {
   string            symbol;
   int               ticket;
   double            lots;
   int               type;
   string            comment;
   int               index;

  };
  
*/
//+------------------------------------------------------------------+
//|         GetExpliciteOrderIndex                                   |
//+------------------------------------------------------------------+


int GetExpliciteOrderIndex(int magic)
  {

   if(OrdersTotal()<1)
     {

      return -1; //No orders set
     }

   for(int i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS))
        {
         if(OrderMagicNumber()==magic)
           {

            OrderPrint();
            return i;
           }
           } else {

         Print("Error during order indexed by ",i,". Error is ",GetLastError());
         ResetLastError();

        }

      ;

     };

   return -1; //No explicite order set

  };
//+------------------------------------------------------------------+
//|                      GetExpliciteOrderTicket                      |
//+------------------------------------------------------------------+

int GetExpliciteOrderTicket(int index)
  {

   if(OrderSelect(index,SELECT_BY_POS))
     {

      return OrderTicket();


        } else {
      Print("Error is ",GetLastError());
      ResetLastError();

     };

   return -1;


  };
//+------------------------------------------------------------------+
//|                      GetExpliciteOrderLots                        |
//+------------------------------------------------------------------+

double GetExpliciteOrderLots(int index)
  {

   if(OrderSelect(index,SELECT_BY_POS))
     {

      return OrderLots();


        } else {
      Print("Error is ",GetLastError());
      ResetLastError();

     };

   return -1;


  };
//+------------------------------------------------------------------+
//|                      GetExpliciteOrderSymbol                      |
//+------------------------------------------------------------------+

string GetExpliciteOrderSymbol(int index)
  {

   if(OrderSelect(index,SELECT_BY_POS))
     {

      return OrderSymbol();


        } else {
      Print("Error is ",GetLastError());
      ResetLastError();

     };

   return "No Symbol";


  };
//+------------------------------------------------------------------+
//|                      GetExpliciteOrderType                        |
//+------------------------------------------------------------------+

int GetExpliciteOrderType(int index)
  {

   if(OrderSelect(index,SELECT_BY_POS))
     {

      return OrderType();


        } else {
      Print("Error is ",GetLastError());
      ResetLastError();

     };

   return -1;


  };
//+------------------------------------------------------------------+
//|                      isExpliciteOrderBuy                        |
//+------------------------------------------------------------------+  

bool isExpliciteOrderBuy(int index)
  {

   if(OrderSelect(index,SELECT_BY_POS))
     {

      if(OrderType()==0)
        {

         return true;
        };

        } else {
      Print("Error is ",GetLastError());
      ResetLastError();

     };

   return false;




  };
//+----------------------------------------------------------------+
//|                      isExpliciteOrderSell                        |
//+------------------------------------------------------------------+  

bool isExpliciteOrderSell(int index)
  {

   if(OrderSelect(index,SELECT_BY_POS))
     {

      if(OrderType()==1)
        {

         return true;

        };

        } else {
      Print("Error is ",GetLastError());
      ResetLastError();

     };

   return false;




  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

avatar
8
chevanton1988 2015.03.24 09:25 #
 
//+------------------------------------------------------------------+
//|                                                     S&RTools.mqh |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property strict


struct MqlPivots {
datetime time;
double pivot;
double R1, R2, R3; //Resistance 1, 2, 3
double S1, S2, S3; //Support 1, 2, 3
};


int GetPivots (string symbol_name, int timeframe, int start_pos, int count, MqlPivots &pivots_array[]) {

int counter = 0;

ArrayResize(pivots_array, count, 0);

for(int i = start_pos; i < count; i++) {



double high = iHigh(symbol_name, timeframe, i);
double low = iLow(symbol_name, timeframe, i);
double close = iClose(symbol_name, timeframe, i);


pivots_array[i].time = iTime(symbol_name, timeframe, i);
pivots_array[i].pivot = (high + low + close)/3;

pivots_array[i].R1 = (2 * pivots_array[i].pivot) - low;
pivots_array[i].R2 = pivots_array[i].pivot + (high - low);
pivots_array[i].R3 = high + 2 * (pivots_array[i].pivot - low);

pivots_array[i].S1 = (2 * pivots_array[i].pivot) - high;
pivots_array[i].S2 = pivots_array[i].pivot - (high - low);
pivots_array[i].S3 = low - 2 * (high - pivots_array[i].pivot);

counter++;

}


return(counter);

} ;



Back to topics list  

To add comments, please log in or register