How to Create a MQ4 Module to Calculate the Profit in MQL4
When you open a new trade, it’s a good idea to have enough trading capital. But how much is enough and how can we find out? I have imported another module called GetProfitThisCurrency mq4 and it will show the profit of the current currency pair in the comment line. And this is the module we use.
First, we create a double variable called profit then we will count all open trades and select one of these trades, and if it’s the right currency pair, we will add the OrderProfit and the OrderSwao to the profit variable and when we are done with counting all the open trades, we will return the profit. So let’s compile that and start a back test.
And now, you will see the current profit of the currency pair you trade. Let’s speed it a little bit up to show you how deep it can go. This is 38. This is about 35 dollars. Now, it’s 56 over 60. Now, it’s going back under 10 and that’s it. For this special trade, you would have needed over 60 dollars to trade a single micro-lot.
Currently, I do not open any trade if I do not have at least 200 Euro trading capital. That means for a thousand dollars account, I would only trade 5 trades at the same time. It used to be 100 Euros but that was before the Euro went downhill. About one year ago it used to be here and now it’s down here, so I need more trading capital to open a single trade. And you should be pretty careful too, I think. Things like this can happen all the time and it’s a good idea to always have enough money to avoid a margin call.