The codes connect pivot lows to pivot lows. Once it comes across a new pivot low, it will lookback for the most recent pivot low which is less than the current pivot low and draw a ray between the two points. That was working fine till the clutter of rays made it impossible to even see the candles!
So I tried to limit the number of rays to 10 (DemandLineMaxCount) as there are usually around 8 pivot lows a day on a 10 min chart. The intention is to have it remove the oldest ray as and when new rays are being drawn. Unfortunately it looked like it was keeping the old rays as new rays are removed. I increased the limit to 100 before I could get the chart to populate (see attached chart) and still the newer pivot lows didn't populate or got removed! The red dots in the charts are where there should be rays drawn
I'm not sure where it went wrong. Could someone please take a look? I've attached the add-on ninjascript.
Update:I changed the Lines 128 and 129 from DemandLines[DemandLines.Count-1] to DemandLines[0] and DemandLines.RemoveAt(DemandLines.Count-1) to DemandLines.RemoveAt(0).
At least the newer lines are there and the older lines are removed. What I can't understand is when DemandLineMaxCount =10, I only see 3 rays when I should have 9.
Regards
Kay Wai
Comment