Thanks for your answers. I'll be more specific. My bar iteration is as follows and it iterates from present to past.
int start()
// Start, limit, etc..int start = 0;
int limit;
int counted_bars = IndicatorCounted();
// check for possible errorsif(counted_bars < 0)
return(-1);
//last counted bar will be recountedif(counted_bars > 0)
counted_bars--;
// Only check these
limit = Bars - counted_bars;
// Check the signal foreach barfor(int i = start; i < limit; i++)
{
// Blabla
}
}
Now, my problem is throwing lots of consecutive signals of the same
type, but since I am iterating from present to past, I can only use
iCustom() recursively to know past signals and it is really disfunctional since I don't have access to other critical data not stored in buffers. Can I iterate from past to
present in such a way that the indicator works properly in real time?
Why not rewriting the code to iterate from past to now? If this is not possible you have a calculation problem and are probably looking into the future, so unless you want to code a repainter, this is the wrong way to go.
Once you iterate correct you can simply access your already filled buffers and you have no problems with recursive?
BTW, calling icustom() does not work for you since your code would be trapped in a endless loop. Your called icustom would need to call icustom again, and again and again to verify the signal..
flaab:. I'll be more specific. My bar iteration is as follows and it iterates from present to past.
Now, my problem is throwing lots of consecutive signals of the same type, but since I am iterating from present to past, I can only use iCustom() recursively to know past signals.
So the indicator has done its job and drawn lots of stuff, regardless of the direction it is done in. That has nothing to do with iCustom at all. iCustom can now pick any value in the history of the indicator.
At the risk of sounding rude it sounds as though you have mis-understood the definition of recursively. Why would iCustom need to call iCustom? Did you perhaps mean call iCustom repeatedly ( a VERY different concept). If you do mean recursive as in "DEFINITION of RECURSION: calling itself, see recursion" then please try to explain why.
So the indicator has done its job and drawn lots of stuff, regardless of the direction it is done in. That has nothing to do with iCustom at all. iCustom can now pick any value in the history of the indicator.
At the risk of sounding rude it sounds as though you have mis-understood the definition of recursively. Why would iCustom need to call iCustom? Did you perhaps mean call iCustom repeatedly ( a VERY different concept). If you do mean recursive as in "DEFINITION of RECURSION: calling itself, see recursion" then please try to explain why.
Hello Dabbler,
For each signal that my indicator throws, it checks the last N bars to avoid repetition. And all those calls check the last N bars as well to avoid repetition and so forth. It sounds like recursion to me -it's like a function calling itself over and over again-. It is not an infinite loop but it definetely seems easier to iterate from past to present :) You are not rude, don't worry.
For each signal that my indicator throws, it checks the last N bars to avoid repetition. And all those calls check the last N bars as well to avoid repetition and so forth. It sounds like recursion to me -it's like a function calling itself over and over again-. It is not an infinite loop but it definetely seems easier to iterate from past to present :) You are not rude, don't worry.
It should be an infinite loop, since on the call to icustom() the indicator does the same thing as your initial indicator (exept you make a extern int startinpoint;) But on a M1 chart with 100000 bars this can cause a big performance drop, and you most likely do not want that
Why not rewriting the code to iterate from past to now? If this is not possible you have a calculation problem and are probably looking into the future, so unless you want to code a repainter, this is the wrong way to go.
Once you iterate correct you can simply access your already filled buffers and you have no problems with recursive?
BTW, calling icustom() does not work for you since your code would be trapped in a endless loop. Your called icustom would need to call icustom again, and again and again to verify the signal..
Exactly, storing variables just "looks into the future" and makes the code useless, so I am not doing it and instead I am "looking into the past" with iCustom() but it is very unnefective.
I will iterate from past to present, any examples you might have at hand? Thank you.
This allows to generate one signal per direction without any lookbackloop.
//add: you have to implement a function:
Thanks a million zzuegg. It seems this scheme iterates from past to present and allows new signals to be painted, is that right? I hope I can be useful to you in the future as you are to me now.
//last counted bar will be recountedif(counted_bars > 0)
counted_bars--;
// Only check these
limit = Bars - counted_bars;
// Check the signal foreach barfor(int i = start; i < limit; i++)
//last counted bar will be recounted// if(counted_bars > 0) // counted_bars--;// Only check these
limit = Bars-1 - counted_bars;
// Check the signal foreach barfor(int i = limit; i >= 0; i--)
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Good afternoon everyone,
Thanks for your answers. I'll be more specific. My bar iteration is as follows and it iterates from present to past.
Now, my problem is throwing lots of consecutive signals of the same type, but since I am iterating from present to past, I can only use iCustom() recursively to know past signals and it is really disfunctional since I don't have access to other critical data not stored in buffers. Can I iterate from past to present in such a way that the indicator works properly in real time?
Cheers!
Why not rewriting the code to iterate from past to now? If this is not possible you have a calculation problem and are probably looking into the future, so unless you want to code a repainter, this is the wrong way to go.
Once you iterate correct you can simply access your already filled buffers and you have no problems with recursive?
BTW, calling icustom() does not work for you since your code would be trapped in a endless loop. Your called icustom would need to call icustom again, and again and again to verify the signal..
Now, my problem is throwing lots of consecutive signals of the same type, but since I am iterating from present to past, I can only use iCustom() recursively to know past signals.
So the indicator has done its job and drawn lots of stuff, regardless of the direction it is done in. That has nothing to do with iCustom at all. iCustom can now pick any value in the history of the indicator.
At the risk of sounding rude it sounds as though you have mis-understood the definition of recursively. Why would iCustom need to call iCustom? Did you perhaps mean call iCustom repeatedly ( a VERY different concept). If you do mean recursive as in "DEFINITION of RECURSION: calling itself, see recursion" then please try to explain why.
So the indicator has done its job and drawn lots of stuff, regardless of the direction it is done in. That has nothing to do with iCustom at all. iCustom can now pick any value in the history of the indicator.
At the risk of sounding rude it sounds as though you have mis-understood the definition of recursively. Why would iCustom need to call iCustom? Did you perhaps mean call iCustom repeatedly ( a VERY different concept). If you do mean recursive as in "DEFINITION of RECURSION: calling itself, see recursion" then please try to explain why.
Hello Dabbler,
For each signal that my indicator throws, it checks the last N bars to avoid repetition. And all those calls check the last N bars as well to avoid repetition and so forth. It sounds like recursion to me -it's like a function calling itself over and over again-. It is not an infinite loop but it definetely seems easier to iterate from past to present :) You are not rude, don't worry.
Hello Dabbler,
For each signal that my indicator throws, it checks the last N bars to avoid repetition. And all those calls check the last N bars as well to avoid repetition and so forth. It sounds like recursion to me -it's like a function calling itself over and over again-. It is not an infinite loop but it definetely seems easier to iterate from past to present :) You are not rude, don't worry.
Why not rewriting the code to iterate from past to now? If this is not possible you have a calculation problem and are probably looking into the future, so unless you want to code a repainter, this is the wrong way to go.
Once you iterate correct you can simply access your already filled buffers and you have no problems with recursive?
BTW, calling icustom() does not work for you since your code would be trapped in a endless loop. Your called icustom would need to call icustom again, and again and again to verify the signal..
Exactly, storing variables just "looks into the future" and makes the code useless, so I am not doing it and instead I am "looking into the past" with iCustom() but it is very unnefective.
I will iterate from past to present, any examples you might have at hand? Thank you.The most simple solution:
This allows to generate one signal per direction without any lookbackloop.
//add: you have to implement a function:
The most simple solution:
This allows to generate one signal per direction without any lookbackloop.
//add: you have to implement a function:
The decrement is unnecessary
OK, all has been sorted out according to WHRoeder and Zzuegg. Here is the result. Iterates from past to present.