|
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.
Using non standard time frame for indicator |
docotor
|
Post subject: Using non standard time frame for indicator |
Post rating: 0
|
Posted: Thu 18 Jun, 2015, 16:23
|
|
User rating: 0
Joined: Thu 12 Dec, 2013, 09:24 Posts: 21 Location: Ukraine, Kyiv
|
I have the following challenge. I need to automate strategy with non standard time frame ( 3 min, 2H, 8H ). For strategy to work properly I need to have access to 3min ema indicator. In order to achieve it in my class declaration I wrote the following:
import java.util.*;
import com.dukascopy.api.*; import com.dukascopy.api.feed.*; import com.dukascopy.api.feed.util.*; import com.dukascopy.api.IIndicators.AppliedPrice;
public class NeuralNetworkSniper implements IStrategy { public Period period3Min = Period.createCustomPeriod(Unit.Minute, 3);
/*here goes onStart, onAccount, etc. functions*/
private double eMaValue(long period, long shift)throws JFException { double ema = indicators.ema(Instrument.EURUSD, period3Min , OfferSide.ASK, AppliedPrice.CLOSE, 5, shift); return ema; } }
but when I try to compile I receive following error message:
2015-06-18 18:21:03 ---------- 2015-06-18 18:21:03 The method ema(Instrument, Period, OfferSide, IIndicators.AppliedPrice, int, int) in the type IIndicators is not applicable for the arguments (Instrument, Period, OfferSide, IIndicators.AppliedPrice, int, long) 2015-06-18 18:21:03 ^^^ 2015-06-18 18:21:03 double ema = indicators.ema(Instrument.EURUSD, period3Min , OfferSide.ASK, AppliedPrice.CLOSE, 5, shift); 2015-06-18 18:21:03 1. ERROR in C:\Users\yzaletskyy\AppData\Local\JForex\yzaletskyy\jfxide\tmp\compile\NeuralNetworkSniper.java (at line 123) 2015-06-18 18:21:03 ----------
does anybody knows how can I get needed information?
|
|
|
|
 |
tcsabina
|
Post subject: Re: Usint non standard time frame for indicator |
Post rating: 0
|
Posted: Mon 22 Jun, 2015, 10:09
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
|
|
|
 |
docotor
|
Post subject: Re: Using non standard time frame for indicator |
Post rating: 0
|
Posted: Tue 23 Jun, 2015, 20:40
|
|
User rating: 0
Joined: Thu 12 Dec, 2013, 09:24 Posts: 21 Location: Ukraine, Kyiv
|
Here is how I solved it:
///Returns ema for period, with shift private double eMaValue(int period, int shift)throws JFException { double ema = indicators.ema(currentInstrument, period3Min , OfferSide.ASK, AppliedPrice.CLOSE, period, shift); return ema; }
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|