简体   繁体   English

如何使用MQL4获取市场数据?

[英]How do I get market data with MQL4?

I am using metatrader4 and I can get any information 'but' the market data from btc-e http://docs.mql4.com/constants/environment_state/marketinfoconstants 我正在使用metatrader4,可以从btc-e http://docs.mql4.com/constants/environment_state/marketinfoconstants中获取任何信息,但可以获取市场数据

IE IE

double pending = MarketInfo(Symbol(),MODE_PENDING);
MessageBox(
  DoubleToStr(pending)
);

just like the market data on the right hand side of this chart https://bitcoinwisdom.com/markets/btce/ltcusd , all the pending buy/sell orders, same market and everything. 就像这张图表右侧的市场数据https://bitcoinwisdom.com/markets/btce/ltcusd一样 ,所有待处理的买/卖定单,相同的市场以及所有东西。 How do I dump the pending volume using MQL4? 如何使用MQL4转储挂起的卷?

First, let's start with the < code >-snippet mis-concept 首先,让我们从< code > -snippet mis-concept开始

As seen in the provided < code >-snippet, there is a principal error/mis-concept. 如提供的< code >片段所示,存在主要错误/错误概念。 While the syntax of the MQL4-code is compiler-phase feasible ( it gets processed into an operational .ex4 runtime-code ), the result is principally wrong. 尽管MQL4代码的语法在编译器阶段是可行的(将其处理为可操作的.ex4运行时代码),但结果基本上是错误的。

MQL4 has a lot of enumerated constants, which used to have zero context-of-use checking in the MetaLang.exe compilation phase. MQL4有很多枚举常量,在MetaLang.exe编译阶段,这些常量过去使用零上下文检查。 ( Yes, had to say "used to have", due to the fact MetaQuotes, Inc., recent move into "hidden"-language modifications has changed a lot of system behaviour, even in the syntax of MQL4, calling it in a rather Orwel-style "New"-MQL4, so one has to pay attention to detail even more under the conditions of moving sands... ) (是的,不得不说“过去拥有”,由于MetaQuotes,Inc.的事实,最近进入“隐藏”语言修改已经改变了许多系统行为,即使在MQL4的语法上也是如此) Orwel风格的“ New” -MQL4,因此在移动沙子的情况下,您甚至必须更加注意细节...)

As expressed, an ENUM_CONST alike your attempt to use MODE_PENDING , has a fair meaning in the language, but that does not guarantee anything but a compile-time substitution of a value of int . 如前所述,ENUM_CONST类似于您尝试使用MODE_PENDING ,在语言中具有合理的含义,但是除了编译时替换int值外,它不能保证任何事情。 Thus one might state a MODE_HIGH ( btw == 2 ) in any place, where MODE_SMMA ( btw == 2 either ) would have an appropriate context-of-use. 因此,可以在任何地方声明MODE_HIGH (btw == 2),其中MODE_SMMA (btw == 2)具有适当的使用环境。 These are just symbolic substitutions during the compiler parsing phase. 这些只是在编译器解析阶段的符号替换。


Second, let's focus on your target 其次,让我们专注于目标

As seen, you would like to somehow operate on a set of knowledge about an overall amount & respective sizes of pending orders, that wait "on the table" before the market turns them active. 如图所示,您希望以某种方式了解一组有关未完成订单的总量和大小的知识,这些知识在市场转为活跃之前先“等待”。 This is a complex and non-trivial task. 这是一项复杂而艰巨的任务。 The more as FX has no "central" marketplace, to collect the global overall sum of sums. 由于FX没有“中心”市场,因此可以收集全球总和。

Speaking about " volume " thereof opens another confusion. 谈到它的“ 体积 ”,会带来另一个困惑。 Volume , as implemented in MQL4 is rather a discrete integer value related to a cummulative amount of price changes within the respective bar. Volume ,如在实施MQL4是相当的各条内有关的价格的变化的累积性量的离散的整数值。 Thus, on aNewBarEVENT, the Volume[0] == 1 ( the first price-bearing-quote has just arrived & has brought the indication of aNewBarEVENT per se ) and this value is step-wise increasing throughout the live-bar ( [0] ) duration. 因此,在aNewBarEVENT上, Volume[0] == 1 (第一个含价报价刚刚到来并带来aNewBarEVENT本身的指示),并且该值在整个实时柱中逐步增加([0 ])持续时间。 One may also note, that for bars, where no price-quote appeared "from Market", the MT4 does not show any bar in the graph ( a missing candle ). 可能还会有人注意到,对于没有“来自市场”的价格报价出现的柱形图,MT4在图中没有显示任何柱形图(缺少蜡烛)。

So always be carefull on using the word Volume , to assure, one gets it's full context-of-use. 因此,请务必谨慎使用Volume一词,以确保获得完整的使用上下文。

Your intention, as far as detectable from your post, is to obtain an OrderBook LEVEL-2 aka Depth-Of-Market . 从您的帖子中可以检测到的最大目的是获取OrderBook LEVEL-2,也就是市场深度

While this is possible, this will require more efforts to assemble, than just a one-liner in MQL4 code. 尽管这是可能的,但与MQL4代码中的单行代码相比,这将需要更多的组装工作。


Third, let's go get the job done 第三,让我们完成工作

May be, your Broker has an API-service ready for you to collect & process the L2 DoM. 可能是,您的经纪人已准备好API服务,供您收集和处理L2 DoM。

  • If not, go and ask them to open it for you. 如果不是,请让他们为您打开。

If not, 如果不,

  • change the Broker to such one, who will. 将经纪人更改为这样的经纪人,谁愿意。

