Note: this is a general C# question but hope its ok to ask (I think a prior post said it was).
I need to keep track of support and resistance zones, for example a support zone for stock ABC being $9-$10. To date I've not been able to master storing them in arrays, so as a work around I'm using declared variables like...
SupportZone1Lower = $9
SupportZone1Upper = $10
SupportZone1ValidFromBarNumber = 199
...and every time a support zone changes, say it moves up, I'm rejigging them around, e.g.
SupportZone2Lower = SupportZone1Lower;
SupportZone2Upper = SupportZone1Upper;
SupportZone2ValidFromBarNumber = SupportZone1ValidFromBarNumber;
SupportZone1Lower = $11
SupportZone1Upper = $12
SupportZone1ValidFromBarNumber = 233
This is becoming a NIGHTMARE to keep track of and I've got a MESS of declared variables in my strategy. I'm hoping to be able to store them like this (or similar)...
[$9,$10,199],[$11,$12,233]
... and then be able to reference them - such as: finding the Support zone with the largest bar number. Hoping to ask a couple of newbie questions please:
1. I've looked through the microsoft C# help guides and I think I need to approach this as an multi-dimensional array, does this sound like the right approach?
2. Most of the guides seem to populate the array within the code when initializing (e.g. the guides hardcode numbers into the array from the beginning), whereas my strategy will add/remove/update as bars update. Is there any advice please for how to correctly initialize an empty array for say: double, double, int (supportzonelower, supportzoneupper, bar number)?
Many thanks in advance
ChainsawDR
Comment