有沒有人有自動計算和提取帶有附加字符的符號的符號後綴的方法?
例:
插入的代碼字符串ecn_suffix = AutoSuffixFinder();
使用下面的代碼,您將在對符號後提取所有內容...示例EURUSDecn ... ecn是提取的部分。插入的代碼字符串sub = StringSubstr(_Symbol,6,0)
如果你知道你正在使用正確的符號,這是有效的,但我的問題是我正在使用拉入同一程序的多個符號,而我的經紀人為同一對顯示3個不同的符號,例如GBPUSD,GBPUSD_和GBPUSDx。我知道當我看市場觀察時,GBPUSD_是我想要使用的符號,因為(_)後綴代表超過50%的可用符號。我還想評估貨幣符號的第7個字符,而不是差價合約。以下是我提出的插入代碼#property copyright nicholishen #property link www.reddit.com/u/nicholishenFX #property version 1.00 #property strict #include lt; Arrays \ ArrayObj.mqhgt; class Suffix:public CObject {public:string suffix; int count;後綴(string suff):suffix(suff),count(1){} int Compare(const CObject * node,const int mode = 0)const {Suffix * that =(Suffix *)node; if(this.count gt; that.count)返回-1;否則if(this.count lt; that.count)返回1;否則返回0; }}; class SuffixList:public CArrayObj {public:Suffix * operator#91;#93;(const int i)const {return(Suffix *)At(i);} void Add(string suffix){for(int i = 0; ilt ; Total(); i ){if(this#91; i#93; .suffix == suffix){this#91; i#93; .count ;返回; CArrayObj :: Add(new Suffix(suffix)); }};/ ----------------------------------------------- ------------------- /|腳本程序啟動功能|/ ----------------------------------------------- ------------------- void OnStart(){//--- string res = AssumedSuffix(); res = res == NULL?NULL:res;打印(假設後綴為(,res,)); }/ ---------------------------------------------- -------------------- string AssumedSuffix(){SuffixList list; int total = SymbolsTotal(false); for(int i = 0; ilt; total; i ){string chart_name = SymbolName(i,false); if(StringLen(chart_name)== 7){bool con = true; for(int j = 0; jlt; 6; j ){if(!IsChar(StringSubstr(chart_name,j,1))){con = false;打破; if(con){string sub_string = StringSubstr(chart_name,6,1); list.Add(SUB_STRING); if(list.Total()gt; 0){list.Sort();返回列表#91; 0#93; .suffix; } return NULL; } bool IsChar(string c){string allowed = ABCDEFGHIJKLMNOPQRSTUVWXYZ; return StringFind(allowed,c)gt; = 0; }Originally Posted by ;
為什麼要恭維?一個解決方案:我認為你有更好的,從一開始,首先強制更改圖表符號然後應用,expertscriptindic以及所需的後綴ChartSetSymbolPeriod函數
1附件例如,如果它是GBPUSDx,它將被強制更改為GBPUSD_現在,即使你沒有放下正確的符號,你的程序也會將圖表符號改為右符號。道歉,如果我不明白你的意思。
在MarketWatch中找到更重複的後綴的標準是什麼?在這種情況下,程序應該從MarketWATCH獲取對名稱,並逐個檢查。你的代碼,上面,解決問題?Originally Posted by ;
是的,這是標準。它已經做到了,但我不想只是市場觀察的符號,我想評估所有經紀人提供的符號。該腳本完全按照我的需要工作。無論如何,歡迎您使用或修改它。Originally Posted by ;