Problems in EA Metatrader4 (maybe regarding ChartSetSymbolPeriod and some bars load?)

 

Hello everyone,

I have a problem regarding an EA in Metatrader4 build 1045 (SimpleFX MetaTrader 4 Terminal) on Windows 10. Until a while ago, the EA worked just fine.

The problem is.. I make little improvements every day, and some day it stopped working properly (or simulating until the end).

 

The EA uses only 2 functions: OnInit and OnDeinit (it's not a real EA, it only does some simulations as an EA):

- OnInit:

  • the EA simulates decisions
  • calculates decisions profits
  • sends data to a WebService (url configured fine with "Allow WebRequest for listed URL" and all) which saves data to SQL database
  • changes charts one by one to simulate decisions for all charts
  • stops

- OnDeinit:

  • the EA prints the Deinit reason

If i run in debug, step by step, the last things that happen are:

  • Maybe trying to access some bars to make a decision with "DecisionCandle" (each bar makes a decision, something like scalping; it checks the inverse decision too, as with every decision)
  • It doesn't get to the end of the loop (to print "DecisionsCount=X DecisionName:"DecisionCandle" Symbol="C.US" Period="PERIOD_H1")
  • Not initializing ok (i do not have return with something different than OK)
  • Entering OnDeinit with reason 8 (Init failed) and without any Error (error gets printed here, if _LastError is different than zero)


 

Or the last things that happen in another scenario are:

  • Calling "ChartSetSymbolPeriod(ChartID(), symbol, PERIOD_CURRENT);" in OnInit
  • Iniializing Ok
  • Entering OnDeinit with reason 3 (Symbol or timeframe changed) => here symbol changed from "BTCJPY" to "BTCUSD"; everything without error, because if it was would get printed here
  • The EA gets removed, even though for the simbols before it worked (it gets from Symbols starting with "A.." until those with "Z.."; now it crashed at "B.." (BTCJPY))

 

Either way, the simulation does not end properly (getting data from decisions on all symbols).

 

 

What the EA prints when it changes charts properly:

 

 

I posted all that I could, because the EA is very huge (30+ files) and cannot be properly run without WebService put in IIS, SQL database set up, and so on, but of interest should be what i wrote. 

Does anybody know what I might do wrong?

 

Thank you. 

 
This is a bug in build 1045, it is fixed in build 1049.
 
mrlinux 2017.03.08 01:16  EN

I hope this will be easy question for some of you as I'm only a newbie with Forex.  I don't know why this occurred.  It may be because I attempted to debug a script file. 

A few weeks ago I was debugging with MetaEditor (Build 1526), ...

1 - I "Compiled" the code.  Generated no errors or warnings.  Everything looked good.  I left clicked on the top icon bar's "Run" button.  At this point, MetaTrader (Build 1045) was displayed.  I wasn't surprised as it was expected. 

2 - I left clicked the MetaTrader and moved the mouse to the EURUSD currency.  The square icon appeared under the mouse pointer just as expected.  Nothing new.  After I released it I waited until for the next bar.  Nothing was unique. 

3 - Yet, shortly after the next bar appeared and MetaEditor once more displayed itself at the pre-selected breakpoint, as expected.  I left clicked over the "Step Into" icon.  The highlighted line progressed just as usual.  Everything looked good. 

4 - However, … a moment later (actually about 10 seconds) the highlighted line returned to the normal color like all the other lines!  I looked up and I noticed the "Step Into" icon was now grayed out!  It no longer was a valid option to choose! 

What happened?  ‌And how can I remove or reset ME to prevent this from happening again? Who should I talk to about this?  ‌

‌To correct this:

1 - ‌I've shutdown, re-started, and tried everything again.  Nothing changed as I saw the same results. 

2 - I tested this process with another EA and I got the same results.  Once more I got the same exact results!

3 - I even tried updating the the latest version of MQL4.  Once again ... the same results! 

4 - Yet, I have not deleted the entire application and installing it onto a another hard drive.  Would that make a difference? 


As it stands now, my version of ME is useless without "Step Into". 

Thanks in advance

mrlinux
mrlinux
  • www.mql5.com
Trader's profile
 

Build 1045 if really bugged.

Wait next official release or try current beta 1052.‌

New MetaTrader 4 Platform build 1045
New MetaTrader 4 Platform build 1045
  • www.mql5.com
New MetaTrader 4 Platform build 1045 The MetaTrader 4 platform update will be released on 3 February, 2017, which is connected with the release of...
Reason: