MQL4 Add indicator to chart from EA - page 7

 

Has no one an answer to that?

Is there any possibility to do that?

 
EA_Trader1 #:

Hi all,

I have also used the code from @Hossein Sadeghian Nezhad and it works pretty good - thanks for that!

However, I want to add custom indicators on the main chart with specific input variables. When using the code above, you can't change the the input values, it will only show the indicator with "standard" settings.

How can I show the custom indicator in the chart with other input values?

Thanks in advance for feedback!

I had some success altering programmatically the template file you can use to load a chart with your indicator....
 
andrew4789 #:
I had some success altering programmatically the template file you can use to load a chart with your indicator....
Hi Andrew,
thank you for your comment.

Did you use the template from @Hossein Sadeghian Nezhad? If yes, how can you implement that in this template?
Hossein Sadeghian Nezhad
Hossein Sadeghian Nezhad
  • 2017.06.15
  • www.mql5.com
Trader's profile
 
Hello dear friends
This code works without any problems

It is enough to call the function with the name of the indicator


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



void Add_Indicator(string IndicatorName)
 {
  int iwin=WindowFind(IndicatorName);
  if(iwin<0) //---------------------------------------------------------------------Add in Chart
    {
      uchar name2[];
      for(int i=0;i<StringLen(IndicatorName);i++)
        {
         ArrayResize(name2,ArraySize(name2)+1,0);
         uchar name1=StringGetChar(StringSubstr(IndicatorName,i,1),0);
         name2[i]=name1;
        }
      ArrayResize(name2,ArraySize(name2)+1,0);
      int MessageNumber=RegisterWindowMessageW("MetaTrader4_Internal_Message");
      int hWnd=WindowHandle(Symbol(),0);
      int r=PostMessageW(hWnd,MessageNumber,15,name2);
    }
  else
    {
     ChartIndicatorDelete(0,0,IndicatorName); //------------------------------------ Delleted in Chart
    }
 }