Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2015.01.19 13:23

Automatic Posting with WebRequest() - script for MetaTrader 5

| English 日本語 Русский 中文 Español Deutsch Português

votes: 26

The WebRequest function has two call options, the first option is used to send simple queries, the example of it is available in the QuotesDemo script.

The second function option allows you to create queries of any type (GET, POST, HEAD, etc.) indicating your own set of headers. This options allows implementing flexible interaction with various Web services. This script is an example of how to post a message on the site.

Warning: avoid sending too frequent automated requests to web sites, because most of sites block too frequent calls. The site also has protection against too frequent requests, and an error in the code may lead to blocking of your account.

When you start the script, enter your login and password.

#property description "Sample script posting a user message "
#property description "on the wall on"

input string InpLogin   ="";             //Your account
input string InpPassword="";             //Your account password
input string InpFileName="EURUSDM5.png"; //An image in folder MQL5/Files/
input string InpFileType="image/png";    //Correct mime type of the image

You may use your own image name in the InpFileName parameter, do not forget to save the image file in the data_folder/MQL5/Files/ and in the InpFileType parameter set the correct MIME type.

Thus, using WebRequest() you can arrange automatic posting of messages containing current market analysis and forecast of probable price actions.


Please note that In the second version of the WebRequest() function, the following parameters passed by the user in the header are ignored, the following values are always used in them:

"Accept-Language: en\r\n"
"Accept-Charset: *,utf-8\r\n"
"Connection: Keep-Alive\r\n"
"Proxy-Connection: Keep-Alive\r\n"
"Pragma: no-cache\r\n"
"Cache-Control: no-cache\r\n",

The Host parameter is also ignored, its value is taken from the URL.

    Translated from Russian by MetaQuotes Software Corp.
    Original code:

    Accelerator Oscillator (AC) Accelerator Oscillator (AC)

    The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

    Average Directional Movement Index (ADX) Average Directional Movement Index (ADX)

    The Average Directional Movement Index Indicator (ADX) helps to determine if there is a price trend.

    TypeToBytes TypeToBytes

    Byte-wise operation with structures and standard data types.

    PriceLines PriceLines

    Script for drawing a price markup.