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.

PRINT
 Post subject: PRINT Post rating: 0   New post Posted: Mon 06 Apr, 2020, 14:36 

User rating: 0
Joined: Fri 31 May, 2013, 21:20
Posts: 14
Location: Syrian Arab RepublicSyrian Arab Republic
HI

How can I convert this line , so the text can be printed on the CHART instead of Messages

print("print me on the chart pls");

Thanks


 
 Post subject: Re: PRINT Post rating: 0   New post Posted: Tue 07 Apr, 2020, 01:34 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
import java.awt.*;
import java.util.*;

import com.dukascopy.api.*;
import com.dukascopy.api.drawings.*;

public class DemoStrategy implements IStrategy {
    public void onStart(IContext context) throws JFException {
        IChart chart = context.getLastActiveChart();
        IChartObjectFactory cf = chart.getChartObjectFactory();

        IScreenLabelChartObject staticLabel = cf.createScreenLabel("my-static-label");
        staticLabel.setColor(Color.RED);
        staticLabel.setText("static - print me on the chart pls");
        staticLabel.setCorner(IScreenLabelChartObject.Corner.TOP_RIGHT);
        staticLabel.setxDistance(20);
        staticLabel.setyDistance(20);
        chart.add(staticLabel);

        ILabelChartObject timedLabel = cf.createLabel("my-timed-label");
        timedLabel.setColor(Color.RED);
        timedLabel.setText("timed - print me on the chart pls");
        timedLabel.setTime(0, System.currentTimeMillis());
        timedLabel.setPrice(0, (chart.getMaxPrice() + chart.getMinPrice()) / 2);
        chart.add(timedLabel);
    }


 

Jump to:  

  © 1998-2024 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