| / | Forum |
|
wackena
2011.06.25 19:33
I use GlobalVariableSet() in init() call to count number of EAs running on Terminal. int init() { if(!GlobalVariableCheck("Count_EAs")) { GlobalVariableSet("Count_EAs",1); } else { GlobalVariableSet("Count_EAs",GlobalVariableGet("Count_EAs")+1); } return(0); } int deinit() { if(GlobalVariableGet("Count_EAs")<2) { GlobalVariableDel("Count_EAs"); } else { GlobalVariableSet("Count_EAs",GlobalVariableGet("Count_EAs")-1); } return(0); } While Terminal is running with EAs loaded OK and EA count in Global Variables correct, later on the EA count will repeatedly double, indicating repeating init() calls. Example: Count_EAs at 3, sometime later becomes 6, sometime later becomes 9 and etc. My question is: What Terminal events that can cause only repeated init() calls and does not call deinit() ? |
|
Considering Orders in a Large Program General principles of considering orders in a large and complex program are discussed. |
|
WHRoeder
2011.06.25 23:06
Only one I know is a divide by zero in the tester, kills the EA. GlobalVariableSet("Count_EAs",GlobalVariableGet("Count_EAs")-1); This may not be safe, On startup or shutdown of the terminal, these may be done concurrently, but it's two calls so one my clobber another. Why do you even care it the EA is running on another pair? |
|
wackena
2011.06.27 00:21
WHRoeder: Only one I know is a divide by zero in the tester, kills the EA. This may not be safe, On startup or shutdown of the terminal, these may be done concurrently, but it's two calls so one my clobber another. Why do you even care it the EA is running on another pair?
I use EA_Count as part of Money Management in allocating Free Margin for lot size calculation. |
|
WHRoeder
2011.06.27 19:42
You might like to look at my code. I don't count EAs but instead look at all open orders and their max loss in my fm/lot size calculation.
|