EA fails to place SL's after a while - reload and it works

 

I am working on an EA that does multiple trigger levels and then sets trailing stops from there.

So, when the first trigger (say 2 pips for example purposes) is hit then the system does a trailing stop (use 1 pip) on the trades.

Triggers -- Trailing Stop

......2 ------ 1

......4 ------ 2

......8 ------ 4

......16 ------ 8

This is all working and was originally done with just loops but as the number of trades increase it tends to stop working.

Reloading the program seems to get it going again.

I have in my effort to overcome this issue converted it to an array process where the trades are gathered into an array and then the code looks there to see if any trades need to be adjusted.

I have checked the data and it appears to all land and be accurate within the array.

Are there any issues I could look into to get this resolved?

Factors that seem to add to the bad operation of the system:
- weaker computer does worse

- longer time that the EA is left without reloading

- more trades open or pending

Working on an EA that is not consistent is dangerous as I get closer to live trading.

There must be a solution and so far it has been elusive.

Thank you for any leads or ideas on what direction to go for a possible solution.

best wishes,

Steve

 
Forex5x:


There must be a solution and so far it has been elusive.

Thank you for any leads or ideas on what direction to go for a possible solution.

Are you doing the basic rudimentary stuff ? printing variables so you can check them ? checking return values from trading functions and reporting all errors and associated variables ? do your trades and trailing stops meet the trading requirements concerning STOPLEVEL and FREEZELEVEL ?
 
Forex5x:

This is all working and was originally done with just loops but as the number of trades increase it tends to stop working.

Reloading the program seems to get it going again.



Once I had an error which caused a stramge behaviour something like this. The reason was so simple that it was hard to find.

I simply did not handle correctly a string variable of which length was increasing on the run and consumed more and more memory.

I thought of almost every kind of tricky problems but this :-)