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.

EA for time remaining to candle's close
 Post subject: EA for time remaining to candle's close Post rating: 0   New post Posted: Mon 30 Sep, 2013, 09:43 

User rating: 0
Joined: Fri 19 Apr, 2013, 15:09
Posts: 3
Location: Poland, Warsaw
Hi guys,

I'm looking for EA that shows time remaining to the close of a candle.
Anybody can help me with that pls pm me to [email protected]

thanx in advance,
Greg


 
 Post subject: Re: EA for time remaining to candle's close Post rating: 0   New post Posted: Wed 02 Oct, 2013, 16:18 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It would be much easier to implement it from a strategy - consider updating an ITextChartObject on every new tick - i.e. in the IStrategy.onTick method.
The unfinished bar start time and the remaining time you will get the following way:
long barStart = history.getBarStart(chart.getFeedDescriptor().getPeriod(), tick.getTime());
long remainingSecs = TimeUnit.MILLISECONDS.toSeconds(tick.getTime() - barStart);
for more on bar history methods see:
https://www.dukascopy.com/wiki/#History_bars
Place on chart and manage chart objects in the following way:
https://www.dukascopy.com/wiki/#Create_and_manage_chart_objects
In particular, see here the example for the text object usage:
https://www.dukascopy.com/wiki/#Chart_object_catalog


 
 Post subject: Re: EA for time remaining to candle's close Post rating: 1   New post Posted: Thu 03 Oct, 2013, 09:15 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
I beg your pardon, but there is some problem with this method:
There is no guarantee that a tick will arrive within a second, so the updating part could be delayed...

A much better approach if you setup a scheduler that runs the update task every second.


 
 Post subject: Re: EA for time remaining to candle's close Post rating: 0   New post Posted: Thu 03 Oct, 2013, 09:42 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tcsabina wrote:
A much better approach if you setup a scheduler that runs the update task every second.
Yes, this would be a more robust solution. In first step one could implement the logic by using the onTick method and then in the second step move the update logic to the scheduler.


 

Jump to:  

cron
  © 1998-2026 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