量化軟件下載:赫茲股票期貨量化軟件訪問 web 上的數(shù)據(jù)
通過智能交易系統(tǒng)訪問互聯(lián)網(wǎng)數(shù)據(jù)
這是在該系統(tǒng)中實現(xiàn)的最有趣的部分。 盡管這是一件簡單的事情,但如果規(guī)化不當,它也會變成迄今為止最危險的。 危險在于它會令 EA 等待服務器的響應,哪怕只是片刻。
我們來看看 EA 如何與包含我們所需捕獲信息的 web 服務器直接交互。 下面您可以看到一個完整的代碼示例,其工作原理與此完全相同。
#property copyright "Daniel Jose" #property version "1.00" //+------------------------------------------------------------------+ int OnInit() { ? ? ? ?EventSetTimer(1); ? ? ? ? ? ? ? ?return INIT_SUCCEEDED; } //+------------------------------------------------------------------+ void OnDeinit(const int reason) { ? ? ? ?EventKillTimer(); } //+------------------------------------------------------------------+ void OnTick() { } //+------------------------------------------------------------------+ void OnTimer() { ? ? ? ?Print(GetDataURL("https://tradingeconomics.com/stocks", 100, "<!doctype html>", 2, "INDU:IND", 172783, 173474, 0x0D)); } //+------------------------------------------------------------------+ string GetDataURL(const string url, const int timeout, const string szTest, int iTest, const string szFind, int iPos, int iInfo, char cLimit) {