Forum

Cumulative Profit, reset when target reached

Hi all, I wrote the code below to support my EA. Essentially, I’m trying to add the cumulative profit until the target is reached, and then I reset the counter to zero. When the Cumulative profit is negative, I would then increase my lot size. So this would be similar to a Martingale strategy. So

Open Limited Number of trades in trend, then stop

Good day, I am trying to write a code that counts the number of trades that have been opened in a new trend. That is, if there is a trend (e.g. MA1 > MA2) the EA opens trades until the set number is reached, and then it stops and waits until there is a new trend. Then it starts counting again from

Check if open trade in Bar - MT4

Dear all, I wrote an EA that allows a total of 5 trades to be opened at one time. However, I only want one trade to open per bar although not necessarily at the beginning of the bar. Therefore, the code written here ( https://www.mql5.com/en/forum/216567 ) or similar variations does not work for me

One Trade per bar until Max Reached - EA not working properly

Dear All, I just designed an EA MetaEditor. I am now testing the code, but it will not open any trades even though conditions are met. It makes a sound, meaning that it wants to open a trade, but then it doesn't. I suspect there is something wrong with the portion of the code where I want the EA to