How to display indicator from EA code and have this indicator merged with chart

 

Hello,

Here is what I have done so far:

#include <Trade/Trade.mqh>
CTrade trade;
int maHandle;

int OnInit()
  {
   maHandle= iMA(_Symbol, PERIOD_CURRENT, 21, 0, MODE_SMMA, PRICE_CLOSE);
   int subwindow=(int)ChartGetInteger(0,CHART_WINDOWS_TOTAL);
   ChartIndicatorAdd(0,subwindow,maHandle);
   return 0;
   }

Which gives something like:


But how do I make the MA "merged" with the candles ? Like I would do in Tradingview


Thanks

 
AYMERIC75: But how do I make the MA "merged" with the candles ? 

Begin by stop lying to us. Your code is using RSI, your image show MA.

Show us your code where you added a MA to the main window and state your problem.

 
William Roeder #:

Begin by stop lying to us. Your code is using RSI, your image show MA.

Show us your code where you added a MA to the main window and state your problem.

Why would I lie lol ? just the wrong picture uploaded...
 
AYMERIC75 #: Why would I lie lol ? just the wrong picture uploaded...
An RSI can't be merged with the main chart. It has different units and scale!
 
Fernando Carreiro #:
An RSI can't be merged with the main chart. It has different units and scale!
yes, as I said I updated my post accordingly, it's all about moving averages now..
 
AYMERIC75 #: yes, as I said I updated my post accordingly, it's all about moving averages now..

No you did not! Your code still shows you using iRSI, and not iMA. If you use iMA it will display on the main chart. You will have to use a subwindow of "0" (main chart), however.

Also, your topic has been moved to the section: Expert Advisors and Automated Trading — In the future, please consider which section is most appropriate for your query.

 
Fernando Carreiro #:

No you did not! Your code still shows you using iRSI, and not iMA. If you use iMA it will display on the main chart. You will have to use a subwindow of "0" (main chart), however.

Also, your topic has been moved to the section: Expert Advisors and Automated Trading — In the future, please consider which section is most appropriate for your query.

Indeed, sorry ! updated now.


Ok, the subwindow to 0 works, thanks a lot!