Script vs EA inconsistencies

 

I have a script to extract historical data and 12 indicators to a csv file for analysis purposes.

On the other hand I have an expert advisor which uses the same 12 indicators as input, so it calculates them as soon as a new bar is closed, over the open prices.

Both the script and the EA use the same 12 indicators, calculated exaclty the same (triple checked).

The problem is that sometimes and with no particular reason the indicators calculated by the EA and those calcuated by the script do not match. Sometimes there are small differences, sometimes there are big differences. Sometimes one of the indicators is wrong and the others are ok; sometimes they are all wrong.

I suspect the EA is doing wrong since looking at charts generated over the script data everithing seems ok (no odd numbers).

The calculation is done as soon as a new bar opens. Could it be a problem ?

Any suggestion or advice is highly apperciated. Thanks, EN.-

 

1st of all, you didn't show the script nor ea and expect us to figure out what's wrong?

2nd, how does a script -running around in cycles- know when the tick of a new bar comes in?

3rd, twelve indicator you say, I could ask the above questions of them too. But sigh....

 
esteban:

The calculation is done as soon as a new bar opens. Could it be a problem ?

If these are the conditions, I "GUESS", you take data from other time-frames and you are testing it forward, it's the time interval needed MT4 to update the new bar in file storage, because of script delay (I guess there is one -)) it gets the true data but expert gets "Unwritten new data" by some definition, and especially if you testing them parallel expert executes first and does a requests for new data and later script takes the same ones written and ready, in other meanings in the expert you need to update the bars from other time-frames (wait after request and check) and than use as comparison, if you need them both.

I am just saying what can arise, but you said "I have a script to extract historical data and 12 indicators to a csv file for analysis purposes." - for the the exact problem solution probably would be different.

I hope this helps.

 
Esteban:

I have a script to extract historical data and 12 indicators to a csv file for analysis purposes.

On the other hand I have an expert advisor which uses the same 12 indicators as input, so it calculates them as soon as a new bar is closed, over the open prices.

Both the script and the EA use the same 12 indicators, calculated exaclty the same (triple checked).

The problem is that sometimes and with no particular reason the indicators calculated by the EA and those calcuated by the script do not match. Sometimes there are small differences, sometimes there are big differences. Sometimes one of the indicators is wrong and the others are ok; sometimes they are all wrong.

I suspect the EA is doing wrong since looking at charts generated over the script data everithing seems ok (no odd numbers).

The calculation is done as soon as a new bar opens. Could it be a problem ?

Any suggestion or advice is highly apperciated. Thanks, EN.-

Do you think that is EA inconsistence or data feed service inconsistence? 

MQL5 forum
MQL5 forum
  • www.mql5.com
MQL5: Forum on automated trading systems and strategy testing
 
Tan Ek Kun #: Do you think that is EA inconsistence or data feed service inconsistence? 

On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
          Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)

On MT5: Unless the current chart is that specific pair/TF, you must synchronize the terminal Data from the Server before accessing candle/indicator values.
          Error 4806 while using CopyBuffer() - Expert Advisors and Automated Trading - MQL5 programming forum #10 (2020)
          Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum (2019)
          Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
          Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum #2 (2018)
          SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum (2019)

Reason: