Прошу помощи - разобраться в ошибке запуска и тестирования советника

 

Всем добрый день.

Есть советник. Из mq5 прекрасно компилируется, без ошибок. Но:

1. Не прикрепляется к графику, на который заточен (EURJPY 1H) - точнее по логу вот так

2017.11.30 19:37:15.434 Experts initializing of strat eurjpy (EURJPY,H1) failed

2017.11.30 19:37:15.450 Experts expert strat eurjpy (EURJPY,H1) removed

2. При попытке запустить его в тесте вываливается ошибка (в конце лога):

2017.11.30 19:38:45.786 Tester EURUSD: history data begins from 1978.10.06 00:00

2017.11.30 19:38:46.200 Tester USDJPY: history data begins from 1971.01.04 00:00

2017.11.30 19:38:46.203 Core 1 agent process started

2017.11.30 19:38:47.226 Core 1 connecting to 127.0.0.1:3000

2017.11.30 19:38:47.227 Core 1 connected

2017.11.30 19:38:47.250 Core 1 authorized (agent build 1643)

2017.11.30 19:38:47.256 Tester EURJPY,H1 (AlfaForex-Real): testing of Experts\strat eurjpy.ex5 from 2017.11.01 00:00 to 2017.11.29 00:00

2017.11.30 19:38:47.323 Core 1 common synchronization completed

2017.11.30 19:38:48.171 Tester quality of analyzed history is 100%

2017.11.30 19:38:48.251 Core 1 MetaTester 5 started on 127.0.0.1:3000

2017.11.30 19:38:48.251 Core 1 initialization finished

2017.11.30 19:38:48.251 Core 1 login (build 1643)

2017.11.30 19:38:48.251 Core 1 38520 bytes of account info loaded

2017.11.30 19:38:48.251 Core 1 1482 bytes of tester parameters loaded

2017.11.30 19:38:48.251 Core 1 35004 bytes of input parameters loaded

2017.11.30 19:38:48.251 Core 1 556 bytes of symbols list loaded

2017.11.30 19:38:48.251 Core 1 expert file added: Experts\strat eurjpy.ex5. 579126 bytes loaded

2017.11.30 19:38:48.251 Core 1 initial deposit 200.00 USD, leverage 1:100

2017.11.30 19:38:48.251 Core 1 successfully initialized

2017.11.30 19:38:48.251 Core 1 571 Kb of total initialization data received

2017.11.30 19:38:48.251 Core 1 QEMU Virtual  version (cpu64-rhel6), 2047 MB

2017.11.30 19:38:48.251 Core 1 EURJPY: symbol to be synchronized

2017.11.30 19:38:48.251 Core 1 EURJPY: symbol synchronized, 3464 bytes of symbol info received

2017.11.30 19:38:48.251 Core 1 EURJPY: load 27 bytes of history data to synchronize in 0:00:00.000

2017.11.30 19:38:48.251 Core 1 EURJPY: history synchronized from 2016.01.04 to 2017.11.29

2017.11.30 19:38:48.251 Core 1 EURJPY,H1: history cache allocated for 11965 bars and contains 11395 bars from 2016.01.04 00:00 to 2017.10.31 23:00

2017.11.30 19:38:48.251 Core 1 EURJPY,H1: history begins from 2016.01.04 00:00

2017.11.30 19:38:48.251 Core 1 EURJPY,H1 (AlfaForex-Real): OHLC bar states generating. OnTick executed on the bar begin only

2017.11.30 19:38:48.251 Core 1 EURJPY,H1: testing of Experts\strat eurjpy.ex5 from 2017.11.01 00:00 to 2017.11.29 00:00 started with inputs:

2017.11.30 19:38:48.251 Core 1   StrategyProperties__=------------

2017.11.30 19:38:48.251 Core 1   Entry_Amount=0.01

2017.11.30 19:38:48.251 Core 1   Maximum_Amount=0.03

2017.11.30 19:38:48.251 Core 1   Adding_Amount=0.01

2017.11.30 19:38:48.251 Core 1   Reducing_Amount=0.01

2017.11.30 19:38:48.251 Core 1   Stop_Loss=1645

2017.11.30 19:38:48.251 Core 1   Take_Profit=2585

2017.11.30 19:38:48.251 Core 1   Break_Even=3000

2017.11.30 19:38:48.251 Core 1   Martingale_Multiplier=0

2017.11.30 19:38:48.251 Core 1   IndicatorName1=Bollinger Bands

