- High[i-1] is NOT in the past, that's in the future.
if((High[i-1]>=Open[i-2]...
If you want last bars high >= previous bars open that would beif((High[i+1]>=Open[i+2]...
int counted_bars=IndicatorCounted(); int limit=Bars-counted_bars; for(i=limit-2; i>=0; i--)
This is also wrong - When IndicatorCounted == Bars-1, every case except the initial run, your loop does nothing. Since you are looking up to two bars back you needint counted_bars=IndicatorCounted(); #define DRAWBEGIN 2 if (counted_bars < DRAWBEGIN) counted_bars = DRAWBEGIN; // Don't look past H[Bars-1] int limit=Bars -1 -counted_bars; for(i=limit/*-2*/; i>=0; i--)

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
I have programmed an indicator with graphical objects.
It calculates the values from the past and the "last state" is very important for the working on...
But my rules for the past didn't work in the future
This it the main-loop in the chart function is