Hi Programmers;
I've written a Custom Indicator that determines how many bars back was the last higher and lower High[] and Low[]. This counts from the most recent bar back in time to Bars. This part seems to work fine.
The second part tries to use a cumulative count with a decay rate. This tries to count from the oldest bar at Bars to the most recent. The "for" loop does not seem to run at all. I'm probably missing something obvious so if anyone can point my error out I would be grateful.
thanks all
Hi Programmers;
I've written a Custom Indicator that determines how many bars back was the last higher and lower High[] and Low[]. This counts from the most recent bar back in time to Bars. This part seems to work fine.
The second part tries to use a cumulative count with a decay rate. This tries to count from the oldest bar at Bars to the most recent. The "for" loop does not seem to run at all. I'm probably missing something obvious so if anyone can point my error out I would be grateful.
thanks all
int lastBar = (Bars - 1); int firstBar = 0; // Loop forward for(i = 0; i <= (Bars - 1); i++) { // code } // Loop backwards for(i = (Bars - 1); i >= 0; i--) { // code }
int bars = rates_total - 1; if(prev_calculated > 0) bars = rates_total - prev_calculated; for(i=0; i <= Bars; i++){ for(CountBack=1; CountBack<=bars; CountBack++){ if(High[CountBack+i] >= High[i]) : return(rates_total);
Thanks WHRoder and h3nrixd. Very helpful.
cheers
WHRoeder;
Thanks for pointing me to your link on counting up and down lookbacks correctly.
Whilst I stress that I am not a programmer, I am not seeing the point: If the array is set as a time series (ArraySetAsSeries) then I would assume that I can go through it backwards or forwards. Or am I missing something?
Thanks again.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use