Executing an URL from MQL4

2019-04-03 01:49发布

On my MQL4 Code I need to execute an External url/link in order to update a table,

I have Added the URL in the Allowed URL List Option.

However I got the following error :

enter image description here

Any Idea how to solve this problem ? Thanks .

PS: I am using MT4 Build 840

标签: url mql4
1条回答
趁早两清
2楼-- · 2019-04-03 02:03

This warning reminds you to set ( check [x] ref. Fig1 below ) permit(s) to do so in your MT4 Terminal Tools->Options ( Ctrl+O )

Both the [Allow automated trading (Expert advisor per se )] and [ Allow WebRequest for listed URL: / Add a properly formatted link...]

must be checked [x] as Allow...

enter image description here

For any further problem resolution, the MCVE-compliant pieces of information are needed.

As a minimum ( there was yet nothing posted about ) the following pieces are needed to reproduce / verify the trouble you indicate having with a WebRequest() call, ( As noted earlier, StackOverflow encourages to post the whole Expert Advisor code-snippet, thus having the full context, right in the question, which helps you to form the MCVE-compliant part of the StackOverflow original post right when asking it. An image with erased URL part does not provide anything valuable for reproducing any error you claim to have problem with ):

// [A] a WebRequest(): which syntax-mode used + <genetators> / <content-state> of all data-payloads used to execute a WebRequest()-call
// ------------------

   aServerRESPONSE = WebRequest( "GET",
                                 "http://stackoverflow.com/users/3666197/user3666197",
                                 NULL,
                                 NULL,
                                 60000,
                                 aPostPAYLOAD,
                                 0,
                                 aRetResult_STORE,
                                 aRetHeadersSTORE
                                 );

// [A.1] method    [in]-> a HTTP method used in a WebRequest() call.
// [A.2] url       [in]-> a URL  target used in .
// [A.3] headers   [in]-> a string of Request headers in a format of "key: value" pairs, separated by a line break "\r\n".
// [A.4] cookie    [in]-> a Cookie setup value.
// [A.5] referer   [in]-> a Referer header value setup for the HTTP request.
// [A.6] timeout   [in]-> a WebRequest() timeout for sync-waiting in [ms].
// [A.7] data[]    [in]-> a WebRequest() HTTP message body.
// [A.8] data_size [in]-> a size of the data[] array under [A.7].
// [A.9] result[]        <-[out] storage for server response data.
// [A.A] result_headers  <-[out] storage server response headers.


// [B] any value returned from server, once a WebRequest() under [A] was executed
// --------------------

// [B.1] an MQL4-engine <Error-STATE>

   print GetLastError();

// [B.2] a WebRequest()-call's returned value

   print aServerRESPONSE;

// [B.3] as setup under [A.9] aRetResult_STORE

// [B.4] as setup under [A.A] aHeadersSTORE
查看更多
登录 后发表回答