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.

Indicator with two BAR type inputs
 Post subject: Indicator with two BAR type inputs Post rating: 0   New post Posted: Tue 10 Mar, 2015, 21:03 
User avatar

User rating: 0
Joined: Tue 10 Mar, 2015, 00:17
Posts: 6
Location: Poland,
Hi guys,

I want to code an indicator that would show current high/low of higher timeframe on a lower timeframe (and plot it as a line). Therefore I need to have info that a new higher tf bar has started (to reset high/low). As far as I understand jForex API I need two inputs: Bars from higher tf to know if the new bar arrived and bars for the lower tf to calc if the high/low of the lower tf is the extreme from the start of the higher bar. Is that possible in jForex ?

Btw. do you know any tutorials, books about jForex API (I have no problem with java itself but the javadocs and wiki being really a joke not a documentation make it really hard to understand how to construct indicators in jForex API) ?

Regards,
K.


 
 Post subject: Re: Indicator with two BAR type inputs Post rating: 0   New post Posted: Mon 16 Mar, 2015, 14:14 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
If an indicator needs bars from higher period please use the following InputParameterInfo object
new InputParameterInfo("Higher period", InputParameterInfo.Type.BAR) {{
    setPeriod(Period.ONE_HOUR);
}


Indicator usage tutorials can be found here:
https://www.dukascopy.com/wiki/#Indicator_API:_Overview


 
 Post subject: Re: Indicator with two BAR type inputs Post rating: 0   New post Posted: Mon 16 Mar, 2015, 20:01 
User avatar

User rating: 0
Joined: Tue 10 Mar, 2015, 00:17
Posts: 6
Location: Poland,
6 days, I mean R E A L L Y ?
I will probably die of old age before you answer my next question but I will try nevertheless:

I code & compile w/o any problems an indicator. In both onstart and calculate methods I have console.getOut().println(sth) statements but only the one in the onstart shows in the message tab. When I recompile, save etc. still only onstart prints. Is this intended ?
fields in IIndicator:
private IIndicatorContext indicatorContext;
    private IConsole console;


in onStart:
 this.indicatorContext = context;
        console = context.getConsole();
        console.getOut().println("Started");


in calculate:
console.getOut().println(outputs[0][i] + " || i: " + i);


In the above case only "Started" prints.

Thanks in advance.

*** EDIT ***
Nevermind, solved it.
Btw.: Is it taking so much time for you to answer because you look up the answers in your very informative wiki ?


 

Jump to:  

  © 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