Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Display text on chart from strategy
 Post subject: Display text on chart from strategy Post rating: 0   New post Posted: Sun 15 May, 2011, 01:04 

User rating: 0
Joined: Tue 15 Sep, 2009, 00:44
Posts: 20
Can someone show me some code snippet to display text below the OHLC Index line?
This is the best I could do from the online documentation.

if (chart != null){
IChartObject Line1 = chart.getChartObjectFactory().createText();
Line1.setColor(Color.BLUE);
Line1.setText("Trade Running",Font.SANS_SERIF, ????? );
chart.addToMainChart(Line1);
}


 
 Post subject: Re: Display text on chart from strategy Post rating: 0   New post Posted: Fri 20 May, 2011, 07:29 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
IHorizontalLineChartObject interface has no method to write text below the line - it is only possible to write some text on the top of it. Consider the following method which writes the text on top of the line.
private void drawHLine(IChart chart, String name, double price, long time) throws JFException {
        if (chart == null  ) {
            return;
        }
        IChartObjectFactory factory = chart.getChartObjectFactory();
        IHorizontalLineChartObject hline = factory.createHorizontalLine("NewhlineKey", price);
        hline.setColor(Color.RED);
        hline.setPrice(0, price);
        hline.setTime(0, time);
        hline.setText(" hline text ", SwingConstants.CENTER);
        chart.addToMainChart(hline);
   }


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com