HippoEngine en = new HippoEngine();
en.DataType = DataSourceType.Excel;
en.Query = "select * from [삼성전자2$]";
en.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=`C:\삼성전자2.xlsx`;Extended Properties=`Excel 12.0;HDR=YES`";
SeriesList sList = en.GetSeriesListOfStock(DataSourceType.Excel, "Date", "Start", "Close", "Low", "High");
sList.AxisFactor.YAxis.Direction = AxisDirection.Right;
sList.AxisFactor.YAxis.IsZeroStartScale = false;
sList.GraphArea.Grid.IsBackGridColor = false;
sList.AxisFactor.AxisItems.Add(new Axis(AxisType.Ytype));
sList.AxisFactor.AxisItems[0].Decimalpoint = 0;
// 스토캐스틱
sList.SeriesCollection.Add(new Series());
sList.SeriesCollection[1].ChartType = ChartType.Line;
sList.SeriesCollection[1].Points.Width = 0;
sList.SeriesCollection[1].Line.LineWidth = 2;
sList.SeriesCollection[1].SeriesColor = Color.Gray;
sList.SeriesCollection[1].AxisIndex = 1;
int nCnt = sList.SeriesCollection[0].items.Count;
//MACD
for(int i = 0; i < nCnt; i++)
{
SeriesItem itemStochastic = new SeriesItem();
itemStochastic.Name = sList.SeriesCollection[0].items[i].Name;
try
{
double max = double.MinValue;
double min = double.MaxValue;
for(int a = 0; a < 15; a++)
{
if (max <= sList.SeriesCollection[0].items[i - a].HighValue)
{
max = sList.SeriesCollection[0].items[i - a].HighValue;
}
if (min >= sList.SeriesCollection[0].items[i - a].LowValue)
{
min = sList.SeriesCollection[0].items[i - a].LowValue;
}
}
itemStochastic.YValue = ((sList.SeriesCollection[0].items[i].YValue - min) / (max - min)) * 100;
}
catch { itemStochastic.YValue = double.NaN; }
sList.SeriesCollection[1].items.Add(itemStochastic);
}
this.hHippoChart1.Designer.InnerBackColor = Color.LightGray;
this.hHippoChart1.Titles.Label.Text = "히포차트 주식 - 스토캐스틱 보조지표";
this.hHippoChart1.LegendBox.Visible = false;
this.hHippoChart1.SeriesListDictionary.Add(sList);
this.hHippoChart1.DrawChart();
Dim en As New. HippoEngine()
en.DataType = DataSourceType.Excel
en.Query = "select * from [삼성전자2$]"
en.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=`C:\삼성전자2.xlsx`;Extended Properties=`Excel 12.0;HDR=YES`"
Dim sList As SeriesList = en.GetSeriesListOfStock(DataSourceType.Excel, "Date", "Start", "Close", "Low", "High")
sList.AxisFactor.YAxis.Direction = AxisDirection.Right
sList.AxisFactor.YAxis.IsZeroStartScale = False
sList.GraphArea.Grid.IsBackGridColor = False
sList.AxisFactor.AxisItems.Add(New Axis(AxisType.Ytype))
sList.AxisFactor.AxisItems(0).Decimalpoint = 0
` 스토캐스틱
sList.SeriesCollection.Add(New Series())
sList.SeriesCollection(1).ChartType = ChartType.Line
sList.SeriesCollection(1).Points.Width = 0
sList.SeriesCollection(1).Line.LineWidth = 2
sList.SeriesCollection(1).SeriesColor = Color.Gray
sList.SeriesCollection(1).AxisIndex = 1
Dim nCnt As Integer = sList.SeriesCollection(0).items.Count
`MACD
For i As Integer = 0 To nCnt - 1
Dim itemStochastic As New. SeriesItem()
itemStochastic.Name = sList.SeriesCollection(0).items(i).Name
Try
Dim max As Double = Double.MinValue
Dim min As Double = Double.MaxValue
For a As Integer = 0 To 14
If max <= sList.SeriesCollection(0).items(i - a).HighValue Then
max = sList.SeriesCollection(0).items(i - a).HighValue
End If
If min >= sList.SeriesCollection(0).items(i - a).LowValue Then
min = sList.SeriesCollection(0).items(i - a).LowValue
End If
Next
itemStochastic.YValue = ((sList.SeriesCollection(0).items(i).YValue - min) / (max - min)) * 100
Catch
itemStochastic.YValue = Double.NaN
End Try
sList.SeriesCollection(1).items.Add(itemStochastic)
Next
Me.hHippoChart1.Designer.InnerBackColor = Color.LightGray
Me.hHippoChart1.Titles.Label.Text = "히포차트 주식 - 스토캐스틱 보조지표"
Me.hHippoChart1.LegendBox.Visible = False
Me.hHippoChart1.SeriesListDictionary.Add(sList)
Me.hHippoChart1.DrawChart()