Robot and Position Sizing

Created at 02 Apr 2013, 23:25
DM

dmg156

Joined 02.04.2013

Robot and Position Sizing
02 Apr 2013, 23:25


Hi Guys


Can some please tell me if it possible to code a robot to calculate say 1% risk of your equity take the required stop into consideration and then return the required volume for that particular trade.

Regards

Darren


@dmg156
Replies

atrader
04 Apr 2013, 15:04

Based on this:

http://www.fxstreet.com/education/learning-center/unit-3/chapter-3/the-position-size/

and 

http://www.babypips.com/tools/forex-calculators/positionsize.php

 

You can use this formula:

var Volume = (((Account.Balance * Risk) / StopLossPips) / PipValue) * 100000;

I believe for xxxUSD where the account currency is USD, the pip value is $10. Not sure how you would calculate this for other currencies.

Risk should be input as a percentage, i.e. 0.01. or if you input 1 then convert it by 

Risk = Risk/100; prior to the formula.

StopLossPips should be in pips, i.e. 10 for 10 pips.

 

 


@atrader