Indicators: Running Median Indicator for MT4 - page 2

 

I add this line in the code: (just before runmedian(limit);)

if(limit<period)limit=period;

because the indicator did not redraw on a new candle (as well as the current one)

with this I force the indicator recalculate the lastest candles and fill the working buffer, else the current and new candles will not have enough info to evaluate the median value.

 
Right. Good remark. We could also correct the function itself :

for (cursor=limit;cursor>=0;cursor--) {

->

for (cursor=MathMax(limit,period);cursor>=0;cursor--) {


willgart:

I add this line in the code: (just before runmedian(limit);)

if(limit<period)limit=period;

because the indicator did not redraw on a new candle (as well as the current one)

with this I force the indicator recalculate the lastest candles and fill the working buffer, else the current and new candles will not have enough info to evaluate the median value.

 

In metatrader 4 the median stops drawing, refresh doesn't work. The only way to let it redraw is to open the indicators list and adjust the median and press ok. Could there be an update please?

Later.....Oh sorry, I copied the text now and it worked, thank you. But the text isn't in the download yet.

 
When I use an expert advisor generator then this indicator doesn't work, I load it as a custom indicator but it doesn't work. It doesn't give any buy and sell signals. It is too difficult for me to understand how to edit all these things. Run median seems like a very good indicator. Is there anybody that can adjust this indicator so that it can be easily implemented for expert advisors?
 

Я все же не могу получить значения индикатора.

Print(iCustom(NULL,0,"RunMedian",RMA_period,"",0,0));

Возвращает: 2147483647.0

///----

 I still can't get the values indicator. 

 returns: 2147483647.0 

 
Thank you for this - just what I was looking for. Also, thank you to the poster for the current bar fix. Good stuff...
 
Yes!, thank you. And thank you Willgart for the fix!
Reason: