Convert programs to class methods

 

Hi senior forum members,

I am learning how to use class to declare a group of functions to be methods of a class - which help the EA to be more semantic and more OOP-ish

Enclosed is the original EA which draw Support & Resistance lines and display some market characteristics base on the last closing price.

I attach the "using class" version of the code. When I compiled there is no error but when put into strategy tester the following error come up:

2019.12.11 14:42:01.567 2019.08.07 20:00:00  EATester_SRband.usingClass EURUSD,H1: array out of range in 'EATester_SRband.usingClass.mq4' (191,28)

I suspect the way I declare the methods inside the class is incorrect.

Can you advise what I 've done wrong. 

Thanks

Andre


 
Duc Anh Le:

Hi senior forum members,

I am learning how to use class to declare a group of functions to be methods of a class - which help the EA to be more semantic and more OOP-ish

Enclosed is the original EA which draw Support & Resistance lines and display some market characteristics base on the last closing price.

I attach the "using class" version of the code. When I compiled there is no error but when put into strategy tester the following error come up:

2019.12.11 14:42:01.567 2019.08.07 20:00:00  EATester_SRband.usingClass EURUSD,H1: array out of range in 'EATester_SRband.usingClass.mq4' (191,28)

I suspect the way I declare the methods inside the class is incorrect.

Can you advise what I 've done wrong. 

Thanks

Andre


Hi all, I just found out that for some reason, no rates data was not copied at this line while running the Strategy Tester in PERIOD_M30:

ArrayCopyRates(rates_tf2, Symbol(), SuppResisChkTF2)

But when I run the EA on chart with live tick, the rates did parsed in. So beside the issue with class declaration, is there also the issue come with the Strategy Tester not running ArrayCopyRates in TF2 (Period_H1)?