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.

EMA shift and flats filter
 Post subject: EMA shift and flats filter Post rating: 0   New post Posted: Mon 21 Mar, 2011, 14:19 

User rating: 0
Joined: Wed 15 Dec, 2010, 03:57
Posts: 14
Hi,

I need a little help..

Currently I'm using this code for my ''shifted ema'' :
EMA = indicators.ema(Instrument.instrument, Period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, Period, 1)


I want to add a filter to remove the flats....

I can't find the appropriate code to do so...

How can I solve this ???

Thx in advance for help


 
 Post subject: Re: EMA shift and flats filter Post rating: 0   New post Posted: Mon 21 Mar, 2011, 17:47 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Please have a look at the following JForex Wiki article: https://www.dukascopy.com/wiki/index.php ... Indicators


 
 Post subject: Re: EMA shift and flats filter Post rating: 0   New post Posted: Mon 28 Mar, 2011, 03:02 

User rating: 0
Joined: Wed 15 Dec, 2010, 03:57
Posts: 14
Thank You support for pointing to that page..

I think I know how to add the filter to my EMA,
however I still don't know how to obtain my EMA value for a previous bar.....????


 
 Post subject: Re: EMA shift and flats filter Post rating: 0   New post Posted: Mon 28 Mar, 2011, 08:01 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Please have a look at the following code:
long prevBarTime = context.getHistory().getBar(Instrument.EURUSD, Period.THIRTY_MINS, OfferSide.BID, 1).getTime();                           
double[] filteredEMA = context.getIndicators().ema(Instrument.EURUSD, Period.THIRTY_MINS, OfferSide.BID, AppliedPrice.CLOSE, 50, Filter.ALL_FLATS, 1, prevBarTime, 0);
console.getOut().println(filteredEMA[0]);


 
 Post subject: Re: EMA shift and flats filter Post rating: 0   New post Posted: Mon 28 Mar, 2011, 13:46 

User rating: 0
Joined: Wed 15 Dec, 2010, 03:57
Posts: 14
Support wrote:
Hi,
Please have a look at the following code:
long prevBarTime = context.getHistory().getBar(Instrument.EURUSD, Period.THIRTY_MINS, OfferSide.BID, 1).getTime();                           
double[] filteredEMA = context.getIndicators().ema(Instrument.EURUSD, Period.THIRTY_MINS, OfferSide.BID, AppliedPrice.CLOSE, 50, Filter.ALL_FLATS, 1, prevBarTime, 0);
console.getOut().println(filteredEMA[0]);


Thank You for a super fast answer,

I was missing this parts
context.getHistory().getBar and context.getIndicators().ema..

Thank You again


 

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