I stopped using for loop. Instead the event will occur every 2 years. This will make my new dataset the middle size as the original one. But this will work for plot in real time.
I prepared a variable (i) that will be increased every time change. This will be the dataset guide point to make the subtraction.
The subtraction formula needs to be
resultado = TFGDS.getY(i-1)-TFGDS.getY(i-2);
for being sure the event is using the dataset existing values, as the event is occuring every 2 years.
Thank you all for making my brain more creative.