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

 

Criticising:

extern double Alpha = 0.1;

double EMA;

double GetPrice( int Shift )
{
  return(Open[Shift]);
}

void init()
{
  EMA = GetPrice(Bars - 1);

  return;
}  

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);
}

void start()
{
  EMA = GetEMA();
  
  return;  
}
 
hrenfx:

Critique:


1. Try pushing this through the tester.

2. the same problem - there will be errors after a connection failure, the lower the timeframe, the more frequent and larger they will be.

Practically not applicable algorithm. It is not suitable for the stated nomination.

 

Why not take the code of MovingAverages.mq4 from standard delivery? I think it is correct enough to be used in an EA.


Update

And it repeats the algorithm of the embedded one for sure.

 
So why try to roll a square and build with round bricks?
 

This is where another advantage of "all-in-one" over "with an indicator" comes into play.

The fact is that if the DC decides to correct the history retroactively, the "with indicator" can change all trading decisions. Because the indicator will be completely recalculated, taking into account the corrected history of DT (which may not exist). And the "all in one" variant will not pay attention to DT delirium.

But in fact it is a question of the purity of the quotes provider, which has little to do with trading.

 
hrenfx:

This is where another advantage of "all-in-one" over "with an indicator" comes into play.

The fact is that if the DC decides to correct the history retroactively, the "with indicator" can change all trading decisions. Because the indicator will be completely recalculated, taking into account the corrected history of DT (which may not exist). And the "all in one" variant will not pay attention to DT delirium.

But in fact it is a question of the purity of the quotes provider, which has little to do with trading.


There could also be a poltergeist and water dripping from the ceiling.
 
alsu:

Why don't you take the code of MovingAverages.mq4 from the standard delivery? As far as I understand it is quite correct for using in the EA.


upd

And for sure it repeats the algorithm of the built-in one.


For the sake of the experiment. As you can see, I gave the indicator and the Expert Advisor over an hour ago, but the opponents have only one boolean so far.

Posted the Expert Advisor on 20.03.2011 at 16:30, now it is 18:00

 
Integer:


1. Try to push it through the tester.

The tester will pass through without any problems. Moreover, a much simpler variant (above) will pass through it even faster, because there are no connection failures in the tester.

2. the same problem - there will be errors after a connection failure, the lower the timeframe, the more frequent and larger they will be.

Practically not applicable algorithm. It is not suitable for the stated nomination.

Completely unsubstantiated statement.
 
And this is the simplest case. What if the zigzag is carried over?
 
Integer:


For the sake of the experiment. As you can see, I provided the indicator and the Expert Advisor over an hour ago, and the opponents have so far provided only a boo-boo.

For the tester the Expert Advisor was shown by me even earlier. I started to criticise its applicability on the real account. I have added it for real account considering all the doubts. Do you have something reasonable to say?