|
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 get the value of an indicator |
[trottel]
|
Post subject: How to get the value of an indicator |
Post rating: 0
|
Posted: Mon 02 May, 2011, 13:06
|
|
User rating: 0
Joined: Wed 27 Apr, 2011, 13:56 Posts: 18
|
I'm trying to get the value of SMA. The onBar() method looks so:
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { if (period != this.period) { return; }
double value = indicators.sma(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 13, 0);
console.getOut().println("indicators value: " + value); }
the period is Period.ONE_MINUTE and the instrument is Instrument.EURUSD
After 3 minutes I get the following output:
12:02:01 indicators value: 81.42715384615384 12:02:00 indicators value: 1.669025 12:02:00 indicators value: 1.4836992307692307 12:02:00 indicators value: 0.8664776923076923 12:01:01 indicators value: 0.8664773076923076 12:01:01 indicators value: 1.6690465384615387 12:01:01 indicators value: 1.4836573076923079 12:01:01 indicators value: 81.42865384615385 11:57:01 indicators value: 81.42920000000001 11:57:01 indicators value: 1.668977 11:57:01 indicators value: 1.483607 11:57:00 indicators value: 0.8665660000000001
I think all the values starting with 1.48 are correct, but what mean all the other values? What do I wrong? Please help.
|
|
|
|
 |
[trottel]
|
Post subject: Re: How to get the value of an indicator |
Post rating: 0
|
Posted: Mon 02 May, 2011, 17:08
|
|
User rating: 0
Joined: Wed 27 Apr, 2011, 13:56 Posts: 18
|
Solved with indicators.ma(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 13, IIndicators.MaType.SMA, 0); call
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|