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 991 times
|
Immagine 2022-06-30 235027.jpg [87.46 KiB]
Downloaded 977 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.
|
|