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.

Strategy Labels Right Justified
 Post subject: Strategy Labels Right Justified Post rating: 0   New post Posted: Wed 22 Oct, 2014, 17:46 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
Hi,

I would like the labels shown in the screenshot to
extend to the LEFT from the time, rather than
to the right, which is shown.

From the Strategy code I use setText with
SwingConstants.RIGHT but this does not achieve
right-justification of the text label relative to
my time, which is the current time right side
of the chart.

How can I achieve left-justification of this text?

Thanks,
HyperScalper


Image


Attachments:
File comment: Want label to extend to the left, not to the right
JForexLabels.PNG [95.81 KiB]
Downloaded 254 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Strategy Labels Right Justified Post rating: 0   New post Posted: Thu 23 Oct, 2014, 13:09 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,

Unfortunately, currently there is no such functionality. The only way to do that is to manually calculate size of text, then manually calculate size between bars on screen and then move text label several bars left.

Also you can make a feature request, but there is no guarantee that it will be implemented any time soon.


 
 Post subject: Re: Strategy Labels Right Justified Post rating: 0   New post Posted: Mon 27 Oct, 2014, 17:50 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
Thanks. Is there a way for me to put all of my labels at
the extreme LEFT side of the chart ? Or if I can get
the timestamps of the extreme left side of the visible
chart, then I could use those timestamps.

But that information is probably not available?

HyperScalper


 
 Post subject: Re: Strategy Labels Right Justified Post rating: 0   New post Posted: Tue 28 Oct, 2014, 09:20 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Look at this method:
https://www.dukascopy.com/client/javadoc/com/dukascopy/api/IChart.html#getMinTime()

Example:
        IChart chart = context.getLastActiveChart();
        IChartObjectFactory factory = chart.getChartObjectFactory();

        long time = chart.getMinTime();
        double price = history.getLastTick(Instrument.EURUSD).getBid();

        IChartObject text = factory.createText("test1", time, price);
        text.setText("TEST TEXT");
        chart.add(text);


 
 Post subject: Re: Strategy Labels Right Justified Post rating: 0   New post Posted: Tue 28 Oct, 2014, 13:30 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
Brilliant. chart.getMinTime() was all I needed to
place my labels on the left of the chart.

Thanks!!
HyperScalper


 

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