Hello, I am drawing two time series in one graph, the High of one currency's daily price and its 19-day EMA. I am trying to shade the area when High > EMA, but it is not working as what I expected, as the shaded areas are always somehow connected even though they don't always satisifies the above condition. (long is the condition High > EMA)
Could someone help me with that?
p = ggplot(data= dt) +`
geom_line(aes(x = date, y = EMA), color='green', size=1) +`
geom_line(aes(x = date, y = High), color = '#0099FF', size=1) +`
geom_ribbon(data = dt[dt$long==TRUE,], aes(x = date, ymin = EMA, ymax = High), alpha=0.1) +`
#scale_fill_manual(values=c('green','white'), name="fill") +`