Hello All!
I was faced with some problem using candle series - when candle style is line, there is some kind of clipping while drawing line segments.
Looks like TChart draws candle line segment only if begin and end points of line segment are visible. It does not looks good. When I scroll or zoom candle-line, sometimes I get void graphic areas instead of candle line.
Is there any solution to my problem?
Best regards. Yushchenko Y.A.
Candle problem.
-
- Newbie
- Posts: 9
- Joined: Fri Apr 16, 2004 4:00 am
- Location: Ukraine
- Contact:
Hi Yuri,
this is as designed. As I know there's no way to change this. I'll add on our wish list (the ability to change this) to be considered for the next releases.
this is as designed. As I know there's no way to change this. I'll add on our wish list (the ability to change this) to be considered for the next releases.
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 9
- Joined: Fri Apr 16, 2004 4:00 am
- Location: Ukraine
- Contact:
Oki... Maybe I can fix this using another series when I wish to display tick graphic. That not a big problem.
But I have some other problem with candle series.
I develop financical chart using TChart. It is necessary for me to hide `weekends`(lot of white space) -- So I used solution similar to recommended in `Tchart5 feature demo->new features->series->Candle->Axis no weekends`. I was just setted Buttom Axis DateTime propepty to false, increment to 1, and style to Mark. So, when I add a new point to graphic, I just do like this:
int count = Series(0).GetCount()
AddCandle(count+1, high,low,open,close)
Series(0).SetPointLabel(count,stringmark);
where stringmark is encoded date-time value string like `10.6.2004'
But what can I do with functions using that candle series as datasource????
I mean ..... using of financical functions are not correct with such series as datasource.
Ofcourse, I can create another `regular` Candle series with regular Date-time x-values and use it as datasource. But my financical chart must support multiple chart windows with corresponding zoom and scroll. It will be possible only if there is some `visible-relation` between points in all chart windows. But there is no visible relation between regular-candle series function and no-weekends candle series.
I think the only way to solution is somehow to `move` points of regular candle series function to hide points corresponding to white spaces .
So.... I need help.
How can I make my financical indicators correctly displayed?
PS:
Sorry for bad english.
Best regards Yuri.
But I have some other problem with candle series.
I develop financical chart using TChart. It is necessary for me to hide `weekends`(lot of white space) -- So I used solution similar to recommended in `Tchart5 feature demo->new features->series->Candle->Axis no weekends`. I was just setted Buttom Axis DateTime propepty to false, increment to 1, and style to Mark. So, when I add a new point to graphic, I just do like this:
int count = Series(0).GetCount()
AddCandle(count+1, high,low,open,close)
Series(0).SetPointLabel(count,stringmark);
where stringmark is encoded date-time value string like `10.6.2004'
But what can I do with functions using that candle series as datasource????
I mean ..... using of financical functions are not correct with such series as datasource.
Ofcourse, I can create another `regular` Candle series with regular Date-time x-values and use it as datasource. But my financical chart must support multiple chart windows with corresponding zoom and scroll. It will be possible only if there is some `visible-relation` between points in all chart windows. But there is no visible relation between regular-candle series function and no-weekends candle series.
I think the only way to solution is somehow to `move` points of regular candle series function to hide points corresponding to white spaces .
So.... I need help.
How can I make my financical indicators correctly displayed?
PS:
Sorry for bad english.
Best regards Yuri.
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi Yuri,
You will find that all of TeeChart's financial functions make calculations on the OHLC values only. The date values are not used in calculations unless the ITeeFunction.PeriodStyle property is set to psRange (see Help files for details).
Have you tried adding a financial indicator to the example you mention? The following code works as expected here:How can I make my financical indicators correctly displayed?
Code: Select all
Dim NotDateTime As Boolean
Private Sub Check1_Click()
If Check1.Value = 1 Then
AddAsNoWeekend
AddFunction
Else
AddAsDatetime
AddFunction
End If
End Sub
Private Sub Form_Load()
TChart1.Aspect.View3D = False
AddAsNoWeekend
AddFunction
End Sub
Private Sub TChart1_OnAfterDraw()
Dim i
If NotDateTime = True Then
With TChart1
' Contain output within Chart rectangle
.Canvas.ClipRectangle .Axis.Left.Position, _
.Axis.Top.Position, _
.Axis.Right.Position, _
.Axis.Bottom.Position
'.Canvas.Font.Bold = True
.Canvas.Font.Color = vbYellow
For i = 0 To .Series(0).Count - 1
If Weekday(DateValue(.Series(0).PointLabel(i))) = 2 Then
.Canvas.RotateLabel .Series(0).CalcXPos(i - 1) + ((.Series(0).CalcXPos(i) - .Series(0).CalcXPos(i - 1)) / 2) - 5, .Axis.Bottom.Position - 10, "eg. Weekend", 90
End If
Next i
End With
End If
End Sub
Private Sub AddFunction()
With TChart1
.Axis.RemoveAllCustom
.Axis.Left.EndPosition = 60
.AddSeries scLine
.Series(1).VerticalAxisCustom = .Axis.AddCustom(False)
.Axis.Custom(0).Otherside = True
.Axis.Custom(0).StartPosition = 60
.Series(1).SetFunction tfMACD
.Series(1).DataSource = .Series(0)
.Series(1).FunctionType.asMACD.Histogram.Active = True
.Series(1).FunctionType.asMACD.MACDExp.Active = True
.Series(1).FunctionType.Period = 26
.Series(1).FunctionType.asMACD.Period2 = 12
.Series(1).CheckDataSource
End With
End Sub
Private Sub AddAsDatetime()
Dim tmpopen, tmp As Integer
' This option simulates a sequential datetime Axis
' Candle Series
NotDateTime = False
TChart1.RemoveAllSeries
TChart1.AddSeries (scCandle)
TChart1.Axis.Bottom.Labels.Angle = 90
With TChart1.Series(0)
.Clear
tmpopen = 1000 + Rnd(100)
For t = 0 To 14
tmp = Int(100 * Rnd - 50)
.asCandle.AddCandle Format(Now - 15, "000000") + t, tmpopen, tmpopen + 20, tmpopen - 20, tmpopen + tmp
tmpopen = tmpopen + tmp
Next t
End With
End Sub
Private Sub AddAsNoWeekend()
'Create an array of example dates
Dim myDates(14) As Variant
Dim StartDate As Date
' If this were to have a database datasource it would be simpler
' as you could use Series(xx).LabelsSource
' If using ADO Recordset the following principle would apply, replacing the
' Array with a step-through the Recordset
NotDateTime = True
StartDate = Now - 15
For i = 0 To 13
While (Weekday(StartDate) = 1) Or (Weekday(StartDate) = 7)
StartDate = StartDate + 1
Wend
myDates(i) = Format(StartDate, "d-mmm-yyyy")
StartDate = StartDate + 1
Next i
TChart1.RemoveAllSeries
TChart1.AddSeries scCandle
With TChart1.Series(0)
.XValues.DateTime = False
.Clear
tmpopen = 1000 + Rnd(100)
For t = 0 To 8
tmp = Int(100 * Rnd - 50)
.asCandle.AddCandle 1 + t, tmpopen, tmpopen + 20, tmpopen - 20, tmpopen + tmp
.PointLabel(t) = myDates(t)
tmpopen = tmpopen + tmp
Next t
End With
End Sub
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
-
- Newbie
- Posts: 9
- Joined: Fri Apr 16, 2004 4:00 am
- Location: Ukraine
- Contact:
Thanks, Christopher. Your example solves my problem.
But.. I want to ask you one more little thing...
When I add function, I set labels for each point and I set bottom axis style to `Text`.
Well, it works fine. Labels are shown. But when I try to change some function property (i.e. period or style for RSI function),labels dissapears and appears only after zoom-scroll.
In other hand when I work with MACD function, MACD period 1 change causes hides labels, but change of period 2 causes labels appear again.
Why so?
How can I make my labels always shown? I tried to use Repaint() and it works fine, but too slow. Is there any other way ?
Best regards, Yuri.
PS: Thanks for your attention - Steema support works just great!
But.. I want to ask you one more little thing...
When I add function, I set labels for each point and I set bottom axis style to `Text`.
Well, it works fine. Labels are shown. But when I try to change some function property (i.e. period or style for RSI function),labels dissapears and appears only after zoom-scroll.
In other hand when I work with MACD function, MACD period 1 change causes hides labels, but change of period 2 causes labels appear again.
Why so?
How can I make my labels always shown? I tried to use Repaint() and it works fine, but too slow. Is there any other way ?
Best regards, Yuri.
PS: Thanks for your attention - Steema support works just great!
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi Yuri,
You can post your project to:
news://www.berneda.com/steema.public.attachments
Would you be so kind as to send me a simple project which I can run "as-is" to reproduce your problem here?But.. I want to ask you one more little thing...
When I add function, I set labels for each point and I set bottom axis style to `Text`.
Well, it works fine. Labels are shown. But when I try to change some function property (i.e. period or style for RSI function),labels dissapears and appears only after zoom-scroll.
In other hand when I work with MACD function, MACD period 1 change causes hides labels, but change of period 2 causes labels appear again.
Why so?
How can I make my labels always shown? I tried to use Repaint() and it works fine, but too slow. Is there any other way ?
You can post your project to:
news://www.berneda.com/steema.public.attachments
You're welcomePS: Thanks for your attention - Steema support works just great!
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/