Ok. So I'm trying to make a switch for the fill in between the plots.
So that way, the fill doesn't always show up but only when I want it, and only between the plots I want, not all the ones that are there.
The first step, I thought, was to make a switch for the fill-- true or false. And then use the "if" later, as shown below.
//@version=3
study("fill ema test")
//---input switches for the emas
ei8 = input(true, title="ema 8")
ei100 = input(true, title="ema 100")
ei200 = input(true, title="ema 200")
//---input switch attempts for the fills.
// ef8 = input(false, title= "fill e8/e100")
// ef100 = input(false, title= "fill e100/e200")
// ef200 = input(false, title="fill e8/e200")
efp= input(false, title="fill in the emas")
//----ema calc
e8 = ema(close, 8)
e100 = ema(close, 100)
e200 = ema(close, 200)
//----plots. checks if the switch for the emas are on and then plots.
ep8 = plot(ei8 and e8?e8:na, color= e8>=e100? green:red)
ep100 = plot(ei100 and e100?e100:na, color= e100>=e200? blue:purple)
ep200 = plot(ei200 and e200?e200:na, color= gray)
//---- now if i make this if statement here, then i can
if efp
ep8= p8
ep100=p100
ep200=p200
fill(p8, p100, color=teal)
fill(p100, p200, color=olive)
fill(p8, p200, color=green)
That throws errors "Undeclared identifier p8;..." etc
What am I doing wrong here?
There was another one I worked on, and that threw an error saying "fill cannot be used in local..." etc., something to that effect.
Thank you for any tips.
Aucun commentaire:
Enregistrer un commentaire