When does it make sense to keep part of the robot code in an indicator? - page 22

 
Integer:


There was that, too. Exactly the same argument as poltergeist and water dripping from the ceiling.

If you don't mind repeating (you can copy-paste) what I missed. Otherwise, I don't know what we're talking about at all. If you feel that my code is not suitable for REAL. Please specify the reason, so that not only the particularly clever ones can understand. You can articulate what you think.
 
hrenfx:
If you don't mind repeating (you can copy-paste) what I've missed. Otherwise, I don't know what I'm talking about at all. If it seems to you that my code is not suitable for REAL. Please specify the reason, so that not only the particularly clever ones can understand. You can articulate what you think.

DeJavu! You can start reading from the beginning of page 19. Absolute repetition. Don't forget the break or return operator or decide beforehand the number of loops.
 
I've read it and still don't understand why you've decided that my EA isn't suitable for REAL. You can go on about "it's all written, re-read it", or you can be specific (which I've called for several times in this thread) and argue your point of view. So far it's just water for reasons I don't understand.
 
hrenfx:
I've read it and still don't understand why you've decided that my EA isn't suitable for REAL. You can go on about "it's all written, re-read it", or you can be specific (which I've called for several times in this thread) and argue your point of view. So far it's just water for reasons I don't understand.

There was this question, I answered it, that I will not! There was also an explanation of the reason. So, let's go to page 19 & while(true)...
 
hrenfx:
If I read it, I still don't understand why you think my Expert Advisor is not suitable for REAL. The Expert Advisor is not suitable for REAL. You can go into the "it's all written, re-read" error, or you can concretely (which I called several times in this thread) argue your point of view. So far it's just water for reasons I don't understand.


To calculate correctly, you must use your analogue of IndicatorCounted(). If the difference between Bars and the value of our function (variable) is greater than 1, we must do a complete recalculation.

If the difference is 1, calculation of the previous bar and calculation of the new bar. If 0, then only recalculation of the current bar

 
Although there is still one problem when transferring the indicator calculation to the EA. This is when you need to refer to values 5 or 10 or more bars ago. The problem can be solved with some complications. But it can be solved
 
Vinin:


You need to use your analogue of IndicatorCounted() to calculate correctly. If the difference between Bars and value of our function (variable) is greater than 1, then a full recalculation should be done.

If the difference is 1, calculation of the previous bar and calculation of the new one. If 0, then only the recalculation of the current bar

Is there something you don't like about this code?

double GetEMA()
{
  static int PrevTime = 0;
  
  if (PrevTime == Time[0])
    return(EMA);

  int i = iBarShift(Symbol(), Period(), PrevTime) - 1;  

  PrevTime = Time[0];    
  
  while (i >= 0)
  {
    EMA = EMA * Alpha + (1 - Alpha) * GetPrice(i);
    
    i--;
  }
  
  return(EMA);
} 
 
hrenfx:

Is there something you don't like about this code?


Of course I don't like it. It counts with errors for nothing
 
Be more specific, please.
 
hrenfx:
Be more specific, please.

The EMA value at break in communication is taken incorrectly. It is taken as the last one calculated. But it is not correct. As the result, the function will work incorrectly not on n bars but on a much larger number of bars. If you save its values, of course