Questions from Beginners MQL4 MT4 MetaTrader 4 - page 6

 

Good afternoon

Please help with a very simple (probably) question. There is a standard function:

int  ArraySize(const void& array[]);

What does "const void &" mean and how to use it? ? Even a simple attempt to write a similar function leads to a compilation error:

int test(const void& array[]) {
    return ArraySize(array);
}

Compilation error: 'const' - illegal use of 'void' type

How can I use "const void &"correctly when writing my own code? Can it be done at all ?
 
mql4-2016:

Good afternoon

Please help with a very simple (probably) question. There is a standard function:

int  ArraySize(const void& array[]);

What does "const void &" mean and how to use it? ? Even a simple attempt to write a similar function leads to a compilation error:

int test(const void& array[]) {
    return ArraySize(array);
}

Compilation error: 'const' - illegal use of 'void' type

How to use "const void &"correctly when writing your code? Is it even possible?

No way.

-----

Try the script,

I think you will understand it.



double array[10];
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   Print("количество элементов = ",ArraySize(array));

//----------------или

   int size=ArraySize(array);

   Print("количество элементов = ",size);
  }
//+------------------------------------------------------------------+
 

Hello. I need tosend to api.binaryteam.ru from the indicator after the alert. What lines should be added to the indicator.mq4 file to send a line like http://api.binaryteam.ru/?request=signal&key=12345472300af900f431234561234567&formname=risefall&type_account=demo&symbol=frxUSDCHF&duration=5m&amount=3&bet=CALL&source=metatrader to api.binaryteam.ru after the alert.

There is an example of sending for advisors http://binaryteam.ru/addons/#api, when adding the lines to the file of the indicator.mq4

extern  string url="http://api.binaryteam.ru/";

extern  double  bet=1;

extern int expiration=1;

extern string key = "12345472300af900f431234561234567" ;

extern string type_account = "demo";

extern bool Flag = false;

extern string bettype;

.....
int start() {

....

условие покупки {

.....

Alert("алерт индюка  -  BUY!!!");

bettype = "CALL";

      Print("направление ставки: ",bettype);

      Flag = true;

Print(BinaryTeam());

  }

условие продажи {

.....  

Alert(""алерт индюка  -   SELL!!!");

bettype = "PUT";

      Print("направление ставки: ",bettype);

      Flag = true;

Print(BinaryTeam());

  }

  }

bool BinaryTeam()

{

   char post[],result[];

   int res;

      string headers;

    //--- для работы с сервером необходимо добавить URL

   //--- в список разрешенных URL (Главное меню->Сервис->Настройки, вкладка "Советники"):

      string formname = "risefall";

   string symbol = "frx" + Symbol();

   string duration = IntegerToString(expiration) + "m";

   string amount = DoubleToString(bet);

  if(Flag==false)

   {

      Print("не задано направление торговли");

      return(false);

   }

  

   //--- пример: http://api.binaryteam.ru/?request=signal&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&formname=risefall&type_account=demo&symbol=frxUSDCHF&duration=5m&amount=3&bet=CALL&source=metatrader

  

   //--- собираем строку для отправки

   string send = "?request=signal" +

         "&source=metatrader" +

         "&type_account=" + type_account +

         "&bet=" + bettype +

         "&formname=" + formname +

"&date_start=now" +

         "&symbol=" + symbol +

         "&duration=" + duration +

         "&barrier=0" +

         "&amount=" + amount +

         "&key=" + key;

  

   Print(send);

  

   ResetLastError();



   int timeout=5000;

   res = WebRequest("GET",url+send,NULL,NULL,timeout,post,0,result,headers);

   if(res==-1)

     {

      Print("Ошибка в WebRequest. Код ошибки  =",GetLastError());

      MessageBox("Необходимо добавить адрес '"+url+"' в список разрешенных URL во вкладке 'Советники'","Ошибка",MB_ICONINFORMATION);

     }

   else

     {

      Print(CharArrayToString(result));

      return(true);

     }

   Print("Непредвиденная ситуация");

   return(false);

}

Writes 2016.11.16 13:50:01.783 Error in WebRequest. Error code =4060


 
How do I link my personal account to my Alpari forum account?
 
how to pass a request without aWebRequest function?
 
greeng2016:
how to send a request without aWebRequest function?
About the same as sending an order without "OrderSend"
 
What programming language should I learn to program in mql4/mql5?
 
Timur1988:
What programming language should I learn to program in mql4/mql5?
The answer is already in the question itself. Original.
 
Timur1988:
What programming language should I learn to program in mql4/mql5?
mql4/mql5 is pure C + additional functions that are easy to find in the help
 
Vitaly Muzichenko:
About the same as sending an order without "OrderSend"
but how can you send a string to a website not via WebRequest, but via WinApi?