发布之前,请阅读其他一些主题。 。 。那么您会看到很多这样的请求:
请使用它来发布代码。 。 。它使阅读更容易。
在这里RaptorUK ...
// + ----------------------------------------------- ------------------- + //| Test 2.mq4 | //| MetaQuotes Software Corp.版权所有2012。 | //| http://www.metaquotes.net | // + ----------------------------------------------- ------------------- + #property版权 "MetaQuotes Software Corp.版权所有2012。" #property link "http://www.metaquotes.net" // + ----------------------------------------------- ------------------- + //| script program start function | // + ----------------------------------------------- ------------------- + int start() { // ---- int Array_A[10] = {5, 7, 3, 1, 2, 6, 9, 8, 10, 4} ; int Array_B[15] = {2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15} ; int c1[10] ; int handle = FileOpen("C1.csv", FILE_CSV|FILE_WRITE, ","); if(handle>0) { for(int j=0; j<10; j++) { c1[j]=ArrayBsearch(Array_B,Array_A[j],WHOLE_ARRAY,0,MODE_ASCEND); FileWrite(handle, c1[j]) ; } } FileClose(handle); //--- return(0); } // + ----------------------------------------------- ------------------- +
你是什么意思"不返回正确的值。"。 ArrayBsearch返回是搜索到的数组的索引。我检查,这是正确的。
这是你要找的吗
c1[j]= Array_B [ArrayBsearch(Array_B,Array_A[j],WHOLE_ARRAY,0,MODE_ASCEND)];
Here is my script code. It 不返回正确的值。
int Array_B [15] = {2,4,6,8,10,12,14,1,1,3,5,7,9,11,13,15};
c1 [j] = ArrayBsearch(Array_B,Array_A [j],WHOLE_ARRAY,0,MODE_ASCEND);
当然不是。 Array_B是 未排序。实时FM
在这里RaptorUK ...
你是什么意思"不返回正确的值。"。 ArrayBsearch返回是搜索到的数组的索引。我检查,这是正确的。
这是你要找的吗
我尝试过,但仍然无法给我正确的结果。
结果应该是
9
10
8
7
0...
我没有得到这些结果...
在这里RaptorUK ...
你是什么意思"不返回正确的值。"。 ArrayBsearch返回是搜索到的数组的索引。我检查,这是正确的。
这是你要找的吗
弄清楚我要做什么。我需要在Array_A中找到每个值的索引值。
我尝试过,但仍然无法给我正确的结果。
结果应该是
9
10
8
7
0...
我没有得到这些结果...
重新在版本409和419 Vista HB上运行。结果:9-10-8-0-0-9-11-10-11-8。您期望结果应该是:9-10-8-7-0-2-2-11-3-4-1 ?,因为如果是这样,那么我应该删除我之前的评论,现在我也不太明白,这很好,因为我不必回答问题:)
认为我们发现了错误:(
Here is my script code. It 不返回正确的值。
// + ----------------------------------------------- ------------------- +
// |测试2.mq4 |
// | MetaQuotes软件公司版权所有©2012。
//| http://www.metaquotes.net |
// + ----------------------------------------------- ------------------- +
#property版权 "MetaQuotes Software Corp.版权所有2012。"
#property link "http://www.metaquotes.net"
// + ----------------------------------------------- ------------------- +
// |脚本程序启动功能|
// + ----------------------------------------------- ------------------- +
int start()
{
// ----
int Array_A [10] = {5,7,3,1,2,6,6,9,8,10,4};
int Array_B [15] = {2,4,6,8,10,12,14,1,1,3,5,7,9,11,13,15};
int c1 [10];
整数句柄= FileOpen("C1.csv",FILE_CSV | FILE_WRITE,",");
如果(处理>0)
{
for(int j = 0; j<10; j++)
{
c1 [j] = ArrayBsearch(Array_B,Array_A [j],WHOLE_ARRAY,0,MODE_ASCEND);
FileWrite(handle,c1 [j]);
}
}
FileClose(handle);
// ----
返回(0);
}
// + ----------------------------------------------- ------------------- +