I'm just starting out learning how to program MQL4. I'm trying to write some code that will automatically enter orders for me when my EA triggers entry signals.
However, I need to place a couple of "if" statements to prevent the system from entering the trade if the following conditions are true. In other words, I do not want the EA to enter a trade if:
1. I already have an existing open position for the currency pair.
2. I already have a set number of lots in open positions (i.e., don't enter the order if my total outstanding lots in existing positions is 10).
Can someone provide some sample code to illustrate how this can be done?
Thanks!
However, I need to place a couple of "if" statements to prevent the system from entering the trade if the following conditions are true. In other words, I do not want the EA to enter a trade if:
1. I already have an existing open position for the currency pair.
2. I already have a set number of lots in open positions (i.e., don't enter the order if my total outstanding lots in existing positions is 10).
Can someone provide some sample code to illustrate how this can be done?
Thanks!