2017.11.30 19:38:48.251 Core 1   Slot1IndParam0=67

2017.11.30 19:38:48.251 Core 1   Slot1IndParam1=1.5

2017.11.30 19:38:48.251 Core 1   IndicatorName2=Oscillator of CCI

2017.11.30 19:38:48.251 Core 1   Slot2IndParam0=34

2017.11.30 19:38:48.251 Core 1   Slot2IndParam1=20

2017.11.30 19:38:48.251 Core 1   IndicatorName3=Doji

2017.11.30 19:38:48.251 Core 1   Slot3IndParam0=87

2017.11.30 19:38:48.251 Core 1   IndicatorName4=Percent Change

2017.11.30 19:38:48.251 Core 1   Slot4IndParam0=140

2017.11.30 19:38:48.251 Core 1   Slot4IndParam1=0

2017.11.30 19:38:48.251 Core 1   IndicatorName5=Bollinger Bands

2017.11.30 19:38:48.251 Core 1   Slot5IndParam0=101

2017.11.30 19:38:48.251 Core 1   Slot5IndParam1=4.17

2017.11.30 19:38:48.251 Core 1   IndicatorName6=ROC MA Oscillator

2017.11.30 19:38:48.251 Core 1   Slot6IndParam0=90

2017.11.30 19:38:48.251 Core 1   Slot6IndParam1=33

2017.11.30 19:38:48.251 Core 1   IndicatorName7=LSMA_Channel v2

2017.11.30 19:38:48.251 Core 1   Slot7IndParam0=178

2017.11.30 19:38:48.251 Core 1   Slot7IndParam1=4.7

2017.11.30 19:38:48.251 Core 1   IndicatorName8=Average True Range

2017.11.30 19:38:48.251 Core 1   Slot8IndParam0=58

2017.11.30 19:38:48.251 Core 1   Slot8IndParam1=87

2017.11.30 19:38:48.251 Core 1   IndicatorName10=CCI MA Oscillator

2017.11.30 19:38:48.251 Core 1   Slot10IndParam0=1

2017.11.30 19:38:48.251 Core 1   Slot10IndParam1=17

2017.11.30 19:38:48.251 Core 1   IndicatorName11=Accelerator Oscillator

2017.11.30 19:38:48.251 Core 1   Slot11IndParam0=15

2017.11.30 19:38:48.251 Core 1   Slot11IndParam1=63

2017.11.30 19:38:48.251 Core 1   Slot11IndParam2=28

2017.11.30 19:38:48.251 Core 1   Slot11IndParam3=0

2017.11.30 19:38:48.251 Core 1   IndicatorName12=MACD

2017.11.30 19:38:48.251 Core 1   Slot12IndParam0=130

2017.11.30 19:38:48.251 Core 1   Slot12IndParam1=172

2017.11.30 19:38:48.251 Core 1   Slot12IndParam2=14

2017.11.30 19:38:48.251 Core 1   IndicatorName13=RSI MA Oscillator

2017.11.30 19:38:48.251 Core 1   Slot13IndParam0=76

2017.11.30 19:38:48.251 Core 1   Slot13IndParam1=169

2017.11.30 19:38:48.251 Core 1   IndicatorName14=Awesome Oscillator

2017.11.30 19:38:48.251 Core 1   Slot14IndParam0=51

2017.11.30 19:38:48.251 Core 1   Slot14IndParam1=13

2017.11.30 19:38:48.251 Core 1   Slot14IndParam3=0

2017.11.30 19:38:48.251 Core 1   IndicatorName15=Moving Averages Crossover

2017.11.30 19:38:48.251 Core 1   Slot15IndParam0=78

2017.11.30 19:38:48.251 Core 1   Slot15IndParam1=122

2017.11.30 19:38:48.251 Core 1   Slot15IndParam2=36

2017.11.30 19:38:48.251 Core 1   Slot15IndParam3=74

2017.11.30 19:38:48.251 Core 1   IndicatorName16=Cumulative Sum

2017.11.30 19:38:48.251 Core 1   Slot16IndParam0=175

2017.11.30 19:38:48.251 Core 1   Slot16IndParam1=140

2017.11.30 19:38:48.251 Core 1   IndicatorName17=Price Action Indicator Oscillator

2017.11.30 19:38:48.251 Core 1   Slot17IndParam0=58

2017.11.30 19:38:48.251 Core 1   Slot17IndParam1=-0.02

2017.11.30 19:38:48.251 Core 1   ExpertSettings__=------------

