Dukascopy
 
 
Wiki JStore Search Login

Position Sizing Block
 Post subject: Position Sizing Block Post rating: 0   New post Posted: Thu 16 May, 2013, 08:40 
User avatar

User rating: 7
Joined: Wed 04 Jul, 2012, 02:40
Posts: 109
Location: Australia, Melbourne
It would be useful to see a position sizing block with the following properties:

-Percentage to risk
-Stoploss in pips

And the block would calculate the number of units to trade to setup the risk in percent. You would want the block to check the account currency - and the currency pair the trade is being executed on.

If you need me to clarify , let me know.

DoCZero


 
 Post subject: Re: Position Sizing Block Post rating: 0   New post Posted: Thu 16 May, 2013, 10:43 
User avatar

User rating: 6
Joined: Fri 12 Apr, 2013, 14:08
Posts: 88
Location: FranceFrance
Hello Doc0

By
Quote:
position sizing block


You mean a new component block? What exactly would be the inputs and outputs of this new block and how would you use it?

Overall, it sounds a good idea (especially the Percentage to risk), but some clarifications are needed.

nb:
Quote:
Stoploss in pips
like the one already existing in the Pending order and Open at market blocks?


 
 Post subject: Re: Position Sizing Block Post rating: 1   New post Posted: Thu 16 May, 2013, 11:04 
User avatar

User rating: 7
Joined: Wed 04 Jul, 2012, 02:40
Posts: 109
Location: Australia, Melbourne
Hello Para,

Thanks for the quick reply - basically it is for fixed fractional position sizing. So every trade on my account is to a fixed percentage risk calculated every trade.

Currently to do this I am using:

Image

Unfortunately - that assumes the users account is in USD and it only works when I trade a currency with USD as the quote currency (i.e EURUSD). When you account is in a different currency, or trading a different pair - the maths changes.

The Block needs to reference the following:

-Account Currency
-Account Balance
-Percentage Risk
-Stoploss in pips
-Currency pair being traded

The standard formula is:

Quote:
Lots = Equity * Risk% / (Stop Loss in Pips * Pip Value) / 100


Attachments:
positionsizing.jpg [86.43 KiB]
Downloaded 998 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: Position Sizing Block Post rating: 0   New post Posted: Thu 13 Jun, 2013, 08:22 
User avatar

User rating: 0
Joined: Thu 13 Jun, 2013, 08:09
Posts: 13
Location: China, Shanghai
In addition, I think it's better to have a choice (single selection) of using Equity or Balance to calculate lots, for people who wish to have more than 1 open position.


 
 Post subject: Re: Position Sizing Block Post rating: 0   New post Posted: Mon 24 Jun, 2013, 12:39 
User avatar

User rating: 0
Joined: Thu 13 Jun, 2013, 08:09
Posts: 13
Location: China, Shanghai
doczero wrote:
Hello Para,

Thanks for the quick reply - basically it is for fixed fractional position sizing. So every trade on my account is to a fixed percentage risk calculated every trade.

Currently to do this I am using:

Image

Unfortunately - that assumes the users account is in USD and it only works when I trade a currency with USD as the quote currency (i.e EURUSD). When you account is in a different currency, or trading a different pair - the maths changes.

The Block needs to reference the following:

-Account Currency
-Account Balance
-Percentage Risk
-Stoploss in pips
-Currency pair being traded

The standard formula is:

Quote:
Lots = Equity * Risk% / (Stop Loss in Pips * Pip Value) / 100



Hey doczero,

Good day, not sure if you have addressed this block for your live trading, I have written a function by researching through JForex API. Paste here FYI.

Hopefully VJF team will realize the block soon.

//--------------------------------------------------
// Calculate lot size
//--------------------------------------------------
private double calculateLotSize() throws JFException {

double lotSize = 0.0;
double equity = context.getAccount().getEquity();
double valuePerPip = utils.convertPipToCurrency(myInstrument, context.getAccount().getCurrency());

lotSize = equity * RiskLevel / (valuePerPip * SLPips) * Math.pow(10, -6); //calulate lots in millions
//math round
lotSize = Math.round(lotSize * 1000) / 1000.0;
return lotSize;
}


 
 Post subject: Re: Position Sizing Block Post rating: 0   New post Posted: Mon 24 Jun, 2013, 12:42 
User avatar

User rating: 0
Joined: Thu 13 Jun, 2013, 08:09
Posts: 13
Location: China, Shanghai
one statement to be added to onStart function:

this.utils = context.getUtils();


 
 Post subject: Re: Position Sizing Block Post rating: 1   New post Posted: Fri 04 Oct, 2013, 17:40 
User avatar

User rating: 7
Joined: Wed 04 Jul, 2012, 02:40
Posts: 109
Location: Australia, Melbourne
Hello Jforex Team,

So any progress on this block? Or is it off the design list for now?


P.S - I'll be around a bit more now - just relocated to asia , and new work commitments have been crazy (but im back into building / designing and testing trading systems =) )


 
 Post subject: Re: Position Sizing Block Post rating: 0   New post Posted: Mon 07 Oct, 2013, 11:36 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Hello Doc.

Welcome back.
Unfortunately you are right, it is off the list because of low demand for such feature.
Not many traders understand meaning of th Risk. And thouse who know can calculte it for themselves.


 
 Post subject: Re: Position Sizing Block Post rating: 0   New post Posted: Fri 18 Oct, 2013, 01:24 

User rating: 0
Joined: Tue 23 Jul, 2013, 13:31
Posts: 76
Location: Brazil, Belo Horizonte
Hi Sirs,

I support the request.
It would be a very useful thing.

tanks


 
 Post subject: Re: Position Sizing Block Post rating: 0   New post Posted: Tue 22 Oct, 2013, 15:49 
User avatar

User rating: 0
Joined: Wed 24 Oct, 2012, 17:12
Posts: 20
Location: France, Paris
UP

Hi Sirs,

I support too the request.
It would be a very very useful thing !

Else maybe the possibility to call java utils like "utils.convertPipToCurrency"...

Thanks in advance


 
 Post subject: Re: Position Sizing Block Post rating: 0   New post Posted: Wed 23 Oct, 2013, 08:37 
Visual JForex expert at Dukascopy
User avatar

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

I know that this is a good feature and I will push things forward in that direction but please also understand that currently the highest priority is to make VJF more reliable and stable in order to leave the beta-status to deploy it for LIVE-environment.
Otherwise we might would implement blocks based on wrong or inadequate data/code.

Thank you for your understanding!

Cheers!


 

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