This is a really silly question but I would like to "look into the inmediate past" of my indicator to see if a signal has been triggered. It seems easy but indicator iteration is backwards!
Is there a way to do it without falling into an infinite loop with iCustom calling myself over and over again?
- What do you mean backwards? The indicator calculates values for all bars it does not call iCustom on itself. (Only MTF indicators do that)
- Your EA calls iCustom with whatever shift value you want.
- You are very confused, by your question. Explain yourself better and we might be able to see where.
This is a really silly question but I would like to "look into the immediate past" of my indicator to see if a signal has been triggered. It seems easy but indicator iteration is backwards!
Indicator iteration typically starts from long ago, say bar[3000], and comes forward to present time bar[0].
That's bizarre. Any moving average filter has to work from past to present.
I (had) never seen one working that way so I just looked and found a Keltner Channel indicator that is indeed written from present to past for no good reason.
You know of course that you are going to unleash the wrath of the WHR for your insubordinate use of wrong way round for loops :-)
I don't think so . . . I coded my Indicators correctly . . . going from the past to the present . . . just like real time moves. I think WHR will agree with that . . . ;-)
If you look at the Custom Indicators supplied with MT4 I think you will see that they go backwards too . . . I'm sure I read a lengthy thread about it . . . can't remember. For my purposes it made sense to process the historic bars in the same way as current bars . . .
you both disagree what backwards is.
for dabbler backwards: for(int i=0;i<Bars;i++) //Going backwards in time
for raptor backwards: for(int i=Bars;i>=0;i--) //Looping backwards
at the end you are currently talking about the same ;)
you both disagree what backwards is.
for dabbler backwards: for(int i=0;i<Bars;i++) //Going backwards in time
for raptor backwards: for(int i=Bars;i>=0;i--) //Looping backwards
Nope, for me backwards is i++ . . . I coded my indicators to go from the past to the present, so the bar index decrements when processing the historical bars.
arr, i have read it agian, my fault. apologize
Nope, for me backwards is i++ . . . I coded my indicators to go from the past to the present, so the bar index decrements when processing the historical bars.
It is not the order of the loop that is the problem. It is wither the indicator repaints.
If the loop counts down and you don't see any iPos-n then most likely you're fine.
If the loop counts up, then it could be (intentionally or not) and must be looked at closely.
Count down is the way to go.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello :-)
This is a really silly question but I would like to "look into the inmediate past" of my indicator to see if a signal has been triggered. It seems easy but indicator iteration is backwards!
Is there a way to do it without falling into an infinite loop with iCustom calling myself over and over again?
Is to avoid repetitive signals -which have been thrown in the inmediate past-
Thank you!