|
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.
Custom period time bar in strategy - actual bars problem |
lifon
|
Post subject: Custom period time bar in strategy - actual bars problem |
Post rating: 0
|
Posted: Sun 12 Apr, 2015, 18:28
|
|
User rating: 1
Joined: Mon 27 Feb, 2012, 22:49 Posts: 119 Location: Czech Republic,
|
Hello support,
I want to use in my strategy custom time period bar (3 minutes). I can take bars from history, but I don’t receive actual bars (I make subscription) in historical tester and from live data too. I made some checking strategy - it is as an attachment.
What is wrong?
Thanks for help.
Attachments: |
AAcheckCustomTimeBarFeed.java [3.29 KiB]
Downloaded 89 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.
|
|
|
|
|
|
API Support
|
Post subject: Re: Custom period time bar in strategy - actual bars problem |
Post rating: 0
|
Posted: Mon 13 Apr, 2015, 13:15
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
IStrategy.onBar() method is called only on bars for basic periods. To handle notifications on bars for custom period one should implement IBarFeedListener interface and place his code to IBarFeedListener.onBar() method. ... public class AAcheckCustomTimeBarFeed implements IStrategy, IBarFeedListener { ... @Override public void onStart( IContext context ) throws JFException { ... context.subscribeToBarsFeed( Instrument.EURUSD, CustomPeriod, OfferSide.ASK, this ); context.subscribeToBarsFeed( Instrument.EURUSD, CustomPeriod, OfferSide.BID, this ); }
@Override public void onBar( Instrument instrument, Period period, OfferSide offerSide, IBar bar ) { // place your code here } ... } Also please see the wiki https://www.dukascopy.com/wiki/#Chart_f ... _to_a_feed
|
|
|
|
|
lifon
|
Post subject: Re: Custom period time bar in strategy - actual bars problem |
Post rating: 0
|
Posted: Mon 13 Apr, 2015, 15:20
|
|
User rating: 1
Joined: Mon 27 Feb, 2012, 22:49 Posts: 119 Location: Czech Republic,
|
Hello support,
I made changes (mainly "implements IBarFeedListener" ). Method onBar I had OK. But I still don't have actual custom bars.
Wiki (in link) doesn't include any mention about IBarFeedListener.
What is wrong?
Thans for help.
Attachments: |
AAcheckCustomTimeBarFeed.java [3.94 KiB]
Downloaded 105 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.
|
|
|
|
|
|
API Support
|
Post subject: Re: Custom period time bar in strategy - actual bars problem |
Post rating: 0
|
Posted: Tue 14 Apr, 2015, 08:12
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
That is because IBarFeedListener that is passed into subscribe method is empty. The object that is passed into the subscribe method should have event processing code. context.subscribeToBarsFeed( Instrument.EURUSD, Period.TEN_SECS, OfferSide.ASK, new IBarFeedListener() { public void onBar( Instrument instrument, Period period, OfferSide offerSide, IBar bar ) { // add code here console.getOut().println("print"); } } );
|
|
|
|
|
lifon
|
Post subject: Re: Custom period time bar in strategy - actual bars problem |
Post rating: 0
|
Posted: Tue 14 Apr, 2015, 10:22
|
|
User rating: 1
Joined: Mon 27 Feb, 2012, 22:49 Posts: 119 Location: Czech Republic,
|
Support, thanks for advise. In "subscribeToBarsFeed" is "this" for me better. I miss it in previous advise.
Feed bars give separately Ask and Bid bars. I make some small improvement to get feed bars in standard onBar method - in attachment. Next feed bars processing could be the same as a standard bars processing.
Attachments: |
AAcheckCustomTimeBarFeed.java [4.64 KiB]
Downloaded 97 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.
|
|
|
|
|
|
lifon
|
Post subject: Re: Custom period time bar in strategy - actual bars problem |
Post rating: 0
|
Posted: Sat 23 May, 2015, 11:27
|
|
User rating: 1
Joined: Mon 27 Feb, 2012, 22:49 Posts: 119 Location: Czech Republic,
|
I made simple code for multiple bar feed.
Attachments: |
AAcheckCustomTimeBarFeedMulti.java [5.15 KiB]
Downloaded 113 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.
|
|
|
|
|
|
|
Pages: [
1
]
|
|
|
|
|