|
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.
Help, the IIndicators not return values. |
illusionriver
|
Post subject: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Fri 24 Feb, 2012, 03:09
|
|
User rating: 0
Joined: Fri 24 Feb, 2012, 03:03 Posts: 9
|
Hi,
I have a question,the IIndicators.t3 about two weeks ago can be used. But now not used, it's retun "Error while loading bars". how can i used IIndicators return values? thanks a lot.
Example: Period period = Period.FIVE_MINS;
IBar prevBar = history.getBar(instrument, period, OfferSide.BID, 1);
int candlesBefore = 1;
int candleAfter = 0;
IIndicators T3IIndicators = null;
double[] slow1 = T3IIndicators.t3(instrument, Period.FIVE_MINS, OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 10, 0.7, Filter.NO_FILTER, candlesBefore, prevBar.getTime(), candleAfter);
|
|
|
|
 |
API Support
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Fri 24 Feb, 2012, 08:36
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
The reason is straightforwardly because of this line: illusionriver wrote: IIndicators T3IIndicators = null; You have to assign a value from context, i.e.: illusionriver wrote: IIndicators T3IIndicators = context.getIndicators();
|
|
|
|
 |
illusionriver
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Fri 24 Feb, 2012, 14:55
|
|
User rating: 0
Joined: Fri 24 Feb, 2012, 03:03 Posts: 9
|
API Support wrote: The reason is straightforwardly because of this line: illusionriver wrote: IIndicators T3IIndicators = null; You have to assign a value from context, i.e.: illusionriver wrote: IIndicators T3IIndicators = context.getIndicators(); sorry, IIndicators T3IIndicators = context.getIndicators(); this code i forget copy . i used it static. about two weeks ago can be used. Is not API update problem? the methed is chenged? thanks ~
|
|
|
|
 |
illusionriver
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Wed 29 Feb, 2012, 04:25
|
|
User rating: 0
Joined: Fri 24 Feb, 2012, 03:03 Posts: 9
|
|
|
|
 |
API Support
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Wed 29 Feb, 2012, 17:31
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Please try the following strategy: package jforex.strategies.indicators;
import java.util.Arrays;
import com.dukascopy.api.*;
public class T3test implements IStrategy { private IIndicators indicators; private IConsole console; private IHistory history;
@Override public void onStart(IContext context) throws JFException { console = context.getConsole(); indicators = context.getIndicators(); history = context.getHistory(); IBar prevBar = history.getBar(Instrument.EURUSD, Period.FIVE_MINS, OfferSide.BID, 1);
double[] result = indicators.t3(Instrument.EURUSD, Period.FIVE_MINS, OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 10, 0.7, Filter.NO_FILTER, 1, prevBar.getTime(), 0); console.getOut().println("result="+ Arrays.toString(result)); }
public void onTick(Instrument instrument, ITick tick) throws JFException {} public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {} public void onMessage(IMessage message) throws JFException {} public void onAccount(IAccount account) throws JFException {} public void onStop() throws JFException {}
}
|
|
|
|
 |
illusionriver
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Mon 05 Mar, 2012, 08:57
|
|
User rating: 0
Joined: Fri 24 Feb, 2012, 03:03 Posts: 9
|
the error exception with "Error while loading bars" at double[] result = indicators.t3(Instrument.EURUSD, Period.FIVE_MINS, OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 10, 0.7, Filter.NO_FILTER, 1, prevBar.getTime(), 0);
please
|
|
|
|
 |
API Support
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Mon 05 Mar, 2012, 16:00
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
illusionriver
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Mon 05 Mar, 2012, 17:04
|
|
User rating: 0
Joined: Fri 24 Feb, 2012, 03:03 Posts: 9
|
API Support wrote: please provide messages that you receive in the java console: viewtopic.php?f=81&t=39073the error is "Error while loading bars" , the parameter is Period.ONE_MIN will fine. if this code: double[] result = indicators.t3(Instrument.EURUSD, Period.ONE_MIN , OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 10, 0.7, Filter.NO_FILTER, 1, prevBar.getTime(), 0); not is excepiton. please.
|
|
|
|
 |
API Support
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Tue 06 Mar, 2012, 09:03
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
We can't reproduce the problem. Please provide full stack trace from your java console (not the Messages tab).
|
|
|
|
 |
illusionriver
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Thu 08 Mar, 2012, 06:34
|
|
User rating: 0
Joined: Fri 24 Feb, 2012, 03:03 Posts: 9
|
API Support wrote: We can't reproduce the problem. Please provide full stack trace from your java console (not the Messages tab). at com.dukascopy.api.impl.b.calculateIndicator(Instrument i1, Period p, OfferSide[] osarr, String str, AppliedPrice[] iiaparr, Object[] objarr, Filter f, Int32 i2, Int64 l, Int32 i3) at com.dukascopy.api.impl.b.t3(Instrument i1, Period p, OfferSide os, AppliedPrice iiap, Int32 i2, Double d, Filter f, Int32 i3, Int64 l, Int32 i4) i don't know is the time difference related or new api limit value of point in time. please
|
|
|
|
 |
API Support
|
Post subject: Re: Help, the IIndicators not return values. |
Post rating: 0
|
Posted: Thu 08 Mar, 2012, 10:20
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
For more efficient assistance, please provide the full stack trace.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|