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.

bug in jforex
 Post subject: bug in jforex Post rating: 0   New post Posted: Mon 11 Oct, 2010, 20:45 

User rating: 0
Joined: Tue 28 Sep, 2010, 09:41
Posts: 18
Hello I found bug in JForex

I have my custom indicator in JForex for calculating correlation between currency pairs.
The indicator is calculating the correlation index from last "n" bars.
For example from last 14 bars, so there is LookBack!! And here is problem with the lookback when there is weekend:

When you will add the indicator into chart, you can see that the chart does not contain weekends.
So imagine indicator has some values at monday morning and these values are calculated from previous fridays bars. That is OK.

BUT when you are using the indicator in some strategy, at the monday morning the strategy calculate different values. And why? Because strategy is calculating the indicator values from weekends bars.


So the thing is: When you have some indicator (displayed in chart) which has some lookBack for his calculations, the indicator has some values at monday morning.
But the same indicator, with the same parameters will have DIFFERENT values at monday morning when it is calculated from strategy.

I think the reason of this is that indicators displayed in chart are not taking the lookBack bars from weekend - but the same indicator calculated in strategy is taking the lookBack bars from weekend - so there are different values.


Do you understand what I mean?
Sorry for my english, If you dont understand what I tried to say just let me know I will try to describe it with other words or I can attach some screenshots what I mean..
Btw: here is code of the my correlation indicator
https://files.lorencsoftware.cz/20000007 ... BPUSD.java


 
 Post subject: Re: bug in jforex Post rating: 0   New post Posted: Tue 12 Oct, 2010, 09:10 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello,
Thanks for you post. There is a functions for indicator calculation that accepts Filter parameter. There you can pass Filter.WEEKENDS as a parameter to filter out weekly flats. Also there is a Period.DAILY_SUNDAY_IN_MONDAY and Period.DAILY_SKIP_SUNDAY which are daily periods with specific logic for sunday candle.


 
 Post subject: Re: bug in jforex Post rating: 0   New post Posted: Tue 12 Oct, 2010, 15:23 

User rating: 0
Joined: Tue 28 Sep, 2010, 09:41
Posts: 18
Hello

I guess you mean that I should use this method:
https://www.dukascopy.com/client/javadoc ... Instrument, com.dukascopy.api.Period, com.dukascopy.api.OfferSide[], java.lang.String, com.dukascopy.api.IIndicators.AppliedPrice[], java.lang.Object[], com.dukascopy.api.Filter, int, long, int)

Can you please show me an example of usage?
I dont understand what the parametrs
int numberOfCandlesBefore,
long time,
int numberOfCandlesAfter

are used for, even there is description of these parametrs.

Thank you


 
 Post subject: Re: bug in jforex Post rating: 0   New post Posted: Wed 13 Oct, 2010, 12:42 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
here nice sample https://www.dukascopy.com/wiki/index.php/Indicators


 

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