0

Hi guy's im trying to not get error using this lines

HERE = if timeframe.period=='D'
    display=display.all
else
    display=display.none

EMA= ema(close,20)

plot(EMA,color=color.red,HERE) //or
plot(timeframe.period=='D'?EMA:na,color=color.red,HERE)

the intention is to draw the EMA only in a specific timeframe so that when the timeframe is changed the n/a is removed in the values next to

study("My script")

displayed in main chart

ElPiner
  • 1
  • 1

1 Answers1

0

Would the below achieve what you are after?

//@version=4
study("Daily EMA Only", overlay=true)

TF_D = (timeframe.period =="D")

EMA= ema(close,20)

plot(EMA and TF_D ? EMA : na, color=color.red)

Please have a read of the below link:

Pine Script: Is there a way to hide specific indicator values from the data window?

Hiding plot values

frien_dd
  • 154
  • 2
  • 12
  • not because, the values displayed next to the indicator´s name, in week for eg, will show the legend "n/a"...and if de const integer display.none is used, the indicator will apear turn off. The const interger display.none made the style checkbox not activated – ElPiner Apr 26 '21 at 01:48
  • https://ibb.co/Q9hTySf https://ibb.co/7CtndNm https://ibb.co/SdhWrpL – ElPiner Apr 26 '21 at 02:33
  • Having read through other questions on here (provided links above) it doesn't look like what you are trying to achieve can be achieved at this moment. – frien_dd Apr 26 '21 at 08:53