Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1039

 
nikelodeon: Every day I have the beginning of the chart missing,

Service -> Settings -> History Max Bar and Max BarGraphs in Window

Now the speed. Most indicators handle only one, last bar on each tick. Or 2 when a new bar appears. But there are indicators that calculate many or even all bars on every tick due to programming errors or due to a specific algorithm. First, we need to identify them. This can be done using the Task Manager, by determining the CPU load. Or, more precisely, you can insert into the indicator something like

  if(XXX>1)Alert("Пересчитываем=",XXX,"   Bars=",Bars);
где XXX - количество пересчитывемых баров. При запуске будет много, затем на каждый новый бар 2

It is unlikely that the indicator should recalculate all the bars. We should check 1) what this indicator returns by the operator return 2) the number of recalculated bars in the indicator code. 3) Max bars in the window 4) The indicators, called by the iCustom function, should not be in the chart. Otherwise we get the duplication of the indicator and increase the load on the processor.

I type the text in Word and copy it through the clipboard to improve the literacy. Otherwise, four syntax and one comma...


 

Good day, colleagues!

Please tell me what the problem is with this piece of code:

   int TF[6]={1,5,15,30,60,240};
   for(int TF=0;TF<6;TF++)
      for(int i=iBars(NULL,TF[TF]);i>=0;)
The compiler outputs this:
'[' - array required        20      30
Help and tutorial doesn't say anything about using arrays in timeseries, can the problem be fixed? How else can we do a replay of all the candlesticks on multiple TFs?
Thank you very much!
 
Ekburg: Please tell me what the problem is with this piece of code:
 int TF[6]={1,5,15,30,60,240};
   for(int TF=0;TF<6;TF++)       TF[TF] ???????

TF is described as an array of 6 elements. i.e. there are: TF[0]=1, TF[1]=5, TF[2]=15, TF[3]=30 TF[4]=60 TF[5]=240
Referring to TF without square brackets, i.e. without specifying an index, is meaningless. Which array element should I use?
I suppose you could use something like for(int NTF=0;NTF<6;NTF++) for(int i=iBars(NULL,TF[NTF]);i>=0;)
 
Ekburg:

Good day, colleagues!

Can you tell me what the problem is with this bit of code?

int TF[6]={1,5,15,30,60,240};
for(int i=0; i<6; i++) int b=iBars(NULL,TF[i]);
 
LRA:
TF is described as an array of 6 elements. i.e. there are: TF[0]=1, TF[1]=5, TF[2]=15, TF[3]=30 TF[4]=60 TF[5]=240
Accessing TF without square brackets, i.e. without specifying an index, is meaningless. Which array element should I use?
I suppose you could use something like for(int NTF=0;NTF<6;NTF++) for(int i=iBars(NULL,TF[NTF]);i>=0;)
artmedia70:

Thanks, guys)

So, the fact that I defined variable TF in the firstfor(int TF=0;TF<6;TF++) operator, the compiler confuses it with an array?

 
Ekburg Does the compiler confuse the TF variable with an array?

It's worse... TF is declared twice 1) as an array 2) as an integer variable. The second declaration covers (makes invisible, almost destroys) the first one.

The compiler will first generate the warning: declaration of 'TF' hides local declaration ... The second declaration of TF hides the previous one. Now TF is not an array but an integer variable. That's why the next use of TF[] requires an array that is already hidden, and the error: '[' - array required Array required.

 
LRA:

It's worse... TF is declared twice 1) as an array 2) as an integer variable. The second declaration closes (makes invisible, almost destroys) the first one.

The compiler will first generate the warning: declaration of 'TF' hides local declaration ... The second declaration of TF hides the previous one. Now TF is not an array but an integer variable. That's why the next use of TF[] requires an array that is already hidden, and the error: '[' - array required Array required.



That's it... I see, thank you very much.

fixed everything, no errors are returned (however, I was confused by the fact that when I declared variable f instead of variable TF, there were no errors using TF[TF]),

but the script doesn't open in the terminal, maybe it's about warnings?

 
LRA:

Service -> Settings -> History Max Bar and Max BarGraphs in Window


Now the speed. Most indicators handle only one, last bar on each tick. Or 2 when a new bar appears. But there are indicators that calculate many or even all bars on every tick due to programming errors or due to a specific algorithm. First, we need to identify them. This can be done using the Task Manager, by determining the CPU load. Or, more precisely, you can insert into the indicator something like

It is unlikely that the indicator should recalculate all the bars. We should check 1) what this indicator returns by the operator return 2) the number of recalculated bars in the indicator code. 3) Max bars in the window 4) The indicators, called by the iCustom function, should not be in the chart. Otherwise we get the duplication of the indicator and increase the load on the processor.

I type the text in Word and copy it through the clipboard to improve the literacy. Otherwise there are 4 syntax and 1 comma...



With errors it's easy. Thanks for the answer, which didn't help at all. I'm more than just a mkul user. All that you have written to me has long been known and tested, the indicator counts once and then with the arrival of a new bar, it counts only one bar, I posted it all clearly visible. I have the maximum bar history in the window. I think maybe my broker screws up. For instance, today I have saved data on gold in the xc file, but they have become inconsistently different from the file I saved yesterday. During the day everything seems to be fine, but let's see what happens tomorrow...
 

Ekburg!!! All warnings should be eliminated. The first warning means that the statement has no effect - discarded by the compiler - this is bad. The last warning is that the size of the local variable (array) exceeds 512kB and therefore has no effect - that's too bad. The rest of the warnings - an uninitialized variable might be used. It's like when you forget to put money on the card and try to spend it. We have to check all the branches of the program. Sometimes the compiler is over-insured. In this case you should declare it this way: int x=0; string y=""; bool z=false;

 
Good day! The following question, I can't understand, when compiling the indicator I always get different values. Is there a check to see if the iCustom indicator call is working? I have suspicions that some indicators don't have time to load, that's why their signals bounce. Is there any way to check if iCustom has been loaded correctly???
Reason: