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.

price line on every tick
 Post subject: price line on every tick Post rating: 0   New post Posted: Thu 29 Aug, 2013, 15:51 

User rating: 0
Joined: Tue 12 Mar, 2013, 15:57
Posts: 7
Location: Czech Republic, Ostrava
Hello API Support,

I would like to kindly ask whether is possible to publish here example of "Draw on all charts" "on Tick" method.
I mean for instance the mentioned horizontal line(s) (ask,bid) would move based on tick (real time).

Thank you for any response.

J.


 
 Post subject: price line on every tick Post rating: 1   New post Posted: Thu 29 Aug, 2013, 21:55 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
Hi Jiri:

See the example in annex...



Trade well

JL


Attachments:
BidAskLine.java [2.83 KiB]
Downloaded 382 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: draw price level horizontal line in all charts Post rating: 0   New post Posted: Fri 30 Aug, 2013, 08:49 

User rating: 0
Joined: Tue 12 Mar, 2013, 15:57
Posts: 7
Location: Czech Republic, Ostrava
Perfect JL,

Thank you.


 
 Post subject: Re: draw price level horizontal line in all charts Post rating: 0   New post Posted: Fri 30 Aug, 2013, 08:57 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
bidLine = chart.draw("Bid", IChart.Type.HLINE, 0, 0);
Please don't use the deprecated methods, instead use:
IChartObject bidLine = chart.getChartObjectFactory().createHorizontalLine("Bid", tick.getBid());
chart.add(bidLine);
See more here https://www.dukascopy.com/wiki/#Create_and_manage_chart_objects
            instruments = Instrument.values();
            subscribed = new int[instruments.length];
You don't need to take care of the instruments, simply iterate the following way:
public void onTick(Instrument instrument, ITick tick) throws JFException {
        for(IChart chart : context.getCharts()){
and on stop do the following (if there won't be such object the remove will take no effect):
    public void onStop() throws JFException {
        // garbage collect
        for(IChart chart : context.getCharts()){
            chart.remove("Ask");


 
 Post subject: Re: draw price level horizontal line in all charts Post rating: 0   New post Posted: Mon 02 Sep, 2013, 07:39 

User rating: 0
Joined: Tue 12 Mar, 2013, 15:57
Posts: 7
Location: Czech Republic, Ostrava
Hello API Support,

is there any reason why my last question has been deleted?


Regards,
J.


 
 Post subject: Re: price line on every tick Post rating: 0   New post Posted: Mon 02 Sep, 2013, 08:05 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The bug will get fixed with the next JForex-API version.


 
 Post subject: Re: price line on every tick Post rating: 0   New post Posted: Mon 02 Sep, 2013, 08:27 

User rating: 0
Joined: Tue 12 Mar, 2013, 15:57
Posts: 7
Location: Czech Republic, Ostrava
I see, perfect.

Thank you.

J.


 
 Post subject: Re: price line on every tick Post rating: 0   New post Posted: Tue 03 Sep, 2013, 08:57 

User rating: 0
Joined: Tue 12 Mar, 2013, 15:57
Posts: 7
Location: Czech Republic, Ostrava
Hello Api Support,

could you please advise how to get approximate solution (with help of deprecated methods) before the mentioned bug will get resolved?
For strategy "Add custom information in OHLC Index" (again based onTick method) I would need to use it at all opened charts (even same instruments)

https://www.dukascopy.com/wiki/#Add_custom_information_in_OHLC_Index


Thank you in advance

J.


 
 Post subject: Re: price line on every tick Post rating: 0   New post Posted: Tue 03 Sep, 2013, 11:44 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Jiri wrote:
could you please advise how to get approximate solution (with help of deprecated methods) before the mentioned bug will get resolved?
You should ensure the key uniqueness among all charts for each chart object you create.
Jiri wrote:
For strategy "Add custom information in OHLC Index" (again based onTick method) I would need to use it at all opened charts (even same instruments)
Simply iterate through IContext.getCharts() and apply the logic likewise as it is given in the example.


 
 Post subject: Re: price line on every tick Post rating: 0   New post Posted: Wed 04 Sep, 2013, 14:11 

User rating: 0
Joined: Tue 12 Mar, 2013, 15:57
Posts: 7
Location: Czech Republic, Ostrava
Thank you,

It helped.

J.


 

Jump to:  

  © 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