Download MetaTrader 5

Show progress of indicator - page 2

To add comments, please log in or register
whroeder1
15561
whroeder1  
angevoyageur: The bars from 897 to 2 are never calculated. I don't see how this is an answer to the OP.
So it needs to be fixed so next tick it does 897 to 797, etc.
   int iBar = rates_total - 1 - indicator_counted,
       iEnd = iBar - MAXCHUNK; if(iEnd < 0) iEnd = 0;
   for(; iBar >= iEnd iBar--){
      Buffer[iBar] = ...;
   }
   return(rates_total - 1 - iEnd); // ?
Never said I tested it. :)
Ian Venner
2584
Ian Venner  
WHRoeder:

False. On a disconnect/reconnect, only Bars changes, the old IndicatorCounted() doesn't, so it only processes the new bars. Only on older history download would IndicatorCounted return zero. Same for the new prev_calculated: "if since the last call of OnCalculate() price data has changed (a deeper history downloaded or history blanks filled), the value of the input parameter prev_calculated will be set to zero by the terminal."


No, my previous post was correct I have previously tested for this undocumented behaviour, because it caused me some issues.

Bars is never reset to zero. IndicatorCounted() resets to zero but not immediately on reconnect, it will return its previous value for two ticks, then it will return its previous value+1 for two more ticks, then it will reset to zero ... I didn't entirely figure out the reasons for these behaviours, you can see from the logs what it does:


2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250035 //---- Several more ticks after this one will continue arriving in rapid succession
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250035 //---- Notice these ticks have been arriving in rapid succession (probably artificial)
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250035 //---- IndicatorCounted now begins including filled in bars.
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 0 //------------ On the 4th tick after reconnect, IndicatorCounted resets to zero, entire chart redrawn.
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250028 //---- 3rd tick IndicatorCounted() returns the old value+1
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250028 //---- 2nd tick: IndicatorCounted() returns the old value+1
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250027 //---- 1st tick: IndicatorCounted() returns old value again.
2014.02.20 15:32:15 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250027 //---- Internet Resonnected several bars later. IndicatorCounted returns old value (as before disconnect).
2014.02.20 15:23:42 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250027 //---- Internet Disconnected
2014.02.20 15:23:39 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250027
2014.02.20 15:23:34 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250026
2014.02.20 15:23:28 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250026
2014.02.20 15:23:21 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250026 //---- notice ticks arriving several seconds apart
2014.02.20 15:23:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 0 //------------IndicatorCounted() initial value, entire chart drawn in loop.
2014.02.20 15:23:14 IndicatorCounted EURUSD,M1: initialized

whroeder1
15561
whroeder1  
SDC: No, my previous post was correct I have previously tested for this undocumented behaviour, because it caused me some issues. Bars is never reset to zero.
  1. No, both are posts were correct. I stated that IndicatorCounted didn't change, and your log shows that I was correct. It also shows that afterwards you get a zero and you are correct.
  2. I never said Bars resets to zero.
  3. Now someone (you) needs to see if the new OnCalculate has the same problem.
Ian Venner
2584
Ian Venner  

I was planning to lol ... I'll start a new thread I might copy that IndicatorCounted test to it too.

Ian Venner
2584
Ian Venner  

I didnt start a new thread because it is mentioned in the docs that prev_calculated also resets to zero when chart history is added, it does very similar to IndicatorCounted().

You can see rates_previous operates almost identical to IndicatorCounted()

prev_counted == IndicatorCounted() - 1 except on inital zero and history added, then prev_calculated == IndicatorCounted().

Internet disconnect causes identical behaviour.

2014.02.25 16:22:15.997 Test indicator loop EURUSD,M1: uninit reason 1
2014.02.25 16:22:11.545 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:10.418 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:09.936 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:08.744 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:07.037 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:00.103 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.049 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.002 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:53.965 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:53.923 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:53.882 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 0 prev_calculated = 0 //------------------- Reset to zero
2014.02.25 16:21:53.791 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236
2014.02.25 16:21:51.498 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236 //---- Internet Reconnected
2014.02.25 16:10:00.709 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236 //---- Internet Disconnected
2014.02.25 16:10:00.255 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236
2014.02.25 16:09:59.788 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236
2014.02.25 16:09:59.337 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236
2014.02.25 16:09:58.924 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251234 prev_calculated = 251235
2014.02.25 16:09:40.369 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251234 prev_calculated = 251235
2014.02.25 16:09:31.285 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251234 prev_calculated = 251235
2014.02.25 16:09:30.960 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 0 prev_calculated = 0 //------------------ Initial zero
2014.02.25 16:09:30.960 Test indicator loop EURUSD,M1: initialized

12
To add comments, please log in or register