ChartIndicatorAdd and drawing style
I tested the EA in https://www.mql5.com/en/docs/chart_operations/chartindicatoradd and works well.
Now I wish modify indicator's style/width/color, is there a way?
Thanks
Nicola
Short answer, yes.
Check on this page to get you started.
I tried this solution, but doesn't work
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { int indicator_handle=iMA(Symbol(),0,_period,_shift,MODE_SMA,apr); if(indicator_handle==INVALID_HANDLE) { Print("Failed to create MA indicator. Error code ",GetLastError()); return(INIT_FAILED); } bool added=ChartIndicatorAdd(0,0,indicator_handle); if(!added) { PrintFormat("Failed to add MA indicator on %d chart window. Error code %d", 0,GetLastError()); return(INIT_FAILED); } PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_DASHDOT); // <------------------------- does nothing return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { // Expert Advisor performs nothing }
I tested the EA in https://www.mql5.com/en/docs/chart_operations/chartindicatoradd and works well.
Now I wish modify indicator's style/width/color, is there a way?
Thanks
Nicola
Add input parameters to indicator and then you can change them from external ea.
Add input parameters to indicator and then you can change them from external ea.
I tested the EA in https://www.mql5.com/en/docs/chart_operations/chartindicatoradd and works well.
Now I wish modify indicator's style/width/color, is there a way?
Thanks
Nicola