|
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 |
[Cyps3178]
|
Post subject: EMA shift and flats filter |
Post rating: 0
|
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
|
|
|
|
 |
API Support
|
Post subject: Re: EMA shift and flats filter |
Post rating: 0
|
Posted: Mon 21 Mar, 2011, 17:47
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
[Cyps3178]
|
Post subject: Re: EMA shift and flats filter |
Post rating: 0
|
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.....????
|
|
|
|
 |
API Support
|
Post subject: Re: EMA shift and flats filter |
Post rating: 0
|
Posted: Mon 28 Mar, 2011, 08:01
|
|
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]);
|
|
|
|
 |
[Cyps3178]
|
Post subject: Re: EMA shift and flats filter |
Post rating: 0
|
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
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|