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.

how to calculate custom indicator values in a strategy using a custom price range feed (period) ?
 Post subject: how to calculate custom indicator values in a strategy using a custom price range feed (period) ? Post rating: 0   New post Posted: Sat 21 Jan, 2012, 11:38 
User avatar

User rating: 1
Joined: Wed 06 Jul, 2011, 23:12
Posts: 42
Location: Romania, Bucharest
Dear API Support,

I have a strategy which subscribes to a custom indicator and calculates values for this indicator for deciding buy and sell. I use an Object[] array to get the indicator results by shift, like in the example bellow.

Object[] resultByShift = indicators.calculateIndicator(selectedInstrument, selectedPeriod, new OfferSide[] { OfferSide.BID }, indicatorName, new IIndicators.AppliedPrice[] { IIndicators.AppliedPrice.CLOSE }, optionalInputArray, shift);



My question is, can a pass a custom 2 pips bar period in the method above for the calculation of my custom indicator? I understand from wikki that I need to define that custom period and to subscribe to the specific RangeBarListener but unfortunately I couldn't make it work.

I need to run this strategy in LIVE JForex platform which now has API version 2.6.33

Reading the previous forum posts, I found this possible solution bellow which doesn't seem to work on my live jforex plaform:

IFeedDescriptor feedDescriptor = new FeedDescriptor();
feedDescriptor.setDataType(DataType.PRICE_RANGE_AGGREGATION);
feedDescriptor.setOfferSide(OfferSide.BID);
feedDescriptor.setInstrument(Instrument.EURUSD);
feedDescriptor.setPriceRange(PriceRange.valueOf(priceRangePips));

Object[] resultByShift = indicators.calculateIndicator(feedDescriptor, new OfferSide[] { OfferSide.BID }, indicatorName, new IIndicators.AppliedPrice[] { IIndicators.AppliedPrice.CLOSE }, optionalInputArray, shift);



Can you please offer some solution?

Thank you very much in advance!
Iulian


 
 Post subject: Re: how to calculate custom indicator values in a strategy using a custom price range feed (period) ? Post rating: 0   New post Posted: Mon 23 Jan, 2012, 09:57 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You have 2 options:
  1. Use Standalone API, which uses JForex-API 2.6.53 and to which you can use your LIVE login. JForex-API 2.6.53 supports range bar feeds, range bar history and indicator calculation on range bar feeds.
  2. Use JForex LIVE Client which uses JForex-API 2.6.33 and virtually does not support range bars from strategy - you have to do all the necessary calculations yourself.

If you choose the latter, note that there is no range range bar feed available from strategy in JForex-API 2.6.33 - thus if you want to work with range bars on that version you need to build them from ticks yourself + calculate indicator on price array by managing yourself the inputs, optional inputs and outputs, here is an example strategy which does that:

Attachment:
RangeBarsHistory2Fix4Live.java [8.66 KiB]
Downloaded 301 times


 

Jump to:  

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