A Buy and Sell Module in MQL4

Okay, by now, we have created our first useful MQ4 module. And that was useful because now we are able to check any trend we like. But it’s even more useful if you can import pre-calculated modules. This one is already done and it’s called Open a Trade. It will check an integer value that is called direction, and if the direction is zero, it’s going to open a buy trade. In the other case, the direction is 1 and it’s going to sell.
After the trend is calculated in the main expert advisor, we will check if the trend is positive and if this is the case, we will call the function OpenTrade with a 0. Otherwise, we call the function OpenTrade with a 1. Let’s see if that works. Right now, in July of 2015, the Euro was going down, so we know it has to sell, here back into 13 the Euro, went up and it should buy and it did.