Custome Indicators - question re: Left to Right Vs right to left calculation (ie.. using say i-- or i++)

 

Hi, I've seen samples of indicators that use either i-- or i++ to invoke a new calaculation during loops, but wonder if somone is able to provide clear guidance when either of these could be used.

I'm having problems getting an up/down stoploss indicator coded, as I have a requirement to retain the previous indicator value if the close price of the next bar stays within a pre-defind range and woudl only chnage if teh close was outside a pre-defined range. This logic would then continue for each new bar. I wonder if it's my incorrect use or misunderstaing of the how my calculations are performed i.e. moving left to right or right to left.

I think my indicator needs to calculate left to right.

Thanks in advance

Paul.

 

One, if the calculated values for a completed bar never change, there is no need to re-calculate it every tick...

Two, indicators rarely (if ever) use values from the future in their calculation (right to left necessary)

So left to right (oldest to current) is the general case.

 
phy wrote >>

One, if the calculated values for a completed bar never change, there is no need to re-calculate it every tick...

Two, indicators rarely (if ever) use values from the future in their calculation (right to left necessary)

So left to right (oldest to current) is the general case.

Phy - thanks for teh reply - much appreciated - makes more ense now.

Actually managed to build the indicator I wanted.

So thnaks again.

Paul..

Reason: