I am trying to learn arrays as well as the ATC function so I was using a simple normalization calculation to range bound a set of values in this case an Advance/Decline Ratio using Norgate Data. I obviously don't have the concepts down as I keep getting zeros for values when trying to normalize the data. The code below is what I have been experimenting with for this issue... Any pointers or clarifications would be greatly appreciated.
/* Normalization:
Normalizing Values
A = Smallest Data Value = LoVaL
B = Largest Data Value = HiVaL
a = Small Scale number = LS
b = Large Scale number = HS
X = Value
X = a+(X-A)*(b-a)/(B-A)
*/
//#SP1500ADR (S&P 1500 Advance/Decline Ratio)
Syma = "~Test Normalized CompositeS";
Sym1 = Foreign("#SP1500ADR","C");
HiValADR=0;
LoValADR=0;
HSADR = 0;
LSADR = 0;
HiValADR == Highest(Sym1);
LoValADR == Lowest(Sym1);
HSADR ==100;
LSADR == 0;
ADR = LSADR + (Sym1 - LoValADR)*(HSADR-LSADR)/(HiValADR-LoValADR);
AddToComposite(ADR,syma,"x");