Show your code.
The problem is the same with another expert, which is not so complicated.
Is there any reason on the platform, which stops the expert(s) run?
The expert works normally after the platform's restart.
The other expert's code:
Is there any reason on the platform, which stops the expert(s) run?
The expert works normally after the platform's restart.
The other expert's code:
//=====================================EXTERN VARIABLES============================== //===================================GLOBAL VARIABLES================================= string Symbols[] = { "GBPUSD", "USDCHF", "EURUSD", "USDJPY", "AUDUSD", "USDCAD", "EURGBP", "EURCHF", "EURJPY", "GBPJPY", "GBPCHF", "EURAUD", "NZDUSD", "EURCAD", "XAUUSD", "XAGUSD", "CHFJPY", "AUDJPY", "AUDCAD", "AUDNZD", "CADJPY", "NZDJPY", "GBPAUD", "GBPCAD", "CADCHF", "AUDCHF", "NZDCHF", "GBPNZD", "NZDCAD", "USDTRY", "EURTRY", "GBPTRY", "TRYJPY" }; // symbols to check int Periods[] = {1, 5, 15, 30, 60, 240, 1440}; // periods to check datetime DataGetTime; //=========================================START===================================== int start() { Print("Error code at start begin: ", GetLastError()); Comment("Get data..."); if((DataGetTime + 60) < TimeCurrent()) { Comment("Downloading data..."); int SizeOfSymbols = ArraySize(Symbols); int SizeOfPeriods = ArraySize(Periods); for(int i = 0; i < SizeOfSymbols; i++) { for(int j = 0; j< SizeOfPeriods; j++) { //Print(Symbols[i], Periods[j], " ", iMA(Symbols[i], Periods[j], 100, 0, 0, 0, 0)); iMA(Symbols[i], Periods[j], 70, 0, 0, 0, 0); } } DataGetTime = TimeCurrent(); } Comment("Get data..."); return(0); }
Your code runs on my machine.
"I have written an EA, and in a few cases, it doesn't want to start, when I attach it to a chart."
Are you waiting long enough for a tick to come? (some pairs are really quiet at some dealers)
"When I change period, it generates the following line in the log: "
Occasionally I get an error 4054. when run as an expert (while running).
2007.09.27 09:33:49 Phy__Test1234 GBPJPY,H4: Error code at start begin: 4054
No error on timeframe change.
????
Yes, ticks are coming, and the EA doesn't start.
How can it be?
After the platform's restart this EA runs normally.
See the log from this (this is again another expert):
12:27:01 EA_Cci_Bands_30M AUDUSD,M30: loaded successfully
As you can see, another expert on AUDUSD,H4 is working. (ticks are coming)
When I remove this EA from chart, the deinit() function is missing too. (there is no "deinitialized")
12:42:10 EA_Cci_Bands_30M AUDUSD,M30: removed
We use the same expert with different settings on many charts.
How can it be?
After the platform's restart this EA runs normally.
See the log from this (this is again another expert):
12:27:01 EA_Cci_Bands_30M AUDUSD,M30: loaded successfully
As you can see, another expert on AUDUSD,H4 is working. (ticks are coming)
When I remove this EA from chart, the deinit() function is missing too. (there is no "deinitialized")
12:42:10 EA_Cci_Bands_30M AUDUSD,M30: removed
We use the same expert with different settings on many charts.
Files:
20071009_short.txt
365 kb
Can anyone help me, please?
![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
I have written an EA, and in a few cases, it doesn't want to start, when I attach it to a chart.
It hasn't got init() function, and the first line of the start() function is:
Print("Error code at start begin: ", GetLastError());
And it prints nothing.
When I change period, it generates the following line in the log:
21:35:42 EA_ZAR_tr_ma_1.004 USDCAD,M5: Uninitialize reason: 3 Last Error Code: 4057
21:35:42 EA_ZAR_tr_ma_1.004 USDCAD,M5: deinitialized
How can it be, that the EA doesn't start at every tick?
4057 (Global variables processing error.) is not a runtime error.
And the acces to the global variables is after the Print("...") line.
Thanks for the advice,
milos