Page 1 of 1
LoadFromFile RSI Indicator
Posted: Wed Dec 15, 2010 2:36 pm
by 15054354
Hi All,
I can't load a chart consisting of a serie type indicator RSI from a binary file.
The code crashes at :
AxTChart.Import.LoadFromFile (tempfile).
And then only for the RSI indicator constructed as follows :
Code: Select all
.Series (NewSerieIndex).DataSource =. Series (SourceSerieIndex)
.Series (NewSerieIndex).SetFunction (TeeChart.EFunctionType.tfRSI)
.Series (NewSerieIndex).FunctionType.Period = Period
.Series (NewSerieIndex).CheckDataSource ()
.Series (NewSerieIndex).FunctionType.asRSI.Style = TeeChart.ERSIStyle.rsiClose
Regards,
Re: LoadFromFile RSI Indicator
Posted: Wed Dec 15, 2010 2:58 pm
by narcis
Hi Petar,
You should use a TeeChart native template file (*.tee) here. Is that the kind of file you are using? If so, can you please attach it here?
Thanks in advance.
Re: LoadFromFile RSI Indicator
Posted: Wed Dec 15, 2010 3:34 pm
by 15054354
Here are the piece of code to save in a binary file (here in C:\temp.nova, the file extension doesn't matter because we transcode in binary) :
Code: Select all
Dim tempFile As String = "C:\temp.nova"
AxTChart.Export.asNative.SaveToFile(tempFile, True)
And an extract from LoadChart :
Code: Select all
Dim res As List(Of Byte()) = New List(Of Byte())(ChartServiceController.Instance.Service.ReadFromDB(RequestName))
Dim tempFile As String = "C:\temp.nova"
Dim sw As New StreamWriter(tempFile)
sw.Close()
Dim fs = New FileStream(tempFile, FileMode.Open, FileAccess.Write)
fs.Write(res(0), 0, res(0).Length)
fs.Close()
AxTChart.Import.LoadFromFile(tempFile)
I recall that the LoadFromFile method works with other indicators but not RSI.
I attached the file temp.zip
Re: LoadFromFile RSI Indicator
Posted: Wed Dec 15, 2010 3:45 pm
by narcis
Hi Petar,
Thanks for the information. Loading your file using this code:
Code: Select all
TChart1.Import.LoadFromFile "C:\temp\temp.tee"
I get this error message:
No valid DataSource: Series0
This is because template files don't store datasources as they may not be available in the location where you load the template. Therefore you need to set datasources to null before exporting the chart and assign them manually after loading.
Re: LoadFromFile RSI Indicator
Posted: Wed Dec 15, 2010 4:07 pm
by 15054354
Can you give a code example ?
PS : I have the follow error, knowing that the code works well with others indicators :
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
The error highlighted row stopped at Axtchart.Import.LoadFromFile(tempFile)..
Thanks
Re: LoadFromFile RSI Indicator
Posted: Wed Dec 15, 2010 4:32 pm
by 15054354
Hi,
I recall you that the LoadFromFile works with other indicators / Functions, but not with the RSI.
Functions type like MACD, Stochastic, Momentum, PVO works well.
In my code, I have a generic function where I set the native functions.
I add a specific line of code in the case of a function rsi :
Code: Select all
.Series(NewSerieIndex).DataSource = .Series(SourceSerieIndex)
.Series(NewSerieIndex).SetFunction(FuncType)
.Series(NewSerieIndex).FunctionType.Period = Period
.Series(NewSerieIndex).CheckDataSource()
If FuncType = TeeChart.EFunctionType.tfRSI Then
.Series(NewSerieIndex).FunctionType.asRSI.Style = TeeChart.ERSIStyle.rsiClose
Endif
Re: LoadFromFile RSI Indicator
Posted: Thu Dec 16, 2010 11:00 am
by 15054354
Hi,
Did you have time to look into this issue ?
Regards,
Re: LoadFromFile RSI Indicator
Posted: Thu Dec 16, 2010 3:28 pm
by yeray
Hi Petar,
I've tried to reproduce the problem with the following simple example:
Code: Select all
Private Sub Form_Load()
TeeCommander1.Chart = TChart1
TChart1.Aspect.View3D = False
TChart1.Axis.Left.EndPosition = 49
TChart1.AddSeries scCandle
TChart1.Series(0).FillSampleValues 100
TChart1.Axis.AddCustom False
TChart1.Axis.Custom(0).StartPosition = 51
TChart1.Axis.Custom(0).EndPosition = 74
TChart1.AddSeries scLine
TChart1.Series(1).SetFunction tfRSI
TChart1.Series(1).DataSource = TChart1.Series(0)
TChart1.Series(1).FunctionType.Period = 10
TChart1.Series(1).VerticalAxisCustom = 0
TChart1.Axis.AddCustom False
TChart1.Axis.Custom(1).StartPosition = 76
TChart1.Axis.Custom(1).EndPosition = 100
TChart1.AddSeries scLine
TChart1.Series(2).SetFunction tfStochastic
TChart1.Series(2).DataSource = TChart1.Series(0)
TChart1.Series(2).FunctionType.Period = 10
TChart1.Series(2).VerticalAxisCustom = 1
TChart1.Export.SaveToFile "C:\tmp\test1.tee"
End Sub
With it, I have a file test1.tee that I can load without problems with the following:
Code: Select all
Private Sub Form_Load()
TeeCommander1.Chart = TChart1
TChart1.Import.LoadFromFile "C:\tmp\test1.tee"
End Sub
And both the RSI and the Stochastic functions seems to loaded as expected.
If you still have problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.