Dukascopy
 
 
Wiki JStore Search Login

How to round numbers?
 Post subject: How to round numbers? Post rating: 0   New post Posted: Mon 22 Jul, 2013, 01:10 

User rating: 1
Joined: Tue 11 Jun, 2013, 15:40
Posts: 29
Location: Russian FederationRussian Federation
I want that lot amount at my market order depends on equity.
For example 0.1 lot per 10000 equity.
I tried to do that, but it gives an error. I think it is because it can`t place the order with 0.543568748 amount.

Please help.


 
 Post subject: Re: How to round numbers? Post rating: 0   New post Posted: Mon 22 Jul, 2013, 07:16 
Site Administrator
User avatar

User rating:
Joined: Fri 21 Jun, 2013, 16:50
Posts: 197
Location: FranceFrance
The mistake might be somewhere else.

In this video: what you are trying to do is explained step by step.


 
The Best Answer  Post subject: Re: How to round numbers? Post rating: 0   New post Posted: Mon 22 Jul, 2013, 08:13 
Visual JForex expert at Dukascopy
User avatar

User rating: 27
Joined: Fri 03 May, 2013, 18:25
Posts: 366
Location: GermanyGermany
Hello!

in your case it would be like this setup:


Image

Happy trading!


Attachments:
LOT_Size.png [46.41 KiB]
Downloaded 814 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: How to round numbers? Post rating: 0   New post Posted: Mon 22 Jul, 2013, 17:04 

User rating: 1
Joined: Tue 11 Jun, 2013, 15:40
Posts: 29
Location: Russian FederationRussian Federation
Thank you.
Will try this.

But how to round numbers? :)


 
 Post subject: Re: How to round numbers? Post rating: 0   New post Posted: Mon 22 Jul, 2013, 17:34 
Visual JForex expert at Dukascopy
User avatar

User rating: 27
Joined: Fri 03 May, 2013, 18:25
Posts: 366
Location: GermanyGermany
My question is: why do you need this? VJF takes any value you want and you can calculate with them.

Otherwise, if you still need to round numbers i am afraid that you cannot do this. But maybe the community knows better than myself?


 
 Post subject: Re: How to round numbers? Post rating: 0   New post Posted: Mon 22 Jul, 2013, 21:45 

User rating: 1
Joined: Tue 11 Jun, 2013, 15:40
Posts: 29
Location: Russian FederationRussian Federation
dirk_r1 wrote:
My question is: why do you need this? VJF takes any value you want and you can calculate with them.

Otherwise, if you still need to round numbers i am afraid that you cannot do this. But maybe the community knows better than myself?


For example, I would like that any lot amount will be calculated automatically depends of equity and looks like X.X77 or X.X55 :)

I have some thoughts about it:

Quote:
The Integer - it is a number, with data 32-bit.
It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive).


So if I use this type of data and multiply it by 1 000 000 000 and then divide it by 1 000 000 000, will it be rounded in this case? :)


 
 Post subject: Re: How to round numbers? Post rating: 0   New post Posted: Tue 23 Jul, 2013, 10:16 
Visual JForex expert at Dukascopy
User avatar

User rating: 27
Joined: Fri 03 May, 2013, 18:25
Posts: 366
Location: GermanyGermany
Unfortunately, rounding numbers is not possible yet. I double checked with the developers and they assured me that it would be fixed (available) soon.

Quote:
The Integer - it is a number, with data 32-bit.
It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive).


So if I use this type of data and multiply it by 1 000 000 000 and then divide it by 1 000 000 000, will it be rounded in this case? :)


The problem is that there would be an error if you try to do that in this way, cause the integer type does not take any commas.

I will turn back to you when the problem is fixed.


 
 Post subject: Re: How to round numbers? Post rating: 0   New post Posted: Tue 23 Jul, 2013, 14:47 

User rating: 1
Joined: Tue 11 Jun, 2013, 15:40
Posts: 29
Location: Russian FederationRussian Federation
Ok.
Thank you.


 
 Post subject: Re: How to round numbers? Post rating: 1   New post Posted: Thu 14 Aug, 2014, 09:00 

User rating: 1
Joined: Sat 09 Aug, 2014, 10:46
Posts: 1
Location: France, St Laurent du Var
Dirty way to round a number is to transfert the content of a double into an int variable, that's the only way I could find so far in visual jforex but it work fine ;)


 

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