Wheeling, WV USA
Posts: 1 since Feb 2015
Thanks Given: 0
Thanks Received: 0
|
Hi,
I have a variable that is conditional meaning that sometimes values are calculated for the variable and sometimes they are not depending on if my condition is true. When the condition is not true generally the last value that the variable produced is used over and over until the condition is true and another value is added (or I can add in a zero). To illustrate please see the string of numbers below:
1, 2, 3, 4, 5, 5, 5, 5, 5, 6, 7, 8
As you can see in this string the number 5 is repeated. The problem I am facing is that I want to apply an analysis technique, like a moving average, to this string of numbers contained in a variable. The consecutive 5's will screw up the analysis technique you apply because of this "flat spot" (ie the consecutive 5's).
My question related as to how I eliminate these redundant numbers or flat spots so I can properly apply different analysis techniques or functions to the variable. When done properly the string of numbers would read 1,2,3,4,5,6,7,8.
Ideally I would like to do this within a variable since arrays can be difficult to apply analysis techniques to. I had the idea of shifting all the values in the variable to the right by one bar when my condition was not true. If that was possible, the shift in the numbers would eliminate this gap of redundant numbers in my string. Would anyone have an idea regarding how I can accomplish this shift in the variable values using easylanguage? Any insight would be greatly appreciated. This has had me stumped for the longest time.
|