Dukascopy
 
 
Wiki JStore Search Login

JFOREX-3194 Indicator IBars-BID is shifted
 Post subject: JFOREX-3194 Indicator IBars-BID is shifted Post rating: 0   New post Posted: Sun 31 Jul, 2011, 21:54 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
When passing an IBar with OfferSide ASK as the first parameter and an IBar with OfferSide BID as the second parameter to an indicator, depending on the timeframe sometimes the passed BID bar (the 2nd input argument) is shifted forward by 1 period.

I've attached an indicator source for showing the min/max/close spread of the bars in the chart.
When this indicator is run on EUR/CHF on the ONE_MINUTE timeframe, the BID bar will be shifted by 1 period into the future.

I've included a workaround in the code and a logging that shows the shifting..

Example: With the attached indicator run on EUR/CHF on the 1 minute timeframe, the following messages are written to the console:
Quote:
...
21:43:56 ERROR - BID shifted forward: 3.6p ASK=1311970740000[2011-07-29 20:19:00.000+0000] O: 1.1314 C: 1.13167 H: 1.13167 L: 1.1314 V: 44.0 BID=1311970800000[2011-07-29 20:20:00.000+0000] O: 1.13145 C: 1.13147 H: 1.13149 L: 1.13145 V: 13.0
21:43:56 ERROR - BID shifted forward: 2.9p ASK=1311970680000[2011-07-29 20:18:00.000+0000] O: 1.13176 C: 1.13141 H: 1.13183 L: 1.13141 V: 83.0 BID=1311970740000[2011-07-29 20:19:00.000+0000] O: 1.13107 C: 1.13147 H: 1.13147 L: 1.13107 V: 53.0
21:43:56 ERROR - BID shifted forward: 2.7p ASK=1311970620000[2011-07-29 20:17:00.000+0000] O: 1.13177 C: 1.13171 H: 1.13177 L: 1.13164 V: 37.0 BID=1311970680000[2011-07-29 20:18:00.000+0000] O: 1.13145 C: 1.13105 H: 1.13158 L: 1.13105 V: 81.0
21:43:56 ERROR - BID shifted forward: 3.0p ASK=1311970560000[2011-07-29 20:16:00.000+0000] O: 1.13188 C: 1.13174 H: 1.13188 L: 1.13174 V: 45.0 BID=1311970620000[2011-07-29 20:17:00.000+0000] O: 1.13147 C: 1.13142 H: 1.13147 L: 1.13137 V: 33.0
21:43:56 ERROR - BID shifted forward: 4.3p ASK=1311970500000[2011-07-29 20:15:00.000+0000] O: 1.13177 C: 1.13188 H: 1.13197 L: 1.13176 V: 39.0 BID=1311970560000[2011-07-29 20:16:00.000+0000] O: 1.13157 C: 1.13147 H: 1.13157 L: 1.13142 V: 37.0
21:43:56 ERROR - BID shifted forward: 5.6p ASK=1311970440000[2011-07-29 20:14:00.000+0000] O: 1.13218 C: 1.13175 H: 1.13225 L: 1.13173 V: 68.0 BID=1311970500000[2011-07-29 20:15:00.000+0000] O: 1.13134 C: 1.13158 H: 1.13158 L: 1.13131 V: 32.0
21:43:56 ERROR - BID shifted forward: 4.2p ASK=1311970380000[2011-07-29 20:13:00.000+0000] O: 1.13245 C: 1.1322 H: 1.13245 L: 1.13216 V: 34.0 BID=1311970440000[2011-07-29 20:14:00.000+0000] O: 1.1316 C: 1.13132 H: 1.13167 L: 1.13131 V: 63.0
21:43:56 ERROR - BID shifted forward: 5.1p ASK=1311970320000[2011-07-29 20:12:00.000+0000] O: 1.13199 C: 1.13245 H: 1.1325 L: 1.13199 V: 59.0 BID=1311970380000[2011-07-29 20:13:00.000+0000] O: 1.13204 C: 1.13164 H: 1.13204 L: 1.1316 V: 28.0
21:43:56 ERROR - BID shifted forward: 2.2p ASK=1311970260000[2011-07-29 20:11:00.000+0000] O: 1.13193 C: 1.13199 H: 1.13199 L: 1.13184 V: 36.0 BID=1311970320000[2011-07-29 20:12:00.000+0000] O: 1.13149 C: 1.13203 H: 1.13203 L: 1.13149 V: 60.0
...



Best regards,
RR.


Attachments:
File comment: Indicator to show spreads
Spread.java [6.28 KiB]
Downloaded 434 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Indicator IBars ASK and BID as input. BID is shifted!! Post rating: 0   New post Posted: Mon 01 Aug, 2011, 09:50 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
Despite the auto-correction of the shifted BID-bar, I'm getting negative spread from time to time on the lower timeframes.

example: EUR/USD, timeframe = TEN_SECS
Quote:
08:42:36 ERROR - negative spread at Close: -0.3p ASK={T:1312188170000(2011-08-01 08:42:50.000+0000)E:false O:1.4399 C:1.4399 L:1.4399 H:1.4399 V2.25} BID={T:1312188170000(2011-08-01 08:42:50.000+0000)E:false O:1.43984 C:1.43993 L:1.43984 H:1.43993 V3.12}


Are there problems with the datafeed?

Best, RR.

