stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Equity contribution per currency
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1506
Page 1 of 1
Author:  icon [ Sun Feb 17, 2013 10:21 pm ]
Post subject:  Equity contribution per currency

Hello ,

I need help to coding a function to close the trades based on each currency contribution as a percent of the account balance.

For example if I have a set of trades opened , USDJAP is giving 5% profit and I want to keep those trades open , while EURUSD is causing a 3% of the account in loss and I want to close those EURUSD trades only due to a percent risk their causing on the account.

I know how to close trades in terms of pips or dollar value , but I don't know how to close a set of trades as a percent of the main account whiteout affecting the other opened ones.

Any ideas ?
Author:  mjws00 [ Fri Feb 22, 2013 2:08 am ]
Post subject:  Re: Equity contribution per currency

You are going to need to iterate through trade history and calculate the profit/loss for the pair (and all it's associated trades). There are a few dashboard indicators that will do the math for you, and show you the sample code. The actual close the trade code isn't much more than looping though the trades, checking the symbol, closing it if it is in the pair you want.

Pretty much every EA has some functions that loop trades to check for a closing conditions. Steve's BASE EA code would get you rolling. You'll have to add your own conditions but the framework will be there. LookForTradeClosure() is the function to start in.

Good luck.

Mike
Author:  icon [ Sat Feb 23, 2013 6:41 pm ]
Post subject:  Re: Equity contribution per currency

thanks a lot Mike
All times are UTC Page 1 of 1