有没有人有自动计算和提取带有附加字符的符号的符号后缀的方法?
例:
插入的代码字符串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函数
在MarketWatch中找到更重复的后缀的标准是什么?在这种情况下,程序应该从MarketWATCH获取对名称,并逐个检查。你的代码,上面,解决问题?Originally Posted by ;
是的,这是标准。它已经做到了,但我不想只是市场观察的符号,我想评估所有经纪人提供的符号。该脚本完全按照我的需要工作。无论如何,欢迎您使用或修改它。Originally Posted by ;