It was a bit of a headache, but I think I found a more elegant way to calculate the exponential DCA layers. The base number is calculated based on the max amount of DCA layers and the range between the entry price and 0. With this method the DCA layers never will be negative. The more layers you set the more the exponential layers get squeezed between the range limit of the entry price and 0.
I also added the option to switch to a linear calculation of the DCA layers. Enjoy!