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.

Equity problem on demo account
 Post subject: Equity problem on demo account Post rating: 0   Post Posted: Thu 02 Dec, 2010, 09:26 

User rating: 0
Joined: Thu 19 Aug, 2010, 13:53
Posts: 62
I use this simple formula to calculate lots for a order:
      double aK = (iAccount.getEquity() * 25)/100000;                
          aRetLot = aK/10;
return aRetLot;

When I start strategy and initial equity is 100 000, first order is opened with 2.5k lots, which is correct.
When the order is closed, let's say in profit with 12k, the JForex shows correct equity in bottom bar: 112 000
If the strategy opens a new order using again the above formula the lot returned should be: 2.8k
but it returns again 2.5k. this says to me the iAccount.getEquity() still return 100 000 although meantime
12k were earned and the real equity is 112 000.
I understand there is a a delay until the onAccount() method is called to update info. But how long is this time ?
I did some extensive tests and even after 15 minutes the IAccount.getEquity() still returns 100 000 as initial balance when strategy started although meantime it changed by closed orders in profit/loss.
If current equity reach let's say 95k and I restart the strategy it gets correct initial equity 95k and use this for calculatin as above. While the strategy remains open it keeps getting iAccount.getEquity() = 95k although it changes.
Is this a problem ? Should I consider other things to get current real time equity ?
Thank you.


 
 Post subject: Re: Equity problem on demo account Post rating: 0   Post Posted: Fri 03 Dec, 2010, 00:41 

User rating: 0
Joined: Thu 02 Dec, 2010, 18:56
Posts: 2
Dear darlu72,

Consult the page https://www.dukascopy.com/swiss/english/ ... _accounts/. Among others, you can read there the sentence as follows:
Account balance is updated on a daily basis after settlement procedure.

Argiris


 
 Post subject: Re: Equity problem on demo account Post rating: 0   Post Posted: Fri 03 Dec, 2010, 09:37 

User rating: 0
Joined: Thu 19 Aug, 2010, 13:53
Posts: 62
Argiris wrote:
Dear darlu72,

Consult the page https://www.dukascopy.com/swiss/english/ ... _accounts/. Among others, you can read there the sentence as follows:
Account balance is updated on a daily basis after settlement procedure.

Argiris


Well, the normal question is why JForex has instant access to real time instant equity but an automated strategy not ? It is a handicap for an automated strategy which may deal with 20 pairs at once, for example.


 
 Post subject: Re: Equity problem on demo account Post rating: 0   Post Posted: Fri 03 Dec, 2010, 11:34 

User rating: 0
Joined: Thu 02 Dec, 2010, 18:56
Posts: 2
Darlu,

Try to catch changes in onAccount(). The method getCreditLine() may be better, as it shows directly how much you can use as quantity of a position. onAccount() should be also called on events when you close a position. Your problem might come from the fact that you read the getEquity() method of same IAccount instance every time instead of getting new instances with updated fields. Just make an attempt.

Argiris


 

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