I am using the following script to create a percent increase or percent decrease historical value entry by comparing the current hour value with the same value exactly 24 hours earlier. This should update once every hour, comparing every hour of the day with the corresponding hour of the previous day.
var previous = p155.ago(HOUR, 24); var current = p155.value; return ((current - previous)/previous)*100;
My problem comes when trying to manually create a history by clicking the "Generate History" button. I'm not exactly sure if the comparison is calculating backward through historical entries. Does the p155.ago(HOUR, 24) always calculate from the current time, or when generating history, can it iterate through previous historical values, and subtract 24 hours from those entries instead. Not sure if I'm exactly clear with my question, but if anybody can help with the proper script, that would be great.