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.

getProfitLoss-Methods of IOrder???
 Post subject: getProfitLoss-Methods of IOrder??? Post rating: 0   New post Posted: Mon 09 Aug, 2010, 12:23 

User rating: 0
Joined: Wed 18 May, 2011, 11:25
Posts: 60
Location: DE
Hi,

in the JFOREX API DOC, there are listed 3 methods to get the ProfitLoss of IOrder:
- double getProfitLossInPips()
- double getProfitLossInUSD()
- double getProfitLossInAccountCurrency()

but in my IOrder object, these methods are not available. have they been removed
from the current source and the java doc is old? or is there a newer JFOREX API
available with this methods? i used the download link just a few minutes ago, but
the methods are not available in this version ...

how can i calculate the ProfitLoss? i know the ProfitLoss-Pips and the amount, but
need the value of 1 Pip.
i tried the Instrument.getPipValue() method, but it seems that this is not the real
pip value i was looking for.
when i calculate 1000000*order.getAmount()*ProfitLossPips*instrument.getPipValue()
i will get the same result as the ProfitLoss-Pips. but i need the ProfitLoss in currency.


need some help ;-)


greetings,
tom


 
 Post subject: Re: getProfitLoss-Methods of IOrder??? Post rating: 0   New post Posted: Tue 10 Aug, 2010, 08:55 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
those methods are still available, but they are available only for orders which is not CLOSED.
What is the error message that you receive and how are you running your strategy: using "singleJar" or JForex platform?


 
 Post subject: Re: getProfitLoss-Methods of IOrder??? Post rating: 0   New post Posted: Tue 10 Aug, 2010, 18:01 

User rating: 0
Joined: Wed 18 May, 2011, 11:25
Posts: 60
Location: DE
Hi,

i write my code in Eclipse (making jar-file) and then using this jar-file
with the @Library Annotation in den JForex Strategy.

i would prefer to use the SingleJar, but i can not login there, i don't know
why. so i have to use the JForex Strategy to get my code running.

the problem is, that the IOrder does not have these methods. in eclipse, i
get the error messages when i write the methods manually:
- The method getProfitLossInPips() is undefined for the type IOrder
- The method getProfitLossInUSD() is undefined for the type IOrder
- The method getProfitLossInAccountCurrency() is undefined for the type IOrder

when i compile my char with this errors and try to start the strategy, i get
the same error message in JForex:
java.lang.Error: Unresolved compilation problems:
- The method getProfitLossInPips() is undefined for the type IOrder
- The method getProfitLossInUSD() is undefined for the type IOrder
- The method getProfitLossInAccountCurrency() is undefined for the type IOrder

so it seems, that i have an older IOrder object in my jar-library. yesterday,
i downloaded the actual JForexLibraryClient and used all the jars in my code,
but the IOrder does not have the required methods ... i don't know why :-(

the import com.dukascopy.api.IOrder comes from JForex-API-SNAPSHOT.jar,
and if you open this jar in eclipse, you can look at the classes and IOrder
does not have the desired methods.

so my JForex-API-SNAPSHOT.jar library must be outdated, but it's the recent
jar in the JForexLibraryClient package ...


 
 Post subject: Re: getProfitLoss-Methods of IOrder??? Post rating: 0   New post Posted: Tue 10 Aug, 2010, 18:25 

User rating: 0
Joined: Wed 18 May, 2011, 11:25
Posts: 60
Location: DE
I FOUND THE PROBLEM!!!

i'm from germany and using german as my prefered language on the dukascopy homepage.
when i download the JForexClientLibrary, i get an outdated version.

ony for testing, i changed the language to englisch. when i now download the Library, i
will get a bigger zip-file and the newer libraries.

i think this is a bug of the homepage!!!


greetings,
tom


 

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