New Coder

 

Hi Guys,

I am trying to code a mt5 EA. I am struggling with the TIME array. I have managed for my code to operate however it opens thousands of trades once conditions are met, to mitigate this I am trying to make it so it can either only trade 1 trade at a time (problems with EA seeming to stop after trade has closed previously) or 1 trade per candle. on the 1 trade per candle option it does not seem to have the Time array stored, is there way to add it manually to the Expert or is there somewhere I can get it to put this file into arrays?

 
Jack Wilson:

You can search CodeBase section for that:

https://www.mql5.com/en/search#!keyword=new%20bar%20open&module=mql5_module_codebase

 
Jack Wilson: I am trying to code a mt5 EA. I am struggling with the TIME array. I have managed for my code to operate however it opens thousands of trades once conditions are met, to mitigate this I am trying to make it so it can either only trade 1 trade at a time (problems with EA seeming to stop after trade has closed previously) or 1 trade per candle. on the 1 trade per candle option it does not seem to have the Time array stored, is there way to add it manually to the Expert or is there somewhere I can get it to put this file into arrays?

Code Base

Detecting the start of a new bar or candle

Fernando Carreiro, 2022.04.24 00:38

Detecting the start of a new bar or candle, in the OnTick() event handler of an expert advisor.
 
Jack Wilson:

Hi Guys,

I am trying to code a mt5 EA. I am struggling with the TIME array. I have managed for my code to operate however it opens thousands of trades once conditions are met, to mitigate this I am trying to make it so it can either only trade 1 trade at a time (problems with EA seeming to stop after trade has closed previously) or 1 trade per candle. on the 1 trade per candle option it does not seem to have the Time array stored, is there way to add it manually to the Expert or is there somewhere I can get it to put this file into arrays?

There are many ways to manage orders

Describe your strategy, there are probably many experts who will guide you to write programs in a simpler and more efficient way.