Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Indicator values on chart don't match values in strategy for timeframes of more than 4 hours
 Post subject: Indicator values on chart don't match values in strategy for timeframes of more than 4 hours Post rating: 0   New post Posted: Tue 13 Mar, 2018, 10:32 

User rating: 0
Joined: Fri 02 Mar, 2018, 04:23
Posts: 12
Location: Cambodia,
I have observed that an SMA value calculated in a strategy does not quite match the value shown by the indicator on the chart if the time frame is four hours or greater. This seems to be the case for other indicators, as well.

To demonstrate this I made small modifications to the SMASmallExample.java strategy that is included in JForex.

You can see those modifications and get the modified strategy here on Github.

Revision 1: Copy-paste the SMASmallExample.java as is
Revision 2: Add a write line for debugging and move the early return so that the write line always runs.
Revision 3: Change the time frame from 10 minutes to 4 hours.

After revision 2, everything works as expected. I make sure my chart is using weekend filter and the bid price (like the strategy). I set the time frame to 10 minutes, like in the strategy. I add an SMA indicator with 30 periods. I run the strategy on historical data. I observe that the previous SMA value is always equal to the value being printed to the console, as shown below.

Image

However, after revision 3, where I change the time frame to four hours, things don't work as expected. I set my chart time frame to four hours, but the indicator value in the chart and in the console are not quite the same, as shown below.

Image

For any time frame of less than four hours, behavior is as expected. But for any time frame four hours or greater, the indicator value on the chart and in the console do not match. Usually the difference is small, but it varies.


 
 Post subject: Re: Indicator values on chart don't match values in strategy for timeframes of more than 4 hours Post rating: 0   New post Posted: Fri 11 Jan, 2019, 00:07 
User avatar

User rating: 0
Joined: Tue 26 Jan, 2016, 04:18
Posts: 16
Location: CanadaCanada
I see there was no reply on the forum. Did you get a reply via email? If so, could you please share it here. I am curious to know why this error occurred.


 

Jump to:  

  © 1998-2011 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