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.

Issue open price on bar just opened
 Post subject: Issue open price on bar just opened Post rating: 0   New post Posted: Fri 01 Jul, 2022, 08:49 

User rating: 0
Joined: Mon 09 Aug, 2021, 12:16
Posts: 2
Location: Italy, Verona
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 784 times
Immagine 2022-06-30 235027.jpg [87.46 KiB]
Downloaded 779 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.
 

Jump to:  

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