Page 1 of 1

Mapping a candle series date to a horizontal axis percentage

Posted: Tue Oct 19, 2004 5:49 pm
by 9524550
I'm using a candle series. Given a valid date for one of the candles, how do I get a percentage of where it is on the horizontal axis to pass to the ColorBand tool? What I am really trying to do is put vertical bands on the candle chart to show when in market positions.
Thanks in advance.

Posted: Wed Oct 20, 2004 8:31 am
by Chris
Hi Willy,
I'm using a candle series. Given a valid date for one of the candles, how do I get a percentage of where it is on the horizontal axis to pass to the ColorBand tool? What I am really trying to do is put vertical bands on the candle chart to show when in market positions.
You could try something like the following:

Code: Select all

Private Sub Command1_Click()
With TChart1
    .Tools.Add tcColorband
    .Tools.Items(0).asColorband.Axis = .Axis.Bottom
    .Tools.Items(0).asColorband.StartValue = DateValue("20/10/2004")
    .Tools.Items(0).asColorband.EndValue = DateValue("25/10/2004")
    
End With
End Sub

Private Sub Form_Load()
With TChart1
    .Aspect.View3D = False
    .AddSeries scCandle
    .Series(0).FillSampleValues 20
End With
End Sub

Posted: Wed Oct 20, 2004 11:33 am
by 9524550
Thanks for the useful information and the timely response. I've been overwhelmed by all the interfaces and objects in TeeChart and blew right past the simple solution to try vastly more complicated ones that didn't work.