There are other sources to build & maintaing L2 DoM, but the relevance for your Trade-Execution-Venue is to be verified, as some could make your strategy crippled via a MarketMaking role, once trading against your model. 还有其他来源可用于构建和维护L2 DoM,但是您的交易执行场所的相关性尚待验证,因为一旦与模型进行交易,某些交易可能会使您的策略因做市商角色而瘫痪。

Your Broker-"local" L2 DoM rulez. 您的经纪人-“本地” L2 DoM Rulez。 Always. 总是。 Not worth the losses to test the contrary. 不值得的损失来检验相反的情况。

If getting ready for this task, be ready to operate on ultra low latency architecture, as sub-milisecond cadencies in L2 DoM evolution dynamics are not uncommon. 如果准备好执行此任务,请准备在超低延迟的体系结构上运行,因为L2 DoM演进动态中的亚毫秒级节奏并不罕见。

Once "on the road", you will soon notice, that MQL4 has a timer resolution above 1 msec. 一旦“上路”,您很快就会注意到,MQL4的计时器分辨率高于 1毫秒。

被动TAMARA嗅探器读取您的Broker到达时间(毫秒),以了解硬实时系统操作模式的最快与典型TimeDOMAIN对齐

Thus your computational strategy to query+gather+sanitize+process+publish+use your own local L2 DoM mapping has a trouble right from the start ( not speaking about your principal skew of the map due to end-to-end transport latency ). 因此,您用于查询,收集,清理,处理,发布,使用您自己的本地L2 DoM映射的计算策略从一开始就存在麻烦(更不用说由于端到端传输延迟而导致的地图主偏斜)。

( Kindly also do bear in mind, that MQL4 has just a few threads, that are absolutely out of your control. Thus a carefull multi-processing design has to be designed, so as to operate in a non-blocking near-RealTime mode. Having integrated systems alike this, your Project is indeed quite thrilling to achieve the goal, believe me :o) (同样要记住,MQL4只有几个线程,这绝对是您无法控制的。因此,必须设计仔细的多处理设计,以便在非阻塞的近实时模式下运行。有了类似的集成系统,相信您的项目确实非常激动人心,可以实现目标,相信我:o)

主动SONAR回声响应延迟端到端(毫秒)-阅读``终端''屏幕上的详细信息

)

Worth doing the job right nevertheless. 尽管如此,还是值得做这份工作。

There are two volume types. 有两种卷类型。 One is iVolume and then there is iOBV or on balance volume. 一个是iVolume,然后是iOBV或平衡体积。

Here is the volume document: 这是卷文件:

http://docs.mql4.com/series/ivolume http://docs.mql4.com/series/ivolume

On balance volume is nice for targeting the mean volume based on your symbol for a duration of time. 平衡交易量很适合根据您的交易品种在一段时间内确定平均交易量。 Having a long term obv can generate a trend. 长期观察会产生趋势。

Here is obv: 这是obv:

http://docs.mql4.com/indicators/iobv http://docs.mql4.com/indicators/iobv

Now about volume. 现在关于音量。 There is no way determine 'pending' volume it is always a historical indicator. 无法确定“待定”数量始终是历史指标。

If you have a guy who has 10 ltc and wants to sell for 7.50 and someone wanting to buy 10 for 7.49 and there is no order change you have no volume as one waits the other out and who knows how long it takes. 如果您有一个拥有10 ltc的人并想以7.50的价格出售,而某个人想以7.49的价格购买10,并且没有订单更改,那么您就没有交易量,因为一个人等待另一人,并且谁知道需要多长时间。

With that said you might want to look at open interest on the buy and sell side and possibly extrapolate the potential. 说了这么多,您可能想看看买卖双方的未平仓合约,并可能推断其潜力。

Last point. 最后一点。 LTC and BTC are very difficult to peg trends. LTC和BTC很难把握趋势。 I have looked at the technicals and all I can say is that stocks look like a tame kitten compared to LTC OR BTC. 我已经看过技术面,我只能说与LTC或BTC相比,股票看起来像一只驯服的小猫。

Finally. 最后。 I bet you didn't know that Stack Exchange has a bitcoin site. 我敢打赌,您不知道Stack Exchange拥有一个比特币网站。 I bet this question would get more airplay over there. 我敢打赌,这个问题会在那儿获得更多收益。 http://bitcoin.stackexchange.com http://bitcoin.stackexchange.com

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 CoinGecko C# API 获取硬币的市值? - How to get market cap of a coin using the CoinGecko C# API? 如何使用虚拟IP在21市场上托管我的比特币API? - How can I host my Bitcoin API on the 21 market with a Virtual IP? 有没有办法使用币安 API 获得硬币的市值或市值排名? - Is there a way to get the market cap or market cap rank of a coin using the Binance API? 如何在精确时间在 Python 中获取 Binance API 价格? - How do I get Binance API prices in Python at a precise time? 我如何获得 Blockcypher API 中的总钱包余额? - How do I get the total Wallet Balance in Blockcypher API? 如何使用比特币中的套接字编程从比特币节点获取 getaddr 的响应? - How do I get the response of getaddr from a bitcoin node using socket programming in Bitcoin? 挖矿节点如何获得相同的目标? - How do mining nodes get the same target? 我如何测试比特币警报消息? - How do I test the Bitcoin alert message? 我正在尝试将JSON格式的API数据获取到我的网站。 如何获取所需的信息并将其发送到html页面中的div? - I am trying to get API data in JSON format to my website. How can I take the required info and send it to a div in the html page? 如何使用javascript与cryptsy建立基本的Pusher连接? - how do I do a basic pusher connection to cryptsy using javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM