Download MetaTrader 5

SuperTrend Indicator to slow

To add comments, please log in or register
All activity of the MQL5.community members is displayed on a single page!
Botts
8
Botts 2012.04.20 05:25 

Hi,

I am using the SuperTrend indicator as part of an EA, but the indicator is very slow and is making the testing incredibly slow.

Can anyone help with how to speed it up?

Cheers

Paul

19730719
63
19730719 2012.04.20 08:49  
   if(counted_bars > 0) counted_bars--;
   limit=Bars-counted_bars;
   //Print(limit);
   
//----
   for (i = Bars; i >= 0; i--) { <---replace Bars with limit.
whroeder1
14504
whroeder1 2012.04.20 14:35  

i = Bars is wrong. You can't access Close[Bars], it does not exist.

limit = Bars - counted_bars is wrong. When counted_bars == 0 limit points beyond.

The decrement is unnecessary Contradictory information on IndicatorCounted() - MQL4 forum

for (i = Bars - 1 - counted_bars; i >= 0; i--) {
To add comments, please log in or register