My Advisor with my Custom indicator not showing on chart

 

I am a somewhat newbie, been programming Mt4 for about 2 months.

Anyways, I developed this Custom indicator, not sure if its relevant but calculates everything from BAR 1 to +, basically always ignores BAR , calculation is only relevant on closed bar.

I have a developed an Expert Advisor that uses this indicator.

When I put the Advisor on a chart, it gets all the right values from the Indicator, but nothing is drawn on the chart. I manually have to add the custom indicator to visually see the lines that it creates.

What do I need to do to not have to add this manually? To have the Advisor reflect the indicator being used?  I tried WIndowRefresh to no avail.

Thank you!

 

Found my own answer, it looks its not quite possible in MT4.


I did however find a useful automated way to do https://www.mql5.com/en/forum/73391, which can be called on init. Left here as follows:


#import "user32.dll"
   int   RegisterWindowMessageW(string MessageName);
   int   PostMessageW(int hwnd,int msg,int wparam,uchar &Name[]);
   int   FindWindowW(string lpszClass,string lpszWindow);   
#import

#define VK_RETURN 13 //ENTER key

void StartCustomIndicator(int hWnd,string IndicatorName, string shortName, bool AutomaticallyAcceptDefaults=true) {
   Sleep(100);
   uchar name2[];
   StringToCharArray(IndicatorName,name2,0,StringLen(IndicatorName));
   int MessageNumber=RegisterWindowMessageW("MetaTrader4_Internal_Message");
   int r=PostMessageW(hWnd,MessageNumber,15,name2);
   Sleep(100);
   if(AutomaticallyAcceptDefaults) {
      int ind_settings = FindWindowW(NULL, "Custom Indicator - "+shortName);
      PostMessageW(ind_settings,0x100,VK_RETURN,name2);
   }
}
 

Hi there, 

I created a simple Grid indicator (different from the standard grid pattern of course), which compiled perfectly, and I can drag it onto the chart, but it shows NOTHING! I have changed the color and the width of the lines but still nothing. 

Anyone with an idea what this is about? I'm using MQL5 

regards, Frank 

Reason: