How to use the MACD function?

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
micha
Newbie
Newbie
Posts: 9
Joined: Thu Jul 05, 2012 12:00 am

How to use the MACD function?

Post by micha » Tue Jul 24, 2012 12:22 pm

Hello,

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

Thanks for ur help!
Michael

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How to use the MACD function?

Post by Yeray » Thu Jul 26, 2012 3:57 pm

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);        
	}   
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

micha
Newbie
Newbie
Posts: 9
Joined: Thu Jul 05, 2012 12:00 am

Re: How to use the MACD function?

Post by micha » Fri Jul 27, 2012 6:18 am

Where can i find this?
All Features\Welcome!\Functions\Financial\MACD

its not in the TeeChartJavaAndroid_3.2012.0202.zip


Michael

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How to use the MACD function?

Post by Yeray » Fri Jul 27, 2012 8:37 am

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).
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply