English

## platform mt4 "crash" after I put my code ?? Oo

 209 thrdel 2014.03.10 08:40 #   GumRai: Well, I was just adjusting the OP's code, apart from that old habits die hard :) To be honest, I've only just learnt how to use the new arrays. Before I was trying &high[index] and I now know that they need to be set as series if one wants to use them in the way that we are used to. There seems so much new stuff that it will take some time to change. I do try to use the SymbolInfo stuff instead of Market info as that looks pretty good. Hope you didn't mind my question, wasn't picking on anyone, just saying, you know. On the other hand, you seem pretty god with array out of range kind of thing and I have one that gives me trouble. Would you look at it please ? Here is one working in an indicator similar to OPs : ```   if(prev_calculated<=0)      {       for(i=0; i
 Moderator3502 GumRai 2014.03.10 11:24 #   thrdel: ```   if(prev_calculated<=0)      {       //--- Step 1, calculate average for bars 1-20       for(i=0; i
 209 thrdel 2014.03.11 00:39 #   GumRai: Well, I don't know what the value of CumulantPeriod is. Is it negative? What about the array Average, is it a dynamic array? You don't re-size it. Is it also set as series? Your comment suggests that you want to store the last 20 average prices in your array, so it is quite possible that you declared your array if so, is it possible that can be more than 20? If this doesn't answer your question, you will probably have to show more of the code. Thanks GumRai, I've fixed it. My mistake was to define the arrays before OnInit() ```input int CumulantPeriod=20; double sum=0; double CumulantBuffer[]; double CumulantBuffer2[]; //--- Calculation Buffers double Average[],Close_Average[],CloseZero_Close[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function                         | //+------------------------------------------------------------------+ int OnInit()``` instead of inside OnCalculate() and not used SetIndexBuffer() for them. MT4 looked at them as buffers, normally. Quite silly, isn't it. Thanks a bunch anyway.