Dear all,
This function in my EA work in tester but not in demo and live, please help.
It return the deal of 2 hours before divided by minimun lots allowed.
e.g. 2 hours before the deal in was 0.05 lot, then it should return 5.
A moderator corrected the formatting this time. Please format code properly in future; posts with improperly formatted code may be removed.
Peter
More information, in demo, I used it for multiple symbols , in stragety tester only one symbol.
The second reason is data holes in some parts of the charts for historical data, there are only candles, but other data is missing and this appears as if the strategy has blown up. Verify only on short segments and not older periods than the last one to two months.
Milan
The second reason is data holes in some parts of the charts for historical data, there are only candles, but other data is missing and this appears as if the strategy has blown up. Verify only on short segments and not older periods than the last one to two months.
Milan
Peter, one more thing to check besides the time functions. TimeCurrent() is the server time of the last received quote, so on demo/live the HistorySelect() window itself is normally fine — it only lags on a symbol that has not ticked for a while. That alone usually does not explain tester-vs-live differences.
The more likely culprit, given your note in #1 that demo runs multiple symbols: the loop has no symbol filter. It returns on the first DEAL_ENTRY_IN older than 2 hours whose magic matches — and if the same magic number is shared across several charts, that deal can belong to a different symbol. The tester runs one symbol, so the problem never shows there. Move the DEAL_SYMBOL read up and add a check like if(l_curr != _Symbol) continue; before the time test, or give each chart instance its own magic.
Also, inside the loop you return 0 whenever a single property read fails, which aborts the whole scan — on live accounts the history also contains balance deals (the deposit) with no symbol, so one odd entry can end the search early. Using continue for those cases instead of return makes the function much more robust. Finally, note the condition (now - dealtime) > 7200 selects the newest deal older than 2 hours, not the deal placed exactly 2 hours ago — worth confirming that is really the intent.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all,
This function in my EA work in tester but not in demo and live, please help.
It return the deal of 2 hours before divided by minimun lots allowed.
e.g. 2 hours before the deal in was 0.05 lot, then it should return 5.
A moderator corrected the formatting this time. Please format code properly in future; posts with improperly formatted code may be removed.
Peter