Dukascopy
 
 
Wiki JStore Search Login

DDSJFX-85 getValuePerPipInAccountCurrency() in Instrument
 Post subject: DDSJFX-85 getValuePerPipInAccountCurrency() in Instrument Post rating: 0   New post Posted: Thu 06 May, 2010, 16:19 

User rating: 1
Joined: Fri 26 Mar, 2010, 19:19
Posts: 116
Location: Canada
I see that getProfitLossInAccountCurrency() has been implemented in IOrder for 2.6.4. Thanks a lot!

However, there is no function to get the value (in account currency) per pip for an instrument. I would like get what is the value (in acct $) per pip of an instrument before placing an order. So that I can calculate my $ risk in acct currency, etc.


 
 Post subject: Re: JFOREX-1764 getValuePerPipInAccountCurrency() in Instrum Post rating: 0   New post Posted: Mon 13 Sep, 2010, 01:31 

User rating: 0
Joined: Tue 25 May, 2010, 04:21
Posts: 21
quantisan wrote:
I see that getProfitLossInAccountCurrency() has been implemented in IOrder for 2.6.4. Thanks a lot!

However, there is no function to get the value (in account currency) per pip for an instrument. I would like get what is the value (in acct $) per pip of an instrument before placing an order. So that I can calculate my $ risk in acct currency, etc.

Did you get answer to this?


 
 Post subject: Re: JFOREX-1764 getValuePerPipInAccountCurrency() in Instrum Post rating: 0   New post Posted: Tue 14 Sep, 2010, 08:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
this will be added in a near future.


 
 Post subject: Re: JFOREX-1764 getValuePerPipInAccountCurrency() in Instrum Post rating: 0   New post Posted: Sat 16 Oct, 2010, 02:17 

User rating: 1
Joined: Fri 26 Mar, 2010, 19:19
Posts: 116
Location: Canada
has this been implemented yet? I don't see it in Instrument in 2.6.18 javadoc


 
 Post subject: Re: JFOREX-1764 getValuePerPipInAccountCurrency() in Instrum Post rating: 0   New post Posted: Mon 18 Oct, 2010, 10:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It is not implemented yet, but you can consider the following JForex Wiki page https://www.dukascopy.com/wiki/index.php ... t_currency


 
 Post subject: Re: JFOREX-1764 getValuePerPipInAccountCurrency() in Instrum Post rating: 0   New post Posted: Tue 09 Nov, 2010, 04:59 

User rating: 1
Joined: Fri 26 Mar, 2010, 19:19
Posts: 116
Location: Canada
the conversion algorithm on the wiki seem to be missing some steps for the case of USD is a secondary (missing check if USD is base or counter currency in pair, for multiplication or division) and the last in which USD is not in instrument, then you need to do this recursively (i.e. USD is now secondary).


 
 Post subject: Re: JFOREX-1764 getValuePerPipInAccountCurrency() in Instrum Post rating: 0   New post Posted: Fri 11 Mar, 2011, 15:38 

User rating: 0
Joined: Thu 10 Mar, 2011, 16:36
Posts: 3
Hi all

I get error messages when I use the calculate function from https://www.dukascopy.com/wiki/index.php ... t_currency.

Error @ this line:
       
          else if (instrument.getSecondaryCurrency().equals(USD)) {
                    transitionalInstrument = pairs.get(account.getCurrency());
                    transitionalPrice = history.getLastTick(transitionalInstrument).getBid(); //In this line I get a NullPointerException
                    profit = profitInInitialCurrncy * transitionalPrice ;
                    System.out.println("Profit: " + profit);
                    // Secondary instrument is not USD, must convert to USD, then to Account currency
   }

My account currency is CHF and I tried this example with GBPUSD. But I think, the strategy doesn't get the ticks from GBPUSD. Why?

And what does
       Set<Instrument> instruments = new HashSet<Instrument>();
                instruments.add(Instrument.EURUSD);

mean in Main.java?

Thanks for help
bigtrader


 

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