Eleni Anna Branou :
Please use the </> button to insert your above code.
Next time that I will put a code in the forum, I Will use the button </>. I already have seen it, but finally I didn't use it.
Thanks for trying to help, but doing tests I have already solved it.
I have set the "Cycles" counter (Cycles = Cycles + 1) in the part where the first order opens, at the end of an "if" conditional. And the cycles are already counted correctly.
Regards
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello good afternoon,
I need help in the programming of an Expert Advisor (EA) for MetaTrader4.
In principle this EA I did with a builder (EABuilder), and from there I have been adding / modifying things (calculation of lot size, closing all open positions, start at a specific time or immediately, etc.).
In this EA, a position is opened, and depending on how the price goes, it will open another position(s).
Finally, when a TakeProfit or a StopLoss is reached, all positions will be closed. To all this, I call it a "Cycle" (first open positions and then close all).
The EA will open a new position, immediately after or at a scheduled time. Then we will have a new "Cycle" that finally will also close. And we will be counting the "Cycles".
I'm stuck with the "Cycles" counter.
I have set a global variable: int Cycles = 0;
When I put the "Cycles" counter (Cycles = Cycles + 1, or Cycles ++) in the short positions closing function, for example:
Then when I do the Backtesting with the MetaTrader 4 Strategy Tester, in the tab "Registration" below there are many lines with a very high total number of Cycles (tens of thousands, hundreds of thousands or millions, depending on the Backtesting period used).
I would appreciate any idea or suggestion to be able to count the "Cycles" one by one, and not by thousands or millions.
Thank you very much