Page 1 of 1

How to use the MACD function?

Posted: Tue Jul 24, 2012 12:22 pm
by 16962897
Hello,

i have a bar chart like this:
MACD1.jpg
MACD1.jpg (13.46 KiB) Viewed 10942 times
now i want a MACD view like this:
MACD.jpg
MACD.jpg (17.44 KiB) Viewed 10947 times
How can i use the MACD function? I cannot find an example in the tutorials?

Thanks for ur help!
Michael

Re: How to use the MACD function?

Posted: Thu Jul 26, 2012 3:57 pm
by yeray
Hi Michael,

There is an example of the MACD function in the features demo program at "All Features\Welcome!\Functions\Financial\MACD".
Here it is the main code:

Code: Select all

	protected void initChart() {
		super.initChart();
        chart1.getHeader().setVisible(true);
        chart1.setText("MACD Function Example");
        chart1.getAspect().setView3D(false);
        
        candleSeries = new com.steema.teechart.styles.Candle(chart1.getChart());
        candleSeries.getMarks().setVisible(false);
        candleSeries.getPointer().setVisible(true);
        candleSeries.setTitle("Candle");
        candleSeries.getVertAxis().setStartPosition(0);
        candleSeries.getVertAxis().setEndPosition(40);
        candleSeries.getVertAxis().getTitle().setCaption("Candle");
        candleSeries.fillSampleValues(50);

        function = new com.steema.teechart.functions.MACD(chart1.getChart());

        Axis tmpAxis;
        tmpAxis = chart1.getAxes().getCustom().getNew();
        tmpAxis.setHorizontal(false);
        tmpAxis.setOtherSide(false);
        tmpAxis.setStartPosition(60.0);
        tmpAxis.setEndPosition(100);
        tmpAxis.getTitle().setText("MACD");
        tmpAxis.getTitle().setAngle(90);
        
        Line functionSeries = new com.steema.teechart.styles.Line(chart1.getChart());
        functionSeries.setTitle("MACD");
        functionSeries.setColor(Color.GREEN);
        functionSeries.setCustomVertAxis(tmpAxis);
        functionSeries.setDataSource(candleSeries);
        functionSeries.setFunction(function);        
	}   

Re: How to use the MACD function?

Posted: Fri Jul 27, 2012 6:18 am
by 16962897
Where can i find this?
All Features\Welcome!\Functions\Financial\MACD

its not in the TeeChartJavaAndroid_3.2012.0202.zip


Michael

Re: How to use the MACD function?

Posted: Fri Jul 27, 2012 8:37 am
by yeray
Hi Michael,

You can find this and other examples in the SWT/Swing features demo program included with the evaluation (with complete Java version at the moment, not just the TeeChart Java for Android version).