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

Issue open price on bar just opened
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=16&t=57883
Page 1 of 1

Author:  masmox [ Fri 01 Jul, 2022, 08:49 ]
Post subject:  Issue open price on bar just opened

Hello,

I'm using the simple code, see attached, to read the bar open price, that is the bar has just opened, and the previous bar close. Everytime, the open and close are the same and this seems very strange. This impact on my strategy where I go to set pending orders, BUYSTOP on high and SELLSTOP on low of the previous bar. The code below run with a period one hour. I tested on several instruments and the results are the always the same.
Is this, history.getBar(instrument, period, OfferSide.BID, 0), the correct way to take the bar just opened and then the open price or is there another way to do this?

The backtest is done tick by tick.

I tried also using the feeddescriptor then use the IStrategy.onFeedData() method but the result is the same

The platform is set with timezone GMT and open time day CET.



Below the log from the console of the backtest.

Thanks.
Sdf is setted with timezone CET:

this.Sdf.setTimeZone(TimeZone.getTimeZone("CET"));



[img]https://www.dukascopy.com/swiss/english/forex/jforex/forum/download/file.php?un=1&id=10411[/img]

Attachments:
code.java [748 Bytes]
Downloaded 831 times
Immagine 2022-06-30 235027.jpg [87.46 KiB]
Downloaded 827 times

  Page 1 of 1