Download MetaTrader 5
To add comments, please log in or register
The Market has more than 400 indicators. Try any of them!
Mycroft
7
Mycroft 2015.05.20 03:20 

New to these boards, greetings.

I use an entropy based indicator as a core element of my trading strategy.  This one in particular:

 

 https://www.mql5.com/en/code/8240

 

However, the drawing line in the indicator window that updates with tick movement, only works as intended when coupled with an offline chart attached to a normal chart with a period converter script running.

When used with an online chart, the line draws correct price movement for historical data(previous to current ticks), but current ticks leave the line at a flat zero(meaning no price movement), which is incorrect.  Normally I would consider this faulty indicator programming, but it does work with offline charts as intended.  And sometimes, it works for long periods of time on the online charts as well, long as in several minutes to an hour.  I have about 100+ indicators, and none have ever exhibited this issue.  Problematically, offline charts do not run well on my MT4 for whatever reason.  I use 9 indicators and run a high end PC, but the chart generally lags, runs very slowly, or eventually freezes.  

I use minimal settings for bar history, and any other optimizing feature in the MT4 settings.

Now, the only way to use the indicator effectively on an online chart is by refreshing it constantly, which present hazards for my 8 hour semi-automatic trading strategy.  Refreshing it shows the correct historical drawing line movement in the indicator window, but the leading tip of the line will snap back to a flat 0 reading after a tick movement.

Help or advice on this issue would be much appreciated.  I would also be willing to accept other entropy indicators that may be available(they seem to be rare?) so long as they follow the autoregression or maximum entropy method.

 

TLDR:

Indicator works in an offline mode chart that is attached to an online chart, but not within an online chart.

Thanks. 

whroeder1
13597
whroeder1 2015.05.20 11:52  
Mycroft:  Normally I would consider this faulty indicator programming, but it does work with offline charts as intended.  but the chart generally lags, runs very slowly, or eventually freezes.
  1. That is because it is faulty. Offline charts receive a refresh message and the indicator recalculates all bars (that's your lag.)  Reduce max bars on chart to something reasonable (1K?)
  2. Normal charts don't a receive a refresh message, (just new ticks,) and it should recalculate just bar zero. The indicator is broken.
  3. Current code. (I suspect that is the problem.)
    if(counted_bars>0) counted_bars--;
    int limit=Bars-counted_bars;
    if(counted_bars==0) limit-=1+numbars+1;
    for(i=0; i<limit; i++)
    Recalculate look back correctly (see Contradictory information on IndicatorCounted() - MQL4 forum)
    int lookback = numbars + 1;  // for(j<numbars+1) Close[in+j+1]
    int limit=Bars - MathMax(lookback, counted_bars);
    for(i=limit-1; i>=0; --i)
    You must count down when closing/deleting in a position loop. Get in the habit of always counting down. Indicator should so we don't have to check if they're repaintiing.

Mycroft
7
Mycroft 2015.05.20 19:52  
WHRoeder:
  1. That is because it is faulty. Offline charts receive a refresh message and the indicator recalculates all bars (that's your lag.)  Reduce max bars on chart to something reasonable (1K?)
  2. Normal charts don't a receive a refresh message, (just new ticks,) and it should recalculate just bar zero. The indicator is broken.
  3. Current code. (I suspect that is the problem.)
    Recalculate look back correctly (see Contradictory information on IndicatorCounted() - MQL4 forum)
    You must count down when closing/deleting in a position loop. Get in the habit of always counting down. Indicator should so we don't have to check if they're repaintiing.

Interesting.  So the online chart never refreshes, or just not on every tick?

I have a solution for the lag.  I'm just using a separate instance for every indicator in every chart.  Instead of 9 indicators in 1 chart, I have 9 charts with 1 of 9 indicators.

Regarding your code suggestion, that is a replacement, instead of an addition, correct?  Sorry, my understanding of code is very basic.

Thank you. 

/
To add comments, please log in or register