Page 1 of 1

Putting lines in a graph

Posted: Thu Jun 09, 2016 7:21 am
by xkid
Hi, I have a hugge problem putting lines in a graph when programming

My graph has as y axis, numbers and as X axis, dates. Thus is the code i'm using:

grafico_overbought.draw(line,bottom, color(red)) "here I have to put the date"

when doig this, it allows me to make a red vertical line fro the x axis, however I need to do this for certain dates that follow a condition. I have a series object call "date" that contains the dates i'm using. My code is

For !t=1 to @obsrange
If rsi_gold(!t) > 70 then
grafico_overbought.draw(line,bottom, color(red)) date(!t)
endif
Next

If I put the date directly, for example 2/12/2008 (spanish format of the date) , the code works. but if I try to use a variable, the code runs, but it does not make the red lines. I've tried with everything, @makedate, @dateval, @datestr and all kind of date functions, but i does not work and I do not know what is wrong.

I will appreciate very much your help, thanks in advance!!

Re: Putting lines in a graph

Posted: Thu Jun 09, 2016 8:30 am
by EViews Gareth
Try:

Code: Select all

For !t=1 to @obsrange If rsi_gold(!t) > 70 then %date = @datestr(date(!t)) grafico_overbought.draw(line,bottom, color(red)) %date endif Next