I have a 20 day DEMA that I am trying to use on NUGT and DUST. The idea is that when the the latest DEMA value is greater than the previous days, it is bullish, and vice versa. When I chart out my strategy it looks great, but when I code it, I don't get the results I expected.
The DEMA array has the first quarter or so values as 'nan', which I think is ok since I only want to look at the last two data values. I noticed the stock was split a few times, could that be the cause of the strangeness? Could it be fixed in my algo?
It also looks like the two graphs correlate inversely.
Thanks.