You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.