You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello fellow mql programmers.
I'm trying to:
1) Calculate the total risk of all open positions function to be used with EA's I create in the future.
2) Calculate the total number of Un-Hedged Lots I currently have running.
3) Calculate the total number of Un-Hedged Points I currently have running.
4) Get a Total Risk in Dollars which I can later subtract from Equity.
*I'm not just interested in if I have enough free-margin to cover a New position. I want to make pretty sure I don't get a margin call should all open positions and the New position starts losing money. This is getting tricky for me because I don't want to view Hedge position as double the value. However, the hedged positions are Not seen as 0 position either. Therefore I cannot just say Buy_Lots - Sell_Lots. If anyone have a similar code of calculating this please provide. If you want the challenge of fixing my Newbie code, its provided below. If you think this approach DOES NOT have merit please explain. Thanks All.