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.

Problem with Calculating Lot size "cannot be resolved"
 Post subject: Problem with Calculating Lot size "cannot be resolved" Post rating: 0   New post Posted: Tue 24 Jul, 2012, 12:46 
User avatar

User rating: 0
Joined: Tue 24 Jul, 2012, 12:36
Posts: 2
Location: ItalyItaly
I have this strategy and when I calculate the lot size with this formula, it gives me error.

  "Lot = equity * CoefficientRisk/100000"



Can you help? I want the machine to calculate the lots in this way
  "Lot = equity * CoefficientRisk/100000"

the error is
/ ---------- 24/07/2012 11:15:46
/ / 7/24/2012 11:15:46 equity can not be resolved
/ / 24/07/2012 11:15:46 ^ ^ ^ ^ ^ ^
/ / 07.24.2012 11:15:46 * CoefficientRisk/100000 amount = equity;
/ / 07.24.2012 11:15:46 1. ERROR in C: \ PROGRA ~ 1 \ genius \ ~ 1 \ Temp \ jfxide \ tmp \ compile \ GoldenEye3.java
/ / 07.24.2012 11:15:46 ----------

thanks for support


Attachments:
GoldenEye4.jfx [5.16 KiB]
Downloaded 302 times
GoldenEye4.java [4.7 KiB]
Downloaded 289 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: Problem with Calculating Lot size "cannot be resolved" Post rating: 0   New post Posted: Tue 24 Jul, 2012, 14:02 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Add an IAccount field and assign it in the onStart:
private IAccount account;
public void onStart(IContext context) throws JFException {
    this.account = context.getAccount();
Then calculate the amount in the following way:
      double amount = this.account.getEquity() * CoefficientRisk/100000 ;
Mind to replace the this.amount (which is the global field amount) with amount (which will be the method-local variable).
In order to avoid such mistakes already before the compilation, consider programming your strategies in an IDE, e.g. Eclipse:
https://www.dukascopy.com/wiki/#Use_in_Eclipse


 

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