我正在尝试复制stochastic
变量中的函数缓冲区。但我看到的是蜡烛按降序复制到数组中。
double KArray[],DArray[];
ArraySetAsSeries(KArray,true);
ArraySetAsSeries(DArray,true);
int stochastic_output = iStochastic(_Symbol,PERIOD_M1,5,3,3,MODE_SMA,STO_LOWHIGH);
CopyBuffer(stochastic_output,0,0,15,KArray);
CopyBuffer(stochastic_output,1,0,15,DArray);
for (int i=0;i < Candles_backtest_Stochastic_quantity;i++)
{
PrintFormat("K %d: %f",i,KArray[i]);
PrintFormat("D %d: %f",i,DArray[i]);
}
这很好用,在打印数组值时,我得到了0th
当前值和之前的值。
2018.03.22 18:07:23.622 2018.02.01 00:00:00 K 0: 57.291667
2018.03.22 18:07:23.622 2018.02.01 00:00:00 D 0: 63.194444
2018.03.22 18:07:23.622 2018.02.01 00:00:00 K 1: 61.458333
2018.03.22 18:07:23.622 2018.02.01 00:00:00 D 1: 68.754756
2018.03.22 18:07:23.622 2018.02.01 00:00:00 K 2: 70.833333
2018.03.22 18:07:23.622 2018.02.01 00:00:00 D 2: 69.294286
2018.03.22 18:07:23.622 2018.02.01 00:00:00 K 3: 73.972603
2018.03.22 18:07:23.622 2018.02.01 00:00:00 D 3: 57.177428
2018.03.22 18:07:23.622 2018.02.01 00:00:00 K 4: 63.076923
等等。
但我想要一个反转数组,即14th
数组元素必须是0th
并且0th
必须是14th
数组的元素。
我试图使CopyBuffer()
语句反转缓冲区,但出现错误,请参见示例:
2018.03.22 18:11:11.957 Total_back_lagANDvantage_required=3
2018.03.22 18:11:12.073 2018.02.01 00:00:00 K 0: 78.260870
2018.03.22 18:11:12.073 2018.02.01 00:00:00 D 0: 72.579331
2018.03.22 18:11:12.073 2018.02.01 00:00:00 array out of range in 'adxSTUDY.mq5' (173,33)
2018.03.22 18:11:12.073 OnTick critical error
2018.03.22 18:11:12.087 EURUSD,M1: 1 ticks, 1 bars generated. Environment synchronized in 0:00:00.312. Test passed in 0:00:00.594 (including ticks preprocessing 0:00:00.016).
2018.03.22 18:11:12.087 EURUSD,M1: total time from login to stop testing 0:00:00.906 (including 0:00:00.312 for history data synchronization)
请帮助我。我不想有另一个缓冲区来复制数组并反转它,有没有办法可以反转数组并使用它?