Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

IOrder::getOpenPrice() returns different Values
 Post subject: IOrder::getOpenPrice() returns different Values Post rating: 0   Post Posted: Mon 06 Aug, 2012, 17:55 
User avatar

User rating: 1
Joined: Thu 15 Mar, 2012, 16:30
Posts: 20
Hello, I have a Problem with IOrder::getOpenPrice() in the Historical-Tester
I am submitting my Market-Orders like this:

submitOrder(label, instrument, cmd, 0.001, 0, 0, sl, tp);


In the onMessage()-Procedure, on ORDER_FILL_OK & ORDER_CLOSE_OK Messages I'll print the getOpenPrice() to the console.
Sometimes it happens that the Price of the same Order, returned by getOpenPrice() on ORDER_FILL_OK Message differes from the price returned in ORDER_CLOSE_OK Message

Some Examples:
    getOpenPrice() on ORDER_FILL_OK = 147.475
    getOpenPrice() on ORDER_CLOSE_OK = 147.4721

    getOpenPrice() on ORDER_FILL_OK = 146.765
    getOpenPrice() on ORDER_CLOSE_OK = 146.7647

    getOpenPrice() on ORDER_FILL_OK = 146.555
    getOpenPrice() on ORDER_CLOSE_OK = 146.5547

All of these Orders were fully filled at the Time ORDER_FILL_OK was recieved. (I checke'd for OrderState FILLED)
This is confusing to me because I thought that the OpenPrice should not change after a Order is fully filled
Could that be a rounding-Problem? (I don't use any formatting-Operations on the double-Value, just pass it to the Console)

Any Ideas?


 
 Post subject: Re: IOrder::getOpenPrice() returns different Values Post rating: 0   Post Posted: Tue 07 Aug, 2012, 09:15 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Could you please provide an example strategy which replicates this and precise Historical Tester settings that you use?


 
 Post subject: Re: IOrder::getOpenPrice() returns different Values Post rating: 0   Post Posted: Tue 07 Aug, 2012, 13:51 
User avatar

User rating: 1
Joined: Thu 15 Mar, 2012, 16:30
Posts: 20
Hello,
this example strategy places Orders for each H1-Candle, the "initial" OpenPrices are stored in a ArrayList.
On ORDER_CLOSE_OK the OpenPrices get compared and if they dont match a Err-Line is sent to the Console.

This example strategy only works with GBPJPY but the problem also occurs on other Instruments.

My HistoricalTester-Settings:
    visualMode = true
    optimization = false
    show Msg = true
    TestPeriod = last Week / I tryed different Periods but the Problem still occurs
    mode = Ticks / process all Ticks


Attachments:
CheckOpenPrice.java [3.53 KiB]
Downloaded 307 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: IOrder::getOpenPrice() returns different Values Post rating: 0   Post Posted: Thu 09 Aug, 2012, 11:46 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This is because of the settlement - commission does not get applied to the order amount, but rather the open price gets adjusted. Run the updated example strategy to see that only the orders which have been open during the settlement have had their open prices changed.


Attachments:
CheckOpenPrice2.java [3.14 KiB]
Downloaded 317 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:  

  © 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