P.S.:
here are further examples on EUR/USD, timeframe TEN_SECS from the live datafeed:
Quote:
08:49:15 ERROR - negative spread: -0.5p ASK={T:1312188570000(2011-08-01 08:49:30.000+0000)E:falseO:1.43941C:1.43941L:1.43941H:1.43941V1.88} BID={T:1312188570000(2011-08-01 08:49:30.000+0000)E:falseO:1.43935C:1.43946L:1.43935H:1.43946V2.63}
08:48:24 ERROR - negative spread: -0.2p ASK={T:1312188510000(2011-08-01 08:48:30.000+0000)E:falseO:1.43918C:1.43908L:1.43906H:1.43922V23.28} BID={T:1312188510000(2011-08-01 08:48:30.000+0000)E:falseO:1.4391C:1.4391L:1.43897H:1.43915V34.41}
08:48:10 ERROR - negative spread: -0.6p ASK={T:1312188500000(2011-08-01 08:48:20.000+0000)E:falseO:1.43908C:1.4391L:1.43908H:1.4391V11.48} BID={T:1312188500000(2011-08-01 08:48:20.000+0000)E:falseO:1.43899C:1.43916L:1.43899H:1.43916V16.08}
08:47:04 ERROR - negative spread: -0.5p ASK={T:1312188430000(2011-08-01 08:47:10.000+0000)E:falseO:1.43907C:1.43905L:1.43892H:1.43907V36.1} BID={T:1312188430000(2011-08-01 08:47:10.000+0000)E:falseO:1.43899C:1.4391L:1.43885H:1.4391V34.24}
08:46:28 ERROR - negative spread: -0.9p ASK={T:1312188400000(2011-08-01 08:46:40.000+0000)E:falseO:1.43917C:1.43919L:1.43916H:1.43919V14.64} BID={T:1312188400000(2011-08-01 08:46:40.000+0000)E:falseO:1.43911C:1.43928L:1.43908H:1.43928V10.51}
08:42:36 ERROR - negative spread: -0.3p ASK={T:1312188170000(2011-08-01 08:42:50.000+0000)E:falseO:1.4399C:1.4399L:1.4399H:1.4399V2.25} BID={T:1312188170000(2011-08-01 08:42:50.000+0000)E:falseO:1.43984C:1.43993L:1.43984H:1.43993V3.12}


 
 Post subject: Re: Indicator IBars ASK and BID as input. BID is shifted!! Post rating: 0   New post Posted: Mon 01 Aug, 2011, 11:54 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
on EUR/USD DAILY we re getting even more abstruse ASK/BID pairs:

Quote:
10:50:24 ERROR - BID shifted forward: 0.8p ASK=1289347200000[2010-11-10 00:00:00.000+0000] O: 1.37692 C: 1.37756 H: 1.38257 L: 1.36711 V: 126917.7 BID=1312156800000[2011-08-01 00:00:00.000+0000] O: 1.43793 C: 1.44379 H: 1.44533 L: 1.43455 V: 116856.63
10:50:24 ERROR - BID shifted forward: 1.4p ASK=1289260800000[2010-11-09 00:00:00.000+0000] O: 1.3863 C: 1.377 H: 1.39743 L: 1.37492 V: 121974.9 BID=1311897600000[2011-07-29 00:00:00.000+0000] O: 1.43263 C: 1.43925 H: 1.44127 L: 1.42295 V: 262426.0
10:50:24 ERROR - BID shifted forward: 212.6p ASK=1289174400000[2010-11-08 00:00:00.000+0000] O: 1.40756 C: 1.38644 H: 1.40861 L: 1.38605 V: 130042.4 BID=1311811200000[2011-07-28 00:00:00.000+0000] O: 1.43607 C: 1.43264 H: 1.44001 L: 1.42543 V: 254362.0
10:50:24 ERROR - BID shifted forward: 21.0p ASK=1289088000000[2010-11-07 00:00:00.000+0000] O: 1.40621 C: 1.40756 H: 1.40816 L: 1.40449 V: 8074.7 BID=1311724800000[2011-07-27 00:00:00.000+0000] O: 1.45076 C: 1.43608 H: 1.45356 L: 1.43389 V: 248645.0


Best, RR.


 
 Post subject: Re: JFOREX-3194 Indicator IBars-BID is shifted Post rating: 0   New post Posted: Fri 09 Dec, 2011, 10:21 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Indicator inputs have to be explicitly synchronized.
Please take a look at https://www.dukascopy.com/wiki/index.php?title=Indicator_with_multiple_inputs


 
 Post subject: Re: JFOREX-3194 Indicator IBars-BID is shifted Post rating: 0   New post Posted: Fri 09 Dec, 2011, 14:00 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
Dear Support,

Thank you very much for your reply!

That now makes sense.
It's quite dangerous though, because users might not be aware of this synchronisation pitfall.

Would it be possible to add a feature on your side to force synchronised inputs for all indicators-inputs using the same timeframe?

Best regards,
RR.


 
 Post subject: Re: JFOREX-3194 Indicator IBars-BID is shifted Post rating: 0   New post Posted: Fri 09 Dec, 2011, 14:44 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Yes, it would. We will implement it in the near future.


 
 Post subject: Re: JFOREX-3194 Indicator IBars-BID is shifted Post rating: 0   New post Posted: Fri 09 Dec, 2011, 15:28 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
That's great, thank you very much.
Do you plan to include it in the 2.6.51 release?

Best, RR.


 

Jump to:  

cron
  © 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