Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

PRINT
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=65&t=57309
Page 1 of 1

Author:  SonGoku [ Mon 06 Apr, 2020, 14:36 ]
Post subject:  PRINT

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

Author:  mtnfx [ Tue 07 Apr, 2020, 01:34 ]
Post subject:  Re: PRINT

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);
    }

  Page 1 of 1