READ-ONLY

The forum is now a read-only archive.

For bug reports & platform questions → [email protected]

Our community lives on Discord and YouTube — come join us!

Problem Using ‘Recent’ Function.

4 replies

RJL

Customer, bbp_participant, community, 67 replies.

Visit profile

11 years ago #114280

I have a custom indicator which, when using a direct and normal ‘IF’ condition works fine, but when I try to apply it to the ‘recent’ function (so it looks back x amount of bars to see if the condition was previously met) it doesn’t want to work at all no matter how many or how few bars I allow it to look back.

 

It’s definitely nothing to do with the ‘IF’ condition itself, only when using it with the ‘recent’ function.

 

Whether this is to be expected or not, I noticed in the source code that when you use the ‘recent’ function, it doesn’t come up using the same code snippet it would use if using the condition without the ‘recent’ function. It comes up with something like this:

 

 

 

==========

 

&& (sqGetRecent( -1204205979 , 5, signalShift) == sqGetRecent( -1884264349 , 5, signalShift)))))))

 

==========

 

 

 

That random number then comes up later in the code which has all the indicator settings…

 

 

 

==========

 

/—————————————————————————-
 
double sqGetAverage(int avgIndiNumber, int period, int maMethod, int signalShiftLocal) {
 
   double indicatorValue[1000];
 
   for(int i=0; i<period; i++) {
      if(avgIndiNumber == -1204205979) {
         indicatorValue[i] = sqCICheck(iCustom(NULL, 0 , “Custom1”, 10 , 21 , False , False , 6, 0 +i));
      }
      if(avgIndiNumber == -1884264349) {
         indicatorValue[i] = sqCICheck(iCustom(NULL, 0 , “Custom1”, 10 , 21 , False , False , 4, 0 +i));
      }
      if(avgIndiNumber == 1283306854) {
         indicatorValue[i] = sqCICheck(iCustom(NULL, 0 , “Custom1”, 10 , 21 , False , False , 7, 0 +i));
      }
      if(avgIndiNumber == 603248484) {
         indicatorValue[i] = sqCICheck(iCustom(NULL, 0 , “Custom1”, 10 , 21 , False , False , 5, 0 +i));
      }
   }
 
   double maValue = iMAOnArray(indicatorValue, period, period, 0, maMethod, 0);
 
   return(maValue);
}
 
//—————————————————————————-
 
double sqGetHighest(int avgIndiNumber, int period, int nthValue, int signalShiftLocal) {
 
   double indicatorValues[200];
   int i;
 
   for(i=0; i<200; i++) {
      indicatorValues[i] = -2147483647;
   }
 
   for(i=0; i<period; i++) {
      if(avgIndiNumber == -1204205979) {
         indicatorValues[i] = sqCICheck(iCustom(NULL, 0 , “Custom1”, 10 , 21 , False , False , 6, 0 +i));
      }
      if(avgIndiNumber == -1884264349) {
         indicatorValues[i] = sqCICheck(iCustom(NULL, 0 , “Custom1”, 10 , 21 , False , False , 4, 0 +i));
      }
      if(avgIndiNumber == 1283306854) {
         indicatorValues[i] = sqCICheck(iCustom(NULL, 0 , “Custom1”, 10 , 21 , False , False , 7, 0 +i));
      }
      if(avgIndiNumber == 603248484) {
         indicatorValues[i] = sqCICheck(iCustom(NULL, 0 , “Custom1”, 10 , 21 , False , False , 5, 0 +i));
      }
   }
 
==========
 
 
 
Anyway…perhaps it’s meant to do that, but either way it never seems to recognise this condition when using the ‘recent’ function, but that’s exactly what I want it to do.
 
Can anyone help?
 
 
Thanks.

0

Tomas Matejka

Administrator, sq-ultimate, 2 replies.

Visit profile

11 years ago #133256

Hi, will check that in Wizard

0

RJL

Customer, bbp_participant, community, 67 replies.

Visit profile

11 years ago #133271

Thank you, Tomas.

0

RJL

Customer, bbp_participant, community, 67 replies.

Visit profile

11 years ago #133316

Hi, will check that in Wizard

 

Any news Tomas?

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

11 years ago #133346

I looked at it, but I don’t see any obvious error there.

Using Recent is different that calling indicator directly, because it has to check for indicator value in cycle of given last few bars, getHighest, getLowest functions work in the same way.

 

It works as you described it – EA Wizard generates random number that is then used to identify which indicator should be called in the getRecent() function.

It should work properly.

 

How does your getRecent() function look like?

 

Maybe log the values that are returned by the Recent function – you’ll see then why the conditions aren’t valid.

Mark
StrategyQuant architect

0

Viewing 4 replies - 1 through 4 (of 4 total)