Any ideas why my custom indicators are blank when I start the terminal in the morning? - page 3

 
KeyserSoze42 #:

I suspect the problem to be related to how CIndicator handles missing data from its buffer. refer to the source code on Indicator.mqh for the next statements. the Refresh function does not return any value, and ignores the value returned by its buffer. when the buffer refreshes, it runs CopyBuffer. when the returned value is < 0, CIndicator does nothing with that information. supposing that is the failure, I cannot see how that would lead to the indicator deleting the data that already populated the custom indicator buffer, and not thrown any exception/error. I expected for previous buffer content to remain, thus leaving the indicator simply not updating, but still shown on screen.

That sounds an awful lot like the end product of iMA() or iCustom() (Commented out in my code template, above).

if(CopyBuffer(handle_indicator, 0, 0, copyBars, buff_indicator) <= 0)
     return(0);

Theoretically, your fix should work.