编码帮助 - 页 701

 
AtApi:

大家好,代码大师们。

我在寻找一个简单的指标,从CSV文件中绘制自己的数值。谁能帮帮我?

谢谢。

"其自身价值 "是什么意思?
 
mladen:
"它自己的值 "是什么意思?

谢谢mladen。

让我解释一下:我需要一个指标,从CVS文件中读取并在一个子窗口中绘制数值,CVS中有两个逗号分隔的数值,第一个数值是日期,第二个是指标应该绘制的实际数值。

例如

CVS看起来像这样。

date,value
2016.10.26.05.55,126.845
2016.10.26.05.50,126.848
2016.10.26.05.45,126.844
2016.10.26.05.40,126.82
2016.10.26.05.35,126.816
2016.10.26.05.30,126.81

指示器将根据日期绘制相应的值

我希望它现在更清楚一些。

谢谢你的帮助,朋友

 

亲爱的朋友。

我需要编码。

蜡烛收盘后,如果蜡烛是向上的,则提醒向上,蜡烛是向下的,则提醒向下 ,任何时间段都可以。

如果你有,请分享给我。

谢谢你的支持。

- 洁星

 
AtApi:

谢谢mladen。

让我解释一下:我需要一个指标,从CVS文件中读取并在一个子窗口中绘制数值,CVS有两个逗号分隔的数值,第一个数值是日期,第二个是指标应该绘制的实际数值。

例如

CVS看起来像这样。

时间,数值

2016.10.26.21.20,127.765

2016.10.26.21.15,127.777

2016.10.26.21.10,127.777

2016.10.26.21.05,127.799

2016.10.26.21.00,127.791

2016.10.26.20.55,127.788

该指标将根据日期绘制相应的数值

我希望现在能更清楚一点。

谢谢你的帮助,朋友!

到目前为止,我已经完成了这个工作。

extern   string   FileName    = "AUDCAD.CSV";
datetime   dt[9999];
double     val[9999];

string     arr[2];    

int h = FileOpen(FileName, FILE_CSV|FILE_READ,'~');
  if (h==0)   Comment("File "+FileName+" not found.");

  
  for (int c=0; !FileIsEnding(h) && c<9999; c++)  {

  
    string tmp = FileReadString(h);
    if (FileIsEnding(h))  break;
    StrToStringArray(tmp,arr,",");
    dt[c]  = StrToTime(arr[0]);  // <==== This should convert the date value (in the format of "yyyy.mm.dd hh:mi") to datatime type and assign it to the array
    val[c] = StrToNumber(arr[1]); // <==== This will assign the value to the array
   

  }
  FileClose(h);

//+------------------------------------------------------------------+
void StrToStringArray(string str, string &a[], string delim=",")  {
//+------------------------------------------------------------------+
  int z1=-1, z2=0;
  for (int i=0; i<ArraySize(a); i++)  {
    z2 = StringFind(str,delim,z1+1);
    a[i] = StringSubstr(str,z1+1,z2-z1-1);
    if (z2 >= StringLen(str)-1)   break;
    z1 = z2;
    
  }
}
//+------------------------------------------------------------------+
double StrToNumber(string str)  {
//+------------------------------------------------------------------+
// Usage: strips all non-numeric characters out of a string
  int    dp   = -1;
  int    sgn  = 1;
  double num  = 0.0;
  for (int i=0; i<StringLen(str); i++)  {
    string s = StringSubstr(str,i,1);
    if (s == "-")  sgn = -sgn;   else
    if (s == ".")  dp = 0;       else
    if (s >= "0" && s <= "9")  {
      if (dp >= 0)  dp++;
      if (dp > 0)
        num = num + StrToInteger(s) / MathPow(10,dp);
      else
        num = num * 10 + StrToInteger(s);
    }
  }
  return(num*sgn);
}
我不知道为什么如果我打印dt[c],它总是返回相同的值......就像时间从未改变,即使arr[0]在循环的每个迭代中改变
在这之后,我们应该把数值分配给那个时间的条形图......但我卡住了。

	          
 
AtApi:
AtApi:

谢谢mladen。

让我解释一下:我需要一个指标,从CVS文件中读取并在一个子窗口中绘制数值,CVS中有两个逗号分隔的数值,第一个数值是日期,第二个是指标应该绘制的实际数值。

例如

CVS看起来像这样。

时间,数值

2016.10.26.21.20,127.765

2016.10.26.21.15,127.777

2016.10.26.21.10,127.777

2016.10.26.21.05,127.799

2016.10.26.21.00,127.791

2016.10.26.20.55,127.788

该指标将根据日期绘制相应的数值

我希望现在能更清楚一点。

谢谢你的帮助,朋友!

到目前为止,我已经完成了这些。

Nevermind I have solved the problem....the SrtToTime only accept string with this format: "yyyy.mm.dd hh:mi" that means that I was loading a CSV with this format instead "yyyy.mm.dd hh.mi" and obviously was giving me an error. Anyway I solved!
 

你好

Mr mladen:

可以为新的MT4版本更新一下吗?

请注意

附加的文件:
 

请谁能帮我解决这3个问题

1.修复尾部错误

2.删除 第二个时间段的过滤器,系统将在30分钟的聊天中运行

3.添加附件中的指标作为1D聊天的过滤器

 

@亲爱的朋友们。

我的EA出现了以下错误,。

"EURUSD+,M5: OrderDelete功能 的未知票21847676"

这句话是什么意思?问题是什么,我可以做什么?

 
oguz:

@亲爱的朋友们。

我的EA出现了以下问题。

"EURUSD+,M5: StringConcatenate(function)的未知票21847676"

这句话是什么意思?是什么问题?

我可以做什么?

这意味着它找不到一个可以删除的21847676 号票据的订单。

要么:

  • 票据号码是错误的
  • 或者该订单已经被删除了(两个EA,或者循环没有正确检查,或者任何类似的情况......)
 

你好,Mladen先生

你能不能帮助把这个指标放在MTF的单独 图表上,类似于这张图

注意

附加的文件:
xb4d_2.mq4  4 kb