Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Indicator values on chart don't match values in strategy for timeframes of more than 4 hours
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=16&t=56375
Page 1 of 1

Author:  mistvak [ Tue 13 Mar, 2018, 10:32 ]
Post subject:  Indicator values on chart don't match values in strategy for timeframes of more than 4 hours

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.

Author:  isomorph [ Fri 11 Jan, 2019, 00:07 ]
Post subject:  Re: Indicator values on chart don't match values in strategy for timeframes of more than 4 hours

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.

  Page 1 of 1