MT5 backtesting chart pile up

 
Backtesting Charts seemed to quickly build up Backtesting Charts seemed to quickly build up

MT5 chart pile up to make chart to mangle  while strategy apply indicators, some of which use time series(ArraySetAsSeries = true), some use non time series.

how to solve this problem.

 
Lei Zhu: MT5 chart pile up to make chart to mangle  while strategy apply indicators, some of which use time series(ArraySetAsSeries = true), some use non time series. how to solve this problem.

I am having difficulty understanding your question. Please explain in more detail and show screenshots or sample code to help us understand your question.

 
Lei Zhu:

MT5 chart pile up to make chart to mangle  while strategy apply indicators, some of which use time series(ArraySetAsSeries = true), some use non time series.

how to solve this problem.

this must be North East reached out to the guy he doesnt respond 

 
Lei Zhu: MT5 chart pile up to make chart to mangle  while strategy apply indicators, some of which use time series(ArraySetAsSeries = true), some use non time series. how to solve this problem.

Your EA code is "broken". Something is wrong with it. Unless you also provide sample code, we will not be able to see what is wrong.

You are probably instantiating the Indicator multiple times in OnTick(), instead of just obtaining the handle once in OnInit() and reusing it.

 

The strategy is prepared by me, I don't know if it is associated with the indicators coding, actually it is simple. There are 2 indicators using in the strategy, one is iMA, the other is KDJ  this code use "ArraySetAsSeries(close,true);".

In addition the speed of MT5 back-testing is far lower than MT4 based on same logical thread, furthermore the data is missing, besides the other weird problems in the backtesting!

 
Lei Zhu #: The strategy is prepared by me, I don't know if it is associated with the indicators coding, actually it is simple. There are 2 indicators using in the strategy, one is iMA, the other is KDJ  this code use "ArraySetAsSeries(close,true);". In addition the speed of MT5 back-testing is far lower than MT4 based on same logical thread, furthermore the data is missing, besides the other weird problems in the backtesting!

It has nothing to do with ArraySetAsSeries. In your EA, you are instantiating your KDJ indicator multiple times, instead of just once in the OnInit.

The code is slow because of this repetitive instantiating of the indicator, and probably several other things you are doing wrong.

If you want us to show you what you are doing wrong, you will have to show your code.

 

Once KDJ (https://www.mql5.com/zh/code/27947) was disable, only leave MA condition to strategies, everything is fine.

what is problem with this?

三线KDJ
三线KDJ
  • www.mql5.com
股票软件通达信中的指标三线KDJ
 
Lei Zhu #: Once KDJ (https://www.mql5.com/zh/code/27947) was disable, only leave MA condition to strategies, everything is fine. what is problem with this?

The problem is not the KDL Indicator. It is your EA code that is the problem. It is instantiating the indicator multiple times, repetitively.

You need to fix your EA code. When you converted it from MQL4 to MQL5, you did not properly address the differences in structuring your code for the way MQL5 is implemented.

In MQL5, you need to initialise the Indicator only once in OnInit(), and then reuse the handle with CopyBuffer in OnTick(), and not repetitively initialising the Indicator over and over.

 
Lei Zhu #: what is problem with this?

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
          MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
          How to call indicators in MQL5 - MQL5 Articles (2010)

 
William Roeder #:

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
          MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
          How to call indicators in MQL5 - MQL5 Articles (2010)

The "handle" was misplaced in OnTick(), which seemed not serious for System-embedded indicators (MA,BAND...), is fatal for iCustom() functions.Learning materials I studied were evidently out-dated.

The other starts links are very helpful.  Thank you for very dedicated guidance.

Also Thank Carreiro.

 
Lei Zhu #: The "handle" was misplaced in OnTick(), which seemed not serious for System-embedded indicators (MA,BAND...), is fatal for iCustom() functions.Learning materials I studied were evidently out-dated. The other starts links are very helpful.  Thank you for very dedicated guidance. Also Thank Carreiro.

Please note that it is SERIOUS, even for System-embedded indicators (MA,BAND...). Do it in the OnInit() also for those cases too.

Reason: