//@version=4
study("My Script", overlay=true)
source = input(close)
fastema = ema(source, 9)
aaaa= 3
slot5 = iff((fastema > fastema[1]), aaaa + 3, aaaa + 3)
slot6 = iff((fastema < fastema[1]), aaaa + 4, slot5)
slot7 = iff((fastema > fastema[1]), aaaa + 4, slot6)
slot8 = iff((fastema < fastema[1]), aaaa + 7, slot7)
newema = ema(source, slot8)
line 14: Cannot call 'ema' with arguments (series[float], series[integer]); available overloads: ema(series[float], integer) => series[float]
So essentially I've been playing around with dynamic moving averages that respond to if and else commands and I guess that passes in a integer series and not a integer. I only started noticing it on pine functions that only allow the series float, integer format, which is many common ones, namely normal ema's and normal ema's are ideal for this strategy. I'd really love to be able to get a changing conditional length to be passed into ema's.
Here's an example from stack exchange though it is a bit unrelated, it did compile so I think it hints at what's going on
```
//@version=4
study("sample", max_bars_back = 200, overlay=true)
var dep=1
if close>open
dep:=dep+1
dep := min(dep, 200) // we needs some limit or must be some condition when
dep := 0
pine_sma(x, y) =>
sum = 0.0
for i = 0 to y - 1
sum := sum + x[i]
sum / y
plot(dep)
plot(pine_sma(close, dep))
```