2017.11.30 19:38:48.251 Core 1   Protection_Min_Account=0

2017.11.30 19:38:48.251 Core 1   Protection_Max_StopLoss=0

2017.11.30 19:38:48.251 Core 1   Bar_Close_Advance=15

2017.11.30 19:38:48.251 Core 1   Write_Log_File=false

2017.11.30 19:38:48.251 Core 1   Order_Comment=

2017.11.30 19:38:48.251 Core 1 2017.11.01 00:00:00   strat eurjpy loaded.

2017.11.30 19:38:48.251 Core 1 2017.11.01 00:00:00   Loading data: EURJPY,H1, Minumum bars: 199...

2017.11.30 19:38:48.251 Core 1 USDJPY: symbol to be synchronized

2017.11.30 19:38:48.251 Core 1 USDJPY: symbol synchronized, 3544 bytes of symbol info received

2017.11.30 19:38:48.251 Core 1 USDJPY: load 27 bytes of history data to synchronize in 0:00:00.016

2017.11.30 19:38:48.251 Core 1 USDJPY: history synchronized from 2016.01.04 to 2017.11.29

2017.11.30 19:38:48.251 Core 1 EURUSD: symbol to be synchronized

2017.11.30 19:38:48.251 Core 1 EURUSD: symbol synchronized, 3544 bytes of symbol info received

2017.11.30 19:38:48.251 Core 1 EURUSD: load 27 bytes of history data to synchronize in 0:00:00.016

2017.11.30 19:38:48.251 Core 1 EURUSD: history synchronized from 2016.01.04 to 2017.11.29

2017.11.30 19:38:48.251 Core 1 2017.11.01 00:00:00   array out of range in 'strat eurjpy.mq5' (1750,24)

2017.11.30 19:38:48.251 Core 1 OnInit critical error

2017.11.30 19:38:48.251 Core 1 log file "C:\Users\Administrator\AppData\Roaming\MetaQuotes\Tester\0DBF5ABC9E39467AFBC39531DE254559\Agent-127.0.0.1-3000\logs\20171130.log" written

2017.11.30 19:38:48.276 Core 1 connection closed


Уже день пытаюсь разобраться и найти похожие ситуации, чтобы определить способ решения - но видимо не судьба.

Если есть у кого догадки, что можно докрутить - буду признателен.

Заранее спасибо.


Файлы:
strat_eurjpy.mq5  359 kb
 
2017.11.30 19:38:48.251 Core 1  2017.11.01 00:00:00   array out of range in 'strat eurjpy.mq5' (1750,24)

Выход за пределы массива.

 

Ошибка где-то здесь:

int OnInit()
  {
...

   int result=actionTrade.OnInit();

...
  }
 
Vladimir Karputov:

Ошибка где-то здесь:


Предположу, исходя из вашей ссылки, что дело в 

"попытка обратиться к данным индикаторного буфера, когда его размер еще не инициализирован"

 
Viacheslav Karavaev:

Предположу, исходя из вашей ссылки, что дело в 

"попытка обратиться к данным индикаторного буфера, когда его размер еще не инициализирован"

В точку. Ставьте точки останова и постепенно продвигайтесь вперёд, пока не найдёте массив при обращении к индексам которого происходит ошибка.

 
Vladimir Karputov:
В точку. Ставьте точки останова и постепенно продвигайтесь вперёд, пока не найдёте массив при обращении к индексам которого происходит ошибка.


Спасибо. Попробую этот баг отловить.

 

Судя по отладке самый главный косяк скрывается где-то здесь - конкретно при работе с индикатором OscillatorLogic

Самое интересное, что у меня есть советник на другую пару и там с тем же кодом всё работает... мистика какая-то

void Indicator::OscillatorLogic(int firstBar,int previous,const double &adIndValue[],double levelLong,
                                double levelShort,IndicatorComp &indCompLong,IndicatorComp &indCompShort,
                                IndicatorLogic indLogic)

  {
   double sigma=Sigma();
   firstBar=MathMax(firstBar,2);

   for(int bar=0; bar<firstBar; bar++)
     {
      indCompLong.Value[bar]=0;
      indCompShort.Value[bar]=0;
     }
 

А может это быть связано с тем, что я на разных графиках пытаюсь задействовать 2 разных советника с похожим кодом (используют одни и теже индикаторы) и первый советник, начав работать с индикатором, не даёт это сделать второму корректно.

Если это так - то как как можно их развести, чтобы они использовали разные копии одного и того же индикатора одновременно.

Причина обращения: