How to make my EA to trade 1 buy and 1 sell for one day

 

Hi everyone,

I am new to mql4 programming and I have been trying to develop a expert advisor that will enter based on a certain condition, however I have managed to make the entry part work, but the problem is that I only want to have 1 buy and 1 sell entry everyday, for now, whenever the EA will add a new entry if the old entry has already hit it's take profit price. For example, if there is a buy entry running then the EA would not add more entry, that's perfect but once the buy is already TP, the EA adds another entry if the conditions are TRUE. It would be great if anyone could help me with fixing this problem, I just want to make 1 buy and 1 sell entry per day.

 

Count the trades by EA using magic number 

You'll have to loop through all the market orders

If tradesByEA()!=0 no need to add trade